The Tree component provides an expandable tree of nodes.
The Tree component is closely modelled on the Swing JTree class. For more information on JTree and Swing visit http://java.sun.com/docs/books/tutorial/uiswing/.
Also for more detailed information about using the Tree component read this article.
Any objects can make up the data of tree, however they should generally implement TreeNode.
There are two types of the Trees. The first is server side trees. These will always return a request to the server when the user clicks on a node, or expands a TreePath. The nodes in the tree can be logically selected and can raise an ActionEvent when clicked on. As usual any ActionListener registered with the Tree will be informed.
This is the most functional type of tree however its drawback is that expansion and collspaing of tree nodes is slow.
The second type is a client side tree. These render themselves on the client and do not send back events to the server when the user expands or collspases a node. This ensures that tree navigation is as fast as possible, however client side trees do not support node selection. They can however raise an ActionEvent when a node in the tree is selected.
The Tree class supports "action command bubbling". If the objects placed in the Tree implement TreeNode then an action command can be identified with each node. When a node is pressed, the associated action command will be raised with any ActionListeners of the Tree. If no action command is associated with a TreeNode then the path to the ancestors will be followed to look for an action command. If no action command can be found, then the action command of the tree itself will be used.