> 1. Is there a generic method that takes the “Sequence.Tree.Path” value > and traverses the TreeView data model to come up with the correct tree node > that corresponds to that path? Or do I have to write my own, depending on > the type of tree node used? It’s obviously not hard, but I was trying to > save having to write it myself.
You are correct - Sequece.Tree.get() etc. can be used to access and manipulate nested structures. > 2. I don’t see any place for “userData” in the TreeNode object, so if I > want to add stuff (for instance, that is language-independent so I can do > string compares on it in any language), do I have to subclass TreeNode and/or > TreeBranch to create a compatible object to populate the TreeView data model > with? The reason there is no "userData" property on TreeNode is because TreeNode and TreeBranch are simply the default implementations for these classes. Any class that implements List can be a branch, and any Object can be a leaf - you just need to define an appropriate renderer. The default TreeViewNodeRenderer is capable of rendering TreeNode and TreeBranch, but it is fairly easy to write your own - you can see an example of a custom renderer in the XML Viewer demo: http://svn.apache.org/repos/asf/pivot/trunk/demos/src/org/apache/pivot/demos/xml/ This application uses a custom renderer to present instance of org.apache.pivot.xml.Element and org.apache.pivot.xml.TextNode as branches and leaves, respectively. Depending on how you get the data for your tree view, you may find that a custom renderer is more efficient. For example, if you return a tree structure as XML from the server, you could do something similar to what is done in XML Viewer. You can simply use the deserialized XML (obtained from XMLSerializer) as your tree model data. This saves the step of converting your data into TreeNodes and TreeBranches for presentation in the TreeView. > 3. If I create my own classes, can I use them in a .wtkx (now .bxml) > file (with the appropriate namespace definitions)? Yes. > Is there any special setup required for the XML parsing to make my own > namespaces accessible there? Nope, not really. You may find the WTKX Primer helpful in understanding how WTKX maps to Java: http://pivot.apache.org/tutorials/wtkx-primer.html G
