示例#1
0
 public void dateChanged(DateChangeEvent evt) {
   if (!listenersEnabled) return;
   if (evt.getSource() == startDateSelection) {
     Date newStartDate = startDateSelection.getDate();
     if (newStartDate.after(endDateSelection.getDate())) {
       Date endDate = DateTools.addDays(newStartDate, 1);
       endDateSelection.setDate(endDate);
     }
   }
   if (evt.getSource() == endDateSelection) {
     Date newEndDate = endDateSelection.getDate();
     if (newEndDate.before(startDateSelection.getDate())) {
       Date startDate = DateTools.addDays(newEndDate, -1);
       startDateSelection.setDate(startDate);
     }
   }
   updateDates(startDateSelection.getDate(), DateTools.addDay(endDateSelection.getDate()));
   fireDateChange(evt.getDate());
 }
 public String getHtmlValue(AppointmentBlock block) {
   RaplaLocale raplaLocale = getRaplaLocale();
   final Date date = new Date(block.getEnd());
   if (block.getAppointment().isWholeDaysSet()) {
     String dateString = raplaLocale.formatDateLong(DateTools.addDays(date, -1));
     return dateString;
   } else {
     String dateString = raplaLocale.formatDateLong(date) + " " + raplaLocale.formatTime(date);
     return dateString;
   }
 }