Package com.sun.faces.util

Examples of com.sun.faces.util.ComponentStruct


         */
        private void handleRemove(FacesContext context, UIComponent component) {
            if (!component.isTransient() && !hasTransientAncestor(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

                actionList.add(struct);
                componentMap.put(struct.clientId, component);
            } else {
                int lastIndex = actionList.lastIndexOf(struct);
                if (lastIndex == firstIndex) {
                    ComponentStruct previousStruct = actionList.get(firstIndex);
                    if (ComponentStruct.ADD.equals(previousStruct.action)) {
                        if (ComponentStruct.ADD.equals(struct.action)) {
                            throw new FacesException("Cannot add the same component twice: " + struct.clientId);
                        }
                        if (ComponentStruct.REMOVE.equals(struct.action)) {
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

                            stateObj = new StateHolderSaver(finalContext, target);
                            Map<String, ComponentStruct> dynamicAdds = stateContext.getDynamicAdds();
                            assert(null != dynamicAdds);
                            String clientId = target.getClientId(finalContext);
                            if (!dynamicAdds.containsKey(clientId)) {
                                ComponentStruct toAdd = new ComponentStruct();
                                toAdd.absorbComponent(finalContext, target);
                                dynamicAdds.put(clientId, toAdd);
                            }

                        } else {
                            stateObj = target.saveState(context.getFacesContext());
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.visitTree(visitContext, new VisitCallback() {
                            public VisitResult visit(VisitContext context, UIComponent target) {
                                VisitResult result = VisitResult.ACCEPT;
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

                String facetName = findFacetNameForComponent(component);
                if (facetName != null) {
                    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 = facetName;
                    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

                actionList.add(struct);
                componentMap.put(struct.clientId, component);
            } else {
                int lastIndex = actionList.lastIndexOf(struct);
                if (lastIndex == firstIndex) {
                    ComponentStruct previousStruct = actionList.get(firstIndex);
                    if (ComponentStruct.ADD.equals(previousStruct.action)) {
                        if (ComponentStruct.ADD.equals(struct.action)) {
                            throw new FacesException("Cannot add the same component twice: " + struct.clientId);
                        }
                        if (ComponentStruct.REMOVE.equals(struct.action)) {
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.