Class zwt.ui.tree.TreeSelectionModel
Extends
zwt.Object.
A tree selection model represents the current state of the selection in a tree.
As for the tree model, selected nodes are identified by a tree path which is an array of indices defining the path to the node in the tree model.
The implementation internally stores the current selection in a linked list of selection arrays. A selection array is composed of a boolean indicating whether the node is selected or not and an array of child selection arrays (ie. [boolean_selected,[...]]).
It also allows the selection of single and multiple element.
Defined in: TreeSelectionModel.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Construct a tree selection model.
|
Method Attributes | Method Name and Description |
---|---|
addSelection(array_treePath, boolean_exclusive)
Add the specified tree path to the selection.
|
|
Remove all the selected nodes from the selection.
|
|
Return the selected nodes.
|
|
Return the selection model event manager attached to the model.
|
|
isNodeSelected(array_treePath)
Determine whether the node at the specified location is selected.
|
|
isSelectable(array_treePath)
Determine whether the node at the specified location is selectable.
|
|
onEvent(zwt_ui_tree_TreeSelectionModelEvent_event)
Dispatch the specified selection model event to the appropriate event manager.
|
|
removeSelection(array_treePath)
Remove the specified tree path from the selection.
|
|
setSelection(array_treePaths, boolean_exclusive)
Set the tree selection to the specified tree paths.
|
|
shiftPath(array_treePath, boolean_remove)
Shift the current selection based on the specified tree path.
|
Author: Jeremy KUHN.
If this represents a change to the current selection then an event is emitted to notify the change.
- Parameters:
- {Integer[]} array_treePath
- A tree path
- {Boolean} boolean_exclusive
- If exclusive, the change deselects currently selected data.
If this represents changes to the current selection then events are emitted to notify the change.
- Returns:
- The selected nodes as an array of tree paths.
- Returns:
- The selection model event manager
- Parameters:
- array_treePath
- Returns:
- true if the node is selected
This method always returns true. You may override this method to make a specific node unselectable.
- Parameters:
- array_treePath
- Returns:
- true if the node is selectable
- Parameters:
- {zwt.ui.tree.TreeSelectionModelEvent} zwt_ui_tree_TreeSelectionModelEvent_event
- The selection model event to dispatch
If this represents a change to the current selection then an event is emitted to notify the change.
- Parameters:
- {Integer[]} array_treePath
- A tree path
If this represents changes to the current selection then events are emitted to notify the change before the new selection is actually persisted in the model.
- Parameters:
- {Integer[][]} array_treePaths
- An array of tree paths
- {Boolean} boolean_exclusive
- If exclusive, the change deselects currently selected data.
This method is called to sync the selection model with a corresponding change in the data model.
- Parameters:
- {Integer[]} array_treePath
- The tree path to consider for the shift
- {Boolean} boolean_remove
- If true, remove from the tree path