Class OSXApplication
- java.lang.Object
-
- org.jhotdraw.beans.AbstractBean
-
- org.jhotdraw.app.AbstractApplication
-
- org.jhotdraw.app.OSXApplication
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, Application
public class OSXApplication extends AbstractApplication
OSXApplicationhandles the lifecycle of multipleViews using a Mac OS X application interface.This user interface created by this application follows the guidelines given in the Apple Human Interface Guidelines.
An application of this type can open multiple
Views. Each view is shown in a separateJFrame.Conceptually all views share a global 'screen menu bar'. In Swing this is implemented as multiple JMenuBar instances. There is one JMenuBar for each opened JFrame, and a special JMenuBar which is shown when all views of the application are closed.
The application also provides floating toolbars and palette windows for the views.
In order for the screen menu bar and the floating palettes to function properly, it is essential that all code which opens JFrame's, JDialog's or JWindow's calls addWindow/Palette and removeWindow/Palette on the application object.
The life cycle of the application is tied to the screen menu bar. Choosing the quit action in the screen menu bar quits the application.
The screen menu bar has the following standard menus:
"Application-Name" File Edit Window
The first menu, is the application menu. It has the following standard menu items:About "Application-Name" (
The file menu has the following standard menu items:AboutAction.ID) - Preferences... (AbstractPreferencesAction.ID) - Services - Hide "Application-Name" Hide Others Show All - Quit "Application-Name" (ExitAction.ID)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) - Close (CloseFileAction.ID) Save (SaveFileAction.ID) Save As... (SaveFileAsAction.ID) Export... (ExportFileAction.ID) Print... (PrintFileAction.ID)Undo (
The window 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})Minimize (
The menus provided by theMinimizeWindowAction.ID) Zoom (MaximizeWindowAction.ID) - "Filename" (FocusWindowAction) - "Palette" (TogglePaletteAction)ApplicationModelare 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.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.jhotdraw.app.AbstractApplication
VIEW_COUNT_PROPERTY
-
Fields inherited from interface org.jhotdraw.app.Application
ACTIVE_VIEW_PROPERTY, RECENT_URIS_PROPERTY
-
-
Constructor Summary
Constructors Constructor and Description OSXApplication()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddPalette(java.awt.Window palette)Adds a palette window to the application.voidaddWindow(java.awt.Window window, View view)Adds a (non-palette) window to the application.voidconfigure(java.lang.String[] args)Configures the application using the provided arguments array.javax.swing.JMenucreateEditMenu(View view)Creates an edit menu for the specified view or for the entire application.javax.swing.JMenucreateFileMenu(View view)Creates a file menu for the specified view or for the entire application.javax.swing.JMenucreateHelpMenu(View view)Creates a help menu for the specified view of for the entire application.javax.swing.JMenucreateViewMenu(View view)Creates a view menu for the specified view or for the entire application.javax.swing.JMenucreateWindowMenu(View view)Creates a window menu for the specified view or for the entire application.voiddispose(View p)This is a convenience method for removing a view and disposing it.java.awt.ComponentgetComponent()Returns the Frame which holds the frameless JMenuBar.voidhide(View p)Hides a view.voidinit()Initializes the application.booleanisSharingToolsAmongViews()Returns true, if this application shares tools among multiple views.voidlaunch(java.lang.String[] args)Launches the application.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.voidshow(View view)Shows a view.-
Methods inherited from class org.jhotdraw.app.AbstractApplication
add, addRecentURI, clearRecentURIs, createContainer, createView, destroy, getActionMap, getActiveView, getCopyright, getExportChooser, getImportChooser, getModel, getName, getOpenChooser, getRecentURIs, getSaveChooser, getVersion, isEnabled, remove, setActionMap, setActiveView, setEnabled, setModel, start, stop, views
-
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, removePropertyChangeListener
-
-
-
-
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- Overrides:
initin classAbstractApplication
-
launch
public void launch(java.lang.String[] args)
Description copied from class:AbstractApplicationLaunches the application.- Specified by:
launchin interfaceApplication- Overrides:
launchin classAbstractApplication- 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- Overrides:
configurein classAbstractApplication
-
dispose
public void dispose(View p)
Description copied from interface:ApplicationThis is a convenience method for removing a view and disposing it.- Specified by:
disposein interfaceApplication- Overrides:
disposein classAbstractApplication
-
addPalette
public void addPalette(java.awt.Window palette)
Description copied from interface:ApplicationAdds a palette window to the application.- Specified by:
addPalettein interfaceApplication- Overrides:
addPalettein classAbstractApplication
-
removePalette
public void removePalette(java.awt.Window palette)
Description copied from interface:ApplicationRemoves a palette window from the application.- Specified by:
removePalettein interfaceApplication- Overrides:
removePalettein classAbstractApplication
-
addWindow
public void addWindow(java.awt.Window window, View view)Description copied from interface:ApplicationAdds a (non-palette) window to the application.- Specified by:
addWindowin interfaceApplication- Overrides:
addWindowin classAbstractApplication- Parameters:
window- The window.view- The View to which this window is associated, or null if the window is associated to the application.
-
removeWindow
public void removeWindow(java.awt.Window window)
Description copied from interface:ApplicationRemoves a (non-palette) window from the application.- Specified by:
removeWindowin interfaceApplication- Overrides:
removeWindowin classAbstractApplication
-
show
public void show(View view)
Description copied from interface:ApplicationShows a view.
-
hide
public void hide(View p)
Description copied from interface:ApplicationHides a view.
-
createViewMenu
@Nullable public javax.swing.JMenu createViewMenu(View view)
Description copied from interface:ApplicationCreates a view menu for the specified view or for the entire application.- Parameters:
view- A view or null.- Returns:
- A JMenu or null, if the menu is empty.
-
createWindowMenu
public javax.swing.JMenu createWindowMenu(View view)
Description copied from interface:ApplicationCreates a window menu for the specified view or for the entire application.- Parameters:
view- A view or null.- Returns:
- A JMenu or null, if the menu is empty.
-
createFileMenu
@Nullable public javax.swing.JMenu createFileMenu(View view)
Description copied from interface:ApplicationCreates a file menu for the specified view or for the entire application.- Parameters:
view- A view or null.- Returns:
- A JMenu or null, if the menu is empty.
-
createEditMenu
@Nullable public javax.swing.JMenu createEditMenu(View view)
Description copied from interface:ApplicationCreates an edit menu for the specified view or for the entire application.- Parameters:
view- A view or null.- Returns:
- A JMenu or null, if the menu is empty.
-
createHelpMenu
public javax.swing.JMenu createHelpMenu(View view)
Description copied from interface:ApplicationCreates a help menu for the specified view of for the entire application.- Parameters:
view- A view or null.- Returns:
- A JMenu or null, if the menu is empty.
-
isSharingToolsAmongViews
public boolean isSharingToolsAmongViews()
Description copied from interface:ApplicationReturns true, if this application shares tools among multiple views.
-
getComponent
public java.awt.Component getComponent()
Returns the Frame which holds the frameless JMenuBar.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG