Class InsertEdgeCommand

All Implemented Interfaces:
Command

public class InsertEdgeCommand
extends AbstractTransaction
Transaction inserting the edge
  • Constructor Details

    • InsertEdgeCommand

      public InsertEdgeCommand​(AbstractLocation source, int x, int y)
      Constructor
      Parameters:
      source - - The source location
      x - - The x value of the edge
      y - - The y value of the edge
  • Method Details

    • addNail

      public void addNail​(int x, int y)
      Add nail that the graphical layout of the edge.
      Parameters:
      x - - The x value of the edge
      y - - The y value of the edge
    • move

      public void move​(int x, int y)
      Overrides:
      move in class AbstractTransaction
    • commitLocation

      public void commitLocation​(int x, int y)
      Commit the location
      Parameters:
      x - - The x value of the edge
      y - - The y value of the edge
    • commitBranchPoint

      public void commitBranchPoint​(int x, int y)
      Commit the branch point
      Parameters:
      x - - The x value of the edge
      y - - The y value of the edge
    • commit

      public void commit​(AbstractLocation target)
      Commit setting of the destination of this edge
      Parameters:
      target - - The location
    • hasNails

      public boolean hasNails()
      Does the edge has nails
      Returns:
      True : The edge has the start node and the next node
    • getSource

      public AbstractLocation getSource()
      Get the source of the edge
      Returns:
      The source location of the edge
    • getTarget

      public AbstractLocation getTarget()
      Get the target of the edge
      Returns:
      The target location of the edge
    • commit

      public void commit()
      Description copied from class: AbstractTransaction
      Commit the transaction.
      Overrides:
      commit in class AbstractTransaction
    • doCancel

      protected void doCancel()
      Specified by:
      doCancel in class AbstractTransaction
    • doExecute

      protected void doExecute()
      Specified by:
      doExecute in class AbstractTransaction
    • doUndo

      protected void doUndo()
      Specified by:
      doUndo in class AbstractTransaction
    • getModifiedElement

      public Element getModifiedElement()
      Returns:
      the modified element or its closest relative (sibling or parent) if the element is not displayed.