org.apache.wicket.examples.repeater
Class ContactDataProvider

java.lang.Object
  extended by org.apache.wicket.examples.repeater.ContactDataProvider
All Implemented Interfaces:
java.io.Serializable, IClusterable, IDataProvider<Contact>, IDetachable

public class ContactDataProvider
extends java.lang.Object
implements IDataProvider<Contact>

Implementation of IDataProvider that retrieves contacts from the contact database.

Author:
igor
See Also:
Serialized Form

Constructor Summary
ContactDataProvider()
           
 
Method Summary
 void detach()
          Detaches model after use.
protected  ContactsDatabase getContactsDB()
           
 java.util.Iterator<Contact> iterator(int first, int count)
          retrieves contacts from database starting with index first and ending with first+count
 IModel<Contact> model(Contact object)
          wraps retrieved contact pojo with a wicket model
 int size()
          returns total number of contacts in the database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContactDataProvider

public ContactDataProvider()
Method Detail

getContactsDB

protected ContactsDatabase getContactsDB()

iterator

public java.util.Iterator<Contact> iterator(int first,
                                            int count)
retrieves contacts from database starting with index first and ending with first+count

Specified by:
iterator in interface IDataProvider<Contact>
Parameters:
first - first row of data
count - minimum number of elements to retrieve
Returns:
iterator capable of iterating over {first, first+count} items
See Also:
IDataProvider.iterator(int, int)

size

public int size()
returns total number of contacts in the database

Specified by:
size in interface IDataProvider<Contact>
Returns:
total item count
See Also:
IDataProvider.size()

model

public IModel<Contact> model(Contact object)
wraps retrieved contact pojo with a wicket model

Specified by:
model in interface IDataProvider<Contact>
Parameters:
object - the object that needs to be wrapped
Returns:
the model representation of the object
See Also:
IDataProvider.model(java.lang.Object)

detach

public void detach()
Description copied from interface: IDetachable
Detaches model after use. This is generally used to null out transient references that can be re-attached later.

Specified by:
detach in interface IDetachable
See Also:
IDetachable.detach()


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.