Class RowGroupModel<T>
java.lang.Object
org.eclipse.nebula.widgets.nattable.group.model.RowGroupModel<T>
- Type Parameters:
T
- the type of the row objects.
- All Implemented Interfaces:
IRowGroupModel<T>
,IPersistable
A thread-safe implementation of
IRowGroupModel
which is optimised for
larger data-sets (it should cope with at least 10k rows spread across 2-300
groups).- Author:
- Stefan Bolton
-
Field Summary
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
addRowGroup
(IRowGroup<T> rowGroup) Adds a group into the model.void
addRowGroups
(List<IRowGroup<T>> rowGroups) Adds multiple row groups into the model and only fires off a single change notification.void
clear()
Wipes all groups from the model.int
getIndexFromRowCache
(T row) Retrieves a row's index by from our cache.getRowFromIndexCache
(int rowIndex) Retrieves a row T by it's index from our cache.getRowGroupForName
(String groupName) Returns an theIRowGroup
with the specified group name.getRowGroupForRow
(T row) Returns the firstIRowGroup
found containing the specified row.void
boolean
isEmpty()
boolean
void
loadState
(String prefix, Properties properties) Restore the state out of the given Properties identified by the specified prefix.void
Notify anyIRowGroupModelListener
s that something in the model has changed.void
Registers a listener to the model to receive notification of any changes.boolean
removeRowGroup
(IRowGroup<T> rowGroup) Removes the group from the model.void
saveState
(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.void
setDataProvider
(IRowDataProvider<T> dataProvider) Required for the index-to-row cache to populate itseld.void
setSuppressNoficiations
(boolean suppressNoficiations) Set to true to stop model change notifications.toString()
void
Unregisters the listener from the model.
-
Constructor Details
-
RowGroupModel
public RowGroupModel()
-
-
Method Details
-
getRowFromIndexCache
Description copied from interface:IRowGroupModel
Retrieves a row T by it's index from our cache. It will be added to the cache if not present.- Specified by:
getRowFromIndexCache
in interfaceIRowGroupModel<T>
-
getIndexFromRowCache
Description copied from interface:IRowGroupModel
Retrieves a row's index by from our cache. It will be added to the cache if not present.- Specified by:
getIndexFromRowCache
in interfaceIRowGroupModel<T>
-
invalidateIndexCache
public void invalidateIndexCache()- Specified by:
invalidateIndexCache
in interfaceIRowGroupModel<T>
-
setDataProvider
Description copied from interface:IRowGroupModel
Required for the index-to-row cache to populate itseld.- Specified by:
setDataProvider
in interfaceIRowGroupModel<T>
-
getDataProvider
- Specified by:
getDataProvider
in interfaceIRowGroupModel<T>
- Returns:
- an
IRowDataProvider
used for the index-to-row cache.
-
notifyListeners
public void notifyListeners()Notify any
IRowGroupModelListener
s that something in the model has changed.- Specified by:
notifyListeners
in interfaceIRowGroupModel<T>
-
setSuppressNoficiations
public void setSuppressNoficiations(boolean suppressNoficiations) Set to true to stop model change notifications.- Parameters:
suppressNoficiations
-
-
isSuppressNoficiations
public boolean isSuppressNoficiations() -
addRowGroups
Description copied from interface:IRowGroupModel
Adds multiple row groups into the model and only fires off a single change notification.
- Specified by:
addRowGroups
in interfaceIRowGroupModel<T>
- Parameters:
rowGroups
- A list ofIRowGroup
s to add.
-
addRowGroup
Description copied from interface:IRowGroupModel
Adds a group into the model.
A notification should be sent to any
IRowGroupModelListener
s to indicate a change in the model has occurred.- Specified by:
addRowGroup
in interfaceIRowGroupModel<T>
- Parameters:
rowGroup
- TheIRowGroup
to be added.- Returns:
- false if the group wasn't added.
-
removeRowGroup
Description copied from interface:IRowGroupModel
Removes the group from the model.
A notification should be sent to any
IRowGroupModelListener
s to indicate a change in the model has occurred.- Specified by:
removeRowGroup
in interfaceIRowGroupModel<T>
- Parameters:
rowGroup
- TheIRowGroup
to remove.- Returns:
- true if the group was present and removed, false if the group was not present.
-
getRowGroups
- Specified by:
getRowGroups
in interfaceIRowGroupModel<T>
- Returns:
- an unmodifiable
List
ofIRowGroup
in the model.
-
getRowGroupForName
Description copied from interface:IRowGroupModel
Returns an theIRowGroup
with the specified group name.- Specified by:
getRowGroupForName
in interfaceIRowGroupModel<T>
- Parameters:
groupName
- The unique name assigned to anIRowGroup
.- Returns:
- An
IRowGroup
or null if there is no group with the specified name.
-
getRowGroupForRow
Description copied from interface:IRowGroupModel
Returns the firstIRowGroup
found containing the specified row.- Specified by:
getRowGroupForRow
in interfaceIRowGroupModel<T>
- Parameters:
row
- The row object.- Returns:
- An
IRowGroup
or null if there is no group with the specified row.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceIRowGroupModel<T>
- Returns:
- true if there are no
IRowGroup
s in the model. Note: if there are groups but there are no rows, then true is still returned.
-
clear
public void clear()Description copied from interface:IRowGroupModel
Wipes all groups from the model.
A notification should be sent to any
IRowGroupModelListener
s to indicate a change in the model has occurred.- Specified by:
clear
in interfaceIRowGroupModel<T>
-
registerRowGroupModelListener
Description copied from interface:IRowGroupModel
Registers a listener to the model to receive notification of any changes.- Specified by:
registerRowGroupModelListener
in interfaceIRowGroupModel<T>
- Parameters:
listener
- anIRowGroupModelListener
.
-
unregisterRowGroupModelListener
Description copied from interface:IRowGroupModel
Unregisters the listener from the model.- Specified by:
unregisterRowGroupModelListener
in interfaceIRowGroupModel<T>
- Parameters:
listener
- anIRowGroupModelListener
.
-
saveState
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 interfaceIPersistable
- 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
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 interfaceIPersistable
- 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.
-
toString
-