Class LocalDateRenderer<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,LocalDate>
-
- com.vaadin.flow.data.renderer.LocalDateRenderer<SOURCE>
-
- Type Parameters:
SOURCE
- the type of the input item, from which theLocalDate
is extracted
- All Implemented Interfaces:
Serializable
public class LocalDateRenderer<SOURCE> extends BasicRenderer<SOURCE,LocalDate>
A template renderer for presenting date values.- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getFormattedValue(LocalDate date)
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
-
LocalDateRenderer
public LocalDateRenderer(ValueProvider<SOURCE,LocalDate> valueProvider)
Creates a new LocalDateRenderer.The renderer is configured with the format style
FormatStyle.LONG
and an empty string as its null representation.- Parameters:
valueProvider
- the callback to provide aLocalDate
to the renderer, notnull
- See Also:
- FormatStyle.LONG
-
LocalDateRenderer
public LocalDateRenderer(ValueProvider<SOURCE,LocalDate> valueProvider, String formatPattern)
Creates a new LocalDateRenderer.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 aLocalDate
to the renderer, notnull
formatPattern
- the format pattern to format the date with, notnull
- See Also:
- Format Pattern Syntax
-
LocalDateRenderer
public LocalDateRenderer(ValueProvider<SOURCE,LocalDate> valueProvider, 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:
valueProvider
- the callback to provide aLocalDate
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
-
LocalDateRenderer
public LocalDateRenderer(ValueProvider<SOURCE,LocalDate> valueProvider, 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:
valueProvider
- the callback to provide aLocalDate
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
-
LocalDateRenderer
@Deprecated public LocalDateRenderer(ValueProvider<SOURCE,LocalDate> valueProvider, DateTimeFormatter formatter)
Deprecated.Via this constructor renderer is not serializable, useLocalDateRenderer(com.vaadin.flow.function.ValueProvider<SOURCE,java.time.LocalDate>,com.vaadin.flow.function.SerializableSupplier<java.time.format.DateTimeFormatter>)
instead.Creates a new LocalDateRenderer.The renderer is configured to render with the given formatter, with an empty string as its null representation.
- Parameters:
valueProvider
- the callback to provide aLocalDate
to the renderer, notnull
formatter
- the formatter to use, notnull
-
LocalDateRenderer
public LocalDateRenderer(ValueProvider<SOURCE,LocalDate> valueProvider, SerializableSupplier<DateTimeFormatter> formatter)
Creates a new LocalDateRenderer.The renderer is configured to render with the given formatter, with an empty string as its null representation.
- Parameters:
valueProvider
- the callback to provide aLocalDate
to the renderer, notnull
formatter
- the formatter to use, notnull
-
LocalDateRenderer
@Deprecated public LocalDateRenderer(ValueProvider<SOURCE,LocalDate> valueProvider, DateTimeFormatter formatter, String nullRepresentation)
Deprecated.Via this constructor renderer is not serializable, useLocalDateRenderer(com.vaadin.flow.function.ValueProvider<SOURCE,java.time.LocalDate>,com.vaadin.flow.function.SerializableSupplier<java.time.format.DateTimeFormatter>,java.lang.String)
instead.Creates a new LocalDateRenderer.The renderer is configured to render with the given formatter.
- Parameters:
valueProvider
- the callback to provide aLocalDate
to the renderer, notnull
formatter
- the formatter to use, notnull
nullRepresentation
- the textual representation of thenull
value
-
LocalDateRenderer
public LocalDateRenderer(ValueProvider<SOURCE,LocalDate> valueProvider, SerializableSupplier<DateTimeFormatter> formatter, String nullRepresentation)
Creates a new LocalDateRenderer.The renderer is configured to render with the given formatter.
- Parameters:
valueProvider
- the callback to provide aLocalDate
to the renderer, notnull
formatter
- the formatter to use, notnull
nullRepresentation
- the textual representation of thenull
value
-
-
Method Detail
-
getFormattedValue
protected String getFormattedValue(LocalDate date)
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,LocalDate>
- Parameters:
date
- the target object- Returns:
- the string representation of the object
-
-