Class RowGroup<T>

  • Type Parameters:
    T - the type of the row objects.
    All Implemented Interfaces:
    IRowGroup<T>

    public class RowGroup<T>
    extends Object
    implements IRowGroup<T>
    An implementation of IRowGroup.
    Author:
    Stefan Bolton
    • Method Detail

      • getGroupName

        public String getGroupName()
        Specified by:
        getGroupName in interface IRowGroup<T>
        Returns:
        A Unique name for the group - it must not conflict with any other group's name.
      • getData

        public Object getData()
        Description copied from interface: IRowGroup
        Allows some arbitrary data to be retrieved from an IRowGroup.
        Specified by:
        getData in interface IRowGroup<T>
      • getData

        public Object getData​(String key)
        Description copied from interface: IRowGroup
        Allows some arbitrary data to be retrieved from an IRowGroup.
        Specified by:
        getData in interface IRowGroup<T>
      • setData

        public void setData​(Object data)
        Description copied from interface: IRowGroup
        Allows some arbitrary data to be tagged to an IRowGroup.
        Specified by:
        setData in interface IRowGroup<T>
      • setData

        public void setData​(String key,
                            Object data)
        Description copied from interface: IRowGroup
        Allows some arbitrary data to be tagged to an IRowGroup.
        Specified by:
        setData in interface IRowGroup<T>
      • isCollapsed

        public boolean isCollapsed()
        Specified by:
        isCollapsed in interface IRowGroup<T>
        Returns:
        Whether the group has been expanded or collapsed. A collapsed group will hide all members of the group apart from any 'static' rows.
      • isCollapseable

        public boolean isCollapseable()
        Specified by:
        isCollapseable in interface IRowGroup<T>
        Returns:
        Whether the group can be expanded or collapsed or, false if it should be locked in it's current state.
      • setCollapseable

        public void setCollapseable​(boolean collapseable)
      • collapse

        public void collapse()
        Description copied from interface: IRowGroup

        Updates the group's state to indicate it is collapsed.

        A notification should be sent to any IRowGroupModelListeners to indicate a change in the model has occurred.

        Specified by:
        collapse in interface IRowGroup<T>
      • expand

        public void expand()
        Description copied from interface: IRowGroup

        Updates the group's state to indicate it is expanded.

        A notification should be sent to any IRowGroupModelListeners to indicate a change in the model has occurred.

        Specified by:
        expand in interface IRowGroup<T>
      • addMemberRow

        public void addMemberRow​(T row)
        Description copied from interface: IRowGroup

        Adds the row into the group.

        Specified by:
        addMemberRow in interface IRowGroup<T>
        Parameters:
        row - the row to be added
      • addStaticMemberRow

        public void addStaticMemberRow​(T row)
        Description copied from interface: IRowGroup

        Adds a static row into the group. A static row is one that is always shown when the group is collapsed (summary data rows for example).

        Specified by:
        addStaticMemberRow in interface IRowGroup<T>
        Parameters:
        row - the static row T to be added.
      • addMemberRows

        public void addMemberRows​(List<T> rows)
        Description copied from interface: IRowGroup

        Adds multiple rows into the group.

        Specified by:
        addMemberRows in interface IRowGroup<T>
        Parameters:
        rows - A List of rows T to be added.
      • removeMemberRow

        public boolean removeMemberRow​(T row)
        Description copied from interface: IRowGroup

        Removes the row from the group whether it's static or non-static.

        Existing positions in the model may be bumped up if the row was not the last row in the model.

        A notification should be sent to any IRowGroupModelListeners to indicate a change in the model has occurred.

        Specified by:
        removeMemberRow in interface IRowGroup<T>
        Parameters:
        row - The row T to be removed.
        Returns:
        true if the row existed and was removed.
      • removeMemberRows

        public void removeMemberRows​(List<T> rows)
        Description copied from interface: IRowGroup

        Removes multiple rows from the group whether they are static or non-static.

        Existing positions in the model may be bumped up if the row was not the last row in the model.

        A notification should be sent to any IRowGroupModelListeners to indicate a change in the model has occurred.

        Specified by:
        removeMemberRows in interface IRowGroup<T>
        Parameters:
        rows - A List of rows T to be added.
      • getParentGroup

        public IRowGroup<T> getParentGroup()
        Description copied from interface: IRowGroup
        If this group is a nested child of another this will return the parent group.
        Specified by:
        getParentGroup in interface IRowGroup<T>
        Returns:
        The parent group if this group is a nested child.
      • setParentGroup

        public void setParentGroup​(IRowGroup<T> parentGroup)
        Description copied from interface: IRowGroup
        Set the specified group as the parent of this group.
        Specified by:
        setParentGroup in interface IRowGroup<T>
      • addRowGroup

        public void addRowGroup​(IRowGroup<T> rowGroup)
        Description copied from interface: IRowGroup
        Adds a row-group into the group. Calls to getMemberRows and getStaticMemberRows will recurse through nested groups and return a flattened list of rows in all contained groups.
        Specified by:
        addRowGroup in interface IRowGroup<T>
        Parameters:
        rowGroup - a IHierarchicalRowGroup.
      • removeRowGroup

        public boolean removeRowGroup​(IRowGroup<T> rowGroup)
        Description copied from interface: IRowGroup
        Returns the row-group child of this group.
        Specified by:
        removeRowGroup in interface IRowGroup<T>
        Parameters:
        rowGroup - a IHierarchicalRowGroup.
        Returns:
        true if the group existed as a child and was removed.
      • getOwnMemberRows

        public List<T> getOwnMemberRows​(boolean includeStaticRows)
        Description copied from interface: IRowGroup
        Returns only the rows contained with this group. Not nested groups.
        Specified by:
        getOwnMemberRows in interface IRowGroup<T>
        Returns:
        a list of rows T.
      • getOwnStaticMemberRows

        public List<T> getOwnStaticMemberRows()
        Specified by:
        getOwnStaticMemberRows in interface IRowGroup<T>
        Returns:
        Static rows only in this group not in nested groups.
      • clear

        public void clear()
        Description copied from interface: IRowGroup
        Removes all member and static member rows from the group.
        Specified by:
        clear in interface IRowGroup<T>
      • getMemberRows

        public List<T> getMemberRows​(boolean includeStaticRows)
        Specified by:
        getMemberRows in interface IRowGroup<T>
        Parameters:
        includeStaticRows - true to include the static rows false to exclude them.
        Returns:
        an unmodifiable List of the rows (T) in the IRowGroup.
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface IRowGroup<T>
        Returns:
        true if there are no rows (normal or static) in the group.