Skip to content

Commit

Permalink
Merge pull request #5516 from pizzi80/4.0
Browse files Browse the repository at this point in the history
Backport #5513 from 5.0 into 4.0
  • Loading branch information
BalusC authored Oct 19, 2024
2 parents 73cdfee + 7e2851a commit 2ae9565
Showing 1 changed file with 8 additions and 2 deletions.
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

0 comments on commit 2ae9565

Please sign in to comment.