[ 
https://issues.apache.org/jira/browse/TRINIDAD-2078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015621#comment-13015621
 ] 

Blake Sullivan commented on TRINIDAD-2078:
------------------------------------------

The proposed patch fixes the problem by reverting to delegating the visiting of 
the children back to the components.  We then:

1) Add to ComponentUtils:

  /**
   * @param visitContext
   * @return <code>true</code> if this is a non-iterating visit.
   */
  public static boolean isSkipIterationVisit(VisitContext visitContext)

So that Components can determine whether they should iterate when tree visiting

And modify the behavior of UIXCollection since it is the base class of all of 
the iterating components in Trinidad to switch inside it's override of 
visitChildren and call a new protected method:

  /**
   * Performs a non-iterating visit of the children.  The default 
implementation visits all
   * of the children.  If the UIXCollection subclass doesn't visit some of its 
children in
   * certain cases, it needs to override this method.
   * @param visitContext
   * @param callback
   * @return
   */
  protected boolean visitChildrenWithoutIterating(


instead of the normal data visiting code if we are in a skip iteration visit.

For convenience, I also made the following method on UIXComponent public:

  /**
   * 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.
   */
  protected final boolean visitAllChildren(
    VisitContext visitContext,
    VisitCallback callback)

And made it the default implementation of visitChildrenWithoutIterating(), 
which should be sufficient for all of the subclasses of UIXCollection that ship 
with Trinidad.  It also happens to be precisely the same behavior as the old 
code we are fixing.


> SKIP_ITERATION forces visit of non-rendered components
> ------------------------------------------------------
>
>                 Key: TRINIDAD-2078
>                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2078
>             Project: MyFaces Trinidad
>          Issue Type: Bug
>          Components: Components
>    Affects Versions: 2.0.0-beta-2
>            Reporter: Andy Schwartz
>            Assignee: Blake Sullivan
>         Attachments: trin2078_trin2.diff
>
>
> Certain tree visits, such as the PostRestoreStateEvent delivery visit, must 
> avoid iteration in stamping components (eg. UIData).  Before the fix for:
> TRINIDAD-2030 Honor SKIP_ITERATION FacesContext property
> This was handled in UIXComponent.visitChildren() by checking for the restore 
> view phase.
> As of the fix for 2030, instead of checking the phase id we now check for the 
> SKIP_ITERATION pseudo-hint.
> While this works correctly for the PostRestoreStateEvent visit, it fails in 
> other cases.  The problem: UIXComponent.visitChildren() falls back on a 
> "facets and children" traversal when SKIP_ITERATION is set, which means that 
> we will visit all children (both rendered and non-rendered) even when the 
> SKIP_UNRENDERED hint is set.
> Thus, the combination of SKIP_ITERATION and SKIP_UNRENDERED is not correctly 
> supported with our current solution.  Since this is a valid combination of 
> hints, we'll need an approach that correctly supports this.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to