caltool.schedule_ui
Class ScheduleAppointmentDialog

java.lang.Object
  extended by mvp.View
      extended by caltool.caltool_ui.CalendarToolWindow
          extended by caltool.schedule_ui.ScheduleAppointmentDialog
All Implemented Interfaces:
java.io.Serializable, java.util.Observer
Direct Known Subclasses:
AppointmentEditor, ConfirmMeetingDialog, ScheduleMeetingDialog, ScheduleTaskDialog

public class ScheduleAppointmentDialog
extends CalendarToolWindow

Class ScheduleAppointmentDialog provides a view of Appointment as an input to the scheduleAppointment method. Hence, the dialog is a view of both an Appointment object as well as the scheduleAppointment method. The data-entry components of the dialog constitute the Appointment view. The 'OK' button is the view of the ScheduleAppointment method.

The data components consist of JLabels, JTextFields, JComboBoxes, JCheckBoxes, and a JTextArea. The 'OK', 'Clear', and 'Cancel' buttons are JButtons. The description of the compose method has details of how the components are laid out in the dialog window.

For organizational clarity, two of the rows in the ScheduleAppointment Dialog are defined in separate classes. These are the RecurringInfoSubdialog and RemindInfoSubdialog classes.

The companion model for ScheduleAppointmentDialog is the Schedule class, since Schedule has the method that is invoked from the 'OK' button action listener. See class OKScheduleAppointmentButtonListener for details of how the Schedule.scheduleAppointment method is invoked.

See Also:
Serialized Form

Field Summary
protected  javax.swing.JComboBox categoryComboBox
          The category combo box
protected  javax.swing.JTextArea detailsTextArea
          The details text area
protected  javax.swing.JTextField durationTextField
          The start time text field
protected  javax.swing.JLabel endDateLabel
          The end date label.
protected  javax.swing.JTextField endDateTextField
          The end date text field
protected  javax.swing.JComboBox locationComboBox
          The location combo box
protected  double maxComponentHeight
          The max height of a text field or combobox; this is necessary since these components stretch when the outer frame is resized, and look very funky when they do
protected  int maxComponentWidth
          The max width of any component; this is only necessary because the max height cannot be set separately, so we must pick some max width.
protected  javax.swing.JPanel panel
          The background panel of this
protected  javax.swing.JComboBox priorityComboBox
          The priority combo box
protected  RecurringInfoSubdialog recurringInfo
          Subview for recurring info
protected  RemindInfoSubdialog remindInfo
          Subview for recurring info
protected  javax.swing.JComboBox securityComboBox
          The security combo box
protected  javax.swing.JLabel startDateLabel
          The (start) date label.
protected  javax.swing.JTextField startDateTextField
          The (start) date text field
protected  javax.swing.JTextField startTimeTextField
          The start time text field.
protected  javax.swing.JTextField titleTextField
          The title text field
 
Fields inherited from class caltool.caltool_ui.CalendarToolWindow
calToolUI
 
Fields inherited from class mvp.View
closeAdapter, editable, model, screen, shown, widget, window
 
Constructor Summary
ScheduleAppointmentDialog(mvp.Screen screen, Schedule schedule, CalendarToolUI calToolUI)
          Construct this with the given Schedule as companion model.
 
Method Summary
protected  void clear()
          Clear each of the text fields of this to empty.
 java.awt.Component compose()
          Compose this in six parts: (1) a top part consisting of the title, date, end date, start time, and duration components; (2) a part consisting of recurring info components; (3) a middle part with category, location, security, and priority; (4) reminder info components; (5) details components; (6) the bottom row consisting of the 'OK', 'Clear', and 'Cancel' buttons.
protected  javax.swing.Box composeButtonRow()
          Compose the buttons row with three JButtons.
protected  javax.swing.Box composeCategorySecurityRow()
          Compose the category/seurity row using two pairs of labels and text fields.
protected  javax.swing.Box composeDetails()
          Compose the details area as a labeled, scrolling text area.
protected  javax.swing.Box composeEndDateRow()
          Compose the end date row using two pairs of labels and text fields.
protected  javax.swing.Box composeLocationPriorityRow()
          Compose the location/priority row using two pairs of labels and text fields.
protected  javax.swing.Box composeMiddlePart()
          Compose the middle part of the dialog, consisting of the category, location, security, and priority.
protected  java.awt.Component composeRecurringInfo()
          Have the recurring info subdialog compose itself.
protected  java.awt.Component composeRemindInfo()
          Have the remind info subdialog compose itself.
protected  void composeRows()
          Compose each of the rows and add to the vertically laid out panel.
protected  javax.swing.Box composeStartDateRow()
          Compose the start date row using two pairs of labels and text fields.
protected  javax.swing.Box composeTitleRow()
          Compose the title row as an hbox with label and text field.
protected  javax.swing.Box composeTopPart()
          Compose the top part of the dialog, consisting of the title, date, start time, end date, and duration.
 
Methods inherited from class caltool.caltool_ui.CalendarToolWindow
show
 
Methods inherited from class mvp.View
getModel, getWidget, getWindow, hide, isEditable, isShown, run, setEditable, setExitOnClose, setModel, show, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

panel

protected javax.swing.JPanel panel
The background panel of this


titleTextField

protected javax.swing.JTextField titleTextField
The title text field


startDateLabel

protected javax.swing.JLabel startDateLabel
The (start) date label. This needs to be a persistent data field since it changes from "Date" to "Start Date" for recurring appointments. Also, it has different text in the ScheduleMeetingDialog, subclass.


startDateTextField

protected javax.swing.JTextField startDateTextField
The (start) date text field


startTimeTextField

protected javax.swing.JTextField startTimeTextField
The start time text field.


endDateLabel

protected javax.swing.JLabel endDateLabel
The end date label. This needs to be a persistent data field since it's enabled or disabled depending on whether the appointment is recurring. Also, it has different text in the ScheduleMeetingDialog, subclass.


endDateTextField

protected javax.swing.JTextField endDateTextField
The end date text field


durationTextField

protected javax.swing.JTextField durationTextField
The start time text field


recurringInfo

protected RecurringInfoSubdialog recurringInfo
Subview for recurring info


categoryComboBox

protected javax.swing.JComboBox categoryComboBox
The category combo box


securityComboBox

protected javax.swing.JComboBox securityComboBox
The security combo box


locationComboBox

protected javax.swing.JComboBox locationComboBox
The location combo box


priorityComboBox

protected javax.swing.JComboBox priorityComboBox
The priority combo box


remindInfo

protected RemindInfoSubdialog remindInfo
Subview for recurring info


detailsTextArea

protected javax.swing.JTextArea detailsTextArea
The details text area


maxComponentHeight

protected final double maxComponentHeight
The max height of a text field or combobox; this is necessary since these components stretch when the outer frame is resized, and look very funky when they do


maxComponentWidth

protected final int maxComponentWidth
The max width of any component; this is only necessary because the max height cannot be set separately, so we must pick some max width.

Constructor Detail

ScheduleAppointmentDialog

public ScheduleAppointmentDialog(mvp.Screen screen,
                                 Schedule schedule,
                                 CalendarToolUI calToolUI)
Construct this with the given Schedule as companion model. Construct the two subviews for recurring info and reminder info.

Method Detail

compose

public java.awt.Component compose()
Compose this in six parts: (1) a top part consisting of the title, date, end date, start time, and duration components; (2) a part consisting of recurring info components; (3) a middle part with category, location, security, and priority; (4) reminder info components; (5) details components; (6) the bottom row consisting of the 'OK', 'Clear', and 'Cancel' buttons.

Overrides:
compose in class mvp.View

composeRows

protected void composeRows()
Compose each of the rows and add to the vertically laid out panel. Put some around spacing between each row, in the form of a vertical strut.


composeTopPart

protected javax.swing.Box composeTopPart()
Compose the top part of the dialog, consisting of the title, date, start time, end date, and duration. The components are laid out in a three-row vertical box. The title row is on top; it is composed as a horizontal box containing a JLabel and JTextField. The second row of top-part components is a horizontal box, composed in turn of two horizontal boxes containing JLabel/JTextField pairs for the date and start time. The third row consists of a JLabel/JTextField pairs for the end date and the duration. The duration is in turn a horizontal box consisting of a JLabel, and two vertical box JLabel/JTextField pairs for the hour and minute components of the duration.


composeTitleRow

protected javax.swing.Box composeTitleRow()
Compose the title row as an hbox with label and text field.


composeStartDateRow

protected javax.swing.Box composeStartDateRow()
Compose the start date row using two pairs of labels and text fields. Cf. ScheduleEventDialg.composeStartAndEndDateRow .


composeEndDateRow

protected javax.swing.Box composeEndDateRow()
Compose the end date row using two pairs of labels and text fields.


composeRecurringInfo

protected java.awt.Component composeRecurringInfo()
Have the recurring info subdialog compose itself.


composeMiddlePart

protected javax.swing.Box composeMiddlePart()
Compose the middle part of the dialog, consisting of the category, location, security, and priority. The category and security are combo boxes, laid out in a horizontal box. Location and priority are also combo boxes in a horizontal box. Location is editable. See the description of composeTopPart for a more detailed description of component layout.


composeCategorySecurityRow

protected javax.swing.Box composeCategorySecurityRow()
Compose the category/seurity row using two pairs of labels and text fields.


composeLocationPriorityRow

protected javax.swing.Box composeLocationPriorityRow()
Compose the location/priority row using two pairs of labels and text fields.


composeRemindInfo

protected java.awt.Component composeRemindInfo()
Have the remind info subdialog compose itself.


composeDetails

protected javax.swing.Box composeDetails()
Compose the details area as a labeled, scrolling text area. The label and the text area are in a left-aligned vbox. The vbox is in a hbox with horizontal spacing on each side


composeButtonRow

protected javax.swing.Box composeButtonRow()
Compose the buttons row with three JButtons. The action listeners for Clear and Cancel buttons are straightforward. The action listener for the OK button is responsible for communication with the Schedule model. See the description of OKScheduleAppointmentButtonListener for explanatory details.


clear

protected void clear()
Clear each of the text fields of this to empty. Reset the combo box to no selection. NOTE: This method needs to be refined to use default values for clearing, once options and defaults functionality is implemented. It also needs to be refined to clear the recurring and remind check boxes and associated components.