Class ColumnGroupUtils
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.group.ColumnGroupUtils
-
public final class ColumnGroupUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static SelectionLayer.MoveDirectionEnum
getMoveDirection(int fromColumnPosition, int toColumnPosition)
Calculates the move direction based on the from and to position.static List<Integer>
getVisibleIndexesToTheRight(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
static List<Integer>
getVisibleIndexesToTheRight(int columnIndex, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
static boolean
isBetweenTwoGroups(ColumnGroupHeaderLayer columnGroupHeaderLayer, int toPosition, boolean reorderToLeftEdge, SelectionLayer.MoveDirectionEnum moveDirection)
Checks if the edge of a column position is the left-most or the right most column on any level of a column group.static boolean
isBetweenTwoGroups(ColumnGroupHeaderLayer columnGroupHeaderLayer, int level, int toPosition, boolean reorderToLeftEdge, SelectionLayer.MoveDirectionEnum moveDirection)
Checks if the edge of a column position for a specific grouping level is the left-most or the right most column of a column group.static boolean
isBetweenTwoGroups(ILayer natLayer, int startX, int endX, ColumnGroupModel model)
static boolean
isBetweenTwoGroups(ILayer natLayer, int startX, int endX, ColumnGroupHeaderLayer layer, int level)
Checks if the column positions at the given x coordinates belong to the same group or not.static boolean
isColumnIndexHiddenInUnderLyingLayer(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer)
Deprecated.static boolean
isColumnIndexHiddenInUnderLyingLayer(int columnIndex, IUniqueIndexLayer underlyingLayer)
static boolean
isColumnPositionHiddenInUnderLyingLayer(int columnPosition, ILayer layer, IUniqueIndexLayer underlyingLayer)
Deprecated.static boolean
isColumnPositionHiddenInUnderLyingLayer(int columnPosition, IUniqueIndexLayer underlyingLayer)
static boolean
isFirstVisibleColumnIndexInGroup(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
static boolean
isFirstVisibleColumnIndexInGroup(int columnIndex, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
static boolean
isGroupReordered(GroupModel.Group fromGroup, int[] fromColumnPositions)
Check if a complete group is reordered.static boolean
isInTheSameGroup(int fromColumnIndex, int toColumnIndex, ColumnGroupModel model)
static boolean
isInTheSameGroup(ColumnGroupHeaderLayer layer, int level, int fromPosition, int toPosition)
Checks if the two given column positions on the given layer belong to the same group at the given level on the givenColumnGroupHeaderLayer
.static boolean
isLastVisibleColumnIndexInGroup(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
static boolean
isLastVisibleColumnIndexInGroup(int columnIndex, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
static boolean
isLeftEdgeOfAColumnGroup(ILayer natLayer, int columnPosition, int columnIndex, ColumnGroupModel model)
See ColumnGroupUtilsTeststatic boolean
isReorderValid(ColumnGroupHeaderLayer columnGroupHeaderLayer, int fromPosition, int toPosition, boolean reorderToLeftEdge)
Checks if a reorder operation is valid by checking the unbreakable states of the groups below the from and the to position.static boolean
isReorderValid(ColumnGroupHeaderLayer columnGroupHeaderLayer, int level, int fromPosition, int toPosition, boolean reorderToLeftEdge)
Checks if a reorder operation is valid by checking the unbreakable states of the groups below the from and the to position.static boolean
isRightEdgeOfAColumnGroup(ILayer natLayer, int columnPosition, int columnIndex, ColumnGroupModel model)
See ColumnGroupUtilsTeststatic boolean
isStaticOrFirstVisibleColumn(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
static boolean
isStaticOrFirstVisibleColumn(int columnIndex, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
Checks whethercolumnIndex
is either a defined static column or (if not) the first visible column in the group containing group.
-
-
-
Method Detail
-
getMoveDirection
public static SelectionLayer.MoveDirectionEnum getMoveDirection(int fromColumnPosition, int toColumnPosition)
Calculates the move direction based on the from and to position.- Parameters:
fromColumnPosition
- The column position from which a move is triggered.toColumnPosition
- The column position to which a move is triggered.- Returns:
- The direction of the triggered move operation.
-
isInTheSameGroup
public static boolean isInTheSameGroup(int fromColumnIndex, int toColumnIndex, ColumnGroupModel model)
-
isStaticOrFirstVisibleColumn
@Deprecated public static boolean isStaticOrFirstVisibleColumn(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
Checks whethercolumnIndex
is either a defined static column or (if not) the first visible column in the group containing group. This method provides downward compatibility for all group definitions without static columns. When no static columns are defined the first visible column will be used.- Parameters:
columnIndex
- The column index to check.layer
- unusedunderlyingLayer
- The underlying layer.model
- The column group model.- Returns:
TRUE
if the givencolumnIndex
is either a defined static column or (if not) the first visible column the it's group
-
isStaticOrFirstVisibleColumn
public static boolean isStaticOrFirstVisibleColumn(int columnIndex, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
Checks whethercolumnIndex
is either a defined static column or (if not) the first visible column in the group containing group. This method provides downward compatibility for all group definitions without static columns. When no static columns are defined the first visible column will be used.- Parameters:
columnIndex
- The column index to check.underlyingLayer
- The underlying layer.model
- The column group model.- Returns:
TRUE
if the givencolumnIndex
is either a defined static column or (if not) the first visible column the it's group- Since:
- 2.0
-
isFirstVisibleColumnIndexInGroup
@Deprecated public static boolean isFirstVisibleColumnIndexInGroup(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
- Parameters:
columnIndex
- The column index to check.layer
- unusedunderlyingLayer
- The underlying layer.model
- The column group model.- Returns:
true
if the given column index is the first column in a column group.
-
isFirstVisibleColumnIndexInGroup
public static boolean isFirstVisibleColumnIndexInGroup(int columnIndex, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
- Parameters:
columnIndex
- The column index to check.underlyingLayer
- The underlying layer.model
- The column group model.- Returns:
true
if the given column index is the first column in a column group.- Since:
- 2.0
-
isLastVisibleColumnIndexInGroup
@Deprecated public static boolean isLastVisibleColumnIndexInGroup(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
- Parameters:
columnIndex
- The column index to check.layer
- unusedunderlyingLayer
- The underlying layer.model
- The column group model.- Returns:
true
if the given column index is the last column in a column group.
-
isLastVisibleColumnIndexInGroup
public static boolean isLastVisibleColumnIndexInGroup(int columnIndex, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
- Parameters:
columnIndex
- The column index to check.underlyingLayer
- The underlying layer.model
- The column group model.- Returns:
true
if the given column index is the last column in a column group.- Since:
- 2.0
-
getVisibleIndexesToTheRight
@Deprecated public static List<Integer> getVisibleIndexesToTheRight(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
- Parameters:
columnIndex
- The index to check.layer
- unusedunderlyingLayer
- The underlying layer to retrieve the visible columns to the right.model
- TheColumnGroupModel
to get the group from.- Returns:
- The column indexes to the right of the given column index (inclusive)
-
getVisibleIndexesToTheRight
public static List<Integer> getVisibleIndexesToTheRight(int columnIndex, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model)
- Parameters:
columnIndex
- The index to check.underlyingLayer
- The underlying layer to retrieve the visible columns to the right.model
- TheColumnGroupModel
to get the group from.- Returns:
- The column indexes to the right of the given column index (inclusive)
- Since:
- 2.0
-
isColumnIndexHiddenInUnderLyingLayer
@Deprecated public static boolean isColumnIndexHiddenInUnderLyingLayer(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer)
Deprecated.- Parameters:
columnIndex
- The column index to check.layer
- unusedunderlyingLayer
- The underlying layer to check against.- Returns:
true
if the column is hidden in the underlying layer,false
if not.
-
isColumnIndexHiddenInUnderLyingLayer
public static boolean isColumnIndexHiddenInUnderLyingLayer(int columnIndex, IUniqueIndexLayer underlyingLayer)
- Parameters:
columnIndex
- The column index to check.underlyingLayer
- The underlying layer to check against.- Returns:
true
if the column is hidden in the underlying layer,false
if not.- Since:
- 2.0
-
isColumnPositionHiddenInUnderLyingLayer
@Deprecated public static boolean isColumnPositionHiddenInUnderLyingLayer(int columnPosition, ILayer layer, IUniqueIndexLayer underlyingLayer)
Deprecated.- Parameters:
columnPosition
- The column position matching the underlying layer.layer
- unusedunderlyingLayer
- The underlying layer to check against.- Returns:
true
if the column position is hidden in the underlying layer,false
if not.
-
isColumnPositionHiddenInUnderLyingLayer
public static boolean isColumnPositionHiddenInUnderLyingLayer(int columnPosition, IUniqueIndexLayer underlyingLayer)
- Parameters:
columnPosition
- The column position matching the underlying layer.underlyingLayer
- The underlying layer to check against.- Returns:
true
if the column position is hidden in the underlying layer,false
if not.- Since:
- 2.0
-
isRightEdgeOfAColumnGroup
public static boolean isRightEdgeOfAColumnGroup(ILayer natLayer, int columnPosition, int columnIndex, ColumnGroupModel model)
See ColumnGroupUtilsTest- Returns:
- TRUE if the given column is the right most column in a group
-
isLeftEdgeOfAColumnGroup
public static boolean isLeftEdgeOfAColumnGroup(ILayer natLayer, int columnPosition, int columnIndex, ColumnGroupModel model)
See ColumnGroupUtilsTest- Returns:
- TRUE if the given column is the left most column in a group
-
isBetweenTwoGroups
public static boolean isBetweenTwoGroups(ILayer natLayer, int startX, int endX, ColumnGroupModel model)
- Returns:
- TRUE if there is a column group boundary between startX and endX
-
isInTheSameGroup
public static boolean isInTheSameGroup(ColumnGroupHeaderLayer layer, int level, int fromPosition, int toPosition)
Checks if the two given column positions on the given layer belong to the same group at the given level on the givenColumnGroupHeaderLayer
.- Parameters:
layer
- TheColumnGroupHeaderLayer
which is needed to perform the check against.level
- The grouping level to check.fromPosition
- The column position to check based on the position layer of the givenColumnGroupHeaderLayer
.toPosition
- The column position to check based on the position layer of the givenColumnGroupHeaderLayer
.- Returns:
true
if both given positions belong to the same group,false
if not.- Since:
- 1.6
-
isBetweenTwoGroups
public static boolean isBetweenTwoGroups(ILayer natLayer, int startX, int endX, ColumnGroupHeaderLayer layer, int level)
Checks if the column positions at the given x coordinates belong to the same group or not.- Parameters:
natLayer
- The layer to which the given positions match. Typically the NatTable itself.startX
- The x coordinate of the column that should be checked. Typically the drag start x coordinate.endX
- The x coordinate of the column that should be checked. Typically the drag end x coordinate.layer
- TheColumnGroupHeaderLayer
which is needed to perform the check against.level
- The grouping level to check.- Returns:
true
if there is a column group boundary between startX and endX,false
if both positions are in the same group.- Since:
- 1.6
-
isBetweenTwoGroups
public static boolean isBetweenTwoGroups(ColumnGroupHeaderLayer columnGroupHeaderLayer, int toPosition, boolean reorderToLeftEdge, SelectionLayer.MoveDirectionEnum moveDirection)
Checks if the edge of a column position is the left-most or the right most column on any level of a column group.- Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
to handle the checks.toPosition
- The position to check. Needs to be related to the positionLayer.reorderToLeftEdge
-true
if the check should be performed to the left edge or the right edge of the toPosition.moveDirection
- The direction in which the reordering is performed.- Returns:
true
if the destination would be between two groups,false
if the destination would be inside a group.- Since:
- 1.6
-
isBetweenTwoGroups
public static boolean isBetweenTwoGroups(ColumnGroupHeaderLayer columnGroupHeaderLayer, int level, int toPosition, boolean reorderToLeftEdge, SelectionLayer.MoveDirectionEnum moveDirection)
Checks if the edge of a column position for a specific grouping level is the left-most or the right most column of a column group.- Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
to handle the checks.level
- The grouping level on which the check should be performed.toPosition
- The position to check. Needs to be related to the positionLayer.reorderToLeftEdge
-true
if the check should be performed to the left edge or the right edge of the toPosition.moveDirection
- The direction in which the reordering is performed.- Returns:
true
if the destination would be between two groups,false
if the destination would be inside a group.- Since:
- 1.6
-
isReorderValid
public static boolean isReorderValid(ColumnGroupHeaderLayer columnGroupHeaderLayer, int fromPosition, int toPosition, boolean reorderToLeftEdge)
Checks if a reorder operation is valid by checking the unbreakable states of the groups below the from and the to position.- Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
to get the groups to check.fromPosition
- The position from which a column should be reordered.toPosition
- The position to which a column should be reordered.reorderToLeftEdge
-true
if the reorder should be performed to the left edge of the toPosition.- Returns:
true
if the reorder operation would be valid,false
if the either the source or the target belongs to an unbreakable group.- Since:
- 1.6
-
isReorderValid
public static boolean isReorderValid(ColumnGroupHeaderLayer columnGroupHeaderLayer, int level, int fromPosition, int toPosition, boolean reorderToLeftEdge)
Checks if a reorder operation is valid by checking the unbreakable states of the groups below the from and the to position.- Parameters:
columnGroupHeaderLayer
- TheColumnGroupHeaderLayer
to get the groups to check.level
- The grouping level that should be checked.fromPosition
- The position from which a column should be reordered.toPosition
- The position to which a column should be reordered.reorderToLeftEdge
-true
if the reorder should be performed to the left edge of the toPosition.- Returns:
true
if the reorder operation would be valid,false
if the either the source or the target belongs to an unbreakable group.- Since:
- 1.6
-
isGroupReordered
public static boolean isGroupReordered(GroupModel.Group fromGroup, int[] fromColumnPositions)
Check if a complete group is reordered.- Parameters:
fromGroup
- The group to check.fromColumnPositions
- The column positions to check.- Returns:
true
if the fromColumnPositions are all part of the given group.- Since:
- 1.6
-
-