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:
yfiles/client/tiles/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(yfiles/client/tiles/widget/GraphCanvas canvas, Boolean selectNodes, Boolean selectEdges, Boolean routeEdges, yfiles/client/tiles/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.

 yfiles/client/tiles/CreateEdgeMode createCreateEdgeMode(yfiles/client/tiles/widget/GraphCanvas canvas, Boolean routeEdges)           

returns an instance of CreateEdgeMode.

 yfiles/client/tiles/EditLabelMode createEditLabelMode(yfiles/client/tiles/widget/GraphCanvas canvas)           

returns an instance of EditLabelMode.

 yfiles/client/tiles/GroupNavigationMode createGroupNavigationMode(yfiles/client/tiles/widget/GraphCanvas canvas, yfiles/client/tiles/HierarchyManager hierarchyManager)           

returns an instance of GroupNavigationMode.

 yfiles/client/tiles/MoveSelectionMode createMoveSelectionMode(yfiles/client/tiles/widget/GraphCanvas canvas, yfiles/client/tiles/GraphSelection selection, yfiles/client/tiles/HierarchyManager hierarchyManager)           

returns an instance of MoveSelectionMode.

  createNode(yfiles/client/tiles/Graph graph, Number x, Number y, String nodeType)           

creates a new node at the world coordinates (x,y).

 yfiles/client/tiles/RectangularSelectionMode createRectangularSelectionMode(yfiles/client/tiles/widget/GraphCanvas canvas, yfiles/client/tiles/GraphSelection selection, yfiles/client/tiles/HierarchyManager hierarchyManager)           

returns an instance of RectangularSelectionMode.

 yfiles/client/tiles/ResizeNodesMode createResizeNodesMode(yfiles/client/tiles/widget/GraphCanvas canvas, yfiles/client/tiles/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.

 yfiles/client/tiles/CreateEdgeMode getCreateEdgeMode()           

returns the create edge mode used by this edit mode.

 Number getEdgeTestSensitivity()           

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

 yfiles/client/tiles/EditLabelMode getEditLabelMode()           

returns the label editing mode used by this edit mode.

 yfiles/client/tiles/MoveSelectionMode getMoveSelectionMode()           

returns the move selection mode used by this edit mode.

 yfiles/client/tiles/ResizeNodesMode getResizeNodesMode()           

returns the resize nodes mode used by this edit mode.

 yfiles/client/tiles/GraphSelection getSelection()           

returns the current selection.

  removeElements(yfiles/client/tiles/Graph graph, String[] ids)           

removes the elements with the given ids from the graph.

  setCreateEdgeMode(yfiles/client/tiles/CreateEdgeMode createEdgeMode)           

sets the create edge mode used by this edit mode.

  setEdgeTestSensitivity(Number sensitivity)           

sets the edge test sensitivity in pixels (view units)

  setEditLabelMode(yfiles/client/tiles/EditLabelMode editLabelMode)           

sets the edit label mode used by this edit mode.

  setMoveSelectionMode(yfiles/client/tiles/MoveSelectionMode moveSelectionMode)           

sets the move selection mode used by this edit mode.

  setResizeNodesMode(yfiles/client/tiles/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(yfiles/client/tiles/widget/GraphCanvas canvas, Boolean selectNodes, Boolean selectEdges, Boolean routeEdges, yfiles/client/tiles/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

yfiles/client/tiles/CreateEdgeMode createCreateEdgeMode(yfiles/client/tiles/widget/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

yfiles/client/tiles/EditLabelMode createEditLabelMode(yfiles/client/tiles/widget/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

yfiles/client/tiles/GroupNavigationMode createGroupNavigationMode(yfiles/client/tiles/widget/GraphCanvas canvas, yfiles/client/tiles/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

yfiles/client/tiles/MoveSelectionMode createMoveSelectionMode(yfiles/client/tiles/widget/GraphCanvas canvas, yfiles/client/tiles/GraphSelection selection, yfiles/client/tiles/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(yfiles/client/tiles/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

yfiles/client/tiles/RectangularSelectionMode createRectangularSelectionMode(yfiles/client/tiles/widget/GraphCanvas canvas, yfiles/client/tiles/GraphSelection selection, yfiles/client/tiles/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

yfiles/client/tiles/ResizeNodesMode createResizeNodesMode(yfiles/client/tiles/widget/GraphCanvas canvas, yfiles/client/tiles/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.


doAllowElementRemoval

Boolean doAllowElementRemoval()

returns whether deleting nodes and edges is allowed.


doAllowLabelEditing

Boolean doAllowLabelEditing()

returns whether editing labels is allowed.


doAllowMoveSelection

Boolean doAllowMoveSelection()

returns whether moving the selection is allowed.


doAllowNodeCreation

Boolean doAllowNodeCreation()

returns whether creating nodes is allowed.


doAllowResizeNodes

Boolean doAllowResizeNodes()

returns whether resizing nodes is allowed.


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

yfiles/client/tiles/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

yfiles/client/tiles/EditLabelMode getEditLabelMode()

returns the label editing mode used by this edit mode.


getMoveSelectionMode

yfiles/client/tiles/MoveSelectionMode getMoveSelectionMode()

returns the move selection mode used by this edit mode.


getResizeNodesMode

yfiles/client/tiles/ResizeNodesMode getResizeNodesMode()

returns the resize nodes mode used by this edit mode.


getSelection

yfiles/client/tiles/GraphSelection getSelection()

returns the current selection.


removeElements

 removeElements(yfiles/client/tiles/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 -

The graph instance to remove elements from

ids -

The IDs of the graph items that should be removed


setCreateEdgeMode

 setCreateEdgeMode(yfiles/client/tiles/CreateEdgeMode createEdgeMode)

sets the create edge mode used by this edit mode.

Parameters:
createEdgeMode -

The new CreateEdgeMode.


setEdgeTestSensitivity

 setEdgeTestSensitivity(Number sensitivity)

sets the edge test sensitivity in pixels (view units)

Parameters:
sensitivity -

The new sensitivity value, in pixels


setEditLabelMode

 setEditLabelMode(yfiles/client/tiles/EditLabelMode editLabelMode)

sets the edit label mode used by this edit mode.

Parameters:
editLabelMode -

The new EditLabelMode.


setMoveSelectionMode

 setMoveSelectionMode(yfiles/client/tiles/MoveSelectionMode moveSelectionMode)

sets the move selection mode used by this edit mode.

Parameters:
moveSelectionMode -

The new MoveSelectionMode.


setResizeNodesMode

 setResizeNodesMode(yfiles/client/tiles/ResizeNodesMode resizeNodesMode)

sets the resize nodes mode used by this edit mode.

Parameters:
resizeNodesMode -

The new ResizeNodesMode.


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