myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu4...@apache.org
Subject svn commit: r635101 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
Date Sat, 08 Mar 2008 22:40:20 GMT
Author: lu4242
Date: Sat Mar  8 14:40:04 2008
New Revision: 635101

URL: http://svn.apache.org/viewvc?rev=635101&view=rev
Log:
fix TOMAHAWK-1179 Tree2 renders duplicate Id's for icons

Modified:
    myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java

Modified: myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java?rev=635101&r1=635100&r2=635101&view=diff
==============================================================================
--- myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
(original)
+++ myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java
Sat Mar  8 14:40:04 2008
@@ -70,6 +70,7 @@
     private static final int EXPANDED = 2;
     private static final int LINES = 4;
     private static final int LAST = 8;
+    private int counter = 0;
 
     // see superclass for documentation
     public boolean getRendersChildren()
@@ -497,7 +498,8 @@
 
 //      add the appropriate image for the nav control
         UIGraphic image = new UIGraphic();
-        image.setId(IMAGE_PREFIX);
+        String imageId = IMAGE_PREFIX+(counter++);
+        image.setId(imageId);
         image.setUrl(navSrcUrl);
         Map imageAttrs = image.getAttributes();
         imageAttrs.put(HTML.WIDTH_ATTR, "19");
@@ -521,7 +523,7 @@
                 expandImgSrc = context.getApplication().getViewHandler().getResourceURL(context,
expandImg.getUrl());
                 if (expandImg.isRendered())
                 {
-                    expandImg.setId(IMAGE_PREFIX + NODE_STATE_EXPANDED);
+                    expandImg.setId(imageId + NODE_STATE_EXPANDED);
                     expandImg.setParent(tree);
                     nodeImageId = expandImg.getClientId(context);
                     nodeImgFacet = expandFacet;
@@ -535,7 +537,7 @@
                 collapseImgSrc = context.getApplication().getViewHandler().getResourceURL(context,
collapseImg.getUrl());
                 if (collapseImg.isRendered())
                 {
-                    collapseImg.setId(IMAGE_PREFIX + NODE_STATE_CLOSED);
+                    collapseImg.setId(imageId + NODE_STATE_CLOSED);
                     collapseImg.setParent(tree);
                     nodeImageId = collapseImg.getClientId(context);
                     nodeImgFacet = collapseFacet;



Mime
View raw message