package caltool.view.schedule; import caltool.model.schedule.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; /**** * * Class OKScheduleTaskButtonListener 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 ScheduleTaskDialog view class. *

* Access to the model is for calling the scheduleTask method. Access to the * view is for gathering the data values that are sent to scheduleEvent. * */ public class OKScheduleTaskButtonListener implements ActionListener { /** * Construct this with the given Schedule model and parent dialog view. * Access to the model is for calling its ScheduleTask method. Access to * the parent view is for gathering date to be sent to Schedule. * ScheduleTask. */ public OKScheduleTaskButtonListener(Schedule schedule, ScheduleTaskDialog dialog) { this.schedule = schedule; this.dialog = dialog; } /** * Respond to a press of the OK button by calling ScheduleTask with a new * Task. The Task data are gathered from the JTextFields and other input * fields in the parent dialog. */ public void actionPerformed(ActionEvent e) { schedule.scheduleTask( new Task( /* dialog.getTitle(), dialog.getDueDate(), dialog.getEndDate(), dialog.getDueTime(), dialog.getCategory(), dialog.getRecurringInfo, dialog.getSecurity(), dialog.getPriority(), dialog.getRemindInfo(), dialog.getDetails() */ ) ); } /** The companion model */ protected Schedule schedule; /** The parent view */ protected ScheduleTaskDialog dialog; }