myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject svn commit: r1070523 - /myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
Date Mon, 14 Feb 2011 15:31:34 GMT
Author: andys
Date: Mon Feb 14 15:31:33 2011
New Revision: 1070523

URL: http://svn.apache.org/viewvc?rev=1070523&view=rev
Log:
TRINIDAD-2030 Honor SKIP_ITERATION FacesContext property

UIXComponent.visitChildren() now checks for the "javax.faces.visit.SKIP_ITERATION" property
instead of for PhaseId.RESTORE_VIEW when deciding whether or not to iterate.

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=1070523&r1=1070522&r2=1070523&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 Feb 14 15:31:33 2011
@@ -22,6 +22,7 @@ import java.io.IOException;
 
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Map;
 
 import javax.el.MethodExpression;
 
@@ -654,12 +655,8 @@ abstract public class UIXComponent exten
     try
     {
       // 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)
+      // even call the protected hook.
+      doneVisiting =  (_isSkipIterationVisit(visitContext))
                         ? uixParentComponent._visitAllChildren(visitContext, callback)
                         : uixParentComponent.visitChildren(visitContext, callback);
     }
@@ -825,6 +822,18 @@ abstract public class UIXComponent exten
   }
 
   /**
+   * Tests whether we should skip iteration during this visit
+   */
+  private static boolean _isSkipIterationVisit(VisitContext visitContext)
+  {
+    FacesContext context = visitContext.getFacesContext();
+    Map<Object, Object> attrs = context.getAttributes();
+    Object skipIteration = attrs.get("javax.faces.visit.SKIP_ITERATION");
+
+    return Boolean.TRUE.equals(skipIteration);
+  }
+
+  /**
    * <p>
    * Called when visiting the component during optimized partial page encoding so that the
    * component can modify what is actually encoded.  For example tab controls often



Mime
View raw message