There are two areas relating to tree visiting where access to additional
information/hints would be helpful:
1. State saving
The tree visitor solution allows component implementations to customize the
manner in which children are visited based on information provided in the
VisitContext, such as the VisitHints. One possible case that component
visitTree() implementations might want to customize is state saving. For
example, a complex component such as UIData may need to visit children somewhat
differently for state saving vs. say, for rendering out an Ajax response.
visitTree() implementations do have access to the FacesContext, so they do have
knowledge of the current phase. However, since JSF does not define a separate
state saving phase, there is no way for visitTree() implementations to determine
whether state saving is being performed.
Components that normally iterate over their children multiple times, such as
UIData (once for each row) require special visitTree() implementations to
provide the necessary iteration. However, in some cases it may be
desirable/necessary to visit the children of such iterating components without
actually performing the iteration - ie. just visit each child one time.
Currently there is no way to indicate to such components that the iteration
should be skipped.
Both of these issues can be addressed by the addition of new VisitHint values.
For example, the following VisitHint values would resolve these issues:
- VistHint.EXECUTE_STATE_SAVING: Lets visitTree() implementations know that
state saving is being performed
- VisitHint.SKIP_ITERATION: Lets visitTree() implementations that normally
iterate over children multiple times kwow that they should avoid any iteration
(ie. only visit each child once).