Class LocalDateTimeRenderer<SOURCE>
- java.lang.Object
-
- com.vaadin.flow.data.renderer.Renderer<SOURCE>
-
- com.vaadin.flow.data.renderer.ComponentRenderer<Component,SOURCE>
-
- com.vaadin.flow.data.renderer.BasicRenderer<SOURCE,LocalDateTime>
-
- com.vaadin.flow.data.renderer.LocalDateTimeRenderer<SOURCE>
-
- Type Parameters:
SOURCE
- the type of the input item, from which theLocalDateTime
is extracted
- All Implemented Interfaces:
Serializable
public class LocalDateTimeRenderer<SOURCE> extends BasicRenderer<SOURCE,LocalDateTime>
A template renderer for presentingLocalDateTime
objects.- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider)
Creates a new LocalDateTimeRenderer.LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, String formatPattern)
Creates a new LocalDateTimeRenderer.LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, String formatPattern, Locale locale)
Creates a new LocalDateTimeRenderer.LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, String formatPattern, Locale locale, String nullRepresentation)
Creates a new LocalDateTimeRenderer.LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, DateTimeFormatter formatter)
Creates a new LocalDateTimeRenderer.LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, DateTimeFormatter formatter, String nullRepresentation)
Creates a new LocalDateTimeRenderer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getFormattedValue(LocalDateTime dateTime)
Gets the String representation of the target object, to be used inside the template.-
Methods inherited from class com.vaadin.flow.data.renderer.BasicRenderer
createComponent, getTemplateForProperty, getTemplatePropertyName, getValueProvider, render
-
Methods inherited from class com.vaadin.flow.data.renderer.ComponentRenderer
setComponentRendererTag, updateComponent
-
Methods inherited from class com.vaadin.flow.data.renderer.Renderer
getEventHandlers, getValueProviders, render, setEventHandler, setProperty
-
-
-
-
Constructor Detail
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider)
Creates a new LocalDateTimeRenderer.The renderer is configured to render with the format style
FormatStyle.LONG
for the date andFormatStyle.SHORT
for time, with an empty string as its null representation.- Parameters:
valueProvider
- the callback to provide aLocalDateTime
to the renderer, notnull
- See Also:
- FormatStyle.LONG, FormatStyle.SHORT
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, DateTimeFormatter formatter)
Creates a new LocalDateTimeRenderer.The renderer is configured to render with the given formatter, with the empty string as its null representation.
- Parameters:
valueProvider
- the callback to provide aLocalDateTime
to the renderer, notnull
formatter
- the formatter to use, notnull
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, DateTimeFormatter formatter, String nullRepresentation)
Creates a new LocalDateTimeRenderer.The renderer is configured to render with the given formatter.
- Parameters:
valueProvider
- the callback to provide aLocalDateTime
to the renderer, notnull
formatter
- the formatter to use, notnull
nullRepresentation
- the textual representation of thenull
value
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, String formatPattern)
Creates a new LocalDateTimeRenderer.The renderer is configured to render with the given string format, with an empty string as its null representation.
- Parameters:
valueProvider
- the callback to provide aLocalDateTime
to the renderer, notnull
formatPattern
- the format pattern to format the date with, notnull
- See Also:
- Format Pattern Syntax
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, 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:
valueProvider
- the callback to provide aLocalDateTime
to the renderer, notnull
formatPattern
- the format pattern to format the date with, notnull
locale
- the locale to use, notnull
- See Also:
- Format Pattern Syntax
-
LocalDateTimeRenderer
public LocalDateTimeRenderer(ValueProvider<SOURCE,LocalDateTime> valueProvider, 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:
valueProvider
- the callback to provide aLocalDateTime
to the renderer, notnull
formatPattern
- the format pattern to format the date with, notnull
locale
- the locale to use, notnull
nullRepresentation
- the textual representation of thenull
value- See Also:
- Format Pattern Syntax
-
-
Method Detail
-
getFormattedValue
protected String getFormattedValue(LocalDateTime dateTime)
Description copied from class:BasicRenderer
Gets the String representation of the target object, to be used inside the template.By default it uses
String.valueOf(Object)
of the object.- Overrides:
getFormattedValue
in classBasicRenderer<SOURCE,LocalDateTime>
- Parameters:
dateTime
- the target object- Returns:
- the string representation of the object
-
-