Class ViewportDragCommand

  • All Implemented Interfaces:
    ILayerCommand

    public class ViewportDragCommand
    extends Object
    implements ILayerCommand
    Command that is used to trigger a scrolling operation. Typically fired by other drag operations.
    • Constructor Detail

      • ViewportDragCommand

        public ViewportDragCommand​(int x,
                                   int y)
        Create a ViewportDragCommand that transports the coordinates of the mouse cursor. This command typically triggers a background thread that performs a scroll operation for the current mouse cursor position.
        Parameters:
        x - The x coordinate
        y - The y coordinate
        See Also:
        ViewportLayer.drag(int, int)
      • ViewportDragCommand

        public ViewportDragCommand​(SelectionLayer.MoveDirectionEnum horizontal,
                                   SelectionLayer.MoveDirectionEnum vertical)
        Create a ViewportDragCommand that transports the scroll directions. This command typically triggers an immediate scrolling operation by one cell position in the given direction.
        Parameters:
        horizontal - The horizontal movement for the scroll operation MoveDirectionEnum.LEFT, MoveDirectionEnum.RIGHT, MoveDirectionEnum.NONE
        vertical - The vertical movement for the scroll operation MoveDirectionEnum.UP, MoveDirectionEnum.DOWN, MoveDirectionEnum.NONE
        Since:
        1.3
        See Also:
        ViewportLayer.drag(MoveDirectionEnum, MoveDirectionEnum)
    • Method Detail

      • getX

        public int getX()
      • getY

        public int getY()
      • getHorizontal

        public SelectionLayer.MoveDirectionEnum getHorizontal()
        Returns:
        The horizontal movement for the scroll operation MoveDirectionEnum.LEFT, MoveDirectionEnum.RIGHT, MoveDirectionEnum.NONE
        Since:
        1.3
      • getVertical

        public SelectionLayer.MoveDirectionEnum getVertical()
        Returns:
        The vertical movement for the scroll operation MoveDirectionEnum.UP, MoveDirectionEnum.DOWN, MoveDirectionEnum.NONE
        Since:
        1.3
      • isConfiguredForMoveDirection

        public boolean isConfiguredForMoveDirection()
        Returns:
        whether the command was created for MoveDirectionEnum values or with screen coordinates
        Since:
        1.3
      • convertToTargetLayer

        public boolean convertToTargetLayer​(ILayer targetLayer)
        Description copied from interface: ILayerCommand
        Convert the row/column coordinates the command might be carrying from the source layer to the destination (target) layer. If it is not possible to convert the command to the target layer, then this method will return false and the state of this command object will remain unchanged. Note: Commands should not be processed if they fail conversion.
        Specified by:
        convertToTargetLayer in interface ILayerCommand
        Parameters:
        targetLayer - the target layer
        Returns:
        true if the command is valid after conversion, false if the command is no longer valid.