Class CellEdgeDetectUtil
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.ui.util.CellEdgeDetectUtil
-
public final class CellEdgeDetectUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getColumnPosition(ILayer layer, org.eclipse.swt.graphics.Point clickPoint)
Calculate the column position depending on the cursor's position on the left/right edges of the cell.static int
getColumnPositionToResize(ILayer layer, org.eclipse.swt.graphics.Point clickPoint)
Calculate the column position to resize depending on the cursor's position on the left/right edges of the cell.static CellEdgeEnum
getHorizontalCellEdge(ILayer layer, org.eclipse.swt.graphics.Point clickPt)
static CellEdgeEnum
getHorizontalCellEdge(ILayer layer, org.eclipse.swt.graphics.Point clickPt, int handleWidth)
static CellEdgeEnum
getHorizontalCellEdge(org.eclipse.swt.graphics.Rectangle cellBounds, org.eclipse.swt.graphics.Point clickPt)
Gets the edge (left/right) of the cell which is closer to the click point.static CellEdgeEnum
getHorizontalCellEdge(org.eclipse.swt.graphics.Rectangle cellBounds, org.eclipse.swt.graphics.Point clickPt, int distanceFromEdge)
Figure out if the click point is closer to the left/right edge of the cell.static int
getRowPosition(ILayer layer, org.eclipse.swt.graphics.Point clickPoint)
Calculate the row position to resize depending on the cursor's position on the top/bottom edges of the cell.static int
getRowPositionToResize(ILayer layer, org.eclipse.swt.graphics.Point clickPoint)
Calculate the row position to resize depending on the cursor's position on the top/bottom edges of the cell.static CellEdgeEnum
getVerticalCellEdge(ILayer layer, org.eclipse.swt.graphics.Point clickPt)
static CellEdgeEnum
getVerticalCellEdge(ILayer layer, org.eclipse.swt.graphics.Point clickPt, int handleHeight)
static CellEdgeEnum
getVerticalCellEdge(org.eclipse.swt.graphics.Rectangle cellBounds, org.eclipse.swt.graphics.Point clickPt)
Gets the edge (top/bottom) of the cell which is closer to the click point.
-
-
-
Method Detail
-
getColumnPosition
public static int getColumnPosition(ILayer layer, org.eclipse.swt.graphics.Point clickPoint)
Calculate the column position depending on the cursor's position on the left/right edges of the cell.- Parameters:
layer
- The layer that should be used to calculate the column position. Typically the NatTable itself.clickPoint
- The coordinate on which an action happened.- Returns:
- the column position according to the cell edge.
- Since:
- 1.6
-
getColumnPositionToResize
public static int getColumnPositionToResize(ILayer layer, org.eclipse.swt.graphics.Point clickPoint)
Calculate the column position to resize depending on the cursor's position on the left/right edges of the cell. Does not take into account columns which are not allowed to be resized.- Parameters:
layer
- The layer that should be used to calculate the column position. Typically the NatTable itself.clickPoint
- The coordinate on which an action happened.- Returns:
- the column position according to the cell edge or -1 for an invalid column, e.g. the left edge of the first column, as a resize is not possible here.
-
getRowPosition
public static int getRowPosition(ILayer layer, org.eclipse.swt.graphics.Point clickPoint)
Calculate the row position to resize depending on the cursor's position on the top/bottom edges of the cell.- Parameters:
layer
- The layer that should be used to calculate the row position. Typically the NatTable itself.clickPoint
- The coordinate on which an action happened.- Returns:
- the row position according to the cell edge.
- Since:
- 1.6
-
getRowPositionToResize
public static int getRowPositionToResize(ILayer layer, org.eclipse.swt.graphics.Point clickPoint)
Calculate the row position to resize depending on the cursor's position on the top/bottom edges of the cell. Does not take into account rows which are not allowed to be resized.- Parameters:
layer
- The layer that should be used to calculate the row position. Typically the NatTable itself.clickPoint
- The coordinate on which an action happened.- Returns:
- the row position according to the cell edge or -1 for an invalid row, e.g. the top edge of the first row, as a resize is not possible here.
-
getHorizontalCellEdge
public static CellEdgeEnum getHorizontalCellEdge(org.eclipse.swt.graphics.Rectangle cellBounds, org.eclipse.swt.graphics.Point clickPt)
Gets the edge (left/right) of the cell which is closer to the click point.- Parameters:
cellBounds
- bounds of the cell containing the clickclickPt
- usually the coordinates of a mouse click
-
getHorizontalCellEdge
public static CellEdgeEnum getHorizontalCellEdge(ILayer layer, org.eclipse.swt.graphics.Point clickPt)
-
getHorizontalCellEdge
public static CellEdgeEnum getHorizontalCellEdge(ILayer layer, org.eclipse.swt.graphics.Point clickPt, int handleWidth)
-
getHorizontalCellEdge
public static CellEdgeEnum getHorizontalCellEdge(org.eclipse.swt.graphics.Rectangle cellBounds, org.eclipse.swt.graphics.Point clickPt, int distanceFromEdge)
Figure out if the click point is closer to the left/right edge of the cell.- Parameters:
cellBounds
- of the table cell containing the clickclickPt
-distanceFromEdge
- distance from the edge to qualify as close to the cell edge
-
getVerticalCellEdge
public static CellEdgeEnum getVerticalCellEdge(org.eclipse.swt.graphics.Rectangle cellBounds, org.eclipse.swt.graphics.Point clickPt)
Gets the edge (top/bottom) of the cell which is closer to the click point.- Parameters:
cellBounds
- bounds of the cell containing the clickclickPt
- usually the coordinates of a mouse click
-
getVerticalCellEdge
public static CellEdgeEnum getVerticalCellEdge(ILayer layer, org.eclipse.swt.graphics.Point clickPt)
-
getVerticalCellEdge
public static CellEdgeEnum getVerticalCellEdge(ILayer layer, org.eclipse.swt.graphics.Point clickPt, int handleHeight)
-
-