org.apache.myfaces.commons.converter
Class DateTimeConverter

java.lang.Object
  extended by javax.faces.convert.DateTimeConverter
      extended by org.apache.myfaces.commons.converter.DateTimeConverter
All Implemented Interfaces:
javax.faces.component.StateHolder, javax.faces.convert.Converter

@JSFConverter(name="mcc:convertDateTime",
              tagClass="org.apache.myfaces.commons.converter.ConvertDateTimeTag",
              tagHandler="org.apache.myfaces.commons.converter.ConvertDateTimeTagHandler",
              tagSuperclass="javax.faces.webapp.ConverterTag",
              evaluateELOnExecution=true)
public class DateTimeConverter
extends javax.faces.convert.DateTimeConverter

Simple convert that overrides the spec DateTimeConverter and uses TimeZone.getDefault() as the base timezone, rather than GMT. Convert date time using normal system timezone like it should User: treeder Date: Oct 28, 2005 Time: 7:19:01 PM


Field Summary
static String CONVERTER_ID
           
 
Constructor Summary
DateTimeConverter()
           
 
Method Summary
 Object getAsObject(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, String value)
           
 String getAsString(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, Object value)
           
 String getDateStyle()
          The style of the date.
protected  javax.faces.context.FacesContext getFacesContext()
           
 Locale getLocale()
          The name of the locale to be used, instead of the default.
 String getPattern()
          A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat.
 String getTimeStyle()
          The style of the time.
 TimeZone getTimeZone()
          The time zone to use instead of GMT (the default timezone).
 String getType()
          Specifies whether the date, time, or both should be parsed/formatted.
 javax.faces.el.ValueBinding getValueBinding(String name)
           
 void restoreState(javax.faces.context.FacesContext facesContext, Object state)
           
 Object saveState(javax.faces.context.FacesContext facesContext)
           
 void setDateStyle(String dateStyle)
           
 void setLocale(Locale locale)
           
 void setPattern(String pattern)
           
 void setTimeStyle(String timeStyle)
           
 void setTimeZone(TimeZone timeZone)
           
 void setType(String type)
           
 void setValueBinding(String name, javax.faces.el.ValueBinding binding)
           
 
Methods inherited from class javax.faces.convert.DateTimeConverter
isTransient, setTransient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONVERTER_ID

public static final String CONVERTER_ID
See Also:
Constant Field Values
Constructor Detail

DateTimeConverter

public DateTimeConverter()
Method Detail

getAsObject

public Object getAsObject(javax.faces.context.FacesContext facesContext,
                          javax.faces.component.UIComponent uiComponent,
                          String value)
Specified by:
getAsObject in interface javax.faces.convert.Converter
Overrides:
getAsObject in class javax.faces.convert.DateTimeConverter

getAsString

public String getAsString(javax.faces.context.FacesContext facesContext,
                          javax.faces.component.UIComponent uiComponent,
                          Object value)
Specified by:
getAsString in interface javax.faces.convert.Converter
Overrides:
getAsString in class javax.faces.convert.DateTimeConverter

restoreState

public void restoreState(javax.faces.context.FacesContext facesContext,
                         Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder
Overrides:
restoreState in class javax.faces.convert.DateTimeConverter

saveState

public Object saveState(javax.faces.context.FacesContext facesContext)
Specified by:
saveState in interface javax.faces.component.StateHolder
Overrides:
saveState in class javax.faces.convert.DateTimeConverter

getValueBinding

public javax.faces.el.ValueBinding getValueBinding(String name)

setValueBinding

public void setValueBinding(String name,
                            javax.faces.el.ValueBinding binding)

getFacesContext

protected javax.faces.context.FacesContext getFacesContext()

getDateStyle

@JSFProperty(inheritedTag=false)
public String getDateStyle()
The style of the date. Values include: default, short, medium, long, and full.

Overrides:
getDateStyle in class javax.faces.convert.DateTimeConverter

setDateStyle

public void setDateStyle(String dateStyle)
Overrides:
setDateStyle in class javax.faces.convert.DateTimeConverter

getLocale

@JSFProperty(inheritedTag=false)
public Locale getLocale()
The name of the locale to be used, instead of the default.

Overrides:
getLocale in class javax.faces.convert.DateTimeConverter

setLocale

public void setLocale(Locale locale)
Overrides:
setLocale in class javax.faces.convert.DateTimeConverter

getPattern

@JSFProperty(inheritedTag=false)
public String getPattern()
A custom Date formatting pattern, in the format used by java.text.SimpleDateFormat.

Overrides:
getPattern in class javax.faces.convert.DateTimeConverter

setPattern

public void setPattern(String pattern)
Overrides:
setPattern in class javax.faces.convert.DateTimeConverter

getTimeStyle

@JSFProperty(inheritedTag=false)
public String getTimeStyle()
The style of the time. Values include: default, short, medium, long, and full.

Overrides:
getTimeStyle in class javax.faces.convert.DateTimeConverter

setTimeStyle

public void setTimeStyle(String timeStyle)
Overrides:
setTimeStyle in class javax.faces.convert.DateTimeConverter

getTimeZone

@JSFProperty(inheritedTag=false)
public TimeZone getTimeZone()
The time zone to use instead of GMT (the default timezone). When this value is a value-binding to a TimeZone instance, that timezone is used. Otherwise this value is treated as a String containing a timezone id, ie as the ID parameter of method java.util.TimeZone.getTimeZone(String).

Overrides:
getTimeZone in class javax.faces.convert.DateTimeConverter

setTimeZone

public void setTimeZone(TimeZone timeZone)
Overrides:
setTimeZone in class javax.faces.convert.DateTimeConverter

getType

@JSFProperty(inheritedTag=false)
public String getType()
Specifies whether the date, time, or both should be parsed/formatted. Values include: date, time, and both. Default based on setting of timeStyle and dateStyle.

Overrides:
getType in class javax.faces.convert.DateTimeConverter

setType

public void setType(String type)
Overrides:
setType in class javax.faces.convert.DateTimeConverter


Copyright © 2007-2011 The Apache Software Foundation. All Rights Reserved.