caltool.schedule_ui
Class ScheduleEventDialog

java.lang.Object
  extended by mvp.View
      extended by caltool.caltool_ui.CalendarToolWindow
          extended by caltool.schedule_ui.ScheduleEventDialog
All Implemented Interfaces:
java.io.Serializable, java.util.Observer
Direct Known Subclasses:
EventEditor

public class ScheduleEventDialog
extends CalendarToolWindow

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

The data components consist of JLabels, JTextFields, and a JComboBox. 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.

The companion model for ScheduleEventDialog is the Schedule class, since Schedule has the method that is invoked from the 'OK' button action listener. See class OKScheduleEventButtonListener.html for details of how the Schedule.scheduleEvent method is invoked.

See Also:
Serialized Form

Field Summary
protected  javax.swing.JComboBox categoryComboBox
          The Categories combo box
protected  javax.swing.JTextField endDateTextField
          The end date text field
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 securityComboBox
          The security text field
protected  javax.swing.JTextField startDateTextField
          The start date 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
ScheduleEventDialog(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 as a vertical Box of four rows.
protected  javax.swing.Box composeButtonRow()
          Compose the buttons row with three JButtons.
protected  javax.swing.Box composeCategoryAndSecurityRow()
          Compose the category/security row using a JComboBox and JTextField, with JLabels next to each.
protected  javax.swing.Box composeStartAndEndDateRow()
          Compose the start/end date row using two pairs of JLabel and JTextField.
protected  javax.swing.Box composeTitleRow()
          Compose the title row using a JLabel and JTextField.
 void displayErrors(ScheduleEventPrecondViolation errors)
          Display the error messages in the given exception object in a modal pop-up window.
 Category getCategory()
          Return selected category as a Category value.
 Date getEndDate()
          Return the end date as a Date value.
 SimpleSecurity getSecurity()
          Return the security as a simple security value.
 Date getStartDate()
          Return the start date as a Date value.
 java.lang.String getTitle()
          Return the title as a string.
 
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


startDateTextField

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


endDateTextField

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


categoryComboBox

protected javax.swing.JComboBox categoryComboBox
The Categories combo box


securityComboBox

protected javax.swing.JComboBox securityComboBox
The security text field


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

ScheduleEventDialog

public ScheduleEventDialog(mvp.Screen screen,
                           Schedule schedule,
                           CalendarToolUI calToolUI)
Construct this with the given Schedule as companion model.

Method Detail

compose

public java.awt.Component compose()
Compose this as a vertical Box of four rows. Each row is a horizontal Box. The first row contains a labeled text field for the event title. The second row has labeled text fields for the start and end dates. The third row has a labeled combo box for the category selection and a labeled combol box for the event security. Finally, the fourth row has the 'OK', 'Clear', and 'Cancel' buttons.

Vertical and horizontal struts are used for spacing among all of the components.

Overrides:
compose in class mvp.View

getTitle

public java.lang.String getTitle()
Return the title as a string.


getStartDate

public Date getStartDate()
Return the start date as a Date value. Note that the Date model class does the parsing.


getEndDate

public Date getEndDate()
Return the end date as a Date value. Note that the Date model class does the parsing.


getCategory

public Category getCategory()
Return selected category as a Category value. does the parsing.


getSecurity

public SimpleSecurity getSecurity()
Return the security as a simple security value.


displayErrors

public void displayErrors(ScheduleEventPrecondViolation errors)
Display the error messages in the given exception object in a modal pop-up window.


composeTitleRow

protected javax.swing.Box composeTitleRow()
Compose the title row using a JLabel and JTextField.


composeStartAndEndDateRow

protected javax.swing.Box composeStartAndEndDateRow()
Compose the start/end date row using two pairs of JLabel and JTextField.


composeCategoryAndSecurityRow

protected javax.swing.Box composeCategoryAndSecurityRow()
Compose the category/security row using a JComboBox and JTextField, with JLabels next to each.


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 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.