Class MoveNodeAction

java.lang.Object
javax.swing.AbstractAction
ca.phon.opgraph.app.commands.HookableCommand
ca.phon.app.opgraph.editor.actions.OpgraphEditorAction
ca.phon.app.opgraph.editor.actions.graph.MoveNodeAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public class MoveNodeAction extends OpgraphEditorAction
See Also:
  • Constructor Details

    • MoveNodeAction

      public MoveNodeAction(OpgraphEditor editor, int deltaX, int deltaY)
      Constructs a move command that moves the current node selection in the given graph canvas, with this edit posted in the given undo manager.
      Parameters:
      deltaX - the x-axis delta
      deltaY - the y-axis delta
  • Method Details

    • getMoveString

      public static String getMoveString(int xDelta, int yDelta)
      Get a textual representation of the given deltas. More specifically:
      • if Δx == 0 and Δy > 0, "Up"
      • if Δx == 0 and Δy invalid input: '<' 0, "Down"
      • if Δy == 0 and Δx > 0, "Right"
      • if Δy == 0 and Δx invalid input: '<' 0, "Left"
      • otherwise, ""
      Parameters:
      xDelta - the x-axis delta
      yDelta - the y-axis delta
      Returns:
      a textual representation that best represents the action of the specified deltas
    • getIcon

      public static ImageIcon getIcon(int xDelta, int yDelta)
    • getMoveKeystroke

      public static KeyStroke getMoveKeystroke(int xDelta, int yDelta)
      Get a keystroke for the given deltas. More specifically:
      • if Δx == 0 and Δy > 0, "Up"
      • if Δx == 0 and Δy invalid input: '<' 0, "Down"
      • if Δy == 0 and Δx > 0, "Right"
      • if Δy == 0 and Δx invalid input: '<' 0, "Left"
      • otherwise, null
      Parameters:
      xDelta - the x-axis delta
      yDelta - the y-axis delta
      Returns:
      a keystroke for the specified deltas
    • hookableActionPerformed

      public void hookableActionPerformed(ActionEvent e)
      Specified by:
      hookableActionPerformed in class ca.phon.opgraph.app.commands.HookableCommand