Ejemplo n.º 1
0
 public void update() {
   listenersEnabled = false;
   try {
     Date startDate = model.getStartDate();
     startDateSelection.setDate(startDate);
     final PeriodModel periodModel = getPeriodModel();
     periodChooser.setPeriodModel(periodModel);
     periodChooser.setDate(startDate);
     Date endDate = model.getEndDate();
     periodPanel.setVisible(periodModel.getSize() > 0);
     endDateSelection.setDate(DateTools.subDay(endDate));
   } finally {
     listenersEnabled = true;
   }
 }
Ejemplo n.º 2
0
    public void setStart(Date start) throws RaplaException {
      PeriodModel periodModel = getPeriodModel();
      Period period = null;
      if (start != null) {
        period = periodModel.getNearestPeriodForDate(start);
      }
      if (period == null) {
        period = periodModel.getNearestPeriodForDate(getQuery().today());
      }
      if (period != null) {
        periodSelection.setSelectedItem(period);
      }

      if (periodModel.getSize() == 0) {
        throw new RaplaException(getString("error.no_period_found"));
      }
    }