Class RowGroup<T>
- Type Parameters:
T
- the type of the row objects.
- All Implemented Interfaces:
IRowGroup<T>
IRowGroup
.- Author:
- Stefan Bolton
-
Constructor Summary
ConstructorsConstructorDescriptionRowGroup
(RowGroupModel<T> rowGroupModel, String groupName) RowGroup
(RowGroupModel<T> rowGroupModel, String groupName, boolean collapsed) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMemberRow
(T row) Adds the row into the group.void
addMemberRows
(List<T> rows) Adds multiple rows into the group.void
addRowGroup
(IRowGroup<T> rowGroup) Adds a row-group into the group.void
addStaticMemberRow
(T row) Adds a static row into the group.void
clear()
Removes all member and static member rows from the group.void
collapse()
Updates the group's state to indicate it is collapsed.void
expand()
Updates the group's state to indicate it is expanded.getData()
Allows some arbitrary data to be retrieved from an IRowGroup.Allows some arbitrary data to be retrieved from an IRowGroup.getMemberRows
(boolean includeStaticRows) getOwnMemberRows
(boolean includeStaticRows) Returns only the rows contained with this group.If this group is a nested child of another this will return the parent group.getRowGroupForRow
(T row) Retrieves the sub-group for a given row member.boolean
boolean
boolean
isEmpty()
boolean
removeMemberRow
(T row) Removes the row from the group whether it's static or non-static.void
removeMemberRows
(List<T> rows) Removes multiple rows from the group whether they are static or non-static.boolean
removeRowGroup
(IRowGroup<T> rowGroup) Returns the row-group child of this group.void
setCollapseable
(boolean collapseable) void
Allows some arbitrary data to be tagged to an IRowGroup.void
Allows some arbitrary data to be tagged to an IRowGroup.void
setParentGroup
(IRowGroup<T> parentGroup) Set the specified group as the parent of this group.toString()
-
Constructor Details
-
RowGroup
-
RowGroup
-
-
Method Details
-
getGroupName
- Specified by:
getGroupName
in interfaceIRowGroup<T>
- Returns:
- A Unique name for the group - it must not conflict with any other group's name.
-
getData
Description copied from interface:IRowGroup
Allows some arbitrary data to be retrieved from an IRowGroup. -
getData
Description copied from interface:IRowGroup
Allows some arbitrary data to be retrieved from an IRowGroup. -
setData
Description copied from interface:IRowGroup
Allows some arbitrary data to be tagged to an IRowGroup. -
setData
Description copied from interface:IRowGroup
Allows some arbitrary data to be tagged to an IRowGroup. -
isCollapsed
public boolean isCollapsed()- Specified by:
isCollapsed
in interfaceIRowGroup<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 interfaceIRowGroup<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
IRowGroupModelListener
s to indicate a change in the model has occurred. -
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
IRowGroupModelListener
s to indicate a change in the model has occurred. -
addMemberRow
Description copied from interface:IRowGroup
Adds the row into the group.
- Specified by:
addMemberRow
in interfaceIRowGroup<T>
- Parameters:
row
- the row to be added
-
addStaticMemberRow
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 interfaceIRowGroup<T>
- Parameters:
row
- the static row T to be added.
-
addMemberRows
Description copied from interface:IRowGroup
Adds multiple rows into the group.
- Specified by:
addMemberRows
in interfaceIRowGroup<T>
- Parameters:
rows
- AList
of rows T to be added.
-
removeMemberRow
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
IRowGroupModelListener
s to indicate a change in the model has occurred.- Specified by:
removeMemberRow
in interfaceIRowGroup<T>
- Parameters:
row
- The row T to be removed.- Returns:
- true if the row existed and was removed.
-
removeMemberRows
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
IRowGroupModelListener
s to indicate a change in the model has occurred.- Specified by:
removeMemberRows
in interfaceIRowGroup<T>
- Parameters:
rows
- AList
of rows T to be added.
-
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 interfaceIRowGroup<T>
- Returns:
- The parent group if this group is a nested child.
-
setParentGroup
Description copied from interface:IRowGroup
Set the specified group as the parent of this group.- Specified by:
setParentGroup
in interfaceIRowGroup<T>
-
addRowGroup
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 interfaceIRowGroup<T>
- Parameters:
rowGroup
- a IHierarchicalRowGroup.
-
removeRowGroup
Description copied from interface:IRowGroup
Returns the row-group child of this group.- Specified by:
removeRowGroup
in interfaceIRowGroup<T>
- Parameters:
rowGroup
- a IHierarchicalRowGroup.- Returns:
- true if the group existed as a child and was removed.
-
getRowGroups
- Specified by:
getRowGroups
in interfaceIRowGroup<T>
- Returns:
- an unmodifiable
List
of the groups which are direct children of this group.
-
getOwnMemberRows
Description copied from interface:IRowGroup
Returns only the rows contained with this group. Not nested groups.- Specified by:
getOwnMemberRows
in interfaceIRowGroup<T>
- Returns:
- a list of rows T.
-
getOwnStaticMemberRows
- Specified by:
getOwnStaticMemberRows
in interfaceIRowGroup<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. -
getMemberRows
- Specified by:
getMemberRows
in interfaceIRowGroup<T>
- Parameters:
includeStaticRows
- true to include the static rows false to exclude them.- Returns:
- an unmodifiable
List
of the rows (T) in theIRowGroup
.
-
getStaticMemberRows
- Specified by:
getStaticMemberRows
in interfaceIRowGroup<T>
- Returns:
- an unmodifiable
List
of the static rows (T) in theIRowGroup
.
-
getRowGroupForRow
Description copied from interface:IRowGroup
Retrieves the sub-group for a given row member.- Specified by:
getRowGroupForRow
in interfaceIRowGroup<T>
-
isEmpty
public boolean isEmpty() -
toString
-