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 TypeMethodDescriptionbooleanaddRowGroup(IRowGroup<T> rowGroup) Adds a group into the model.voidaddRowGroups(List<IRowGroup<T>> rowGroups) Adds multiple row groups into the model and only fires off a single change notification.voidclear()Wipes all groups from the model.intgetIndexFromRowCache(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 theIRowGroupwith the specified group name.getRowGroupForRow(T row) Returns the firstIRowGroupfound containing the specified row.voidbooleanisEmpty()booleanvoidloadState(String prefix, Properties properties) Restore the state out of the given Properties identified by the specified prefix.voidNotify anyIRowGroupModelListeners that something in the model has changed.voidRegisters a listener to the model to receive notification of any changes.booleanremoveRowGroup(IRowGroup<T> rowGroup) Removes the group from the model.voidsaveState(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.voidsetDataProvider(IRowDataProvider<T> dataProvider) Required for the index-to-row cache to populate itseld.voidsetSuppressNoficiations(boolean suppressNoficiations) Set to true to stop model change notifications.toString()voidUnregisters the listener from the model.
-
Constructor Details
-
RowGroupModel
public RowGroupModel()
-
-
Method Details
-
getRowFromIndexCache
Description copied from interface:IRowGroupModelRetrieves a row T by it's index from our cache. It will be added to the cache if not present.- Specified by:
getRowFromIndexCachein interfaceIRowGroupModel<T>
-
getIndexFromRowCache
Description copied from interface:IRowGroupModelRetrieves a row's index by from our cache. It will be added to the cache if not present.- Specified by:
getIndexFromRowCachein interfaceIRowGroupModel<T>
-
invalidateIndexCache
public void invalidateIndexCache()- Specified by:
invalidateIndexCachein interfaceIRowGroupModel<T>
-
setDataProvider
Description copied from interface:IRowGroupModelRequired for the index-to-row cache to populate itseld.- Specified by:
setDataProviderin interfaceIRowGroupModel<T>
-
getDataProvider
- Specified by:
getDataProviderin interfaceIRowGroupModel<T>- Returns:
- an
IRowDataProviderused for the index-to-row cache.
-
notifyListeners
public void notifyListeners()Notify any
IRowGroupModelListeners that something in the model has changed.- Specified by:
notifyListenersin 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:IRowGroupModelAdds multiple row groups into the model and only fires off a single change notification.
- Specified by:
addRowGroupsin interfaceIRowGroupModel<T>- Parameters:
rowGroups- A list ofIRowGroups to add.
-
addRowGroup
Description copied from interface:IRowGroupModelAdds a group into the model.
A notification should be sent to any
IRowGroupModelListeners to indicate a change in the model has occurred.- Specified by:
addRowGroupin interfaceIRowGroupModel<T>- Parameters:
rowGroup- TheIRowGroupto be added.- Returns:
- false if the group wasn't added.
-
removeRowGroup
Description copied from interface:IRowGroupModelRemoves the group from the model.
A notification should be sent to any
IRowGroupModelListeners to indicate a change in the model has occurred.- Specified by:
removeRowGroupin interfaceIRowGroupModel<T>- Parameters:
rowGroup- TheIRowGroupto remove.- Returns:
- true if the group was present and removed, false if the group was not present.
-
getRowGroups
- Specified by:
getRowGroupsin interfaceIRowGroupModel<T>- Returns:
- an unmodifiable
ListofIRowGroupin the model.
-
getRowGroupForName
Description copied from interface:IRowGroupModelReturns an theIRowGroupwith the specified group name.- Specified by:
getRowGroupForNamein interfaceIRowGroupModel<T>- Parameters:
groupName- The unique name assigned to anIRowGroup.- Returns:
- An
IRowGroupor null if there is no group with the specified name.
-
getRowGroupForRow
Description copied from interface:IRowGroupModelReturns the firstIRowGroupfound containing the specified row.- Specified by:
getRowGroupForRowin interfaceIRowGroupModel<T>- Parameters:
row- The row object.- Returns:
- An
IRowGroupor null if there is no group with the specified row.
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceIRowGroupModel<T>- Returns:
- true if there are no
IRowGroups 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:IRowGroupModelWipes all groups from the model.
A notification should be sent to any
IRowGroupModelListeners to indicate a change in the model has occurred.- Specified by:
clearin interfaceIRowGroupModel<T>
-
registerRowGroupModelListener
Description copied from interface:IRowGroupModelRegisters a listener to the model to receive notification of any changes.- Specified by:
registerRowGroupModelListenerin interfaceIRowGroupModel<T>- Parameters:
listener- anIRowGroupModelListener.
-
unregisterRowGroupModelListener
Description copied from interface:IRowGroupModelUnregisters the listener from the model.- Specified by:
unregisterRowGroupModelListenerin interfaceIRowGroupModel<T>- Parameters:
listener- anIRowGroupModelListener.
-
saveState
Description copied from interface:IPersistableSaves 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:
saveStatein 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:IPersistableRestore 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:
loadStatein 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
-