|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cc.framework.convert.imp.DateTimeConverter
Converter for Date and time (as in the Java Server Faces Specification)
Field Summary | |
static java.lang.String |
CONVERTER_ID
Converter Id |
private java.lang.String |
dateStyle
|
private static java.util.TimeZone |
DEFAULT_TIME_ZONE
|
private java.util.Locale |
locale
|
private java.lang.String |
pattern
|
private java.lang.String |
timeStyle
|
private java.util.TimeZone |
timeZone
|
private java.lang.String |
type
|
Constructor Summary | |
DateTimeConverter()
Default constructor |
Method Summary | |
java.lang.Object |
getAsObject(RequestContext context,
java.lang.String value)
Converts the given String value into the Converters Datatype |
java.lang.String |
getAsString(RequestContext context,
java.lang.Object value)
Converts the Object of the converters Datatype into it's String representation |
private java.text.DateFormat |
getDateFormat(RequestContext context,
java.util.Locale locale)
Creates a DateFormat Object from the Converter Attributes |
java.lang.String |
getDateStyle()
|
private java.util.Locale |
getLocale(RequestContext context)
Retrieves the Locale for this Converter |
java.lang.String |
getPattern()
|
private int |
getStyle(java.lang.String name)
Converts the given Date Style in one of the DateFormat Constants |
java.lang.String |
getTimeStyle()
|
java.util.TimeZone |
getTimeZone()
|
java.lang.String |
getType()
|
void |
restoreState(RequestContext context,
java.lang.Object state)
Perform any processing required to restore the state from the entries in the state Object. |
java.lang.Object |
saveState(RequestContext context)
Gets the state of the instance as a Serializable Object. |
void |
setDateStyle(java.lang.String dateStyle)
|
void |
setLocale(java.util.Locale locale)
|
void |
setPattern(java.lang.String pattern)
|
void |
setTimeStyle(java.lang.String timeStyle)
|
void |
setTimeZone(java.util.TimeZone timeZone)
|
void |
setType(java.lang.String type)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String CONVERTER_ID
private static final java.util.TimeZone DEFAULT_TIME_ZONE
private java.lang.String dateStyle
private java.util.Locale locale
private java.lang.String pattern
private java.lang.String timeStyle
private java.util.TimeZone timeZone
private java.lang.String type
Constructor Detail |
public DateTimeConverter()
Method Detail |
public java.lang.String getDateStyle()
public void setDateStyle(java.lang.String dateStyle)
dateStyle
- Predefined formatting style which determines how the date
component of a date string is to be formatted and parsed.
Applied only if type is "date" or "both". Valid values are
"default", "short", "medium", "long", and "full". Default
value is "default".public void setLocale(java.util.Locale locale)
locale
- Locale whose predefined styles for dates and times are used
during formatting or parsing. If not specified, the Locale
returned by FacesContext.getViewRoot().getLocale() will be
used. Value must be either a VB expression that evaluates to a
java.util.Locale instance, or a String that is valid to pass
as the first argument to the constructor
java.util.Locale(String language, String country). The empty
string is passed as the second argument.public java.lang.String getPattern()
public void setPattern(java.lang.String pattern)
pattern
- Custom formatting pattern which determines how the date/time
string should be formatted and parsed.public java.lang.String getTimeStyle()
public void setTimeStyle(java.lang.String timeStyle)
timeStyle
- Predefined formatting style which determines how the time
component of a date string is to be formatted and parsed.
Applied only if type is "time" or "both". Valid values are
"default", "short", "medium", "long", and "full". Default
value is "default".public java.util.TimeZone getTimeZone()
public void setTimeZone(java.util.TimeZone timeZone)
timeZone
- Time zone in which to interpret any time information in the
date String. Value must be either a VB expression that
evaluates to a java.util.TimeVone instance, or a String that
is a timezone ID as described in the javadocs for
java.util.TimeZone.getTimeZone().public java.lang.String getType()
public void setType(java.lang.String type)
type
- Specifies what contents the string value will be formatted to
include, or parsed expecting. Valid values are "date", "time",
and "both". Default value is "date".public java.lang.Object getAsObject(RequestContext context, java.lang.String value) throws ConverterException
Converter
getAsObject
in interface Converter
context
- Request Contextvalue
- The String Value to convert
ConverterException
- is thrown when a conversion error occursConverter.getAsObject(com.cc.framework.adapter.RequestContext,
java.lang.String)
public java.lang.String getAsString(RequestContext context, java.lang.Object value) throws ConverterException
Converter
getAsString
in interface Converter
context
- Request Contextvalue
- The Object to convert
ConverterException
- is thrown when a conversion error occursConverter.getAsString(com.cc.framework.adapter.RequestContext,
java.lang.Object)
private java.text.DateFormat getDateFormat(RequestContext context, java.util.Locale locale) throws ConverterException
context
- RequestContextlocale
- The Locale to use
ConverterException
- Is thrown when the Converter Attributes are not validprivate java.util.Locale getLocale(RequestContext context)
context
- The RequestContext
private int getStyle(java.lang.String name) throws ConverterException
name
- The Style Name
ConverterException
- Is thrown when the style identifier is unknownpublic java.lang.Object saveState(RequestContext context)
StatefullConverter
Object state = component.saveState(ctx);Component should be the same as before executing it.
saveState
in interface StatefullConverter
context
- The RequestContext object
StatefullConverter.saveState(com.cc.framework.adapter.RequestContext)
public void restoreState(RequestContext context, java.lang.Object state)
StatefullConverter
restoreState
in interface StatefullConverter
context
- The RequestContext objectstate
- the serialized stateStatefullConverter.restoreState(com.cc.framework.adapter.RequestContext,
java.lang.Object)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |