You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ms...@apache.org on 2010/07/12 20:22:58 UTC

svn commit: r963415 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java

Author: mstarets
Date: Mon Jul 12 18:22:57 2010
New Revision: 963415

URL: http://svn.apache.org/viewvc?rev=963415&view=rev
Log:
TRINIDAD-1847 - processFlattenedChildren should treat UIPanel and UINamingContainer as FlattenedComponents

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?rev=963415&r1=963414&r2=963415&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java Mon Jul 12 18:22:57 2010
@@ -28,6 +28,8 @@ import javax.el.MethodExpression;
 import javax.faces.component.NamingContainer;
 import javax.faces.component.StateHelper;
 import javax.faces.component.UIComponent;
+import javax.faces.component.UINamingContainer;
+import javax.faces.component.UIPanel;
 import javax.faces.component.visit.VisitCallback;
 import javax.faces.component.visit.VisitContext;
 import javax.faces.component.visit.VisitHint;
@@ -164,21 +166,45 @@ abstract public class UIXComponent exten
       }
       else
       {
-        // not a FlattenedComponent, pass the component directly to the ComponentProcessor
+        boolean processed = true;
         child.pushComponentToEL(context, null);
 
         try
         {
-          childProcessor.processComponent(context, cpContext, child, callbackContext);
+          // Optimize the cases of UINamingContainer (<f:subview>) and UIPanel -
+          // we will treat these components as FlattenedComponents because they do not render
+          // any DOM
+          // Note that JSF 2.0 creates UIPanel wrappers around multiple components
+          // inside of <f:facet>
+          if (UINamingContainer.class == child.getClass() ||
+              UIPanel.class == child.getClass())
+          {
+            processed =
+                processFlattenedChildren(context, cpContext, childProcessor,
+                                         child.getChildren(),
+                                         callbackContext);
+          }
+          else
+          {
+            try
+            {
+              // not a FlattenedComponent, pass the component directly to the ComponentProcessor
+              childProcessor.processComponent(context, cpContext, child,
+                                              callbackContext);
+            }
+            finally
+            {
+              // if startDepth is > 0, only the first visible child will be marked as starting a group
+              cpContext.resetStartDepth();
+            }
+          }
         }
         finally
         {
-          // if startDepth is > 0, only the first visible child will be marked as starting a group
-          cpContext.resetStartDepth();
           child.popComponentFromEL(context);
         }
 
-        return true;
+        return processed;
       }
     }
     else