Class MultiRowReorderCommand
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.reorder.command.MultiRowReorderCommand
-
- All Implemented Interfaces:
ILayerCommand
- Direct Known Subclasses:
GroupMultiRowReorderCommand
public class MultiRowReorderCommand extends Object implements ILayerCommand
Command for reordering rows.
-
-
Field Summary
Fields Modifier and Type Field Description protected RowPositionCoordinate
toRowPositionCoordinate
The coordinate of the row to which the dragged rows should be dropped.
-
Constructor Summary
Constructors Modifier Constructor Description MultiRowReorderCommand(ILayer layer, int[] fromRowPositions, int toRowPosition)
MultiRowReorderCommand(ILayer layer, int[] fromRowPositions, int toRowPosition, boolean reorderToTopEdge)
MultiRowReorderCommand(ILayer layer, List<Integer> fromRowPositions, int toRowPosition)
MultiRowReorderCommand(ILayer layer, List<Integer> fromRowPositions, int toRowPosition, boolean reorderToTopEdge)
protected
MultiRowReorderCommand(MultiRowReorderCommand command)
Constructor used for cloning purposes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiRowReorderCommand
cloneCommand()
Same semantics asObject.clone()
Used to make a copies of the command if has to passed to different layer stacks.boolean
convertToTargetLayer(ILayer targetLayer)
Convert the row/column coordinates the command might be carrying from the source layer to the destination (target) layer.List<Integer>
getFromRowPositions()
int[]
getFromRowPositionsArray()
int
getToRowPosition()
boolean
isReorderByIndex()
boolean
isReorderToTopEdge()
void
setReorderByIndex(boolean reorderByIndex)
Configure how the carried rows should be treated.void
toggleCoordinateByEdge()
Toggles the coordinate from top edge to bottom edge and vice versa.void
updateFromRowPositions(int... fromPositions)
void
updateToRowPosition(int toPosition)
-
-
-
Field Detail
-
toRowPositionCoordinate
protected RowPositionCoordinate toRowPositionCoordinate
The coordinate of the row to which the dragged rows should be dropped.- Since:
- 1.6
-
-
Constructor Detail
-
MultiRowReorderCommand
public MultiRowReorderCommand(ILayer layer, List<Integer> fromRowPositions, int toRowPosition)
- Parameters:
layer
- The layer the positions are related tofromRowPositions
- The positions of the rows that should be reorderedtoRowPosition
- The position of the row to which the dragged row should be dropped
-
MultiRowReorderCommand
public MultiRowReorderCommand(ILayer layer, List<Integer> fromRowPositions, int toRowPosition, boolean reorderToTopEdge)
- Parameters:
layer
- The layer the positions are related tofromRowPositions
- The positions of the rows that should be reorderedtoRowPosition
- The position of the row to which the dragged row should be droppedreorderToTopEdge
- Flag to indicate if the row is dragged to the top edge of the layer
-
MultiRowReorderCommand
public MultiRowReorderCommand(ILayer layer, int[] fromRowPositions, int toRowPosition)
- Parameters:
layer
- The layer the positions are related tofromRowPositions
- The positions of the rows that should be reorderedtoRowPosition
- The position of the row to which the dragged row should be dropped- Since:
- 2.0
-
MultiRowReorderCommand
public MultiRowReorderCommand(ILayer layer, int[] fromRowPositions, int toRowPosition, boolean reorderToTopEdge)
- Parameters:
layer
- The layer the positions are related tofromRowPositions
- The positions of the rows that should be reorderedtoRowPosition
- The position of the row to which the dragged row should be droppedreorderToTopEdge
- Flag to indicate if the row is dragged to the top edge of the layer- Since:
- 2.0
-
MultiRowReorderCommand
protected MultiRowReorderCommand(MultiRowReorderCommand command)
Constructor used for cloning purposes- Parameters:
command
- The command which is base for the new one
-
-
Method Detail
-
getFromRowPositions
public List<Integer> getFromRowPositions()
- Returns:
- The positions of the rows that should be reordered
-
getFromRowPositionsArray
public int[] getFromRowPositionsArray()
- Returns:
- The positions of the rows that should be reordered
- Since:
- 2.0
-
getToRowPosition
public int getToRowPosition()
- Returns:
- The position of the row to which the dragged rows should be dropped
-
isReorderToTopEdge
public boolean isReorderToTopEdge()
- Returns:
- Flag to indicate if the row is dragged to the top edge of the layer.
-
isReorderByIndex
public boolean isReorderByIndex()
- Returns:
true
if the carried from rows are treated as indexes,false
if they are treated as positions. Default isfalse
.- Since:
- 1.6
-
setReorderByIndex
public void setReorderByIndex(boolean reorderByIndex)
Configure how the carried rows should be treated. By default they are treated as positions and converted to the local layer. Setting this value totrue
will treat the rows as indexes which will avoid conversion. This can be useful to reorder hidden rows for example.- Parameters:
reorderByIndex
-true
if the carried from columns should be treated as indexes,false
if they should be treated as positions.- Since:
- 1.6
-
toggleCoordinateByEdge
public void toggleCoordinateByEdge()
Toggles the coordinate from top edge to bottom edge and vice versa. Will not toggle if the coordinate is bottom edge of the last row or the top edge of the first row.- Since:
- 1.6
-
updateFromRowPositions
public void updateFromRowPositions(int... fromPositions)
- Parameters:
fromPositions
- The new fromRowPositions.- Since:
- 2.0
-
updateToRowPosition
public void updateToRowPosition(int toPosition)
- Parameters:
toPosition
- The new toRowPosition.- Since:
- 2.0
-
convertToTargetLayer
public boolean convertToTargetLayer(ILayer targetLayer)
Description copied from interface:ILayerCommand
Convert 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:
convertToTargetLayer
in interfaceILayerCommand
- Parameters:
targetLayer
- the target layer- Returns:
- true if the command is valid after conversion, false if the command is no longer valid.
-
cloneCommand
public MultiRowReorderCommand cloneCommand()
Description copied from interface:ILayerCommand
Same semantics asObject.clone()
Used to make a copies of the command if has to passed to different layer stacks.- Specified by:
cloneCommand
in interfaceILayerCommand
- Returns:
- a cloned instance of the command
- See Also:
GridLayer.doCommand(ILayerCommand)
-
-