public interface ApplicationModel
ApplicationModel
provides meta-data for an Application
,
actions and factory methods for creating View
s, toolbars and
URIChooser
s.
Open last URI on launch
When the application is started, the last opened URI is opened in a view.
isOpenLastURIOnLaunch()
is used by Application.start(java.util.List<java.net.URI>)
to
determine whether this feature is enabled.
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 another view is open is prevented.
ApplicationModel
defines an API for this feature.
See org.jhotdraw.app
.
Framework
The interfaces and classes listed below together with the Action
classes in the org.jhotddraw.app.action package define the contracts of a
framework for document oriented applications:
Contract: Application
, ApplicationModel
, View
.
Modifier and Type | Method and Description |
---|---|
javax.swing.ActionMap |
createActionMap(Application a,
View v)
Creates an action map.
|
URIChooser |
createExportChooser(Application a,
View v)
Creates an export chooser.
|
URIChooser |
createImportChooser(Application a,
View v)
Creates an import chooser.
|
URIChooser |
createOpenChooser(Application a,
View v)
Creates an open chooser.
|
URIChooser |
createOpenDirectoryChooser(Application a,
View v)
Creates an open chooser for directories.
|
URIChooser |
createSaveChooser(Application a,
View v)
Creates a save chooser.
|
java.util.List<javax.swing.JToolBar> |
createToolBars(Application a,
View v)
Creates tool bars.
|
View |
createView()
Creates a new view for the application.
|
void |
destroyApplication(Application a)
Destroys the application.
|
void |
destroyView(Application a,
View v)
Destroys the supplied view.
|
java.lang.String |
getCopyright()
Returns the copyright of the application.
|
MenuBuilder |
getMenuBuilder()
Returns the abstract factory for building application menus.
|
java.lang.String |
getName()
Returns the name of the application.
|
java.lang.String |
getVersion()
Returns the version of the application.
|
void |
initApplication(Application a)
Initializes the application.
|
void |
initView(Application a,
View v)
Initializes the supplied view for the application.
|
boolean |
isAllowMultipleViewsPerURI()
Returns true if the application may open multiple views for the same
URI.
|
boolean |
isOpenLastURIOnLaunch()
Returns true if the application should open the last opened URI on launch
instead of opening an empty view.
|
java.lang.String getName()
java.lang.String getVersion()
java.lang.String getCopyright()
View createView()
void initApplication(Application a)
a
- the applicationvoid destroyApplication(Application a)
a
- the applicationvoid initView(Application a, View v)
a
- the applicationv
- the viewvoid destroyView(Application a, View v)
a
- the applicationv
- the viewjavax.swing.ActionMap createActionMap(Application a, @Nullable View v)
This method is invoked once for the application, and once for each created view.
The application adds the created map to a hierarchy of action maps. Thus actions created for the application are accessible from the action maps of the views.
a
- Application.v
- The view for which the toolbars need to be created, or null
if the actions are to be shared by multiple views.java.util.List<javax.swing.JToolBar> createToolBars(Application a, @Nullable View v)
Depending on the document interface of the application, this method may be invoked only once for the application, or for each opened view.
a
- Application.v
- The view for which the toolbars need to be created, or null
if the toolbars are shared by multiple views.MenuBuilder getMenuBuilder()
URIChooser createOpenChooser(Application a, @Nullable View v)
a
- Application.v
- The view for which the chooser needs to be created, or null
if the chooser is shared by multiple views.URIChooser createOpenDirectoryChooser(Application a, @Nullable View v)
a
- Application.v
- The view for which the chooser needs to be created, or null
if the chooser is shared by multiple views.URIChooser createSaveChooser(Application a, @Nullable View v)
a
- Application.v
- The view for which the chooser needs to be created, or null
if the chooser is shared by multiple views.URIChooser createImportChooser(Application a, @Nullable View v)
a
- Application.v
- The view for which the chooser needs to be created, or null
if the chooser is shared by multiple views.URIChooser createExportChooser(Application a, @Nullable View v)
a
- Application.v
- The view for which the chooser needs to be created, or null
if the chooser is shared by multiple views.boolean isOpenLastURIOnLaunch()
This method defines an API for the Open last URI on Launch feature.
See org.jhotdraw.app
.
boolean isAllowMultipleViewsPerURI()
This method defines an API for the Allow multiple views for URI feature.
See org.jhotdraw.app
.