Class Index | File Index

Classes


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.

Class Summary
Constructor Attributes Constructor Name and Description
 
Construct a tree selection model.
Method Summary
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.
Class Detail
zwt.ui.tree.TreeSelectionModel()
Construct a tree selection model.
Author: Jeremy KUHN.
See:
zwt.ui.tree.Tree
zwt.ui.tree.TreeSelectionModelEvent
Method Detail
addSelection(array_treePath, boolean_exclusive)
Add the specified tree path to the selection.

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.

clearSelection()
Remove all the selected nodes from the selection.

If this represents changes to the current selection then events are emitted to notify the change.


{Integer[][]} getSelectedNodes()
Return the selected nodes.
Returns:
The selected nodes as an array of tree paths.

{zwt.ui.tree.TreeSelectionModelEventManager} getTreeSelectionModelEventManager()
Return the selection model event manager attached to the model.
Returns:
The selection model event manager

{Boolean} isNodeSelected(array_treePath)
Determine whether the node at the specified location is selected.
Parameters:
array_treePath
Returns:
true if the node is selected

{Boolean} isSelectable(array_treePath)
Determine whether the node at the specified location is selectable.

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

onEvent(zwt_ui_tree_TreeSelectionModelEvent_event)
Dispatch the specified selection model event to the appropriate event manager.
Parameters:
{zwt.ui.tree.TreeSelectionModelEvent} zwt_ui_tree_TreeSelectionModelEvent_event
The selection model event to dispatch

removeSelection(array_treePath)
Remove the specified tree path from the selection.

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

setSelection(array_treePaths, boolean_exclusive)
Set the tree selection to the specified tree paths.

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.

shiftPath(array_treePath, boolean_remove)
Shift the current selection based on the specified tree path.

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

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Nov 09 2011 19:29:09 GMT+0100 (CET)