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
public class ColumnGroupHeaderReorderDragMode extends ColumnReorderDragMode
DefaultIDragMode
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.ColumnReorderOverlayPainter
-
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 ColumnGroupHeaderLayer
columnGroupHeaderLayer
protected int
dragFromGridRowPosition
protected int
level
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode
currentEvent, dragFromGridColumnPosition, initialEvent, natTable, targetOverlayPainter
-
Fields inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
horizontalBorderOffset, verticalBorderOffset
-
-
Constructor Summary
Constructors Constructor Description ColumnGroupHeaderReorderDragMode(ColumnGroupHeaderLayer columnGroupHeaderLayer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected void
fireMoveEndCommand(NatTable natTable, int dragToGridColumnPosition)
protected void
fireMoveStartCommand(NatTable natTable, int dragFromGridColumnPosition)
protected ILayerCell
getColumnCell(int x)
protected CellEdgeEnum
getMoveDirection(int x)
protected boolean
isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition)
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.void
mouseDown(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.reorder.action.ColumnReorderDragMode
getDragFromGridColumnPosition, getDragToGridColumnPosition, mouseMove, mouseUp
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.viewport.action.AutoScrollDragMode
performDragAction
-
-
-
-
Field Detail
-
columnGroupHeaderLayer
protected final ColumnGroupHeaderLayer columnGroupHeaderLayer
-
level
protected int level
-
dragFromGridRowPosition
protected int dragFromGridRowPosition
-
-
Constructor Detail
-
ColumnGroupHeaderReorderDragMode
public ColumnGroupHeaderReorderDragMode(ColumnGroupHeaderLayer columnGroupHeaderLayer)
- Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
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 classColumnReorderDragMode
-
isValidTargetColumnPosition
protected boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition)
- Overrides:
isValidTargetColumnPosition
in 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:
true
if the reorder would be valid on the specified level,false
if not.
-
fireMoveStartCommand
protected void fireMoveStartCommand(NatTable natTable, int dragFromGridColumnPosition)
- Overrides:
fireMoveStartCommand
in classColumnReorderDragMode
-
fireMoveEndCommand
protected void fireMoveEndCommand(NatTable natTable, int dragToGridColumnPosition)
- Overrides:
fireMoveEndCommand
in classColumnReorderDragMode
-
getMoveDirection
protected CellEdgeEnum getMoveDirection(int x)
- Overrides:
getMoveDirection
in classColumnReorderDragMode
-
getColumnCell
protected ILayerCell getColumnCell(int x)
- Overrides:
getColumnCell
in 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.
-
-