Class RowReorderDragMode
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
-
- org.eclipse.nebula.widgets.nattable.reorder.action.RowReorderDragMode
-
- All Implemented Interfaces:
IDragMode
- Direct Known Subclasses:
RowGroupHeaderReorderDragMode
,RowHeaderReorderDragMode
public class RowReorderDragMode extends AutoScrollDragMode
DefaultIDragMode
invoked for 'left click + drag' on the row header. It does the following when invoked:- Fires a row reorder command, to move columns
- Overlays a black line indicating the new row position
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
RowReorderDragMode.RowReorderOverlayPainter
The overlay painter for showing the drag operation.-
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
dragFromGridRowPosition
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 RowReorderDragMode()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
fireMoveEndCommand(NatTable natTable, int dragToGridRowPosition)
Executes the command to indicate row reorder ending.protected void
fireMoveStartCommand(NatTable natTable, int dragFromGridRowPosition)
Executes the command to indicate row reorder starting.protected int
getDragFromGridRowPosition()
protected int
getDragToGridRowPosition(CellEdgeEnum moveDirection, int gridRowPosition)
protected CellEdgeEnum
getMoveDirection(int y)
protected ILayerCell
getRowCell(int y)
protected boolean
isValidTargetRowPosition(ILayer natLayer, int dragFromGridRowPosition, int dragToGridRowPosition)
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
-
dragFromGridRowPosition
protected int dragFromGridRowPosition
-
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
-
getDragFromGridRowPosition
protected int getDragFromGridRowPosition()
- Returns:
- The row position of the row that is dragged
-
getDragToGridRowPosition
protected int getDragToGridRowPosition(CellEdgeEnum moveDirection, int gridRowPosition)
- Parameters:
moveDirection
- The direction to indicate whether the drop was before or after the given row positiongridRowPosition
- The row position at which the drop was performed- Returns:
- The row position where the dragged row should be dropped
-
getMoveDirection
protected CellEdgeEnum getMoveDirection(int y)
- Parameters:
y
- The y coordinate of the drop location- Returns:
- The direction whether the drop should be performed before the the cell at drop position or after
-
getRowCell
protected ILayerCell getRowCell(int y)
- Parameters:
y
- The y coordinate of the drop location- Returns:
- The
ILayerCell
at the drop location - Since:
- 1.6
-
isValidTargetRowPosition
protected boolean isValidTargetRowPosition(ILayer natLayer, int dragFromGridRowPosition, int dragToGridRowPosition)
- Parameters:
natLayer
- The layer the positions are related todragFromGridRowPosition
- The row position of the row that is draggeddragToGridRowPosition
- The row position where the row is dropped- Returns:
true
if the drop position is valid,false
if not
-
fireMoveStartCommand
protected void fireMoveStartCommand(NatTable natTable, int dragFromGridRowPosition)
Executes the command to indicate row reorder starting.- Parameters:
natTable
- The NatTable instance on which the command should be executeddragFromGridRowPosition
- The row position of the row that is dragged
-
fireMoveEndCommand
protected void fireMoveEndCommand(NatTable natTable, int dragToGridRowPosition)
Executes the command to indicate row reorder ending.- Parameters:
natTable
- The NatTable instance on which the command should be executeddragToGridRowPosition
- The position of the row to which the dragged row should be dropped
-
-