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

Backport #5513 from 5.0 into 4.0 #5516

Merged
merged 1 commit into from
Oct 19, 2024
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
10 changes: 8 additions & 2 deletions impl/src/main/java/jakarta/faces/component/UIViewRoot.java
Original file line number Diff line number Diff line change
Expand Up @@ -1015,17 +1015,23 @@ public void processDecodes(FacesContext context) {
* @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.
*/

public void resetValues(FacesContext context, Collection<String> clientIds) {
visitTree(VisitContext.createVisitContext(context, clientIds, null), new DoResetValues());
visitTree(VisitContext.createVisitContext(context, clientIds, null), DoResetValues.INSTANCE);
}

private static class DoResetValues implements VisitCallback {

private static final DoResetValues INSTANCE = new DoResetValues();

@Override
public VisitResult visit(VisitContext context, UIComponent target) {
if (target instanceof EditableValueHolder) {
((EditableValueHolder) target).resetValue();
}
// If render ID didn't specifically point to an EditableValueHolder. Visit all children as well.
else if (!VisitContext.ALL_IDS.equals(context.getIdsToVisit())) {
target.visitTree(VisitContext.createVisitContext(context.getFacesContext(), null, context.getHints()), this);
}
return VisitResult.ACCEPT;
}
}
Expand Down
Loading