diff --git a/impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java b/impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java index 441402f881..02aec7c08f 100644 --- a/impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java +++ b/impl/src/main/java/com/sun/faces/context/PartialViewContextImpl.java @@ -72,8 +72,6 @@ public class PartialViewContextImpl extends PartialViewContext { // Log instance for this class private static final Logger LOGGER = FacesLogger.CONTEXT.getLogger(); - private static final Set SKIP_UNRENDERED_HINT = EnumSet.of(SKIP_UNRENDERED); - private static final Set SKIP_UNRENDERED_AND_EXECUTE_LIFECYCLE_HINTS = EnumSet.of(SKIP_UNRENDERED, EXECUTE_LIFECYCLE); @@ -293,7 +291,7 @@ public void processPartial(PhaseId phaseId) { writer.startDocument(); if (isResetValues()) { - resetValues(viewRoot, myRenderIds, ctx); + viewRoot.resetValues(ctx, myRenderIds, SKIP_UNRENDERED); } if (isRenderAll()) { @@ -389,7 +387,8 @@ private void processComponents(UIComponent component, PhaseId phaseId, Collectio // process. Create our (partial) VisitContext and the // VisitCallback that will be invoked for each component that // is visited. - VisitContext visitContext = createPartialVisitContext(context, phaseClientIds, true); + VisitContextFactory visitContextFactory = (VisitContextFactory) FactoryFinder.getFactory(VISIT_CONTEXT_FACTORY); + VisitContext visitContext = visitContextFactory.getVisitContext(context, phaseClientIds, SKIP_UNRENDERED_AND_EXECUTE_LIFECYCLE_HINTS); PhaseAwareVisitCallback visitCallback = new PhaseAwareVisitCallback(ctx, phaseId); component.visitTree(visitContext, visitCallback); @@ -406,34 +405,6 @@ private void processComponents(UIComponent component, PhaseId phaseId, Collectio } } - private static VisitContext createPartialVisitContext(FacesContext context, Collection clientIds, boolean executeLifecycle) { - - // Note that we use the SKIP_UNRENDERED hint as - // we only want to visit the rendered subtree. - Set hints = executeLifecycle ? SKIP_UNRENDERED_AND_EXECUTE_LIFECYCLE_HINTS : SKIP_UNRENDERED_HINT; - VisitContextFactory visitContextFactory = (VisitContextFactory) FactoryFinder.getFactory(VISIT_CONTEXT_FACTORY); - return visitContextFactory.getVisitContext(context, clientIds, hints); - } - - private static void resetValues(UIComponent component, Collection clientIds, FacesContext context) { - - // NOTE: this is indeed a copy of the one in UIViewRoot#resetValues(). - // The difference is that we want to be able to control the visit hints. - // This isn't possible via the UIViewRoot#resetValues() API in its current form. - component.visitTree(createPartialVisitContext(context, clientIds, false), new DoResetValues()); - } - - private static class DoResetValues implements VisitCallback { - - @Override - public VisitResult visit(VisitContext context, UIComponent target) { - if (target instanceof EditableValueHolder) { - ((EditableValueHolder) target).resetValue(); - } - return VisitResult.ACCEPT; - } - } - /** * Unwraps {@link PartialVisitContext} from a chain of {@link VisitContextWrapper}s. *