package caltool.view.schedule; import caltool.model.schedule.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; /**** * * Class ChangeAppointmentButtonListener defines the action listener that is * attached to the Change button in the appointment editor. When the class is * constructed, it is passed references to the classes that need to be accessed * in the actionPerformed method. In this case, the required classes are the * Schedule model class and the ScheduleAppointmentDialog view class. *

* Access to the model is for calling the changeAppointment method. Access to * the view is for gathering the data values that are sent to * changeAppointment. * */ public class ChangeAppointmentButtonListener implements ActionListener { /** * Construct this with the given Schedule model and parent dialog view. */ public ChangeAppointmentButtonListener(Schedule schedule, ScheduleAppointmentDialog dialog) { this.schedule = schedule; this.dialog = dialog; } /** * Respond to a press of the OK button by calling ScheduleAppointment with * a new Appointment. The Appointment data are gathered from the * JTextFields and other input fields in the parent dialog. */ public void actionPerformed(ActionEvent e) { schedule.changeAppointment(null, null); } /** The companion model */ protected Schedule schedule; /** The parent view */ protected ScheduleAppointmentDialog dialog; }