com.vaadin.ui.renderers.
Class LocalDateRenderer
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.server.AbstractExtension
-
- com.vaadin.ui.renderers.AbstractRenderer<Object,LocalDate>
-
- com.vaadin.ui.renderers.LocalDateRenderer
-
All Implemented Interfaces:
MethodEventSource
,ClientConnector
,Extension
,Connector
,Renderer<LocalDate>
,Serializable
public class LocalDateRenderer extends AbstractRenderer<Object,LocalDate>
A renderer for presenting date values.
Since:
8.1
Author:
Vaadin Ltd
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 Constructor Description LocalDateRenderer()
Creates a new LocalDateRenderer.
LocalDateRenderer(SerializableSupplier<DateTimeFormatter> formatterSupplier)
Creates a new LocalDateRenderer.
LocalDateRenderer(SerializableSupplier<DateTimeFormatter> formatterSupplier, String nullRepresentation)
Creates a new LocalDateRenderer.
LocalDateRenderer(String formatPattern)
Creates a new LocalDateRenderer.
LocalDateRenderer(String formatPattern, Locale locale)
Creates a new LocalDateRenderer.
LocalDateRenderer(String formatPattern, Locale locale, String nullRepresentation)
Creates a new LocalDateRenderer.
LocalDateRenderer(DateTimeFormatter formatter)
Deprecated.
the method is unsafe for serialization, may produce troubles in a cluster environmentLocalDateRenderer(DateTimeFormatter formatter, String nullRepresentation)
Deprecated.
the method is unsafe for serialization, may produce troubles in acluster environment
-
Method Summary
All Methods Modifier and Type Method Description elemental.json.JsonValue
encode(LocalDate value)
Encodes the given value into a
JsonValue
.protected LocalDateRendererState
getState()
Returns the shared state for this connector.
protected LocalDateRendererState
getState(boolean markAsDirty)
Returns the shared state for this connector.
-
Methods inherited from class com.vaadin.ui.renderers.AbstractRenderer
encode, extend, getNullRepresentation, getParent, getParentGrid, getPresentationType, getSupportedParentType
-
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
-
LocalDateRenderer
public LocalDateRenderer()
Creates a new LocalDateRenderer.
The renderer is configured to render with the grid's locale it is attached to, with the format style being
FormatStyle.LONG
and an empty string as its null representation.See Also:
-
LocalDateRenderer
public LocalDateRenderer(String formatPattern)
Creates a new LocalDateRenderer.
The renderer is configured to render with the given string format, as displayed in the grid's locale it is attached to, with an empty string as its null representation.
Parameters:
formatPattern
- the format pattern to format the date with, notnull
Throws:
IllegalArgumentException
- if format pattern is nullSee Also:
-
LocalDateRenderer
public LocalDateRenderer(String formatPattern, Locale locale)
Creates a new LocalDateRenderer.
The renderer is configured to render with the given string format, as displayed in the given locale, with an empty string as its null representation.
Parameters:
formatPattern
- the format pattern to format the date with, notnull
locale
- the locale to use, notnull
Throws:
IllegalArgumentException
- if format pattern is nullIllegalArgumentException
- if locale is nullSee Also:
-
LocalDateRenderer
public LocalDateRenderer(String formatPattern, Locale locale, String nullRepresentation)
Creates a new LocalDateRenderer.
The renderer is configured to render with the given string format, as displayed in the given locale.
Parameters:
formatPattern
- the format pattern to format the date with, notnull
locale
- the locale to use, notnull
nullRepresentation
- the textual representation of thenull
valueThrows:
IllegalArgumentException
- if format pattern is nullIllegalArgumentException
- if locale is nullSee Also:
-
LocalDateRenderer
@Deprecated public LocalDateRenderer(DateTimeFormatter formatter)
Deprecated.the method is unsafe for serialization, may produce troubles in a cluster environmentCreates a new LocalDateRenderer.
The renderer is configured to render with the given formatter, with an empty string as its null representation.
Note the
DateTimeFormatter
is not a serializable class, so using this method in an environment which requires session persistence may produceNotSerializableException
.Parameters:
formatter
- the formatter to use, notnull
Throws:
IllegalArgumentException
- if formatter is nullSee Also:
-
LocalDateRenderer
public LocalDateRenderer(SerializableSupplier<DateTimeFormatter> formatterSupplier, String nullRepresentation)
Creates a new LocalDateRenderer.
The renderer is configured to render with the given formatterSupplier.
Parameters:
formatterSupplier
- the formatterSupplier supplier to use, notnull
, it should not supplynull
eithernullRepresentation
- the textual representation of thenull
valueThrows:
IllegalArgumentException
- if formatterSupplier is null
-
LocalDateRenderer
public LocalDateRenderer(SerializableSupplier<DateTimeFormatter> formatterSupplier)
Creates a new LocalDateRenderer.
The renderer is configured to render with the given formatterSupplier.
Parameters:
formatterSupplier
- the formatterSupplier supplier to use, notnull
, it should not supplynull
eitherThrows:
IllegalArgumentException
- if formatterSupplier is null
-
LocalDateRenderer
@Deprecated public LocalDateRenderer(DateTimeFormatter formatter, String nullRepresentation)
Deprecated.the method is unsafe for serialization, may produce troubles in acluster environmentCreates a new LocalDateRenderer.
The renderer is configured to render with the given formatter.
Note the
DateTimeFormatter
is not a serializable class, so using this method in an environment which requires session persistence may produceNotSerializableException
.Parameters:
formatter
- the formatter to use, notnull
nullRepresentation
- the textual representation of thenull
valueThrows:
IllegalArgumentException
- if formatter is nullSee Also:
-
-
Method Detail
-
encode
public elemental.json.JsonValue encode(LocalDate value)
Description copied from interface:
Renderer
Encodes the given value into a
JsonValue
.
-
getState
protected LocalDateRendererState 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 classAbstractRenderer<Object,LocalDate>
Returns:
The shared state for this connector. Never null.
-
getState
protected LocalDateRendererState getState(boolean markAsDirty)
Description copied from class:
AbstractClientConnector
Returns the shared state for this connector.
Overrides:
getState
in classAbstractRenderer<Object,LocalDate>
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
-