Class ColumnHeaderReorderDragMode

All Implemented Interfaces:
IDragMode
Direct Known Subclasses:
GroupByColumnGroupReorderDragMode

public class ColumnHeaderReorderDragMode extends ColumnReorderDragMode
Extends the regular column drag functionality to work with column groups. It does the following checks:
  1. Checks that the destination is not part of a Unbreakable column group
  2. Checks if the destination is between two adjoining column groups
Since:
1.6
  • Field Details

    • dragFromGridRowPosition

      protected int dragFromGridRowPosition
  • Constructor Details

    • ColumnHeaderReorderDragMode

      public ColumnHeaderReorderDragMode(ColumnGroupHeaderLayer columnGroupHeaderLayer)
      Parameters:
      columnGroupHeaderLayer - The ColumnGroupHeaderLayer to which this drag mode should be assigned to.
  • Method Details

    • mouseDown

      public void mouseDown(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
      Specified by:
      mouseDown in interface IDragMode
      Overrides:
      mouseDown in class ColumnReorderDragMode
    • isValidTargetColumnPosition

      public boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition)
      Overrides:
      isValidTargetColumnPosition in class ColumnReorderDragMode
    • isValidTargetColumnPosition

      protected boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition, int level, int fromPosition, int toPosition)
      Test if the reorder is valid for the given level.
      Parameters:
      natLayer - The layer on which the drag operation is triggered, typically the NatTable instance.
      fromGridColumnPosition - The from position related to the given natLayer.
      toGridColumnPosition - The to position related to the given natLayer.
      level - The grouping level for which the check should be performed.
      fromPosition - The from position related to the positionLayer of the ColumnGroupHeaderLayer.
      toPosition - The to position related to the positionLayer of the ColumnGroupHeaderLayer.
      Returns:
      true if the reorder would be valid on the specified level, false if not.
    • getMoveDirection

      protected CellEdgeEnum getMoveDirection(int x)
      Overrides:
      getMoveDirection in class ColumnReorderDragMode
    • getColumnCell

      protected ILayerCell getColumnCell(int x)
      Overrides:
      getColumnCell in class ColumnReorderDragMode
      Parameters:
      x - The x coordinate to determine the column of the NatTable.
      Returns:
      The cell at the given x coordinate and the y coordinate of the initial event.