|
|||||
SUMMARY: FIELD | CONSTR | METHOD| EVENT | DETAIL: FIELD | CONSTR | METHOD| EVENT |
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().
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 |
---|
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 Detail |
---|
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().
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()
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.
allowEdgeCreation(Boolean flag)
specifies, whether creating edges is allowed (default true).
flag
- If true
then edges can be created.
allowElementRemoval(Boolean flag)
specifies, whether deleting nodes and edges is allowed (default true).
flag
- If true
then nodes and edges can be removed from the graph.
allowLabelEditing(Boolean flag)
specifies, whether editing labels is allowed (default true).
flag
- If true
then labels can be edited.
allowMoveSelection(Boolean flag)
specifies, whether moving the selection is allowed (default true).
flag
- If true
then the selection can be moved.
allowNodeCreation(Boolean flag)
specifies, whether creating nodes is allowed (default true).
flag
- If true
then nodes can be created.
allowResizeNodes(Boolean flag)
specifies, whether resizing the selected nodes is allowed (default true).
flag
- If true
then nodes can be resized.
clearSelection()
clears the current selection.
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.
canvas
- The graph canvas.
routeEdges
- If true
, the newly created edges will be routed; otherwise they wont be.
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.
canvas
- The graph canvas.
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.
canvas
- The graph canvas.
hierarchyManager
- The hierarchy manager associated with the graph.
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.
canvas
- The graph canvas.
selection
- The selection on the graph.
hierarchyManager
- The hierarchy manager.
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.
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.
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.
canvas
- The graph canvas.
selection
- The selection on the graph.
hierarchyManager
- The hierarchy manager.
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.
canvas
- The graph canvas.
selection
- The selection on the graph.
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.
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.
This method can be used in event handlers for menu entries or buttons.
id
- id of a node or a node label
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.
This function is used by this mode, if removal of elements is allowed. It can be customized in a subclass.
graph
- The graph instance to remove elements from
ids
- The IDs of the graph items that should be removed
setCreateEdgeMode(yfiles/client/tiles/CreateEdgeMode createEdgeMode)
sets the create edge mode used by this edit mode.
createEdgeMode
- The new CreateEdgeMode
.
setEdgeTestSensitivity(Number sensitivity)
sets the edge test sensitivity in pixels (view units)
sensitivity
- The new sensitivity value, in pixels
setEditLabelMode(yfiles/client/tiles/EditLabelMode editLabelMode)
sets the edit label mode used by this edit mode.
editLabelMode
- The new EditLabelMode
.
setMoveSelectionMode(yfiles/client/tiles/MoveSelectionMode moveSelectionMode)
sets the move selection mode used by this edit mode.
moveSelectionMode
- The new MoveSelectionMode
.
setResizeNodesMode(yfiles/client/tiles/ResizeNodesMode resizeNodesMode)
sets the resize nodes mode used by this edit mode.
resizeNodesMode
- The new ResizeNodesMode
.