java.lang.Object
org.eclipse.nebula.widgets.nattable.group.performance.GroupModel.Group
Enclosing class:
GroupModel

public class GroupModel.Group extends Object
Model class to track the states of a group. Only carries the state, does not contain logic with regards to changing the states.
  • Method Details

    • getName

      public String getName()
      Returns the name of this group. Typically this value is used as value in the cell.
      Returns:
      The name of this group.
    • setName

      public void setName(String name)
      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:
      true if this group is collapsed, false if it is expanded.
    • setCollapsed

      public void setCollapsed(boolean collapsed)
      Set the collapsed state of this group.
      Parameters:
      collapsed - true to set the group in the collapsed state, false to set it to the expanded state.
    • toggleCollapsed

      public void toggleCollapsed()
      Toggles the collapsed state.
    • isCollapseable

      public boolean isCollapseable()
      Returns:
      true if this GroupModel.Group can be collapsed, false if not.
    • setCollapseable

      public void setCollapseable(boolean collapseable)
      Configure this GroupModel.Group whether it can be collapsed or not.
      Parameters:
      collapseable - true if this GroupModel.Group can be collapsed, false if not.
    • isUnbreakable

      public boolean isUnbreakable()
      Returns:
      true if this GroupModel.Group can not be changed. false if the number of items in this GroupModel.Group can be modified.
    • setUnbreakable

      public void setUnbreakable(boolean unbreakable)
      Parameters:
      unbreakable - true if this GroupModel.Group should not be changeable. false if the number of items in this GroupModel.Group should 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 startIndex if 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 this GroupModel.Group or not.
      Parameters:
      memberIndex - The index to check.
      Returns:
      true if the given index is a member of this GroupModel.Group, false if 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 the originalSpan if columns/rows are hidden.
    • setVisibleSpan

      public void setVisibleSpan(int visibleSpan)
      Parameters:
      visibleSpan - The number of items that are currently visible in this GroupModel.Group. Cannot be bigger than the original span.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if this GroupModel.Group has no spanning, false if at least one position is part of this GroupModel.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:
      true if the given index is configured as static index of this group, false if 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

      public int getGroupEndPosition(IUniqueIndexLayer layer)
      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:
      true if the given position is the left/top most position of this group, false if 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:
      true if the given position is the right/bottom most position of this group, false if not.
    • toString

      public String toString()
      Overrides:
      toString in class Object