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
Default
IDragMode
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 ClassesModifier and TypeClassDescriptionprotected class
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
FieldsModifier and TypeFieldDescriptionprotected org.eclipse.swt.events.MouseEvent
protected int
protected org.eclipse.swt.events.MouseEvent
protected NatTable
protected IOverlayPainter
Fields inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
horizontalBorderOffset, verticalBorderOffset
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
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
void
void
Methods inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
performDragAction
-
Field Details
-
natTable
-
initialEvent
protected org.eclipse.swt.events.MouseEvent initialEvent -
currentEvent
protected org.eclipse.swt.events.MouseEvent currentEvent -
dragFromGridRowPosition
protected int dragFromGridRowPosition -
targetOverlayPainter
-
-
Constructor Details
-
RowReorderDragMode
public RowReorderDragMode()
-
-
Method Details
-
mouseDown
-
mouseMove
- Specified by:
mouseMove
in interfaceIDragMode
- Overrides:
mouseMove
in classAutoScrollDragMode
-
mouseUp
- Specified by:
mouseUp
in interfaceIDragMode
- Overrides:
mouseUp
in classAutoScrollDragMode
-
getDragFromGridRowPosition
protected int getDragFromGridRowPosition()- Returns:
- The row position of the row that is dragged
-
getDragToGridRowPosition
- 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
- 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
- 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
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
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
-