Ejemplo n.º 1
0
    public boolean checkReservation() {
      try {
        Classifiable classifiable = reservation;
        List<Classifiable> singletonList = Collections.singletonList(classifiable);
        classificationField.mapTo(singletonList);
      } catch (RaplaException ex) {
        showException(ex, getComponent());
        return false;
      }
      String newName = getName(reservation);
      if (newName.length() == 0) {
        showWarning(getString("error.no_reservation_name"), getComponent());
        return false;
      }
      // We must clear all appointments because the period has been changed);
      if (period != null && !period.equals(periodSelection.getSelectedItem())) {
        panel2.removeAllAppointments();
      }

      period = (Period) periodSelection.getSelectedItem();
      if (period == null) {
        showWarning(getString("error.no_period_found"), getComponent());
        return false;
      }
      return true;
    }
Ejemplo n.º 2
0
 public ReservationInfo() throws RaplaException {
   Period[] periods = getQuery().getPeriods();
   periodSelection.setModel(new DefaultComboBoxModel(periods));
   classificationField = new ClassificationField(getContext());
   periodLabel.setText(getString("period") + ":");
   double pre = TableLayout.PREFERRED;
   double fill = TableLayout.FILL;
   double[][] sizes = new double[][] {{pre, 5, fill}, {pre, fill}};
   content.setLayout(new TableLayout(sizes));
   content.add(periodLabel, "0,0");
   content.add(periodSelection, "2,0");
   content.add(classificationField.getComponent(), "0,1,2,1");
 }
Ejemplo n.º 3
0
 public void setReservation(Reservation reservation) throws RaplaException {
   Classifiable classifiable = reservation;
   List<Classifiable> singletonList = Collections.singletonList(classifiable);
   classificationField.mapFrom(singletonList);
 }