myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bsulli...@apache.org
Subject svn commit: r919247 - /myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
Date Fri, 05 Mar 2010 00:41:47 GMT
Author: bsullivan
Date: Fri Mar  5 00:41:47 2010
New Revision: 919247

URL: http://svn.apache.org/viewvc?rev=919247&view=rev
Log:
Don't iterate in tree visiting when visiting children during state restoration

Modified:
    myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java

Modified: myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?rev=919247&r1=919246&r2=919247&view=diff
==============================================================================
--- myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
(original)
+++ myfaces/trinidad/branches/trinidad-2.0.x/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
Fri Mar  5 00:41:47 2010
@@ -28,7 +28,6 @@
 import javax.faces.component.NamingContainer;
 import javax.faces.component.StateHelper;
 import javax.faces.component.UIComponent;
-import javax.faces.component.UINamingContainer;
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseId;
 import javax.faces.render.Renderer;
@@ -352,9 +351,23 @@
     VisitContext visitContext,
     VisitCallback callback)
   {
+    // visit all of the chikldren of the component
+    return _visitAllChildren(visitContext, callback);
+  }
+ 
+  /**
+   * Default implementation of visiting children that visits all children without iterating
+   * @param visitContext the <code>VisitContext</code> for this visit
+   * @param callback the <code>VisitCallback</code> instance
+   * @return <code>true</code> if the visit is complete.
+   */
+  private boolean _visitAllChildren(
+    VisitContext visitContext,
+    VisitCallback callback)
+  {
     // visit the children of the component
     Iterator<UIComponent> kids = getFacetsAndChildren();
-
+  
     while(kids.hasNext())
     {
       // If any kid visit returns true, we are done.
@@ -366,7 +379,7 @@
     
     return false;
   }
-  
+   
   /**
    * Returns <code>true</code> if the components are being visited
    * for the purpose of encoding.
@@ -475,7 +488,15 @@
             
             try
             {
-              doneVisiting =  uixComponent.visitChildren(visitContext, callback);
+              // determine whether this visit should be iterating.  If it shouldn't, don't
+              // even call the protected hook.  We currently don't iterate during the
+              // restore view phase when we are visiting all of the components.
+              boolean noIterate = (visitContext.getIdsToVisit() == VisitContext.ALL_IDS)
&&
+                                  (context.getCurrentPhaseId() == PhaseId.RESTORE_VIEW);
+                
+              doneVisiting =  (noIterate)
+                                ? uixComponent._visitAllChildren(visitContext, callback)
+                                : uixComponent.visitChildren(visitContext, callback);
             }
             finally
             {



Mime
View raw message