wicket.contrib.phonebook.web
Class ContactsDataProvider

java.lang.Object
  extended by org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider<Contact>
      extended by wicket.contrib.phonebook.web.ContactsDataProvider
All Implemented Interfaces:
Serializable, org.apache.wicket.extensions.markup.html.repeater.data.sort.ISortStateLocator, org.apache.wicket.extensions.markup.html.repeater.data.table.filter.IFilterStateLocator, org.apache.wicket.extensions.markup.html.repeater.data.table.ISortableDataProvider<Contact>, org.apache.wicket.IClusterable, org.apache.wicket.markup.repeater.data.IDataProvider<Contact>, org.apache.wicket.model.IDetachable

public class ContactsDataProvider
extends org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider<Contact>
implements org.apache.wicket.extensions.markup.html.repeater.data.table.filter.IFilterStateLocator

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
ContactsDataProvider(ContactDao dao)
           
 
Method Summary
 Object getFilterState()
           
 Iterator<Contact> iterator(int first, int count)
          Gets an iterator for the subset of contacts.
 org.apache.wicket.model.IModel<Contact> model(Contact object)
          Converts the object in the collection to its model representation.
 void setFilterState(Object state)
           
 void setQueryParam(QueryParam queryParam)
           
 int size()
          Gets total number of items in the collection.
 
Methods inherited from class org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider
detach, getSort, getSortState, setSort, setSort, setSortState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContactsDataProvider

public ContactsDataProvider(ContactDao dao)
Method Detail

setQueryParam

public void setQueryParam(QueryParam queryParam)

getFilterState

public Object getFilterState()
Specified by:
getFilterState in interface org.apache.wicket.extensions.markup.html.repeater.data.table.filter.IFilterStateLocator

setFilterState

public void setFilterState(Object state)
Specified by:
setFilterState in interface org.apache.wicket.extensions.markup.html.repeater.data.table.filter.IFilterStateLocator

iterator

public Iterator<Contact> iterator(int first,
                                  int count)
Gets an iterator for the subset of contacts.

Specified by:
iterator in interface org.apache.wicket.markup.repeater.data.IDataProvider<Contact>
Parameters:
first - offset for the first row of data to retrieve
count - number of rows to retrieve
Returns:
iterator capable of iterating over {first, first+count} contacts

size

public int size()
Gets total number of items in the collection.

Specified by:
size in interface org.apache.wicket.markup.repeater.data.IDataProvider<Contact>
Returns:
total item count

model

public org.apache.wicket.model.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:
model in interface org.apache.wicket.markup.repeater.data.IDataProvider<Contact>
Parameters:
object - The object that needs to be wrapped
Returns:
The model representation of the object


Copyright © 2005-2012 Wicket developers. All Rights Reserved.