You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mm...@apache.org on 2007/10/24 20:06:28 UTC

svn commit: r587941 - in /myfaces/core/branches/1_2_1/api/src/main/java/javax/faces: component/UIComponent.java render/Renderer.java

Author: mmarinschek
Date: Wed Oct 24 11:06:27 2007
New Revision: 587941

URL: http://svn.apache.org/viewvc?rev=587941&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-1751 (MYFACES-1751): reverted the changes - added better java-doc comments to the Renderer and UIComponent class

Modified:
    myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/UIComponent.java
    myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/render/Renderer.java

Modified: myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/UIComponent.java?rev=587941&r1=587940&r2=587941&view=diff
==============================================================================
--- myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/UIComponent.java (original)
+++ myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/component/UIComponent.java Wed Oct 24 11:06:27 2007
@@ -234,18 +234,18 @@
     		this.encodeBegin(context);
     		
     		//rendering children
-    		if(!this.getRendersChildren())
+    		if(this.getRendersChildren())
     		{
     			this.encodeChildren(context);
     		}
     		//let children render itself
     		else
     		{
-    			List<UIComponent> comps = this.getChildren();
-    			for (Iterator<UIComponent> iter = comps.iterator(); iter.hasNext();)
-    			{
-					iter.next().encodeAll(context);;
-				}
+          if(this.getChildCount()>0) {
+      			for (UIComponent comp : this.getChildren()) {
+    					comp.encodeAll(context);
+    				}
+          }
     		}
             this.encodeEnd(context);
     	}

Modified: myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/render/Renderer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/render/Renderer.java?rev=587941&r1=587940&r2=587941&view=diff
==============================================================================
--- myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/render/Renderer.java (original)
+++ myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/render/Renderer.java Wed Oct 24 11:06:27 2007
@@ -45,48 +45,65 @@
         if (component == null) throw new NullPointerException("component");
     }
 
+    /**Render all children if there are any.
+     * 
+     * Note: this will only be called if getRendersChildren()
+     * returns true. A component which has a renderer with
+     * getRendersChildren() set to true will typically contain
+     * the rendering logic for its children in this method.
+     * 
+     * @param context
+     * @param component
+     * @throws IOException
+     */
     public void encodeChildren(FacesContext context,
                                UIComponent component)
-            throws IOException
-    {
+            throws IOException {
         if (context == null) throw new NullPointerException("context");
         if (component == null) throw new NullPointerException("component");
         
-        List children = component.getChildren();
-        for (int i=0; i<children.size(); i++) 
-        {
-            UIComponent child = (UIComponent) children.get(i);
-            
-            if (!child.isRendered())
-            {
-                continue;
-            }
-
-            child.encodeBegin(context);
-            if (!child.getRendersChildren())
-            {
-                child.encodeChildren(context);
-            }
-            child.encodeEnd(context);
+        if(component.getChildCount()>0) {
+          for (UIComponent child : component.getChildren()) {
+              if (!child.isRendered()) {
+                  continue;
+              }
+  
+              child.encodeAll(context);
+          }
         }
     }
 
     public void encodeEnd(FacesContext context,
                           UIComponent component)
-            throws IOException
+            throws IOException 
     {
         if (context == null) throw new NullPointerException("context");
         if (component == null) throw new NullPointerException("component");
     }
 
     public String convertClientId(FacesContext context,
-                                  String clientId)
+                                  String clientId) 
     {
         if (context == null) throw new NullPointerException("context");
         if (clientId == null) throw new NullPointerException("clientId");
         return clientId;
     }
 
+    /**Switch for deciding who renders the children.
+     * 
+     * @return <b>true</b> - if the component takes care of rendering its
+     * children. In this case, encodeChildren() ought to be called
+     * by the rendering controller (e.g., the rendering controller
+     * could be the method encodeAll() in UIComponent). 
+     * In the method encodeChildren(), the component
+     * should therefore provide all children encode logic.
+     * <br/>
+     * <b>false</b> - if the component does not take care of rendering its
+     * children. In this case, encodeChildren() should not be called
+     * by the rendering controller. Instead, the children-list should
+     * be retrieved and the children should directly be rendered by
+     * the rendering controller one by one.
+     */
     public boolean getRendersChildren()
     {
         return false;