Skip to content

Commit

Permalink
MYFACES-4650
Browse files Browse the repository at this point in the history
  • Loading branch information
tandraschko committed Feb 12, 2024
1 parent 16702a4 commit 052a32a
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.logging.Logger;

import javax.faces.FactoryFinder;
import javax.faces.component.EditableValueHolder;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewParameter;
import javax.faces.component.UIViewRoot;
Expand Down Expand Up @@ -72,6 +73,11 @@ public class PartialViewContextImpl extends PartialViewContext
private static final Set<VisitHint> PARTIAL_EXECUTE_HINTS = Collections.unmodifiableSet(
EnumSet.of(VisitHint.EXECUTE_LIFECYCLE, VisitHint.SKIP_UNRENDERED));

private static final VisitCallback RESET_VALUES_CALLBACK = new ResetValuesCallback();

private static final Set<VisitHint> RESET_VALUES_HINTS =
Collections.unmodifiableSet(EnumSet.of(VisitHint.SKIP_UNRENDERED));

private FacesContext context = null;
private boolean _released = false;
// Cached values, since their parent methods could be called
Expand Down Expand Up @@ -441,7 +447,9 @@ private void processPartialRendering(UIViewRoot viewRoot, PhaseId phaseId)

if (isResetValues())
{
viewRoot.resetValues(context, getRenderIds());
VisitContext visitContext = VisitContext.createVisitContext(context, getRenderIds(),
RESET_VALUES_HINTS);
viewRoot.visitTree(visitContext, RESET_VALUES_CALLBACK);
}

if (pvc.isRenderAll())
Expand Down Expand Up @@ -563,7 +571,20 @@ else if (viewRoot.isTransient())
}

}


// same like UIViewRoot#ResetValuesCallback
private static class ResetValuesCallback implements VisitCallback
{
public VisitResult visit(VisitContext context, UIComponent target)
{
if (target instanceof EditableValueHolder)
{
((EditableValueHolder)target).resetValue();
}
return VisitResult.ACCEPT;
}
}

private void processRenderResource(FacesContext facesContext, PartialResponseWriter writer, RequestViewContext rvc,
List<UIComponent> updatedComponents, String target) throws IOException
{
Expand Down

0 comments on commit 052a32a

Please sign in to comment.