JHotDraw 7.0.9

org.jhotdraw.app
Class AbstractApplication

java.lang.Object
  extended by org.jhotdraw.beans.AbstractBean
      extended by org.jhotdraw.app.AbstractApplication
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Application
Direct Known Subclasses:
DefaultAppletApplication, DefaultMDIApplication, DefaultOSXApplication, DefaultSDIApplication

public abstract class AbstractApplication
extends AbstractBean
implements Application

AbstractApplication.

Version:
1.1 2006-05-01 System.exit(0) explicitly in method stop().
1.0 October 4, 2005 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
protected  ResourceBundleUtil labels
           
 
Fields inherited from class org.jhotdraw.beans.AbstractBean
propertySupport
 
Constructor Summary
AbstractApplication()
          Creates a new instance.
 
Method Summary
 void add(Project p)
          Adds a project to this application.
 void addRecentFile(java.io.File file)
          Appends a file to the list of recent files.
protected  Project basicCreateProject()
           
 void clearRecentFiles()
          Clears the list of recent files.
 void configure(java.lang.String[] args)
          Configures the application using the provided arguments array.
 java.awt.Container createContainer()
           
 Project createProject()
          Creates a new project for this application.
 void dispose(Project p)
          This is a convenience method for removing a project and disposing it.
 java.lang.String getCopyright()
          Returns the copyright of the application.
 ApplicationModel getModel()
          Returns the application model.
 java.lang.String getName()
          Returns the name of the application.
 java.lang.String getVersion()
          Returns the version of the application.
 void init()
          Initializes the application.
protected  void initLabels()
           
protected abstract  void initProjectActions(Project p)
           
 boolean isEnabled()
          Returns the enabled state of the application.
 void launch(java.lang.String[] args)
          Launches the application from the main method.
 java.util.Collection<Project> projects()
          Returns a read only collection view of the projects of this application.
 java.util.List<java.io.File> recentFiles()
          Returns the recently opened files.
 void remove(Project p)
          Removes a project from this application and removes it from the users view.
 void setEnabled(boolean newValue)
          Sets the enabled state of the application.
 void setModel(ApplicationModel newValue)
          Sets the application model.
 void start()
          Starts the application.
 void stop()
          Stops the application without saving any unsaved projects.
 
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, getComponent, getCurrentProject, hide, isSharingToolsAmongProjects, removePropertyChangeListener, show
 

Field Detail

labels

protected ResourceBundleUtil labels
Constructor Detail

AbstractApplication

public AbstractApplication()
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

start

public void start()
Description copied from interface: Application
Starts the application. This usually creates a new project, and adds it to the application. init() must have been invoked before the application is started.

Specified by:
start in interface Application

createProject

public final Project createProject()
Description copied from interface: Application
Creates a new project for this application.

Specified by:
createProject in interface Application

setModel

public void setModel(ApplicationModel newValue)
Description copied from interface: Application
Sets the application model.

Specified by:
setModel in interface Application

getModel

public ApplicationModel getModel()
Description copied from interface: Application
Returns the application model.

Specified by:
getModel in interface Application

basicCreateProject

protected Project basicCreateProject()

getName

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

Specified by:
getName in interface Application

getVersion

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

Specified by:
getVersion in interface Application

getCopyright

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

Specified by:
getCopyright in interface Application

initProjectActions

protected abstract void initProjectActions(Project p)

stop

public void stop()
Description copied from interface: Application
Stops the application without saving any unsaved projects. init() must have been invoked before the application is stopped.

Specified by:
stop in interface Application

remove

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

Specified by:
remove in interface Application

add

public void add(Project p)
Description copied from interface: Application
Adds a project to this application. Fires a "documentCount" property change event. Invokes method setApplication(this) on the project object.

Specified by:
add in interface Application

dispose

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

Specified by:
dispose in interface Application

projects

public java.util.Collection<Project> projects()
Description copied from interface: Application
Returns a read only collection view of the projects of this application.

Specified by:
projects in interface Application

isEnabled

public boolean isEnabled()
Description copied from interface: Application
Returns the enabled state of the application.

Specified by:
isEnabled in interface Application

setEnabled

public void setEnabled(boolean newValue)
Description copied from interface: Application
Sets the enabled state of the application. The enabled state is used to prevent parallel invocation of actions on the application. If an action consists of a sequential part and a concurrent part, it must disable the application only for the sequential part. Actions that act on the application must check in their actionPerformed method whether the application is enabled. If the application is disabled, they must do nothing. If the application is enabled, they must disable the application, perform the action and then enable the application again. This is a bound property.

Specified by:
setEnabled in interface Application

createContainer

public java.awt.Container createContainer()

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

initLabels

protected void initLabels()

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

recentFiles

public java.util.List<java.io.File> recentFiles()
Description copied from interface: Application
Returns the recently opened files. By convention, this is an immutable list.

Specified by:
recentFiles in interface Application

clearRecentFiles

public void clearRecentFiles()
Description copied from interface: Application
Clears the list of recent files. This fires a property change event for the property "recentFiles".

Specified by:
clearRecentFiles in interface Application

addRecentFile

public void addRecentFile(java.io.File file)
Description copied from interface: Application
Appends a file to the list of recent files. This fires a property change event for the property "recentFiles".

Specified by:
addRecentFile in interface Application

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