yfiles.client.tiles.GraphSelection
Class GraphSelection

This class realizes a client list of node and/or edge ids.

It is independent of the server side. It does not provide highlighting of selected nodes and edges (see the graph canvas for this). The selectable types of graph elements (nodes and/or edges) are configurable for each instance.

 
Constructor Summary
GraphSelection(/*Boolean*/ selectNodes, /*Boolean*/ selectEdges)
           This class realizes a client list of node and/or edge ids.
 
Method Summary
 Boolean add(/*String*/ id)
          adds the given id to the selection and returns true on success.
  addAll(/*String[]*/ ids)
          calls add() for all the given ids.
  clear()
          clears the current selection.
 String[] get()
          returns an array of ids of all selected graph elements.
 String[] getEdges()
          returns an array of ids of selected edges.
 String[] getNodes()
          returns an array of ids of selected nodes.
 Number getSize()
          returns the number of selected elements.
 Boolean isSelected(/*String*/ id)
          returns true if the given id belongs to the selection and false otherwise.
 Boolean remove(/*String*/ id)
          removes the given id from the selection and returns true on success.
  removeAll(/*String[]*/ ids)
          calls remove() for all the given ids.
  setSelectEdges(/*Boolean*/ bool)
          allow or do not allow the selection of edges.
  setSelectNodes(/*Boolean*/ bool)
          allow or do not allow the selection of nodes.
 Boolean toggle(/*String*/ id)
          toggles the selection state for the given id.
  toggleAll(/*String[]*/ ids)
          calls toggle() for all the given ids.
 
Event Summary
  onAddEdge(/*String*/ edgeId)
          is called whenever an edge id is added to the selection.
  onAddNode(/*String*/ nodeId)
          is called whenever a node id is added to the selection.
  onRemoveEdge(/*String*/ edgeId)
          is called whenever an edge id is removed from the selection.
  onRemoveNode(/*String*/ nodeId)
          is called whenever a node id is removed from the selection.
 
Constructor Detail

GraphSelection

GraphSelection(/*Boolean*/ selectNodes, /*Boolean*/ selectEdges)
This class realizes a client list of node and/or edge ids.
It is independent of the server side. It does not provide highlighting of selected nodes and edges (see the graph canvas for this). The selectable types of graph elements (nodes and/or edges) are configurable for each instance.
Parameters:
selectNodes - whether edges are allowed to be selected
selectEdges -
Method Detail

add

Boolean add(/*String*/ id)
adds the given id to the selection and returns true on success.
Adding fails, if the given id belongs to a graph element which is already in the selection or which is not allowed to be selected.
Parameters:
id - The id of the node or edge that should be selected.

addAll

addAll(/*String[]*/ ids)
calls add() for all the given ids.
Parameters:
ids - An array of ids of nodes or edges that should be selected.

clear

clear()
clears the current selection.

get

String[] get()
returns an array of ids of all selected graph elements.

getEdges

String[] getEdges()
returns an array of ids of selected edges.

getNodes

String[] getNodes()
returns an array of ids of selected nodes.

getSize

Number getSize()
returns the number of selected elements.

isSelected

Boolean isSelected(/*String*/ id)
returns true if the given id belongs to the selection and false otherwise.
Parameters:
id - The node or edge to test.

remove

Boolean remove(/*String*/ id)
removes the given id from the selection and returns true on success.
Removing fails, if the given id belongs to a graph element which does not belong to the selection.
Parameters:
id - The id of the node or edge that should be removed from the selection.

removeAll

removeAll(/*String[]*/ ids)
calls remove() for all the given ids.
Parameters:
ids - An array of ids of nodes or edges that should be deselected.

setSelectEdges

setSelectEdges(/*Boolean*/ bool)
allow or do not allow the selection of edges.
Parameters:
bool - whether edges are allowed to be selected

setSelectNodes

setSelectNodes(/*Boolean*/ bool)
allow or do not allow the selection of nodes.
Parameters:
bool - whether nodes are allowed to be selected

toggle

Boolean toggle(/*String*/ id)
toggles the selection state for the given id.
The id is removed from the selection, if it belongs to the selection. It is added, if it does not belong to the selection and is allowed to be selected. True is returned on success.
Parameters:
id - The id of the node or edge whose selection state should be toggled.

toggleAll

toggleAll(/*String[]*/ ids)
calls toggle() for all the given ids.
Parameters:
ids - An array of ids of nodes or edges whose selection state should be toggled.
Event Detail

onAddEdge

onAddEdge(/*String*/ edgeId)
is called whenever an edge id is added to the selection.
Parameters:
edgeId - The id of the edge.

onAddNode

onAddNode(/*String*/ nodeId)
is called whenever a node id is added to the selection.
Parameters:
nodeId - The id of the node.

onRemoveEdge

onRemoveEdge(/*String*/ edgeId)
is called whenever an edge id is removed from the selection.
Parameters:
edgeId - The id of the edge.

onRemoveNode

onRemoveNode(/*String*/ nodeId)
is called whenever a node id is removed from the selection.
Parameters:
nodeId - The id of the node.

Copyright © 2006-2011 yWorks GmbH. All rights reserved.