gov.sns.application
Class ActionFactory

java.lang.Object
  |
  +--gov.sns.application.ActionFactory

public class ActionFactory
extends java.lang.Object

ActionFactory is a factory class with methods that can instantiate actions for use in menus and the toolbar. All of the actions are standard document-based application actions. In addition to actions, it also defines menu handlers that get invoked when a menu is activated. Typically it menu handlers are used to dynamically populate menus. For example there is "documents" submenu under the "Window" menu that populates itself upon selection with a list of menu items having one menu item for each open document.


Method Summary
static javax.swing.Action captureWindowAsImageAction(XalDocument document)
          Make an action that captures the main window corresponding to the document as a PNG image and allows the user to save it to a file.
protected static javax.swing.Action cascadeWindowsAction(XalDocument document)
          Cascade all document windows relative to the location of the window where the action was fired.
static javax.swing.Action closeAllDocumentsAction()
          Make an action that closes all documents in the application which leads to termination of the application.
static javax.swing.Action closeDocumentAction(XalDocument document)
          Make an action that closes the document where the from which the menu item was selected.
static javax.swing.event.MenuListener documentsHandler()
          Make a menu handler that updates the list of open documents that should appear in the documents submenu under the Window menu.
static javax.swing.Action editPreferencesAction(XalDocument document)
          Make an action for editing a preference panel.
static javax.swing.Action hideAllWindowsAction()
          Make an action taht hides all windows.
static javax.swing.Action newAction()
          Make an action that creates a new document in the application.
static javax.swing.Action openDocumentAction()
          Make an action that presents the user with an open file dialog.
static javax.swing.event.MenuListener openRecentHandler()
          Make a menu handler that is used to generate a list of recently opened files to be available under the "Open Recent" submenu of the "File" menu.
protected static javax.swing.Action openURLAction(java.lang.String urlSpec)
          Make an action that is used internally to open a file as specified by the given URL specification into a new document.
static javax.swing.Action pageSetupAction()
          Make an action that shows a standard page-setup dialog box for formatting printing.
static javax.swing.Action printAction(XalDocument document)
          Make an action that shows a standard page-setup dialog box for formatting printing.
static javax.swing.Action quitAction()
          Make an action for quitting the application.
static javax.swing.Action revertToSavedAction(XalDocument document)
          Make an action that reverts a document to its source disposing of any changes the user has made to the document.
static javax.swing.Action saveAllDocumentsAction()
          Make an action that saves all open documents.
static javax.swing.Action saveAsDocumentAction(XalDocument document)
          Make an action that presents the user with an save file dialog.
static javax.swing.Action saveDocumentAction(XalDocument document)
          Make an action that presents the user with an save file dialog for a new document or just save the present document to its existing file source if it is not new.
static javax.swing.Action showAboutBoxAction()
          Make an action that shows the about box which presents information about the application.
static javax.swing.Action showAllWindowsAction()
          Make an action that shows all of the open documents.
static javax.swing.Action showConsoleAction()
          Make an action that shows the console window.
protected static javax.swing.Action showDocumentAction(XalDocument document)
          Make an internal action used by the documentsHandler to show a specified document when that document is selected from the documents submenu.
static javax.swing.Action showHelpWindow()
          Make an action that shows the help window.
static javax.swing.Action showMemoryConsoleAction()
          Make an action that shows the memory console window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newAction

public static javax.swing.Action newAction()
Make an action that creates a new document in the application. This action is usually associated with the "new" menu item in the "File" menu.

Returns:
An action that creates a new document

openDocumentAction

public static javax.swing.Action openDocumentAction()
Make an action that presents the user with an open file dialog. If the user selects one or more files, those files are opened as XalDocument subclasses and added to the application's list of open documents. This action is usually associated with the "Open..." menu item in the "File" menu.

Returns:
An action that opens a document

openURLAction

protected static javax.swing.Action openURLAction(java.lang.String urlSpec)
Make an action that is used internally to open a file as specified by the given URL specification into a new document. This action is used by the menu items in the dynamically generated submenu "Open Recent" in the "File" menu. The "Open Recent" submenu lists the URL specifications of the recently opened files.

Parameters:
urlSpec - The URL specification of the file to open
Returns:
An action that opens a file corresponding to the given URL specification
See Also:
openRecentHandler()

openRecentHandler

public static javax.swing.event.MenuListener openRecentHandler()
Make a menu handler that is used to generate a list of recently opened files to be available under the "Open Recent" submenu of the "File" menu. A "clear" menu item appears at the end of the list and allows the user to clear the list. When the submenu is selected, the submenu gets populated with the list of recently opened files. The list is stored in the user preferences and the Application class manages the list.

Returns:
An action that opens a file corresponding to the given URL specification
See Also:
openURLAction(java.lang.String)

closeDocumentAction

public static javax.swing.Action closeDocumentAction(XalDocument document)
Make an action that closes the document where the from which the menu item was selected. This action is usually associated with the "Close" menu item in the "File" menu.

Parameters:
document - The document to close
Returns:
An action that closes the document

closeAllDocumentsAction

public static javax.swing.Action closeAllDocumentsAction()
Make an action that closes all documents in the application which leads to termination of the application. This action is usually associated with the "Close All" menu item in the "File" menu.

Returns:
An action that closes all documents in the application

saveDocumentAction

public static javax.swing.Action saveDocumentAction(XalDocument document)
Make an action that presents the user with an save file dialog for a new document or just save the present document to its existing file source if it is not new. In the case were the document is new: if the user selects "Save" after navigating to a folder and naming a new file, the present document is saved to the selected file. This action is usually associated with the "Save" menu item in the "File" menu.

Parameters:
document - The document to save.
Returns:
An action that saves a document
See Also:
Application.saveDocument(gov.sns.application.XalDocument)

saveAsDocumentAction

public static javax.swing.Action saveAsDocumentAction(XalDocument document)
Make an action that presents the user with an save file dialog. If the user selects "Save" after navigating to a folder and naming a new file, the present document is saved to the selected file. This action is usually associated with the "Save As..." menu item in the "File" menu.

Parameters:
document - The document to save.
Returns:
An action that saves a document to a selected file
See Also:
Application.saveDocument(gov.sns.application.XalDocument)

saveAllDocumentsAction

public static javax.swing.Action saveAllDocumentsAction()
Make an action that saves all open documents.

Returns:
An action that saves all open documents
See Also:
saveDocumentAction(gov.sns.application.XalDocument)

revertToSavedAction

public static javax.swing.Action revertToSavedAction(XalDocument document)
Make an action that reverts a document to its source disposing of any changes the user has made to the document.

Parameters:
document - The document to be reverted
Returns:
An action that reverts a document to its source

printAction

public static javax.swing.Action printAction(XalDocument document)
Make an action that shows a standard page-setup dialog box for formatting printing.

Returns:
An action for showing a standard page-setup dialog box

pageSetupAction

public static javax.swing.Action pageSetupAction()
Make an action that shows a standard page-setup dialog box for formatting printing.

Returns:
An action for showing a standard page-setup dialog box

quitAction

public static javax.swing.Action quitAction()
Make an action for quitting the application.

Returns:
An action for quitting the application

editPreferencesAction

public static javax.swing.Action editPreferencesAction(XalDocument document)
Make an action for editing a preference panel.

Returns:
An action for editing a preference panel

showConsoleAction

public static javax.swing.Action showConsoleAction()
Make an action that shows the console window.

Returns:
An action that shows the console window.

showMemoryConsoleAction

public static javax.swing.Action showMemoryConsoleAction()
Make an action that shows the memory console window.

Returns:
An action that shows the memory console window.

documentsHandler

public static javax.swing.event.MenuListener documentsHandler()
Make a menu handler that updates the list of open documents that should appear in the documents submenu under the Window menu.

Returns:
An action that updates the list of open documents

showDocumentAction

protected static javax.swing.Action showDocumentAction(XalDocument document)
Make an internal action used by the documentsHandler to show a specified document when that document is selected from the documents submenu.

Parameters:
document - The document to be shown
Returns:
An action that displays the window of the specified document
See Also:
documentsHandler()

cascadeWindowsAction

protected static javax.swing.Action cascadeWindowsAction(XalDocument document)
Cascade all document windows relative to the location of the window where the action was fired.

Parameters:
document - The document about whose window all other windows will cascade
Returns:
An action that cascades all windows in the application

showAllWindowsAction

public static javax.swing.Action showAllWindowsAction()
Make an action that shows all of the open documents.

Returns:
An action that displays the main window for each open document

hideAllWindowsAction

public static javax.swing.Action hideAllWindowsAction()
Make an action taht hides all windows.

Returns:
An action that hides all windows.

captureWindowAsImageAction

public static javax.swing.Action captureWindowAsImageAction(XalDocument document)
Make an action that captures the main window corresponding to the document as a PNG image and allows the user to save it to a file.

Parameters:
document - The document whose main window should be captured
Returns:
An action that captures the main window as a PNG image

showAboutBoxAction

public static javax.swing.Action showAboutBoxAction()
Make an action that shows the about box which presents information about the application.

Returns:
An action that shows the about box

showHelpWindow

public static javax.swing.Action showHelpWindow()
Make an action that shows the help window.

Returns:
An action that shows the help window