Hi,

I Never used trees before, so...
I would like to have a ROOT with x sons ( no grandsons at all )
How can I create this?
I thought that doing
children.add(node)
will not create a son but a brother.


I have this, but this is creating a ROOT, a son, a grandson,
grand-grandson, etc (4 generations)
/************************************************************************************/
this is from the action class:
        public Node getRootNode() {
                return new Node("root", "ROOT");
                //return new Node(0,"ROOT",4,4);
        }
/*************************************************************************************/
the Node class
public class Node {
        private String id;
        private String title;
        public Node() {}
        public Node(String id, String title) {
                this.id = id;
                this.title = title;
        }
        //setters and getters

        public static int counter = 1;
        public List <Node> getChildren() {
                List<Node> children = new ArrayList<Node>();
                if (counter < 5) {
                        Node child = new Node("node" + counter, "Generation " + 
counter);
                        children.add(child);
                        counter++;
                }
                return children;
        }
/************************************************************************************/
and the tree:
<sx:tree rootNode="rootNode"
                nodeTitleProperty="title"
                nodeIdProperty="id"
                childCollectionProperty="children"
                selectedNotifyTopics="nodeSelectedNotification">
</sx:tree>
/*************************************************************************************/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to