public class SDIApplication extends AbstractApplication
SDIApplication
handles the lifecycle of multiple View
s
using a Windows single document interface (SDI).
This user interface created by this application follows the guidelines given in the Windows User Experience Interaction Guidelines.
An application of this type can open multiple View
s. Each view is
shown in a separate JFrame
.
Each JFrame contains a menu bar, toolbars and palette bars for the views.
The life cycle of the application is tied to the JFrame
s. Closing the
last JFrame
quits the application.
SDIApplication handles the life cycle of a single document window
being presented in a JFrame. The JFrame provides all the functionality needed
to work with the document, such as a menu bar, tool bars and palette windows.
The life cycle of the application is tied to the JFrame. Closing the JFrame quits the application.
The menu bar of a JFrame has the following standard menus:
File Edit View HelpThe file menu has the following standard menu items:
Clear (The edit menu has the following standard menu items:ClearFileAction.ID
}) New (NewFileAction.ID
}) New Window (NewWindowAction.ID
}) Load... (LoadFileAction.ID
}) Open... (OpenFileAction.ID
}) Load Directory... (LoadDirectoryAction.ID
}) Open Directory... (OpenDirectoryAction.ID
}) Load Recent > "Filename" (LoadRecentFileAction.ID
) Open Recent > "Filename" (OpenRecentFileAction.ID
) - Save (SaveFileAction.ID
) Save As... (SaveFileAsAction.ID
) Export... (ExportFileAction.ID
) Print... (PrintFileAction.ID
) - Close (CloseFileAction.ID
)
Undo (The view menu has the following standard menu items:UndoAction.ID
}) Redo (RedoAction.ID
}) - Cut (CutAction.ID
}) Copy (CopyAction.ID
}) Paste (PasteAction.ID
}) Duplicate (DuplicateAction.ID
}) Delete... (DeleteAction.ID
}) - Select All (SelectAllAction.ID
}) Clear Selection (ClearSelectionAction.ID
}) - Find (AbstractFindAction.ID
}) - Preferences... (AbstractPreferencesAction.ID
)
"Toolbar" (ToggleVisibleAction
)
The view menu has the following standard menu items:
About (AboutAction.ID
)
The menus provided by the ApplicationModel
are inserted between
the file menu and the window menu. In case the application model supplies
a menu with the title "Help", it is inserted after the window menu.labels, model, VIEW_COUNT_PROPERTY
propertySupport
ACTIVE_VIEW_PROPERTY, RECENT_URIS_PROPERTY
Constructor and Description |
---|
SDIApplication()
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
configure(java.lang.String[] args)
Configures the application using the provided arguments array.
|
javax.swing.JMenu |
createEditMenu(View view)
Creates an edit menu for the specified view or for the entire application.
|
javax.swing.JMenu |
createFileMenu(View view)
Creates a file menu for the specified view or for the entire application.
|
javax.swing.JMenu |
createHelpMenu(View p)
Creates a help menu for the specified view of for the entire application.
|
protected javax.swing.JMenuBar |
createMenuBar(View v)
Creates a menu bar.
|
protected javax.swing.ActionMap |
createModelActionMap(ApplicationModel mo) |
protected javax.swing.ActionMap |
createViewActionMap(View v) |
javax.swing.JMenu |
createViewMenu(View view)
Creates the view menu.
|
javax.swing.JMenu |
createWindowMenu(View view)
Creates a window menu for the specified view or for the entire application.
|
void |
dispose(View p)
This is a convenience method for removing a view and disposing it.
|
java.awt.Component |
getComponent()
Returns the application component.
|
void |
hide(View p)
Hides a view.
|
void |
init()
Initializes the application.
|
protected void |
initLookAndFeel() |
boolean |
isSharingToolsAmongViews()
Returns true, if this application shares tools among multiple views.
|
void |
launch(java.lang.String[] args)
Launches the application.
|
void |
remove(View p)
Removes a view from this application and removes it from the users
view.
|
void |
show(View view)
Shows a view.
|
protected void |
updateViewTitle(View view,
javax.swing.JFrame f)
Updates the title of a view and displays it in the given frame.
|
protected java.awt.Component |
wrapViewComponent(View p)
Returns the view component.
|
add, addAction, addAction, addMenuItem, addPalette, addRecentURI, addWindow, basicCreateView, clearRecentURIs, createContainer, createOpenRecentFileMenu, createView, destroy, getAction, getActionMap, getActiveView, getCopyright, getExportChooser, getImportChooser, getModel, getName, getOpenChooser, getOpenURIsFromMainArgs, getRecentURIs, getSaveChooser, getVersion, initLabels, isEnabled, maybeAddSeparator, removePalette, removeWindow, setActionMap, setActiveView, setEnabled, setModel, start, stop, views
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addPropertyChangeListener, removePropertyChangeListener
public void launch(java.lang.String[] args)
AbstractApplication
launch
in interface Application
launch
in class AbstractApplication
args
- This implementation supports the command-line parameter "-open"
which can be followed by one or more filenames or URI's.public void init()
Application
configure()
should have been invoked before the application
is inited. Alternatively an application can be configured using setter
methods.init
in interface Application
init
in class AbstractApplication
public void remove(View p)
Application
remove
in interface Application
remove
in class AbstractApplication
public void configure(java.lang.String[] args)
Application
configure
in interface Application
configure
in class AbstractApplication
protected void initLookAndFeel()
public void show(View view)
Application
protected java.awt.Component wrapViewComponent(View p)
public void hide(View p)
Application
public void dispose(View p)
Application
dispose
in interface Application
dispose
in class AbstractApplication
protected javax.swing.JMenuBar createMenuBar(View v)
public javax.swing.JMenu createFileMenu(View view)
Application
view
- A view or null.public javax.swing.JMenu createEditMenu(View view)
Application
view
- A view or null.protected void updateViewTitle(View view, javax.swing.JFrame f)
view
- The view.f
- The frame.public boolean isSharingToolsAmongViews()
Application
public java.awt.Component getComponent()
Application
public javax.swing.JMenu createWindowMenu(View view)
Application
view
- A view or null.public javax.swing.JMenu createViewMenu(View view)
view
- The Viewpublic javax.swing.JMenu createHelpMenu(View p)
Application
p
- A view or null.protected javax.swing.ActionMap createModelActionMap(ApplicationModel mo)
protected javax.swing.ActionMap createViewActionMap(View v)
createViewActionMap
in class AbstractApplication