|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.application.XalDocument
The base class for custom documents. Subclasses of this class need to define the logic for their document. Every document has a main window and a URL source that provides persistent storage.
| Field Summary | |
protected XalDocumentListener |
documentListenerProxy
|
protected boolean |
hasChanges
|
protected XalWindow |
mainWindow
|
protected MessageCenter |
messageCenter
|
static int |
NO_OPTION
|
protected java.net.URL |
source
|
protected java.lang.String |
title
|
static int |
YES_OPTION
|
| Fields inherited from interface java.awt.print.Pageable |
UNKNOWN_NUMBER_OF_PAGES |
| Constructor Summary | |
XalDocument()
Constructor for new documents |
|
| Method Summary | |
void |
addXalDocumentListener(XalDocumentListener listener)
Add the listener for events from this document. |
protected boolean |
closeDocument()
This method is a request to close a document. |
protected void |
customizeCommands(Commander commander)
Override this method to register custom document commands if any. |
int |
displayConfirmDialog(java.lang.String title,
java.lang.String message)
Display a confirmation dialog with a title and message |
void |
displayError(java.lang.Exception exception)
Display an error dialog box with information about the exception and provide an audible alert. |
void |
displayError(java.lang.String title,
java.lang.String message)
Display an error dialog box and provide an audible alert. |
void |
displayError(java.lang.String title,
java.lang.String prefix,
java.lang.Exception exception)
Display an error dialog box with information about the exception and provide an audible alert. |
void |
displayWarning(java.lang.Exception exception)
Display a warning dialog box with information about the exception and provide an audible alert. |
void |
displayWarning(java.lang.String title,
java.lang.String message)
Display a warning dialog box and provide an audible alert. |
void |
displayWarning(java.lang.String title,
java.lang.String prefix,
java.lang.Exception exception)
Display a warning dialog box with information about the exception and provide an audible alert. |
protected void |
freeCustomResources()
Dispose of custom document resources. |
protected void |
freeResources()
Free document resources. |
protected void |
generateDocumentTitle()
Generate and set the title for this document. |
protected java.lang.String |
getCustomMenuDefinitionPath()
Subclasses should override this method if this document should use a menu definition other than the default specified in application adaptor. |
protected java.lang.String |
getDisplayFilePath()
By default the file path to display for this document is set to the file path of the document or the default empty document file path if the document does not yet have a file store. |
protected java.lang.String |
getEmptyDocumentPath()
Get the default file path to use for empty documents |
XalWindow |
getMainWindow()
Get the main window for this document. |
int |
getNumberOfPages()
Implement the Pageable interface. |
java.awt.print.PageFormat |
getPageFormat(int pageIndex)
Implement the Pageable interface. |
java.awt.print.Printable |
getPrintable(int pageIndex)
Implement the Pageable interface. |
java.net.URL |
getSource()
Get the URL of the persistent storage for this document. |
java.lang.String |
getTitle()
Get the document title. |
boolean |
hasChanges()
Indicates if there are changes that need saving. |
void |
hideDocument()
Hide this document. |
boolean |
isEmpty()
Check if the document is empty. |
protected abstract void |
makeMainWindow()
Subclasses must implement this method to make their custom main window. |
protected void |
registerEvents()
Register this document as a source of DocumentListener events. |
void |
removeXalDocumentListener(XalDocumentListener listener)
Remove the listener from event from this document. |
void |
saveDocument()
Save this document to its persistent storage source. |
abstract void |
saveDocumentAs(java.net.URL url)
Subclasses need to implement this method for saving the document to a URL. |
void |
setHasChanges(boolean changeStatus)
Set the whether this document has changes. |
void |
setSource(java.net.URL url)
Set the URL of the persistent storage for this document. |
void |
setTitle(java.lang.String newTitle)
Set the document title. |
void |
showDocument()
Make this document's window visible. |
boolean |
warnUserOfUnsavedChangesWhenClosing()
Determine whether the user should be warned when closing a document with unsaved changes. |
protected void |
willClose()
Called when the document will be closed. |
java.lang.String[] |
writableDocumentTypes()
Subclasses should implement this method to return the array of file suffixes identifying the files that can be written by the document. |
| 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
protected XalWindow mainWindow
protected boolean hasChanges
protected java.lang.String title
protected java.net.URL source
protected MessageCenter messageCenter
protected XalDocumentListener documentListenerProxy
| Constructor Detail |
public XalDocument()
| Method Detail |
public java.lang.String[] writableDocumentTypes()
protected void registerEvents()
public void addXalDocumentListener(XalDocumentListener listener)
public void removeXalDocumentListener(XalDocumentListener listener)
protected abstract void makeMainWindow()
protected void customizeCommands(Commander commander)
commander - The commander that manages commands.Commander.registerAction(Action)protected java.lang.String getCustomMenuDefinitionPath()
ApplicationAdaptor.getPathToResource(java.lang.String)public java.lang.String getTitle()
public void setTitle(java.lang.String newTitle)
newTitle - The new title for this document.public java.net.URL getSource()
public void setSource(java.net.URL url)
url - The URL of the persistent storage to set for this document.public boolean isEmpty()
protected void generateDocumentTitle()
protected java.lang.String getDisplayFilePath()
protected java.lang.String getEmptyDocumentPath()
public boolean hasChanges()
public void setHasChanges(boolean changeStatus)
changeStatus - Status to set whether this document has changes that need saving.public abstract void saveDocumentAs(java.net.URL url)
url - The URL to which this document should be saved.public void saveDocument()
protected boolean closeDocument()
public boolean warnUserOfUnsavedChangesWhenClosing()
protected final void freeResources()
protected void freeCustomResources()
protected void willClose()
public XalWindow getMainWindow()
public void showDocument()
public void hideDocument()
public int displayConfirmDialog(java.lang.String title,
java.lang.String message)
title - The title of the dialogmessage - The message to display
public 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 void displayWarning(java.lang.Exception exception)
exception - The exception about which the warning dialog is displayed.
public 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 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 void displayError(java.lang.Exception exception)
exception - The exception about which the warning dialog is displayed.
public 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 int getNumberOfPages()
getNumberOfPages in interface java.awt.print.Pageable
public java.awt.print.PageFormat getPageFormat(int pageIndex)
throws java.lang.IndexOutOfBoundsException
getPageFormat in interface java.awt.print.PageablepageIndex - The page number corresponding to the page format to return
java.lang.IndexOutOfBoundsException - when the page index is out of rangePrintManager.getPageFormat()
public java.awt.print.Printable getPrintable(int pageIndex)
throws java.lang.IndexOutOfBoundsException
getPrintable in interface java.awt.print.PageablepageIndex - The page to print
java.lang.IndexOutOfBoundsException - when the page index is out of range
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||