com.vaadin.ui.renderers.
Class AbstractRenderer<T,V>
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.server.AbstractExtension
-
- com.vaadin.ui.renderers.AbstractRenderer<T,V>
-
Type Parameters:
T
- the grid type this renderer can be attached toV
- the type this renderer knows how to presentAll Implemented Interfaces:
MethodEventSource
,ClientConnector
,Extension
,Connector
,Renderer<V>
,Serializable
Direct Known Subclasses:
AbstractJavaScriptRenderer
,ClickableRenderer
,ComponentRenderer
,DateRenderer
,HtmlRenderer
,LocalDateRenderer
,LocalDateTimeRenderer
,NumberRenderer
,ProgressBarRenderer
,TextRenderer
,Tree.TreeRenderer
public abstract class AbstractRenderer<T,V> extends AbstractExtension implements Renderer<V>
An abstract base class for server-side
Grid renderers
.This class currently extends the AbstractExtension superclass, but this fact should be regarded as an implementation detail and subject to change in a future major or minor Vaadin version.
Since:
8.0
See Also:
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractRenderer(Class<V> presentationType)
Creates a new renderer with the given presentation type.
protected
AbstractRenderer(Class<V> presentationType, String nullRepresentation)
Creates a new renderer with the given presentation type and null representation.
-
Method Summary
All Methods Modifier and Type Method Description protected <U> elemental.json.JsonValue
encode(U value, Class<U> type)
Encodes the given value to JSON.
elemental.json.JsonValue
encode(V value)
Encodes the given value into a
JsonValue
.protected void
extend(AbstractClientConnector target)
Deprecated.
protected String
getNullRepresentation()
Null representation for the renderer.
Grid.Column<T,V>
getParent()
Gets the parent connector of this connector, or
null
if the connector is not attached to any parent.protected Grid<T>
getParentGrid()
Gets the
Grid
this renderer is attached to.Class<V>
getPresentationType()
Returns the class literal corresponding to the presentation type T.
protected AbstractRendererState
getState()
Returns the shared state for this connector.
protected AbstractRendererState
getState(boolean markAsDirty)
Returns the shared state for this connector.
protected Class<Grid.Column>
getSupportedParentType()
Deprecated.
-
Methods inherited from class com.vaadin.server.AbstractExtension
remove, setParent
-
Methods inherited from class com.vaadin.server.AbstractClientConnector
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, attach, beforeClientResponse, createState, detach, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isConnectorEnabled, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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
-
AbstractRenderer
protected AbstractRenderer(Class<V> presentationType, String nullRepresentation)
Creates a new renderer with the given presentation type and null representation.
Parameters:
presentationType
- the data type that this renderer displays, notnull
nullRepresentation
- a string that will be sent to the client instead of a regular value in case the actual cell value isnull
. May benull
.
-
-
Method Detail
-
getSupportedParentType
@Deprecated protected Class<Grid.Column> getSupportedParentType()
Deprecated.This method is inherited from AbstractExtension but should never be called directly with an AbstractRenderer.
Overrides:
getSupportedParentType
in classAbstractExtension
Returns:
a type that the parent must be an instance of
-
extend
@Deprecated protected void extend(AbstractClientConnector target)
Deprecated.This method is inherited from AbstractExtension but should never be called directly with an AbstractRenderer.
Overrides:
extend
in classAbstractExtension
Parameters:
target
- the connector to attach this extension to
-
getPresentationType
public Class<V> getPresentationType()
Description copied from interface:
Renderer
Returns the class literal corresponding to the presentation type T.
Specified by:
getPresentationType
in interfaceRenderer<T>
Returns:
the class literal of T
-
encode
public elemental.json.JsonValue encode(V value)
Description copied from interface:
Renderer
Encodes the given value into a
JsonValue
.
-
getNullRepresentation
protected String getNullRepresentation()
Null representation for the renderer.
Returns:
a textual representation of
null
-
encode
protected <U> elemental.json.JsonValue encode(U value, Class<U> type)
Encodes the given value to JSON.
This is a helper method that can be invoked by an
encode(T)
override if serializing a value of type other thanthe presentation type
is desired. For instance, aRenderer<Date>
could first turn a date value into a formatted string and returnencode(dateString, String.class)
.Parameters:
value
- the value to be encodedtype
- the type of the valueReturns:
a JSON representation of the given value
-
getParentGrid
protected Grid<T> getParentGrid()
Gets the
Grid
this renderer is attached to. Used internally for indicating the source grid of possible events emitted by this renderer, such asClickableRenderer.RendererClickEvent
s.Returns:
the grid this renderer is attached to or
null
if unattached
-
getParent
public Grid.Column<T,V> getParent()
Description copied from interface:
Connector
Gets the parent connector of this connector, or
null
if the connector is not attached to any parent.Specified by:
getParent
in interfaceClientConnector
Specified by:
getParent
in interfaceConnector
Overrides:
getParent
in classAbstractExtension
Returns:
the parent connector, or
null
if there is no parent.
-
getState
protected AbstractRendererState 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 classAbstractClientConnector
Returns:
The shared state for this connector. Never null.
-
getState
protected AbstractRendererState getState(boolean markAsDirty)
Description copied from class:
AbstractClientConnector
Returns the shared state for this connector.
Overrides:
getState
in classAbstractClientConnector
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
-