public class LspsDateConverter extends Object implements com.vaadin.data.util.converter.Converter<String,Date>
Modifier and Type | Field and Description |
---|---|
protected String |
formatPattern
Format pattern used to perform conversion
|
Constructor and Description |
---|
LspsDateConverter(String formatPattern)
Creates converter with the given format pattern.
|
LspsDateConverter(UIComponent uiComponent)
Creates converter and loads format pattern from property
UIFieldNames.FORMAT of the component definition
for the given ui component. |
Modifier and Type | Method and Description |
---|---|
Date |
convertToModel(String value,
Class<? extends Date> clazz,
Locale locale) |
String |
convertToPresentation(Date value,
Class<? extends String> clazz,
Locale locale) |
protected SimpleDateFormat |
getFormat(Locale locale)
Returns instance of format to use for conversion.
|
static String |
getFormatPattern(UIComponentData data)
Returns format pattern from property
UIFieldNames.FORMAT of the component definition. |
Class<Date> |
getModelType() |
Class<String> |
getPresentationType() |
protected final String formatPattern
public LspsDateConverter(String formatPattern)
formatPattern
- the format pattern to use, see SimpleDateFormat
for details.
If null, the default pattern is used, as specified by the SimpleDateFormat.SimpleDateFormat()
constructor.public LspsDateConverter(UIComponent uiComponent)
UIFieldNames.FORMAT
of the component definition
for the given ui component. If the format equals "date" or "datetime" string, it will get translated
to the format patterns defined by application.uiComponent
- public static String getFormatPattern(UIComponentData data)
UIFieldNames.FORMAT
of the component definition.
Values date
and dateTime
are handled specially (localized format is loaded from
application message bundle - either app.dateFormat
or app.dateFormat
is used).data
- public Date convertToModel(String value, Class<? extends Date> clazz, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException
public String convertToPresentation(Date value, Class<? extends String> clazz, Locale locale) throws com.vaadin.data.util.converter.Converter.ConversionException
protected SimpleDateFormat getFormat(Locale locale)
UIFieldNames.FORMAT
.locale
- Copyright © 2007-2018 Whitestein Technologies. All Rights Reserved.