Class MultiColumnReorderCommand
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.reorder.command.MultiColumnReorderCommand
-
- All Implemented Interfaces:
ILayerCommand
- Direct Known Subclasses:
GroupMultiColumnReorderCommand
,ReorderColumnsAndGroupsCommand
public class MultiColumnReorderCommand extends Object implements ILayerCommand
Command to reorder multiple columns at once.
-
-
Field Summary
Fields Modifier and Type Field Description protected ColumnPositionCoordinate
toColumnPositionCoordinate
-
Constructor Summary
Constructors Modifier Constructor Description MultiColumnReorderCommand(ILayer layer, int[] fromColumnPositions, int toColumnPosition)
MultiColumnReorderCommand(ILayer layer, int[] fromColumnPositions, int toColumnPosition, boolean reorderToLeftEdge)
MultiColumnReorderCommand(ILayer layer, List<Integer> fromColumnPositions, int toColumnPosition)
MultiColumnReorderCommand(ILayer layer, List<Integer> fromColumnPositions, int toColumnPosition, boolean reorderToLeftEdge)
protected
MultiColumnReorderCommand(MultiColumnReorderCommand command)
Clone constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiColumnReorderCommand
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>
getFromColumnPositions()
Returns the column positions that should be reordered on the layer where this command is processed.int[]
getFromColumnPositionsArray()
Returns the column positions that should be reordered on the layer where this command is processed.int
getToColumnPosition()
boolean
isReorderByIndex()
boolean
isReorderToLeftEdge()
void
setReorderByIndex(boolean reorderByIndex)
Configure how the carried columns should be treated.void
toggleCoordinateByEdge()
Toggles the coordinate from left edge to right edge and vice versa.void
updateFromColumnPositions(int... fromPositions)
void
updateToColumnPosition(int toPosition)
-
-
-
Field Detail
-
toColumnPositionCoordinate
protected ColumnPositionCoordinate toColumnPositionCoordinate
- Since:
- 1.6
-
-
Constructor Detail
-
MultiColumnReorderCommand
public MultiColumnReorderCommand(ILayer layer, List<Integer> fromColumnPositions, int toColumnPosition)
- Parameters:
layer
- The layer to which the column positions match.fromColumnPositions
- The column positions to reorder.toColumnPosition
- The target column position to reorder to.
-
MultiColumnReorderCommand
public MultiColumnReorderCommand(ILayer layer, List<Integer> fromColumnPositions, int toColumnPosition, boolean reorderToLeftEdge)
- Parameters:
layer
- The layer to which the column positions match.fromColumnPositions
- The column positions to reorder.toColumnPosition
- The target column position to reorder to.reorderToLeftEdge
-true
if the reorder operation should be done on the left edge of the toColumnPosition,false
if it should be reordered to the right edge.
-
MultiColumnReorderCommand
public MultiColumnReorderCommand(ILayer layer, int[] fromColumnPositions, int toColumnPosition)
- Parameters:
layer
- The layer to which the column positions match.fromColumnPositions
- The column positions to reorder.toColumnPosition
- The target column position to reorder to.- Since:
- 2.0
-
MultiColumnReorderCommand
public MultiColumnReorderCommand(ILayer layer, int[] fromColumnPositions, int toColumnPosition, boolean reorderToLeftEdge)
- Parameters:
layer
- The layer to which the column positions match.fromColumnPositions
- The column positions to reorder.toColumnPosition
- The target column position to reorder to.reorderToLeftEdge
-true
if the reorder operation should be done on the left edge of the toColumnPosition,false
if it should be reordered to the right edge.- Since:
- 2.0
-
MultiColumnReorderCommand
protected MultiColumnReorderCommand(MultiColumnReorderCommand command)
Clone constructor.- Parameters:
command
- The command to clone.
-
-
Method Detail
-
getFromColumnPositions
public List<Integer> getFromColumnPositions()
Returns the column positions that should be reordered on the layer where this command is processed. Can be the column indexes ifreorderByIndex
is set totrue
.- Returns:
- The column positions that should be reordered.
-
getFromColumnPositionsArray
public int[] getFromColumnPositionsArray()
Returns the column positions that should be reordered on the layer where this command is processed. Can be the column indexes ifreorderByIndex
is set totrue
.- Returns:
- The column positions that should be reordered.
- Since:
- 2.0
-
getToColumnPosition
public int getToColumnPosition()
- Returns:
- The column position to which the columns should be reordered.
-
isReorderToLeftEdge
public boolean isReorderToLeftEdge()
- Returns:
true
if the reorder operation should be done on the left edge of the toColumnPosition,false
if it should be reordered to the right edge.
-
isReorderByIndex
public boolean isReorderByIndex()
- Returns:
true
if the carried from columns 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 columns should be treated. By default they are treated as positions and converted to the local layer. Setting this value totrue
will treat the columns as indexes which will avoid conversion. This can be useful to reorder hidden columns 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 left edge to right edge and vice versa. Will not toggle if the coordinate is right edge of the last column or the left edge of the first column.- Since:
- 1.6
-
updateFromColumnPositions
public void updateFromColumnPositions(int... fromPositions)
- Parameters:
fromPositions
- The new fromColumnPositions.- Since:
- 2.0
-
updateToColumnPosition
public void updateToColumnPosition(int toPosition)
- Parameters:
toPosition
- The new toColumnPosition.- 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 MultiColumnReorderCommand 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)
-
-