Class AutoResizeColumnsCommand

java.lang.Object
org.eclipse.nebula.widgets.nattable.command.AbstractMultiColumnCommand
org.eclipse.nebula.widgets.nattable.resize.command.AutoResizeColumnsCommand
All Implemented Interfaces:
ILayerCommand

public class AutoResizeColumnsCommand extends AbstractMultiColumnCommand
Command indicating that all selected columns have to be auto resized i.e made wide enough to just fit the widest cell. This should also take the column header into account Note: The InitializeAutoResizeColumnsCommand has to be fired first when autoresizing columns.
See Also:
  • Constructor Details

    • AutoResizeColumnsCommand

      public AutoResizeColumnsCommand(InitializeAutoResizeColumnsCommand initCommand)
      Parameters:
      initCommand - The InitializeAutoResizeColumnsCommand from which this command should be created.
    • AutoResizeColumnsCommand

      public AutoResizeColumnsCommand(NatTable natTable, int... columnPositions)
      Create a AutoResizeColumnsCommand for programmatic execution.
      Parameters:
      natTable - The NatTable instance in which the resize should be performed.
      columnPositions - The column positions that should be auto resized, based on the NatTable position.
      Since:
      1.6
    • AutoResizeColumnsCommand

      public AutoResizeColumnsCommand(NatTable natTable, boolean transformPositions, int... columnPositions)
      Create a AutoResizeColumnsCommand for programmatic execution.
      Parameters:
      natTable - The NatTable instance in which the resize should be performed.
      transformPositions - true if the column positions should be back transformed (e.g. in case the positions are collected via SelectionLayer and therefore need to be back transformed to the GridLayer coordinates), false if the column positions should be treated based on the NatTable.
      columnPositions - The column positions that should be auto resized, based on the NatTable position.
      Since:
      1.6
    • AutoResizeColumnsCommand

      protected AutoResizeColumnsCommand(AutoResizeColumnsCommand command)
      Create a AutoResizeColumnsCommand as a clone of the given command instance.
      Parameters:
      command - The AutoResizeColumnsCommand that should be cloned.
  • Method Details

    • cloneCommand

      public ILayerCommand cloneCommand()
      Description copied from interface: ILayerCommand
      Same semantics as Object.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:
    • getGCFactory

      public GCFactory getGCFactory()
      Returns:
      The GCFactory needed to create a temporary GC for column height calculation.
    • getConfigRegistry

      public IConfigRegistry getConfigRegistry()
      Returns:
      The IConfigRegistry needed for retrieval of style configurations.
    • doPositionTransformation

      public boolean doPositionTransformation()
      Return whether the command handler should transform the column positions or not. If this command is created via InitializeAutoResizeColumnsCommand the column positions need to be transformed as by default the command handler is registered to the GridLayer but the column positions are set based on the SelectionLayer. A back transformation is therefore needed. If this command was not created with the other constructor, a back transformation in the command handler is not necessary.
      Returns:
      true if the command handler should transform the column positions, false if not.
      Since:
      1.6