You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by jhomuth <jo...@sourcepark.de> on 2008/10/10 12:53:25 UTC

Expand Tomahawk tree at startup

Hello List,

I quess a simple quesiton. Is it possible to expand the Tomahawk Tree2 
at startup?. I couldn't find any attribute "expand" in the tag.

Thx for suggestions

RE: Expand Tomahawk tree at startup

Posted by Ma...@sanofi-aventis.com.
As far as I know there's no built in method for that, although in my
managed been where I use tree2 I have and expand method which is pretty
simple.

public void expandAllFromNode(TreeNode node) throws SystemException {
        final List children = node.getChildren();
        final int size = children.size();
        TreeState state = (TreeState) model.getTreeState();
        for (int i=0; i<size; i++) {
            TreeNode nextNode = (TreeNode) children.get(i);
            if (nextNode.isFolder()) {
                if (!state.isNodeExpanded(nextNode.getIdentifier())) {
                    state.toggleExpanded(nextNode.getIdentifier());
                }
                loadChildDocuments(nextNode);
                expandAllFromNode(nextNode);
            }
        }        
    }

I have an expandAll method which just passes the root node to this one.
This of course requires a method loadChildDocuments or something similar
that will load that node. Hope this helps.

Matt

-----Original Message-----
From: jhomuth [mailto:johannes.homuth@sourcepark.de] 
Sent: vendredi 10 octobre 2008 12:53
To: MyFaces Discussion
Subject: Expand Tomahawk tree at startup

Hello List,

I quess a simple quesiton. Is it possible to expand the Tomahawk Tree2 
at startup?. I couldn't find any attribute "expand" in the tag.

Thx for suggestions