Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

com.arcle.rmt.j2se.swing.AbstractMainWindow Class Reference

A main entry point useable both as an applet and a swing application. More...

Inheritance diagram for com.arcle.rmt.j2se.swing.AbstractMainWindow:

com.arcle.rmt.j2se.swing.Main List of all members.

Public Member Functions

void init ()
void start ()
void stop ()
void destroy ()
void update (Observable source, Object param)
boolean isDirty ()

Protected Member Functions

void cmFileNew ()
 Handles user command to create a new, blank document.

void cmFileOpen ()
 Handles user command to open a file from disk.

void cmFileSave ()
 Handles user command to save the currently active document to disk.

void cmFileSaveAs ()
 Handles user command to save the currently active document as a new file on disk.

void cmFileRevert ()
 Handles user command to revert the document to the last-saved version.

void cmFileExit ()
 Handles user command to exit the application and/or closes the main window.

abstract void doNewDocument ()
 

void doSaveDocument ()
 

void doOpenDocument ()
 

boolean doAskSave ()
 Checks whether the document is modified and asks the user to save it.

void doExit ()
 

void updateTitle ()
void showException (Exception e)
 Displays a dialog window showing an exception's exception stack trace.

void initMenu ()
 Creates and initializes the main menu bar.

void initFileMenu (JMenu file)
 Initialize the "File" menu.

void initRequirementMenu (JMenu reqMenu)
 Initialize the "requirement" menu.

void initHelpMenu (JMenu help)
 Initialize the "Help" menu.

void initToolsMenu (JMenu tools)
 Initialize the "tools" menu.

void runAsApplication (String[] args)
 Runs this class as a Java application instead of an applet.

AbstractDesktop getDesktop ()
 Returns the main "desktop".

void setDirty (boolean d)
Document getDocument ()
 Returns the current ocument.

void setDocument (Document d)
 Sets the current document.

void setDocumentFile (File f)
 Sets the current document file.

File getDocumentFile ()
JFileChooser getFileChooser ()
Map getFileHandlers ()
 Returns a map of (FileFilter, FileHandler) objects.

abstract FileHandler getDefaultFileHandler ()
 Returns the default file handler object.

Collection getFileFilters ()
 Returns the FileFilter objects used in the open and save file dialogs.

FileHandler getCurrentFileHandler ()
 Returns the last-selected file handler.

abstract AbstractDesktop createDesktop ()
 Abstract factory method that will create the "desktop" component.

abstract Collection createFileHandlers ()
 Abstract factory method used to create the available file handler objects.

Frame createApplicationFrame (Component content)
 Factory method that creates and configures the main Frame window when run as a Java standalone application.

JFileChooser createFileChooser ()
 Creates the file chooser object used to open and save files.

JMenuBar createMenuBar ()
 Creates a menu bar for use in this component.

JMenu createMenu ()
 

JMenuItem createMenuItem ()
 

JMenuItem createMenuItem (final Action action)
 

Action createActionWrapper (Action wrapped)
 

Action createFileNewAction ()
 

Action createFileOpenAction ()
 

Action createFileSaveAction ()
 

Action createFileSaveAsAction ()
 

Action createFileRevertAction ()
 

Action createFileExitAction ()
 

Action createHelpAboutAction ()
 


Static Protected Attributes

final String APPLICATION_TITLE = "Rambutan Desktop"
 The application title.

final String FILE_UNMODIFIED = "(Unmodified)"
final String FILE_UNTITILED = " -untitled- "

Private Attributes

AbstractDesktop _desktop = null
boolean dirty = false
 Whether the document has been modified.

Document document = null
File documentFile = null
Frame applicationFrame = null
 The main frame window when run as an application.

JFileChooser _fileChooser = null
 The file chooser dialog.

Map _fileHandlers = null
 Contains (FileFilter, FileHandler) mappings.


Detailed Description

A main entry point useable both as an applet and a swing application.

Author:
Sasmito Adibowo
Version:
Id
AbstractMainWindow.java,v 1.14 2003/05/19 10:08:10 adib Exp

Definition at line 99 of file AbstractMainWindow.java.


Member Function Documentation

void com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileExit  )  [protected]
 

Handles user command to exit the application and/or closes the main window.

This template method checks whether the document is unsaved, saves it if the user desires to do so, and quits the application.

Definition at line 236 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.doAskSave(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.doExit().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileNew  )  [protected]
 

Handles user command to create a new, blank document.

This command handler is a template method that prior to blank-ing the current document, checks whether it is modified and provides an opportunity to the user to save it.

Definition at line 110 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.doAskSave(), com.arcle.rmt.j2se.swing.AbstractMainWindow.doNewDocument(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.updateTitle().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileOpen  )  [protected]
 

Handles user command to open a file from disk.

This command handler is a template method which, prior to calling doOpenDocument, assures that the documentFile property is set to a correct file as specified by the user.

See also:
doOpenDocument

setDocumentFile

Definition at line 126 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.doOpenDocument(), com.arcle.rmt.j2se.swing.AbstractMainWindow.getCurrentFileHandler(), com.arcle.rmt.j2se.swing.AbstractMainWindow.getFileChooser(), com.arcle.rmt.j2se.swing.AbstractMainWindow.setDocumentFile(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.updateTitle().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileRevert  )  [protected]
 

Handles user command to revert the document to the last-saved version.

This template method simply calls doOpenDocument after asking confirmation from the user.

See also:
doOpenDocument()

Definition at line 207 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.doOpenDocument(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.getDocumentFile().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSave  )  [protected]
 

Handles user command to save the currently active document to disk.

This command handler is a template method that, prior to calling doSaveDocument, checks whether the documentFile is already been set and calls cmFileSaveAs if it isn't.

See also:
doSaveDocument()

cmFileSaveAs()

getDocumentFile()

Definition at line 159 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSaveAs(), com.arcle.rmt.j2se.swing.AbstractMainWindow.doSaveDocument(), com.arcle.rmt.j2se.swing.AbstractMainWindow.getDocumentFile(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.updateTitle().

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.doAskSave().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSaveAs  )  [protected]
 

Handles user command to save the currently active document as a new file on disk.

This command handler is a template method similar to cmFileSave, except that it requires the user to select a file name. In fact, cmFileSave uses this method if the current document doesn't yet corresponds to a file on disk.

See also:
cmFileSave()

doSaveDocument()

Definition at line 177 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.doSaveDocument(), com.arcle.rmt.j2se.swing.AbstractMainWindow.getCurrentFileHandler(), com.arcle.rmt.j2se.swing.AbstractMainWindow.getFileChooser(), com.arcle.rmt.j2se.swing.AbstractMainWindow.setDocumentFile(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.updateTitle().

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSave().

Action com.arcle.rmt.j2se.swing.AbstractMainWindow.createActionWrapper Action  wrapped  )  [protected]
 

Definition at line 770 of file AbstractMainWindow.java.

Frame com.arcle.rmt.j2se.swing.AbstractMainWindow.createApplicationFrame Component  content  )  [protected]
 

Factory method that creates and configures the main Frame window when run as a Java standalone application.

Parameters:
content the contents of the frame.
Returns:
the new frame.

Definition at line 692 of file AbstractMainWindow.java.

abstract AbstractDesktop com.arcle.rmt.j2se.swing.AbstractMainWindow.createDesktop  )  [protected, pure virtual]
 

Abstract factory method that will create the "desktop" component.

Implemented in com.arcle.rmt.j2se.swing.Main.

JFileChooser com.arcle.rmt.j2se.swing.AbstractMainWindow.createFileChooser  )  [protected]
 

Creates the file chooser object used to open and save files.

Definition at line 720 of file AbstractMainWindow.java.

Action com.arcle.rmt.j2se.swing.AbstractMainWindow.createFileExitAction  )  [protected]
 

Definition at line 812 of file AbstractMainWindow.java.

abstract Collection com.arcle.rmt.j2se.swing.AbstractMainWindow.createFileHandlers  )  [protected, pure virtual]
 

Abstract factory method used to create the available file handler objects.

Returns:
a Collection of FileHandler instances.

Implemented in com.arcle.rmt.j2se.swing.Main.

Action com.arcle.rmt.j2se.swing.AbstractMainWindow.createFileNewAction  )  [protected]
 

Definition at line 777 of file AbstractMainWindow.java.

Action com.arcle.rmt.j2se.swing.AbstractMainWindow.createFileOpenAction  )  [protected]
 

Definition at line 784 of file AbstractMainWindow.java.

Action com.arcle.rmt.j2se.swing.AbstractMainWindow.createFileRevertAction  )  [protected]
 

Definition at line 805 of file AbstractMainWindow.java.

Action com.arcle.rmt.j2se.swing.AbstractMainWindow.createFileSaveAction  )  [protected]
 

Definition at line 791 of file AbstractMainWindow.java.

Action com.arcle.rmt.j2se.swing.AbstractMainWindow.createFileSaveAsAction  )  [protected]
 

Definition at line 798 of file AbstractMainWindow.java.

Action com.arcle.rmt.j2se.swing.AbstractMainWindow.createHelpAboutAction  )  [protected]
 

Definition at line 819 of file AbstractMainWindow.java.

JMenu com.arcle.rmt.j2se.swing.AbstractMainWindow.createMenu  )  [protected]
 

Definition at line 745 of file AbstractMainWindow.java.

JMenuBar com.arcle.rmt.j2se.swing.AbstractMainWindow.createMenuBar  )  [protected]
 

Creates a menu bar for use in this component.

Definition at line 738 of file AbstractMainWindow.java.

JMenuItem com.arcle.rmt.j2se.swing.AbstractMainWindow.createMenuItem final Action  action  )  [protected]
 

Definition at line 759 of file AbstractMainWindow.java.

JMenuItem com.arcle.rmt.j2se.swing.AbstractMainWindow.createMenuItem  )  [protected]
 

Definition at line 752 of file AbstractMainWindow.java.

void com.arcle.rmt.j2se.swing.AbstractMainWindow.destroy  ) 
 

Definition at line 384 of file AbstractMainWindow.java.

boolean com.arcle.rmt.j2se.swing.AbstractMainWindow.doAskSave  )  [protected]
 

Checks whether the document is modified and asks the user to save it.

Returns:
When true, the caller should proceed operation. When false, it should return immediately.

Definition at line 300 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSave(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.isDirty().

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileExit(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileNew().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.doExit  )  [protected]
 

Todo:
How to exit from an applet?

Definition at line 328 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.applicationFrame.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileExit().

abstract void com.arcle.rmt.j2se.swing.AbstractMainWindow.doNewDocument  )  [protected, pure virtual]
 

Implemented in com.arcle.rmt.j2se.swing.Main.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileNew().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.doOpenDocument  )  [protected]
 

Definition at line 275 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.getCurrentFileHandler(), com.arcle.rmt.j2se.swing.AbstractMainWindow.getDocumentFile(), com.arcle.rmt.j2se.swing.AbstractMainWindow.FileHandler.openFile(), com.arcle.rmt.j2se.swing.AbstractMainWindow.setDirty(), com.arcle.rmt.j2se.swing.AbstractMainWindow.setDocument(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.showException().

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileOpen(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileRevert().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.doSaveDocument  )  [protected]
 

Definition at line 254 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.getCurrentFileHandler(), com.arcle.rmt.j2se.swing.AbstractMainWindow.getDocument(), com.arcle.rmt.j2se.swing.AbstractMainWindow.getDocumentFile(), com.arcle.rmt.j2se.swing.AbstractMainWindow.FileHandler.saveFile(), com.arcle.rmt.j2se.swing.AbstractMainWindow.setDirty(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.showException().

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSave(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSaveAs().

FileHandler com.arcle.rmt.j2se.swing.AbstractMainWindow.getCurrentFileHandler  )  [protected]
 

Returns the last-selected file handler.

Definition at line 663 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileOpen(), com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSaveAs(), com.arcle.rmt.j2se.swing.AbstractMainWindow.doOpenDocument(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.doSaveDocument().

abstract FileHandler com.arcle.rmt.j2se.swing.AbstractMainWindow.getDefaultFileHandler  )  [protected, pure virtual]
 

Returns the default file handler object.

Implemented in com.arcle.rmt.j2se.swing.Main.

AbstractDesktop com.arcle.rmt.j2se.swing.AbstractMainWindow.getDesktop  )  [protected]
 

Returns the main "desktop".

Definition at line 556 of file AbstractMainWindow.java.

Document com.arcle.rmt.j2se.swing.AbstractMainWindow.getDocument  )  [protected]
 

Returns the current ocument.

Definition at line 584 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.doSaveDocument().

File com.arcle.rmt.j2se.swing.AbstractMainWindow.getDocumentFile  )  [protected]
 

Definition at line 615 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileRevert(), com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSave(), com.arcle.rmt.j2se.swing.AbstractMainWindow.doOpenDocument(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.doSaveDocument().

JFileChooser com.arcle.rmt.j2se.swing.AbstractMainWindow.getFileChooser  )  [protected]
 

Definition at line 619 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileOpen(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSaveAs().

Collection com.arcle.rmt.j2se.swing.AbstractMainWindow.getFileFilters  )  [protected]
 

Returns the FileFilter objects used in the open and save file dialogs.

Returns:
a Collection of FileFilter object.

Definition at line 655 of file AbstractMainWindow.java.

Map com.arcle.rmt.j2se.swing.AbstractMainWindow.getFileHandlers  )  [protected]
 

Returns a map of (FileFilter, FileHandler) objects.

Definition at line 630 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.FileHandler.getFileFilter().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.init  ) 
 

Definition at line 347 of file AbstractMainWindow.java.

void com.arcle.rmt.j2se.swing.AbstractMainWindow.initFileMenu JMenu  file  )  [protected]
 

Initialize the "File" menu.

Definition at line 466 of file AbstractMainWindow.java.

void com.arcle.rmt.j2se.swing.AbstractMainWindow.initHelpMenu JMenu  help  )  [protected]
 

Initialize the "Help" menu.

Definition at line 491 of file AbstractMainWindow.java.

void com.arcle.rmt.j2se.swing.AbstractMainWindow.initMenu  )  [protected]
 

Creates and initializes the main menu bar.

Definition at line 429 of file AbstractMainWindow.java.

void com.arcle.rmt.j2se.swing.AbstractMainWindow.initRequirementMenu JMenu  reqMenu  )  [protected]
 

Initialize the "requirement" menu.

Definition at line 481 of file AbstractMainWindow.java.

void com.arcle.rmt.j2se.swing.AbstractMainWindow.initToolsMenu JMenu  tools  )  [protected]
 

Initialize the "tools" menu.

Definition at line 498 of file AbstractMainWindow.java.

boolean com.arcle.rmt.j2se.swing.AbstractMainWindow.isDirty  ) 
 

Definition at line 565 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.doAskSave().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.runAsApplication String[]  args  )  [protected]
 

Runs this class as a Java application instead of an applet.

Definition at line 528 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.AbstractMainWindow.start().

Referenced by com.arcle.rmt.j2se.swing.Main.main().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.setDirty boolean  d  )  [protected]
 

Definition at line 572 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.Main.doNewDocument(), com.arcle.rmt.j2se.swing.AbstractMainWindow.doOpenDocument(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.doSaveDocument().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.setDocument Document  d  )  [protected]
 

Sets the current document.

Definition at line 591 of file AbstractMainWindow.java.

References com.arcle.rmt.j2se.swing.vc.AbstractDesktop.setDocument().

Referenced by com.arcle.rmt.j2se.swing.Main.doNewDocument(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.doOpenDocument().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.setDocumentFile File  f  )  [protected]
 

Sets the current document file.

Definition at line 609 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileOpen(), com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSaveAs(), and com.arcle.rmt.j2se.swing.Main.doNewDocument().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.showException Exception  e  )  [protected]
 

Displays a dialog window showing an exception's exception stack trace.

Parameters:
e the exception to display.

Definition at line 418 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.Main.doNewDocument(), com.arcle.rmt.j2se.swing.AbstractMainWindow.doOpenDocument(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.doSaveDocument().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.start  ) 
 

Definition at line 371 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.runAsApplication().

void com.arcle.rmt.j2se.swing.AbstractMainWindow.stop  ) 
 

Definition at line 382 of file AbstractMainWindow.java.

void com.arcle.rmt.j2se.swing.AbstractMainWindow.update Observable  source,
Object  param
 

Definition at line 389 of file AbstractMainWindow.java.

void com.arcle.rmt.j2se.swing.AbstractMainWindow.updateTitle  )  [protected]
 

Definition at line 404 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileNew(), com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileOpen(), com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSave(), and com.arcle.rmt.j2se.swing.AbstractMainWindow.cmFileSaveAs().


Member Data Documentation

AbstractDesktop com.arcle.rmt.j2se.swing.AbstractMainWindow._desktop = null [private]
 

Definition at line 826 of file AbstractMainWindow.java.

JFileChooser com.arcle.rmt.j2se.swing.AbstractMainWindow._fileChooser = null [private]
 

The file chooser dialog.

Definition at line 850 of file AbstractMainWindow.java.

Map com.arcle.rmt.j2se.swing.AbstractMainWindow._fileHandlers = null [private]
 

Contains (FileFilter, FileHandler) mappings.

Definition at line 855 of file AbstractMainWindow.java.

final String com.arcle.rmt.j2se.swing.AbstractMainWindow.APPLICATION_TITLE = "Rambutan Desktop" [static, protected]
 

The application title.

Definition at line 860 of file AbstractMainWindow.java.

Frame com.arcle.rmt.j2se.swing.AbstractMainWindow.applicationFrame = null [private]
 

The main frame window when run as an application.

Definition at line 845 of file AbstractMainWindow.java.

Referenced by com.arcle.rmt.j2se.swing.AbstractMainWindow.doExit().

boolean com.arcle.rmt.j2se.swing.AbstractMainWindow.dirty = false [private]
 

Whether the document has been modified.

Definition at line 831 of file AbstractMainWindow.java.

Document com.arcle.rmt.j2se.swing.AbstractMainWindow.document = null [private]
 

Definition at line 836 of file AbstractMainWindow.java.

File com.arcle.rmt.j2se.swing.AbstractMainWindow.documentFile = null [private]
 

Definition at line 840 of file AbstractMainWindow.java.

final String com.arcle.rmt.j2se.swing.AbstractMainWindow.FILE_UNMODIFIED = "(Unmodified)" [static, protected]
 

Definition at line 865 of file AbstractMainWindow.java.

final String com.arcle.rmt.j2se.swing.AbstractMainWindow.FILE_UNTITILED = " -untitled- " [static, protected]
 

Definition at line 867 of file AbstractMainWindow.java.


The documentation for this class was generated from the following file:
Generated on Fri Jun 18 19:53:05 2004 for Arcle Rambutan by doxygen 1.3.5