Class MultiColumnResizeCommand
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.command.AbstractMultiColumnCommand
-
- org.eclipse.nebula.widgets.nattable.resize.command.MultiColumnResizeCommand
-
- All Implemented Interfaces:
ILayerCommand
public class MultiColumnResizeCommand extends AbstractMultiColumnCommand
Command to trigger resizing of multiple columns.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<ColumnPositionCoordinate,Integer>
colPositionToWidth
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.command.AbstractMultiColumnCommand
columnPositionCoordinates
-
-
Constructor Summary
Constructors Modifier Constructor Description MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int commonColumnWidth)
Create aMultiColumnResizeCommand
to resize multiple columns, where each column is resized to the same width, e.g.MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int[] columnWidths)
Create aMultiColumnResizeCommand
to resize multiple columns, where each column can be resized to a different size, e.g.MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int[] columnWidths, boolean downScale)
Create aMultiColumnResizeCommand
to resize multiple columns, where each column can be resized to a different size, e.g.MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int commonColumnWidth, boolean downScale)
Create aMultiColumnResizeCommand
to resize multiple columns, where each column is resized to the same width, e.g.protected
MultiColumnResizeCommand(MultiColumnResizeCommand command)
Constructor used to clone the given command.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiColumnResizeCommand
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 column positions to the target layer.boolean
downScaleValue()
int
getColumnWidth(int columnPosition)
int
getCommonColumnWidth()
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.command.AbstractMultiColumnCommand
getColumnPositions, getColumnPositionsArray, setColumnPositions
-
-
-
-
Field Detail
-
colPositionToWidth
protected Map<ColumnPositionCoordinate,Integer> colPositionToWidth
-
-
Constructor Detail
-
MultiColumnResizeCommand
public MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int commonColumnWidth)
Create aMultiColumnResizeCommand
to resize multiple columns, where each column is resized to the same width, e.g. during a drag resize. The given column width will be taken as is without scaling.- Parameters:
layer
- TheILayer
to which the column positions correlate.columnPositions
- The positions of the columns that should be resized.commonColumnWidth
- The column width that should be applied to all given columns.
-
MultiColumnResizeCommand
public MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int commonColumnWidth, boolean downScale)
Create aMultiColumnResizeCommand
to resize multiple columns, where each column is resized to the same width, e.g. during a drag resize.- Parameters:
layer
- TheILayer
to which the column positions correlate.columnPositions
- The positions of the columns that should be resized.commonColumnWidth
- The column width that should be applied to all given columns.downScale
-true
if the commonColumnWidth value should be down scaled according to the scaling level,false
if the value should be taken as is.- Since:
- 1.6
-
MultiColumnResizeCommand
public MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int[] columnWidths)
Create aMultiColumnResizeCommand
to resize multiple columns, where each column can be resized to a different size, e.g. during auto resize. The given column width will be taken as is without scaling.- Parameters:
layer
- TheILayer
to which the column positions correlate.columnPositions
- The positions of the columns that should be resized.columnWidths
- The new widths that should be applied to the given columns. The indexes in the arrays need to correlate.
-
MultiColumnResizeCommand
public MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int[] columnWidths, boolean downScale)
Create aMultiColumnResizeCommand
to resize multiple columns, where each column can be resized to a different size, e.g. during auto resize.- Parameters:
layer
- TheILayer
to which the column positions correlate.columnPositions
- The positions of the columns that should be resized.columnWidths
- The new widths that should be applied to the given columns. The indexes in the arrays need to correlate.downScale
-true
if the columnWidths value should be down scaled according to the scaling level,false
if the value should be taken as is.- Since:
- 1.6
-
MultiColumnResizeCommand
protected MultiColumnResizeCommand(MultiColumnResizeCommand command)
Constructor used to clone the given command.- Parameters:
command
- The command to clone.
-
-
Method Detail
-
getCommonColumnWidth
public int getCommonColumnWidth()
- Returns:
- The common column width if all columns should be resized to the same width, or -1 if the columns should be resized to different values.
-
getColumnWidth
public int getColumnWidth(int columnPosition)
- Parameters:
columnPosition
- The column position for which the new width is requested.- Returns:
- The new column width for the requested position.
-
downScaleValue
public boolean downScaleValue()
- Returns:
true
if the column width value should be down scaled according to the scaling level,false
if the value should be taken as is.- Since:
- 1.6
-
convertToTargetLayer
public boolean convertToTargetLayer(ILayer targetLayer)
Convert the column positions to the target layer. Ensure that the width associated with the column is now associated with the converted column position.- Specified by:
convertToTargetLayer
in interfaceILayerCommand
- Overrides:
convertToTargetLayer
in classAbstractMultiColumnCommand
- Parameters:
targetLayer
- the target layer- Returns:
- true if the command is valid after conversion, false if the command is no longer valid.
-
cloneCommand
public MultiColumnResizeCommand 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.- Returns:
- a cloned instance of the command
- See Also:
GridLayer.doCommand(ILayerCommand)
-
-