Class ColumnGroupHeaderReorderDragMode
java.lang.Object
org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode
org.eclipse.nebula.widgets.nattable.group.performance.action.ColumnGroupHeaderReorderDragMode
- All Implemented Interfaces:
IDragMode
Default
IDragMode invoked for 'left click + drag' on the column group
header.
It overrides the isValidTargetColumnPosition() to calculate if a destination position is valid for the column group to be reordered to.
Example, a column group cannot be reordered to be inside another column group.
- Since:
- 1.6
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode
ColumnReorderDragMode.ColumnReorderOverlayPainterNested classes/interfaces inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
AutoScrollDragMode.AutoScrollRunnable -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ColumnGroupHeaderLayerprotected intprotected intFields inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode
currentEvent, dragFromGridColumnPosition, initialEvent, natTable, targetOverlayPainterFields inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
horizontalBorderOffset, verticalBorderOffset -
Constructor Summary
ConstructorsConstructorDescriptionColumnGroupHeaderReorderDragMode(ColumnGroupHeaderLayer columnGroupHeaderLayer) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateLevel(int rowPosition, int columnPosition) Calculate the group level and based on that the real drag from grid row position that is reordered.protected voidfireMoveEndCommand(NatTable natTable, int dragToGridColumnPosition) protected voidfireMoveStartCommand(NatTable natTable, int dragFromGridColumnPosition) protected ILayerCellgetColumnCell(int x) protected CellEdgeEnumgetMoveDirection(int x) protected booleanisValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition) protected booleanisValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition, 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.ColumnReorderDragMode
getDragFromGridColumnPosition, getDragToGridColumnPosition, mouseMove, mouseUpMethods inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
performDragAction
-
Field Details
-
columnGroupHeaderLayer
-
level
protected int level -
dragFromGridRowPosition
protected int dragFromGridRowPosition
-
-
Constructor Details
-
ColumnGroupHeaderReorderDragMode
- Parameters:
columnGroupHeaderLayer- TheColumnGroupHeaderLayerto which this drag mode should be assigned to.
-
-
Method Details
-
mouseDown
- Specified by:
mouseDownin interfaceIDragMode- Overrides:
mouseDownin classColumnReorderDragMode
-
isValidTargetColumnPosition
protected boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition) - Overrides:
isValidTargetColumnPositionin classColumnReorderDragMode
-
isValidTargetColumnPosition
protected boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition, 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.fromGridColumnPosition- The from position related to the given natLayer.toGridColumnPosition- 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 theColumnGroupHeaderLayer.toPosition- The to position related to the positionLayer of theColumnGroupHeaderLayer.- Returns:
trueif the reorder would be valid on the specified level,falseif not.
-
fireMoveStartCommand
- Overrides:
fireMoveStartCommandin classColumnReorderDragMode
-
fireMoveEndCommand
- Overrides:
fireMoveEndCommandin classColumnReorderDragMode
-
getMoveDirection
- Overrides:
getMoveDirectionin classColumnReorderDragMode
-
getColumnCell
- Overrides:
getColumnCellin classColumnReorderDragMode- 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.
-
calculateLevel
protected void calculateLevel(int rowPosition, int columnPosition) Calculate the group level and based on that the real drag from grid row 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:
rowPosition- The row position from which the drag was started. Needs to be related to the columnGroupHeaderLayer.columnPosition- The column 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.
-