Class GroupModel.Group
java.lang.Object
org.eclipse.nebula.widgets.nattable.group.performance.GroupModel.Group
- Enclosing class:
- GroupModel
Model class to track the states of a group. Only carries the state, does
not contain logic with regards to changing the states.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddStaticIndexes(int... indexes) Adds the given indexes as static indexes to this group.booleancontainsStaticIndex(int index) Checks if the given index is a static index of this group.intSearches for the position of the last item in this group for the given layer.getName()Returns the name of this group.intintint[]int[]int[]intintintbooleanhasMember(int memberIndex) Check if the given index is a member of thisGroupModel.Groupor not.booleanbooleanReturns whether the group is collapsed or not.booleanisEmpty()booleanisGroupEnd(int position) Checks if the given position is the right/bottom most position of this group.booleanisGroupStart(int position) Checks if the given position is the left/top most position of this group.booleanvoidremoveStaticIndexes(int... indexes) Removes the given indexes as static indexes from this group.voidsetCollapseable(boolean collapseable) Configure thisGroupModel.Groupwhether it can be collapsed or not.voidsetCollapsed(boolean collapsed) Set the collapsed state of this group.voidSet the name of this group.voidsetOriginalSpan(int originalSpan) voidsetStartIndex(int startIndex) Sets the index of the first item in the group.voidsetUnbreakable(boolean unbreakable) voidsetVisibleSpan(int visibleSpan) voidsetVisibleStartIndex(int visibleStartIndex) Sets the index of the first visible item in the group.voidToggles the collapsed state.toString()
-
Method Details
-
getName
Returns the name of this group. Typically this value is used as value in the cell.- Returns:
- The name of this group.
-
setName
Set the name of this group. The value is typically used as value in the cell.- Parameters:
name- The name of the group.
-
isCollapsed
public boolean isCollapsed()Returns whether the group is collapsed or not.- Returns:
trueif this group is collapsed,falseif it is expanded.
-
setCollapsed
public void setCollapsed(boolean collapsed) Set the collapsed state of this group.- Parameters:
collapsed-trueto set the group in the collapsed state,falseto set it to the expanded state.
-
toggleCollapsed
public void toggleCollapsed()Toggles the collapsed state. -
isCollapseable
public boolean isCollapseable()- Returns:
trueif thisGroupModel.Groupcan be collapsed,falseif not.
-
setCollapseable
public void setCollapseable(boolean collapseable) Configure thisGroupModel.Groupwhether it can be collapsed or not.- Parameters:
collapseable-trueif thisGroupModel.Groupcan be collapsed,falseif not.
-
isUnbreakable
public boolean isUnbreakable()- Returns:
trueif thisGroupModel.Groupcan not be changed.falseif the number of items in thisGroupModel.Groupcan be modified.
-
setUnbreakable
public void setUnbreakable(boolean unbreakable) - Parameters:
unbreakable-trueif thisGroupModel.Groupshould not be changeable.falseif the number of items in thisGroupModel.Groupshould be changeable.
-
getStartIndex
public int getStartIndex()- Returns:
- The index of the first item in the group.
-
setStartIndex
public void setStartIndex(int startIndex) Sets the index of the first item in the group. Needed in case of reordering or if the first item is removed from the group.- Parameters:
startIndex- The index of the first item in the group.
-
getVisibleStartIndex
public int getVisibleStartIndex()- Returns:
- The index of the first visible item in the group. Could
differ from
startIndexif that item is hidden.
-
setVisibleStartIndex
public void setVisibleStartIndex(int visibleStartIndex) Sets the index of the first visible item in the group. Needed in case the first real item in the group is hidden.- Parameters:
visibleStartIndex- The index of the first visible item in the group.
-
getVisibleStartPosition
public int getVisibleStartPosition()- Returns:
- The position of the first visible item in the group matching the position layer of the GroupModel. Needed in case the first column of a group is hidden for example.
-
hasMember
public boolean hasMember(int memberIndex) Check if the given index is a member of thisGroupModel.Groupor not.- Parameters:
memberIndex- The index to check.- Returns:
trueif the given index is a member of thisGroupModel.Group,falseif not.
-
getOriginalSpan
public int getOriginalSpan()- Returns:
- The configured number of items that belong to this group.
-
setOriginalSpan
public void setOriginalSpan(int originalSpan) - Parameters:
originalSpan- The number of items that should belong to this group.
-
getVisibleSpan
public int getVisibleSpan()- Returns:
- The number of items that are currently visible in this
GroupModel.Group. Might differ from theoriginalSpanif columns/rows are hidden.
-
setVisibleSpan
public void setVisibleSpan(int visibleSpan) - Parameters:
visibleSpan- The number of items that are currently visible in thisGroupModel.Group. Cannot be bigger than the original span.
-
isEmpty
public boolean isEmpty()- Returns:
trueif thisGroupModel.Grouphas no spanning,falseif at least one position is part of thisGroupModel.Group.
-
addStaticIndexes
public void addStaticIndexes(int... indexes) Adds the given indexes as static indexes to this group. Static indexes are the indexes that stay visible when the group is collapsed.- Parameters:
indexes- The static indexes to add.
-
removeStaticIndexes
public void removeStaticIndexes(int... indexes) Removes the given indexes as static indexes from this group.- Parameters:
indexes- The static indexes to remove.
-
containsStaticIndex
public boolean containsStaticIndex(int index) Checks if the given index is a static index of this group.- Parameters:
index- The index to check.- Returns:
trueif the given index is configured as static index of this group,falseif not.- Since:
- 2.0
-
getStaticIndexes
public int[] getStaticIndexes()- Returns:
- The indexes that remain visible when collapsing this group.
- Since:
- 2.0
-
getVisiblePositions
public int[] getVisiblePositions()- Returns:
- The positions of the visible items in the group matching the position layer of the GroupModel.
- Since:
- 2.0
-
getVisibleIndexes
public int[] getVisibleIndexes()- Returns:
- The indexes of the positions that are currently visible.
- Since:
- 2.0
-
getGroupEndPosition
Searches for the position of the last item in this group for the given layer. Needed as the Group positions are based on the positionLayer, but on transporting commands down the layer stack the positions might need to be converted, e.g. to find the last item even if it is hidden.- Parameters:
layer- The layer needed for index-position-transformation.- Returns:
- The position of the last item in this group.
- Since:
- 2.0
-
isGroupStart
public boolean isGroupStart(int position) Checks if the given position is the left/top most position of this group. This actually means if the given position is the visible start position.- Parameters:
position- The position to check.- Returns:
trueif the given position is the left/top most position of this group,falseif not.
-
isGroupEnd
public boolean isGroupEnd(int position) Checks if the given position is the right/bottom most position of this group. This actually means if the given position is the visible start position + visible span.- Parameters:
position- The position to check.- Returns:
trueif the given position is the right/bottom most position of this group,falseif not.
-
toString
-