dev@javaserverfaces.java.net

Seeking Review for 453-ApplicationWrapper, 180-TreeVisitor, 150-BindingBlackBox

From: Ed Burns <Ed.Burns_at_Sun.COM>
Date: Tue, 14 Oct 2008 22:54:02 -0400

SECTION: Modified Files
----------------------------
A jsf-api/src/javax/faces/event/AfterRestoreStateEvent.java

- [150-BindingBlackBox] Event passed to each component's processEvent()
  method after the tree has been fully restored.

M jsf-api/src/javax/faces/component/UIComponent.java

- [150-BindingBlackBox] Make this implement ComponentSystemEventListener
  and add a processEvent that does what used to be called for in the
  RestoreView Phase of the lifecycle:

     * <p class="changed_added_2_0">The default implementation performs
     * the following action. If the argument <code>event</code> is an
     * instance of {_at_link AfterRestoreStateEvent}, call
     * <code>this.</code>{_at_link #getValueExpression} passing the literal
     * string &#8220;binding&#8221;, without the quotes, as the
     * argument. If the result is non-<code>null</code>, set the value
     * of the <code>ValueExpression</code> to be <code>this</code>.</p>


M jsf-api/src/javax/faces/component/UIViewRoot.java

- [150-BindingBlackBox] in processRestoreState(), traverse the tree and
  cause the "binding" magic to happen. Use the new method from
  [180-TreeVisitor].

M jsf-api/src/javax/faces/application/Application.java

- Some methods and constants to implement [180-TreeVisitor]

+ /**
+ * <p class="changed_added_2_0">The presence of this value in the
+ * bitmask passed as an argument to {_at_link
+ * #doTreeTraversal(FacesContext,UIComponent,long,ContextCallback)}
+ * and {_at_link
+ * #getTreeTraversalIterator(FacesContext,UIComponent,long)}
+ * indicates that action is taken on a parent node <em>before</em>
+ * the children are traversed.</p>
+ */
+
+ public static final long TREEORDER_PREFIX = 1;
+
+ /**
+ * <p class="changed_added_2_0">The presence of this value in the
+ * bitmask passed as an argument to {_at_link
+ * #doTreeTraversal(FacesContext,UIComponent,long,ContextCallback)}
+ * and {_at_link
+ * #getTreeTraversalIterator(FacesContext,UIComponent,long)}
+ * indicates that action is taken on a parent node <em>after</em>
+ * the children are traversed.</p>
+ */
+ public static final long TREEORDER_POSTFIX = 1 << 2;
+
+ /**
+ * <p class="changed_added_2_0">The presence of this value in the
+ * bitmask passed as an argument to {_at_link
+ * #doTreeTraversal(FacesContext,UIComponent,long,ContextCallback)}
+ * and {_at_link
+ * #getTreeTraversalIterator(FacesContext,UIComponent,long)}
+ * indicates that the members of any data holder class, such as
+ * {_at_link javax.faces.component.UIData}, must be traversed using the
+ * {_at_link UIComponent#invokeOnComponent} method. </p>
+ */
+ public static final long TREEORDER_INCLUDES_DATAHOLDER_MEMBERS = 1 << 3;

+ /**
+ * <p class="changed_added_2_0">Perform a tree traversal starting at
+ * the {_at_link javax.faces.component.UIViewRoot} of the argument
+ * {_at_link FacesContext}. The tree is traversed as documented in
+ * {_at_link #TREEORDER_PREFIX}. For each node in the traversal call the
+ * {_at_link ContextCallback#invokeContextCallback} method. The
+ * traversal may be aborted by throwing an {_at_link
+ * javax.faces.event.AbortProcessingException} from this method.</p>
+ *
+ * @param context the <code>FacesContext</code> for this request
+ * @param nodeCallback the <code>ContextCallback</code> instance
+ * whose <code>invokeContextCallback</code> method will be called
+ * for each node encountered.
+ *
+ */
+
+ public void doTreeTraversal(FacesContext context, ContextCallback nodeCallback) {
+ if (defaultApplication != null) {
+ defaultApplication.doTreeTraversal(context, nodeCallback);
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * <p class="changed_added_2_0">Perform a tree traversal starting at
+ * the <code>root</code> node in the tree. The order in which
+ * traversal is performed is determined by the
+ * <code>traversalMask</code> argument. If
+ * <code>traversalMask</code> contains both {_at_link
+ * #TREEORDER_PREFIX} and {_at_link #TREEORDER_POSTFIX},
+ * <code>TREEORDER_POSTFIX</code> is ignored. If
+ * <code>traversalMask</code> contains {_at_link
+ * #TREEORDER_INCLUDES_DATAHOLDER_MEMBERS}, the the traversal must
+ * be performed in a manner consistent with the javadoc for
+ * <code>TREEORDER_INCLUDES_DATAHOLDER_MEMBERS</code>. For each
+ * node in the traversal call the {_at_link
+ * ContextCallback#invokeContextCallback} method. The traversal may
+ * be aborted by throwing an {_at_link
+ * javax.faces.event.AbortProcessingException} from this method.</p>
+ *
+ * @param context the <code>FacesContext</code> for this request
+ * @param root the node in the tree from which the traversal should
+ * start.
+ * @param traversalMask a bitwise <code>OR</code> of values from the
+ * <code>TREEORDER_</code> constants.
+ * @param nodeCallback the <code>ContextCallback</code> instance
+ * whose <code>invokeContextCallback</code> method will be called
+ * for each node encountered.
+ */
+ public void doTreeTraversal(FacesContext context, UIComponent root,
+ long traversalMask, ContextCallback nodeCallback) {
+ if (defaultApplication != null) {
+ defaultApplication.doTreeTraversal(context, root, traversalMask,
+ nodeCallback);
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * <p class="changed_added_2_0">Return an <code>Iterator</code> that
+ * performs a tree traversal starting at the {_at_link
+ * javax.faces.component.UIViewRoot} of the argument {_at_link
+ * FacesContext}. The tree is traversed as documented in {_at_link
+ * #TREEORDER_PREFIX}. </p>
+ *
+ * @param context the <code>FacesContext</code> for this request
+ */
 
+ public Iterator getTreeTraversalIterator(FacesContext context) {
+ if (defaultApplication != null) {
+ return defaultApplication.getTreeTraversalIterator(context);
+ }
+ throw new UnsupportedOperationException();
+ }
+
     /**
+ * <p class="changed_added_2_0">Return an <code>Iterator</code> that
+ * performs a tree traversal starting at the argument
+ * <code>root</code> in the tree. The order in which traversal is
+ * performed is determined by the <code>traversalMask</code>
+ * argument. If <code>traversalMask</code> contains both {_at_link
+ * #TREEORDER_PREFIX} and {_at_link #TREEORDER_POSTFIX},
+ * <code>TREEORDER_POSTFIX</code> is ignored. If
+ * <code>traversalMask</code> contains {_at_link
+ * #TREEORDER_INCLUDES_DATAHOLDER_MEMBERS}, the the traversal must
+ * be performed in a manner consistent with the javadoc for
+ * <code>TREEORDER_INCLUDES_DATAHOLDER_MEMBERS</code>. For each
+ * node in the traversal call the {_at_link
+ * ContextCallback#invokeContextCallback} method.</p>
+ *
+ * @param context the <code>FacesContext</code> for this request
+ * @param root the node in the tree from which the traversal should
+ * start.
+ * @param traversalMask a bitwise <code>OR</code> of values from the
+ * <code>TREEORDER_</code> constants.
+ */
+ public Iterator getTreeTraversalIterator(FacesContext context,
+ UIComponent root, long traversalMask) {
+ if (defaultApplication != null) {
+ return defaultApplication.getTreeTraversalIterator(context, root, traversalMask);
+ }
+ throw new UnsupportedOperationException();
+ }

M jsf-ri/src/com/sun/faces/lifecycle/RestoreViewPhase.java

- [150-BindingBlackBox] Remove "binding" magic, now correctly placed in
  component.

M jsf-ri/src/com/sun/faces/application/ApplicationImpl.java

- Implement methods for [180-TreeVisitor]

M jsf-ri/systest-per-webapp/replace-statemanager/src/java/com/sun/faces/systest/NewApplication.java

- make this use [453-ApplicationWrapper]

A jsf-api/src/javax/faces/application/ApplicationWrapper.java

- Implementation for [453-ApplicationWrapper]



--