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 TypeMethodDescriptionvoidcancel(ViewModelGraph graph) Stops / cancels the edge creation processvoidcreate(UUID sourceTarget, ViewModelGraph graph, ISyntaxFactory factory) Start the edge creation process.javafx.scene.NodeGet 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 toolbooleanCheck if the tool is currently creating a new edge or notvoidEvent handler for the case where the model editor viewport has been interacted with with the keyboardvoidEvent handler for the case where a vertex has been interacted with with the mousevoidEvent handler for the case where the model editor viewport has been interacted with with the mousevoidrelease(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:IToolGet a multiline string that describe the tool and how to use it- Returns:
- a (possibly) multiline string
-
getTooltip
Description copied from interface:IToolGet a multiline tooltip string that briefly describes this tool- Specified by:
getTooltipin interfaceITool- Overrides:
getTooltipin classAbstractBaseTool- Returns:
- a (possibly) multiline string
-
getGraphic
public javafx.scene.Node getGraphic()Description copied from interface:IToolGet 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:IToolEvent handler for the case where a vertex has been interacted with with the mouse- Specified by:
onVertexMouseEventin interfaceITool- Overrides:
onVertexMouseEventin classAbstractBaseTool- Parameters:
e- The event that happened
-
onViewportMouseEvent
Description copied from interface:IToolEvent handler for the case where the model editor viewport has been interacted with with the mouse- Specified by:
onViewportMouseEventin interfaceITool- Overrides:
onViewportMouseEventin classAbstractBaseTool- Parameters:
e- The event that happened
-
onKeyEvent
Description copied from interface:IToolEvent handler for the case where the model editor viewport has been interacted with with the keyboard- Specified by:
onKeyEventin interfaceITool- Overrides:
onKeyEventin 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
-