Class ColumnGroupsCommandHandler

java.lang.Object
org.eclipse.nebula.widgets.nattable.command.AbstractLayerCommandHandler<IColumnGroupCommand>
org.eclipse.nebula.widgets.nattable.group.performance.command.ColumnGroupsCommandHandler
All Implemented Interfaces:
ILayerCommandHandler<IColumnGroupCommand>

public class ColumnGroupsCommandHandler extends AbstractLayerCommandHandler<IColumnGroupCommand>
Command handler for handling IColumnGroupCommands to create, remove and rename column groups.
Since:
1.6
  • Constructor Details

    • ColumnGroupsCommandHandler

      public ColumnGroupsCommandHandler(ColumnGroupHeaderLayer contextLayer, SelectionLayer selectionLayer)
      Parameters:
      contextLayer - The ColumnGroupHeaderLayer this command handler is connected to.
      selectionLayer - The SelectionLayer needed to get the selection and perform reordering tasks if necessary.
    • ColumnGroupsCommandHandler

      public ColumnGroupsCommandHandler(ColumnGroupHeaderLayer contextLayer, SelectionLayer selectionLayer, boolean clearSelection)
      Parameters:
      contextLayer - The ColumnGroupHeaderLayer this command handler is connected to.
      selectionLayer - The SelectionLayer needed to get the selection and perform reordering tasks if necessary.
      clearSelection - true if the selection should be cleared after group/ungroup, false if the selection should stay unchanged.
      Since:
      2.3
  • Method Details

    • doCommand

      public boolean doCommand(IColumnGroupCommand command)
      Specified by:
      doCommand in class AbstractLayerCommandHandler<IColumnGroupCommand>
    • handleCreateColumnGroupCommand

      protected boolean handleCreateColumnGroupCommand(String columnGroupName)
      Creates a new column group with the given name out of the currently fully selected column positions. If a selected column is part of an existing group, the existing group will be removed and all columns belonging to that group will be also part of the new group.
      Parameters:
      columnGroupName - The name of the new column group.
      Returns:
      true if the column group could be created, false if there are no columns fully selected.
    • handleRemoveColumnGroupCommand

      protected void handleRemoveColumnGroupCommand(int columnIndex)
      Remove the column group at the given column index.
      Parameters:
      columnIndex - The column index to retrieve the column group to remove.
    • handleUngroupCommand

      protected void handleUngroupCommand()
      Remove the currently fully selected columns from their corresponding groups. Will also trigger a reorder to ensure a consistent group rendering
    • getPositionsToProcess

      protected org.eclipse.collections.api.list.primitive.MutableIntList getPositionsToProcess()
      Return the collection of column positions related to the ColumnGroupHeaderLayer.getPositionLayer() that should be added to a column group.

      The default implementation uses the SelectionLayer to retrieve the fully selected column positions.

      Returns:
      The collection of column positions related to the ColumnGroupHeaderLayer.getPositionLayer() that should be added to a column group.
      Since:
      2.3
    • displayColumnGroupRenameDialog

      protected boolean displayColumnGroupRenameDialog(DisplayColumnGroupRenameDialogCommand command)
    • getCommandClass

      public Class<IColumnGroupCommand> getCommandClass()