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 classThe 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.MouseEventprotected intprotected org.eclipse.swt.events.MouseEventprotected NatTableprotected IOverlayPainterFields inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
horizontalBorderOffset, verticalBorderOffset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfireMoveEndCommand(NatTable natTable, int dragToGridRowPosition) Executes the command to indicate row reorder ending.protected voidfireMoveStartCommand(NatTable natTable, int dragFromGridRowPosition) Executes the command to indicate row reorder starting.protected intprotected intgetDragToGridRowPosition(CellEdgeEnum moveDirection, int gridRowPosition) protected CellEdgeEnumgetMoveDirection(int y) protected ILayerCellgetRowCell(int y) protected booleanisValidTargetRowPosition(ILayer natLayer, int dragFromGridRowPosition, int dragToGridRowPosition) voidvoidvoidMethods 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:
mouseMovein interfaceIDragMode- Overrides:
mouseMovein classAutoScrollDragMode
-
mouseUp
- Specified by:
mouseUpin interfaceIDragMode- Overrides:
mouseUpin 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
ILayerCellat 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:
trueif the drop position is valid,falseif 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
-