T - the row typepublic interface DataSource<T>
| Modifier and Type | Interface and Description |
|---|---|
static class |
DataSource.RowHandle<T>
|
| Modifier and Type | Method and Description |
|---|---|
default Registration |
addDataChangeHandler(Consumer<Range> refreshMethod)
Sets a simple data change handler for a widget without lazy loading.
|
Registration |
addDataChangeHandler(DataChangeHandler dataChangeHandler)
Sets a data change handler to inform when data is updated, added or
removed.
|
void |
ensureAvailability(int firstRowIndex,
int numberOfRows)
Informs the data source that data for the given range is needed.
|
DataSource.RowHandle<T> |
getHandle(T row)
Gets a
DataSource.RowHandle of a row object in the cache. |
T |
getRow(int rowIndex)
Retrieves the data for the row at the given index.
|
boolean |
isWaitingForData()
Checks whether this data source is currently waiting for more rows to
become available.
|
int |
size()
Returns the number of rows in the data source.
|
void ensureAvailability(int firstRowIndex,
int numberOfRows)
This method triggers lazy loading of data if necessary. The change
handler registered using addDataChangeHandler(DataChangeHandler)
is informed when new data has been loaded.
After any possible lazy loading and updates are done, the change handler is informed that new data is available.
firstRowIndex - the index of the first needed rownumberOfRows - the number of needed rowsT getRow(int rowIndex)
null.
This method does not trigger loading of unavailable data.
ensureAvailability(int, int) should be used to signal what data
will be needed.
rowIndex - the index of the row to retrieve data fornull if no data is availableint size()
Registration addDataChangeHandler(DataChangeHandler dataChangeHandler)
dataChangeHandler - the data change handlerdefault Registration addDataChangeHandler(Consumer<Range> refreshMethod)
refreshMethod - a method to refresh all data in the widgetDataSource.RowHandle<T> getHandle(T row)
DataSource.RowHandle of a row object in the cache.row - the row object for which to retrieve a row handlenull row handle of the given row objectboolean isWaitingForData()
true if waiting for data; otherwise
falseCopyright © 2018 Vaadin Ltd. All rights reserved.