A tree component manages a javax.swing.tree.TreeModel
data model, tree node values are rendered as markup using a special object, the renderer, and may be optionally edited "in place" using a user defined editor.
Any change to the data model is notified to the component and the markup is rendered again. The data model ever mandates over the markup, any initial markup content (initial root node) is removed.
Almost a root node must be present in the markup, this element is used as a pattern to create new tree nodes, and is removed because by default the data model is empty.
This component family uses a javax.swing.tree.TreeSelectionModel
to keep track of selection states. When a tree node is selected (usually by clicking it) the selection state is updated accordingly using the selection model (this one fires any listener registered).
There is no default decoration of tree node selection, selection model listeners may be used to decorate the tree node markup when its selection state changes.
The component internally manages the expand/collapse behavior, when a mouse event is received (by default one click on handler, double click if icon or label) usually changes the expand/collapse state, this change is notified sending a javax.swing.event.TreeExpansionEvent
to the registered listeners, these listeners must be used to manage how the expansion/collapsing is rendered visually (by default the component does not modify the view, does not force a default view behavior).
By default this component uses the default renderer and editor and a javax.swing.tree.DefaultTreeModel
data model.
Row indexes start in 0.
This component family is the "componentized" version of {@link org.itsnat.core.domutil.ElementTree} andfollows a similar philosophy.
ItsNat only provides "free trees" because no <tree> tag is present in HTML.
@author Jose Maria Arranz Santamaria
|
|
|
|
|
|
|
|
|
|