JHotDraw 7.0.9

org.jhotdraw.application
Class AbstractOSXApplication

java.lang.Object
  extended by application.Application
      extended by org.jhotdraw.application.AbstractDocumentOrientedApplication
          extended by org.jhotdraw.application.AbstractOSXApplication
All Implemented Interfaces:
DocumentOrientedApplication

public abstract class AbstractOSXApplication
extends AbstractDocumentOrientedApplication

A AbstractOSXApplication can handle the life cycle of multiple document windows each being presented in a JFrame of its own. The application provides all the functionality needed to work with the document, such as a menu bar, tool bars and palette windows.

OSX stands for Mac OS X Application Document Interface. An OSX application can handle multiple DocumentView's at the same time. Each documentView gets a JFrame of its own. An OSX application has one menu bar, attached to the top of the screen. This 'screen menu bar' is shared by all DocumentView's.

AbstractOSXApplication is designed for Mac OS X. It will not work on other platforms.

The screen menu bar has the following standard menus:

 "Application-Name" File Edit Window Help
 
The first menu, is the application menu. It has the following standard menu items. AbstractOSXApplication wires the menu items to the action objects specified in brackets. The preferences menu item is only displayed, if the application has an action with PreferencesAction.ID. The other menu items are always displayed. Menu items without action wiring are generated by Mac OS X and can not be changed.
  About "Application-Name" (AboutAction.ID)
  -
  Preferences... (PreferencesAction.ID)
  -
  Services
  -
  Hide "Application-Name"
  Hide Others
  Show All
  -
  Quit "Application-Name" (ExitAction.ID)
 
The file menu has the following standard menu items. AbstractOSXApplication wires the menu items to the action objects specified in brackets. If the application hasn't an action with the specified ID, the menu item is not displayed. Menu items without action wiring are generated by this class, and can be changed by subclasses.
  New (NewAction.ID)
  Open... (OpenAction.ID)
  Open Recent >
  -
  Close (CloseAction.ID)
  Save (SaveAction.ID)
  Save As... (SaveAsAction.ID)
  Save All
  Revert to Saved (RevertToSavedAction.ID)
  -
  Page Setup... (PrintPageSetupAction.ID)
  Print... (PrintAction.ID)
 
The edit menu has the following standard menu items. AbstractOSXApplication wires the menu items to the action objects specified in brackets. If the application hasn't an action with the specified ID, the menu item is not displayed. Menu items without action wiring are generated by this class, and can be changed by subclasses.
  Undo (UndoAction.ID)
  Redo (RedoAction.ID)
  -
  Cut (CutAction.ID)
  Copy (CopyAction.ID)
  Paste (PasteAction.ID)
  Delete (DeleteAction.ID)
  Select All (SelectAllAction.ID)
 

Version:
1.1 2007-01-11 Removed method addStandardActionsTo.
1.0.1 2007-01-02 Floating palettes disappear now if the application looses the focus. 1.0 October 4, 2005 Created.
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class org.jhotdraw.application.AbstractDocumentOrientedApplication
PROP_CURRENT_VIEW, PROP_VIEW_COUNT
 
Constructor Summary
AbstractOSXApplication()
          Creates a new instance.
 
Method Summary
 void addPalette(java.awt.Window palette)
          Adds a palette window to the application.
protected  javax.swing.ActionMap createActionMap()
          Creates an action map for actions which haven not been defined using the
protected  javax.swing.JMenu createFileMenu(DocumentView p)
          Creates the file menu.
protected  javax.swing.JMenuBar createMenuBar(DocumentView p)
          Creates a menu bar.
protected  javax.swing.JMenu createWindowMenu(DocumentView p)
          Creates the window menu.
 java.awt.Component getComponent()
          Returns the application component.
 DocumentView getCurrentView()
          Returns the current view.
 void hide(DocumentView p)
          Hides a view.
static void initAWT(java.lang.String[] args)
           
 void initialize(java.lang.String[] args)
          Initializes the application.
protected  void initLookAndFeel()
          Initializes the look and feel of the application.
protected  void initPalettes(java.util.LinkedList<javax.swing.Action> paletteActions)
           
protected  void initScreenMenuBar()
           
protected  void initView(DocumentView v)
          Initializes the view.
 boolean isEditorShared()
          Returns true, if this application shares an editor among multiple views.
 void removePalette(java.awt.Window palette)
          Removes a palette window from the application.
 void setCurrentView(DocumentView newValue)
           
 void show(DocumentView p)
          Shows a view.
 
Methods inherited from class org.jhotdraw.application.AbstractDocumentOrientedApplication
add, addRecentFile, clearRecentFiles, createEditMenu, createHelpMenu, createMenuBar, createMenus, createToolBars, createView, createViewMenu, destroyView, getAction, getFrameworkResourceMap, getResourceMap, getViewClass, getViews, initActionMap, initDefaults, initMainFrame, initRecentFiles, isEnabled, launch, recentFiles, remove, setEnabled, shutdown, startup, updateName, updateOpenRecentMenu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.application.DocumentOrientedApplication
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

AbstractOSXApplication

public AbstractOSXApplication()
Creates a new instance.

Method Detail

initialize

public void initialize(java.lang.String[] args)
Description copied from class: AbstractDocumentOrientedApplication
Initializes the application. If you override this method, make sure to call initDefaults.

Specified by:
initialize in interface DocumentOrientedApplication
Overrides:
initialize in class AbstractDocumentOrientedApplication

initAWT

public static void initAWT(java.lang.String[] args)

initLookAndFeel

protected void initLookAndFeel()
Description copied from class: AbstractDocumentOrientedApplication
Initializes the look and feel of the application. This method is called by initDefaults.

Overrides:
initLookAndFeel in class AbstractDocumentOrientedApplication

createActionMap

protected javax.swing.ActionMap createActionMap()
Description copied from class: AbstractDocumentOrientedApplication
Creates an action map for actions which haven not been defined using the

Overrides:
createActionMap in class AbstractDocumentOrientedApplication

initView

protected void initView(DocumentView v)
Description copied from class: AbstractDocumentOrientedApplication
Initializes the view.

Overrides:
initView in class AbstractDocumentOrientedApplication

addPalette

public void addPalette(java.awt.Window palette)
Description copied from interface: DocumentOrientedApplication
Adds a palette window to the application.

Specified by:
addPalette in interface DocumentOrientedApplication
Overrides:
addPalette in class AbstractDocumentOrientedApplication

removePalette

public void removePalette(java.awt.Window palette)
Description copied from interface: DocumentOrientedApplication
Removes a palette window from the application.

Specified by:
removePalette in interface DocumentOrientedApplication
Overrides:
removePalette in class AbstractDocumentOrientedApplication

show

public void show(DocumentView p)
Description copied from class: AbstractDocumentOrientedApplication
Shows a view. Calls start on the view.

Specified by:
show in interface DocumentOrientedApplication
Specified by:
show in class AbstractDocumentOrientedApplication

hide

public void hide(DocumentView p)
Description copied from class: AbstractDocumentOrientedApplication
Hides a view. Calls stop on the view.

Specified by:
hide in interface DocumentOrientedApplication
Specified by:
hide in class AbstractDocumentOrientedApplication

createMenuBar

protected javax.swing.JMenuBar createMenuBar(DocumentView p)
Creates a menu bar.

Parameters:
p - The documentView for which the menu bar is created. This may be null if the menu bar is attached to an application component, such as the screen menu bar or a floating palette window.

createWindowMenu

protected javax.swing.JMenu createWindowMenu(DocumentView p)
Description copied from class: AbstractDocumentOrientedApplication
Creates the window menu. Return null, if you don't want this menu.  @param v The document view.

Overrides:
createWindowMenu in class AbstractDocumentOrientedApplication

createFileMenu

protected javax.swing.JMenu createFileMenu(DocumentView p)
Description copied from class: AbstractDocumentOrientedApplication
Creates the file menu. Return null, if you don't want this menu.

Overrides:
createFileMenu in class AbstractDocumentOrientedApplication

getCurrentView

public DocumentView getCurrentView()
Description copied from class: AbstractDocumentOrientedApplication
Returns the current view. This is used by Actions which act on the current DocumentView. Current view is null, if the application has no visible view.

This is a bound property.

Specified by:
getCurrentView in interface DocumentOrientedApplication
Specified by:
getCurrentView in class AbstractDocumentOrientedApplication

setCurrentView

public void setCurrentView(DocumentView newValue)

initScreenMenuBar

protected void initScreenMenuBar()

initPalettes

protected void initPalettes(java.util.LinkedList<javax.swing.Action> paletteActions)

isEditorShared

public boolean isEditorShared()
Description copied from class: AbstractDocumentOrientedApplication
Returns true, if this application shares an editor among multiple views. This is true for MDI and OSX applications. This is false for SDI applications.

Specified by:
isEditorShared in interface DocumentOrientedApplication
Specified by:
isEditorShared in class AbstractDocumentOrientedApplication

getComponent

public java.awt.Component getComponent()
Description copied from interface: DocumentOrientedApplication
Returns the application component. This may return null, if the application is not represented by a component of its own on the user interface.


Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.