Class EdgeCreateTool

java.lang.Object
dk.gtz.graphedit.tool.AbstractBaseTool
dk.gtz.graphedit.tool.EdgeCreateTool
All Implemented Interfaces:
ITool

public class EdgeCreateTool extends AbstractBaseTool
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 Details

    • EdgeCreateTool

      public EdgeCreateTool()
      Create a new instance of EdgeCreateTool
  • Method Details

    • getHelpDescription

      public String 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

      public Optional<String> getTooltip()
      Description copied from interface: ITool
      Get a multiline tooltip string that briefly describes this tool
      Specified by:
      getTooltip in interface ITool
      Overrides:
      getTooltip in class AbstractBaseTool
      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 a FontIcon, but can be anything
      Returns:
      a javafx node that will be displayed inside the tool selector button
    • onVertexMouseEvent

      public void onVertexMouseEvent(VertexMouseEvent e)
      Description copied from interface: ITool
      Event handler for the case where a vertex has been interacted with with the mouse
      Specified by:
      onVertexMouseEvent in interface ITool
      Overrides:
      onVertexMouseEvent in class AbstractBaseTool
      Parameters:
      e - The event that happened
    • onViewportMouseEvent

      public void onViewportMouseEvent(ViewportMouseEvent e)
      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 interface ITool
      Overrides:
      onViewportMouseEvent in class AbstractBaseTool
      Parameters:
      e - The event that happened
    • onKeyEvent

      public void onKeyEvent(ViewportKeyEvent e)
      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 interface ITool
      Overrides:
      onKeyEvent in class AbstractBaseTool
      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

      public void cancel(ViewModelGraph graph)
      Stops / cancels the edge creation process
      Parameters:
      graph - The graph where the current temporary edge is located in
    • release

      public void release(ViewModelProjectResource buffer, UUID releaseTarget, ViewModelGraph graph)
      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 in
      releaseTarget - Id of the target vertex to finalize the edge to
      graph - The graph where the current temporary edge is located in
    • create

      public void create(UUID sourceTarget, ViewModelGraph graph, ISyntaxFactory factory)
      Start the edge creation process.
      Parameters:
      sourceTarget - Id of the source vertex to start creating an edge from
      graph - The graph where the temporary edge shall be located in
      factory - The associated syntax factory