Class ColumnGroupModel

  • All Implemented Interfaces:
    IPersistable
    Direct Known Subclasses:
    ColumnGroupModelFixture

    public class ColumnGroupModel
    extends Object
    implements IPersistable
    Tracks: Columns (by index) in a column Group. Does not keep the column indexes in any defined order. Expand/collapse state of the Group. Name of the Column Group (CG)
    • Constructor Detail

      • ColumnGroupModel

        public ColumnGroupModel()
    • Method Detail

      • unregisterColumnGroupModelListener

        public void unregisterColumnGroupModelListener​(IColumnGroupModelListener listener)
      • notifyListeners

        public void notifyListeners()
      • saveState

        public void saveState​(String prefix,
                              Properties properties)
        Description copied from interface: IPersistable
        Saves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.
        Specified by:
        saveState in interface IPersistable
        Parameters:
        prefix - The prefix to use for the state keys. Is also used as the state configuration name.
        properties - The Properties instance to save the state to.
      • loadState

        public void loadState​(String prefix,
                              Properties properties)
        Description copied from interface: IPersistable
        Restore the state out of the given Properties identified by the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.
        Specified by:
        loadState in interface IPersistable
        Parameters:
        prefix - The prefix to use for the state keys. Is also used as the state configuration name.
        properties - The Properties instance to load the state from.
      • addColumnsIndexesToGroup

        public void addColumnsIndexesToGroup​(String colGroupName,
                                             int... bodyColumnIndexs)
        Creates the column group if one does not exist with the given name and adds the column indexes to it.
        Parameters:
        colGroupName - The name of the column group.
        bodyColumnIndexs - The column indexes that should be added to the group.
        See Also:
        insertColumnIndexes(String, int[])
      • insertColumnIndexes

        public boolean insertColumnIndexes​(String colGroupName,
                                           int... columnIndexesToInsert)
        This method will add column indexes to an existing group.
        Parameters:
        colGroupName - The name of the column group to which the column indexes should be added to
        columnIndexesToInsert - The column indexes to insert.
        Returns:
        FALSE if: The column group is frozen Index is already s part of a column group
      • removeColumnIndexes

        public boolean removeColumnIndexes​(String colGroupName,
                                           int... columnIndexesToRemove)
        This method will remove column indexes from an existing group.
        Parameters:
        colGroupName - The name of the column group from which the column indexes should be removed.
        columnIndexesToRemove - The column indexes to remove.
        Returns:
        true if at least one column was removed from the column group.
        Since:
        1.3
      • setStaticColumnIndexesByGroup

        public void setStaticColumnIndexesByGroup​(String colGroupName,
                                                  int[] staticColumnIndexes)
        Add static columns identified by staticColumnIndexes to the given columnGroup colGroupName. Static columns remains visible when a column group is collapsed.
        Parameters:
        colGroupName - to add the indexes to
        staticColumnIndexes - the column indexes that should be treated as static columns
      • insertStaticColumnIndexes

        public void insertStaticColumnIndexes​(String colGroupName,
                                              int... columnIndexesToInsert)
        This method will add static column index(s) to an existing group
        Parameters:
        colGroupName - to add the indexes to
        columnIndexesToInsert - the column indexes that should be treated as static columns
      • isPartOfAGroup

        public boolean isPartOfAGroup​(int bodyColumnIndex)
      • isAGroup

        public boolean isAGroup​(String cellValue)
        Parameters:
        cellValue - the name that should be checked
        Returns:
        true if a group by this name exists
      • clear

        public void clear()
      • size

        public int size()
        Returns:
        Number of column Groups in the model.
      • isEmpty

        public boolean isEmpty()
        Returns:
        TRUE if no column groups exist
      • getAllIndexesInGroups

        public List<Integer> getAllIndexesInGroups()
        Returns:
        all the indexes which belong to groups
      • isStaticColumn

        public boolean isStaticColumn​(int bodyColumnIndex)
        Parameters:
        bodyColumnIndex - the column index to check
        Returns:
        true if bodyColumnIndex is contained in the list of static columns of the column group this index belongs to
      • getCollapsedColumnCount

        public int getCollapsedColumnCount()
        Returns:
        Total number of columns hidden for all the collapsed columns.
      • getColumnGroupPositionFromIndex

        public int getColumnGroupPositionFromIndex​(int bodyColumnIndex)
        Parameters:
        bodyColumnIndex - the column index to check
        Returns:
        The position of the index within the column group
      • setColumnGroupCollapseable

        public void setColumnGroupCollapseable​(int columnIndex,
                                               boolean collabseable)
        Set the ColumnGroupModel.ColumnGroup to which the column and the specified column index belongs to, to be collapseable or not.
        Parameters:
        columnIndex - The column index used to retrieve the corresponding column group
        collabseable - true to set the column group collapseable, false to set it not to be collapseable.
      • setColumnGroupUnbreakable

        public void setColumnGroupUnbreakable​(int columnIndex,
                                              boolean unbreakable)
        Set the ColumnGroupModel.ColumnGroup to which the column and the specified column index belongs to, to be unbreakable/breakable.
        Parameters:
        columnIndex - The column index used to retrieve the corresponding column group
        unbreakable - true to set the column group unbreakable, false to remove the unbreakable state.
      • isDefaultCollapseable

        public boolean isDefaultCollapseable()
        Returns:
        The default value for the collapseable flag of newly created ColumnGroupModel.ColumnGroup objects.
        Since:
        1.6