Class DataCommunicatorConnector.VaadinDataSource
- java.lang.Object
-
- com.vaadin.client.data.AbstractRemoteDataSource<elemental.json.JsonObject>
-
- com.vaadin.client.connectors.data.DataCommunicatorConnector.VaadinDataSource
-
- All Implemented Interfaces:
DataSource<elemental.json.JsonObject>
- Enclosing class:
- DataCommunicatorConnector
public class DataCommunicatorConnector.VaadinDataSource extends AbstractRemoteDataSource<elemental.json.JsonObject>
Client-sideDataSourceimplementation to be used withDataCommunicator.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.vaadin.client.data.AbstractRemoteDataSource
AbstractRemoteDataSource.RequestRowsCallback<T>, AbstractRemoteDataSource.RowHandleImpl
-
Nested classes/interfaces inherited from interface com.vaadin.client.data.DataSource
DataSource.RowHandle<T>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedVaadinDataSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddropFromCache(Range range)Drop the given range of rows from this data source's cache.StringgetRowKey(elemental.json.JsonObject row)Gets a stable key for the row object.protected voidonDropFromCache(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 voidrequestRows(int firstRowIndex, int numberOfRows, AbstractRemoteDataSource.RequestRowsCallback<elemental.json.JsonObject> callback)Triggers fetching rows from the remote data source.protected voidupdateRowData(elemental.json.JsonObject rowData)Updates row data based on row key.-
Methods inherited from class com.vaadin.client.data.AbstractRemoteDataSource
addDataChangeHandler, canFetchData, ensureAvailability, getCachedRange, getHandle, getRequestedAvailability, getRow, indexOf, indexOfKey, insertRowData, isPinned, isWaitingForData, onDropFromCache, pinHandle, removeRowData, resetDataAndSize, setCacheStrategy, setExpandCollapsePending, setRowData, setTrackInvalidatedRows, size, unpinHandle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.client.data.DataSource
addDataChangeHandler
-
-
-
-
Method Detail
-
requestRows
protected void requestRows(int firstRowIndex, int numberOfRows, AbstractRemoteDataSource.RequestRowsCallback<elemental.json.JsonObject> callback)Description copied from class:AbstractRemoteDataSourceTriggers fetching rows from the remote data source. The provided callback should be informed when the requested rows have been received.- Specified by:
requestRowsin classAbstractRemoteDataSource<elemental.json.JsonObject>- Parameters:
firstRowIndex- the index of the first row to fetchnumberOfRows- the number of rows to fetchcallback- callback to inform when the requested rows are available
-
getRowKey
public String getRowKey(elemental.json.JsonObject row)
Description copied from class:AbstractRemoteDataSourceGets a stable key for the row object.This method is a workaround for the fact that there is no means to force proper implementations for
Object.hashCode()andObject.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.
- Specified by:
getRowKeyin classAbstractRemoteDataSource<elemental.json.JsonObject>- Parameters:
row- the row object for which to get the key- Returns:
- a non-null object that uniquely and consistently represents the row object
-
dropFromCache
protected void dropFromCache(Range range)
Description copied from class:AbstractRemoteDataSourceDrop the given range of rows from this data source's cache.- Overrides:
dropFromCachein classAbstractRemoteDataSource<elemental.json.JsonObject>- Parameters:
range- the range of rows to drop
-
onDropFromCache
protected void onDropFromCache(int rowIndex, elemental.json.JsonObject removed)Description copied from class:AbstractRemoteDataSourceA hook that can be overridden to do something whenever a row has been dropped from the cache. DataSource no longer has anything in the given index.- Overrides:
onDropFromCachein classAbstractRemoteDataSource<elemental.json.JsonObject>- Parameters:
rowIndex- the index of the dropped rowremoved- the removed row object
-
updateRowData
protected void updateRowData(elemental.json.JsonObject rowData)
Updates row data based on row key.- Parameters:
rowData- new row object
-
-