public class DataCommunicatorConnector.VaadinDataSource extends AbstractRemoteDataSource<elemental.json.JsonObject>
DataSource implementation to be used with
DataCommunicator.AbstractRemoteDataSource.RequestRowsCallback<T>, AbstractRemoteDataSource.RowHandleImplDataSource.RowHandle<T>| Modifier | Constructor and Description |
|---|---|
protected |
VaadinDataSource() |
| Modifier and Type | Method and Description |
|---|---|
String |
getRowKey(elemental.json.JsonObject row)
Gets a stable key for the row object.
|
protected void |
onDropFromCache(int rowIndex,
elemental.json.JsonObject removed)
A hook that can be overridden to do something whenever a row has been
dropped from the cache.
|
protected void |
requestRows(int firstRowIndex,
int numberOfRows,
AbstractRemoteDataSource.RequestRowsCallback<elemental.json.JsonObject> callback)
Triggers fetching rows from the remote data source.
|
protected void |
updateRowData(elemental.json.JsonObject row)
Updates row data based on row key.
|
addDataChangeHandler, canFetchData, ensureAvailability, getCachedRange, getHandle, getRequestedAvailability, getRow, indexOf, indexOfKey, insertRowData, isPinned, isWaitingForData, onDropFromCache, pinHandle, removeRowData, resetDataAndSize, setCacheStrategy, setRowData, size, unpinHandleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddDataChangeHandlerprotected void requestRows(int firstRowIndex,
int numberOfRows,
AbstractRemoteDataSource.RequestRowsCallback<elemental.json.JsonObject> callback)
AbstractRemoteDataSourcerequestRows in class AbstractRemoteDataSource<elemental.json.JsonObject>firstRowIndex - the index of the first row to fetchnumberOfRows - the number of rows to fetchcallback - callback to inform when the requested rows are availablepublic String getRowKey(elemental.json.JsonObject row)
AbstractRemoteDataSource
This method is a workaround for the fact that there is no means to force
proper implementations for Object.hashCode() and
Object.equals(Object) methods.
Since the same row object will be created several times for the same logical data, the DataSource needs a mechanism to be able to compare two objects, and figure out whether or not they represent the same data. Even if all the fields of an entity would be changed, it still could represent the very same thing (say, a person changes all of her names.)
A very usual and simple example what this could be, is an unique ID for this object that would also be stored in a database.
getRowKey in class AbstractRemoteDataSource<elemental.json.JsonObject>row - the row object for which to get the keyprotected void onDropFromCache(int rowIndex,
elemental.json.JsonObject removed)
AbstractRemoteDataSourceonDropFromCache in class AbstractRemoteDataSource<elemental.json.JsonObject>rowIndex - the index of the dropped rowremoved - the removed row objectprotected void updateRowData(elemental.json.JsonObject row)
row - new row objectCopyright © 2017 Vaadin Ltd. All rights reserved.