Class MoveSelectionCommand

All Implemented Interfaces:
ILayerCommand

public class MoveSelectionCommand extends AbstractSelectionCommand
Command that is used to move a selection into a given direction.

Since 1.2.0 it can be created in several ways, to be able to customize the determination of the steps to move. The following lists the different ways and their effects:

  1. no steps, no strategy
    the ITraversalStrategy configured with the MoveSelectionCommandHandler is used and will be asked for the step count
  2. specify steps to move
    the ITraversalStrategy configured with the MoveSelectionCommandHandler is used but modified to return the given step count
  3. specify traversal strategy
    the given ITraversalStrategy is used and will be asked for the step count. The ITraversalStrategy configured with the MoveSelectionCommandHandler will be ignored.
  • Constructor Details

    • MoveSelectionCommand

      public MoveSelectionCommand(SelectionLayer.MoveDirectionEnum direction, boolean shiftMask, boolean controlMask)
      Creates a MoveSelectionCommand that doesn't specify a step count nor an ITraversalStrategy. Using this constructor will lead to a selection movement that uses the ITraversalStrategy that is registered with the MoveSelectionCommandHandler.
      Parameters:
      direction - The direction to move to.
      shiftMask - boolean flag to indicate whether the shift key modifier is enabled or not
      controlMask - boolean flag to indicate whether the control key modifier is enabled or not
    • MoveSelectionCommand

      public MoveSelectionCommand(SelectionLayer.MoveDirectionEnum direction, Integer stepSize, boolean shiftMask, boolean controlMask)
      Creates a MoveSelectionCommand that specifies the number of steps to move directly. Using this constructor will cause the usage of the registered ITraversalStrategy in the MoveSelectionCommandHandler while using the specified step size.
      Parameters:
      direction - The direction to move to.
      stepSize - The number of steps to move in the given direction.
      shiftMask - boolean flag to indicate whether the shift key modifier is enabled or not
      controlMask - boolean flag to indicate whether the control key modifier is enabled or not
    • MoveSelectionCommand

      public MoveSelectionCommand(SelectionLayer.MoveDirectionEnum direction, ITraversalStrategy traversalStrategy, boolean shiftMask, boolean controlMask)
      Parameters:
      direction - The direction to move to.
      traversalStrategy - the traversal strategy to determine the number of steps to move and the behavior on moving over the border
      shiftMask - boolean flag to indicate whether the shift key modifier is enabled or not
      controlMask - boolean flag to indicate whether the control key modifier is enabled or not
  • Method Details

    • getDirection

      public SelectionLayer.MoveDirectionEnum getDirection()
      Returns:
      The direction to move to.
    • getStepSize

      public Integer getStepSize()
      Returns:
      The number of steps to move. Can be null.
    • getTraversalStrategy

      public ITraversalStrategy getTraversalStrategy()
      Returns:
      The traversal strategy to use for moving.