|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.application.Application
The Application class handles defines the core of an application. It is often
the first handler of application wide events and typically forwards those events
to the custom application adaptor for further processing. Every application has
exactly one instance of this class. The static method getApp()
provides access to that instance. Every application has one custom
application adaptor. The adaptor acts as a delegate for handling events
specific to the custom application. The Application, however, handles events
common to all multi-document applications.
| Field Summary | |
static int |
NO_OPTION
|
static int |
YES_OPTION
|
| Constructor Summary | |
Application(ApplicationAdaptor adaptor)
Application constructor. |
|
Application(ApplicationAdaptor adaptor,
java.net.URL[] urls)
Application constructor. |
|
| Method Summary | |
void |
addApplicationListener(ApplicationListener listener)
Add the listener as a listener of Application events. |
protected void |
cascadeWindowsAbout(XalDocument targetDocument)
Handle the "Cascade Windows" action by cascading all document windows about the target document. |
protected void |
closeAllDocuments()
Handle the "Close All" action by closing all open documents and opening a new empty document. |
protected void |
closeDocument(XalDocument document)
Handle the "Close" action by closing the specified document. |
static void |
displayApplicationError(java.lang.String title,
java.lang.String prefix,
java.lang.Exception exception)
Display an error dialog box with information about the exception. |
static int |
displayConfirmDialog(java.lang.String title,
java.lang.String message)
Display a confirmation dialog with a title and message |
static void |
displayError(java.lang.Exception exception)
Display an error dialog box with information about the exception. |
static void |
displayError(java.lang.String title,
java.lang.String message)
Display an error dialog box. |
static void |
displayError(java.lang.String title,
java.lang.String prefix,
java.lang.Exception exception)
Display an error dialog box with information about the exception. |
static void |
displayWarning(java.lang.Exception exception)
Display a warning dialog box with information about the exception. |
static void |
displayWarning(java.lang.String title,
java.lang.String message)
Display a warning dialog box. |
static void |
displayWarning(java.lang.String title,
java.lang.String prefix,
java.lang.Exception exception)
Display a warning dialog box with information about the exception. |
void |
documentHasClosed(XalDocument document)
Implement XalDocumentListener. |
void |
documentWillClose(XalDocument document)
Implement XalDocumentListener. |
static java.awt.Window |
getActiveWindow()
Get the active window which is in focus for this application. |
static ApplicationAdaptor |
getAdaptor()
Convenience method for getting the custom application adaptor. |
static Application |
getApp()
Get the application instance. |
ApplicationAdaptor |
getApplicationAdaptor()
Get the custom application adaptor. |
Commander |
getCommander()
Get the application commander that manages commands for the entire application. |
java.util.List |
getDocuments()
Get the list of all open documents. |
javax.swing.JFileChooser |
getOpenFileChooser()
Get the file chooser with which the user interacts when opening a document. |
javax.swing.JFileChooser |
getSaveFileChooser()
Get the file chooser with which the user interacts when saving a document. |
void |
hasChangesChanged(XalDocument document,
boolean newHasChangesStatus)
Implement XalDocumentListener. |
protected void |
hideAllWindows()
Handle the "Hide All" action by hiding all main windows corresponding to the open documents. |
static void |
launch(ApplicationAdaptor adaptor)
Handle the launching of the application by creating the application instance and performing application initialization. |
static void |
launch(ApplicationAdaptor adaptor,
java.net.URL[] urls)
Handle the launching of the application by creating the application instance and performing application initialization. |
protected Commander |
makeCommander()
Make an application commander |
protected void |
makeFileChoosers()
Create a file chooser for opening and saving documents. |
protected void |
newDocument()
Handle the "New" action by creating a new document. |
protected void |
openDocument()
Handle the "Open" action by opening a new document. |
void |
openDocument(java.net.URL url)
Support method for opening a document with the specified URL. |
protected void |
openFile(java.io.File file)
Support method for opening a new document given a file. |
protected void |
openFiles(java.io.File[] files)
Support method for opening an array of files. |
protected void |
openURL(java.lang.String urlSpec)
Support method for opening a new document with the URL specification |
void |
produceDocument(XalDocument document)
Add a new document to this application and show it |
void |
produceDocument(XalDocument document,
boolean makeVisible)
Add a new document to this application and if makeVisible is true, show it |
void |
quit()
Handle the "Quit" action by quitting the application. |
protected void |
registerApplicationStatusService()
Register the application status service so clients on the network can query the status of this application instance. |
protected void |
registerEvents()
Register the instance as a provider for ApplictionListener events. |
void |
removeApplicationListener(ApplicationListener listener)
Remove the listener from listening to Application events. |
protected void |
revertToSaved(XalDocument document)
Handle the "Revert To Saved" action by reverting the specified document to that of its source file. |
protected void |
saveAllDocuments()
Handle the "Save All" action by saving all open documents. |
protected void |
saveAsDocument(XalDocument document)
Handle the "Save As" action by saving the specified document to the location chosen by the user. |
protected void |
saveDocument(XalDocument document)
Handle the "Save" action by saving the specified document. |
protected void |
saveDocumentToFile(XalDocument document,
java.io.File file)
Support method for saving a document to a file. |
void |
setOpenFileChooser(javax.swing.JFileChooser fileChooser)
Set the file chooser with which the user will interact when opening a document. |
void |
setSaveFileChooser(javax.swing.JFileChooser fileChooser)
Set the file chooser with which the user will interact when saving a document. |
protected void |
setupConsole()
Setup the console to capture standard output and standard error |
protected void |
showAllWindows()
Handle the "Show All" action by showing all main windows corresponding to the open documents. |
void |
titleChanged(XalDocument document,
java.lang.String newTitle)
Implement XalDocumentListener. |
protected void |
updateFileChooserFolder()
Update the current directories of the open and save file choosers. |
protected void |
updateFileChooserFolder(javax.swing.JFileChooser fileChooser)
Update the current directory of the specified file chooser. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int YES_OPTION
public static final int NO_OPTION
| Constructor Detail |
public Application(ApplicationAdaptor adaptor)
adaptor - The application adaptor used for customization.
public Application(ApplicationAdaptor adaptor,
java.net.URL[] urls)
adaptor - The application adaptor used for customization.urls - An array of document URLs to open upon startup.| Method Detail |
public Commander getCommander()
protected Commander makeCommander()
protected final void registerApplicationStatusService()
protected void setupConsole()
public javax.swing.JFileChooser getSaveFileChooser()
public void setSaveFileChooser(javax.swing.JFileChooser fileChooser)
fileChooser - The file chooser with which the user will interact when saving a document.public javax.swing.JFileChooser getOpenFileChooser()
public void setOpenFileChooser(javax.swing.JFileChooser fileChooser)
fileChooser - The file chooser with which the user will interact when opening a document.protected void makeFileChoosers()
protected void updateFileChooserFolder()
protected void updateFileChooserFolder(javax.swing.JFileChooser fileChooser)
fileChooser - The file chooser for which to update the current directory.protected void registerEvents()
public void addApplicationListener(ApplicationListener listener)
listener - Object to register as a listener of application events.public void removeApplicationListener(ApplicationListener listener)
listener - Object to un-register as a listener of application events.public java.util.List getDocuments()
public ApplicationAdaptor getApplicationAdaptor()
getAdaptor()protected void newDocument()
protected void openDocument()
protected void openURL(java.lang.String urlSpec)
urlSpec - The URL specification of the file to open.protected void openFile(java.io.File file)
file - The file to open.openFiles(java.io.File[])protected void openFiles(java.io.File[] files)
files - The files to open.openDocument()public void openDocument(java.net.URL url)
url - The URL of the file to open.openURL(java.lang.String),
openFile(java.io.File)protected void closeDocument(XalDocument document)
document - The document to close.protected void closeAllDocuments()
protected void saveDocument(XalDocument document)
document - The document to save.protected void saveAsDocument(XalDocument document)
document - The document to save.protected void saveAllDocuments()
protected void saveDocumentToFile(XalDocument document,
java.io.File file)
document - The document to save.file - The file to which the document will be saved.protected void revertToSaved(XalDocument document)
document - The document to revert.public void quit()
protected void cascadeWindowsAbout(XalDocument targetDocument)
targetDocument - The document about whose window all document windows should cascadeprotected void showAllWindows()
protected void hideAllWindows()
public void titleChanged(XalDocument document,
java.lang.String newTitle)
titleChanged in interface XalDocumentListenerdocument - The document whose title changed.newTitle - The new document title.
public void hasChangesChanged(XalDocument document,
boolean newHasChangesStatus)
hasChangesChanged in interface XalDocumentListenerdocument - The document whose change status changednewHasChangesStatus - The new "hasChanges" status of the document.public void documentWillClose(XalDocument document)
documentWillClose in interface XalDocumentListenerdocument - The document that will close.public void documentHasClosed(XalDocument document)
documentHasClosed in interface XalDocumentListenerdocument - The document that has closed.public static void launch(ApplicationAdaptor adaptor)
adaptor - The custom application adaptor.
public static void launch(ApplicationAdaptor adaptor,
java.net.URL[] urls)
adaptor - The custom application adaptor.urls - The URLs of documents to open upon launching the applicationpublic static ApplicationAdaptor getAdaptor()
getApplicationAdaptor()public static Application getApp()
public static java.awt.Window getActiveWindow()
public void produceDocument(XalDocument document)
document - the document to produce
public void produceDocument(XalDocument document,
boolean makeVisible)
document - the document to producemakeVisible - make the document visible
public static int displayConfirmDialog(java.lang.String title,
java.lang.String message)
title - The title of the dialogmessage - The message to display
public static void displayWarning(java.lang.Exception exception)
exception - The exception about which the warning dialog is displayed.
public static void displayWarning(java.lang.String title,
java.lang.String message)
title - Title of the warning dialog box.message - The warning message to appear in the warning dialog box.
public static void displayWarning(java.lang.String title,
java.lang.String prefix,
java.lang.Exception exception)
title - Title of the warning dialog box.prefix - Text that should appear in the dialog box before the exception messasge.exception - The exception about which the warning dialog is displayed.
public static void displayError(java.lang.String title,
java.lang.String message)
title - Title of the warning dialog box.message - The warning message to appear in the warning dialog box.public static void displayError(java.lang.Exception exception)
exception - The exception about which the warning dialog is displayed.
public static void displayError(java.lang.String title,
java.lang.String prefix,
java.lang.Exception exception)
title - Title of the warning dialog box.prefix - Text that should appear in the dialog box before the exception messasge.exception - The exception about which the warning dialog is displayed.
public static void displayApplicationError(java.lang.String title,
java.lang.String prefix,
java.lang.Exception exception)
title - Title of the warning dialog box.prefix - Text that should appear in the dialog box before the exception messasge.exception - The exception about which the warning dialog is displayed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||