JHotDraw 7.0.9

org.jhotdraw.app
Class DefaultOSXApplication

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.app.AbstractApplication
          extended by org.jhotdraw.app.DefaultOSXApplication
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Application

public class DefaultOSXApplication
extends AbstractApplication

A DefaultOSXApplication 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 Project's at the same time. Each project 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 Project's.

DefaultOSXApplication 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. DefaultOSXApplication 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. DefaultOSXApplication 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. DefaultOSXApplication 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
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.app.AbstractApplication
labels
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
DefaultOSXApplication()
          Creates a new instance.
 
Method Summary
 void addPalette(java.awt.Window palette)
           
 void configure(java.lang.String[] args)
          Configures the application using the provided arguments array.
protected  javax.swing.JMenu createFileMenu(Project p)
           
protected  javax.swing.JMenuBar createMenuBar(Project p)
          Creates a menu bar.
protected  javax.swing.JMenu createWindowMenu(Project p)
           
 java.awt.Component getComponent()
          Returns the application component.
 Project getCurrentProject()
          Returns the current project.
 void hide(Project p)
          Hides a project.
 void init()
          Initializes the application.
protected  void initApplicationActions()
           
protected  void initLookAndFeel()
           
protected  void initPalettes(java.util.LinkedList<javax.swing.Action> paletteActions)
           
protected  void initProjectActions(Project p)
           
protected  void initScreenMenuBar()
           
 boolean isSharingToolsAmongProjects()
          Returns true, if this application shares tools among multiple projects.
 void launch(java.lang.String[] args)
          Launches the application from the main method.
 void removePalette(java.awt.Window palette)
           
 void setCurrentProject(Project newValue)
           
 void show(Project p)
          Shows a project.
 
Methods inherited from class org.jhotdraw.app.AbstractApplication
add, addRecentFile, basicCreateProject, clearRecentFiles, createContainer, createProject, dispose, getCopyright, getModel, getName, getVersion, initLabels, isEnabled, projects, recentFiles, remove, setEnabled, setModel, start, stop
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jhotdraw.app.Application
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

DefaultOSXApplication

public DefaultOSXApplication()
Creates a new instance.

Method Detail

init

public void init()
Description copied from interface: Application
Initializes the application. configure() should have been invoked before the application is inited. Alternatively an application can be configured using setter methods.

Specified by:
init in interface Application
Overrides:
init in class AbstractApplication

launch

public void launch(java.lang.String[] args)
Description copied from interface: Application
Launches the application from the main method. This method is typically invoked on the main Thread. This will invoke configure() on the current thread and then init() and start() on the AWT Event Dispatcher Thread.

Specified by:
launch in interface Application
Overrides:
launch in class AbstractApplication

configure

public void configure(java.lang.String[] args)
Description copied from interface: Application
Configures the application using the provided arguments array.

Specified by:
configure in interface Application
Overrides:
configure in class AbstractApplication

initLookAndFeel

protected void initLookAndFeel()

initApplicationActions

protected void initApplicationActions()

initProjectActions

protected void initProjectActions(Project p)
Specified by:
initProjectActions in class AbstractApplication

addPalette

public void addPalette(java.awt.Window palette)

removePalette

public void removePalette(java.awt.Window palette)

show

public void show(Project p)
Description copied from interface: Application
Shows a project.


hide

public void hide(Project p)
Description copied from interface: Application
Hides a project.


createMenuBar

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

Parameters:
p - The project 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(Project p)

createFileMenu

protected javax.swing.JMenu createFileMenu(Project p)

getCurrentProject

public Project getCurrentProject()
Description copied from interface: Application
Returns the current project. This is used for OSXApplication and MDIApplication which share actions among multiple Project instances. Current project may be become null, if the application has no project.

This is a bound property.


setCurrentProject

public void setCurrentProject(Project newValue)

initScreenMenuBar

protected void initScreenMenuBar()

initPalettes

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

isSharingToolsAmongProjects

public boolean isSharingToolsAmongProjects()
Description copied from interface: Application
Returns true, if this application shares tools among multiple projects.


getComponent

public java.awt.Component getComponent()
Description copied from interface: Application
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.