Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1883: Enhance UIViewRoot#resetValues() to pass VisitHints #1944

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions api/src/main/java/jakarta/faces/component/UIViewRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.ListIterator;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Logger;

Expand All @@ -43,6 +44,7 @@
import jakarta.faces.component.behavior.ClientBehaviorContext;
import jakarta.faces.component.visit.VisitCallback;
import jakarta.faces.component.visit.VisitContext;
import jakarta.faces.component.visit.VisitHint;
import jakarta.faces.component.visit.VisitResult;
import jakarta.faces.context.FacesContext;
import jakarta.faces.context.PartialViewContext;
Expand Down Expand Up @@ -1012,18 +1014,19 @@ public void processDecodes(FacesContext context) {

/**
* <p class="changed_added_2_2">
* Visit the clientIds and, if the component is an instance of {@link EditableValueHolder}, call its
* Visit the clientIds <span class="changed_added_5_0"> with the given visit hints, if any,</span> and, if the component is an instance of {@link EditableValueHolder}, call its
* {@link EditableValueHolder#resetValue} method. Use {@link #visitTree} to do the visiting.
* </p>
*
* @since 2.2
*
* @param context the {@link FacesContext} for the request we are processing.
* @param clientIds The client ids to be visited, on which the described action will be taken.
* @param visitHints Since 5.0: Any visit hints you wish to apply to the visit.
*/

public void resetValues(FacesContext context, Collection<String> clientIds) {
visitTree(VisitContext.createVisitContext(context, clientIds, null), new DoResetValues());
public void resetValues(FacesContext context, Collection<String> clientIds, VisitHint... visitHints) {
visitTree(VisitContext.createVisitContext(context, clientIds, visitHints.length == 0 ? null : Set.of(visitHints)), new DoResetValues());
}

private static class DoResetValues implements VisitCallback {
Expand Down