org.argouml.kernel
Class ProjectManager

java.lang.Object
  extended byorg.argouml.kernel.ProjectManager
All Implemented Interfaces:
MementoCreationObserver

public final class ProjectManager
extends Object
implements MementoCreationObserver

This class manages the projects loaded in argouml. 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 String CURRENT_PROJECT_PROPERTY_NAME
          The name of the property that defines the current project.
static String NO_PROJECT
          The name of the property that there is no project.
static String SAVE_STATE_PROPERTY_NAME
          The name of the property that defines the save state.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a listener to the listener list.
 Project getCurrentProject()
          Returns the current project.
static ProjectManager getManager()
          The singleton accessor method of this class.
 Project makeEmptyProject()
          Makes an empty project with two standard diagrams.
 void mementoCreated(ModelMemento memento)
          Called when the model subsystem creates a memento.
 void removeProject(Project oldProject)
          Remove the project.
 void removePropertyChangeListener(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).
 void setSaveAction(Action save)
          Set the save action.
 void setSaveEnabled(boolean newValue)
          Notify the gui that the current project's save state has changed.
 
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 String CURRENT_PROJECT_PROPERTY_NAME
The name of the property that defines the current project.

See Also:
Constant Field Values

NO_PROJECT

public static final String NO_PROJECT
The name of the property that there is no project.

See Also:
Constant Field Values

SAVE_STATE_PROPERTY_NAME

public static final String SAVE_STATE_PROPERTY_NAME
The name of the property that defines the save state.

See Also:
Constant Field Values
Method Detail

getManager

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

Returns:
The singleton.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to the listener list.

Parameters:
listener - The listener to add.

removePropertyChangeListener

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

Parameters:
listener - The listener to remove.

setCurrentProject

public void setCurrentProject(Project newProject)
Sets the current project (the project that is viewable in the projectbrowser). Sets the current diagram for the project (if one exists). 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.

If there is no project, a new one is created (unless we are busy creating one).

Returns:
Project the current project

makeEmptyProject

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

Returns:
Project

setSaveAction

public void setSaveAction(Action save)
Set the save action.

Parameters:
save - the action to be used

setSaveEnabled

public void setSaveEnabled(boolean newValue)
Notify the gui that the current project's save state has changed. There are 2 receivers: the SaveProject tool icon and the title bar (for showing a *).

Parameters:
newValue - The new state.

removeProject

public void removeProject(Project oldProject)
Remove the project.

Parameters:
oldProject - The project to be removed.

mementoCreated

public void mementoCreated(ModelMemento memento)
Called when the model subsystem creates a memento. We must add this to the UndoManager.

Specified by:
mementoCreated in interface MementoCreationObserver
Parameters:
memento - the memento.
See Also:
MementoCreationObserver.mementoCreated(org.argouml.model.ModelMemento)


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook