org.argouml.kernel
Interface Project

All Known Implementing Classes:
ProjectImpl

public interface Project

The Project interface encapsulates all information about a designer's project. It contains the list of diagrams and UML models, various project properties such as the author's name, and defaults for various settings.

TODO: This interface was mechanically refactored from the implementation class ProjectImpl. It needs to be reviewed and cleaned up, eliminating methods which should be part of the public API and splitting the interface into smaller function specific (e.g. TrashCan) interfaces.

Since:
0.25.4 when it replaced the concrete class of the same name

Field Summary
static int PROFILE_PROJECT
          Project type: a profile project
static int UML_PROJECT
          Project type: an UML project
 
Method Summary
 void addDiagram(ArgoDiagram d)
           
 void addMember(java.lang.Object m)
          Add a member: ArgoDiagram, a UML Model, or a ProjectMemberTodoList.
 void addModel(java.lang.Object model)
           
 void addSearchPath(java.lang.String searchPathElement)
           
 java.util.Collection findAllPresentationsFor(java.lang.Object obj)
          Returns a list with all figs for some UML object on all diagrams.
 java.util.Collection<Fig> findFigsForMember(java.lang.Object member)
          Finds all figs on the diagrams for some project member, including the figs containing the member (so for some operation, the containing figclass is returned).
 java.lang.Object findType(java.lang.String s)
          Searches for a type/classifier with name s.
 java.lang.Object findType(java.lang.String s, boolean defineNew)
          Searches for a type/classifier with name s.
 java.lang.Object findTypeInDefaultModel(java.lang.String name)
          Find a type by name in the default model.
 java.lang.Object findTypeInModel(java.lang.String s, java.lang.Object ns)
          Finds a classifier with a certain name.
 ArgoDiagram getActiveDiagram()
          Deprecated. for 0.27.2 by tfmorris for all uses other than argo.tee. The active diagram is a concept associated with the current editing window, not a project. It can be retrieved from DiagramUtils.getActiveDiagram(), which will get the diagram for the window that last contained the mouse (from GEF). Alternatively, to get the diagram from a Fig, use ((LayerPerspective) getLayer()).getDiagram().
 java.lang.String getAuthoremail()
          Get the author e-mail address.
 java.lang.String getAuthorname()
          Get the author name.
 java.lang.Object getCurrentNamespace()
          Deprecated. for 0.27.2 by tfmorris. Since we can now have multiple top level packages in the project, there is no concept of a single current namespace. Callers should use getRoots() and be prepared to handle multiple roots.
 java.lang.Object getDefaultAttributeType()
          Return the default type for an attribute.
 java.lang.Object getDefaultParameterType()
          Return the default type for a parameter.
 java.lang.Object getDefaultReturnType()
          Return the default type for the return parameter of a method.
 java.lang.String getDescription()
          Get the description.
 ArgoDiagram getDiagram(java.lang.String name)
          Finds a diagram with a specific name or UID.
 int getDiagramCount()
          Get the number of diagrams in this project.
 java.util.List<ArgoDiagram> getDiagramList()
           
 java.lang.String getHistoryFile()
          Get the history file name.
 java.lang.Object getInitialTarget()
           
 java.util.List<ProjectMember> getMembers()
          Get all members of the project.
 java.lang.Object getModel()
          Deprecated. for 0.25.4 by tfmorris. Use getUserDefinedModelList() or getModels().
 java.util.Collection getModels()
          Returns all top level Packages (e.g.
 java.lang.String getName()
          Get the project name.
 int getPersistenceVersion()
          Used by "argo.tee".
 int getPresentationCountFor(java.lang.Object me)
           
 ProfileConfiguration getProfileConfiguration()
           
 ProjectSettings getProjectSettings()
          Used by "argo.tee".
 int getProjectType()
          Get the project type.
 java.lang.Object getRoot()
          Deprecated. for 0.25.4 by tfmorris - use getRoots() to packages/model elements which are at the top level.

TODO: We probably need a getDefaultNamespace() method or something similar to replace some uses of this.

 java.util.Collection getRoots()
          Return a collection of top level Model Elements.
 java.util.List<java.lang.String> getSearchPathList()
          Used by "argo.tee".
 UndoManager getUndoManager()
          Return the UndoManager for this project.
 java.net.URI getUri()
          Returns the uri.
 java.net.URI getURI()
          Get the URI for this project.
 java.util.List getUserDefinedModelList()
          Returns all models defined by the user.
 java.util.Map<java.lang.String,java.lang.Object> getUUIDRefs()
          Returns the uUIDRefs.
 java.lang.String getVersion()
          Get the version.
 java.beans.VetoableChangeSupport getVetoSupport()
          Deprecated. for 0.27.3 by tfmorris. This appears to be unused anywhere in ArgoUML. Speak up now if you need it.
 boolean isDirty()
           
 boolean isInTrash(java.lang.Object obj)
          Deprecated. for 0.27.3 by tfmorris. Not actually implemented. The (future) Undo facility is a better way to handle this.
 boolean isValidDiagramName(java.lang.String name)
          Returns true if the given name is a valid name for a diagram.
 void moveToTrash(java.lang.Object obj)
          Moves some object to trash, i.e.
 void postLoad()
          This is executed after a load.
 void postSave()
          This is executed after a save.
 void preSave()
          This is executed before a save.
 void remove()
          Remove the project.
 java.lang.String repair()
          Repair all parts of the project before a save takes place.
 void setActiveDiagram(ArgoDiagram theDiagram)
          Deprecated. for 0.27.2 by tfmorris. The active diagram is a concept associated with the current editing window, not a project.
 void setAuthoremail(java.lang.String s)
          Set the author e-mail address.
 void setAuthorname(java.lang.String s)
          Set the author name.
 void setCurrentNamespace(java.lang.Object m)
          Deprecated. for 0.27.2 by tfmorris. Since we can now have multiple top level packages in the project, there is no concept of a single current namespace. To add a new top-level package, use getRoots().add(Object).
 void setDescription(java.lang.String s)
          Set a new description.
 void setDirty(boolean isDirty)
          Set the dirty flag for the project.
 void setFile(java.io.File file)
          Set the project file.
 void setHistoryFile(java.lang.String s)
          Set the history file name.
 void setPersistenceVersion(int pv)
           
 void setProfileConfiguration(ProfileConfiguration pc)
          Set the profile configuration.
 void setProjectType(int projectType)
          Set the project type.
 void setRoot(java.lang.Object root)
          Deprecated. for 0.25.4 by tfmorris - use setRoots(java.util.Collection).
 void setRoots(java.util.Collection elements)
          Set the top level ModelElements for this project.
 void setSavedDiagramName(java.lang.String diagramName)
           
 void setSearchPath(java.util.List<java.lang.String> theSearchpath)
          Sets the searchpath.
 void setUri(java.net.URI theUri)
          Set the URI for this project.
 void setUUIDRefs(java.util.Map<java.lang.String,java.lang.Object> uUIDRefs)
          Sets the uUIDRefs.
 void setVersion(java.lang.String s)
          Set the new version.
 void setVetoSupport(java.beans.VetoableChangeSupport theVetoSupport)
          Deprecated. for 0.27.3 by tfmorris. This appears to be unused anywhere in ArgoUML. Speak up now if you need it.
 

Field Detail

UML_PROJECT

static final int UML_PROJECT
Project type: an UML project

See Also:
Constant Field Values

PROFILE_PROJECT

static final int PROFILE_PROJECT
Project type: a profile project

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Get the project name. This is just the name part of the full filename.

Returns:
the name of the project

getProjectType

int getProjectType()
Get the project type. (Currently needed for profile project; probably no longer needed when ArgoUML supports multimodel projects.)

Returns:
The URI.

setProjectType

void setProjectType(int projectType)
Set the project type. (Currently needed for profile project; probably no longer needed when ArgoUML supports multimodel projects.)

Parameters:
projectType - The new project type.

getURI

java.net.URI getURI()
Get the URI for this project.

Returns:
The URI.

setUri

void setUri(java.net.URI theUri)
Set the URI for this project.

Don't use this directly! Use instead: #setProjectURI(URI, Project)

TODO: Why isn't this deprecated or private if it is not to be used?

Parameters:
theUri - The URI to set.

setFile

void setFile(java.io.File file)
Set the project file. This only works if it is possible to convert the File to an uri.

Parameters:
file - File to set the project to.

getSearchPathList

java.util.List<java.lang.String> getSearchPathList()
Used by "argo.tee".

Returns:
the search path

addSearchPath

void addSearchPath(java.lang.String searchPathElement)
Parameters:
searchPathElement - the element to be added to the searchpath

setSearchPath

void setSearchPath(java.util.List<java.lang.String> theSearchpath)
Sets the searchpath.

Parameters:
theSearchpath - The searchpath to set

getMembers

java.util.List<ProjectMember> getMembers()
Get all members of the project. Used by "argo.tee".

Returns:
all members.

addMember

void addMember(java.lang.Object m)
Add a member: ArgoDiagram, a UML Model, or a ProjectMemberTodoList.

Parameters:
m - the member to be added

addModel

void addModel(java.lang.Object model)
Parameters:
model - a namespace

getAuthorname

java.lang.String getAuthorname()
Get the author name. Used by "argo.tee".

Returns:
The author name.

setAuthorname

void setAuthorname(java.lang.String s)
Set the author name.

Parameters:
s - The new author name.

getAuthoremail

java.lang.String getAuthoremail()
Get the author e-mail address. Used by "argo.tee".

Returns:
the author e-mail address

setAuthoremail

void setAuthoremail(java.lang.String s)
Set the author e-mail address.

Parameters:
s - the new author e-mail address

getVersion

java.lang.String getVersion()
Get the version. This is the ArgoUML version that last saved this project. This field is not editable by the user. Used by "argo.tee".

Returns:
the version.

setVersion

void setVersion(java.lang.String s)
Set the new version. This is the ArgoUML version that last saved this project. This field is not editable by the user.

Parameters:
s - The new version.

getDescription

java.lang.String getDescription()
Get the description. This is the description of the project, as entered by the user. Used by "argo.tee".

Returns:
the description.

setDescription

void setDescription(java.lang.String s)
Set a new description. This is the description of the project. It is freely editable by the user.

Parameters:
s - The new description.

getHistoryFile

java.lang.String getHistoryFile()
Get the history file name. Not used. Used by "argo.tee".

Returns:
The history file.

setHistoryFile

void setHistoryFile(java.lang.String s)
Set the history file name.

Parameters:
s - The new history file.

getUserDefinedModelList

java.util.List getUserDefinedModelList()
Returns all models defined by the user. I.e. this does not return any profile packages but all other top level Packages (usually Models).

Returns:
A List of all user defined models.

getModels

java.util.Collection getModels()
Returns all top level Packages (e.g. Models), including the profile packages.

WARNING: The models returned by this method are not ordered. Any code which makes the assumption that the user model is first (or any other ordering assumption) is broken!

NOTE: Since user defined models and profiles are handled quite differently, you normally want to use getUserDefinedModelList() instead of this method.

Returns:
A Collection containing all models.

getModel

@Deprecated
java.lang.Object getModel()
Deprecated. for 0.25.4 by tfmorris. Use getUserDefinedModelList() or getModels().

Return the model.

If there isn't exactly one model, null is returned.

Returns:
the model.

getDefaultAttributeType

java.lang.Object getDefaultAttributeType()
Return the default type for an attribute.

Returns:
a Classifier to use as the default type TODO: This belongs in ProjectSettings. - tfm

getDefaultParameterType

java.lang.Object getDefaultParameterType()
Return the default type for a parameter.

Returns:
a Classifier to use as the default type TODO: This belongs in ProjectSettings. - tfm

getDefaultReturnType

java.lang.Object getDefaultReturnType()
Return the default type for the return parameter of a method.

Returns:
a Classifier to use as the default type TODO: This belongs in ProjectSettings. - tfm

findType

java.lang.Object findType(java.lang.String s)
Searches for a type/classifier with name s. If the type is not found, a new type is created and added to the current namespace.

TODO: Move to Model subsystem - tfm 20070307

Parameters:
s - the name of the type/classifier to be found
Returns:
Classifier

findType

java.lang.Object findType(java.lang.String s,
                          boolean defineNew)
Searches for a type/classifier with name s. If defineNew is true, a new type is defined if the type/classifier is not found. The newly created type is added to the currentNamespace and given the name s.

TODO: Move to Model subsystem - tfm 20070307

Parameters:
s - the name of the type/classifier to be found
defineNew - if true, define a new one
Returns:
Classifier the found classifier

findFigsForMember

java.util.Collection<Fig> findFigsForMember(java.lang.Object member)
Finds all figs on the diagrams for some project member, including the figs containing the member (so for some operation, the containing figclass is returned).

Parameters:
member - The member we are looking for. This can be a model element object but also another object.
Returns:
Collection The collection with the figs.

findAllPresentationsFor

java.util.Collection findAllPresentationsFor(java.lang.Object obj)
Returns a list with all figs for some UML object on all diagrams.

Parameters:
obj - the given UML object
Returns:
List the list of figs

findTypeInModel

java.lang.Object findTypeInModel(java.lang.String s,
                                 java.lang.Object ns)
Finds a classifier with a certain name.

Will only return first classifier with the matching name. TODO: Move to Model subsystem - tfm 20070307

Parameters:
s - is short name.
ns - Namespace where we do the search.
Returns:
the found classifier (or null if not found).

setCurrentNamespace

@Deprecated
void setCurrentNamespace(java.lang.Object m)
Deprecated. for 0.27.2 by tfmorris. Since we can now have multiple top level packages in the project, there is no concept of a single current namespace. To add a new top-level package, use getRoots().add(Object).

Parameters:
m - the namespace

getCurrentNamespace

@Deprecated
java.lang.Object getCurrentNamespace()
Deprecated. for 0.27.2 by tfmorris. Since we can now have multiple top level packages in the project, there is no concept of a single current namespace. Callers should use getRoots() and be prepared to handle multiple roots.

Returns:
the namespace

getDiagramList

java.util.List<ArgoDiagram> getDiagramList()
Returns:
the diagrams

getDiagramCount

int getDiagramCount()
Get the number of diagrams in this project. Used by argo2.tee!!

Returns:
the number of diagrams in this project.

getDiagram

ArgoDiagram getDiagram(java.lang.String name)
Finds a diagram with a specific name or UID.

Parameters:
name - is the name to search for.
Returns:
the diagram object (if found). Otherwise null.

addDiagram

void addDiagram(ArgoDiagram d)
Parameters:
d - the diagram to be added

getPresentationCountFor

int getPresentationCountFor(java.lang.Object me)
Parameters:
me - the given modelelement
Returns:
the total number of presentation for the given modelelement in the project

getInitialTarget

java.lang.Object getInitialTarget()
Returns:
an initial target, in casu a diagram or a model

getVetoSupport

@Deprecated
java.beans.VetoableChangeSupport getVetoSupport()
Deprecated. for 0.27.3 by tfmorris. This appears to be unused anywhere in ArgoUML. Speak up now if you need it.

Returns:
the VetoableChangeSupport object
See Also:
VetoableChangeSupport

preSave

void preSave()
This is executed before a save.


postSave

void postSave()
This is executed after a save.


postLoad

void postLoad()
This is executed after a load.


moveToTrash

void moveToTrash(java.lang.Object obj)
Moves some object to trash, i.e. deletes it completely with all dependent structures.

Deleting an object involves:

 - Removing Target history
 - Deleting all Fig representations for the object
 - Deleting the UML element
 - Deleting all dependent UML modelelements
 - Deleting CommentEdges (which are not UML elements)
 - Move to trash for enclosed objects, i.e. graphically drawn on top of
 - Move to trash subdiagrams for the object
 - Saveguard that there is always at least 1 diagram left
 - If the current diagram has been deleted, select a new one to show
 - Trigger the explorer when a diagram is deleted
 - Set the needsSave (dirty) flag of the projectmanager
 

Parameters:
obj - The object to be deleted
See Also:

TODO: This should just be named delete() or something which better tells what it does (since there really isn't a trash can).


isInTrash

@Deprecated
boolean isInTrash(java.lang.Object obj)
Deprecated. for 0.27.3 by tfmorris. Not actually implemented. The (future) Undo facility is a better way to handle this.

Parameters:
obj - the object
Returns:
true if the object is trashed

findTypeInDefaultModel

java.lang.Object findTypeInDefaultModel(java.lang.String name)
Find a type by name in the default model.

NOTE:The behavior of this method changed after version 0.24. Earlier versions copied the type from the profile or default model into the user model. The type is now returned directly and HREFs are used to link to it when the model is written out.

Parameters:
name - the name.
Returns:
the type.

getRoot

@Deprecated
java.lang.Object getRoot()
Deprecated. for 0.25.4 by tfmorris - use getRoots() to packages/model elements which are at the top level.

TODO: We probably need a getDefaultNamespace() method or something similar to replace some uses of this.

Returns the root package.

Returns:
the Package which is the root

setRoot

@Deprecated
void setRoot(java.lang.Object root)
Deprecated. for 0.25.4 by tfmorris - use setRoots(java.util.Collection).

Sets the root package.

Parameters:
root - The root to set, a UML Package

getRoots

java.util.Collection getRoots()
Return a collection of top level Model Elements. Normally for ArgoUML created models, this will be a single Package or Model, but other tools may allow more liberal structures.

Returns:
Collection of top level ModelElements

setRoots

void setRoots(java.util.Collection elements)
Set the top level ModelElements for this project.

Parameters:
elements - Collection of top level ModelElements

isValidDiagramName

boolean isValidDiagramName(java.lang.String name)
Returns true if the given name is a valid name for a diagram. Valid means that it does not occur as a name for a diagram yet.

Parameters:
name - The name to test
Returns:
boolean True if there are no problems with this name, false if it's not valid.

getUri

java.net.URI getUri()
Returns the uri.

Returns:
URI

getUUIDRefs

java.util.Map<java.lang.String,java.lang.Object> getUUIDRefs()
Returns the uUIDRefs.

Returns:
HashMap

setUUIDRefs

void setUUIDRefs(java.util.Map<java.lang.String,java.lang.Object> uUIDRefs)
Sets the uUIDRefs.

Parameters:
uUIDRefs - The uUIDRefs to set

setVetoSupport

@Deprecated
void setVetoSupport(java.beans.VetoableChangeSupport theVetoSupport)
Deprecated. for 0.27.3 by tfmorris. This appears to be unused anywhere in ArgoUML. Speak up now if you need it.

Sets the VetoableChangeSupport object. This will be returned by getVetoSupport() but is otherwise unused.

TODO: Why is this here since it's never used? - tfm

Parameters:
theVetoSupport - The vetoSupport to set
See Also:
VetoableChangeSupport

getActiveDiagram

@Deprecated
ArgoDiagram getActiveDiagram()
Deprecated. for 0.27.2 by tfmorris for all uses other than argo.tee. The active diagram is a concept associated with the current editing window, not a project. It can be retrieved from DiagramUtils.getActiveDiagram(), which will get the diagram for the window that last contained the mouse (from GEF). Alternatively, to get the diagram from a Fig, use ((LayerPerspective) getLayer()).getDiagram().

Get the current viewed diagram.

Used by "argo.tee" to save the name of this diagram, so that the same diagram can be initially shown when reloading this project. This probably needs to be converted to an ordered list of open diagram windows to support MDI.

Returns:
the current viewed diagram

setActiveDiagram

@Deprecated
void setActiveDiagram(ArgoDiagram theDiagram)
Deprecated. for 0.27.2 by tfmorris. The active diagram is a concept associated with the current editing window, not a project.

Parameters:
theDiagram - the ArgoDiagram

setSavedDiagramName

void setSavedDiagramName(java.lang.String diagramName)
Parameters:
diagramName - the name of the diagram to show by default after loading

remove

void remove()
Remove the project.


getPersistenceVersion

int getPersistenceVersion()
Used by "argo.tee".

Returns:
Returns the persistenceVersion.

setPersistenceVersion

void setPersistenceVersion(int pv)
Parameters:
pv - The persistenceVersion to set.

repair

java.lang.String repair()
Repair all parts of the project before a save takes place.

Returns:
a report of any fixes

getProjectSettings

ProjectSettings getProjectSettings()
Used by "argo.tee".

Returns:
the settings of this project

getProfileConfiguration

ProfileConfiguration getProfileConfiguration()
Returns:
Returns the profile configuration.

setProfileConfiguration

void setProfileConfiguration(ProfileConfiguration pc)
Set the profile configuration.

Parameters:
pc - the profile configuration

getUndoManager

UndoManager getUndoManager()
Return the UndoManager for this project. Undo is managed on a per-project basis.

Returns:
the UndoManager for this project

isDirty

boolean isDirty()
Returns:
true if Project has been modified since last save

setDirty

void setDirty(boolean isDirty)
Set the dirty flag for the project. This has no direct effect other than setting the flag.

Parameters:
isDirty - true if the project should be marked as dirty


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook