Search in sources :

Example 1 with MultiColumnResizeCommand

use of org.eclipse.nebula.widgets.nattable.resize.command.MultiColumnResizeCommand in project nebula.widgets.nattable by eclipse.

the class AutoResizeColumnCommandHandler method doCommand.

@Override
public boolean doCommand(ILayer targetLayer, AutoResizeColumnsCommand command) {
    // Need to resize selected columns even if they are outside the viewport
    // As this command is triggered by the InitialAutoResizeCommand we know
    // that the targetLayer is the
    // NatTable itself
    targetLayer.doCommand(new TurnViewportOffCommand());
    int[] columnPositions = ObjectUtils.asIntArray(command.getColumnPositions());
    int[] gridColumnPositions = command.doPositionTransformation() ? convertFromPositionToCommandLayer(columnPositions) : columnPositions;
    int[] gridColumnWidths = MaxCellBoundsHelper.getPreferredColumnWidths(command.getConfigRegistry(), command.getGCFactory(), this.commandLayer, gridColumnPositions);
    this.commandLayer.doCommand(new MultiColumnResizeCommand(this.commandLayer, gridColumnPositions, gridColumnWidths, true));
    targetLayer.doCommand(new TurnViewportOnCommand());
    return true;
}
Also used : TurnViewportOnCommand(org.eclipse.nebula.widgets.nattable.print.command.TurnViewportOnCommand) MultiColumnResizeCommand(org.eclipse.nebula.widgets.nattable.resize.command.MultiColumnResizeCommand) TurnViewportOffCommand(org.eclipse.nebula.widgets.nattable.print.command.TurnViewportOffCommand)

Aggregations

TurnViewportOffCommand (org.eclipse.nebula.widgets.nattable.print.command.TurnViewportOffCommand)1 TurnViewportOnCommand (org.eclipse.nebula.widgets.nattable.print.command.TurnViewportOnCommand)1 MultiColumnResizeCommand (org.eclipse.nebula.widgets.nattable.resize.command.MultiColumnResizeCommand)1