Class SelectRegionCommand

java.lang.Object
org.eclipse.nebula.widgets.nattable.selection.command.SelectRegionCommand
All Implemented Interfaces:
ILayerCommand

public class SelectRegionCommand extends Object implements ILayerCommand
Command to trigger the selection of multiple consecutive cells.
Since:
1.6
  • Constructor Details

    • SelectRegionCommand

      public SelectRegionCommand(ILayer layer, int startColumnPosition, int startRowPosition, int regionWidth, int regionHeight, boolean shiftMask, boolean controlMask)
      Create a SelectionRegionCommand with the given parameters.
      Parameters:
      layer - The ILayer to which the column and row position matches.
      startColumnPosition - The column position that is the start of the region to select.
      startRowPosition - The row position that is the start of the region to select.
      regionWidth - The number of columns that should be included in the selection.
      regionHeight - The number of rows that should be included in the selection.
      shiftMask - true if the selection should be performed as if the shift key was pressed.
      controlMask - true if the selection should be performed as if the control key was pressed.
    • SelectRegionCommand

      public SelectRegionCommand(ILayer layer, org.eclipse.swt.graphics.Rectangle region, boolean shiftMask, boolean controlMask)
      Create a SelectionRegionCommand with the given parameters.
      Parameters:
      layer - The ILayer to which the column and row position in the rectangle matches.
      region - The region that should be selected.
      shiftMask - true if the selection should be performed as if the shift key was pressed.
      controlMask - true if the selection should be performed as if the control key was pressed.
    • SelectRegionCommand

      protected SelectRegionCommand(SelectRegionCommand command)
      Constructor that is used to clone a command.
      Parameters:
      command - The command that should be cloned.
  • Method Details

    • 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.
    • cloneCommand

      public ILayerCommand cloneCommand()
      Description copied from interface: ILayerCommand
      Same semantics as Object.clone() Used to make a copies of the command if has to passed to different layer stacks.
      Specified by:
      cloneCommand in interface ILayerCommand
      Returns:
      a cloned instance of the command
      See Also:
    • getRegion

      public org.eclipse.swt.graphics.Rectangle getRegion()
      Returns:
      The region that should be selected.
    • isShiftMask

      public boolean isShiftMask()
      Returns:
      true if the selection should be performed as if the shift key was pressed.
    • isControlMask

      public boolean isControlMask()
      Returns:
      true if the selection should be performed as if the control key was pressed.
    • getAnchorRowPosition

      public int getAnchorRowPosition()
      Returns:
      The row position to which the selection anchor should be set to or -1 if the anchor should be set to the region start y.
    • setAnchorRowPosition

      public void setAnchorRowPosition(int anchorRowPosition)
      Specifying an anchor row position will force to move the selection anchor to the given row position. Without setting a value for the anchor row position, the selection anchor will be placed according to the region start.
      Parameters:
      anchorRowPosition - The row position to which the selection anchor should be set to.
    • getAnchorColumnPosition

      public int getAnchorColumnPosition()
      Returns:
      The column position to which the selection anchor should be set to or -1 if the anchor should be set to the region start x.
    • setAnchorColumnPosition

      public void setAnchorColumnPosition(int anchorColumnPosition)
      Specifying an anchor column position will force to move the selection anchor to the given column position. Without setting a value for the anchor column position, the selection anchor will be placed according to the region start.
      Parameters:
      anchorColumnPosition - The column position to which the selection anchor should be set to.