Interface ITraversalStrategy
- All Known Implementing Classes:
EditTraversalStrategy,HierarchicalTraversalStrategy
public interface ITraversalStrategy
This interface is used to configure the traversal behavior when moving the
selection in a NatTable via key actions, e.g. tab or the arrow keys. You can
specify the scope, if the traversal should cycle and specify logic to
determine the step count if necessary. It is also possible to add logic that
determines whether a target is a valid selection movement target. This allows
traversal of editable cells while non-editable cells would be skipped.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumThe scope of the traversal which is necessary to determine what should happen on cycling. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ITraversalStrategyITraversalStrategythat specifies the following:
traversal scope = axis cycle = true step count = 1 valid = true This means for example, on moving a selection to the right, the selection will move one cell at a time and jump to the first column when moving over the right border.static final ITraversalStrategyITraversalStrategythat specifies the following:
traversal scope = axis cycle = false step count = 1 valid = true This means for example, on moving a selection to the right, the selection will move one cell at a time and stop at the right border.static final ITraversalStrategyITraversalStrategythat specifies the following:
traversal scope = table cycle = true step count = 1 valid = true This means for example, on moving a selection to the right, the selection will move one cell at a time and jump to the first column and move one row down when moving over the right border.static final ITraversalStrategyITraversalStrategythat specifies the following:
traversal scope = table cycle = false step count = 1 valid = true This means for example, on moving a selection to the right, the selection will move one cell at a time and jump to the first column and move one row down when moving over the right border. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanisCycle()booleanisValidTarget(ILayerCell from, ILayerCell to) Checks whether theILayerCellthat would be selected after the selection movement is valid or not.
-
Field Details
-
AXIS_TRAVERSAL_STRATEGY
ITraversalStrategythat specifies the following:
- traversal scope = axis
- cycle = false
- step count = 1
- valid = true
This is the default traversal strategy.
-
AXIS_CYCLE_TRAVERSAL_STRATEGY
ITraversalStrategythat specifies the following:
- traversal scope = axis
- cycle = true
- step count = 1
- valid = true
-
TABLE_TRAVERSAL_STRATEGY
ITraversalStrategythat specifies the following:
- traversal scope = table
- cycle = false
- step count = 1
- valid = true
-
TABLE_CYCLE_TRAVERSAL_STRATEGY
ITraversalStrategythat specifies the following:
- traversal scope = table
- cycle = true
- step count = 1
- valid = true
-
-
Method Details
-
getTraversalScope
ITraversalStrategy.TraversalScope getTraversalScope()- Returns:
- The
ITraversalStrategy.TraversalScopethis traversal strategy specifies.
-
isCycle
boolean isCycle()- Returns:
trueif on traversal the selection should cycle,falseif the selection should stay at the last/first position without cycling.
-
getStepCount
int getStepCount()- Returns:
- The number of steps to jump on traversal.
-
isValidTarget
Checks whether theILayerCellthat would be selected after the selection movement is valid or not. In case the target is invalid, the responsible command handler is able to react accordingly, e.g. move the next valid cell.This is for example useful for editing traversal. If the selection movement is triggered on committing a value in an editor, the next editable cell should be selected and the editor opened immediately.
- Parameters:
from- TheILayerCellfrom which the selection movement is started.to- TheILayerCellto which the selection movement should be performed.- Returns:
trueif the target is a valid target for selection movement,falseif not
-