Class zwt.ui.tree.Tree
Extends
zwt.ui.Widget.
A tree widget is used to display a set of hierarchical data.
An element of the tree is a zwt.ui.tree.TreeNode in the zwt.ui.tree.TreeModel. Nodes are identified by a tree path which is an array of indices defining the path to the node through the hierarchy of data.
A tree is using a zwt.ui.tree.TreeSelectionModel to handle single or multiple node selection. The selection behavior is specified in a zwt.ui.tree.TreeSelector.
Each node in the tree is rendered using a zwt.ui.tree.TreeNodeRenderer.
CSS rules
.zwt_tree {}
.zwt_tree .zwt_tree-sub {}
.zwt_tree .zwt_tree-item {}
.zwt_tree .zwt_tree-item-cursor {}
.zwt_tree .zwt_tree-item-selected {}
.zwt_tree .zwt_tree-item-dir {}
.zwt_tree .zwt_tree-item-root {}
.zwt_tree .zwt_tree-item .zwt_tree-item-indent {}
.zwt_tree .zwt_tree-item .zwt_tree-item-control {}
.zwt_tree .zwt_tree-item .zwt_tree-item-icon {}
.zwt_tree .zwt_tree-item .zwt_tree-item-label {}
Defined in: Tree.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Construct a tree.
|
Method Attributes | Method Name and Description |
---|---|
Return the click event manager attached to the tree.
|
|
getModel()
Return the tree model that provides the data displayed by the tree.
|
|
Return the mouse event manager attached to the tree.
|
|
Return the renderer used to render nodes in the tree.
|
|
Return the selection model used to maintain the selection state.
|
|
Return the selector used to select nodes in the tree.
|
|
Determine whether animation is enabled.
|
|
processClickEvent(zwt_event_ClickEvent_event)
Process the specified click event.
|
|
processEvent(zwt_event_Event_event)
Process the specified event.
|
|
processFocusEvent(zwt_event_FocusEvent_event)
Process the specified focus event.
|
|
processMouseEvent(zwt_event_MouseEvent_event)
Process the specified mouse event.
|
|
setModel(zwt_ui_tree_TreeModel_model)
Set the tree model.
|
|
setNodeRenderer(zwt_ui_tree_TreeNodeRenderer_renderer)
Set the tree node renderer.
|
|
setSelectionModel(zwt_ui_tree_TreeSelectionModel_model)
Set the selection model.
|
|
setSelector(zwt_ui_tree_TreeSelector_selector)
Set the tree selector.
|
|
setUseAnimation(boolean_flag)
Disable or enable the animation when a node is expanded or collapsed.
|
- Methods borrowed from class zwt.ui.Widget:
- addStyle, draw, getContextFill, getDimension, getElement, getElementDimension, getFill, getFocusEventManager, getId, getKeyboardEventManager, getParent, getRelativeLeft, getRelativeTop, getStyle, getWheelEventManager, hasFocus, hasStyle, isFocusable, isVisible, onEvent, processContentEvent, processKeyboardEvent, processWheelEvent, redraw, removeStyle, replaceStyle, setFill, setFocusable, setId, setStyle, setVisible
- Returns:
- The click event manager
- Returns:
- The tree model
- Returns:
- The mouse event manager
- Returns:
- The tree node renderer
- Returns:
- The selection model.
- Returns:
- The selector
- Returns:
- true if animation is enabled, false otherwise
This method dispatches the event to the tree click event manager with the tree path of the targeted node as extra argument in order to give registered handlers an access to the targeted node.
- Parameters:
- {zwt.event.ClickEvent} zwt_event_ClickEvent_event
- The click event to process
- Parameters:
- {zwt.event.Event} zwt_event_Event_event
- The event to process
- Parameters:
- {zwt.event.FocusEvent} zwt_event_FocusEvent_event
- The focus event to process
This method dispatches the event to the tree click event manager with the tree path of the targeted node as extra argument in order to give registered handlers an access to the targeted node.
- Parameters:
- {zwt.event.MouseEvent} zwt_event_MouseEvent_event
- The mouse event to process
- Parameters:
- {zwt.ui.tree.TreeModel} zwt_ui_tree_TreeModel_model
- The tree model to set
- Parameters:
- {zwt.ui.tree.TreeNodeRenderer} zwt_ui_tree_TreeNodeRenderer_renderer
- The renderer to set
- Parameters:
- {zwt.ui.tree.TreeSelectionModel} zwt_ui_tree_TreeSelectionModel_model
- The selection model to set.
A selector is tightly linked to the tree, therefore a selector instance must not be used in several tree instances.
- Parameters:
- {zwt.ui.tree.TreeSelector} zwt_ui_tree_TreeSelector_selector
- The selector to set
- Parameters:
- {Boolean} boolean_flag
- true to enable animation, false otherwise