yfiles.client.tiles.EditMode
Class EditMode

This class implements a main edit mode for interacting with a graph displayed in a GraphCanvas.

The EditMode dispatches some of its tasks to instances of CreateEdgeMode, MoveSelectionMode, ResizeNodesMode, RectangularSelectionMode and EditLabelMode, respectively. If the EditMode is activated, it maintains a GraphSelection and connects selecting nodes and edges to highlighting these nodes and edges in the graph canvas. It handles user input by changing the graph possibly through activating one of the above mentioned input modes as child modes. A list of user input gestures and the actions they trigger is given in the comment for activate().

 
All Parent Classes:
InputMode
 
Field Summary
 Number hotSpotSize
          the size (width and height) of the hot spots for activating the ResizeNodesMode in pixels, default 10 (read/write)
 String nodeType
          the type of newly created nodes sent to the server side, default null (read/write)
 
Constructor Summary
EditMode(/*GraphCanvas*/ canvas, /*Boolean*/ selectNodes, /*Boolean*/ selectEdges, /*Boolean*/ routeEdges, /*HierarchyManager*/ hierarchyManager)
           This class implements a main edit mode for interacting with a graph displayed in a GraphCanvas.
 
Method Summary
  activate()
          activates this input mode.
  allowEdgeCreation(/*Boolean*/ flag)
          specifies, whether creating edges is allowed (default true).
  allowElementRemoval(/*Boolean*/ flag)
          specifies, whether deleting nodes and edges is allowed (default true).
  allowLabelEditing(/*Boolean*/ flag)
          specifies, whether editing labels is allowed (default true).
  allowMoveSelection(/*Boolean*/ flag)
          specifies, whether moving the selection is allowed (default true).
  allowNodeCreation(/*Boolean*/ flag)
          specifies, whether creating nodes is allowed (default true).
  allowResizeNodes(/*Boolean*/ flag)
          specifies, whether resizing the selected nodes is allowed (default true).
  clearSelection()
          clears the current selection.
 CreateEdgeMode createCreateEdgeMode(/*GraphCanvas*/ canvas, /*Boolean*/ routeEdges)
          returns an instance of CreateEdgeMode.
 EditLabelMode createEditLabelMode(/*GraphCanvas*/ canvas)
          returns an instance of EditLabelMode.
 GroupNavigationMode createGroupNavigationMode(/*GraphCanvas*/ canvas, /*HierarchyManager*/ hierarchyManager)
          returns an instance of GroupNavigationMode.
 MoveSelectionMode createMoveSelectionMode(/*GraphCanvas*/ canvas, /*GraphSelection*/ selection, /*HierarchyManager*/ hierarchyManager)
          returns an instance of MoveSelectionMode.
  createNode(/*Graph*/ graph, /*Number*/ x, /*Number*/ y, /*String*/ nodeType)
          creates a new node at the world coordinates (x,y).
 RectangularSelectionMode createRectangularSelectionMode(/*GraphCanvas*/ canvas, /*GraphSelection*/ selection, /*HierarchyManager*/ hierarchyManager)
          returns an instance of RectangularSelectionMode.
 ResizeNodesMode createResizeNodesMode(/*GraphCanvas*/ canvas, /*GraphSelection*/ selection)
          returns an instance of ResizeNodesMode.
  deactivate()
          deactivates this input mode.
 Boolean doAllowEdgeCreation()
          returns, whether creating edges is allowed.
 Boolean doAllowElementRemoval()
          returns, whether deleting nodes and edges is allowed.
 Boolean doAllowLabelEditing()
          returns, whether editing labels is allowed.
 Boolean doAllowMoveSelection()
          returns, whether moving the selection is allowed.
 Boolean doAllowNodeCreation()
          returns, whether creating nodes is allowed.
 Boolean doAllowResizeNodes()
          returns, whether resizing nodes is allowed.
  editLabel(/*String*/ id)
          starts editing a node label, if label editing is allowed and an edit label mode is set.
 CreateEdgeMode getCreateEdgeMode()
          returns the create edge mode used by this edit mode.
 Number getEdgeTestSensitivity()
          gets the edge test sensitivity in pixels (view units).
 EditLabelMode getEditLabelMode()
          returns the label editing mode used by this edit mode.
 MoveSelectionMode getMoveSelectionMode()
          returns the move selection mode used by this edit mode.
 ResizeNodesMode getResizeNodesMode()
          returns the resize nodes mode used by this edit mode.
 GraphSelection getSelection()
          returns the current selection.
  removeElements(/*Graph*/ graph, /*String[]*/ ids)
          removes the elements with the given ids from the graph.
  setCreateEdgeMode(/*CreateEdgeMode*/ createEdgeMode)
          sets the create edge mode used by this edit mode. createdEdgeMode: The new CreateEdgeMode.
  setEdgeTestSensitivity(/*Number*/ sensitivity)
          sets the edge test sensitivity in pixels (view units).
  setEditLabelMode(/*EditLabelMode*/ editLabelMode)
          sets the edit label mode used by this edit mode.
  setMoveSelectionMode(/*MoveSelectionMode*/ moveSelectionMode)
          sets the move selection mode used by this edit mode.
  setResizeNodesMode(/*ResizeNodesMode*/ resizeNodesMode)
          sets the resize nodes mode used by this edit mode.
 
Field Detail

hotSpotSize

/*Number*/ hotSpotSize
the size (width and height) of the hot spots for activating the ResizeNodesMode in pixels, default 10 (read/write)

nodeType

/*String*/ nodeType
the type of newly created nodes sent to the server side, default null (read/write)
 
Constructor Detail

EditMode

EditMode(/*GraphCanvas*/ canvas, /*Boolean*/ selectNodes, /*Boolean*/ selectEdges, /*Boolean*/ routeEdges, /*HierarchyManager*/ hierarchyManager)
This class implements a main edit mode for interacting with a graph displayed in a GraphCanvas.
The EditMode dispatches some of its tasks to instances of CreateEdgeMode, MoveSelectionMode, ResizeNodesMode, RectangularSelectionMode and EditLabelMode, respectively. If the EditMode is activated, it maintains a GraphSelection and connects selecting nodes and edges to highlighting these nodes and edges in the graph canvas. It handles user input by changing the graph possibly through activating one of the above mentioned input modes as child modes. A list of user input gestures and the actions they trigger is given in the comment for activate().
Parameters:
canvas - the canvas instance this mode works on
selectNodes - if true, nodes are selectable (default true)
selectEdges - if true, edges are selectable (default true)
routeEdges - if true, newly created edges are roued (default false)
hierarchyManager - optional hierarchy manager for the graph of the canvas
Method Detail

activate

activate()
activates this input mode.
The canvas is fix()ed. Certain user gestures trigger changes of the graph or the activation of one of the child input modes which might change the graph in turn. Moreover there is a visual indication, whether the mouse is considered to be over a node or an edge or over empty space.

allowEdgeCreation

allowEdgeCreation(/*Boolean*/ flag)
specifies, whether creating edges is allowed (default true).
Parameters:
flag - If true then edges can be created.

allowElementRemoval

allowElementRemoval(/*Boolean*/ flag)
specifies, whether deleting nodes and edges is allowed (default true).
Parameters:
flag - If true then nodes and edges can be removed from the graph.

allowLabelEditing

allowLabelEditing(/*Boolean*/ flag)
specifies, whether editing labels is allowed (default true).
Parameters:
flag - If true then labels can be edited.

allowMoveSelection

allowMoveSelection(/*Boolean*/ flag)
specifies, whether moving the selection is allowed (default true).
Parameters:
flag - If true then the selection can be moved.

allowNodeCreation

allowNodeCreation(/*Boolean*/ flag)
specifies, whether creating nodes is allowed (default true).
Parameters:
flag - If true then nodes can be created.

allowResizeNodes

allowResizeNodes(/*Boolean*/ flag)
specifies, whether resizing the selected nodes is allowed (default true).
Parameters:
flag - If true then nodes can be resized.

clearSelection

clearSelection()
clears the current selection.

createCreateEdgeMode

CreateEdgeMode createCreateEdgeMode(/*GraphCanvas*/ canvas, /*Boolean*/ routeEdges)
returns an instance of CreateEdgeMode.
This function is called at initialization time. It can be overwritten in a subclass to return a customized input mode.
Parameters:
canvas - The graph canvas.
routeEdges - If true, the newly created edges will be routed; otherwise they wont be.

createEditLabelMode

EditLabelMode createEditLabelMode(/*GraphCanvas*/ canvas)
returns an instance of EditLabelMode.
This function is called at initialization time. It can be overwritten in a subclass to return a customized input mode.
Parameters:
canvas - The graph canvas.

createGroupNavigationMode

GroupNavigationMode createGroupNavigationMode(/*GraphCanvas*/ canvas, /*HierarchyManager*/ hierarchyManager)
returns an instance of GroupNavigationMode.
This function is called at initialization time, if a hierarchy manager is present. It can be overwritten in a subclass to return a customized input mode.
Parameters:
canvas - The graph canvas.
hierarchyManager - The hierarchy manager associated with the graph.

createMoveSelectionMode

MoveSelectionMode createMoveSelectionMode(/*GraphCanvas*/ canvas, /*GraphSelection*/ selection, /*HierarchyManager*/ hierarchyManager)
returns an instance of MoveSelectionMode.
This function is called at initialization time. It can be overwritten in a subclass to return a customized input mode.
Parameters:
canvas - The graph canvas.
selection - The selection on the graph.
hierarchyManager - The hierarchy manager.

createNode

createNode(/*Graph*/ graph, /*Number*/ x, /*Number*/ y, /*String*/ nodeType)
creates a new node at the world coordinates (x,y).
This function is used, if the user clicks on an empty location and creating nodes is allowed. It can be customized in subclasses.
Parameters:
graph - The graph instance.
x - The x coordinate of the new node.
y - The y coordinate of the new node.
nodeType - The type of the new node.

createRectangularSelectionMode

RectangularSelectionMode createRectangularSelectionMode(/*GraphCanvas*/ canvas, /*GraphSelection*/ selection, /*HierarchyManager*/ hierarchyManager)
returns an instance of RectangularSelectionMode.
This function is called at initialization time. It can be overwritten in a subclass to return a customized input mode.
Parameters:
canvas - The graph canvas.
selection - The selection on the graph.
hierarchyManager - The hierarchy manager.

createResizeNodesMode

ResizeNodesMode createResizeNodesMode(/*GraphCanvas*/ canvas, /*GraphSelection*/ selection)
returns an instance of ResizeNodesMode.
This function is called at initialization time. It can be overwritten in a subclass to return a customized input mode.
Parameters:
canvas - The graph canvas.
selection - The selection on the graph.

deactivate

deactivate()
deactivates this input mode.
The selection is cleared. The canvas is release()d. The user input as described in activate() is no longer handled.

doAllowEdgeCreation

Boolean doAllowEdgeCreation()
returns, whether creating edges is allowed.
This mode will act according to the return value of this method.

doAllowElementRemoval

Boolean doAllowElementRemoval()
returns, whether deleting nodes and edges is allowed.
This mode will act according to the return value of this method.

doAllowLabelEditing

Boolean doAllowLabelEditing()
returns, whether editing labels is allowed.
This mode will act according to the return value of this method.

doAllowMoveSelection

Boolean doAllowMoveSelection()
returns, whether moving the selection is allowed.
This mode will act according to the return value of this method.

doAllowNodeCreation

Boolean doAllowNodeCreation()
returns, whether creating nodes is allowed.
This mode will act according to the return value of this method.

doAllowResizeNodes

Boolean doAllowResizeNodes()
returns, whether resizing nodes is allowed.
This mode will act according to the return value of this method.

editLabel

editLabel(/*String*/ id)
starts editing a node label, if label editing is allowed and an edit label mode is set.
This method can be used in event handlers for menu entries or buttons.
Parameters:
id - id of a node or a node label

getCreateEdgeMode

CreateEdgeMode getCreateEdgeMode()
returns the create edge mode used by this edit mode.

getEdgeTestSensitivity

Number getEdgeTestSensitivity()
gets the edge test sensitivity in pixels (view units).

getEditLabelMode

EditLabelMode getEditLabelMode()
returns the label editing mode used by this edit mode.

getMoveSelectionMode

MoveSelectionMode getMoveSelectionMode()
returns the move selection mode used by this edit mode.

getResizeNodesMode

ResizeNodesMode getResizeNodesMode()
returns the resize nodes mode used by this edit mode.

getSelection

GraphSelection getSelection()
returns the current selection.

removeElements

removeElements(/*Graph*/ graph, /*String[]*/ ids)
removes the elements with the given ids from the graph.
This function is used by this mode, if removal of elements is allowed. It can be customized in a subclass.
Parameters:
graph -
ids -

setCreateEdgeMode

setCreateEdgeMode(/*CreateEdgeMode*/ createEdgeMode)
sets the create edge mode used by this edit mode. createdEdgeMode: The new CreateEdgeMode.
Parameters:
createEdgeMode -

setEdgeTestSensitivity

setEdgeTestSensitivity(/*Number*/ sensitivity)
sets the edge test sensitivity in pixels (view units).
Parameters:
sensitivity -

setEditLabelMode

setEditLabelMode(/*EditLabelMode*/ editLabelMode)
sets the edit label mode used by this edit mode.
Parameters:
editLabelMode - Thew new EditLabelMode.

setMoveSelectionMode

setMoveSelectionMode(/*MoveSelectionMode*/ moveSelectionMode)
sets the move selection mode used by this edit mode.
Parameters:
moveSelectionMode - The new MoveSelectionMode.

setResizeNodesMode

setResizeNodesMode(/*ResizeNodesMode*/ resizeNodesMode)
sets the resize nodes mode used by this edit mode.
Parameters:
resizeNodesMode - The new ResizeNodesMode.

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