Class RowGroupUtils
java.lang.Object
org.eclipse.nebula.widgets.nattable.group.RowGroupUtils
The utility methods in this class bridge the divide between the world of row
indexes and positions and row objects used the model.
- Author:
- Stefan Bolton, Matt Biggs
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> IRowGroup<T>getOwnRowGroupForRowIndex(IRowGroupModel<T> model, int rowIndex) static <T> IRowGroup<T>getRowGroupForRowIndex(IRowGroupModel<T> model, int rowIndex) static <T> StringgetRowGroupNameForIndex(IRowGroupModel<T> model, int bodyRowIndex) getRowIndexesInGroup(IRowGroupModel<T> model, int rowIndex) getRowIndexesInGroup(IRowGroupModel<T> model, IRowGroup<T> group, boolean includeStatic) Return the row indexes of the rows that belong to a group.static <T> int[]getRowIndexesInGroupAsArray(IRowGroupModel<T> model, int rowIndex) static <T> int[]getRowIndexesInGroupAsArray(IRowGroupModel<T> model, IRowGroup<T> group, boolean includeStatic) Return the row indexes of the rows that belong to a group.static int[]getRowPositionsInGroup(IUniqueIndexLayer layer, int... bodyRowIndexes) Helper method to get the row positions for a specified layer If a row is currently invisible (-1) it will not be returned within the collectiongetRowPositionsInGroup(IUniqueIndexLayer layer, Collection<Integer> bodyRowIndexes) Helper method to get the row positions for a specified layer If a row is currently invisible (-1) it will not be returned within the collectionstatic <T> IRowGroup<T>getTopMostParentGroup(IRowGroup<T> rowGroup) static <T> booleanisAnyParentCollapsed(IRowGroup<T> group) static booleanisBetweenTwoGroups(RowGroupHeaderLayer rowGroupHeaderLayer, int toPosition, boolean reorderToTopEdge, SelectionLayer.MoveDirectionEnum moveDirection) Checks if the edge of a row position is the top-most or the bottom most row on any level of a row group.static booleanisBetweenTwoGroups(RowGroupHeaderLayer rowGroupHeaderLayer, int level, int toPosition, boolean reorderToTopEdge, SelectionLayer.MoveDirectionEnum moveDirection) Checks if the edge of a row position for a specific grouping level is the top-most or the bottom most row of a row group.static booleanisBetweenTwoGroups(ILayer natLayer, int startY, int endY, RowGroupHeaderLayer layer, int level) Checks if the row positions at the given y coordinates belong to the same group or not.static <T> booleanisCollapsed(IRowGroupModel<T> model, IRowGroup<T> group) static booleanisGroupReordered(GroupModel.Group fromGroup, int[] fromPositions) Check if a complete group is reordered.static <T> booleanisInTheSameGroup(int fromRowIndex, int toRowIndex, IRowGroupModel<T> model) static booleanisInTheSameGroup(RowGroupHeaderLayer layer, int level, int fromPosition, int toPosition) Checks if the two given row positions on the given layer belong to the same group at the given level on the givenRowGroupHeaderLayer.static <T> booleanisPartOfAGroup(IRowGroupModel<T> model, int rowIndex) static booleanisReorderValid(RowGroupHeaderLayer rowGroupHeaderLayer, int fromPosition, int toPosition, boolean reorderToTopEdge) Checks if a reorder operation is valid by checking the unbreakable states of the groups below the from and the to position.static booleanisReorderValid(RowGroupHeaderLayer rowGroupHeaderLayer, int level, int fromPosition, int toPosition, boolean reorderToTopEdge) Checks if a reorder operation is valid by checking the unbreakable states of the groups below the from and the to position.static booleanisRowIndexHiddenInUnderLyingLayer(int rowIndex, ILayer layer, IUniqueIndexLayer underlyingLayer) static <T> booleanisStaticRow(IRowGroupModel<T> model, int bodyRowIndex) static <T> intsizeOfGroup(IRowGroupModel<T> model, int bodyRowIndex)
-
Method Details
-
getRowGroupForRowIndex
-
getOwnRowGroupForRowIndex
-
isPartOfAGroup
-
isInTheSameGroup
public static <T> boolean isInTheSameGroup(int fromRowIndex, int toRowIndex, IRowGroupModel<T> model) -
isCollapsed
- Parameters:
model- TheIRowGroupModelthe givenIRowGroupbelongs to.group- TheIRowGroupto check.- Returns:
trueif the given row group or one of its parent groups is collapsed.
-
isAnyParentCollapsed
- Parameters:
group- TheIRowGroupto check.- Returns:
trueif any of the groups parent groups is collapsed.
-
sizeOfGroup
- Parameters:
model- TheIRowGroupModelto check.bodyRowIndex- The index of a row whose row group should be inspected.- Returns:
- The number of rows in the row group to which the given bodyRowIndex belongs to.
-
getTopMostParentGroup
- Parameters:
rowGroup- TheIRowGroupto check.- Returns:
- the top-most parent group of the given group or the group specified if it has no parents.
-
isStaticRow
- Parameters:
model- TheIRowGroupModelto check.bodyRowIndex- The index of a row whose row group should be inspected.- Returns:
trueifbodyRowIndexis contained in the list of static rows of the row group this index belongs to
-
isRowIndexHiddenInUnderLyingLayer
public static boolean isRowIndexHiddenInUnderLyingLayer(int rowIndex, ILayer layer, IUniqueIndexLayer underlyingLayer) -
getRowPositionsInGroup
public static List<Integer> getRowPositionsInGroup(IUniqueIndexLayer layer, Collection<Integer> bodyRowIndexes) Helper method to get the row positions for a specified layer If a row is currently invisible (-1) it will not be returned within the collection- Parameters:
layer- The layer for which the position transformation should be performed.bodyRowIndexes- The row indexes for which the positions are requested.- Returns:
- Unmodifiable list of the row positions for the given layer
-
getRowIndexesInGroup
- Parameters:
model- TheIRowGroupModelto check.rowIndex- The index of a row whose row group should be inspected.- Returns:
- Unmodifiable list of row indexes and static row indexes in the same group as this index
-
getRowIndexesInGroup
public static <T> List<Integer> getRowIndexesInGroup(IRowGroupModel<T> model, IRowGroup<T> group, boolean includeStatic) Return the row indexes of the rows that belong to a group.- Type Parameters:
T- The type of the objects in the backing data.- Parameters:
model- TheIRowGroupModelto check.group- TheIRowGroupto check.includeStatic-trueif static rows should be included,falseif not.- Returns:
- The row indexes of the rows that belong to the given group.
-
getRowPositionsInGroup
Helper method to get the row positions for a specified layer If a row is currently invisible (-1) it will not be returned within the collection- Parameters:
layer- The layer for which the position transformation should be performed.bodyRowIndexes- The row indexes for which the positions are requested.- Returns:
- The row positions for the given layer.
- Since:
- 2.0
-
getRowIndexesInGroupAsArray
- Parameters:
model- TheIRowGroupModelto check.rowIndex- The index of a row whose row group should be inspected.- Returns:
- The row indexes and static row indexes in the same group as this index.
- Since:
- 2.0
-
getRowIndexesInGroupAsArray
public static <T> int[] getRowIndexesInGroupAsArray(IRowGroupModel<T> model, IRowGroup<T> group, boolean includeStatic) Return the row indexes of the rows that belong to a group.- Type Parameters:
T- The type of the objects in the backing data.- Parameters:
model- TheIRowGroupModelto check.group- TheIRowGroupto check.includeStatic-trueif static rows should be included,falseif not.- Returns:
- The row indexes of the rows that belong to the given group.
- Since:
- 2.0
-
getRowGroupNameForIndex
-
isInTheSameGroup
public static boolean isInTheSameGroup(RowGroupHeaderLayer layer, int level, int fromPosition, int toPosition) Checks if the two given row positions on the given layer belong to the same group at the given level on the givenRowGroupHeaderLayer.- Parameters:
layer- TheRowGroupHeaderLayerwhich is needed to perform the check against.level- The grouping level to check.fromPosition- The row position to check based on the position layer of the givenRowGroupHeaderLayer.toPosition- The row position to check based on the position layer of the givenRowGroupHeaderLayer.- Returns:
trueif both given positions belong to the same group,falseif not.- Since:
- 1.6
-
isBetweenTwoGroups
public static boolean isBetweenTwoGroups(ILayer natLayer, int startY, int endY, RowGroupHeaderLayer layer, int level) Checks if the row positions at the given y coordinates belong to the same group or not.- Parameters:
natLayer- The layer to which the given positions match. Typically the NatTable itself.startY- The y coordinate of the row that should be checked. Typically the drag start y coordinate.endY- The y coordinate of the row that should be checked. Typically the drag end y coordinate.layer- TheRowGroupHeaderLayerwhich is needed to perform the check against.level- The grouping level to check.- Returns:
trueif there is a row group boundary between startY and endY,falseif both positions are in the same group.- Since:
- 1.6
-
isBetweenTwoGroups
public static boolean isBetweenTwoGroups(RowGroupHeaderLayer rowGroupHeaderLayer, int toPosition, boolean reorderToTopEdge, SelectionLayer.MoveDirectionEnum moveDirection) Checks if the edge of a row position is the top-most or the bottom most row on any level of a row group.- Parameters:
rowGroupHeaderLayer- TheRowGroupHeaderLayerto handle the checks.toPosition- The position to check. Needs to be related to the positionLayer.reorderToTopEdge-trueif the check should be performed to the top edge or the bottom edge of the toPosition.moveDirection- The direction in which the reordering is performed.- Returns:
trueif the destination would be between two groups,falseif the destination would be inside a group.- Since:
- 1.6
-
isBetweenTwoGroups
public static boolean isBetweenTwoGroups(RowGroupHeaderLayer rowGroupHeaderLayer, int level, int toPosition, boolean reorderToTopEdge, SelectionLayer.MoveDirectionEnum moveDirection) Checks if the edge of a row position for a specific grouping level is the top-most or the bottom most row of a row group.- Parameters:
rowGroupHeaderLayer- TheRowGroupHeaderLayerto 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.reorderToTopEdge-trueif the check should be performed to the top edge or the bottom edge of the toPosition.moveDirection- The direction in which the reordering is performed.- Returns:
trueif the destination would be between two groups,falseif the destination would be inside a group.- Since:
- 1.6
-
isReorderValid
public static boolean isReorderValid(RowGroupHeaderLayer rowGroupHeaderLayer, int fromPosition, int toPosition, boolean reorderToTopEdge) Checks if a reorder operation is valid by checking the unbreakable states of the groups below the from and the to position.- Parameters:
rowGroupHeaderLayer- TheRowGroupHeaderLayerto get the groups to check.fromPosition- The position from which a row should be reordered.toPosition- The position to which a row should be reordered.reorderToTopEdge-trueif the reorder should be performed to the top edge of the toPosition.- Returns:
trueif the reorder operation would be valid,falseif the either the source or the target belongs to an unbreakable group.- Since:
- 1.6
-
isReorderValid
public static boolean isReorderValid(RowGroupHeaderLayer rowGroupHeaderLayer, int level, int fromPosition, int toPosition, boolean reorderToTopEdge) Checks if a reorder operation is valid by checking the unbreakable states of the groups below the from and the to position.- Parameters:
rowGroupHeaderLayer- TheRowGroupHeaderLayerto get the groups to check.level- The grouping level that should be checked.fromPosition- The position from which a row should be reordered.toPosition- The position to which a row should be reordered.reorderToTopEdge-trueif the reorder should be performed to the top edge of the toPosition.- Returns:
trueif the reorder operation would be valid,falseif the either the source or the target belongs to an unbreakable group.- Since:
- 1.6
-
isGroupReordered
Check if a complete group is reordered.- Parameters:
fromGroup- The group to check.fromPositions- The positions to check.- Returns:
trueif the fromPositions are all part of the given group.- Since:
- 1.6
-