com.vaadin.ui.renderers.
Class LocalDateTimeRenderer
- java.lang.Object
-
- com.vaadin.server.AbstractClientConnector
-
- com.vaadin.server.AbstractExtension
-
- com.vaadin.ui.renderers.AbstractRenderer<Object,LocalDateTime>
-
- com.vaadin.ui.renderers.LocalDateTimeRenderer
-
All Implemented Interfaces:
MethodEventSource
,ClientConnector
,Extension
,Connector
,Renderer<LocalDateTime>
,Serializable
public class LocalDateTimeRenderer extends AbstractRenderer<Object,LocalDateTime>
A renderer for presenting
LocalDateTime
objects.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 LocalDateTimeRenderer()
Creates a new LocalDateTimeRenderer.
LocalDateTimeRenderer(SerializableSupplier<DateTimeFormatter> formatterSupplier)
Creates a new LocalDateTimeRenderer.
LocalDateTimeRenderer(SerializableSupplier<DateTimeFormatter> formatterSupplier, String nullRepresentation)
Creates a new LocalDateTimeRenderer.
LocalDateTimeRenderer(String formatPattern)
Creates a new LocalDateTimeRenderer.
LocalDateTimeRenderer(String formatPattern, Locale locale)
Creates a new LocalDateTimeRenderer.
LocalDateTimeRenderer(String formatPattern, Locale locale, String nullRepresentation)
Creates a new LocalDateTimeRenderer.
LocalDateTimeRenderer(DateTimeFormatter formatter)
Deprecated.
the method is unsafe for serialization, may produce troubles in a cluster environmentLocalDateTimeRenderer(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(LocalDateTime value)
Encodes the given value into a
JsonValue
.protected LocalDateTimeRendererState
getState()
Returns the shared state for this connector.
protected LocalDateTimeRendererState
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
-
LocalDateTimeRenderer
public LocalDateTimeRenderer()
Creates a new LocalDateTimeRenderer.
The renderer is configured to render with the grid's locale it is attached to, with the format style being
FormatStyle.LONG
for the date andFormatStyle.SHORT
for time, with an empty string as its null representation.See Also:
-
LocalDateTimeRenderer
@Deprecated public LocalDateTimeRenderer(DateTimeFormatter formatter)
Deprecated.the method is unsafe for serialization, may produce troubles in a cluster environmentCreates a new LocalDateTimeRenderer.
The renderer is configured to render with the given formatter, with the 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:
-
LocalDateTimeRenderer
@Deprecated public LocalDateTimeRenderer(DateTimeFormatter formatter, String nullRepresentation)
Deprecated.the method is unsafe for serialization, may produce troubles in acluster environmentCreates a new LocalDateTimeRenderer.
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:
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(String formatPattern)
Creates a new LocalDateTimeRenderer.
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:
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(String formatPattern, Locale locale)
Creates a new LocalDateTimeRenderer.
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:
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(String formatPattern, Locale locale, String nullRepresentation)
Creates a new LocalDateTimeRenderer.
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:
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(SerializableSupplier<DateTimeFormatter> formatterSupplier)
Creates a new LocalDateTimeRenderer.
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
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(SerializableSupplier<DateTimeFormatter> formatterSupplier, String nullRepresentation)
Creates a new LocalDateTimeRenderer.
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
-
-
Method Detail
-
encode
public elemental.json.JsonValue encode(LocalDateTime value)
Description copied from interface:
Renderer
Encodes the given value into a
JsonValue
.Specified by:
encode
in interfaceRenderer<LocalDateTime>
Overrides:
encode
in classAbstractRenderer<Object,LocalDateTime>
Parameters:
value
- the value to encodeReturns:
a JSON representation of the given value
-
getState
protected LocalDateTimeRendererState 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,LocalDateTime>
Returns:
The shared state for this connector. Never null.
-
getState
protected LocalDateTimeRendererState getState(boolean markAsDirty)
Description copied from class:
AbstractClientConnector
Returns the shared state for this connector.
Overrides:
getState
in classAbstractRenderer<Object,LocalDateTime>
Parameters:
markAsDirty
- true if the connector should automatically be marked dirty, false otherwiseReturns:
The shared state for this connector. Never null.
See Also:
-
-