/** * @param ctx FacesContext. * @param viewId the view ID to check or null if viewId is unknown. * @return <code>true</code> if partial state saving should be used for the specified view ID, * otherwise <code>false</code> */ public boolean isPartialStateSaving(FacesContext ctx, String viewId) { // track UIViewRoot changes UIViewRoot root = ctx.getViewRoot(); UIViewRoot refRoot = viewRootRef.get(); if (root != refRoot) { // set weak reference to current viewRoot this.viewRootRef = new WeakReference<UIViewRoot>(root); // On first call in restore phase, viewRoot is null, so we treat the first // change to not null not as a changing viewRoot. if (refRoot != null) { // view root changed in request processing - force usage of a // new AddRemoveListener instance for the new viewId ... modListener = null; // ... and also force check for partial state saving for the new viewId partialLocked = false; } } if (!partialLocked) { if (viewId == null) { if (root != null) { viewId = root.getViewId(); } else { // View root has not yet been initialized. Check to see whether // the target view id has been stashed away for us. viewId = (String) ctx.getAttributes().get(RIConstants.VIEWID_KEY_NAME); } } partial = stateInfo.usePartialStateSaving(viewId); partialLocked = true; } return partial; }
/** * @param viewId the view ID to check * @return <code>true</code> if partial state saving should be used for the specified view ID, * otherwise <code>false</code> */ public boolean partialStateSaving(String viewId) { // track UIViewRoot changes UIViewRoot root = ctx.getViewRoot(); UIViewRoot refRoot = viewRootRef.get(); if (root != refRoot) { // set weak reference to current viewRoot this.viewRootRef = new WeakReference<UIViewRoot>(root); // On first call in restore phase, viewRoot is null, so we treat the first // change to not null not as a changing viewRoot. if (refRoot != null) { // view root changed in request processing - force usage of a // new AddRemoveListener instance for the new viewId ... modListener = null; // ... and also force check for partial state saving for the new viewId partialLocked = false; } } if (!partialLocked) { partial = stateInfo.usePartialStateSaving(viewId); partialLocked = true; } return partial; }