Class SelectRegionCommand
java.lang.Object
org.eclipse.nebula.widgets.nattable.selection.command.SelectRegionCommand
- All Implemented Interfaces:
ILayerCommand
Command to trigger the selection of multiple consecutive cells.
- Since:
- 1.6
-
Constructor Summary
ConstructorsModifierConstructorDescriptionSelectRegionCommand(ILayer layer, int startColumnPosition, int startRowPosition, int regionWidth, int regionHeight, boolean shiftMask, boolean controlMask) Create a SelectionRegionCommand with the given parameters.SelectRegionCommand(ILayer layer, org.eclipse.swt.graphics.Rectangle region, boolean shiftMask, boolean controlMask) Create a SelectionRegionCommand with the given parameters.protectedSelectRegionCommand(SelectRegionCommand command) Constructor that is used to clone a command. -
Method Summary
Modifier and TypeMethodDescriptionSame semantics asObject.clone()Used to make a copies of the command if has to passed to different layer stacks.booleanconvertToTargetLayer(ILayer targetLayer) Convert the row/column coordinates the command might be carrying from the source layer to the destination (target) layer.intintorg.eclipse.swt.graphics.RectanglebooleanbooleanvoidsetAnchorColumnPosition(int anchorColumnPosition) Specifying an anchor column position will force to move the selection anchor to the given column position.voidsetAnchorRowPosition(int anchorRowPosition) Specifying an anchor row position will force to move the selection anchor to the given row position.
-
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- TheILayerto 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-trueif the selection should be performed as if the shift key was pressed.controlMask-trueif 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- TheILayerto which the column and row position in the rectangle matches.region- The region that should be selected.shiftMask-trueif the selection should be performed as if the shift key was pressed.controlMask-trueif the selection should be performed as if the control key was pressed.
-
SelectRegionCommand
Constructor that is used to clone a command.- Parameters:
command- The command that should be cloned.
-
-
Method Details
-
convertToTargetLayer
Description copied from interface:ILayerCommandConvert 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:
convertToTargetLayerin interfaceILayerCommand- Parameters:
targetLayer- the target layer- Returns:
- true if the command is valid after conversion, false if the command is no longer valid.
-
cloneCommand
Description copied from interface:ILayerCommandSame semantics asObject.clone()Used to make a copies of the command if has to passed to different layer stacks.- Specified by:
cloneCommandin interfaceILayerCommand- 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:
trueif the selection should be performed as if the shift key was pressed.
-
isControlMask
public boolean isControlMask()- Returns:
trueif 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.
-