jdraw.file_ui
Class FileMenu

java.lang.Object
  |
  +--mvp.View
        |
        +--jdraw.file_ui.FileMenu
All Implemented Interfaces:
java.util.Observer

public class FileMenu
extends mvp.View

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


Field Summary
protected  File file
          A local reference to the File model.
protected  javax.swing.JFileChooser fileChooser
          A File Chooser for Opening, Saving files
protected  FileFilter fileFilter
          A instance of FileFilter to filter file selection.
 
Fields inherited from class mvp.View
editable, model, screen, shown, widget, window
 
Constructor Summary
FileMenu(mvp.Screen screen, File file, FileUI fileUI)
          Construct the menu with the given File model.
 
Method Summary
protected  void addClose()
          Add the 'Close' menu item.
protected  void addExit()
          Add the 'Exit' menu item.
protected  void addNew()
          Add the 'New' menu item.
protected  void addOpen()
          Add the 'Open' menu item.
protected  void addPrint()
          Add the 'Print' menu item.
protected  void addRevert()
          Add the 'Revert' menu item.
protected  void addSave()
          Add the 'Save' menu item.
protected  void addSaveAs()
          Add the 'Save As ...' menu item.
 java.awt.Component compose()
          Compose the menu items into the pulldown.
 java.lang.String getFileInput()
           
 
Methods inherited from class mvp.View
getModel, getWidget, getWindow, hide, isEditable, isShown, run, setEditable, setModel, show, show, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected File file
A local reference to the File model.

fileFilter

protected FileFilter fileFilter
A instance of FileFilter to filter file selection.

fileChooser

protected javax.swing.JFileChooser fileChooser
A File Chooser for Opening, Saving files
Constructor Detail

FileMenu

public FileMenu(mvp.Screen screen,
                File file,
                FileUI fileUI)
Construct the menu with the given File model.
Parameters:
screen - - The Screen object on which to add the menu.
file - - The companion model object.
fileUI - - The companion view object.
Method Detail

compose

public java.awt.Component compose()
Compose the menu items into the pulldown. Separator added after 'Revert' and 'Close'.
Overrides:
compose in class mvp.View

addNew

protected void addNew()
Add the 'New' menu item. Invokes File.fileNew method.

addRevert

protected void addRevert()
Add the 'Revert' menu item. Invokes File.revert method.

addOpen

protected void addOpen()
Add the 'Open' menu item. Invokes file.open method.

addSave

protected void addSave()
Add the 'Save' menu item. Invokes file.save method.

getFileInput

public java.lang.String getFileInput()

addSaveAs

protected void addSaveAs()
Add the 'Save As ...' menu item. Invokes File.saveAs method.

addClose

protected void addClose()
Add the 'Close' menu item. Invokes File.close method.

addPrint

protected void addPrint()
Add the 'Print' menu item. Invokes file.print method.

addExit

protected void addExit()
Add the 'Exit' menu item. Invokes File.exit method.