Package com.sun.faces.util

Examples of com.sun.faces.util.ComponentStruct


        List<Object> savedActions = (List<Object>) viewRoot.getAttributes().get(DYNAMIC_ACTIONS);
        List<ComponentStruct> actions = stateContext.getDynamicActions();

        if (savedActions != null && !savedActions.isEmpty()) {
            for (Object object : savedActions) {
                ComponentStruct action = new ComponentStruct();
                action.restoreState(context, object);
                if (ComponentStruct.ADD.equals(action.action)) {
                    restoreDynamicAdd(context, state, action);
                }
                if (ComponentStruct.REMOVE.equals(action.action)) {
                    restoreDynamicRemove(context, action);
View Full Code Here


        List<Object> savedActions = (List<Object>) stateMap.get(DYNAMIC_ACTIONS);
        List<ComponentStruct> actions = stateContext.getDynamicActions();
       
        if (savedActions != null && !savedActions.isEmpty()) {
            for(Object object : savedActions) {
                ComponentStruct action = new ComponentStruct();
                action.restoreState(context, object);
                if (ComponentStruct.ADD.equals(action.action)) {
                    restoreDynamicAdd(context, stateMap, action);
                }
                if (ComponentStruct.REMOVE.equals(action.action)) {
                    restoreDynamicRemove(context, action);
View Full Code Here

         */
        private void handleRemove(FacesContext context, UIComponent component) {
            if (!component.isTransient()) {
                if (component.isInView()) {
                    decrementDynamicChildCount(component.getParent());
                    ComponentStruct struct = new ComponentStruct();
                    struct.action = ComponentStruct.REMOVE;
                    struct.clientId = component.getClientId(context);
                    struct.id = component.getId();
                    getDynamicActions().add(struct);
                }           
View Full Code Here

                            Map.Entry entry = (Map.Entry) entries.next();
                            if (entry.getValue() == component) {
                                incrementDynamicChildCount(component.getParent());
                                component.getAttributes().put(DYNAMIC_COMPONENT, component.getParent().getChildren().indexOf(component));
                                component.clearInitialState();
                                ComponentStruct struct = new ComponentStruct();
                                struct.action = ComponentStruct.ADD;
                                struct.facetName = entry.getKey().toString();
                                struct.parentClientId = component.getParent().getClientId(context);
                                struct.clientId = component.getClientId(context);
                                struct.id = component.getId();
                                getDynamicActions().add(struct);
                            }
                        }
                    }
                    else {
                        incrementDynamicChildCount(component.getParent());
                        component.getAttributes().put(DYNAMIC_COMPONENT, component.getParent().getChildren().indexOf(component));
                        component.clearInitialState();
                        ComponentStruct struct = new ComponentStruct();
                        struct.action = ComponentStruct.ADD;
                        struct.parentClientId = component.getParent().getClientId(context);
                        struct.clientId = component.getClientId(context);
                        struct.id = component.getId();
                        getDynamicActions().add(struct);
View Full Code Here

                parent = parent.getParent();
            }

            parent = added.getParent();
            StateContext.this.incrementDynamicChildCount(parent);
            ComponentStruct toAdd = new ComponentStruct();
            toAdd.absorbComponent(context, added);

            if (dynamicRemoves != null) {
                dynamicRemoves.remove(toAdd.clientId);
            }
            added.getAttributes().put(DYNAMIC_COMPONENT, new Integer(toAdd.indexOfChildInParent));
View Full Code Here

                Object restoredAddList[] = (Object[]) state.get(CLIENTIDS_TO_ADD_NAME);
                if (restoredAddList != null && restoredAddList.length > 0) {
                    // Restore the list of added components
                    List<ComponentStruct> addList = new ArrayList<ComponentStruct>(restoredAddList.length);
                    for (Object aRestoredAddList : restoredAddList) {
                        ComponentStruct cur = new ComponentStruct();
                        cur.restoreState(context, aRestoredAddList);
                        addList.add(cur);
                    }
                    // restore the components themselves
                    for (ComponentStruct cur : addList) {
                        final ComponentStruct finalCur = cur;
                        // Find the parent
                        viewRoot.invokeOnComponent(context, finalCur.parentClientId,
                                new ContextCallback() {
                                    public void invokeContextCallback(FacesContext context, UIComponent parent) {
                                        // Create the child
View Full Code Here

                // ensure it's in the addList.
                Map<String, ComponentStruct> dynamicAdds = stateContext.getDynamicAdds();
                assert(null != dynamicAdds);
                String clientId = c.getClientId(ctx);
                if (!dynamicAdds.containsKey(clientId)) {
                    ComponentStruct toAdd = new ComponentStruct();
                    toAdd.absorbComponent(ctx, c);
                    dynamicAdds.put(clientId, toAdd);
                }
            } else {
                stateObj = c.saveState(ctx);
            }
View Full Code Here

        List<Object> savedActions = (List<Object>) viewRoot.getAttributes().get(DYNAMIC_ACTIONS);
        List<ComponentStruct> actions = stateContext.getDynamicActions();

        if (savedActions != null && !savedActions.isEmpty()) {
            for (Object object : savedActions) {
                ComponentStruct action = new ComponentStruct();
                action.restoreState(context, object);
                if (ComponentStruct.ADD.equals(action.action)) {
                    restoreDynamicAdd(context, state, action);
                }
                if (ComponentStruct.REMOVE.equals(action.action)) {
                    restoreDynamicRemove(context, action);
View Full Code Here

         * @param component the UI component to add to the list as a REMOVE.
         */
        private void handleRemove(FacesContext context, UIComponent component) {
            if (component.isInView()) {
                decrementDynamicChildCount(component.getParent());
                ComponentStruct struct = new ComponentStruct();
                struct.action = ComponentStruct.REMOVE;
                struct.clientId = component.getClientId(context);
                struct.id = component.getId();
                handleAddRemoveWithAutoPrune(component, struct);
            }           
View Full Code Here

                        Map.Entry entry = (Map.Entry) entries.next();
                        if (entry.getValue() == component) {
                            incrementDynamicChildCount(component.getParent());
                            component.clearInitialState();
                            component.getAttributes().put(DYNAMIC_COMPONENT, component.getParent().getChildren().indexOf(component));
                            ComponentStruct struct = new ComponentStruct();
                            struct.action = ComponentStruct.ADD;
                            struct.facetName = entry.getKey().toString();
                            struct.parentClientId = component.getParent().getClientId(context);
                            struct.clientId = component.getClientId(context);
                            struct.id = component.getId();
                            handleAddRemoveWithAutoPrune(component, struct);
                        }
                    }
                }
                else {
                    incrementDynamicChildCount(component.getParent());
                    component.clearInitialState();
                    component.getAttributes().put(DYNAMIC_COMPONENT, component.getParent().getChildren().indexOf(component));
                    ComponentStruct struct = new ComponentStruct();
                    struct.action = ComponentStruct.ADD;
                    struct.parentClientId = component.getParent().getClientId(context);
                    struct.clientId = component.getClientId(context);
                    struct.id = component.getId();
                    handleAddRemoveWithAutoPrune(component, struct);
View Full Code Here

TOP

Related Classes of com.sun.faces.util.ComponentStruct

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.