JHotDraw 7.0.9

org.jhotdraw.application
Interface DocumentOrientedApplication

All Known Implementing Classes:
AbstractDocumentOrientedApplication, AbstractMDIApplication, AbstractOSXApplication, AbstractSDIApplication, TeddyMDIApplication, TeddySDIApplication

public interface DocumentOrientedApplication

An DocumentOrientedApplication handles the lifecycle of Projects and provides windows to present them on screen. Depending on the document interface style used by the DocumentOrientedApplication, the DocumentOrientedApplication can handle multiple Projects at the same time, or only one.

Typical document interface styles are the Single Document Interface (SDI), the Multiple Document Interface (MDI) and the Mac OS X DocumentOrientedApplication Document Interface (OSX).

Typical usage of this class:

 public class MyMainClass {
     public static void main(String[] args) {
         DocumentOrientedApplication application = new DefaultADIApplication();
         DefaultApplicationModel model = new DefaultApplicationModel();
         model.setName("MyAppliciation");
         model.setVersion("1.0");
         model.setCopyright("Copyright 2006 (c) Werner Randelshofer. All Rights Reserved.");
         model.setProjectClassName("org.jhotdraw.myapplication.MyProject");
         application.setModel(model);
         application.launch(args);
     } 
 

Version:
2007-07-08 Reworked for JSR-296 version 0.42.
1.0 October 4, 2005 Created.
Author:
Werner Randelshofer

Method Summary
 void add(DocumentView v)
          Adds a view to this application.
 void addPalette(java.awt.Window w)
          Adds a palette window to the application.
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Adds a property change listener.
 void addRecentFile(java.io.File file)
          Appends a file to the list of recent files.
 void clearRecentFiles()
          Clears the list of recent files.
 DocumentView createView()
          Creates a new view for this application.
 javax.swing.Action getAction(java.lang.Object key)
          Gets the action with the specified key from the ActionMap of the application.
 java.awt.Component getComponent()
          Returns the application component.
 DocumentView getCurrentView()
          Returns the current view.
 java.util.Collection<DocumentView> getViews()
          Returns a read only collection view of the getViews of this application.
 void hide(DocumentView v)
          Hides a view.
 void initialize(java.lang.String[] args)
          Initializes the application.
 boolean isEditorShared()
          Returns true, if this application shares tools among multiple getViews.
 boolean isEnabled()
          Returns the enabled state of the application.
 java.util.List<java.io.File> recentFiles()
          Returns the recently opened files.
 void remove(DocumentView v)
          Removes a view from this application and removes it from the users view.
 void removePalette(java.awt.Window w)
          Removes a palette window from the application.
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Removes a property change listener.
 void setEnabled(boolean newValue)
          Sets the enabled state of the application.
 void show(DocumentView v)
          Shows a view.
 void shutdown()
          Stops the application without saving any unsaved getViews.
 void startup()
          Starts the application.
 

Method Detail

initialize

void initialize(java.lang.String[] args)
Initializes the application. configureAWT() should have been invoked before the application is inited. Alternatively an application can be configured using setter methods.


startup

void startup()
Starts the application. This usually creates a new view, and adds it to the application. initialize() must have been invoked before the application is started.


shutdown

void shutdown()
Stops the application without saving any unsaved getViews. initialize() must have been invoked before the application is stopped.


createView

DocumentView createView()
Creates a new view for this application.


add

void add(DocumentView v)
Adds a view to this application. Calls init on the view. Fires a "documentCount" property change event. Invokes method setApplication(this) on the view object.


remove

void remove(DocumentView v)
Removes a view from this application and removes it from the users view. Calls dispose on the view. Fires a "documentCount" property change event. Invokes method setApplication(null) on the view object.


show

void show(DocumentView v)
Shows a view. Calls start on the view.


hide

void hide(DocumentView v)
Hides a view. Calls stop on the view.


getViews

java.util.Collection<DocumentView> getViews()
Returns a read only collection view of the getViews of this application.


getCurrentView

DocumentView getCurrentView()
Returns the current view. This is used for OSXApplication and MDIApplication which share actions among multiple DocumentView instances. Current view may be become null, if the application has no view.

This is a bound property.


isEnabled

boolean isEnabled()
Returns the enabled state of the application.


setEnabled

void setEnabled(boolean newValue)
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.


addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Adds a property change listener.


removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Removes a property change listener.


isEditorShared

boolean isEditorShared()
Returns true, if this application shares tools among multiple getViews.


getComponent

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


recentFiles

java.util.List<java.io.File> recentFiles()
Returns the recently opened files. By convention, this is an immutable list.


addRecentFile

void addRecentFile(java.io.File file)
Appends a file to the list of recent files. This fires a property change event for the property "recentFiles".


clearRecentFiles

void clearRecentFiles()
Clears the list of recent files. This fires a property change event for the property "recentFiles".


addPalette

void addPalette(java.awt.Window w)
Adds a palette window to the application.


removePalette

void removePalette(java.awt.Window w)
Removes a palette window from the application.


getAction

javax.swing.Action getAction(java.lang.Object key)
Gets the action with the specified key from the ActionMap of the application.


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