Class ListDataProvider<T extends Serializable>

Type Parameters:
T -
All Implemented Interfaces:
Serializable, IDataProvider<T>, IDetachable, IClusterable

public class ListDataProvider<T extends Serializable> extends Object implements IDataProvider<T>
Allows the use of lists with DataView. The only requirement is that either list items must be serializable or model(Object) needs to be overridden to provide the proper model implementation.
Igor Vaynberg ( ivaynberg )
See Also:
  • Constructor Details

    • ListDataProvider

      Constructs an empty provider. Useful for lazy loading together with getData()
    • ListDataProvider

      public ListDataProvider(List<T> list)
      list - the list used as dataprovider for the dataview
  • Method Details

    • getData

      protected List<T> getData()
      Subclass to lazy load the list
      The list
    • iterator

      public Iterator<T> iterator(long first, long count)
      Description copied from interface: IDataProvider
      Gets an iterator for the subset of total data
      Specified by:
      iterator in interface IDataProvider<T extends Serializable>
      first - first row of data
      count - minimum number of elements to retrieve
      iterator capable of iterating over {first, first+count} items
    • size

      public long size()
      Description copied from interface: IDataProvider
      Gets total number of items in the collection represented by the DataProvider
      Specified by:
      size in interface IDataProvider<T extends Serializable>
      total item count
    • model

      public IModel<T> model(T object)
      Description copied from interface: IDataProvider
      Callback used by the consumer of this data provider to wrap objects retrieved from IDataProvider.iterator(long, long) with a model (usually a detachable one).
      Specified by:
      model in interface IDataProvider<T extends Serializable>
      object - the object that needs to be wrapped
      the model representation of the object