mind serializer and weblog
[ start | index | login ]
start > source-changed-AtoZListFormatter

source-changed-AtoZListFormatter

Created by case. Last edited by case, 3 years and 96 days ago. Viewed 66 times. #2
[diff] [history] [edit] [rdf]
labels
attachments

Reason

Index is rendered without namespaces and entries with equal names but different namespaces are not shown.

Updated org.snipsnap.render.macro.list.AtoZListFormatter

Index: src/org/snipsnap/render/macro/list/AtoZListFormatter.java
===================================================================
RCS file: /var/cvs/snip/src/org/snipsnap/render/macro/list/AtoZListFormatter.java,v
retrieving revision 1.3
diff -u -r1.3 AtoZListFormatter.java
--- src/org/snipsnap/render/macro/list/AtoZListFormatter.java	17 May 2004 10:56:17 -0000	1.3
+++ src/org/snipsnap/render/macro/list/AtoZListFormatter.java	21 Oct 2004 11:18:07 -0000
@@ -40,7 +40,9 @@
  * @version $Id: AtoZListFormatter.java,v 1.3 2004/05/17 10:56:17 leo Exp $
  */
 public class AtoZListFormatter implements ListFormatter {
-  public String getName() {
+    private Map namespaceMap = new HashMap();
+    
+    public String getName() {
     return "atoz";
   }

@@ -75,10 +77,25 @@ } String finalName = removeParents(name); indexChar = finalName.substring(0, 1).toUpperCase(); + + int length = name.length() - finalName.length(); + if (length > 0){ + --length; + } + String namespace; + if (length > 0){ + namespace = name.substring(0, length); + finalName += " " + namespace; + } else { + namespace = null; + } + if (object instanceof Linkable) { name = ((Linkable) object).getLink(); }

+ namespaceMap.put(name, namespace); + if (indexChar.charAt(0) >= 'A' && indexChar.charAt(0) <= 'Z') { if (!atozMap.containsKey(indexChar)) { atozMap.put(indexChar, new TreeMap()); @@ -159,11 +176,30 @@

while (leftIt.hasNext() || rightIt.hasNext()) { String leftName = (String) (leftIt != null && leftIt.hasNext() ? leftIt.next() : null); + leftName = addNamespace(leftName); + String rightName = (String) (rightIt != null && rightIt.hasNext() ? rightIt.next() : null); + rightName = addNamespace(rightName); insertRow(writer, leftName, rightName, false); } }

+ /** + * @param name + * @return + */ + private String addNamespace(String name) + { + String namespace = (String) namespaceMap.get(name); + if (null == namespace){ + return name; + } + if (namespace.length() != 0){ + name += " ("+namespace+")"; + } + return name; + } + private void insertCharHeader(Writer writer, String leftHeader, String rightHeader) throws IOException { writer.write("<tr><th>"); writer.write("<b><a name="idx");

no comments | post comment
Quick Links
WhatIsThis about?
Midlets (mobile apps)
TimeLine
Charley a dog's life
MovieReview
Impressum
Project (internal)

Logged in Users: (2)
… and 11 Guests.

< July 2008 >
SunMonTueWedThuFriSat
12345
6789101112
13141516171819
20212223242526
2728293031

Icon-Snip more changes...

Blogs
>>++ vox.machina ++
>>Zitate - Sprüche - Aphorismen
>>Wil Wheaton
>>Mathematische Kleinigkeiten
>>William Gibson
>>instant-thinking
>>Over heard in NY

nearby  sites
link=http://www.mozilla.org/products/firefox/central.html
link=http://www.nutellausa.com/
link=http://snipsnap.org
link=http://www.amazon.de/exec/obidos/registry/wishlist/ref=cs_nav_top_2/028-7651535-0049343
RSS Feed RSS Feed
post to del.icio.us

Stats: 1174 snips by 16 users
created 5 years and 186 days ago

Powered by
>>SnipSnap 1.0b2-uttoxeter
with SnipScale 1.1.0



This work is licensed under a
>>Creative Commons License.

SEARCH