T
- public interface IDataProvider<T> extends IDetachable
class UsersProvider implements IDataProvider { public Iterator iterator(long first, long count) { ((MyApplication)Application.get()).getUserDao().iterator(first, count); } public long size() { ((MyApplication)Application.get()).getUserDao().getCount(); } public IModel model(Object object) { return new DetachableUserModel((User)object); } }You can use the
IDetachable.detach()
method for cleaning up your IDataProvider instance.
So that you can do one query that returns both the size and the values if your dataset is small
enough the be able to do that.IDetachable
,
DataViewBase
,
DataView
,
GridView
Modifier and Type | Method and Description |
---|---|
Iterator<? extends T> |
iterator(long first,
long count)
Gets an iterator for the subset of total data
|
IModel<T> |
model(T object)
Callback used by the consumer of this data provider to wrap objects retrieved from
iterator(long, long) with a model (usually a detachable one). |
long |
size()
Gets total number of items in the collection represented by the DataProvider
|
detach
Iterator<? extends T> iterator(long first, long count)
first
- first row of datacount
- minimum number of elements to retrievelong size()
IModel<T> model(T object)
iterator(long, long)
with a model (usually a detachable one).object
- the object that needs to be wrappedCopyright © 2006–2016 Apache Software Foundation. All rights reserved.