com.vaadin.client.data
Class RpcDataSourceConnector.RpcDataSource

java.lang.Object
  extended by com.vaadin.client.data.AbstractRemoteDataSource<JSONObject>
      extended by com.vaadin.client.data.RpcDataSourceConnector.RpcDataSource
All Implemented Interfaces:
DataSource<JSONObject>
Enclosing class:
RpcDataSourceConnector

public class RpcDataSourceConnector.RpcDataSource
extends AbstractRemoteDataSource<JSONObject>


Nested Class Summary
 
Nested classes/interfaces inherited from class com.vaadin.client.data.AbstractRemoteDataSource
AbstractRemoteDataSource.RowHandleImpl
 
Nested classes/interfaces inherited from interface com.vaadin.client.data.DataSource
DataSource.RowHandle<T>
 
Field Summary
 
Fields inherited from class com.vaadin.client.data.AbstractRemoteDataSource
temporarilyPinnedRows
 
Constructor Summary
RpcDataSourceConnector.RpcDataSource()
           
 
Method Summary
 DataSource.RowHandle<JSONObject> getHandleByKey(java.lang.Object key)
           
 java.lang.Object getRowKey(JSONObject row)
          Gets a stable key for the row object.
protected  void requestRows(int firstRowIndex, int numberOfRows)
          Triggers fetching rows from the remote data source.
 int size()
          Returns the number of rows in the data source.
 void transactionPin(java.util.Collection<JSONObject> keys)
          Marks rows as pinned when fetching new rows.
 
Methods inherited from class com.vaadin.client.data.AbstractRemoteDataSource
ensureAvailability, getCachedRange, getHandle, getRow, indexOf, insertRowData, removeRowData, resetDataAndSize, setCacheStrategy, setDataChangeHandler, setRowData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RpcDataSourceConnector.RpcDataSource

public RpcDataSourceConnector.RpcDataSource()
Method Detail

requestRows

protected void requestRows(int firstRowIndex,
                           int numberOfRows)
Description copied from class: AbstractRemoteDataSource
Triggers fetching rows from the remote data source. AbstractRemoteDataSource.setRowData(int, List) should be invoked with data for the requested rows when they have been received.

Specified by:
requestRows in class AbstractRemoteDataSource<JSONObject>
Parameters:
firstRowIndex - the index of the first row to fetch
numberOfRows - the number of rows to fetch

getRowKey

public java.lang.Object getRowKey(JSONObject row)
Description copied from class: AbstractRemoteDataSource
Gets 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() 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.

Specified by:
getRowKey in class AbstractRemoteDataSource<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

getHandleByKey

public DataSource.RowHandle<JSONObject> getHandleByKey(java.lang.Object key)

transactionPin

public void transactionPin(java.util.Collection<JSONObject> keys)
Description copied from class: AbstractRemoteDataSource
Marks rows as pinned when fetching new rows.

This collection of rows are intended to remain pinned if new rows are fetched from the data source, even if some of the pinned rows would fall off the cache and become inactive.

This method does nothing by itself, other than it stores the rows into a field. The implementation needs to make all the adjustments for itself. Check requestRows(int, int) for an implementation example.

Overrides:
transactionPin in class AbstractRemoteDataSource<JSONObject>
See Also:
AbstractRemoteDataSource.temporarilyPinnedRows, requestRows(int, int)

size

public int size()
Description copied from interface: DataSource
Returns the number of rows in the data source.

Returns:
the current size of the data source


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.