-
1. Re: Question about rich tree
henrym36 Feb 19, 2008 7:54 PM (in response to henrym36)I figured out the problem. Gotta pay attention to the details.
-
2. Re: Question about rich tree
viggo.navarsete Feb 20, 2008 3:03 AM (in response to henrym36)Henrym: Would you mind share your solution to the other members here at the forum? I'm sure other people have problems using the tree as well, and all code that can help them is valuable:)
-
3. Re: Question about rich tree
fabmars Feb 20, 2008 5:56 AM (in response to henrym36)In the JSP, #{item} refers to some treeNode.data, and not some treeNode itself ; that is #{item} refers to some String passed as "display" in the TabTreeNode constructor here.
Regarding the <h:outputText value="#{item.title}" /> , #{item} alone would be enough. But even like that the JSP would throw errors since the nodeFace is unreachable (item being a string and not a TabTreeNode instance).
To make it to work like it's written now, the user has to override getData() in the TabTreeNodeClass and make it return "this".
Maybe it would be cool to explicitely mention in the RichFaces manual that this is the TreeNode.data you're iterating in a tree, and not the TreeNode temselves. -
4. Re: Question about rich tree
henrym36 Feb 20, 2008 4:53 PM (in response to henrym36)The problem was in this line of code.
private tabTreeNode addNode(String display, tabTreeNode node ) {
tabTreeNode tabNode = new tabTreeNode();
tabNode.setTitle(display);
tabNode.setData(display);
------>node.addChild(display, tabNode);<------
return tabNode;
}
addChild is a function that you must impliment when you create a class that implements TreeNode. In order to get this to work, instead of calling addChild directly, you must use this instead.
public void addTab(String display, tabTreeNode newTab) {
addChild(display, newTab);
newTab.setParent(this);
}
You then call addTab and have addTab call addChild. This was in the sample code that I downloaded but I overlooked it. Hope this help someone else.