org.jhotdraw.app
Class AbstractApplication
- java.lang.Object
-
- org.jhotdraw.beans.AbstractBean
-
- org.jhotdraw.app.AbstractApplication
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Application
- Direct Known Subclasses:
- AppletApplication, MDIApplication, OSXApplication, SDIApplication
public abstract class AbstractApplication extends AbstractBean implements Application
This abstract class can be extended to implement anApplication.AbstractApplicationsupports the command line parameter-open filenameto open views for specific URI's upon launch of the application.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringVIEW_COUNT_PROPERTY-
Fields inherited from interface org.jhotdraw.app.Application
ACTIVE_VIEW_PROPERTY, RECENT_URIS_PROPERTY
-
-
Constructor Summary
Constructors Constructor and Description AbstractApplication()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(View v)Adds a view to this application.voidaddPalette(java.awt.Window palette)Adds a palette window to the application.voidaddRecentURI(java.net.URI uri)Appends a URI to the list of recent URIs.voidaddWindow(java.awt.Window window, View p)Adds a (non-palette) window to the application.voidclearRecentURIs()Clears the list of recent URIs.voidconfigure(java.lang.String[] args)Configures the application using the provided arguments array.java.awt.ContainercreateContainer()ViewcreateView()Creates a new view for this application and initializes it, by callingView.init().voiddestroy()Destroys the application and calls System.exit(0).voiddispose(View view)This is a convenience method for removing a view and disposing it.javax.swing.ActionMapgetActionMap(View v)Gets the action map.ViewgetActiveView()Gets the active view.java.lang.StringgetCopyright()Returns the copyright of the application.URIChoosergetExportChooser(View v)Gets an export chooser for the specified view or for the entire application.URIChoosergetImportChooser(View v)Gets an import chooser for the specified view or for the entire application.ApplicationModelgetModel()Returns the application model.java.lang.StringgetName()Returns the name of the application.URIChoosergetOpenChooser(View v)Gets an open chooser for the specified view or for the entire application.java.util.List<java.net.URI>getRecentURIs()Returns the recently opened URIs.URIChoosergetSaveChooser(View v)Gets a save chooser for the specified view or for the entire application.java.lang.StringgetVersion()Returns the version of the application.voidinit()Initializes the application.booleanisEnabled()Returns the enabled state of the application.voidlaunch(java.lang.String[] args)Launches the application.voidremove(View v)Removes a view from this application and removes it from the users view.voidremovePalette(java.awt.Window palette)Removes a palette window from the application.voidremoveWindow(java.awt.Window window)Removes a (non-palette) window from the application.voidsetActionMap(javax.swing.ActionMap m)Sets the application-wide action map.voidsetActiveView(View newValue)Sets the active view.voidsetEnabled(boolean newValue)Sets the enabled state of the application.voidsetModel(ApplicationModel newValue)Sets the application model.voidstart(java.util.List<java.net.URI> uris)Starts the application.voidstop()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, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Methods inherited from class java.lang.Object
equals, 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
-
VIEW_COUNT_PROPERTY
public static final java.lang.String VIEW_COUNT_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
public void init()
Description copied from interface:ApplicationInitializes the application.configure()should have been invoked before the application is inited. Alternatively an application can be configured using setter methods.- Specified by:
initin interfaceApplication
-
start
public void start(java.util.List<java.net.URI> uris)
Description copied from interface:ApplicationStarts the application. This usually creates at least one view, and adds it to the application.init()must have been invoked before the application is started.- Specified by:
startin interfaceApplication- Parameters:
uris- Upon launch, the application may be requested to open views for a given list of URI's.
-
createView
public final View createView()
Description copied from interface:ApplicationCreates a new view for this application and initializes it, by callingView.init().- Specified by:
createViewin interfaceApplication
-
setModel
public void setModel(ApplicationModel newValue)
Description copied from interface:ApplicationSets the application model.- Specified by:
setModelin interfaceApplication
-
getModel
public ApplicationModel getModel()
Description copied from interface:ApplicationReturns the application model.- Specified by:
getModelin interfaceApplication
-
setActiveView
public void setActiveView(@Nullable View newValue)
Sets the active view. Calls deactivate on the previously active view, and then calls activate on the given view.- Parameters:
newValue- Active view, can be null.
-
getActiveView
@Nullable public View getActiveView()
Gets the active view.- Specified by:
getActiveViewin interfaceApplication- Returns:
- The active view can be null.
-
getName
public java.lang.String getName()
Description copied from interface:ApplicationReturns the name of the application.- Specified by:
getNamein interfaceApplication
-
getVersion
public java.lang.String getVersion()
Description copied from interface:ApplicationReturns the version of the application.- Specified by:
getVersionin interfaceApplication
-
getCopyright
public java.lang.String getCopyright()
Description copied from interface:ApplicationReturns the copyright of the application.- Specified by:
getCopyrightin interfaceApplication
-
stop
public void stop()
Description copied from interface:ApplicationStops the application without saving any unsaved views.init()must have been invoked before the application is stopped.- Specified by:
stopin interfaceApplication
-
destroy
public void destroy()
Description copied from interface:ApplicationDestroys the application and calls System.exit(0).- Specified by:
destroyin interfaceApplication
-
remove
public void remove(View v)
Description copied from interface:ApplicationRemoves a view from this application and removes it from the users view. Fires a "documentCount" property change event. Invokes method setApplication(null) on the view object.- Specified by:
removein interfaceApplication
-
add
public void add(View v)
Description copied from interface:ApplicationAdds a view to this application. Fires a "documentCount" property change event. Invokes method setApplication(this) on the view object.- Specified by:
addin interfaceApplication
-
dispose
public void dispose(View view)
Description copied from interface:ApplicationThis is a convenience method for removing a view and disposing it.- Specified by:
disposein interfaceApplication
-
views
public java.util.Collection<View> views()
Description copied from interface:ApplicationReturns a read only collection view of the views of this application.- Specified by:
viewsin interfaceApplication
-
isEnabled
public boolean isEnabled()
Description copied from interface:ApplicationReturns the enabled state of the application.- Specified by:
isEnabledin interfaceApplication
-
setEnabled
public void setEnabled(boolean newValue)
Description copied from interface:ApplicationSets the enabled state of the application. The enabled state is used to prevent parallel invocation of actions on the application. If an action consists of a sequential part and a concurrent part, it must disable the application only for the sequential part. Actions that act on the application must check in their actionPerformed method whether the application is enabled. If the application is disabled, they must do nothing. If the application is enabled, they must disable the application, perform the action and then enable the application again. This is a bound property.- Specified by:
setEnabledin interfaceApplication
-
createContainer
public java.awt.Container createContainer()
-
launch
public void launch(java.lang.String[] args)
Launches the application.- Specified by:
launchin interfaceApplication- Parameters:
args- This implementation supports the command-line parameter "-open" which can be followed by one or more filenames or URI's.
-
configure
public void configure(java.lang.String[] args)
Description copied from interface:ApplicationConfigures the application using the provided arguments array.- Specified by:
configurein interfaceApplication
-
removePalette
public void removePalette(java.awt.Window palette)
Description copied from interface:ApplicationRemoves a palette window from the application.- Specified by:
removePalettein interfaceApplication
-
addPalette
public void addPalette(java.awt.Window palette)
Description copied from interface:ApplicationAdds a palette window to the application.- Specified by:
addPalettein interfaceApplication
-
removeWindow
public void removeWindow(java.awt.Window window)
Description copied from interface:ApplicationRemoves a (non-palette) window from the application.- Specified by:
removeWindowin interfaceApplication
-
addWindow
public void addWindow(java.awt.Window window, @Nullable View p)Description copied from interface:ApplicationAdds a (non-palette) window to the application.- Specified by:
addWindowin interfaceApplication- Parameters:
window- The window.p- The View to which this window is associated, or null if the window is associated to the application.
-
getRecentURIs
public java.util.List<java.net.URI> getRecentURIs()
Description copied from interface:ApplicationReturns the recently opened URIs. By convention, this is an immutable list.- Specified by:
getRecentURIsin interfaceApplication
-
clearRecentURIs
public void clearRecentURIs()
Description copied from interface:ApplicationClears the list of recent URIs. This fires a property change event for the property "recentURIs".- Specified by:
clearRecentURIsin interfaceApplication
-
addRecentURI
public void addRecentURI(java.net.URI uri)
Description copied from interface:ApplicationAppends a URI to the list of recent URIs. This fires a property change event for the property "recentURIs".- Specified by:
addRecentURIin interfaceApplication
-
getOpenChooser
public URIChooser getOpenChooser(View v)
Description copied from interface:ApplicationGets an open chooser for the specified view or for the entire application.- Specified by:
getOpenChooserin interfaceApplication- Parameters:
v- A view or null.- Returns:
- A chooser.
-
getSaveChooser
public URIChooser getSaveChooser(View v)
Description copied from interface:ApplicationGets a save chooser for the specified view or for the entire application.- Specified by:
getSaveChooserin interfaceApplication- Parameters:
v- A view or null.- Returns:
- A chooser.
-
getImportChooser
public URIChooser getImportChooser(View v)
Description copied from interface:ApplicationGets an import chooser for the specified view or for the entire application.- Specified by:
getImportChooserin interfaceApplication- Parameters:
v- A view or null.- Returns:
- A chooser.
-
getExportChooser
public URIChooser getExportChooser(View v)
Description copied from interface:ApplicationGets an export chooser for the specified view or for the entire application.- Specified by:
getExportChooserin interfaceApplication- Parameters:
v- A view or null.- Returns:
- A chooser.
-
setActionMap
public void setActionMap(javax.swing.ActionMap m)
Sets the application-wide action map.
-
getActionMap
public javax.swing.ActionMap getActionMap(@Nullable View v)
Gets the action map.- Specified by:
getActionMapin interfaceApplication- Parameters:
v- A view or null
-
-
DataMelt 3.0 © DataMelt by jWork.ORG