org.jboss.seam.faces
Class DateConverter
java.lang.Object
javax.faces.convert.DateTimeConverter
org.jboss.seam.faces.DateConverter
- All Implemented Interfaces:
- javax.faces.component.StateHolder, javax.faces.convert.Converter
@Converter(forClass=java.util.Date.class)
@Name(value="org.jboss.seam.faces.dateConverter")
@Install(precedence=0,
classDependencies="javax.faces.context.FacesContext")
@BypassInterceptors
public class DateConverter
- extends javax.faces.convert.DateTimeConverter
Provides a default JSF converter for properties of type java.util.Date.
This converter is provided to save a developer from having to specify
a DateTimeConverter on an input field or page parameter. By default, it
assumes the type to be a date (as opposed to a time or date plus time) and
uses the short input style adjusted to the Locale of the user. For Locale.US,
the input pattern is mm/DD/yy. However, to comply with Y2K, the year is changed
from two digits to four (e.g., mm/DD/yyyy).
It's possible to override the input pattern globally using component configuration.
Here is an example of changing the style to both and setting the date and
time style to medium.
org.jboss.seam.faces.dateConverter.type=both
org.jboss.seam.faces.dateConverter.dateStyle=medium
org.jboss.seam.faces.dateConverter.timeStyle=medium
Alternatively, a fixed pattern can be specified.
org.jboss.seam.faces.dateConverter.pattern=yyyy-mm-DD
- Author:
- Dan Allen
Fields inherited from class javax.faces.convert.DateTimeConverter |
CONVERTER_ID, DATE_ID, DATETIME_ID, STRING_ID, TIME_ID |
Methods inherited from class javax.faces.convert.DateTimeConverter |
getDateStyle, getPattern, getTimeStyle, getType, isTransient, restoreState, saveState, setDateStyle, setLocale, setPattern, setTimeStyle, setTimeZone, setTransient, setType |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DateConverter
public DateConverter()
create
@Create
public void create()
getTimeZone
public TimeZone getTimeZone()
- Overrides:
getTimeZone
in class javax.faces.convert.DateTimeConverter
getLocale
public Locale getLocale()
- Overrides:
getLocale
in class javax.faces.convert.DateTimeConverter
getAsObject
public Object getAsObject(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String value)
throws javax.faces.convert.ConverterException
- Specified by:
getAsObject
in interface javax.faces.convert.Converter
- Overrides:
getAsObject
in class javax.faces.convert.DateTimeConverter
- Throws:
javax.faces.convert.ConverterException
getAsString
public String getAsString(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
Object value)
throws javax.faces.convert.ConverterException
- Specified by:
getAsString
in interface javax.faces.convert.Converter
- Overrides:
getAsString
in class javax.faces.convert.DateTimeConverter
- Throws:
javax.faces.convert.ConverterException
getInstance
public static javax.faces.convert.Converter getInstance()