com.sun.rave.faces.converter
Class CalendarConverter

java.lang.Object
  extended by com.sun.rave.faces.converter.CalendarConverter
All Implemented Interfaces:
javax.faces.component.StateHolder, javax.faces.convert.Converter
Direct Known Subclasses:
CalendarConverter

public class CalendarConverter
extends java.lang.Object
implements javax.faces.convert.Converter, javax.faces.component.StateHolder

Converter implementation for java.util.Calendar values. Delegates detailed processing, and all property settings, to an internal instance of dateTimeConverter that is used to perform the actual conversion processing.


Field Summary
static java.lang.String CONVERTER_ID
          The standard converter id for this converter.
 
Constructor Summary
CalendarConverter()
           
 
Method Summary
 java.lang.Object getAsObject(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String value)
           
 java.lang.String getAsString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value)
           
 java.lang.String getDateStyle()
          Return the style to be used to format or parse dates.
 java.util.Locale getLocale()
          Return the Locale to be used when parsing or formatting dates and times.
 java.lang.String getPattern()
          Return the format pattern to be used when formatting and parsing dates and times.
 java.lang.String getTimeStyle()
          Return the style to be used to format or parse times.
 java.util.TimeZone getTimeZone()
          Return the TimeZone used to interpret a time value.
 java.lang.String getType()
          Return the type of value to be formatted or parsed.
 boolean isTransient()
           
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
           
 java.lang.Object saveState(javax.faces.context.FacesContext context)
           
 void setDateStyle(java.lang.String dateStyle)
          Set the style to be used to format or parse dates.
 void setLocale(java.util.Locale locale)
          Set the Locale to be used when parsing or formatting dates and times.
 void setPattern(java.lang.String pattern)
          Set the format pattern to be used when formatting and parsing dates and times.
 void setTimeStyle(java.lang.String timeStyle)
          Set the style to be used to format or parse times.
 void setTimeZone(java.util.TimeZone timeZone)
          Set the TimeZone used to interpret a time value.
 void setTransient(boolean transientFlag)
           
 void setType(java.lang.String type)
          Set the type of value to be formatted or parsed.
 
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 java.lang.String CONVERTER_ID

The standard converter id for this converter.

See Also:
Constant Field Values
Constructor Detail

CalendarConverter

public CalendarConverter()
Method Detail

getDateStyle

public java.lang.String getDateStyle()

Return the style to be used to format or parse dates. If not set, the default value, default, is returned.


setDateStyle

public void setDateStyle(java.lang.String dateStyle)

Set the style to be used to format or parse dates. Valid values are default, short, medium, long, and full. An invalid value will cause a ConverterException when getAsObject() or getAsString() is called.

Parameters:
dateStyle - The new style code

getLocale

public java.util.Locale getLocale()

Return the Locale to be used when parsing or formatting dates and times. If not explicitly set, the Locale stored in the UIViewRoot for the current request is returned.


setLocale

public void setLocale(java.util.Locale locale)

Set the Locale to be used when parsing or formatting dates and times. If set to null, the Locale stored in the UIViewRoot for the current request will be utilized.

Parameters:
locale - The new Locale (or null)

getPattern

public java.lang.String getPattern()

Return the format pattern to be used when formatting and parsing dates and times.


setPattern

public void setPattern(java.lang.String pattern)

Set the format pattern 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.

Parameters:
pattern - The new format pattern

getTimeStyle

public java.lang.String getTimeStyle()

Return the style to be used to format or parse times. If not set, the default value, default, is returned.


setTimeStyle

public void setTimeStyle(java.lang.String timeStyle)

Set the style to be used to format or parse times. Valid values are default, short, medium, long, and full. An invalid value will cause a ConverterException when getAsObject() or getAsString() is called.

Parameters:
timeStyle - The new style code

getTimeZone

public java.util.TimeZone getTimeZone()

Return the TimeZone used to interpret a time value. If not explicitly set, the default time zone of GMT returned.


setTimeZone

public void setTimeZone(java.util.TimeZone timeZone)

Set the TimeZone used to interpret a time value.

Parameters:
timeZone - The new time zone

getType

public java.lang.String getType()

Return the type of value to be formatted or parsed. If not explicitly set, the default type, date is returned.


setType

public void setType(java.lang.String type)

Set the type of value to be formatted or parsed. Valid values are both, date, or time. An invalid value will cause a ConverterException when getAsObject() or getAsString() is called.

Parameters:
type - The new date style

getAsObject

public java.lang.Object getAsObject(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    java.lang.String value)
Specified by:
getAsObject in interface javax.faces.convert.Converter
Throws:
javax.faces.convert.ConverterException
java.lang.NullPointerException

getAsString

public java.lang.String getAsString(javax.faces.context.FacesContext context,
                                    javax.faces.component.UIComponent component,
                                    java.lang.Object value)
Specified by:
getAsString in interface javax.faces.convert.Converter
Throws:
javax.faces.convert.ConverterException
java.lang.NullPointerException

saveState

public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder

restoreState

public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder

isTransient

public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder

setTransient

public void setTransient(boolean transientFlag)
Specified by:
setTransient in interface javax.faces.component.StateHolder