public class

ListDataProvider

extends AbstractDataProvider<T>
java.lang.Object
   ↳ com.google.gwt.view.client.AbstractDataProvider<T>
     ↳ com.google.gwt.view.client.ListDataProvider<T>

Class Overview

A concrete subclass of AbstractDataProvider that is backed by an in-memory list.

Example

{@example com.google.gwt.examples.view.ListDataProviderExample}

Summary

Public Constructors
ListDataProvider()
Creates an empty model.
ListDataProvider(List<T> listToWrap)
Creates a list model that wraps the given list.
ListDataProvider(ProvidesKey<T> keyProvider)
Creates an empty list model that wraps the given collection.
ListDataProvider(List<T> listToWrap, ProvidesKey<T> keyProvider)
Creates a list model that wraps the given list.
Public Methods
void flush()
Flush pending list changes to the displays.
List<T> getList()
Get the list that backs this model.
void refresh()
Refresh all of the displays listening to this adapter.
void setList(List<T> listToWrap)
Replace this model's list.
Protected Methods
void onRangeChanged(HasData<T> display)
Called when a display changes its range of interest.
[Expand]
Inherited Methods
From class com.google.gwt.view.client.AbstractDataProvider
From class java.lang.Object
From interface com.google.gwt.view.client.ProvidesKey

Public Constructors

public ListDataProvider ()

Creates an empty model.

public ListDataProvider (List<T> listToWrap)

Creates a list model that wraps the given list. Changes to the wrapped list must be made via this model in order to be correctly applied to displays.

Parameters
listToWrap the List to be wrapped

public ListDataProvider (ProvidesKey<T> keyProvider)

Creates an empty list model that wraps the given collection.

Parameters
keyProvider an instance of ProvidesKey, or null if the record object should act as its own key

public ListDataProvider (List<T> listToWrap, ProvidesKey<T> keyProvider)

Creates a list model that wraps the given list. Changes to the wrapped list must be made via this model in order to be correctly applied to displays.

Parameters
listToWrap the List to be wrapped
keyProvider an instance of ProvidesKey, or null if the record object should act as its own key

Public Methods

public void flush ()

Flush pending list changes to the displays. By default, displays are informed of modifications to the underlying list at the end of the current event loop, which makes it possible to perform multiple operations synchronously without repeatedly refreshing the displays. This method can be called to flush the changes immediately instead of waiting until the end of the current event loop.

public List<T> getList ()

Get the list that backs this model. Changes to the list will be reflected in the model.

Returns
  • the list
See Also

public void refresh ()

Refresh all of the displays listening to this adapter.

public void setList (List<T> listToWrap)

Replace this model's list.

Parameters
listToWrap the model's new list
See Also

Protected Methods

protected void onRangeChanged (HasData<T> display)

Called when a display changes its range of interest.

Parameters
display the display whose range has changed