com.vaadin.data
Class RpcDataProviderExtension

java.lang.Object
  extended by com.vaadin.server.AbstractClientConnector
      extended by com.vaadin.server.AbstractExtension
          extended by com.vaadin.data.RpcDataProviderExtension
All Implemented Interfaces:
MethodEventSource, ClientConnector, Extension, com.vaadin.shared.Connector, java.io.Serializable

public class RpcDataProviderExtension
extends AbstractExtension

Provides Vaadin server-side container data source to a com.vaadin.client.ui.grid.GridConnector. This is currently implemented as an Extension hardcoded to support a specific connector type. This will be changed once framework support for something more flexible has been implemented.

Since:
Author:
Vaadin Ltd
See Also:
Serialized Form

Nested Class Summary
 class RpcDataProviderExtension.DataProviderKeyMapper
          ItemId to Key to ItemId mapper.
 
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
 
Constructor Summary
RpcDataProviderExtension(Container.Indexed container)
          Creates a new data provider using the given container.
 
Method Summary
static
<T> java.lang.Object
encodeValue(java.lang.Object modelValue, Renderer<T> renderer, Converter<?,?> converter, java.util.Locale locale)
          Converts and encodes the given data model property value using the given converter and renderer.
 void extend(Grid component)
          Makes the data source available to the given Grid component.
protected  Grid getGrid()
           
 RpcDataProviderExtension.DataProviderKeyMapper getKeyMapper()
           
protected  com.vaadin.shared.data.DataProviderState getState()
          Returns the shared state for this connector.
 void propertiesAdded(java.util.HashSet<java.lang.Object> addedPropertyIds)
          Informs this data provider that some of the properties have been added to the container.
 void propertiesRemoved(java.util.List<java.lang.Object> removedColumns)
          Informs this data provider that some of the properties have been removed from the container.
 void setParent(ClientConnector parent)
          Sets the parent connector of the connector.
 void updateRowData(int index)
          Informs the client side that data of a row has been modified in the data source.
 
Methods inherited from class com.vaadin.server.AbstractExtension
extend, getParent, getSupportedParentType, remove
 
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getState, getStateType, getUI, handleConnectorRequest, hasListeners, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vaadin.server.ClientConnector
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
 
Methods inherited from interface com.vaadin.shared.Connector
getConnectorId
 

Constructor Detail

RpcDataProviderExtension

public RpcDataProviderExtension(Container.Indexed container)
Creates a new data provider using the given container.

Parameters:
container - the container to make available
Method Detail

getState

protected com.vaadin.shared.data.DataProviderState getState()
Description copied from class: AbstractClientConnector
Returns the shared state for this connector. The shared state object is shared between the server connector and the client connector. Changes are only communicated from the server to the client and not in the other direction.

As a side effect, marks the connector dirty so any changes done to the state will be sent to the client. Use getState(false) to avoid marking the connector as dirty.

Overrides:
getState in class AbstractClientConnector
Returns:
The shared state for this connector. Never null.

extend

public void extend(Grid component)
Makes the data source available to the given Grid component.

Parameters:
component - the remote data grid component to extend

updateRowData

public void updateRowData(int index)
Informs the client side that data of a row has been modified in the data source.

Parameters:
index - the index of the row that was updated

setParent

public void setParent(ClientConnector parent)
Description copied from interface: Extension
Sets the parent connector of the connector. This method automatically calls ClientConnector.attach() if the connector becomes attached to the session.

This method is rarely called directly. AbstractClientConnector.addExtension(Extension) is normally used for adding extensions to a parent and it will call this method implicitly.

Specified by:
setParent in interface Extension
Overrides:
setParent in class AbstractExtension
Parameters:
parent - the parent connector

propertiesRemoved

public void propertiesRemoved(java.util.List<java.lang.Object> removedColumns)
Informs this data provider that some of the properties have been removed from the container.

Please note that we could add our own PropertySetChangeListener to the container, but then we'd need to implement the same bookeeping for finding what's added and removed that Grid already does in its own listener.

Parameters:
removedColumns - a list of property ids for the removed columns

propertiesAdded

public void propertiesAdded(java.util.HashSet<java.lang.Object> addedPropertyIds)
Informs this data provider that some of the properties have been added to the container.

Please note that we could add our own PropertySetChangeListener to the container, but then we'd need to implement the same bookeeping for finding what's added and removed that Grid already does in its own listener.

Parameters:
addedPropertyIds - a list of property ids for the added columns

getKeyMapper

public RpcDataProviderExtension.DataProviderKeyMapper getKeyMapper()

getGrid

protected Grid getGrid()

encodeValue

public static <T> java.lang.Object encodeValue(java.lang.Object modelValue,
                                               Renderer<T> renderer,
                                               Converter<?,?> converter,
                                               java.util.Locale locale)
Converts and encodes the given data model property value using the given converter and renderer. This method is public only for testing purposes.

Parameters:
renderer - the renderer to use
converter - the converter to use
modelValue - the value to convert and encode
locale - the locale to use in conversion
Returns:
an encoded value ready to be sent to the client


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