yfiles/client/tiles/CreateEdgeMode
Class CreateEdgeMode

This is an input mode for creating edges.

A CanvasDragLine is used to display the potential edge once the input mode is activated (see activate).

 
All Parent Classes:
yfiles/client/tiles/InputMode
 
Field Summary
 boolean routeEdges           
 Object startNode           

the start node for the edge to be created (read/write)

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

This is an input mode for creating edges.

 
Method Summary
 boolean acceptSourceNode(String nodeId)           

returns true, if the node with the given id is a possible source node for the new edge.

 boolean acceptTargetNode(String nodeId)           

returns true, if the node with the given id is a possible target node for the new edge.

  activate()           

activates this instance.

  cancelEdgeCreation()           

cancels creating an edge properly and reactivates the parent input mode.

  createEdge(yfiles/client/tiles/Graph graph, String startNodeId, String endNodeId)           

is called for creating the edge.

  deactivate()           

deactivates this instance.

  setTargetNode(String nodeId)           

sets the id of the target node.

 
Field Detail

routeEdges

boolean routeEdges

startNode

Object startNode

the start node for the edge to be created (read/write)

 
Constructor Detail

CreateEdgeMode

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

This is an input mode for creating edges.

A CanvasDragLine is used to display the potential edge once the input mode is activated (see activate).

Parameters:
canvas -

the canvas

routeEdges -

route newly created edges (optional, default false)

Method Detail

acceptSourceNode

boolean acceptSourceNode(String nodeId)

returns true, if the node with the given id is a possible source node for the new edge.

This implementation returns true, if the given id is not null.

Parameters:
nodeId -

The id of the node.


acceptTargetNode

boolean acceptTargetNode(String nodeId)

returns true, if the node with the given id is a possible target node for the new edge.

This implementation always returns true.

Parameters:
nodeId -

The id of the node.


activate

 activate()

activates this instance.

If the attribute startNode is not set or not accepted (see acceptSourceNode), cancelEdgeCreation is called. Otherwise the CanvasDragLine becomes visible. It is assumed that the left mouse button is pressed. An edge is created via createEdge when the user eventually releases the button while the mouse is over an accepted target node (see acceptTargetNode). Setting the current target node is done in setTargetNode. For creating self loops, the user has to leave the start node and enter it again before releasing the button.


cancelEdgeCreation

 cancelEdgeCreation()

cancels creating an edge properly and reactivates the parent input mode.

This implementation just calls deactivate.


createEdge

 createEdge(yfiles/client/tiles/Graph graph, String startNodeId, String endNodeId)

is called for creating the edge.

This implementation just delegates the call to the given graph, if both ids are not null.

Parameters:
graph -

The graph that contains the nodes.

startNodeId -

The id of the starting node.

endNodeId -

The id of the ending node.


deactivate

 deactivate()

deactivates this instance.

The CanvasDragLine becomes invisible.


setTargetNode

 setTargetNode(String nodeId)

sets the id of the target node.

The node with the given id is used as the target node of the new edge, if the user releases the mouse button (see createEdge()). The given parameter may be null.

Parameters:
nodeId -

The id of the node.


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