Package com.google.gwt.view.client
Class AbstractDataProvider<T>
java.lang.Object
com.google.gwt.view.client.AbstractDataProvider<T>
- Type Parameters:
T- the data type of records in the list
- All Implemented Interfaces:
ProvidesKey<T>
- Direct Known Subclasses:
AsyncDataProvider,ListDataProvider
A base implementation of a data source for
HasData implementations.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstruct an AbstractDataProvider without a key provider.protectedAbstractDataProvider(ProvidesKey<T> keyProvider) Construct an AbstractDataProvider with a given key provider. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataDisplay(HasData<T> display) Adds a data display to this adapter.Get the set of displays currently assigned to this adapter.Get the key for a list item.Get theProvidesKeythat provides keys for list items.Range[]Get the current ranges of all displays.protected abstract voidonRangeChanged(HasData<T> display) Called when a display changes its range of interest.voidremoveDataDisplay(HasData<T> display) Remove the given data display.protected voidupdateRowCount(int count, boolean exact) Inform the displays of the total number of items that are available.protected voidupdateRowData(int start, List<T> values) Inform the displays of the new data.protected voidupdateRowData(HasData<T> display, int start, List<T> values) Informs a single display of new data.
-
Constructor Details
-
AbstractDataProvider
protected AbstractDataProvider()Construct an AbstractDataProvider without a key provider. -
AbstractDataProvider
Construct an AbstractDataProvider with a given key provider.- Parameters:
keyProvider- aProvidesKeyobject
-
-
Method Details
-
addDataDisplay
Adds a data display to this adapter. The current range of interest of the display will be populated with data.- Parameters:
display- aHasData.
-
getDataDisplays
Get the set of displays currently assigned to this adapter.- Returns:
- the set of
HasData
-
getKey
Get the key for a list item. The default implementation returns the item itself.- Specified by:
getKeyin interfaceProvidesKey<T>- Parameters:
item- the list item- Returns:
- the key that represents the item
-
getKeyProvider
Get theProvidesKeythat provides keys for list items.- Returns:
- the
ProvidesKey
-
getRanges
Get the current ranges of all displays.- Returns:
- the ranges
-
removeDataDisplay
Remove the given data display.- Parameters:
display- aHasDatainstance- Throws:
IllegalStateException- if the display is not present
-
onRangeChanged
Called when a display changes its range of interest.- Parameters:
display- the display whose range has changed
-
updateRowCount
protected void updateRowCount(int count, boolean exact) Inform the displays of the total number of items that are available.- Parameters:
count- the new total row countexact- true if the count is exact, false if it is an estimate
-
updateRowData
Inform the displays of the new data.- Parameters:
start- the start indexvalues- the data values
-
updateRowData
Informs a single display of new data.- Parameters:
display- the display to be updatedstart- the start indexvalues- the data values
-