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
Modifier and TypeInterfaceDescriptionstatic enum
The scope of the traversal which is necessary to determine what should happen on cycling. -
Field Summary
Modifier and TypeFieldDescriptionstatic final ITraversalStrategy
ITraversalStrategy
that 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 ITraversalStrategy
ITraversalStrategy
that 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 ITraversalStrategy
ITraversalStrategy
that 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 ITraversalStrategy
ITraversalStrategy
that 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 TypeMethodDescriptionint
boolean
isCycle()
boolean
isValidTarget
(ILayerCell from, ILayerCell to) Checks whether theILayerCell
that would be selected after the selection movement is valid or not.
-
Field Details
-
AXIS_TRAVERSAL_STRATEGY
ITraversalStrategy
that specifies the following:
- traversal scope = axis
- cycle = false
- step count = 1
- valid = true
This is the default traversal strategy.
-
AXIS_CYCLE_TRAVERSAL_STRATEGY
ITraversalStrategy
that specifies the following:
- traversal scope = axis
- cycle = true
- step count = 1
- valid = true
-
TABLE_TRAVERSAL_STRATEGY
ITraversalStrategy
that specifies the following:
- traversal scope = table
- cycle = false
- step count = 1
- valid = true
-
TABLE_CYCLE_TRAVERSAL_STRATEGY
ITraversalStrategy
that specifies the following:
- traversal scope = table
- cycle = true
- step count = 1
- valid = true
-
-
Method Details
-
getTraversalScope
ITraversalStrategy.TraversalScope getTraversalScope()- Returns:
- The
ITraversalStrategy.TraversalScope
this traversal strategy specifies.
-
isCycle
boolean isCycle()- Returns:
true
if on traversal the selection should cycle,false
if 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 theILayerCell
that 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
- TheILayerCell
from which the selection movement is started.to
- TheILayerCell
to which the selection movement should be performed.- Returns:
true
if the target is a valid target for selection movement,false
if not
-