You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sc...@apache.org on 2006/02/18 22:31:09 UTC

svn commit: r378782 - /myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java

Author: schof
Date: Sat Feb 18 13:31:07 2006
New Revision: 378782

URL: http://svn.apache.org/viewcvs?rev=378782&view=rev
Log:
Fixes MYFACES-690 (Patch by Marius Kreis)

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/viewcvs/myfaces/tomahawk/trunk/core/src/main/java/org/apache/myfaces/custom/tree2/HtmlTreeRenderer.java?rev=378782&r1=378781&r2=378782&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 Feb 18 13:31:07 2006
@@ -567,18 +567,25 @@
         }
         else
         {
-            // set up the expand control and remove whatever children (if any) this control had previously
-            UICommand expandControl = tree.getExpandControl();
-            expandControl.getChildren().clear();
-            expandControl.setId(TOGGLE_ID);
+            if (node.getChildCount() > 0)
+            {
+                // set up the expand control and remove whatever children (if any) this control had previously
+                UICommand expandControl = tree.getExpandControl();
+                expandControl.getChildren().clear();
+                expandControl.setId(TOGGLE_ID);
 
-            UIParameter param = new UIParameter();
-            param.setName(tree.getId() + NamingContainer.SEPARATOR_CHAR + NAV_COMMAND);
-            param.setValue(tree.getNodeId());
-            expandControl.getChildren().add(param);
-            expandControl.getChildren().add(image);
+                UIParameter param = new UIParameter();
+                param.setName(tree.getId() + NamingContainer.SEPARATOR_CHAR + NAV_COMMAND);
+                param.setValue(tree.getNodeId());
+                expandControl.getChildren().add(param);
+                expandControl.getChildren().add(image);
 
-            RendererUtils.renderChild(context, expandControl);
+                RendererUtils.renderChild(context, expandControl);
+            }
+            else
+            {
+                RendererUtils.renderChild(context, image);
+            }
         }
         out.endElement(HTML.TD_ELEM);