org.beanfabrics.samples.timespan
Class TimeSpanPM
java.lang.Object
org.beanfabrics.AbstractBean
org.beanfabrics.ValidatableBean
org.beanfabrics.model.AbstractPM
org.beanfabrics.samples.timespan.TimeSpanPM
- All Implemented Interfaces:
- Bean, ContextOwner, HasComparable, PresentationModel, Supportable, Validatable
public class TimeSpanPM
- extends AbstractPM
The TimeSpanPM is a presentation model for editing a period of time. The
start date must be before or equal the end date.
Method Summary |
java.util.Date |
getEndDate()
|
java.util.Date |
getStartDate()
|
boolean |
isPositivePeriod()
Validates start date and end date if their time span is a positive
period. |
void |
setEndDate(java.util.Date endDate)
|
void |
setStartDate(java.util.Date startDate)
|
void |
updateDays()
Calculates the number of days between start and end date, and updates the
"days" field with this value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
start
public final DatePM start
end
public final DatePM end
days
public final IntegerPM days
TimeSpanPM
public TimeSpanPM()
TimeSpanPM
public TimeSpanPM(java.util.Date startDate,
java.util.Date endDate)
isPositivePeriod
public boolean isPositivePeriod()
- Validates start date and end date if their time span is a positive
period.
- Returns:
true
, if the time span is a positive period
updateDays
public void updateDays()
- Calculates the number of days between start and end date, and updates the
"days" field with this value. This method is called automatically when
any of the date fields change.
getStartDate
public java.util.Date getStartDate()
setStartDate
public void setStartDate(java.util.Date startDate)
getEndDate
public java.util.Date getEndDate()
setEndDate
public void setEndDate(java.util.Date endDate)