Package 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 present
- All 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-sideGrid 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:
- Serialized Form
-
-
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 protectedAbstractRenderer(Class<V> presentationType)Creates a new renderer with the given presentation type.protectedAbstractRenderer(Class<V> presentationType, String nullRepresentation)Creates a new renderer with the given presentation type and null representation.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected <U> elemental.json.JsonValueencode(U value, Class<U> type)Encodes the given value to JSON.elemental.json.JsonValueencode(V value)Encodes the given value into aJsonValue.protected voidextend(AbstractClientConnector target)Deprecated.protected StringgetNullRepresentation()Null representation for the renderer.Grid.Column<T,V>getParent()protected Grid<T>getParentGrid()Gets theGridthis renderer is attached to.Class<V>getPresentationType()Returns the class literal corresponding to the presentation type T.protected AbstractRendererStategetState()Returns the shared state for this connector.protected AbstractRendererStategetState(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, notnullnullRepresentation- 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:
getSupportedParentTypein 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:
extendin classAbstractExtension- Parameters:
target- the connector to attach this extension to
-
getPresentationType
public Class<V> getPresentationType()
Description copied from interface:RendererReturns the class literal corresponding to the presentation type T.- Specified by:
getPresentationTypein interfaceRenderer<T>- Returns:
- the class literal of T
-
encode
public elemental.json.JsonValue encode(V value)
Description copied from interface:RendererEncodes the given value into aJsonValue.
-
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 typeis 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 value- Returns:
- a JSON representation of the given value
-
getParentGrid
protected Grid<T> getParentGrid()
Gets theGridthis renderer is attached to. Used internally for indicating the source grid of possible events emitted by this renderer, such asClickableRenderer.RendererClickEvents.- Returns:
- the grid this renderer is attached to or
nullif unattached
-
getParent
public Grid.Column<T,V> getParent()
- Specified by:
getParentin interfaceClientConnector- Specified by:
getParentin interfaceConnector- Overrides:
getParentin classAbstractExtension
-
getState
protected AbstractRendererState getState()
Description copied from class:AbstractClientConnectorReturns 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:
getStatein classAbstractClientConnector- Returns:
- The shared state for this connector. Never null.
-
getState
protected AbstractRendererState getState(boolean markAsDirty)
Description copied from class:AbstractClientConnectorReturns the shared state for this connector.- Overrides:
getStatein classAbstractClientConnector- Parameters:
markAsDirty- true if the connector should automatically be marked dirty, false otherwise- Returns:
- The shared state for this connector. Never null.
- See Also:
AbstractClientConnector.getState()
-
-