Class ColumnReorderDragMode

java.lang.Object
org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode
All Implemented Interfaces:
IDragMode
Direct Known Subclasses:
ColumnGroupHeaderReorderDragMode, ColumnGroupHeaderReorderDragMode, ColumnHeaderReorderDragMode, ColumnHeaderReorderDragMode, GroupByColumnReorderDragMode, HierarchicalTreeColumnReorderDragMode

public class ColumnReorderDragMode extends AutoScrollDragMode
Default IDragMode invoked for 'left click + drag' on the column header. It does the following when invoked:
  1. Fires a column reorder command, to move columns
  2. Overlays a black line indicating the new column position
  • Field Details

    • natTable

      protected NatTable natTable
    • initialEvent

      protected org.eclipse.swt.events.MouseEvent initialEvent
    • currentEvent

      protected org.eclipse.swt.events.MouseEvent currentEvent
    • dragFromGridColumnPosition

      protected int dragFromGridColumnPosition
    • targetOverlayPainter

      protected IOverlayPainter targetOverlayPainter
  • Constructor Details

    • ColumnReorderDragMode

      public ColumnReorderDragMode()
  • Method Details

    • mouseDown

      public void mouseDown(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
    • mouseMove

      public void mouseMove(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
      Specified by:
      mouseMove in interface IDragMode
      Overrides:
      mouseMove in class AutoScrollDragMode
    • mouseUp

      public void mouseUp(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
      Specified by:
      mouseUp in interface IDragMode
      Overrides:
      mouseUp in class AutoScrollDragMode
    • getDragFromGridColumnPosition

      protected int getDragFromGridColumnPosition()
    • getDragToGridColumnPosition

      protected int getDragToGridColumnPosition(CellEdgeEnum moveDirection, int gridColumnPosition)
    • getMoveDirection

      protected CellEdgeEnum getMoveDirection(int x)
    • getColumnCell

      protected ILayerCell getColumnCell(int x)
      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.
      Since:
      1.6
    • isValidTargetColumnPosition

      protected boolean isValidTargetColumnPosition(ILayer natLayer, int dragFromGridColumnPosition, int dragToGridColumnPosition)
    • fireMoveStartCommand

      protected void fireMoveStartCommand(NatTable natTable, int dragFromGridColumnPosition)
    • fireMoveEndCommand

      protected void fireMoveEndCommand(NatTable natTable, int dragToGridColumnPosition)