Class RowGroupHeaderReorderDragMode
java.lang.Object
org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
org.eclipse.nebula.widgets.nattable.reorder.action.RowReorderDragMode
org.eclipse.nebula.widgets.nattable.group.performance.action.RowGroupHeaderReorderDragMode
- All Implemented Interfaces:
IDragMode
Default
IDragMode invoked for 'left click + drag' on the row group
header.
It overrides the isValidTargetRowPosition() to calculate if a destination position is valid for the row group to be reordered to.
Example, a row group cannot be reordered to be inside another row group.
- Since:
- 1.6
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.RowReorderDragMode
RowReorderDragMode.RowReorderOverlayPainterNested classes/interfaces inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
AutoScrollDragMode.AutoScrollRunnable -
Field Summary
FieldsFields inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.RowReorderDragMode
currentEvent, dragFromGridRowPosition, initialEvent, natTable, targetOverlayPainterFields inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
horizontalBorderOffset, verticalBorderOffset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateLevel(int columnPosition, int rowPosition) Calculate the group level and based on that the real drag from grid column position that is reordered.protected 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 CellEdgeEnumgetMoveDirection(int y) protected ILayerCellgetRowCell(int y) protected booleanisValidTargetRowPosition(ILayer natLayer, int fromGridRowPosition, int toGridRowPosition) protected booleanisValidTargetRowPosition(ILayer natLayer, int fromGridRowPosition, int toGridRowPosition, int level, int fromPosition, int toPosition) Test if the reorder is valid for the given level.voidMethods inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.RowReorderDragMode
getDragFromGridRowPosition, getDragToGridRowPosition, mouseMove, mouseUpMethods inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
performDragAction
-
Field Details
-
rowGroupHeaderLayer
-
level
protected int level -
dragFromGridColumnPosition
protected int dragFromGridColumnPosition
-
-
Constructor Details
-
RowGroupHeaderReorderDragMode
- Parameters:
columnGroupHeaderLayer- TheRowGroupHeaderLayerto which this drag mode should be assigned to.
-
-
Method Details
-
mouseDown
- Specified by:
mouseDownin interfaceIDragMode- Overrides:
mouseDownin classRowReorderDragMode
-
isValidTargetRowPosition
protected boolean isValidTargetRowPosition(ILayer natLayer, int fromGridRowPosition, int toGridRowPosition) - Overrides:
isValidTargetRowPositionin classRowReorderDragMode- Parameters:
natLayer- The layer the positions are related tofromGridRowPosition- The row position of the row that is draggedtoGridRowPosition- The row position where the row is dropped- Returns:
trueif the drop position is valid,falseif not
-
isValidTargetRowPosition
protected boolean isValidTargetRowPosition(ILayer natLayer, int fromGridRowPosition, int toGridRowPosition, int level, int fromPosition, int toPosition) Test if the reorder is valid for the given level.- Parameters:
natLayer- The layer on which the drag operation is triggered, typically the NatTable instance.fromGridRowPosition- The from position related to the given natLayer.toGridRowPosition- The to position related to the given natLayer.level- The grouping level for which the check should be performed.fromPosition- The from position related to the positionLayer of theRowGroupHeaderLayer.toPosition- The to position related to the positionLayer of theRowGroupHeaderLayer.- Returns:
trueif the reorder would be valid on the specified level,falseif not.
-
fireMoveStartCommand
Description copied from class:RowReorderDragModeExecutes the command to indicate row reorder starting.- Overrides:
fireMoveStartCommandin classRowReorderDragMode- Parameters:
natTable- The NatTable instance on which the command should be executeddragFromGridRowPosition- The row position of the row that is dragged
-
fireMoveEndCommand
Description copied from class:RowReorderDragModeExecutes the command to indicate row reorder ending.- Overrides:
fireMoveEndCommandin classRowReorderDragMode- 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
-
getMoveDirection
- Overrides:
getMoveDirectionin classRowReorderDragMode- 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
- Overrides:
getRowCellin classRowReorderDragMode- Parameters:
y- The y coordinate of the drop location- Returns:
- The
ILayerCellat the drop location
-
calculateLevel
protected void calculateLevel(int columnPosition, int rowPosition) Calculate the group level and based on that the real drag from grid column position that is reordered. Needed in case there is no group at the coordinate level and therefore a spanning indicates a group at a lower level.- Parameters:
columnPosition- The column position from which the drag was started. Needs to be related to the columnGroupHeaderLayer.rowPosition- The row position from which the drag was started. Needed to check if there is a group at the calculated level. Needs to be related to the columnGroupHeaderLayer.
-