package caltool.view.schedule; import caltool.model.schedule.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; /**** * * Class OKScheduleAppointmentButtonListener defines the action listener that * is attached to the OK button in the schedule appointment dialog. 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 scheduleAppointment method. Access * to the view is for gathering the data values that are sent to * scheduleAppointment. * */ public class OKScheduleAppointmentButtonListener implements ActionListener { /** * Construct this with the given Schedule model and parent dialog view. */ public OKScheduleAppointmentButtonListener(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.scheduleAppointment( new Appointment( /* dialog.getTitle(), dialog.getStartDate(), dialog.getEndDate(), dialog.getStartTime(), dialog.getDuration(), dialog.getRecurringInfo, dialog.getCategory(), dialog.getLocation(), dialog.getSecurity(), dialog.getPriority(), dialog.getRemindInfo(), dialog.getDetails() */ ) ); } /** The companion model */ protected Schedule schedule; /** The parent view */ protected ScheduleAppointmentDialog dialog; }