|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.beanfabrics.AbstractBean
org.beanfabrics.ValidatableBean
org.beanfabrics.model.AbstractPM
org.beanfabrics.model.AbstractValuePM
org.beanfabrics.model.TextPM
org.beanfabrics.model.DatePM
public class DatePM
The DatePM
is a PresentationModel
that contains a
Date
value.
The date format used for formatting and pasring can be set by calling
setFormat(DateFormat)
. The default text format is Locale
dependent.
Nested Class Summary | |
---|---|
static class |
DatePM.DateFormatProvider
The DatePM.DateFormatProvider is a factory for the default
DateFormat used by newly created DatePM instances. |
class |
DatePM.DateValidationRule
This rule evaluates to invalid if the PM's value can't be converted into a Date . |
Nested classes/interfaces inherited from class org.beanfabrics.model.TextPM |
---|
TextPM.DefaultOptionsValidationRule, TextPM.TextComparable |
Nested classes/interfaces inherited from class org.beanfabrics.model.AbstractValuePM |
---|
AbstractValuePM.MandatoryValidationRule |
Nested classes/interfaces inherited from class org.beanfabrics.model.AbstractPM |
---|
AbstractPM.PropertiesValidationRule |
Field Summary | |
---|---|
protected static java.lang.String |
KEY_MESSAGE_INVALID_DATE
|
Fields inherited from class org.beanfabrics.model.TextPM |
---|
KEY_MESSAGE_VALUE_NOT_AN_OPTION |
Fields inherited from class org.beanfabrics.model.AbstractValuePM |
---|
KEY_MESSAGE_MANDATORY |
Fields inherited from class org.beanfabrics.model.AbstractPM |
---|
KEY_MESSAGE_ONE_OR_MORE_INVALID |
Constructor Summary | |
---|---|
DatePM()
Constructs a DatePM using the default format. |
Method Summary | |
---|---|
java.lang.Comparable<?> |
getComparable()
Returns the comparable substitute. |
java.util.Date |
getDate()
Returns the value of this PM as a Date . |
static DatePM.DateFormatProvider |
getDefaultDateFormatProvider()
Returns the DatePM.DateFormatProvider that is used to create the default
DateFormat used by newly created DatePM instances. |
protected java.text.DateFormat |
getDefaultFormat()
Returns a DateFormat for formatting a Date to a
String and converting a String to a
Date . |
java.text.DateFormat |
getFormat()
Returns the date format used for parsing and converting between the text and date value. |
void |
setDate(java.util.Date date)
Sets the value of this PM to the given Date . |
void |
setDefaultDate(java.util.Date date)
Sets the default value of this PM to the given Date value. |
static void |
setDefaultDateFormatProvider(DatePM.DateFormatProvider provider)
Sets the DatePM.DateFormatProvider that is used to create the default
DateFormat used by newly created DatePM instances. |
void |
setFormat(java.text.DateFormat newFormat)
Sets the date format used for parsing and converting between the text and date value. |
Methods inherited from class org.beanfabrics.model.TextPM |
---|
getDefaultText, getOptions, getText, getText, isEmpty, isModified, isRestrictedToOptions, preset, reformat, reset, setDefaultText, setOptions, setRestrictedToOptions, setText |
Methods inherited from class org.beanfabrics.model.AbstractValuePM |
---|
getDescription, getTitle, isEditable, isMandatory, revalidate, setDescription, setEditable, setMandatory, setTitle |
Methods inherited from class org.beanfabrics.model.AbstractPM |
---|
getContext, getSupportMap, revalidateProperties |
Methods inherited from class org.beanfabrics.ValidatableBean |
---|
getValidationState, getValidator, isValid, setValidationState |
Methods inherited from class org.beanfabrics.AbstractBean |
---|
addPropertyChangeListener, addPropertyChangeListener, equals, getPropertyChangeSupport, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.beanfabrics.model.ITextPM |
---|
getOptions, getText, isModified, preset, reformat, reset, setOptions, setText |
Methods inherited from interface org.beanfabrics.model.IValuePM |
---|
getDescription, getTitle, isEditable, isEmpty, isMandatory, setDescription, setEditable, setMandatory, setTitle |
Methods inherited from interface org.beanfabrics.Bean |
---|
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeSupport, removePropertyChangeListener, removePropertyChangeListener |
Methods inherited from interface org.beanfabrics.validation.Validatable |
---|
getValidationState, getValidator, isValid, revalidate |
Methods inherited from interface org.beanfabrics.support.Supportable |
---|
getSupportMap |
Methods inherited from interface org.beanfabrics.context.ContextOwner |
---|
getContext |
Field Detail |
---|
protected static final java.lang.String KEY_MESSAGE_INVALID_DATE
Constructor Detail |
---|
public DatePM()
DatePM
using the default format.
getDefaultFormat()
Method Detail |
---|
public static DatePM.DateFormatProvider getDefaultDateFormatProvider()
DatePM.DateFormatProvider
that is used to create the default
DateFormat
used by newly created DatePM
instances.
DatePM.DateFormatProvider
public static void setDefaultDateFormatProvider(DatePM.DateFormatProvider provider)
DatePM.DateFormatProvider
that is used to create the default
DateFormat
used by newly created DatePM
instances.
provider
- protected java.text.DateFormat getDefaultFormat()
DateFormat
for formatting a Date
to a
String
and converting a String
to a
Date
.
DateFormat
for formatting and parsing this
PM's valuepublic java.text.DateFormat getFormat()
getFormat
in interface IDatePM
public void setFormat(java.text.DateFormat newFormat)
For example, to set a format with date and time component do:
DateFormat format = DateFormat.getDateTimeInstance(); format.setLenient(false); pm.setFormat(format);
Implementors must try to reformat the content to match the new format.
setFormat
in interface IDatePM
newFormat
- the new formatpublic java.util.Date getDate() throws ConversionException
Date
.
getDate
in interface IDatePM
ConversionException
- if the text value of this PM cannot be
converted to a Date
using the defined formatpublic void setDate(java.util.Date date)
Date
.
setDate
in interface IDatePM
date
- the date valuepublic void setDefaultDate(java.util.Date date)
Date
value.
date
- the default valuepublic java.lang.Comparable<?> getComparable()
Override this method to control how instances of this class are sorted by a Sorter.
The default implementation returns a TextPM.TextComparable
or one of its subclasses.
getComparable
in interface HasComparable
getComparable
in class TextPM
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |