fdda.core.projects
Interface ProjectManager

All Known Implementing Classes:
ProjectManagerImpl

public interface ProjectManager

Project manager interface. Only one instance exists. Generates events for each (important) action; listeners can register for these events according to the observer pattern. All manipulations concerning whole projects run through this class. The manager also keeps track of whether a project is currently being demonstrated. Only one project can be in demonstration mode at each point of time.

Author:
Jörg Rüdenauer

Method Summary
 void addProjectListener(ProjectListener listener)
          Adds a project listener.
 void changeProjectName(Project project, String name)
          Changes the name of a project.
 boolean closeAll()
          Closes all projects.
 boolean closeProject(Project project)
          Closes a project.
 Project getActiveProject()
          Returns the currently active project (the user activates projects by selecting the frame).
 int getNrOfProjects()
          Returns the number of projects that are open.
 boolean isInDemoState()
          Returns whether a project is currently being demonstrated.
 Project newProject()
          Creates a new project.
 Project openProject(String location)
          Opens a project from a certain location.
 Iterator projects()
          Returns an iterator over the open projects.
 void removeProjectListener(ProjectListener listener)
          Removes a project listener.
 void saveProject(Project project, boolean newName)
          Saves a project.
 void setActiveProject(Project project)
          Sets the currently active project.
 void setDemoStateForActiveProject()
          Turns the currently active project into demo state.
 void setModState()
          Returns to the modelling state.
 

Method Detail

newProject

public Project newProject()
Creates a new project.

Returns:
a new, empty project

openProject

public Project openProject(String location)
Opens a project from a certain location. The current plugin is used to perform this operation. The new project is returned.

Parameters:
location - storage location of the project, e.g. a file path
Returns:
the loaded project or null if an error occured

saveProject

public void saveProject(Project project,
                        boolean newName)
Saves a project. The current plugin is used to perform this operation (and also to determine the storage location).

Parameters:
project - the project to be saved
newName - whether the project shall be saved in a new location ('save as')

closeProject

public boolean closeProject(Project project)
Closes a project. Checks whether it should be saved and whether a demo must be stopped before closing.

Parameters:
project - the project to be closed
Returns:
true, iff the project was closed

closeAll

public boolean closeAll()
Closes all projects.

Returns:
true, iff all projects were closed

changeProjectName

public void changeProjectName(Project project,
                              String name)
Changes the name of a project.

Parameters:
project - the project
name - the new name

getActiveProject

public Project getActiveProject()
Returns the currently active project (the user activates projects by selecting the frame).

Returns:
the project that is active or null if no project is active

setActiveProject

public void setActiveProject(Project project)
Sets the currently active project. This doesn't change the active frame but follows from changing the active frame.

Parameters:
project - the project that is active now

getNrOfProjects

public int getNrOfProjects()
Returns the number of projects that are open.

Returns:
the number of open projects

projects

public Iterator projects()
Returns an iterator over the open projects.

Returns:
Iterator over the open projects

setModState

public void setModState()
Returns to the modelling state. Since there can only be one project in demo state, no project must be given.


isInDemoState

public boolean isInDemoState()
Returns whether a project is currently being demonstrated.

Returns:
whether a project is currently in the demo state

setDemoStateForActiveProject

public void setDemoStateForActiveProject()
Turns the currently active project into demo state.


addProjectListener

public void addProjectListener(ProjectListener listener)
Adds a project listener.

Parameters:
listener - the listener

removeProjectListener

public void removeProjectListener(ProjectListener listener)
Removes a project listener.

Parameters:
listener - the listener


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.