wicket.extensions.markup.html.repeater.data
Interface IDataProvider

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
EmptyDataProvider, ListDataProvider, SortableDataProvider

public interface IDataProvider
extends java.io.Serializable

Interface used to provide data to data views.

Note that if the IDataProvider implementation implements IDetachable interface, the IDetachable.detach() method will be called at the end of request.

Example:

         class UsersProvider implements IDataProvider() {
           
           Iterator iterator(int first, int count) {
             ((MyApplication)Application.get()).getUserDao().iterator(first, count);
           }
           
           int size() {
             ((MyApplication)Application.get()).getUserDao().getCount();
           }
           
           IModel model(Object object) {
             return new DetachableUserModel((User)object);
           }
         }
 

Author:
Igor Vaynberg (ivaynberg) TODO 2.0: directly extend IDetachable
See Also:
DataViewBase, DataView, GridView

Method Summary
 java.util.Iterator iterator(int first, int count)
          Gets an iterator for the subset of total data
 wicket.model.IModel model(java.lang.Object object)
          Callback used by the consumer of this data provider to wrap objects retrieved from iterator(int, int) with a model (usually a detachable one).
 int size()
          Gets total number of items in the collection represented by the DataProvider
 

Method Detail

iterator

public java.util.Iterator iterator(int first,
                                   int count)
Gets an iterator for the subset of total data

Parameters:
first - first row of data
count - minumum number of elements to retrieve
Returns:
iterator capable of iterating over {first, first+count} items

size

public int size()
Gets total number of items in the collection represented by the DataProvider

Returns:
total item count

model

public wicket.model.IModel model(java.lang.Object object)
Callback used by the consumer of this data provider to wrap objects retrieved from iterator(int, int) with a model (usually a detachable one).

Parameters:
object - the object that needs to be wrapped
Returns:
the model representation of the object


Copyright © 2004-2008 Wicket developers. All Rights Reserved.