/** * Reapply the dynamic actions after Facelets reapply. * * <p> Note a precondition to this method is that tracking view * modifications is turned off during the execution of this method. The * caller of this method is responsible for turning tracking view * modifications off and on as required. </p> * * @param context the Faces context. */ private void reapplyDynamicActions(FacesContext context) { StateContext stateContext = StateContext.getStateContext(context); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (actions != null) { for (ComponentStruct action : actions) { if (REMOVE.equals(action.getAction())) { reapplyDynamicRemove(context, action); } if (ADD.equals(action.getAction())) { reapplyDynamicAdd(context, action); } } } }
/** * Reapply the dynamic actions after Facelets reapply. * * <p> Note a precondition to this method is that tracking view * modifications is turned off during the execution of this method. The * caller of this method is responsible for turning tracking view * modifications off and on as required. </p> * * @param context the Faces context. */ private void reapplyDynamicActions(FacesContext context) { StateContext stateContext = StateContext.getStateContext(context); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (actions != null) { for (ComponentStruct action : actions) { if (REMOVE.equals(action.getAction())) { reapplyDynamicRemove(context, action); } if (ADD.equals(action.getAction())) { reapplyDynamicAdd(context, action); } } } }
/** * Reapply the dynamic actions after Facelets reapply. * * <p> Note a precondition to this method is that tracking view * modifications is turned off during the execution of this method. The * caller of this method is responsible for turning tracking view * modifications off and on as required. </p> * * @param context the Faces context. */ private void reapplyDynamicActions(FacesContext context) { StateContext stateContext = StateContext.getStateContext(context); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (actions != null) { for (ComponentStruct action : actions) { if (REMOVE.equals(action.getAction())) { reapplyDynamicRemove(context, action); } if (ADD.equals(action.getAction())) { reapplyDynamicAdd(context, action); } } } }
if (lastIndex == firstIndex) { ComponentStruct previousStruct = actionList.get(firstIndex); if (ADD.equals(previousStruct.getAction())) { if (ADD.equals(struct.getAction())) { throw new FacesException("Cannot add the same component twice: " + struct.getClientId()); if (REMOVE.equals(struct.getAction())) { actionList.remove(firstIndex); componentMap.remove(struct.getClientId()); if (REMOVE.equals(previousStruct.getAction())) { if (ADD.equals(struct.getAction())) { actionList.add(struct); componentMap.put(struct.getClientId(), component); if (REMOVE.equals(struct.getAction())) { throw new FacesException("Cannot remove the same component twice: " + struct.getClientId()); if (ADD.equals(struct.getAction())) { throw new FacesException("Cannot add the same component twice: " + struct.getClientId()); if (REMOVE.equals(struct.getAction())) { actionList.remove(lastIndex);
if (lastIndex == firstIndex) { ComponentStruct previousStruct = actionList.get(firstIndex); if (ADD.equals(previousStruct.getAction())) { if (ADD.equals(struct.getAction())) { throw new FacesException("Cannot add the same component twice: " + struct.getClientId()); if (REMOVE.equals(struct.getAction())) { actionList.remove(firstIndex); componentMap.remove(struct.getClientId()); if (REMOVE.equals(previousStruct.getAction())) { if (ADD.equals(struct.getAction())) { actionList.add(struct); componentMap.put(struct.getClientId(), component); if (REMOVE.equals(struct.getAction())) { throw new FacesException("Cannot remove the same component twice: " + struct.getClientId()); if (ADD.equals(struct.getAction())) { throw new FacesException("Cannot add the same component twice: " + struct.getClientId()); if (REMOVE.equals(struct.getAction())) { actionList.remove(lastIndex);
if (lastIndex == firstIndex) { ComponentStruct previousStruct = actionList.get(firstIndex); if (ADD.equals(previousStruct.getAction())) { if (ADD.equals(struct.getAction())) { throw new FacesException("Cannot add the same component twice: " + struct.getClientId()); if (REMOVE.equals(struct.getAction())) { actionList.remove(firstIndex); componentMap.remove(struct.getClientId()); if (REMOVE.equals(previousStruct.getAction())) { if (ADD.equals(struct.getAction())) { actionList.add(struct); componentMap.put(struct.getClientId(), component); if (REMOVE.equals(struct.getAction())) { throw new FacesException("Cannot remove the same component twice: " + struct.getClientId()); if (ADD.equals(struct.getAction())) { throw new FacesException("Cannot add the same component twice: " + struct.getClientId()); if (REMOVE.equals(struct.getAction())) { actionList.remove(lastIndex);
/** * Restore the list of dynamic actions and replay them. * * @param context the Faces context. * @param stateContext the state context. * @param stateMap the state. * @param viewRoot the view root. */ private void restoreDynamicActions(FacesContext context, StateContext stateContext, Map<String, Object> stateMap) { if (LOGGER.isLoggable(FINEST)) { LOGGER.finest("FaceletPartialStateManagementStrategy.restoreDynamicActions"); } @SuppressWarnings("unchecked") List<Object> savedActions = (List<Object>) stateMap.get(DYNAMIC_ACTIONS); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (!isEmpty(savedActions)) { for (Object savedAction : savedActions) { ComponentStruct action = new ComponentStruct(); action.restoreState(context, savedAction); if (ADD.equals(action.getAction())) { restoreDynamicAdd(context, stateMap, action); } if (REMOVE.equals(action.getAction())) { restoreDynamicRemove(context, action); } pruneAndReAddToDynamicActions(actions, action); } } }
/** * Restore the list of dynamic actions and replay them. * * @param context the Faces context. * @param stateContext the state context. * @param stateMap the state. * @param viewRoot the view root. */ private void restoreDynamicActions(FacesContext context, StateContext stateContext, Map<String, Object> stateMap) { if (LOGGER.isLoggable(FINEST)) { LOGGER.finest("FaceletPartialStateManagementStrategy.restoreDynamicActions"); } @SuppressWarnings("unchecked") List<Object> savedActions = (List<Object>) stateMap.get(DYNAMIC_ACTIONS); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (!isEmpty(savedActions)) { for (Object savedAction : savedActions) { ComponentStruct action = new ComponentStruct(); action.restoreState(context, savedAction); if (ADD.equals(action.getAction())) { restoreDynamicAdd(context, stateMap, action); } if (REMOVE.equals(action.getAction())) { restoreDynamicRemove(context, action); } pruneAndReAddToDynamicActions(actions, action); } } }
/** * Restore the list of dynamic actions and replay them. * * @param context the Faces context. * @param stateContext the state context. * @param stateMap the state. * @param viewRoot the view root. */ private void restoreDynamicActions(FacesContext context, StateContext stateContext, HashMap<String, Object> state) { if (LOGGER.isLoggable(FINEST)) { LOGGER.finest("FaceletFullStateManagementStrategy.restoreDynamicActions"); } @SuppressWarnings("unchecked") List<Object> savedActions = (List<Object>) context.getViewRoot().getAttributes().get(DYNAMIC_ACTIONS); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (!isEmpty(savedActions)) { for (Object savedAction : savedActions) { ComponentStruct action = new ComponentStruct(); action.restoreState(context, savedAction); if (ADD.equals(action.getAction())) { restoreDynamicAdd(context, state, action); } if (REMOVE.equals(action.getAction())) { restoreDynamicRemove(context, action); } pruneAndReAddToDynamicActions(actions, action); } } }
/** * Restore the list of dynamic actions and replay them. * * @param context the Faces context. * @param stateContext the state context. * @param stateMap the state. * @param viewRoot the view root. */ private void restoreDynamicActions(FacesContext context, StateContext stateContext, Map<String, Object> stateMap) { if (LOGGER.isLoggable(FINEST)) { LOGGER.finest("FaceletPartialStateManagementStrategy.restoreDynamicActions"); } @SuppressWarnings("unchecked") List<Object> savedActions = (List<Object>) stateMap.get(DYNAMIC_ACTIONS); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (!isEmpty(savedActions)) { for (Object savedAction : savedActions) { ComponentStruct action = new ComponentStruct(); action.restoreState(context, savedAction); if (ADD.equals(action.getAction())) { restoreDynamicAdd(context, stateMap, action); } if (REMOVE.equals(action.getAction())) { restoreDynamicRemove(context, action); } pruneAndReAddToDynamicActions(actions, action); } } }
/** * Restore the list of dynamic actions and replay them. * * @param context the Faces context. * @param stateContext the state context. * @param stateMap the state. * @param viewRoot the view root. */ private void restoreDynamicActions(FacesContext context, StateContext stateContext, HashMap<String, Object> state) { if (LOGGER.isLoggable(FINEST)) { LOGGER.finest("FaceletFullStateManagementStrategy.restoreDynamicActions"); } @SuppressWarnings("unchecked") List<Object> savedActions = (List<Object>) context.getViewRoot().getAttributes().get(DYNAMIC_ACTIONS); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (!isEmpty(savedActions)) { for (Object savedAction : savedActions) { ComponentStruct action = new ComponentStruct(); action.restoreState(context, savedAction); if (ADD.equals(action.getAction())) { restoreDynamicAdd(context, state, action); } if (REMOVE.equals(action.getAction())) { restoreDynamicRemove(context, action); } pruneAndReAddToDynamicActions(actions, action); } } }
/** * Restore the list of dynamic actions and replay them. * * @param context the Faces context. * @param stateContext the state context. * @param stateMap the state. * @param viewRoot the view root. */ private void restoreDynamicActions(FacesContext context, StateContext stateContext, HashMap<String, Object> state) { if (LOGGER.isLoggable(FINEST)) { LOGGER.finest("FaceletFullStateManagementStrategy.restoreDynamicActions"); } @SuppressWarnings("unchecked") List<Object> savedActions = (List<Object>) context.getViewRoot().getAttributes().get(DYNAMIC_ACTIONS); List<ComponentStruct> actions = stateContext.getDynamicActions(); if (!isEmpty(savedActions)) { for (Object savedAction : savedActions) { ComponentStruct action = new ComponentStruct(); action.restoreState(context, savedAction); if (ADD.equals(action.getAction())) { restoreDynamicAdd(context, state, action); } if (REMOVE.equals(action.getAction())) { restoreDynamicRemove(context, action); } pruneAndReAddToDynamicActions(actions, action); } } }