caltool.file_ui
Class FileMenu

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

public class FileMenu
extends mvp.View

Class FileMenu is the pulldown menu view of the model class. The FileMenu widget is a Java JMenu. Anonymous instances of JMenuItem are defined for each item in the menu.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class mvp.View
closeAdapter, editable, model, screen, shown, widget, window
 
Constructor Summary
FileMenu(mvp.Screen screen, File file, FileUI fileUI)
          Construct this with the given File model.
 
Method Summary
protected  void addCloseAllItem()
          Add the 'Close All menu item.
protected  void addCloseItem()
          Add the 'Close' menu item.
protected  void addExitItem()
          Add the 'Exit' menu item.
protected  void addLoadSettingsItem()
          Add the 'Load Settings' menu item.
protected  void addNewItem()
          Add the 'New' menu item.
protected  void addOpenItem()
          Add the 'Open ...' menu item.
protected  void addPageSetupItem()
          Add the 'Page Setup ...' menu item.
protected  void addPrintItem()
          Add the 'Print ...' menu item.
protected  void addSaveAllItem()
          Add the 'Save All' menu item.
protected  void addSaveAsItem()
          Add the 'Save As ...' menu item.
protected  void addSaveItem()
          Add the 'Save' menu item.
protected  void addSaveSettingsItem()
          Add the 'Load Settings' menu item.
protected  void addSystemTestItems()
          Add menu items to perform any system tests that may be useful during development.
 java.awt.Component compose()
          Compose this by inserting each of its nine menu items into the pulldown menu.
 
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
 

Constructor Detail

FileMenu

public FileMenu(mvp.Screen screen,
                File file,
                FileUI fileUI)
Construct this with the given File model.

Method Detail

compose

public java.awt.Component compose()
Compose this by inserting each of its nine menu items into the pulldown menu. The items are New, Open, Close, Close All, Save, Save As, Save All, Print, and Exit. JSeparators are placed after the 'Close All', 'Save All', and 'Print' items.

Overrides:
compose in class mvp.View

addNewItem

protected void addNewItem()
Add the 'New' menu item. Its action listener invokes the File.fileNew method. This and all other menu items are created using the following pattern:
     JMenu.add(new JMenuItem("Item name")).addActionListener(
         new ActionListener() {
         public void actionPerformed(ActionEvent e) {
             Model.method()
                                                                   


addOpenItem

protected void addOpenItem()
Add the 'Open ...' menu item. Its action listener invokes the File.open method. See the description of the addNewItem method for further info.


addCloseItem

protected void addCloseItem()
Add the 'Close' menu item. Its action listener invokes the File.close method. See the description of the addNewItem method for further info.


addCloseAllItem

protected void addCloseAllItem()
Add the 'Close All menu item. Its action listener invokes the File.closeAll method. See the description of the addNewItem method for further info.


addSaveItem

protected void addSaveItem()
Add the 'Save' menu item. Its action listener invokes the File.save method. See the description of the addNewItem method for further info.


addSaveAsItem

protected void addSaveAsItem()
Add the 'Save As ...' menu item. Its action listener displays a file chooser to select the file on which to save, then invokes the File.saveAs method. See the description of the addNewItem method for further info.


addSaveAllItem

protected void addSaveAllItem()
Add the 'Save All' menu item. Its action listener invokes the File.saveAll method. See the description of the addNewItem method for further info.


addLoadSettingsItem

protected void addLoadSettingsItem()
Add the 'Load Settings' menu item. Its action listener displays a load settings dialog, from which the File.loadSettings method is invoked. See the description of the addNewItem method for further info.


addSaveSettingsItem

protected void addSaveSettingsItem()
Add the 'Load Settings' menu item. Its action listener displays a save settings dialog, from which the File.saveSettings method is invoked. FileMenu.html#addNewItem> addNewItem method for further info.


addPageSetupItem

protected void addPageSetupItem()
Add the 'Page Setup ...' menu item. Its action listener displays a Page Setup dialog, from which the File.pageSetup method is invoked. See the description of the addNewItem method for further info.


addPrintItem

protected void addPrintItem()
Add the 'Print ...' menu item. Its action listener invokes the File.print method. See the description of the addNewItem method for further info.


addExitItem

protected void addExitItem()
Add the 'Exit' menu item. Its action listener invokes the File.exit method. See the description of the addNewItem method for further info.


addSystemTestItems

protected void addSystemTestItems()
Add menu items to perform any system tests that may be useful during development. This submenu goes away in the production version of the system.