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
public class RowGroupHeaderReorderDragMode extends RowReorderDragMode
DefaultIDragMode
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.RowReorderOverlayPainter
-
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 int
dragFromGridColumnPosition
protected int
level
protected RowGroupHeaderLayer
rowGroupHeaderLayer
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.RowReorderDragMode
currentEvent, dragFromGridRowPosition, initialEvent, natTable, targetOverlayPainter
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
horizontalBorderOffset, verticalBorderOffset
-
-
Constructor Summary
Constructors Constructor Description RowGroupHeaderReorderDragMode(RowGroupHeaderLayer columnGroupHeaderLayer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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 CellEdgeEnum
getMoveDirection(int y)
protected ILayerCell
getRowCell(int y)
protected boolean
isValidTargetRowPosition(ILayer natLayer, int fromGridRowPosition, int toGridRowPosition)
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.void
mouseDown(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.RowReorderDragMode
getDragFromGridRowPosition, getDragToGridRowPosition, mouseMove, mouseUp
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
performDragAction
-
-
-
-
Field Detail
-
rowGroupHeaderLayer
protected final RowGroupHeaderLayer rowGroupHeaderLayer
-
level
protected int level
-
dragFromGridColumnPosition
protected int dragFromGridColumnPosition
-
-
Constructor Detail
-
RowGroupHeaderReorderDragMode
public RowGroupHeaderReorderDragMode(RowGroupHeaderLayer columnGroupHeaderLayer)
- Parameters:
columnGroupHeaderLayer
- TheRowGroupHeaderLayer
to which this drag mode should be assigned to.
-
-
Method Detail
-
mouseDown
public void mouseDown(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
- Specified by:
mouseDown
in interfaceIDragMode
- Overrides:
mouseDown
in classRowReorderDragMode
-
isValidTargetRowPosition
protected boolean isValidTargetRowPosition(ILayer natLayer, int fromGridRowPosition, int toGridRowPosition)
- Overrides:
isValidTargetRowPosition
in 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:
true
if the drop position is valid,false
if 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:
true
if the reorder would be valid on the specified level,false
if not.
-
fireMoveStartCommand
protected void fireMoveStartCommand(NatTable natTable, int dragFromGridRowPosition)
Description copied from class:RowReorderDragMode
Executes the command to indicate row reorder starting.- Overrides:
fireMoveStartCommand
in classRowReorderDragMode
- 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)
Description copied from class:RowReorderDragMode
Executes the command to indicate row reorder ending.- Overrides:
fireMoveEndCommand
in 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
protected CellEdgeEnum getMoveDirection(int y)
- Overrides:
getMoveDirection
in 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
protected ILayerCell getRowCell(int y)
- Overrides:
getRowCell
in classRowReorderDragMode
- Parameters:
y
- The y coordinate of the drop location- Returns:
- The
ILayerCell
at 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.
-
-