org.jhotdraw.app
Class DefaultApplicationModel

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.app.DefaultApplicationModel
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, ApplicationModel
Direct Known Subclasses:
DrawApplicationModel, NetApplicationModel, ODGApplicationModel, PertApplicationModel, SVGApplicationModel, TeddyApplicationModel

public class DefaultApplicationModel
extends AbstractBean
implements ApplicationModel

DefaultApplicationModel.

Version:
1.1 2007-01-11 Changed method createToolBars.
1.0 June 10, 2006 Created.
Author:
Werner Randelshofer.
See Also:
Serialized Form

Field Summary
private  java.util.HashMap<java.lang.String,javax.swing.Action> actions
           
private  java.lang.String copyright
           
static java.lang.String COPYRIGHT_PROPERTY
           
private  java.lang.String name
           
static java.lang.String NAME_PROPERTY
           
private  java.lang.String version
           
static java.lang.String VERSION_PROPERTY
           
static java.lang.String VIEW_CLASS_NAME_PROPERTY
           
static java.lang.String VIEW_CLASS_PROPERTY
           
private  java.lang.Class viewClass
           
private  java.lang.String viewClassName
           
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
DefaultApplicationModel()
          Creates a new instance.
 
Method Summary
protected  javax.swing.JMenu createEditMenu(Application a, View p)
           
 java.util.List<javax.swing.JMenu> createMenus(Application a, View p)
          Creates menus.
 java.util.List<javax.swing.JToolBar> createToolBars(Application app, View p)
          Creates toolbars for the application.
 View createView()
          Creates a new view for the application.
 javax.swing.Action getAction(java.lang.String id)
          Returns the action with the specified id.
 java.lang.String getCopyright()
          Returns the copyright of the application.
 java.lang.String getName()
          Returns the name of the application.
 java.lang.String getVersion()
          Returns the version of the application.
 java.lang.Class getViewClass()
           
 void initApplication(Application a)
           
 void initView(Application a, View p)
           
 void putAction(java.lang.String id, javax.swing.Action action)
          Puts an action with the specified id.
 void setCopyright(java.lang.String newValue)
           
 void setName(java.lang.String newValue)
           
 void setVersion(java.lang.String newValue)
           
 void setViewClass(java.lang.Class newValue)
          Use this method only, if setViewClassName() does not suit you.
 void setViewClassName(java.lang.String newValue)
          Use this method for best application startup performance.
 
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
 

Field Detail

actions

private java.util.HashMap<java.lang.String,javax.swing.Action> actions

name

private java.lang.String name

version

private java.lang.String version

copyright

private java.lang.String copyright

viewClass

private java.lang.Class viewClass

viewClassName

private java.lang.String viewClassName

NAME_PROPERTY

public static final java.lang.String NAME_PROPERTY
See Also:
Constant Field Values

VERSION_PROPERTY

public static final java.lang.String VERSION_PROPERTY
See Also:
Constant Field Values

COPYRIGHT_PROPERTY

public static final java.lang.String COPYRIGHT_PROPERTY
See Also:
Constant Field Values

VIEW_CLASS_NAME_PROPERTY

public static final java.lang.String VIEW_CLASS_NAME_PROPERTY
See Also:
Constant Field Values

VIEW_CLASS_PROPERTY

public static final java.lang.String VIEW_CLASS_PROPERTY
See Also:
Constant Field Values
Constructor Detail

DefaultApplicationModel

public DefaultApplicationModel()
Creates a new instance.

Method Detail

setName

public void setName(java.lang.String newValue)

getName

public java.lang.String getName()
Description copied from interface: ApplicationModel
Returns the name of the application.

Specified by:
getName in interface ApplicationModel

setVersion

public void setVersion(java.lang.String newValue)

getVersion

public java.lang.String getVersion()
Description copied from interface: ApplicationModel
Returns the version of the application.

Specified by:
getVersion in interface ApplicationModel

setCopyright

public void setCopyright(java.lang.String newValue)

getCopyright

public java.lang.String getCopyright()
Description copied from interface: ApplicationModel
Returns the copyright of the application.

Specified by:
getCopyright in interface ApplicationModel

setViewClassName

public void setViewClassName(java.lang.String newValue)
Use this method for best application startup performance.


setViewClass

public void setViewClass(java.lang.Class newValue)
Use this method only, if setViewClassName() does not suit you.


getViewClass

public java.lang.Class getViewClass()

createView

public View createView()
Description copied from interface: ApplicationModel
Creates a new view for the application.

Specified by:
createView in interface ApplicationModel

createToolBars

public java.util.List<javax.swing.JToolBar> createToolBars(Application app,
                                                           View p)
Creates toolbars for the application. This class creates a standard toolbar with the following buttons in it:

Specified by:
createToolBars in interface ApplicationModel
Parameters:
app - Application.
p - The view for which the toolbars need to be created, or null if the toolbar needs to be shared with multiple views.

createMenus

public java.util.List<javax.swing.JMenu> createMenus(Application a,
                                                     View p)
Description copied from interface: ApplicationModel
Creates menus.

Depending on the document interface of the application, this method may be invoked only once for the application, or for each opened view.

Specified by:
createMenus in interface ApplicationModel
Parameters:
a - Application.
p - The view for which the toolbars need to be created, or null if the toolbar needs to be shared with multiple views.

createEditMenu

protected javax.swing.JMenu createEditMenu(Application a,
                                           View p)

initView

public void initView(Application a,
                     View p)
Specified by:
initView in interface ApplicationModel

initApplication

public void initApplication(Application a)
Specified by:
initApplication in interface ApplicationModel

getAction

public javax.swing.Action getAction(java.lang.String id)
Returns the action with the specified id.

Specified by:
getAction in interface ApplicationModel

putAction

public void putAction(java.lang.String id,
                      javax.swing.Action action)
Puts an action with the specified id.

Specified by:
putAction in interface ApplicationModel