myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Blake Sullivan <blake.sulli...@oracle.com>
Subject [trinidad][api] TRINIDAD-2078 SKIP_ITERATION forces visit of non-rendered components
Date Mon, 04 Apr 2011 23:04:14 GMT
To fix TRINIDAD-2078 SKIP_ITERATION forces visit of non-rendered 
components 
<https://issues.apache.org/jira/browse/TRINIDAD-2078?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13015621#comment-13015621>,

I proposed the following apis:

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.

-- Blake Sullivan


Mime
View raw message