/** * This allows the user to modify an appointment when they click the edit button. * * @param ActionEvent e is the event sent to this method when the user pressed the edit button. */ public void actionPerformed(ActionEvent e) { RefAppointment ref = controller.getModel().getCurrentAppointment(); if (ref != null) { if (ref.getPattern() != null) { AppointmentTemplate apptTmpl = (AppointmentTemplate) ref.getTemplate().clone(); apptTmpl.setPattern(null); RefAppointment appt = new RefAppointment(ref.getStartDate(), apptTmpl); if (AppointmentDialog.changeAppointment(controller.getView(), appt)) { controller.getModel().getAppointmentSet().remove(ref); CalendarModelUtility.add(controller.getModel(), appt); } } else JOptionPane.showMessageDialog( controller.getView(), "the selected appointment does not recur", "", JOptionPane.ERROR_MESSAGE); } else JOptionPane.showMessageDialog( controller.getView(), "no appointment is selected", "", JOptionPane.ERROR_MESSAGE); }
public Object clone() { AppointmentTemplate ret = new AppointmentTemplate("", "", "", 0); ret.setFields(this); return ret; }