You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ar...@apache.org on 2010/07/21 00:35:52 UTC

svn commit: r966043 [2/2] - in /myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2: ./ trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/ trinidad-api/src/main/java-templates/org/apache/myfaces/trinidad/component/core/layo...

Modified: myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java?rev=966043&r1=966042&r2=966043&view=diff
==============================================================================
--- myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java (original)
+++ myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXComponent.java Tue Jul 20 22:35:51 2010
@@ -251,7 +251,7 @@ abstract public class UIXComponent exten
   {
     ComponentProcessingContext processingContext = new ComponentProcessingContext();
     processingContext.__setIsRendering();
-    
+
     return processFlattenedChildren(context,
                                     processingContext,
                                     childProcessor,
@@ -327,6 +327,81 @@ abstract public class UIXComponent exten
   }
 
   /**
+   * Hook for subclasses to override the manner in which the component's children are visited.  The default
+   * implementation visits all of the children and facets of the Component.
+   * <code>setupChildrenVisitingContext</code> will have been called before this method is
+   * invoked and <code>tearDownChildrenVisitingContext</code> will be called after.
+   * respectively.  If the purpose of this visit was to encode the component and the
+   * component uses a CoreRenderer, the CoreRenderer's
+   * <code>setupChildrenEncodingContext</code> and <code>tearDownChildrenEncodingContext</code>
+   * will be called before and after this method is invoked, respectively.
+   * @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.
+   * @see #setupChildrenVisitingContext
+   * @see #tearDownChildrenVisitingContext
+   * @see org.apache.myfaces.trinidad.render.CoreRenderer#setupChildrenEncodingContext
+   * @see org.apache.myfaces.trinidad.render.CoreRenderer#tearDownChildrenEncodingContext
+   */
+  protected boolean visitChildren(
+    VisitContext  visitContext,
+    VisitCallback callback)
+  {
+    // See if this is during encoding, if so, allow the renderer to control the visitation of
+    // the children so that any special encoding context may be applied around the visitation
+    // of each child.
+    if (_isEncodingVisit(visitContext))
+    {
+      Renderer renderer = getRenderer(visitContext.getFacesContext());
+      if (renderer instanceof CoreRenderer)
+      {
+        CoreRenderer coreRenderer = (CoreRenderer)renderer;
+        return coreRenderer.visitChildrenForEncoding(this, visitContext, callback);
+      }
+    }
+
+    // visit all of the children of the component
+    return _visitAllChildren(this, 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 static boolean _visitAllChildren(
+    UIComponent   component,
+    VisitContext  visitContext,
+    VisitCallback callback)
+  {
+    // visit the children of the component
+    Iterator<UIComponent> kids = component.getFacetsAndChildren();
+
+    while (kids.hasNext())
+    {
+      // If any kid visit returns true, we are done.
+      UIComponent kid = kids.next();
+      if (kid instanceof UIXComponent)
+      {
+        if (((UIXComponent)kid).visitTree(visitContext, callback))
+        {
+          return true;
+        }
+      }
+      else
+      {
+        if (visitTree(visitContext, kid, callback))
+        {
+          return true;
+        }
+      }
+    }
+
+    return false;
+  }
+
+  /**
   * <p>Perform a tree visit starting at the specified node in the tree.</p>
   *
   * <p>UIXComponent.visitTree() implementations do not invoke the
@@ -350,7 +425,7 @@ abstract public class UIXComponent exten
   * @see VisitContext#invokeVisitCallback VisitContext.invokeVisitCallback()
   */
   public static boolean visitTree(
-    VisitContext visitContext,
+    VisitContext  visitContext,
     UIComponent   component,
     VisitCallback callback)
   {
@@ -374,106 +449,113 @@ abstract public class UIXComponent exten
       uixComponent = null;
     }
 
-    // invoke the callback for this component
-    VisitResult result = visitContext.invokeVisitCallback(component, callback);
-
-    if (result == VisitResult.COMPLETE)
-      return true;
-    else if (result == VisitResult.ACCEPT)
-    {
-      // now visit the children
-      FacesContext context = visitContext.getFacesContext();
-      PhaseId phaseId = visitContext.getPhaseId();
-      RenderingContext rc = (PhaseId.RENDER_RESPONSE == phaseId)
-                              ? RenderingContext.getCurrentInstance()
-                              : null;
-
-      if (uixComponent != null)
+    FacesContext facesContext = visitContext.getFacesContext();
+    RenderingContext rc = null;
+    if (uixComponent != null)
+    {
+      // We only need the rendering context if we are visiting a UIXComponent
+      rc = (uixComponent != null && _isEncodingVisit(visitContext))
+                                  ? RenderingContext.getCurrentInstance()
+                                  : null;
+
+      // UIXComponents are allowed to set up their context differently for encoding
+      // than normal processing, so behave differently if this is the RenderResponse
+      // phase
+      if (rc != null)
       {
-        // assume that all UIXComponent NamingContainers always act as NamingContainers,
-        // (unlike <h:form>) and this it is OK to put the optimization where we
-        // don't visit the children if we know that we don't have any ids in this
-        // subtree to visit
-        if (uixComponent instanceof NamingContainer)
-        {
-          if (visitContext.getSubtreeIdsToVisit(uixComponent).isEmpty())
-            return false;
-        }
-
-        // UIXComponents are allowed to set up their context differently for encoding
-        // than normal processing, so behave differently if this is the RenderResponse
-        // phase
-        if (PhaseId.RENDER_RESPONSE == phaseId)
-        {
-          uixComponent.setUpEncodingContext(context, rc);
-        }
-        else
-        {
-          uixComponent.setupVisitingContext(context);
-        }
+        uixComponent.setUpEncodingContext(facesContext, rc);
       }
       else
       {
-        // we only optimize walking into non-UIXComponent NamingContainers
-        // if they are UINamingConainer (which is used by <f:subview>
-        if (UINamingContainer.class == component.getClass())
-        {
-          if (visitContext.getSubtreeIdsToVisit(component).isEmpty())
-            return false;
-        }
+        uixComponent.setupVisitingContext(facesContext);
       }
+    }
+    try
+    {
+      // invoke the callback for this component
+      VisitResult result = visitContext.invokeVisitCallback(component, callback);
 
-      // visit the children of the component
-      try
+      if (result == VisitResult.COMPLETE)
+        return true;
+      else if (result == VisitResult.ACCEPT)
       {
-        Iterator<UIComponent> kids = component.getFacetsAndChildren();
-
-        while(kids.hasNext())
+        // now visit the children
+        if (uixComponent != null)
         {
-          boolean done;
-
-          UIComponent currChild = kids.next();
-
-          if (currChild instanceof UIXComponent)
+          // assume that all UIXComponent NamingContainers always act as NamingContainers,
+          // (unlike <h:form>) and this it is OK to put the optimization where we
+          // don't visit the children if we know that we don't have any ids in this
+          // subtree to visit
+          if (uixComponent instanceof NamingContainer)
           {
-            UIXComponent uixChild = (UIXComponent)currChild;
-
-            // delegate to UIXComponent's visitTree implementation to allow
-            // subclassses to modify the behavior
-            done = uixChild.visitTree(visitContext, callback);
+            if (visitContext.getSubtreeIdsToVisit(uixComponent).isEmpty())
+              return false;
           }
-          else
-          {
-            // use generic visit implementation
-            done = visitTree(visitContext, currChild, callback);
-          }
-
-          // If any kid visit returns true, we are done.
-          if (done)
+        }
+        else
+        {
+          // we only optimize walking into non-UIXComponent NamingContainers
+          // if they are UINamingConainer (which is used by <f:subview>
+          if (UINamingContainer.class == component.getClass())
           {
-            return true;
+            if (visitContext.getSubtreeIdsToVisit(component).isEmpty())
+              return false;
           }
         }
-      }
-      finally
-      {
-        // tear down the context we set up in order to visit our children
+
         if (uixComponent != null)
         {
-          if (PhaseId.RENDER_RESPONSE == phaseId)
+          // setup any context needed for visiting the children of the component as opposed
+          // to the component itself
+          if (rc != null)
           {
-            uixComponent.tearDownEncodingContext(context, rc);
+            uixComponent.setupChildrenEncodingContext(facesContext, rc);
           }
           else
           {
-            uixComponent.tearDownVisitingContext(context);
+            uixComponent.setupChildrenVisitingContext(facesContext);
+          }
+
+          try
+          {
+            return uixComponent.visitChildren(visitContext, callback);
+          }
+          finally
+          {
+            // teardown any context initialized above
+            if (rc != null)
+            {
+              uixComponent.tearDownChildrenEncodingContext(facesContext, rc);
+            }
+            else
+            {
+              uixComponent.tearDownChildrenVisitingContext(facesContext);
+            }
           }
         }
+        else
+        {
+          return _visitAllChildren(component, visitContext, callback);
+        }
+      }
+      else
+      {
+        assert(result == VisitResult.REJECT);
       }
     }
-    else
+    finally
     {
-      assert(result == VisitResult.REJECT);
+      if (uixComponent != null)
+      {
+        if (rc != null)
+        {
+          uixComponent.tearDownEncodingContext(facesContext, rc);
+        }
+        else
+        {
+          uixComponent.tearDownVisitingContext(facesContext);
+        }
+      }
     }
 
     // if we got this far, we're not done
@@ -481,6 +563,17 @@ abstract public class UIXComponent exten
   }
 
   /**
+   * Returns <code>true</code> if the components are being visited
+   * for the purpose of encoding.
+   */
+  private static boolean _isEncodingVisit(
+    VisitContext visitContext)
+  {
+    return (visitContext.getHints().contains(VisitHint.EXECUTE_LIFECYCLE) &&
+      visitContext.getPhaseId() == PhaseId.RENDER_RESPONSE);
+  }
+
+  /**
    * Add a component as a partial target to the current request. This code handles the
    * delegation to {@link #setPartialTarget(FacesContext, PartialPageContext)}
    * for UIXComponents or assumes for {@link UIComponent} that components with a renderer
@@ -655,6 +748,23 @@ abstract public class UIXComponent exten
   }
 
   /**
+   * <p>Sets up the context necessary to visit or invoke the children of a component for all phases.
+   * </p>
+   * <p>The default implementation does nothing.</p>
+   * <p>If a subclass overrides this method, it should override
+   * <code>tearDownChildrenVisitingContext</code> as well.</p>
+   * <p>It is guaranteed that if <code>setupChildrenVisitingContext</code> completes
+   * <code>tearDownChildrenVisitingContext</code> will be called for this component</p>
+   * @param context FacesContext
+   * @see #visitChildren
+   * @see #tearDownChildrenVisitingContext
+   */
+  protected void setupChildrenVisitingContext(@SuppressWarnings("unused") FacesContext context)
+  {
+    // do nothing
+  }
+
+  /**
    * <p>Tears down context created in order to visit or invoke the component
    * for all phases.</p>
    * <p>The default implementation does nothing.</p>
@@ -672,6 +782,23 @@ abstract public class UIXComponent exten
   }
 
   /**
+   * <p>Tears down context created in order to visit or invoke the children of a component
+   * for all phases.</p>
+   * <p>The default implementation does nothing.</p>
+   * <p>A subclass should only override this method if it overrode
+   * <code>setupChildrenVisitingContext</code> as well</p>
+   * <p>It is guaranteed that <code>tearDownChildrenVisitingContext</code> will be called only after
+   * <code>setupChildrenVisitingContext</code> has been called for this component</p>
+   * @param context FacesContext
+   * @see #setupChildrenVisitingContext
+   * @see #visitChildren
+   */
+  protected void tearDownChildrenVisitingContext(@SuppressWarnings("unused") FacesContext context)
+  {
+    // do nothing
+  }
+
+  /**
    * <p>Sets up the context necessary to encode the component.</p>
    * <p>The default implementation delegates to
    * <code>CoreRenderer.setupEncodingContext</code> and then calls
@@ -700,6 +827,28 @@ abstract public class UIXComponent exten
   }
 
   /**
+   * Sets the context necessary to encode the children of a component.
+   * @param context The FacesContext
+   * @param rc      RenderingContext to use for encoding
+   * @see #setupChildrenVisitingContext
+   * @see #tearDownChildrenEncodingContext
+   * @see org.apache.myfaces.trinidad.render.CoreRenderer#setupChildrenEncodingContext
+   */
+  public void setupChildrenEncodingContext(FacesContext context, RenderingContext rc)
+  {
+    setupChildrenVisitingContext(context);
+
+    Renderer renderer = getRenderer(context);
+
+    if (renderer instanceof CoreRenderer)
+    {
+      CoreRenderer coreRenderer = (CoreRenderer)renderer;
+
+      coreRenderer.setupChildrenEncodingContext(context, rc, this);
+    }
+  }
+
+  /**
    * <p>Tears down the context created in order to encode the component</p>
    * <p>The default implementation delegates to
    * <code>CoreRenderer.tearDownEncodingContext</code> and then calls
@@ -735,6 +884,35 @@ abstract public class UIXComponent exten
   }
 
   /**
+   * Tears down the context necessary to encode the children of a component.
+   * @param context The FacesContext
+   * @param rc      RenderingContext to use for encoding
+   * @see #setupChildrenVisitingContext
+   * @see #tearDownChildrenEncodingContext
+   * @see org.apache.myfaces.trinidad.render.CoreRenderer#setupChildrenEncodingContext
+   */
+  public void tearDownChildrenEncodingContext(
+    FacesContext context,
+    RenderingContext rc)
+  {
+    Renderer renderer = getRenderer(context);
+
+    try
+    {
+      if (renderer instanceof CoreRenderer)
+      {
+        CoreRenderer coreRenderer = (CoreRenderer)renderer;
+
+        coreRenderer.tearDownChildrenEncodingContext(context, rc, this);
+      }
+    }
+    finally
+    {
+      tearDownChildrenVisitingContext(context);
+    }
+  }
+
+  /**
    * Returns the FacesBean used for storing the component's state.
    */
   abstract public FacesBean getFacesBean();

Modified: myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXHierarchy.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXHierarchy.java?rev=966043&r1=966042&r2=966043&view=diff
==============================================================================
--- myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXHierarchy.java (original)
+++ myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/component/UIXHierarchy.java Tue Jul 20 22:35:51 2010
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -19,11 +19,12 @@
 package org.apache.myfaces.trinidad.component;
 
 import java.util.Collections;
-
 import java.util.List;
 
 import javax.faces.component.UIComponent;
 
+import org.apache.myfaces.trinidad.component.visit.VisitCallback;
+import org.apache.myfaces.trinidad.component.visit.VisitContext;
 import org.apache.myfaces.trinidad.model.CollectionModel;
 import org.apache.myfaces.trinidad.model.LocalRowKeyIndex;
 import org.apache.myfaces.trinidad.model.ModelUtils;
@@ -37,7 +38,7 @@ import org.apache.myfaces.trinidad.model
  *
  * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-api/src/main/java/oracle/adf/view/faces/component/UIXHierarchy.java#0 $) $Date: 10-nov-2005.19:09:52 $
  */
-abstract public class UIXHierarchy extends UIXCollection implements CollectionComponent, LocalRowKeyIndex, 
+abstract public class UIXHierarchy extends UIXCollection implements CollectionComponent, LocalRowKeyIndex,
              TreeLocalRowKeyIndex
 {
   /**
@@ -58,7 +59,7 @@ abstract public class UIXHierarchy exten
   public CollectionModel createCollectionModel(CollectionModel current, Object value)
   {
     TreeModel model = ModelUtils.toTreeModel(value);
-    model.setRowKey(null);    
+    model.setRowKey(null);
     return model;
   }
 
@@ -80,8 +81,8 @@ abstract public class UIXHierarchy exten
   public int getRows()
   {
     return 0;
-  }  
-  
+  }
+
   /**
   * Treats the current element as a parent element and steps into the children.
   * A new path is constructed by appending the null value to the old path.
@@ -128,7 +129,7 @@ abstract public class UIXHierarchy exten
    */
   public boolean isContainerEmpty()
   {
-    
+
     return getTreeModel().isContainerEmpty();
   }
 
@@ -169,7 +170,7 @@ abstract public class UIXHierarchy exten
   {
     return getTreeModel().getContainerRowKey(childKey);
   }
-  
+
   /**
    * Gets the all the rowKeys of the ancestors of the given child row.
    * @see TreeModel#getAllAncestorContainerRowKeys(Object)
@@ -184,8 +185,8 @@ abstract public class UIXHierarchy exten
   //
 
   /**
-   * Indicates whether data for a child model (children of the current node) is 
-   * locally available. 
+   * Indicates whether data for a child model (children of the current node) is
+   * locally available.
    * @see TreeModel#isChildCollectionLocallyAvailable()
    * @return true if child data is locally available
    */
@@ -196,7 +197,7 @@ abstract public class UIXHierarchy exten
 
   /**
    * Indicates whether child data for the node with the given index is
-   * locally available.   
+   * locally available.
    * @see TreeModel#isChildCollectionLocallyAvailable(int)
    * @param index row index to check
    * @return true if child data is available, false otherwise
@@ -208,7 +209,7 @@ abstract public class UIXHierarchy exten
 
   /**
    * Indicates whether child data for the node with the given row key is
-   * locally available.   
+   * locally available.
    * @see TreeModel#isChildCollectionLocallyAvailable(Object)
    * @param rowKey row key to check
    * @return true if child data is available, false otherwise
@@ -221,7 +222,7 @@ abstract public class UIXHierarchy exten
   /**
    * Check if a range of rows is locally available starting from a row index.  The range
    * can include child nodes in any expanded nodes within the range.
-   * @param startIndex staring index for the range  
+   * @param startIndex staring index for the range
    * @param rowCount number of rows in the range
    * @param disclosedRowKeys set of expanded nodes which may fall within the range to check for
    * availability
@@ -237,7 +238,7 @@ abstract public class UIXHierarchy exten
   /**
    * Check if a range of rows is locally available starting from a row key.   The range
    * can include child nodes in any expanded nodes within the range.
-   * @param startRowKey staring row key for the range  
+   * @param startRowKey staring row key for the range
    * @param rowCount number of rows in the range
    * @param disclosedRowKeys set of expanded nodes which may fall within the range to check for
    * availability
@@ -273,8 +274,8 @@ abstract public class UIXHierarchy exten
   {
     TreeModel model = (TreeModel) getCollectionModel();
     return model;
-  } 
-  
+  }
+
   @Override
   protected List<UIComponent> getStamps()
   {
@@ -283,7 +284,94 @@ abstract public class UIXHierarchy exten
       return Collections.singletonList(nodeStamp);
     else
       return Collections.emptyList();
-  }  
+  }
 
   abstract public Object getFocusRowKey();
+
+  protected final boolean visitLevel(
+    VisitContext      visitContext,
+    VisitCallback     callback,
+    List<UIComponent> stamps)
+  {
+    if (getRowCount() != 0)
+    {
+      if (!stamps.isEmpty())
+      {
+        int oldRow = getRowIndex();
+        int first = getFirst();
+        int last = TableUtils.getLast(this, first);
+
+        try
+        {
+          for (int i = first; i <= last; i++)
+          {
+            setRowIndex(i);
+
+            for (UIComponent currStamp : stamps)
+            {
+              // visit the stamps.  If we have visited all of the visit targets then return early
+              if (UIXComponent.visitTree(visitContext, currStamp, callback))
+                return true;
+            }
+          }
+        }
+        finally
+        {
+          setRowIndex(oldRow);
+        }
+      }
+    }
+
+    return false;
+  }
+
+  protected final boolean visitHierarchy(
+    VisitContext      visitContext,
+    VisitCallback     callback,
+    List<UIComponent> stamps,
+    RowKeySet         disclosedRowKeys)
+  {
+    int oldRow = getRowIndex();
+    int first = getFirst();
+    int last = TableUtils.getLast(this, first);
+
+    try
+    {
+      for(int i = first; i <= last; i++)
+      {
+        setRowIndex(i);
+        if (!stamps.isEmpty())
+        {
+          for (UIComponent currStamp : stamps)
+          {
+            // visit the stamps.  If we have visited all of the visit targets then return early
+            if (UIXComponent.visitTree(visitContext, currStamp, callback))
+              return true;
+          }
+        }
+
+        if (isContainer() && ((disclosedRowKeys == null) || disclosedRowKeys.isContained()))
+        {
+          enterContainer();
+
+          try
+          {
+            // visit this container.  If we have visited all of the visit targets then return early
+            if (visitHierarchy(visitContext, callback, stamps, disclosedRowKeys))
+              return true;
+          }
+          finally
+          {
+            exitContainer();
+          }
+        }
+      }
+    }
+    finally
+    {
+      setRowIndex(oldRow);
+    }
+
+    return false;
+  }
 }

Modified: myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java?rev=966043&r1=966042&r2=966043&view=diff
==============================================================================
--- myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java (original)
+++ myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-api/src/main/java/org/apache/myfaces/trinidad/render/CoreRenderer.java Tue Jul 20 22:35:51 2010
@@ -129,6 +129,27 @@ public class CoreRenderer extends Render
 
   /**
    * <p>
+   * Called before rendering the current component's children in order to set
+   * up any special context.
+   * </p>
+   * <p>If <code>setupChildrenEncodingContext</code> succeeds then
+   * <code>tearDownChildrenEncodingContext</code> will be called for the same component.
+   * </p>
+   * <p>The default implementation does nothing</p>
+   * @param context FacesContext for this request
+   * @param rc RenderingContext for this encoding pass
+   * @param component Component to encode using this Renderer
+   * @see #tearDownChildrenEncodingContext
+   */
+  public void setupChildrenEncodingContext(
+    @SuppressWarnings("unused") FacesContext context,
+    @SuppressWarnings("unused") RenderingContext rc,
+    @SuppressWarnings("unused") UIComponent component)
+  {
+  }
+
+  /**
+   * <p>
    * Called after rendering the current component's children in order to tear
    * down any special context.
    * </p>
@@ -161,6 +182,68 @@ public class CoreRenderer extends Render
       tearDownEncodingContext(context, rc, (UIXComponent)component);
   }
 
+  /**
+   * <p>
+   * Called after rendering the current component's children in order to tear
+   * down any special context.
+   * </p>
+   * <p>
+   * <code>tearDownChildrenEncodingContext</code> will be called on the component if
+   * <code>setupChildrenEncodingContext</code> succeeded.
+   * </p>
+   * <p>The default implementation does nothing</p>
+   * @param context FacesContext for this request
+   * @param rc RenderingContext for this encoding pass
+   * @param component Component to encode using this Renderer
+   * @see #setupChildrenEncodingContext
+   */
+  public void tearDownChildrenEncodingContext(
+    @SuppressWarnings("unused") FacesContext context,
+    @SuppressWarnings("unused") RenderingContext rc,
+    @SuppressWarnings("unused") UIComponent component)
+  {
+  }
+
+  /**
+   * Hook to allow the renderer to customize the visitation of the children components
+   * of a component during the visitation of a component during rendering.
+   *
+   * @param component the component which owns the children to visit
+   * @param visitContext the visitation context
+   * @param callback the visit callback
+   * @return <code>true</code> if the visit is complete.
+   * @see UIXComponent#visitChildren(VisitContext, VisitCallback)
+   */
+  public boolean visitChildrenForEncoding(
+    UIXComponent  component,
+    VisitContext  visitContext,
+    VisitCallback callback)
+  {
+    // visit the children of the component
+    Iterator<UIComponent> kids = component.getFacetsAndChildren();
+
+    while (kids.hasNext())
+    {
+      // If any kid visit returns true, we are done.
+      UIComponent kid = kids.next();
+      if (kid instanceof UIXComponent)
+      {
+        if (((UIXComponent)kid).visitTree(visitContext, callback))
+        {
+          return true;
+        }
+      }
+      else
+      {
+        if (UIXComponent.visitTree(visitContext, kid, callback))
+        {
+          return true;
+        }
+      }
+    }
+
+    return false;
+  }
 
   //
   // COERCION HELPERS
@@ -684,9 +767,9 @@ public class CoreRenderer extends Render
   {
     return (Agent.PLATFORM_GENERICPDA.equals(rc.getAgent().getPlatformName()));
   }
-  
+
   /**
-   * This method returns true if a user-agent's platform is NokiaS60 
+   * This method returns true if a user-agent's platform is NokiaS60
    * @param arc - RenderingContext of a request
    * @return boolean
    */

Propchange: myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 20 22:35:51 2010
@@ -3,4 +3,5 @@
 /myfaces/trinidad/branches/1.2.12.2-branch/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:895708
 /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:699406,699496
 /myfaces/trinidad/branches/TRINIDAD-1402/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:745675
+/myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:964963-966042
 /myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java-templates/org/apache/myfaces/trinidad/sandbox/component:894885,915962,962582

Propchange: myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree_2/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jul 20 22:35:51 2010
@@ -3,4 +3,5 @@
 /myfaces/trinidad/branches/1.2.12.2-branch/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:895708
 /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:699406,699496
 /myfaces/trinidad/branches/TRINIDAD-1402/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:745675
+/myfaces/trinidad/branches/anrobins_1.2.12.3_visitTree/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:964963-966042
 /myfaces/trinidad/trunk/trinidad-sandbox/sandbox-api/src/main/java/org/apache/myfaces/trinidad/sandbox/event:894885,915962,962582