Examples of TreeState


Examples of org.richfaces.component.state.TreeState

    Set<ResourceTreeNode> openNodes = new HashSet<ResourceTreeNode>();
   
    public void changeExpandListener(org.richfaces.event.NodeExpandedEvent e) {
        HtmlTree tree = (HtmlTree) e.getComponent();
        TreeState state = (TreeState) tree.getComponentState();

        //check if we're collapsing a parent of currently selected node.
        //if we do, change the focus to the parent
        if (state.getSelectedNode() != null) {
            boolean closingParent = false;

            TreeRowKey<?> key = (TreeRowKey<?>) tree.getRowKey();
            ResourceTreeNode node = (ResourceTreeNode) tree.getRowData(key);
            ResourceTreeNode selectedNode = (ResourceTreeNode) tree.getRowData(state.getSelectedNode());

            ResourceTreeNode traverseCheckNode = selectedNode.getParent();
            while (traverseCheckNode != null) {
                if (node.equals(traverseCheckNode)) {
                    closingParent = true;
                    break;
                }
                traverseCheckNode = traverseCheckNode.getParent();
            }

            if (closingParent) {
                if (redirectTo(node)) {
                    state.setSelected(key);
                    openNodes.remove(node);
                   
                    //this is nasty hack. We need some kind of flag that would persist only for the remainder
                    //of this request to advertise that no more open/closed states should be made in this request.
                    //The tree is request scoped, so setting this flag will not persist to the next request.
View Full Code Here

Examples of org.richfaces.component.state.TreeState

        }
    }

    public void nodeSelectListener(org.richfaces.event.NodeSelectedEvent e) {
        HtmlTree tree = (HtmlTree) e.getComponent();
        TreeState state = (TreeState) ((HtmlTree) tree).getComponentState();

        ResourceTreeNode node = (ResourceTreeNode) tree.getRowData(tree.getRowKey());

        if (node != null && !redirectTo(node)) {
            state.setSelected(e.getOldSelection());
        }
    }
View Full Code Here

Examples of org.richfaces.component.state.TreeState

        }
        return ret;
    }

    public Boolean adviseNodeSelected(UITree tree) {
        TreeState state = (TreeState) ((HtmlTree) tree).getComponentState();
        String id = FacesContextUtility.getOptionalRequestParameter("id");
        String parent = FacesContextUtility.getOptionalRequestParameter("parent");
        String type = FacesContextUtility.getOptionalRequestParameter("type");
        ResourceTreeNode node = (ResourceTreeNode) tree.getRowData(tree.getRowKey());

        if (node.getData() instanceof AutoGroupCompositeFlyweight) {
            AutoGroupCompositeFlyweight ag = (AutoGroupCompositeFlyweight) node.getData();
            if (ag.getParentResource() != null && ag.getResourceType() != null
                && String.valueOf(ag.getParentResource().getId()).equals(parent)
                && String.valueOf(ag.getResourceType().getId()).equals(type)) {
                return true;
            }
        } else if (node.getData() instanceof ResourceFlyweight) {
            if (String.valueOf(((ResourceFlyweight) node.getData()).getId()).equals(id)) {
                return Boolean.TRUE;
            }
        }

       
        return tree.getRowKey().equals(state.getSelectedNode());
    }
View Full Code Here

Examples of org.richfaces.component.state.TreeState

        return Integer.parseInt(groupId);
    }

    public void changeExpandListener(org.richfaces.event.NodeExpandedEvent e) {
        HtmlTree tree = (HtmlTree) e.getComponent();
        TreeState state = (TreeState) tree.getComponentState();

        //check if we're collapsing a parent of currently selected node.
        //if we do, change the focus to the parent
        if (state.getSelectedNode() != null) {
            boolean closingParent = false;

            TreeRowKey<?> key = (TreeRowKey<?>) tree.getRowKey();
            ResourceGroupTreeNode node = (ResourceGroupTreeNode) tree.getRowData(key);
            ResourceGroupTreeNode selectedNode = (ResourceGroupTreeNode) tree.getRowData(state.getSelectedNode());

            ResourceGroupTreeNode traverseCheckNode = selectedNode.getParent();
            while (traverseCheckNode != null) {
                if (node.equals(traverseCheckNode)) {
                    closingParent = true;
                    break;
                }
                traverseCheckNode = traverseCheckNode.getParent();
            }

            if (closingParent) {
                if (redirectTo(node)) {
                    state.setSelected(key);
                    openNodes.remove(node);
                   
                    //this is nasty hack. We need some kind of flag that would persist only for the remainder
                    //of this request to advertise that no more open/closed states should be made in this request.
                    //The tree is request scoped, so setting this flag will not persist to the next request.
View Full Code Here

Examples of org.richfaces.component.state.TreeState

        return ret;
    }

    public void nodeSelectListener(org.richfaces.event.NodeSelectedEvent e) {
        HtmlTree tree = (HtmlTree) e.getComponent();
        TreeState state = (TreeState) ((HtmlTree) tree).getComponentState();

        TreeRowKey<?> key = (TreeRowKey<?>) tree.getRowKey();
        ResourceGroupTreeNode node = (ResourceGroupTreeNode) tree.getRowData(key);

        if (node != null && !redirectTo(node)) {
            state.setSelected(e.getOldSelection());
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.