T
- public class RowGroupModel<T> extends Object implements IRowGroupModel<T>
IRowGroupModel
which is optimised for
larger data-sets (it should cope with at least 10k rows spread across 2-300
groups).DOT, VALUE_SEPARATOR
Constructor and Description |
---|
RowGroupModel() |
Modifier and Type | Method and Description |
---|---|
boolean |
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.
|
IRowDataProvider<T> |
getDataProvider() |
int |
getIndexFromRowCache(T row)
Retrieves a row's index by from our cache.
|
T |
getRowFromIndexCache(int rowIndex)
Retrieves a row T by it's index from our cache.
|
IRowGroup<T> |
getRowGroupForName(String groupName)
Returns an the
IRowGroup with the specified group name. |
IRowGroup<T> |
getRowGroupForRow(T row)
Returns the first
IRowGroup found containing the specified row. |
List<IRowGroup<T>> |
getRowGroups() |
void |
invalidateIndexCache() |
boolean |
isEmpty() |
boolean |
isSuppressNoficiations() |
void |
loadState(String prefix,
Properties properties)
Restore the state out of the given Properties identified by the specified prefix.
|
void |
notifyListeners()
Notify any
IRowGroupModelListener s that something in the model
has changed. |
void |
registerRowGroupModelListener(IRowGroupModelListener listener)
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.
|
String |
toString() |
void |
unregisterRowGroupModelListener(IRowGroupModelListener listener)
Unregisters the listener from the model.
|
public T getRowFromIndexCache(int rowIndex)
IRowGroupModel
getRowFromIndexCache
in interface IRowGroupModel<T>
public int getIndexFromRowCache(T row)
IRowGroupModel
getIndexFromRowCache
in interface IRowGroupModel<T>
public void invalidateIndexCache()
invalidateIndexCache
in interface IRowGroupModel<T>
public void setDataProvider(IRowDataProvider<T> dataProvider)
IRowGroupModel
setDataProvider
in interface IRowGroupModel<T>
public IRowDataProvider<T> getDataProvider()
getDataProvider
in interface IRowGroupModel<T>
IRowDataProvider
used for the index-to-row cache.public void notifyListeners()
Notify any IRowGroupModelListener
s that something in the model
has changed.
notifyListeners
in interface IRowGroupModel<T>
public void setSuppressNoficiations(boolean suppressNoficiations)
suppressNoficiations
- public boolean isSuppressNoficiations()
public void addRowGroups(List<IRowGroup<T>> rowGroups)
IRowGroupModel
Adds multiple row groups into the model and only fires off a single change notification.
addRowGroups
in interface IRowGroupModel<T>
rowGroups
- A list of IRowGroup
s to add.public boolean addRowGroup(IRowGroup<T> rowGroup)
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.
addRowGroup
in interface IRowGroupModel<T>
rowGroup
- The IRowGroup
to be added.public boolean removeRowGroup(IRowGroup<T> rowGroup)
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.
removeRowGroup
in interface IRowGroupModel<T>
rowGroup
- The IRowGroup
to remove.public List<IRowGroup<T>> getRowGroups()
getRowGroups
in interface IRowGroupModel<T>
List
of IRowGroup
in the model.public IRowGroup<T> getRowGroupForName(String groupName)
IRowGroupModel
IRowGroup
with the specified group name.getRowGroupForName
in interface IRowGroupModel<T>
groupName
- The unique name assigned to an IRowGroup
.IRowGroup
or null if there is no group with the
specified name.public IRowGroup<T> getRowGroupForRow(T row)
IRowGroupModel
IRowGroup
found containing the specified row.getRowGroupForRow
in interface IRowGroupModel<T>
row
- The row object.IRowGroup
or null if there is no group with the
specified row.public boolean isEmpty()
isEmpty
in interface IRowGroupModel<T>
IRowGroup
s in the model. Note: if
there are groups but there are no rows, then true is still
returned.public void clear()
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.
clear
in interface IRowGroupModel<T>
public void registerRowGroupModelListener(IRowGroupModelListener listener)
IRowGroupModel
registerRowGroupModelListener
in interface IRowGroupModel<T>
listener
- an IRowGroupModelListener
.public void unregisterRowGroupModelListener(IRowGroupModelListener listener)
IRowGroupModel
unregisterRowGroupModelListener
in interface IRowGroupModel<T>
listener
- an IRowGroupModelListener
.public void saveState(String prefix, Properties properties)
IPersistable
saveState
in interface IPersistable
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.public void loadState(String prefix, Properties properties)
IPersistable
loadState
in interface IPersistable
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.Copyright © 2013. All Rights Reserved.