public abstract class AbstractApplication extends AbstractBean implements Application
Application.
AbstractApplication supports the command line parameter
-open filename to open views for specific URI's upon launch of
the application.
| Modifier and Type | Field and Description |
|---|---|
protected ResourceBundleUtil |
labels |
protected ApplicationModel |
model |
static java.lang.String |
VIEW_COUNT_PROPERTY |
propertySupportACTIVE_VIEW_PROPERTY, RECENT_URIS_PROPERTY| Constructor and Description |
|---|
AbstractApplication()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(View v)
Adds a view to this application.
|
protected void |
addAction(javax.swing.JMenu m,
javax.swing.Action a)
Adds the specified action as a menu item to the supplied menu.
|
protected void |
addAction(javax.swing.JMenu m,
View view,
java.lang.String actionID)
Adds the specified action as a menu item to the supplied menu.
|
protected void |
addMenuItem(javax.swing.JMenu m,
javax.swing.JMenuItem mi)
Adds the specified action as a menu item to the supplied menu.
|
void |
addPalette(java.awt.Window palette)
Adds a palette window to the application.
|
void |
addRecentURI(java.net.URI uri)
Appends a URI to the list of recent URIs.
|
void |
addWindow(java.awt.Window window,
View p)
Adds a (non-palette) window to the application.
|
protected View |
basicCreateView() |
void |
clearRecentURIs()
Clears the list of recent URIs.
|
void |
configure(java.lang.String[] args)
Configures the application using the provided arguments array.
|
java.awt.Container |
createContainer() |
protected javax.swing.JMenu |
createOpenRecentFileMenu(View view) |
View |
createView()
Creates a new view for this application and initializes it, by calling
View.init(). |
protected abstract javax.swing.ActionMap |
createViewActionMap(View p) |
void |
destroy()
Destroys the application and calls System.exit(0).
|
void |
dispose(View view)
This is a convenience method for removing a view and disposing it.
|
protected javax.swing.Action |
getAction(View view,
java.lang.String actionID) |
javax.swing.ActionMap |
getActionMap(View v)
Gets the action map.
|
View |
getActiveView()
Gets the active view.
|
java.lang.String |
getCopyright()
Returns the copyright of the application.
|
URIChooser |
getExportChooser(View v)
Gets an export chooser for the specified view or for the entire application.
|
URIChooser |
getImportChooser(View v)
Gets an import chooser for the specified view or for the entire application.
|
ApplicationModel |
getModel()
Returns the application model.
|
java.lang.String |
getName()
Returns the name of the application.
|
URIChooser |
getOpenChooser(View v)
Gets an open chooser for the specified view or for the entire application.
|
protected java.util.List<java.net.URI> |
getOpenURIsFromMainArgs(java.lang.String[] args)
Parses the arguments to the main method and returns a list of URI's
for which views need to be opened upon launch of the application.
|
java.util.List<java.net.URI> |
getRecentURIs()
Returns the recently opened URIs.
|
URIChooser |
getSaveChooser(View v)
Gets a save chooser for the specified view or for the entire application.
|
java.lang.String |
getVersion()
Returns the version of the application.
|
void |
init()
Initializes the application.
|
protected void |
initLabels() |
boolean |
isEnabled()
Returns the enabled state of the application.
|
void |
launch(java.lang.String[] args)
Launches the application.
|
protected void |
maybeAddSeparator(javax.swing.JMenu m)
Adds a separator to the supplied menu.
|
void |
remove(View v)
Removes a view from this application and removes it from the users
view.
|
void |
removePalette(java.awt.Window palette)
Removes a palette window from the application.
|
void |
removeWindow(java.awt.Window window)
Removes a (non-palette) window from the application.
|
void |
setActionMap(javax.swing.ActionMap m)
Sets the application-wide action map.
|
void |
setActiveView(View newValue)
Sets the active view.
|
void |
setEnabled(boolean newValue)
Sets the enabled state of the application.
|
void |
setModel(ApplicationModel newValue)
Sets the application model.
|
void |
start(java.util.List<java.net.URI> uris)
Starts the application.
|
void |
stop()
Stops the application without saving any unsaved views.
|
java.util.Collection<View> |
views()
Returns a read only collection view of the views of this application.
|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListenerequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddPropertyChangeListener, createEditMenu, createFileMenu, createHelpMenu, createViewMenu, createWindowMenu, getComponent, hide, isSharingToolsAmongViews, removePropertyChangeListener, showprotected ResourceBundleUtil labels
protected ApplicationModel model
public static final java.lang.String VIEW_COUNT_PROPERTY
public void init()
Applicationconfigure() should have been invoked before the application
is inited. Alternatively an application can be configured using setter
methods.init in interface Applicationpublic void start(java.util.List<java.net.URI> uris)
Applicationinit() must have been invoked before the application is started.start in interface Applicationuris - Upon launch, the application may be requested to open views
for a given list of URI's.public final View createView()
ApplicationView.init().createView in interface Applicationpublic void setModel(ApplicationModel newValue)
ApplicationsetModel in interface Applicationpublic ApplicationModel getModel()
ApplicationgetModel in interface Applicationprotected View basicCreateView()
public void setActiveView(View newValue)
newValue - Active view, can be null.public View getActiveView()
getActiveView in interface Applicationpublic java.lang.String getName()
ApplicationgetName in interface Applicationpublic java.lang.String getVersion()
ApplicationgetVersion in interface Applicationpublic java.lang.String getCopyright()
ApplicationgetCopyright in interface Applicationpublic void stop()
Applicationinit() must have been invoked before the application is stopped.stop in interface Applicationpublic void destroy()
Applicationdestroy in interface Applicationpublic void remove(View v)
Applicationremove in interface Applicationpublic void add(View v)
Applicationadd in interface Applicationprotected abstract javax.swing.ActionMap createViewActionMap(View p)
public void dispose(View view)
Applicationdispose in interface Applicationpublic java.util.Collection<View> views()
Applicationviews in interface Applicationpublic boolean isEnabled()
ApplicationisEnabled in interface Applicationpublic void setEnabled(boolean newValue)
ApplicationsetEnabled in interface Applicationpublic java.awt.Container createContainer()
public void launch(java.lang.String[] args)
launch in interface Applicationargs - This implementation supports the command-line parameter "-open"
which can be followed by one or more filenames or URI's.protected java.util.List<java.net.URI> getOpenURIsFromMainArgs(java.lang.String[] args)
This implementation supports the command-line parameter "-open" which can be followed by one or more filenames or URI's.
This method is invoked from the Application.launch method.
args - Arguments to the main method.protected void initLabels()
public void configure(java.lang.String[] args)
Applicationconfigure in interface Applicationpublic void removePalette(java.awt.Window palette)
ApplicationremovePalette in interface Applicationpublic void addPalette(java.awt.Window palette)
ApplicationaddPalette in interface Applicationpublic void removeWindow(java.awt.Window window)
ApplicationremoveWindow in interface Applicationpublic void addWindow(java.awt.Window window,
View p)
ApplicationaddWindow in interface Applicationwindow - The window.p - The View to which this window is associated, or null
if the window is associated to the application.protected javax.swing.Action getAction(View view, java.lang.String actionID)
protected void addAction(javax.swing.JMenu m,
View view,
java.lang.String actionID)
protected void addAction(javax.swing.JMenu m,
javax.swing.Action a)
protected void addMenuItem(javax.swing.JMenu m,
javax.swing.JMenuItem mi)
protected void maybeAddSeparator(javax.swing.JMenu m)
public java.util.List<java.net.URI> getRecentURIs()
ApplicationgetRecentURIs in interface Applicationpublic void clearRecentURIs()
ApplicationclearRecentURIs in interface Applicationpublic void addRecentURI(java.net.URI uri)
ApplicationaddRecentURI in interface Applicationprotected javax.swing.JMenu createOpenRecentFileMenu(View view)
public URIChooser getOpenChooser(View v)
ApplicationgetOpenChooser in interface Applicationv - A view or null.public URIChooser getSaveChooser(View v)
ApplicationgetSaveChooser in interface Applicationv - A view or null.public URIChooser getImportChooser(View v)
ApplicationgetImportChooser in interface Applicationv - A view or null.public URIChooser getExportChooser(View v)
ApplicationgetExportChooser in interface Applicationv - A view or null.public void setActionMap(javax.swing.ActionMap m)
public javax.swing.ActionMap getActionMap(View v)
getActionMap in interface Applicationv - A view or null