org.argouml.kernel
Class ProjectManager

java.lang.Object
  |
  +--org.argouml.kernel.ProjectManager

public final class ProjectManager
extends java.lang.Object

This class manages the projects loaded in argouml. It is a singleton. Classes in Argouml can ask this class for the current project and set the current project. Since we only have one project in ArgoUML at the moment, this class does not manage a list of projects like one would expect. This could be a nice extension for the future of argouml. As soon as the current project is changed, a property changed event is fired.

Since:
Nov 17, 2002

Field Summary
static java.lang.String CURRENT_PROJECT_PROPERTY_NAME
           
static java.lang.String SAVE_STATE_PROPERTY_NAME
           
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds an instance implementing propertychangelistener to the listener list
 Project getCurrentProject()
          Returns the current project.
static ProjectManager getManager()
          The singleton accessor method of this class
 Project loadProject(java.net.URL url)
          This method creates a project from the specified URL Unlike the constructor which forces an .argo extension This method will attempt to load a raw XMI file This method can fail in several different ways.
 Project makeEmptyProject()
          Makes an empty project with two standard diagrams.
 void notifySavePropertyChanged(boolean newValue)
          notify the gui from the project manager that the current project's save state has changed.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a listener from the listener list.
 void setCurrentProject(Project newProject)
          Sets the current project (the project that is viewable in the projectbrowser).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_PROJECT_PROPERTY_NAME

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

SAVE_STATE_PROPERTY_NAME

public static final java.lang.String SAVE_STATE_PROPERTY_NAME
See Also:
Constant Field Values
Method Detail

getManager

public static ProjectManager getManager()
The singleton accessor method of this class


addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds an instance implementing propertychangelistener to the listener list

Parameters:
listener -

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a listener from the listener list.

Parameters:
listener -

setCurrentProject

public void setCurrentProject(Project newProject)
Sets the current project (the project that is viewable in the projectbrowser). This method fires a propertychanged event.

If the argument is null, then the current project will be forgotten about.

Parameters:
newProject - The new project.

getCurrentProject

public Project getCurrentProject()
Returns the current project.

Returns:
Project

makeEmptyProject

public Project makeEmptyProject()
Makes an empty project with two standard diagrams.

Returns:
Project

loadProject

public Project loadProject(java.net.URL url)
                    throws java.io.IOException,
                           IllegalFormatException,
                           org.xml.sax.SAXException,
                           javax.xml.parsers.ParserConfigurationException
This method creates a project from the specified URL Unlike the constructor which forces an .argo extension This method will attempt to load a raw XMI file This method can fail in several different ways. Either by throwing an exception or by having the ArgoParser.SINGLETON.getLastLoadStatus() set to not true. TODO: The exception in the throws clause should be splitted in several other types of exceptions to handle errors better

java.io.IOException
IllegalFormatException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException

notifySavePropertyChanged

public void notifySavePropertyChanged(boolean newValue)
notify the gui from the project manager that the current project's save state has changed.



ArgoUML © 1996-2003 (20030919)ArgoUML Project HomeArgoUML Cookbook