Class MoveSelectionCommandHandler<T extends MoveSelectionCommand>

    • Field Detail

      • selectionLayer

        protected final SelectionLayer selectionLayer
        The SelectionLayer instance which is needed to perform selection operations.
      • horizontalTraversalStrategy

        protected final ITraversalStrategy horizontalTraversalStrategy
        The strategy to use on horizontal traversal. Specifies the behavior when the movement reaches a border.
      • verticalTraversalStrategy

        protected final ITraversalStrategy verticalTraversalStrategy
        The strategy to use on vertical traversal. Specifies the behavior when the movement reaches a border.
    • Constructor Detail

      • MoveSelectionCommandHandler

        public MoveSelectionCommandHandler​(SelectionLayer selectionLayer,
                                           ITraversalStrategy traversalStrategy)
        Create a MoveSelectionCommandHandler for the given SelectionLayer .
        Parameters:
        selectionLayer - The SelectionLayer on which the selection should be performed.
        traversalStrategy - The strategy that should be used for selection movements. Can not be null.
      • MoveSelectionCommandHandler

        public MoveSelectionCommandHandler​(SelectionLayer selectionLayer,
                                           ITraversalStrategy horizontalTraversalStrategy,
                                           ITraversalStrategy verticalTraversalStrategy)
        Create a MoveSelectionCommandHandler for the given SelectionLayer .
        Parameters:
        selectionLayer - The SelectionLayer on which the selection should be performed.
        horizontalTraversalStrategy - The strategy that should be used for horizontal selection movements. Can not be null.
        verticalTraversalStrategy - The strategy that should be used for vertical selection movements. Can not be null.
    • Method Detail

      • doCommand

        public boolean doCommand​(ILayer targetLayer,
                                 T command)
        Specified by:
        doCommand in interface ILayerCommandHandler<T extends MoveSelectionCommand>
        Parameters:
        targetLayer - the target layer
        command - the command
        Returns:
        true if the command has been handled, false otherwise
      • moveSelection

        protected void moveSelection​(SelectionLayer.MoveDirectionEnum moveDirection,
                                     ITraversalStrategy traversalStrategy,
                                     boolean withShiftMask,
                                     boolean withControlMask)
        Moves the selection from the current position into the given move direction.
        Parameters:
        moveDirection - 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
        withShiftMask - boolean flag to indicate whether the shift key modifier is enabled or not
        withControlMask - boolean flag to indicate whether the control key modifier is enabled or not
      • moveLastSelectedRight

        protected abstract void moveLastSelectedRight​(ITraversalStrategy traversalStrategy,
                                                      boolean withShiftMask,
                                                      boolean withControlMask)
        Moves the selection from the current position to the right.
        Parameters:
        traversalStrategy - the traversal strategy to determine the number of steps to move and the behavior on moving over the border
        withShiftMask - boolean flag to indicate whether the shift key modifier is enabled or not
        withControlMask - boolean flag to indicate whether the control key modifier is enabled or not
      • moveLastSelectedLeft

        protected abstract void moveLastSelectedLeft​(ITraversalStrategy traversalStrategy,
                                                     boolean withShiftMask,
                                                     boolean withControlMask)
        Moves the selection from the current position to the left.
        Parameters:
        traversalStrategy - the traversal strategy to determine the number of steps to move and the behavior on moving over the border
        withShiftMask - boolean flag to indicate whether the shift key modifier is enabled or not
        withControlMask - boolean flag to indicate whether the control key modifier is enabled or not
      • moveLastSelectedUp

        protected abstract void moveLastSelectedUp​(ITraversalStrategy traversalStrategy,
                                                   boolean withShiftMask,
                                                   boolean withControlMask)
        Moves the selection from the current position up.
        Parameters:
        traversalStrategy - the traversal strategy to determine the number of steps to move and the behavior on moving over the border
        withShiftMask - boolean flag to indicate whether the shift key modifier is enabled or not
        withControlMask - boolean flag to indicate whether the control key modifier is enabled or not
      • moveLastSelectedDown

        protected abstract void moveLastSelectedDown​(ITraversalStrategy traversalStrategy,
                                                     boolean withShiftMask,
                                                     boolean withControlMask)
        Moves the selection from the current position down.
        Parameters:
        traversalStrategy - the traversal strategy to determine the number of steps to move and the behavior on moving over the border
        withShiftMask - boolean flag to indicate whether the shift key modifier is enabled or not
        withControlMask - boolean flag to indicate whether the control key modifier is enabled or not