Package dk.gtz.graphedit.tool
Class EdgeCreateTool
java.lang.Object
dk.gtz.graphedit.tool.AbstractBaseTool
dk.gtz.graphedit.tool.EdgeCreateTool
- All Implemented Interfaces:
ITool
Tool to create edges between vertices.
When selected, click a vertex to start creating an edge and complete the edge by clicking another vertex.
You can cancel edge creation by clicking at the canvas, the initial vertex again or by pressing ESC
Note that the action completes at edge completion (second click) rather than edge creation (first click).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel
(ViewModelGraph graph) Stops / cancels the edge creation processvoid
create
(UUID sourceTarget, ViewModelGraph graph, ISyntaxFactory factory) Start the edge creation process.javafx.scene.Node
Get the graphical representation for the tool selection button.Get a multiline string that describe the tool and how to use itGet a multiline tooltip string that briefly describes this toolboolean
Check if the tool is currently creating a new edge or notvoid
Event handler for the case where the model editor viewport has been interacted with with the keyboardvoid
Event handler for the case where a vertex has been interacted with with the mousevoid
Event handler for the case where the model editor viewport has been interacted with with the mousevoid
release
(ViewModelProjectResource buffer, UUID releaseTarget, ViewModelGraph graph) Finishes the edge creation process.Methods inherited from class dk.gtz.graphedit.tool.AbstractBaseTool
onEdgeMouseEvent
-
Constructor Details
-
EdgeCreateTool
public EdgeCreateTool()Create a new instance ofEdgeCreateTool
-
-
Method Details
-
getHelpDescription
Description copied from interface:ITool
Get a multiline string that describe the tool and how to use it- Returns:
- a (possibly) multiline string
-
getTooltip
Description copied from interface:ITool
Get a multiline tooltip string that briefly describes this tool- Specified by:
getTooltip
in interfaceITool
- Overrides:
getTooltip
in classAbstractBaseTool
- Returns:
- a (possibly) multiline string
-
getGraphic
public javafx.scene.Node getGraphic()Description copied from interface:ITool
Get the graphical representation for the tool selection button. Typically just aFontIcon
, but can be anything- Returns:
- a javafx node that will be displayed inside the tool selector button
-
onVertexMouseEvent
Description copied from interface:ITool
Event handler for the case where a vertex has been interacted with with the mouse- Specified by:
onVertexMouseEvent
in interfaceITool
- Overrides:
onVertexMouseEvent
in classAbstractBaseTool
- Parameters:
e
- The event that happened
-
onViewportMouseEvent
Description copied from interface:ITool
Event handler for the case where the model editor viewport has been interacted with with the mouse- Specified by:
onViewportMouseEvent
in interfaceITool
- Overrides:
onViewportMouseEvent
in classAbstractBaseTool
- Parameters:
e
- The event that happened
-
onKeyEvent
Description copied from interface:ITool
Event handler for the case where the model editor viewport has been interacted with with the keyboard- Specified by:
onKeyEvent
in interfaceITool
- Overrides:
onKeyEvent
in classAbstractBaseTool
- Parameters:
e
- The event that happened
-
isCurrentlyCreatingEdge
public boolean isCurrentlyCreatingEdge()Check if the tool is currently creating a new edge or not- Returns:
- true when the tool is in a state where an edge is being created, otherwise false
-
cancel
Stops / cancels the edge creation process- Parameters:
graph
- The graph where the current temporary edge is located in
-
release
Finishes the edge creation process. Will fail with a warning if the provided graph is not the same one you started creating the edge in- Parameters:
buffer
- The buffer where the undo action should be stored inreleaseTarget
- Id of the target vertex to finalize the edge tograph
- The graph where the current temporary edge is located in
-
create
Start the edge creation process.- Parameters:
sourceTarget
- Id of the source vertex to start creating an edge fromgraph
- The graph where the temporary edge shall be located infactory
- The associated syntax factory
-