SelectionAPI¶
Description¶
In webVis, a Collection is used to represent the visible selection in the user interface. It is possible to select nodes by using a Collection and/or add/remove individual nodes the the selection by using functions in the webvis API.
- addToSelection(nodeID, silent)¶
Adds the given node to the selection. If recursive is true, the descendents of the node are also added to the selection. If the node is already selected, this function has no effect.
- Arguments
nodeID (
number|Array
) – The ID of the node that should be added to the current selectionsilent (
boolean()
) – Optional- Returns
Promise<ChangeSelectionResult>
- clearSelection(silent)¶
Clears the selection.
- Arguments
silent (
boolean()
) – Optional- Returns
Promise<ChangeSelectionResult>
- getLastSelectedNodeID()¶
- Returns
number
- getSelectedLeafNodes()¶
readonly
Returns the node IDs for all leaf nodes in the current selection.
- Returns
Array<number> – An Array which contains the IDs of all leaf nodes in the current selection
- getSelectedNodes()¶
readonly
Returns the node IDs for all nodes in the current selection. Any operations on this Array will result in undefined behavior.
- Returns
Array<number> – An Array which contains the IDs of all nodes in the current selection
- getSelection()¶
deprecated readonly
Returns the node IDs for all nodes in the current selection. Any operations on this Array will result in undefined behavior.
- Returns
Promise<Array<number>> – An Array which contains the IDs of all nodes in the current selection
- invertSelection(silent)¶
Creates a new selection containing all the nodes that are currently not selected.
- Arguments
silent (
boolean()
) – Optional- Returns
Promise<ChangeSelectionResult>
- isSelected(nodeID)¶
Returns true, if the node is currently selected.
- Arguments
nodeID (
number()
) – The ID of the node for which we would like to know if it is selected or not- Returns
Promise<boolean> – True of the given node is selected, otherwise false
- removeFromSelection(nodeID, silent)¶
Removes the given node from the selection. If recursive is true, the descendents of the node are also removed from the selection. If the given node is not in the selection, this function has no effect.
- Arguments
nodeID (
number|Array
) – The ID of the node that should be removed from the current selectionsilent (
boolean()
) – Optional- Returns
Promise<ChangeSelectionResult>
- selectCollection(collectionID, silent)¶
Replaces the current selection with the nodes from the given collection.
- Arguments
collectionID (
number()
) – Sets the current selection to the given collection of nodessilent (
boolean()
) – Optional- Returns
Promise<void|ChangeSelectionResult>
- setLastSelectedNodeID(nodeID)¶
- Arguments
nodeID (
number()
) –- Returns
void
- setSelection(nodeID, silent)¶
Replaces the current selection with the specified nodes
- Arguments
nodeID (
number|Array
) –silent (
boolean()
) – Optional- Returns
Promise<ChangeSelectionResult>