Hi Andy<br><br>Ok I created this one for the documentation of UIData.VisitTree:<br><br><a href="https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=803">https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=803</a><br>
<br>best regards,<br><br>Leonardo Uribe<br><br><div class="gmail_quote">2010/5/18 Andy Schwartz <span dir="ltr">&lt;<a href="mailto:andy.schwartz@oracle.com">andy.schwartz@oracle.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Leonardo -<div class="im"><br>
<br>
On 5/18/10 2:09 AM, Leonardo Uribe wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
It could be good to have a hint that could be called VisitHint.VISIT_REAL_COMPONENTS or something like that that visit only real components.<br>
</blockquote>
<br></div>
Ah, a topic near and dear to my heart. :-)<br>
<br>
I proposed adding this API (and provided a patch implementing the solution) back in April 2009:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Gang -<br>
<br>
While reviewing this list with Ed earlier this week, Ed and I discussed very small issue that is not mentioned in the list but which we agreed to at least consider fixing for 2.0.  The issue is related to tree visiting and state saving.  I believe that it is likely that certain components may need to visit their children in a somewhat different manner for state saving purposes - eg. a UIData may take different steps when visiting children for state saving as opposed to say, rendering an Ajax response.  However, at the moment there is no way for a visitTree() implementation to know that state saving is being performed.  visitTree() implementations do have access to the current phase id via the FacesContext, but of course state saving does not live in its own phase.  In order to provide a way to inform visitTree() implementations that state saving is being performed, I proposed (to Ed) that we add a new visit hint.<br>

<br>
Currently we&#39;ve got the following visit hints:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
  SKIP_UNRENDERED<br>
  SKIP_TRANSIENT<br>
  EXECUTE_LIFECYCLE<br>
</blockquote>
<br>
<br>
I would like to add this new hint:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
  EXECUTE_STATE_SAVING<br>
</blockquote>
<br>
While thinking about visit hints and UIData again, I got back to thinking about a use case that we had discussed in the past... Currently there is no way to tell components which visit their children multiple times (think UIData) not to bother performing iteration - ie. to only visit each child one time.  So, for example, in the UIData case, there is no way to tell the UIData component to not iterate over each row when visiting children.  At one point I had proposed a hint to provide control over this, but I never actually added this to the API.  After discussing this with my colleagues internally here, we realized that we have at least one case where we need this ability.  So, while I am in the VisitHint enum, I would like to also add the following new hint:<br>

<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
  SKIP_ITERATION<br>
</blockquote>
<br>
I have opened up the following spec issue to track these requirements:<br>
<br>
<a href="https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=545" target="_blank">https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=545</a> <br>
<br>
And have also uploaded a patch which adds both of these APIs (though for the most part leaves the implementation alone).<br>
<br>
If anyone has comments/questions about either of these, please let me know.<br>
<br>
Ed -<br>
<br>
I realize that we did not discuss the SKIP_ITERATION proposal on our call.  Please let me know if you feel that it is inappropriate to add this.  I can  upload a new patch.<br>
<br>
Andy <br>
</blockquote>
<br>
However, this did not make it into the 2.0 spec.  I&#39;ve mentioned a couple of times since that we really, really need to add this as soon as possible.   If we had any leeway for getting this into 2.0 rev A, I would say we should do so.  However, based on the description of 2.0 rev A:<br>

<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
&quot;2.0 Rev a&quot; will include work that does not require any change in<br>
  behavior of the implementation (including any signature changes) or<br>
  TCK.  This work will be limited to spec edits.<br>
</blockquote>
<br>
It looks like this will need to wait for 2.1.<div class="im"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
In othe side, looking the documentation there is a hint called VisitHint.EXECUTE_LIFECYCLE that says the following:<br>
<br>
&quot;Hint that indicates that the visit is being performed as part of lifecycle phase execution and as such phase-specific actions (initialization) may be taken.&quot;<br>
<br>
I understand why VisitHint.SKIP_TRANSIENT and VisitHint.SKIP_UNRENDERED, but looking the javadoc I couldn&#39;t find when, how or why that hint should be set. At this time, myfaces just ignore it, but if it is used, there should be some documentation on UIComponent.visitTree or UIData.visitTree.<br>

</blockquote>
<br>
<br></div>
Here was the original rationale for adding this, from the thread &quot;[180-TreeVisitor] Visit hints, UIData iteration&quot; (December 2008):<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
While looking at the UIData code base in preparation for implementing UIData.visitTree(), I noticed that UIData&#39;s lifecycle methods perform various phase-specific tasks.  For example, looking at UIData.processDecodes(), I see that before processDecodes() iterates over the children, it does some initialization work:<br>

<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
        setDataModel(null); // Re-evaluate even with server-side state saving<br>
        if (null == saved || !keepSaved(context)) {<br>
            //noinspection CollectionWithoutInitialCapacity<br>
            saved = new HashMap&lt;String, SavedState&gt;(); // We don&#39;t need saved state here<br>
        }<br>
</blockquote>
<br>
The other UIData lifecycle methods do not do this, but perform other minor initialization tasks.<br>
<br>
In the case of Ajax/partial processing, we will be using tree visitor to execute partial lifecycle phases.  This makes me think that UIData.visitTree() is going to need to be able to:<br>
<br>
1. Know what the current phase is, so that it can to phase-specific initialization.<br>
2. Know whether or not the visit corresponds to the execution of a lifecycle phase, as opposed to a generic tree visit that is invoked from application logic (eg. from an action listener).<br>
<br>
#1 is easy enough - this information is available via FacesContext.getCurrentPhaseId().<br>
<br>
I don&#39;t see how we can determine #2 without exposing this information on the VisitContext - presumably as a new hint.<br>
<br>
In order to address this requirement, I would like to add a new hint that indicates whether or not the visit is being performed as part of lifecycle/phase execution.  By default this hint would be off.  When we perform our partial traversals during Ajax request processing we would turn this hint on.<br>

<br>
Unfortunately I cannot think of a good name for this hint.  Maybe something like VisitHint.PROCESS_PHASE?  Suggestions for less awful names (or other ways to solve this problem) would be appreciated!<br>
<br>
Andy <br>
</blockquote>
<br>
Martin suggested &quot;EXECUTE_LIFECYCLE&quot; for this concept, and we rolled with that.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Maybe I&#39;m wrong about that, and if myfaces don&#39;t use it really there is not problem, but the point is: Is mojarra really implementing the algorithm that says the javadoc?.<br>
</blockquote>
<br></div>
In the version of Mojarra that I happen to have sitting here (about a month old), UIData is looking for this hint.   However...  the PartialViewContext implementation is not actually setting the hint, so this is not actually being used at the moment.<div class="im">
<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
It could be good if someone could check this algorithm against javadoc, because really it is very suspicious.<br>
<br>
Should I open an issue for these ones (one for each problem)?<br>
</blockquote>
<br></div>
Could you log a spec issue requesting that the doc be more explicit?<br>
<br>
I will follow up on the Mojarra side to see that the PartialViewContext implementation is fixed.<br>
<br>
Andy<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
regards,<br>
<br>
Leonardo Uribe<br>
</blockquote>
<br>
</blockquote></div><br>