// If only one is null, throw exception
// If both are null, set defaults
if (startDate == null ^ endDate == null) {
String message = "Schedule cannot be painted without a proper date range.\n";
if (startDate == null) {
throw new PaintException(message
+ "You must set a start date using setStartDate(Date).");
} else {
throw new PaintException(message
+ "You must set an end date using setEndDate(Date).");
}
} else if (startDate == null && endDate == null) {
// set defaults
startDate = getStartDate();
endDate = getEndDate();
}
int durationInDays = (int) (((endDate.getTime()) - startDate.getTime()) / VCalendar.DAYINMILLIS);
durationInDays++;
if (durationInDays > 60) {
throw new PaintException("Daterange is too big (max 60) = "
+ durationInDays);
}
target.addAttribute(VCalendarPaintable.ATTR_FORMAT24H,
getTimeFormat() == TimeFormat.Format24H);