|
|||||
SUMMARY: FIELD | CONSTR | METHOD| EVENT | DETAIL: FIELD | CONSTR | METHOD| EVENT |
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).
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 |
---|
boolean routeEdges
Object startNode
the start node for the edge to be created (read/write)
Constructor Detail |
---|
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).
canvas
- the canvas
routeEdges
- route newly created edges (optional, default false)
Method Detail |
---|
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.
nodeId
- The id of the node.
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.
nodeId
- The id of the node.
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()
cancels creating an edge properly and reactivates the parent input mode.
This implementation just calls deactivate.
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.
graph
- The graph that contains the nodes.
startNodeId
- The id of the starting node.
endNodeId
- The id of the ending node.
deactivate()
deactivates this instance.
The CanvasDragLine becomes invisible.
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.
nodeId
- The id of the node.