Class MoveSelectionCommandHandler<T extends MoveSelectionCommand>
java.lang.Object
org.eclipse.nebula.widgets.nattable.selection.MoveSelectionCommandHandler<T>
- Type Parameters:
T- The type of theILayerCommandthisILayerCommandHandlerhandles. Needs to be aMoveSelectionCommandor subtype.
- All Implemented Interfaces:
ILayerCommandHandler<T>
- Direct Known Subclasses:
MoveCellSelectionCommandHandler
public abstract class MoveSelectionCommandHandler<T extends MoveSelectionCommand>
extends Object
implements ILayerCommandHandler<T>
Abstraction of the selection behavior during navigation in the grid.
Implementations of this class specify what to select when the selection moves
by responding to the
MoveSelectionCommand.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ITraversalStrategyThe strategy to use on horizontal traversal.protected final SelectionLayerThe SelectionLayer instance which is needed to perform selection operations.protected final ITraversalStrategyThe strategy to use on vertical traversal. -
Constructor Summary
ConstructorsConstructorDescriptionMoveSelectionCommandHandler(SelectionLayer selectionLayer) Create a MoveSelectionCommandHandler for the givenSelectionLayer.MoveSelectionCommandHandler(SelectionLayer selectionLayer, ITraversalStrategy traversalStrategy) Create a MoveSelectionCommandHandler for the givenSelectionLayer.MoveSelectionCommandHandler(SelectionLayer selectionLayer, ITraversalStrategy horizontalTraversalStrategy, ITraversalStrategy verticalTraversalStrategy) Create a MoveSelectionCommandHandler for the givenSelectionLayer. -
Method Summary
Modifier and TypeMethodDescriptionbooleanprotected ITraversalStrategygetTraversalStrategy(T command) Determines theITraversalStrategythat should be used to move the selection on handling the given command.protected abstract voidmoveLastSelectedDown(ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) Moves the selection from the current position down.protected abstract voidmoveLastSelectedLeft(ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) Moves the selection from the current position to the left.protected abstract voidmoveLastSelectedRight(ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) Moves the selection from the current position to the right.protected abstract voidmoveLastSelectedUp(ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) Moves the selection from the current position up.protected voidmoveSelection(SelectionLayer.MoveDirectionEnum moveDirection, ITraversalStrategy traversalStrategy, boolean withShiftMask, boolean withControlMask) Moves the selection from the current position into the given move direction.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler
getCommandClass
-
Field Details
-
selectionLayer
The SelectionLayer instance which is needed to perform selection operations. -
horizontalTraversalStrategy
The strategy to use on horizontal traversal. Specifies the behavior when the movement reaches a border. -
verticalTraversalStrategy
The strategy to use on vertical traversal. Specifies the behavior when the movement reaches a border.
-
-
Constructor Details
-
MoveSelectionCommandHandler
Create a MoveSelectionCommandHandler for the givenSelectionLayer. Uses theITraversalStrategy.AXIS_TRAVERSAL_STRATEGYas default strategy for selection movement.- Parameters:
selectionLayer- TheSelectionLayeron which the selection should be performed.
-
MoveSelectionCommandHandler
public MoveSelectionCommandHandler(SelectionLayer selectionLayer, ITraversalStrategy traversalStrategy) Create a MoveSelectionCommandHandler for the givenSelectionLayer.- Parameters:
selectionLayer- TheSelectionLayeron which the selection should be performed.traversalStrategy- The strategy that should be used for selection movements. Can not benull.
-
MoveSelectionCommandHandler
public MoveSelectionCommandHandler(SelectionLayer selectionLayer, ITraversalStrategy horizontalTraversalStrategy, ITraversalStrategy verticalTraversalStrategy) Create a MoveSelectionCommandHandler for the givenSelectionLayer.- Parameters:
selectionLayer- TheSelectionLayeron which the selection should be performed.horizontalTraversalStrategy- The strategy that should be used for horizontal selection movements. Can not benull.verticalTraversalStrategy- The strategy that should be used for vertical selection movements. Can not benull.
-
-
Method Details
-
doCommand
- Specified by:
doCommandin interfaceILayerCommandHandler<T extends MoveSelectionCommand>- Parameters:
targetLayer- the target layercommand- the command- Returns:
- true if the command has been handled, false otherwise
-
getTraversalStrategy
Determines theITraversalStrategythat should be used to move the selection on handling the given command. The strategy is determined in the following way:- Return the
ITraversalStrategycarried by the command - If it doesn't contain a
ITraversalStrategybut a carries a dedicated step count, create a temporaryITraversalStrategythat is configured with the locally configuredITraversalStrategybut returns the step count carried by the command. - If the command doesn't carry a
ITraversalStrategyand no dedicated step count, theITraversalStrategyregistered with this command handler is returned.
- Parameters:
command- The current handled command.- Returns:
- The
ITraversalStrategythat should be used to move the selection.nullforSelectionLayer.MoveDirectionEnum.NONE.
- Return the
-
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 borderwithShiftMask- boolean flag to indicate whether the shift key modifier is enabled or notwithControlMask- 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 borderwithShiftMask- boolean flag to indicate whether the shift key modifier is enabled or notwithControlMask- 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 borderwithShiftMask- boolean flag to indicate whether the shift key modifier is enabled or notwithControlMask- 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 borderwithShiftMask- boolean flag to indicate whether the shift key modifier is enabled or notwithControlMask- 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 borderwithShiftMask- boolean flag to indicate whether the shift key modifier is enabled or notwithControlMask- boolean flag to indicate whether the control key modifier is enabled or not
-