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",
              tagSuperclass="org.apache.myfaces.commons.converter.ConverterTag",
              tagHandler="org.apache.myfaces.commons.converter.ConvertDateTimeTagHandler",
              serialuidtag="1542071733367150635L",
              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
           
 
Fields inherited from class javax.faces.convert.DateTimeConverter
DATE_ID, DATETIME_ID, STRING_ID, TIME_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.el.ValueExpression getValueExpression(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 setValueExpression(String name, javax.el.ValueExpression 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

getValueExpression

public javax.el.ValueExpression getValueExpression(String name)

setValueExpression

public void setValueExpression(String name,
                               javax.el.ValueExpression 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,
             deferredValueType="java.lang.Object")
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,
             deferredValueType="java.lang.Object")
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.