T
- type of the Objects in the backing list.public abstract class AbstractFilterListDataProvider<T> extends ListDataProvider<T>
List
containing POJO(s) as a backing data source.
By default a bean at position 'X' in the list is displayed in
row 'X' in the table. The properties of the bean are used to
populate the columns. A IColumnPropertyResolver
is used to
retrieve column data from the bean properties.
By implementing filter logic within show(Object)
it is possible to create a static filter. All data access methods will skip invisible
items within the wrapped list and delegate access to the visible items.
NOTE: This way of static filtering can cause performance issues for huge data sets
where a lot of items are filtered, because data access will always calculate the visible row
position. Trying to use a caching mechanism would create some issues for deleting or inserting
new data to the wrapped list.
TODO add caching that reacts on insert/delete actions on the wrapped listIColumnPropertyResolver
columnAccessor, list
Constructor and Description |
---|
AbstractFilterListDataProvider(List<T> list,
IColumnAccessor<T> columnAccessor) |
Modifier and Type | Method and Description |
---|---|
Object |
getDataValue(int columnIndex,
int rowIndex)
Get the data value for the columnIndex and the visible rowIndex.
|
int |
getRowCount()
Iterates over the whole list of data objects and checks the visibility for
every object.
|
T |
getRowObject(int rowIndex)
Returns the object for the visible rowIndex.
|
int |
indexOfRowObject(T rowObject)
Returns the visible rowIndex for the given object.
|
void |
setDataValue(int columnIndex,
int rowIndex,
Object newValue)
Set the data value for the columnIndex and the visible rowIndex.
|
protected abstract boolean |
show(T object)
Within this method the filter logic should be applied.
|
getColumnCount, getList
public AbstractFilterListDataProvider(List<T> list, IColumnAccessor<T> columnAccessor)
public int getRowCount()
getRowCount
in interface IDataProvider
getRowCount
in class ListDataProvider<T>
public Object getDataValue(int columnIndex, int rowIndex)
getDataValue
in interface IDataProvider
getDataValue
in class ListDataProvider<T>
public void setDataValue(int columnIndex, int rowIndex, Object newValue)
setDataValue
in interface IDataProvider
setDataValue
in class ListDataProvider<T>
public T getRowObject(int rowIndex)
getRowObject
in interface IRowDataProvider<T>
getRowObject
in class ListDataProvider<T>
public int indexOfRowObject(T rowObject)
indexOfRowObject
in interface IRowDataProvider<T>
indexOfRowObject
in class ListDataProvider<T>
protected abstract boolean show(T object)
object
- The object that should be checked.Copyright © 2013. All Rights Reserved.