JHotDraw 7.3.1

org.jhotdraw.app
Class DefaultSDIApplication

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

public class DefaultSDIApplication
extends AbstractApplication

DefaultSDIApplication handles the lifecycle of a Views using a single document interface (SDI).

An application consists of independent JFrames for each view. Each JFrame contains a menu bar, toolbars and palette bars for the views.

The life cycle of the application is tied to the JFrames. Closing the last JFrame quits the application. DefaultSDIApplication 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.

Version:
$Id: DefaultSDIApplication.java 573 2009-10-13 05:59:20Z rawcoder $
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jhotdraw.app.AbstractApplication
labels, VIEW_COUNT_PROPERTY
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Fields inherited from interface org.jhotdraw.app.Application
ACTIVE_VIEW_PROPERTY
 
Constructor Summary
DefaultSDIApplication()
          Creates a new instance.
 
Method Summary
 void configure(java.lang.String[] args)
          Configures the application using the provided arguments array.
protected  javax.swing.JMenu createEditMenu()
           
protected  javax.swing.JMenu createFileMenu(View p)
           
protected  javax.swing.JMenu createHelpMenu(View p)
           
protected  javax.swing.JMenuBar createMenuBar(View p, java.util.List<javax.swing.Action> toolBarActions)
          The view menu bar is displayed for a view.
protected  javax.swing.JMenu createViewMenu(View p, java.util.List<javax.swing.Action> viewActions)
          Creates the view menu.
 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 initApplicationActions()
           
protected  void initLookAndFeel()
           
protected  void initViewActions(View p)
           
 boolean isSharingToolsAmongViews()
          Returns true, if this application shares tools among multiple views.
 void launch(java.lang.String[] args)
          Launches the application from the main method.
 void remove(View p)
          Removes a view from this application and removes it from the users view.
 void show(View p)
          Shows a view.
protected  void updateViewTitle(View p, 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.
 
Methods inherited from class org.jhotdraw.app.AbstractApplication
add, addPalette, addRecentFile, addWindow, basicCreateView, clearRecentFiles, createContainer, createView, getActiveView, getCopyright, getModel, getName, getVersion, initLabels, isEnabled, recentFiles, removePalette, removeWindow, setActiveView, setEnabled, setModel, start, stop, views
 
Methods inherited from class org.jhotdraw.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, clone, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, 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

DefaultSDIApplication

public DefaultSDIApplication()
Creates a new instance.

Method Detail

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

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

remove

public void remove(View p)
Description copied from interface: Application
Removes a view from this application and removes it from the users view. Fires a "documentCount" property change event. Invokes method setApplication(null) on the view object.

Specified by:
remove in interface Application
Overrides:
remove 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()

initViewActions

protected void initViewActions(View p)
Specified by:
initViewActions in class AbstractApplication

show

public void show(View p)
Description copied from interface: Application
Shows a view.


wrapViewComponent

protected java.awt.Component wrapViewComponent(View p)
Returns the view component. Eventually wraps it into another component in order to provide additional functionality.


hide

public void hide(View p)
Description copied from interface: Application
Hides a view.


dispose

public void dispose(View p)
Description copied from interface: Application
This is a convenience method for removing a view and disposing it.

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

createMenuBar

protected javax.swing.JMenuBar createMenuBar(View p,
                                             java.util.List<javax.swing.Action> toolBarActions)
The view menu bar is displayed for a view. The default implementation returns a new screen menu bar.


createFileMenu

protected javax.swing.JMenu createFileMenu(View p)

createEditMenu

protected javax.swing.JMenu createEditMenu()

updateViewTitle

protected void updateViewTitle(View p,
                               javax.swing.JFrame f)
Updates the title of a view and displays it in the given frame.

Parameters:
p - The view.
f - The frame.

isSharingToolsAmongViews

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


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.


createViewMenu

protected javax.swing.JMenu createViewMenu(View p,
                                           java.util.List<javax.swing.Action> viewActions)
Creates the view menu.

Parameters:
p - The View
viewActions - Actions for the view menu
Returns:
A JMenu or null, if no view actions are provided

createHelpMenu

protected javax.swing.JMenu createHelpMenu(View p)

Copyright 1996-2009 (c) by the authors and contributors of the JHotDraw project.
Some rights reserved.