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
DefaultIDragMode
invoked for 'left click + drag' on the column header. It does the following when invoked:- Fires a column reorder command, to move columns
- Overlays a black line indicating the new column position
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
ColumnReorderDragMode.ColumnReorderOverlayPainter
IOverlayPainter
that paints the black line on the target destination if valid.-
Nested classes/interfaces inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
AutoScrollDragMode.AutoScrollRunnable
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.swt.events.MouseEvent
currentEvent
protected int
dragFromGridColumnPosition
protected org.eclipse.swt.events.MouseEvent
initialEvent
protected NatTable
natTable
protected IOverlayPainter
targetOverlayPainter
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
horizontalBorderOffset, verticalBorderOffset
-
-
Constructor Summary
Constructors Constructor Description ColumnReorderDragMode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
fireMoveEndCommand(NatTable natTable, int dragToGridColumnPosition)
protected void
fireMoveStartCommand(NatTable natTable, int dragFromGridColumnPosition)
protected ILayerCell
getColumnCell(int x)
protected int
getDragFromGridColumnPosition()
protected int
getDragToGridColumnPosition(CellEdgeEnum moveDirection, int gridColumnPosition)
protected CellEdgeEnum
getMoveDirection(int x)
protected boolean
isValidTargetColumnPosition(ILayer natLayer, int dragFromGridColumnPosition, int dragToGridColumnPosition)
void
mouseDown(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
void
mouseMove(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
void
mouseUp(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
performDragAction
-
-
-
-
Field Detail
-
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
-
-
Method Detail
-
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 interfaceIDragMode
- Overrides:
mouseMove
in classAutoScrollDragMode
-
mouseUp
public void mouseUp(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
- Specified by:
mouseUp
in interfaceIDragMode
- Overrides:
mouseUp
in classAutoScrollDragMode
-
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)
-
-