If a node implements org.apache.pivot.collections.List, it is considered a branch. Otherwise, it is a leaf.
On May 6, 2011, at 8:06 AM, Edvin Syse wrote: > ListAdapter was nice, thanks :) > > But how do I express what is supposed to be Leaf nodes and what to be Branch > nodes? > > -- Edvin > > Den 06.05.2011 13:49, skrev Greg Brown: >> Have you looked at org.apache.pivot.collections.adapter.ListAdapter? You >> might be able to use this in conjunction with TreeViewBranchListener to >> construct your tree nodes from your backing data structure on demand. >> >> G >> >> >> On May 6, 2011, at 7:31 AM, Edvin Syse wrote: >> >>> I have a tree-structure represented by a list of domain objects. Some of >>> the domain objects have a "children" property with a java.util.List of >>> children. The TreeView#setTreeData method takes a >>> org.apache.pivot.collections.List, and I figured I could do: >>> >>> setTreeData(new ArrayList(myJavaUtilListList.toArray())); >>> >>> This works so that I can see the first level of nodes, but I don't know how >>> to express branch nodes. Also, I would like to lazy load some of the nodes. >>> I think I need to use the TreeViewBranchListener somehow, but I can't find >>> any documentation or examples. >>> >>> Do I need to wrap all my domain objects in TreeNodes or is there another >>> way to do this? >>> >>> -- Edvin >>
