public class DateConverter extends javax.faces.convert.DateTimeConverter implements G9Converter
The getAsObject() method parses a String into a
java.util.Date, according to the following algorithm:
null. Otherwise,
trim leading and trailing whitespace before proceeding.null.locale property is not null, use that
Locale for managing parsing. Otherwise, use the
Locale from the UIViewRoot.displayRule has been specified, its syntax must conform
the rules specified by java.text.SimpleDateFormat. Such a
displayRule will be used to parse, and the type,
dateStyle, and timeStyle properties will be
ignored.displayRule has not been specified, parsing will be
based on the type property, which expects a date value, a time
value, or both. Any date and time values included will be parsed in
accordance to the styles specified by dateStyle and
timeStyle, respectively.timezone has been specified, it must be passed to the
underlying DateFormat instance. Otherwise the "GMT" timezone is
used.
The getAsString() method expects a value of type
java.util.Date (or a subclass), and creates a formatted String
according to the following algorithm:
locale property is not null, use that
Locale for managing formatting. Otherwise, use the
Locale from the UIViewRoot.timezone has been specified, it must be passed to the
underlying DateFormat instance. Otherwise the "GMT" timezone is
used.displayRule has been specified, its syntax must conform
the rules specified by java.text.SimpleDateFormat. Such a
displayRule will be used to format, and the dataType,
dateStyle, and timeStyle properties will be
ignored.displayRule has not been specified, formatting will be
based on the dataType property, which includes a date value, a
time value, or both into the formatted String. Any date and time values
included will be formatted in accordance to the styles specified by
dateStyle and timeStyle, respectively.| Constructor and Description |
|---|
DateConverter()
Create a new G9 date converter.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getAsObject(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String value)
Convert the specified string value, which is associated with the
specified UIComponent, into a model data object that is appropriate for
being stored during the Apply Request Values phase of the request
processing life cycle.
|
String |
getAsString(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Object value) |
String |
getDataType() |
String |
getDisplayRule() |
String |
getTitle() |
void |
restoreState(javax.faces.context.FacesContext context,
Object state) |
Object |
saveState(javax.faces.context.FacesContext context) |
void |
setDataType(String dataType) |
void |
setDisplayRule(String displayRule)
Set the format displayRule to be used when formatting and parsing dates
and times.
|
void |
setTitle(String title) |
public DateConverter()
public Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String value)
getAsObject in interface javax.faces.convert.ConvertergetAsObject in class javax.faces.convert.DateTimeConverterDateTimeConverter.getAsObject(javax.faces.context.FacesContext,
javax.faces.component.UIComponent, java.lang.String)public String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, Object value)
getAsString in interface javax.faces.convert.ConvertergetAsString in class javax.faces.convert.DateTimeConverterpublic void setDisplayRule(String displayRule)
Set the format displayRule to be used when formatting and parsing dates
and times. Valid values are those supported by
java.text.SimpleDateFormat. An invalid value will cause a
ConverterException when getAsObject() or
getAsString() is called.
setDisplayRule in interface G9ConverterdisplayRule - The new format displayRulepublic void setDataType(String dataType)
setDataType in interface G9ConverterdataType - the data type to setpublic String getDataType()
getDataType in interface G9Converterpublic String getDisplayRule()
getDisplayRule in interface G9Converterpublic void setTitle(String title)
setTitle in interface G9Convertertitle - the title to setpublic String getTitle()
getTitle in interface G9Converterpublic Object saveState(javax.faces.context.FacesContext context)
saveState in interface javax.faces.component.StateHoldersaveState in class javax.faces.convert.DateTimeConverterpublic void restoreState(javax.faces.context.FacesContext context,
Object state)
restoreState in interface javax.faces.component.StateHolderrestoreState in class javax.faces.convert.DateTimeConverterCopyright © 2006–2017 Esito AS. All rights reserved.