Interface ITraversalStrategy
-
- All Known Implementing Classes:
EditTraversalStrategy,HierarchicalTraversalStrategy
public interface ITraversalStrategyThis 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 Classes Modifier and Type Interface Description static classITraversalStrategy.TraversalScopeThe scope of the traversal which is necessary to determine what should happen on cycling.
-
Field Summary
Fields Modifier and Type Field Description static ITraversalStrategyAXIS_CYCLE_TRAVERSAL_STRATEGYITraversalStrategythat 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 ITraversalStrategyAXIS_TRAVERSAL_STRATEGYITraversalStrategythat 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 ITraversalStrategyTABLE_CYCLE_TRAVERSAL_STRATEGYITraversalStrategythat 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 ITraversalStrategyTABLE_TRAVERSAL_STRATEGYITraversalStrategythat 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetStepCount()ITraversalStrategy.TraversalScopegetTraversalScope()booleanisCycle()booleanisValidTarget(ILayerCell from, ILayerCell to)Checks whether theILayerCellthat would be selected after the selection movement is valid or not.
-
-
-
Field Detail
-
AXIS_TRAVERSAL_STRATEGY
static final ITraversalStrategy 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
static final ITraversalStrategy AXIS_CYCLE_TRAVERSAL_STRATEGY
ITraversalStrategythat specifies the following:
- traversal scope = axis
- cycle = true
- step count = 1
- valid = true
-
TABLE_TRAVERSAL_STRATEGY
static final ITraversalStrategy TABLE_TRAVERSAL_STRATEGY
ITraversalStrategythat specifies the following:
- traversal scope = table
- cycle = false
- step count = 1
- valid = true
-
TABLE_CYCLE_TRAVERSAL_STRATEGY
static final ITraversalStrategy TABLE_CYCLE_TRAVERSAL_STRATEGY
ITraversalStrategythat specifies the following:
- traversal scope = table
- cycle = true
- step count = 1
- valid = true
-
-
Method Detail
-
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
boolean isValidTarget(ILayerCell from, ILayerCell to)
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
-
-