|
JHotDraw 7rev733 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jhotdraw.beans.AbstractBean
org.jhotdraw.app.AbstractApplication
public abstract class AbstractApplication
This abstract class can be extended to implement an Application.
AbstractApplication supports the command line parameter
-open filename to open views for specific URI's upon launch of
the application.
Open last URI on launch
When the application is started, the last opened URI is opened in a view.
The following methods participate in this feature:
Data suppliers addRecentURI(java.net.URI), getRecentURIs().
Behavior: start(java.util.List.
See org.jhotdraw.app for a list of participating classes.
Allow multiple views for URI
Allows opening the same URI in multiple views.
When the feature is disabled, opening multiple views is prevented, and saving
to a file for which a view is currently open is prevented.
The following methods participate in this feature:
Data suppliers getViews().
See org.jhotdraw.app for a list of participating classes.
| Field Summary | |
|---|---|
protected ResourceBundleUtil |
labels
|
protected ApplicationModel |
model
|
static java.lang.String |
VIEW_COUNT_PROPERTY
|
| Fields inherited from class org.jhotdraw.beans.AbstractBean |
|---|
propertySupport |
| Fields inherited from interface org.jhotdraw.app.Application |
|---|
ACTIVE_VIEW_PROPERTY, RECENT_URIS_PROPERTY |
| Constructor Summary | |
|---|---|
AbstractApplication()
Creates a new instance. |
|
| Method Summary | |
|---|---|
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)
Adds an URI to the start of 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()
Stops the application and then 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 application. |
URIChooser |
getImportChooser(View v)
Gets an import chooser for the specified view or for the 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 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 application. |
java.lang.String |
getVersion()
Returns the version of the application. |
java.util.List<View> |
getViews()
Returns an unmodifiable list of all views of the application. |
void |
init()
Initializes the application after it has been configured. |
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. |
protected void |
removeTrailingSeparators(javax.swing.JMenu m)
|
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. |
| Methods inherited from class org.jhotdraw.beans.AbstractBean |
|---|
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jhotdraw.app.Application |
|---|
addPropertyChangeListener, createEditMenu, createFileMenu, createHelpMenu, createViewMenu, createWindowMenu, getComponent, hide, isSharingToolsAmongViews, removePropertyChangeListener, show |
| Field Detail |
|---|
protected ResourceBundleUtil labels
protected ApplicationModel model
public static final java.lang.String VIEW_COUNT_PROPERTY
| Constructor Detail |
|---|
public AbstractApplication()
| Method Detail |
|---|
public void init()
init in interface Applicationpublic void start(java.util.List<java.net.URI> uris)
This method creates a view for each supplied URI, and adds it to the application. If no URI has been supplied, this method may open an empty view.
By convention this method is only called after Application.init() has
been called.
This method implements behavior for the following feature:
Open URI on launch.
See org.jhotdraw.app.
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().
The view has not been added to the application yet.
To make the view usable with this application, call Application.add(View).
To make it visible, first call add(View), then Application.show(View).
createView in interface Applicationpublic void setModel(ApplicationModel newValue)
Application
setModel in interface Applicationpublic ApplicationModel getModel()
Application
getModel in interface Applicationprotected View basicCreateView()
public void setActiveView(@Nullable
View newValue)
newValue - Active view, can be null.@Nullable public View getActiveView()
getActiveView in interface Applicationpublic java.lang.String getName()
Application
getName in interface Applicationpublic java.lang.String getVersion()
Application
getVersion in interface Applicationpublic java.lang.String getCopyright()
Application
getCopyright in interface Applicationpublic void stop()
Application
By convention this method is only called after Application.init() has
been called.
This method must be called from AWT Event Dispatcher Thread.
stop in interface Applicationpublic void destroy()
Application
By convention this method is only called after Application.init() has
been called.
This method must be called from AWT Event Dispatcher Thread.
destroy in interface Applicationpublic void remove(View v)
Application
remove in interface Applicationpublic void add(View v)
Application
add in interface Applicationpublic java.util.List<View> getViews()
Application
The list of views is used by the Allow multiple views per URI feature.
See org.jhotdraw.app.
getViews in interface Applicationprotected abstract javax.swing.ActionMap createViewActionMap(View p)
public void dispose(View view)
Application
dispose in interface Applicationpublic java.util.Collection<View> views()
Application
views in interface Applicationpublic boolean isEnabled()
Application
isEnabled in interface Applicationpublic void setEnabled(boolean newValue)
Application
setEnabled 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)
configure in interface Applicationpublic void removePalette(java.awt.Window palette)
Application
removePalette in interface Applicationpublic void addPalette(java.awt.Window palette)
Application
addPalette in interface Applicationpublic void removeWindow(java.awt.Window window)
Application
removeWindow in interface Application
public void addWindow(java.awt.Window window,
@Nullable
View p)
Application
addWindow 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(@Nullable
View view,
java.lang.String actionID)
protected void addAction(javax.swing.JMenu m,
@Nullable
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)
protected void removeTrailingSeparators(javax.swing.JMenu m)
public java.util.List<java.net.URI> getRecentURIs()
Application
The most recent URI is used by the Open last URI on launch feature.
See org.jhotdraw.app.
getRecentURIs in interface Applicationpublic void clearRecentURIs()
ApplicationThe recent URIs are persisted (for example using the Java Preferences API) so that they are available on the next launch of the application.
The most recent URI is used by the Open last URI on launch feature.
See org.jhotdraw.app.
clearRecentURIs in interface Applicationpublic void addRecentURI(java.net.URI uri)
ApplicationThis fires a property change event for the property "recentURIs".
The recent URIs are persisted (for example using the Java Preferences API) so that they are available on the next launch of the application.
The most recent URI is used by the Open last URI on launch feature.
See org.jhotdraw.app.
addRecentURI in interface Application
protected javax.swing.JMenu createOpenRecentFileMenu(@Nullable
View view)
public URIChooser getOpenChooser(View v)
If the chooser has an accessory panel, it can access the view using the client property "view" on the component of the chooser. It can access the application using the client property "application" on the chooser.
getOpenChooser in interface Applicationv - The view. Specify null to get a chooser for the application.
public URIChooser getSaveChooser(View v)
If the chooser has an accessory panel, it can access the view using the client property "view" on the component of the chooser. It can access the application using the client property "application" on the chooser.
getSaveChooser in interface Applicationv - The view. Specify null to get a chooser for the application.
public URIChooser getImportChooser(View v)
If the chooser has an accessory panel, it can access the view using the client property "view" on the component of the chooser. It can access the application using the client property "application" on the chooser.
getImportChooser in interface Applicationv - The view. Specify null to get a chooser for the application.
public URIChooser getExportChooser(View v)
If the chooser has an accessory panel, it can access the view using the client property "view" on the component of the chooser. It can access the application using the client property "application" on the chooser.
getExportChooser in interface Applicationv - The view. Specify null to get a chooser for the application.
public void setActionMap(javax.swing.ActionMap m)
public javax.swing.ActionMap getActionMap(@Nullable
View v)
getActionMap in interface Applicationv - A view or null
|
Copyright 1996-2010 (c) by the authors and contributors of the JHotDraw project. Some rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||