Package wicket.contrib.phonebook.web
Class ContactsDataProvider
- java.lang.Object
-
- org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider<Contact,String>
-
- wicket.contrib.phonebook.web.ContactsDataProvider
-
- All Implemented Interfaces:
Serializable,ISortStateLocator<String>,IFilterStateLocator<Contact>,ISortableDataProvider<Contact,String>,IDataProvider<Contact>,IDetachable,IClusterable
public class ContactsDataProvider extends SortableDataProvider<Contact,String> implements IFilterStateLocator<Contact>
note: it is important that the dao passed to the data provider be a proxy from wicket-contrib-spring when used in non-testing environment. this is because the dataprovider might get serialized for versioning or for replication among the cluster and that would mean that the dao will also be serialized. this is usually undesirable because the dao might have references to other objects and thus might cause a lot more to be serialized then is needed. wicket-contrib-spring provides proxies to fix just this, the proxy only serializes information it needs to locate the dao when it is deserialized instead of serializing the dao itself.- Author:
- igor
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ContactsDataProvider(ContactDao dao)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContactgetFilterState()Iterator<Contact>iterator(long first, long count)Gets an iterator for the subset of contacts.IModel<Contact>model(Contact object)Converts the object in the collection to its model representation.voidsetFilterState(Contact state)voidsetQueryParam(QueryParam queryParam)longsize()Gets total number of items in the collection.-
Methods inherited from class org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider
getSort, getSortState, setSort, setSort
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.wicket.markup.repeater.data.IDataProvider
detach
-
-
-
-
Constructor Detail
-
ContactsDataProvider
public ContactsDataProvider(ContactDao dao)
-
-
Method Detail
-
setQueryParam
public void setQueryParam(QueryParam queryParam)
-
getFilterState
public Contact getFilterState()
- Specified by:
getFilterStatein interfaceIFilterStateLocator<Contact>
-
setFilterState
public void setFilterState(Contact state)
- Specified by:
setFilterStatein interfaceIFilterStateLocator<Contact>
-
iterator
public Iterator<Contact> iterator(long first, long count)
Gets an iterator for the subset of contacts.- Specified by:
iteratorin interfaceIDataProvider<Contact>- Parameters:
first- offset for the first row of data to retrievecount- number of rows to retrieve- Returns:
- iterator capable of iterating over {first, first+count} contacts
-
size
public long size()
Gets total number of items in the collection.- Specified by:
sizein interfaceIDataProvider<Contact>- Returns:
- total item count
-
model
public IModel<Contact> model(Contact object)
Converts the object in the collection to its model representation. A good place to wrap the object in a detachable model.- Specified by:
modelin interfaceIDataProvider<Contact>- Parameters:
object- The object that needs to be wrapped- Returns:
- The model representation of the object
-
-