public abstract class AcceleratorDocument extends XalDocument
Modifier and Type | Field and Description |
---|---|
protected Accelerator |
accelerator |
protected java.lang.String |
acceleratorFilePath |
protected MessageCenter |
MESSAGE_CENTER
Local message center
|
protected AcceleratorSeq |
selectedSequence |
protected java.util.List<AcceleratorSeq> |
selectedSequenceList |
protected java.net.URL |
source
The persistent storage URL for the document
|
mainWindow, NO_OPTION, WILDCARD_FILE_EXTENSION, YES_OPTION
Constructor and Description |
---|
AcceleratorDocument()
Creates a new instance of AcceleratorDocument
|
Modifier and Type | Method and Description |
---|---|
void |
acceleratorChanged()
Hook for handling the accelerator change event.
|
void |
acceleratorFilePathChanged()
Hook for handling the accelerator file path change event.
|
Accelerator |
applySelectedAcceleratorWithDefaultPath(java.lang.String filePath)
Attempt to load the accelerator with the specified path and if none exists, then request a substitute accelerator from the user.
|
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.
|
void |
freeCustomResources()
Dispose of custom document resources.
|
void |
generateDocumentTitle()
Generate and set the title for this document.
|
Accelerator |
getAccelerator()
Get the accelerator managed by this document.
|
java.lang.String |
getAcceleratorFilePath()
Get the path to the xml file of the accelerator managed by this document.
|
AcceleratorWindow |
getAcceleratorWindow()
Get the accelerator window managed by this document
|
java.lang.String |
getCustomMenuDefinitionResource()
Subclasses should override this method if this document should use a menu definition
other than the default specified in application adaptor.
|
java.io.File |
getDefaultFolder()
Get the default document folder.
|
java.net.URL |
getDefaultFolderURL()
Get the default document folder as a URL.
|
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.
|
java.lang.String |
getEmptyDocumentPath()
Get the default file path to use for empty documents
|
java.lang.String |
getFileNameForSaving()
Get the base file name to use when saving a new file.
|
java.lang.String |
getNewDocumentName(java.lang.String baseName)
Get the default file path to use for empty documents
|
java.lang.String |
getNewFileName()
Get the file name (including extension but without path) for a new file.
|
java.lang.String |
getNewFileNamePrefix()
Get the prefix for a new file (precedes timestamp) defaulting to the selected sequence ID if any or the super class's default if no sequence is selected.
|
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.
|
AcceleratorSeq |
getSelectedSequence()
Get the selected accelerator sequence managed by this document.
|
java.util.List<AcceleratorSeq> |
getSelectedSequenceList()
Get the selected sequence list
|
java.net.URL |
getSource()
Get the URL of the persistent storage for this document.
|
java.lang.String |
getTitle()
Get the document title.
|
void |
handleDataWrittenTo(DataListener dataRoot,
java.net.URL url)
Subclasses may override this empty method to implement custom code called by writeDataTo() after data has been successfully written to the specified URL.
|
boolean |
hasChanges()
Indicates if there are changes that need saving.
|
void |
hideDocument()
Hide this document.
|
boolean |
isEmpty()
Check if the document is empty.
|
protected boolean |
loadDefaultAccelerator()
Attempt to load the user's default accelerator.
|
abstract void |
makeMainWindow()
Subclasses must implement this method to make their custom main window.
|
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 |
selectedSequenceChanged()
Hook for handling the selected sequence change event.
|
void |
setAccelerator(Accelerator newAccelerator,
java.lang.String newPath)
Set the accelerator managed by the document.
|
void |
setAcceleratorFilePath(java.lang.String newPath)
Set the accelerator file path.
|
void |
setSelectedSequence(AcceleratorSeq selection)
Set the selected accelerator sequence managed by this document.
|
void |
setSelectedSequenceList(java.util.List<AcceleratorSeq> seqList)
Set a list of selected sequences
|
void |
setSource(java.net.URL url)
Set the URL of the persistent storage for this document.
|
void |
showDocument()
Make this document's window visible.
|
boolean |
warnUserOfUnsavedChangesWhenClosing()
Determine whether the user should be warned when closing a document with unsaved changes.
|
void |
willClose()
Called when the document will be closed.
|
void |
windowOpened()
Hook indicating that the window was opened.
|
void |
windowWillOpen()
Hook indicating that the window will be opened.
|
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.
|
void |
writeDataTo(DataListener dataRoot,
java.net.URL url)
Convenience method typically called in saveDocumentAs() to save a document rooted in a data listener source.
|
addXalDocumentListener, closeDocument, freeResources, getDefaultWindowReference, getDocumentView, getMainWindow, registerEvents, removeXalDocumentListener, setHasChanges, setTitle
protected Accelerator accelerator
protected AcceleratorSeq selectedSequence
protected java.lang.String acceleratorFilePath
protected java.util.List<AcceleratorSeq> selectedSequenceList
protected MessageCenter MESSAGE_CENTER
protected java.net.URL source
public AcceleratorDocument()
public AcceleratorWindow getAcceleratorWindow()
public void generateDocumentTitle()
public java.lang.String getNewFileNamePrefix()
public Accelerator applySelectedAcceleratorWithDefaultPath(java.lang.String filePath)
filePath
- file path to the accelerator for which to first attempt to loadpublic void setAccelerator(Accelerator newAccelerator, java.lang.String newPath)
newAccelerator
- The accelerator managed by this document.newPath
- The path to the accelerator managed by this document.public Accelerator getAccelerator()
public void setAcceleratorFilePath(java.lang.String newPath)
newPath
- The path to the accelerator managed by this document.public java.lang.String getAcceleratorFilePath()
protected boolean loadDefaultAccelerator()
public void setSelectedSequence(AcceleratorSeq selection)
selection
- The accelerator sequence to be managed by this document.public void setSelectedSequenceList(java.util.List<AcceleratorSeq> seqList)
seqList
- The list of selected sequencespublic AcceleratorSeq getSelectedSequence()
public java.util.List<AcceleratorSeq> getSelectedSequenceList()
public void acceleratorChanged()
public void selectedSequenceChanged()
public void acceleratorFilePathChanged()
public java.lang.String[] writableDocumentTypes()
public abstract void makeMainWindow()
public void customizeCommands(Commander commander)
commander
- The commander that manages commands.Commander.registerAction(Action)
public java.lang.String getCustomMenuDefinitionResource()
public java.lang.String getTitle()
public java.net.URL getSource()
public java.io.File getDefaultFolder()
public java.net.URL getDefaultFolderURL()
public void setSource(java.net.URL url)
url
- The URL of the persistent storage to set for this document.public boolean isEmpty()
public java.lang.String getDisplayFilePath()
public java.lang.String getFileNameForSaving()
public java.lang.String getNewFileName()
public java.lang.String getNewDocumentName(java.lang.String baseName)
baseName
- the base name to use for an empty documentpublic java.lang.String getEmptyDocumentPath()
public boolean hasChanges()
public abstract void saveDocumentAs(java.net.URL url)
url
- The URL to which this document should be saved.public void saveDocument()
public void writeDataTo(DataListener dataRoot, java.net.URL url)
dataRoot
- DataListener root of the document to saveurl
- The URL to which the document should be saved.public void handleDataWrittenTo(DataListener dataRoot, java.net.URL url)
dataRoot
- DataListener root of the document to saveurl
- The URL to which the document should be saved.public boolean warnUserOfUnsavedChangesWhenClosing()
public void freeCustomResources()
public void willClose()
public void windowWillOpen()
public void windowOpened()
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 displaypublic 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.Pageable
pageIndex
- The page number corresponding to the page format to returnjava.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.Pageable
pageIndex
- The page to printjava.lang.IndexOutOfBoundsException
- when the page index is out of range