On Wed, Mar 13, 2013 at 2:39 PM, Andy Schwartz <andy.schwartz_at_oracle.com>wrote:
> Comments on the following new UIViewRoot API:
>
> Index: javax/faces/component/**UIViewRoot.java
> ==============================**==============================**=======
> --- javax/faces/component/**UIViewRoot.java (revision 8845)
> +++ javax/faces/component/**UIViewRoot.java (revision 11719)
>
> + * <p class="changed_added_2_2">**Visit the clientIds and, if the
> component is
> + * an instance of {_at_link EditableValueHolder},
> + * call its {_at_link EditableValueHolder#**resetValue} method. +
> * Use {_at_link #visitTree} to do the visiting.</p>
> + *
> + * @since 2.2
> +
> + * @param context the {_at_link FacesContext} for the request we are
> processing.
> + * @param clientIds The client ids to be visited, on which the
> described action will be taken.
> + */
> + + public void resetValues(FacesContext context, Collection<String>
> clientIds)
>
> Is the idea that the client id of every EditableValueHolder to reset must
> be explicitly specified in the clientIds collection? If so, this seems bad.
>
> The clientIds collection should specify ancestor components, under which
> all EditableValueHolders should be reset.
>
> So, for example, given a form like:
>
> <h:form id="bestFormEver">
>
> <!-- 100 EditableValueHolder components here -->
>
> </h:form>
>
> A call to:
>
> root.resetValue(context, Collections.singleton("**bestFormEver"));
>
> Should reset all of the values of the EditableValueHolders under the form.
>
> Similarly, this:
>
> <f:ajax render="@form" resetValues="true">
>
> Should reset all of the EditableValueHolders under the form.
>
> Or, at least, I think that is the desired behavior. Seems like it would
> be annoying and error prone to force page authors to explicitly list each
> EditableValueHolder to reset individually in the execute/render lists.
>
> Do folks agree?
Ideally, we would want to support both use cases. There are some cases
where you really only want this behavior for specific fields (this is the
case I often see). This happens when you're manipulating only a couple of
fields via Ajax, and you want to clear the values, but the other fields on
the form (maybe in a separate tab) are okay.
However, I'm sure there are cases where you really just want to reset the
entire form, in which case listing all of the ids may be impossible (again,
a page with one form and multiple tabs is a good example).
>
>
> Andy
>
>