T
- the grid type this renderer can be attached toV
- the type this renderer knows how to presentpublic abstract class AbstractRenderer<T,V> extends AbstractExtension implements Renderer<V>
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.
ClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListener
Modifier | Constructor and 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.
|
Modifier and Type | Method and Description |
---|---|
protected <U> JsonValue |
encode(U value,
Class<U> type)
Encodes the given value to 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.
|
remove, setParent
addAttachListener, addDetachListener, addExtension, 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, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addAttachListener, addDetachListener, attach, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, getUI, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getConnectorId
protected AbstractRenderer(Class<V> presentationType, String nullRepresentation)
presentationType
- the data type that this renderer displays, not
null
nullRepresentation
- a string that will be sent to the client instead of a regular
value in case the actual cell value is null
. May
be null
.@Deprecated protected Class<Grid.Column> getSupportedParentType()
getSupportedParentType
in class AbstractExtension
@Deprecated protected void extend(AbstractClientConnector target)
extend
in class AbstractExtension
target
- the connector to attach this extension topublic Class<V> getPresentationType()
Renderer
getPresentationType
in interface Renderer<V>
public JsonValue encode(V value)
Renderer
JsonValue
.protected String getNullRepresentation()
null
protected <U> JsonValue encode(U value, Class<U> type)
This is a helper method that can be invoked by an encode(T)
override if serializing a value of type other than
the presentation type
is desired. For
instance, a Renderer<Date>
could first turn a date value into a
formatted string and return encode(dateString, String.class)
.
value
- the value to be encodedtype
- the type of the valueprotected Grid<T> getParentGrid()
Grid
this renderer is attached to. Used internally for
indicating the source grid of possible events emitted by this renderer,
such as ClickableRenderer.RendererClickEvent
s.null
if
unattachedpublic Grid.Column<T,V> getParent()
Connector
null
if the
connector is not attached to any parent.getParent
in interface ClientConnector
getParent
in interface Connector
getParent
in class AbstractExtension
null
if there is no parent.protected AbstractRendererState getState()
AbstractClientConnector
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.
getState
in class AbstractClientConnector
protected AbstractRendererState getState(boolean markAsDirty)
AbstractClientConnector
getState
in class AbstractClientConnector
markAsDirty
- true if the connector should automatically be marked dirty,
false otherwiseAbstractClientConnector.getState()
Copyright © 2018 Vaadin Ltd. All rights reserved.