caltool.caltool_ui
Class CalendarToolUI

java.lang.Object
  extended by mvp.View
      extended by caltool.caltool_ui.CalendarToolUI
All Implemented Interfaces:
java.io.Serializable, java.util.Observer

public class CalendarToolUI
extends mvp.View

Class CalendarToolUI is a companion view to the CalendarTool model class. The window component of the CalendarToolUI is a free-floating JMenuBar, containing JMenus for the pulldown command menus.

CalendarToolUI contains an instance of the view classes that are companion to each of the CalendarTool Model classes. Here is the correspondence:

     Model Class              Companion View Class
     -----------------------------------------------
     file.File                file_ui.FileUI
     edit.Edit                edit_ui.EditUI
     schedule.Schedule        schedule_ui.ScheduleUI
     view.View                view_ui.ViewUI
     admin.Admin              admin_ui.AdminUI
     options.Options          options_ui.OptionsUI
     help.Help                help_ui.HelpUI
                                                                       
Each of these view classes contains all of the interface components needed for UI access to their companion model's methods and data.

CalendarToolUI extends the abstract View class as follows. First, the constructor is sent a Screen and CalendarTool model. The screen and model inputs come from the top-level Main function, which calls the CalendarToolUI constructor. These inputs are passed up to the parent View constructor, which initializes the inherited screen and model data fields, respectively. The CalendarToolUI constructor then creates its own JMenuBar and calls the constructors for each of the component views. These component view constructors in turn call the constructors for their components, and so on until all interface components are constructed.

CalendarToolUI specializes the View.compose method to compose its own top-level window with the menubar. CalendarToolUI.compose then calls the compose methods for each of its component views, which in turn do their own composition, call their components' compose methods, and so on until all interface components are composed.

Displaywise, all of the subviews are autonomous units that are not controlled by the top-level CalendarToolUI. All that this top-level class does is construct and compose the menubar, construct and compose the subviews, and set up the initial display state.

See also the companion model class CalendarTool.

See Also:
Serialized Form

Field Summary
protected  AdminUI adminUI
          The pulldown Admin menu.
protected  EditUI editUI
          The pulldown Edit menu.
protected  FileUI fileUI
          The pulldown File menu.
protected  HelpUI helpUI
          The pulldown Help menu.
protected  javax.swing.JMenuBar menuBar
          The top-level menu bar.
protected  OptionsUI optionsUI
          The pulldown Options menu.
protected  ScheduleUI scheduleUI
          The pulldown Schedule menu.
protected  ViewUI viewUI
          The pulldown View menu.
 
Fields inherited from class mvp.View
closeAdapter, editable, model, screen, shown, widget, window
 
Constructor Summary
CalendarToolUI(mvp.Screen screen, CalendarTool calTool)
          Construct this with the given UI screen and CalendarTool model.
 
Method Summary
 java.awt.Component compose()
          Compose this by (1) creating a new window, (2) setting the window's menubar to this' menubar, (3) populating the menubar with the menus, (4) calling compose in turn for each menu, and (5) setting the window title.
protected  javax.swing.Box composeHelpSpacing()
          Compose a piece of horizontal spacing to be inserted between the options menu and the help menu in the menubar.
protected  void composeMenuBar()
          Compose this' menubar by adding each composed menu to it.
protected  void constructSubviews(CalendarToolUI this2)
          Call the constructor for each of the component views.
protected  void initialize()
          Configure the initial display based on the tool's option settings.
 
Methods inherited from class mvp.View
getModel, getWidget, getWindow, hide, isEditable, isShown, run, setEditable, setExitOnClose, setModel, show, show, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

menuBar

protected javax.swing.JMenuBar menuBar
The top-level menu bar.


fileUI

protected FileUI fileUI
The pulldown File menu.


editUI

protected EditUI editUI
The pulldown Edit menu.


scheduleUI

protected ScheduleUI scheduleUI
The pulldown Schedule menu.


viewUI

protected ViewUI viewUI
The pulldown View menu.


adminUI

protected AdminUI adminUI
The pulldown Admin menu.


optionsUI

protected OptionsUI optionsUI
The pulldown Options menu.


helpUI

protected HelpUI helpUI
The pulldown Help menu.

Constructor Detail

CalendarToolUI

public CalendarToolUI(mvp.Screen screen,
                      CalendarTool calTool)
Construct this with the given UI screen and CalendarTool model. Also construct the pulldown menu subviews and display the initial calendar view(s) based on the tool option settings.

Method Detail

compose

public java.awt.Component compose()
Compose this by (1) creating a new window, (2) setting the window's menubar to this' menubar, (3) populating the menubar with the menus, (4) calling compose in turn for each menu, and (5) setting the window title.

Since this is the top-level window, call setExitOnClose(true) to have a close of this window exit the entire application. This means that the companion model must implement the exit method to do the right thing.

Overrides:
compose in class mvp.View

constructSubviews

protected void constructSubviews(CalendarToolUI this2)
Call the constructor for each of the component views. Pass each constructor its companion model.


composeMenuBar

protected void composeMenuBar()
Compose this' menubar by adding each composed menu to it.


composeHelpSpacing

protected javax.swing.Box composeHelpSpacing()
Compose a piece of horizontal spacing to be inserted between the options menu and the help menu in the menubar.


initialize

protected void initialize()
Configure the initial display based on the tool's option settings. The standard default is to display a monthly view immediately below the menubar. This standard default can be changed by the user to other display windows, including no windows at all. Details TBD.