has anyone created a dynamic two or three level tree?
Hi -
If anyone has created a dynamic two or three level tree, can you please explain and/or show a code example of how you did it? The 'dynamic tree tutorial' doesn't show the child node being created dynamically, but graphically.
I can build the first level fine, but how does the child node get associated with the parent node in the next level?
Thanks in advance.
[395 byte] By [
yukhntr] at [2007-11-26 8:55:02]

# 1
Here's a snippet that might help. I'm sure there are more elegant ways to code it but this seems to work!
Good luck,
Keith
//1st Loop - executed once per first level of tree
for (int i = 0; i <= days; i++) {
j = i+1;
TreeNode newFirstNode = new TreeNode();
newFirstNode.setId("day" + j);
newFirstNode.setText("First " + j );
itineraryNodeChildren.add(newFirstNode);
java.util.List firstNodeChildren = newFirstNode.getChildren();
// Second Loop executed once per Second level within the First loop
for (int k=0; k<rk; k++) {
secondNumber ++;
TreeNode newSecondNode = new TreeNode();
newSecondNode.setText(secondNodeText);
firstNodeChildren.add(newSecondNode);
}>