org.beanfabrics.model
Interface IDatePM

All Superinterfaces:
Bean, ContextOwner, HasComparable, ITextPM, IValuePM, PresentationModel, Supportable, Validatable
All Known Implementing Classes:
DatePM

public interface IDatePM
extends ITextPM

The IDatePM is the interface of PresentationModel components that contain 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.


Method Summary
 java.util.Date getDate()
          Returns the value of this PM as 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 setFormat(java.text.DateFormat newFormat)
          Sets the date format used for parsing and converting between the text and date value.
 
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
 
Methods inherited from interface org.beanfabrics.HasComparable
getComparable
 

Method Detail

getFormat

java.text.DateFormat getFormat()
Returns the date format used for parsing and converting between the text and date value. This format is used for validation also.

Returns:
the date format used for parsing and converting

setFormat

void setFormat(java.text.DateFormat newFormat)
Sets the date format used for parsing and converting between the text and date value. This format is used for validation also.

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.

Parameters:
newFormat - the new format

getDate

java.util.Date getDate()
                       throws ConversionException
Returns the value of this PM as a Date.

Returns:
the value of this PM as a Date
Throws:
ConversionException - if the text value of this PM cannot be converted to a Date using the defined format

setDate

void setDate(java.util.Date date)
Sets the value of this PM to the given Date.

Parameters:
date - the date value