You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/03/21 15:24:05 UTC

svn commit: r1083799 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeCommandRenderer.java

Author: lofwyr
Date: Mon Mar 21 14:24:05 2011
New Revision: 1083799

URL: http://svn.apache.org/viewvc?rev=1083799&view=rev
Log:
TOBAGO-377: Tree
 - A tree command inside a disabled tree node is also disabled

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeCommandRenderer.java

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeCommandRenderer.java?rev=1083799&r1=1083798&r2=1083799&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeCommandRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TreeCommandRenderer.java Mon Mar 21 14:24:05 2011
@@ -19,6 +19,7 @@ package org.apache.myfaces.tobago.render
 
 import org.apache.myfaces.tobago.component.Attributes;
 import org.apache.myfaces.tobago.component.UITreeCommand;
+import org.apache.myfaces.tobago.component.UITreeNode;
 import org.apache.myfaces.tobago.internal.component.AbstractUICommand;
 import org.apache.myfaces.tobago.internal.util.AccessKeyMap;
 import org.apache.myfaces.tobago.renderkit.CommandRendererBase;
@@ -43,6 +44,18 @@ public class TreeCommandRenderer extends
 
   private static final Logger LOG = LoggerFactory.getLogger(TreeCommandRenderer.class);
 
+  @Override
+  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
+    final UITreeCommand command = (UITreeCommand) component;
+    final UITreeNode node = ComponentUtils.findAncestor(command, UITreeNode.class);
+    if (node.isDisabled()) {
+      command.setDisabled(true);
+    }
+
+    super.prepareRender(facesContext, component);
+  }
+
+  @Override
   public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
 
     UITreeCommand command = (UITreeCommand) component;
@@ -91,6 +104,7 @@ public class TreeCommandRenderer extends
     return new Style(facesContext, link);
   }
 
+  @Override
   public void encodeEnd(FacesContext facesContext, UIComponent component)
       throws IOException {
     ResponseWriter writer = facesContext.getResponseWriter();