com.vaadin.client.ui.grid.renderers
Class AbstractRendererConnector<T>

java.lang.Object
  extended by com.vaadin.client.ui.AbstractConnector
      extended by com.vaadin.client.extensions.AbstractExtensionConnector
          extended by com.vaadin.client.ui.grid.renderers.AbstractRendererConnector<T>
All Implemented Interfaces:
com.google.gwt.event.shared.EventHandler, StateChangeEvent.StateChangeHandler, ServerConnector, com.vaadin.shared.Connector, java.io.Serializable
Direct Known Subclasses:
ButtonRendererConnector, ImageRendererConnector, ProgressBarRendererConnector, TextRendererConnector, UnsafeHtmlRendererConnector

public abstract class AbstractRendererConnector<T>
extends AbstractExtensionConnector

An abstract base class for renderer connectors. A renderer connector is used to link a client-side Renderer to a server-side Renderer. As a connector, it can use the regular Vaadin RPC and shared state mechanism to pass additional state and information between the client and the server. This base class itself only uses the basic SharedState and no RPC interfaces.

Since:
Author:
Vaadin Ltd
See Also:
Serialized Form

Constructor Summary
protected AbstractRendererConnector()
           
 
Method Summary
protected  Renderer<T> createRenderer()
          Creates a new Renderer instance associated with this renderer connector.
 T decode(JSONValue value)
          Decodes the given JSON value into a value of type T so it can be passed to the renderer.
protected  void extend(ServerConnector target)
          Deprecated. 
 Renderer<T> getRenderer()
          Returns the renderer associated with this renderer connector.
protected  java.lang.String getRowKey(int index)
          Gets the row key for a row index.
 
Methods inherited from class com.vaadin.client.extensions.AbstractExtensionConnector
setParent
 
Methods inherited from class com.vaadin.client.ui.AbstractConnector
addStateChangeHandler, addStateChangeHandler, createState, doInit, ensureHandlerManager, fireEvent, forceStateChange, getChildren, getConnection, getConnectorId, getParent, getResourceUrl, getRpcImplementations, getRpcProxy, getState, getStateType, hasEventListener, init, isEnabled, onStateChanged, onUnregister, registerRpc, removeStateChangeHandler, removeStateChangeHandler, setChildren, unregisterRpc, updateEnabledState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRendererConnector

protected AbstractRendererConnector()
Method Detail

getRenderer

public Renderer<T> getRenderer()
Returns the renderer associated with this renderer connector.

A subclass of AbstractRendererConnector should override this method as shown below. The framework uses GWT.create(Class) to create a renderer based on the return type of the overridden method, but only if createRenderer() is not overridden as well:

 public MyRenderer getRenderer() {
     return (MyRenderer) super.getRenderer();
 }
 

Returns:
the renderer bound to this connector

createRenderer

protected Renderer<T> createRenderer()
Creates a new Renderer instance associated with this renderer connector.

You should typically not override this method since the framework by default generates an implementation that uses GWT#create(Class) to create a renderer of the same type as returned by the most specific override of getRenderer(). If you do override the method, you can't call super.createRenderer() since the metadata needed for that implementation is not generated if there's an override of the method.

Returns:
a new renderer to be used with this connector

decode

public T decode(JSONValue value)
Decodes the given JSON value into a value of type T so it can be passed to the renderer.

Parameters:
value - the value to decode
Returns:
the decoded value of value

extend

@Deprecated
protected void extend(ServerConnector target)
Deprecated. 

Description copied from class: AbstractExtensionConnector
Called when the extension is attached to its parent. This method is only called once as an extension cannot be moved from one parent to another.

Specified by:
extend in class AbstractExtensionConnector
Parameters:
target - The connector this extension extends

getRowKey

protected java.lang.String getRowKey(int index)
Gets the row key for a row index.

In case this renderer wants be able to identify a row in such a way that the server also understands it, the row key is used for that. Rows are identified by unified keys between the client and the server.

Parameters:
index - the row index for which to get the row key
Returns:
the row key for the row at index


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