org.argoprint.util
Class DiagramUtil

java.lang.Object
  extended by org.argoprint.util.DiagramUtil

public class DiagramUtil
extends java.lang.Object

This class contains a collection of diagram-based utilities.

Author:
mfortner

Field Summary
static java.lang.String CLASS_DIAGRAM
          A constant used to identify a class diagram
static java.lang.String COLLABORATION_DIAGRAM
          A constant used to identify a collaboration diagram
static java.lang.String DEPLOYMENT_DIAGRAM
          A constant used to identify a deployment diagram
static java.lang.String SEQUENCE_DIAGRAM
          A constant used to identify a sequence diagram
static java.lang.String STATE_DIAGRAM
          A constant used to identify a state diagram
static java.lang.String USE_CASE_DIAGRAM
          A constant used to identify a use case diagram
 
Constructor Summary
DiagramUtil()
           
 
Method Summary
static java.util.Map<java.lang.String,java.lang.String> getAttributes(org.argouml.uml.diagram.static_structure.ui.FigClass figClass)
          This method gets the attributes and their descriptions for a specific class.
static java.lang.String getAuthor(org.argouml.kernel.Project project)
          This is a convenience method for returning the project author name.
static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getClassDiagrams(org.argouml.kernel.Project project)
          This method gets the class diagrams for a particular project.
static java.util.List<org.tigris.gef.presentation.Fig> getClasses(org.argouml.uml.diagram.ArgoDiagram diagram)
          This method gets the classes for a class diagram.
static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getCollaborationDiagrams(org.argouml.kernel.Project project)
          This method gets the collaboration diagrams for a particular project.
static java.util.List<org.tigris.gef.presentation.Fig> getComponents(org.argouml.uml.diagram.ArgoDiagram diagram)
          Gets the components found in a deployment diagram.
static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getDeploymentDiagrams(org.argouml.kernel.Project project)
          This method gets the deployment diagrams for a particular project.
static java.lang.String getDiagramAsJPEG(org.argouml.uml.diagram.ArgoDiagram diagram)
          This method gets the diagram as a JPEG bytearray and Base64 encodes it so that it can be embedded into HTML, or XML-based file formats that support Base64 encoded images.
static java.lang.String getDiagramAsSVG(org.argouml.uml.diagram.ArgoDiagram diagram)
          This method gets the diagram as an SVG snippet.
static java.awt.Rectangle getDiagramDim(org.argouml.uml.diagram.ArgoDiagram diagram)
          This method gets the diagram dimensions.
static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getDiagramsByType(org.argouml.kernel.Project project, java.lang.Class diagramType)
          This method gets diagrams by a particular diagram type.
static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getDiagramsByType(org.argouml.kernel.Project project, java.lang.String diagramType)
          This method is responsible for getting diagrams of a particular diagram type.
static java.lang.String getDiagramType(org.argouml.uml.diagram.ArgoDiagram diagram)
          This method determines what the type of diagram.
static java.util.List<org.tigris.gef.presentation.Fig> getInterfaces(org.argouml.uml.diagram.ArgoDiagram diagram)
          This method gets the interfaces for a class diagram.
static java.lang.String getMemberDescription(org.tigris.gef.presentation.Fig fig)
          This method gets a description of the member.
static java.util.List<org.tigris.gef.presentation.Fig> getMembersByType(org.argouml.uml.diagram.ArgoDiagram diagram, java.lang.Class memberType)
          This method gets the members of a particular diagram.
static java.lang.String getMemberTaggedValue(org.tigris.gef.presentation.Fig fig, java.lang.String tagname)
          This method gets a tagged value for a particular member of a diagram.
static java.util.Map<java.lang.String,java.lang.String> getMethods(org.argouml.uml.diagram.static_structure.ui.FigClass figClass)
           
static java.util.Map<java.lang.String,java.lang.String> getMethods(org.argouml.uml.diagram.static_structure.ui.FigInterface figClass)
           
static java.lang.String getProjectDescription(org.argouml.kernel.Project project)
          This is a convenience method for returning the project description.
static java.lang.String getProjectName(org.argouml.kernel.Project project)
           
static java.util.List<org.tigris.gef.presentation.Fig> getSequenceClassifiers(org.argouml.uml.diagram.ArgoDiagram diagram)
          Gets the classifiers from a sequence diagram.
static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getSequenceDiagrams(org.argouml.kernel.Project project)
          This method gets the sequence diagrams for a particular project.
static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getStateDiagrams(org.argouml.kernel.Project project)
          This method gets the state diagrams for a particular project.
static java.util.List<org.tigris.gef.presentation.Fig> getStates(org.argouml.uml.diagram.ArgoDiagram diagram)
          Gets the states found in a State diagram.
static java.lang.String getTaggedValue(org.argouml.kernel.Project project, java.lang.String tagname)
          This method gets tagged values for the current namespace used by the project.
static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getUseCaseDiagrams(org.argouml.kernel.Project project)
          This method gets the use case diagrams for a particular project.
static java.util.List<org.tigris.gef.presentation.Fig> getUseCases(org.argouml.uml.diagram.ArgoDiagram diagram)
          This method gets the use cases for a use case diagram.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USE_CASE_DIAGRAM

public static final java.lang.String USE_CASE_DIAGRAM
A constant used to identify a use case diagram

See Also:
Constant Field Values

CLASS_DIAGRAM

public static final java.lang.String CLASS_DIAGRAM
A constant used to identify a class diagram

See Also:
Constant Field Values

DEPLOYMENT_DIAGRAM

public static final java.lang.String DEPLOYMENT_DIAGRAM
A constant used to identify a deployment diagram

See Also:
Constant Field Values

COLLABORATION_DIAGRAM

public static final java.lang.String COLLABORATION_DIAGRAM
A constant used to identify a collaboration diagram

See Also:
Constant Field Values

SEQUENCE_DIAGRAM

public static final java.lang.String SEQUENCE_DIAGRAM
A constant used to identify a sequence diagram

See Also:
Constant Field Values

STATE_DIAGRAM

public static final java.lang.String STATE_DIAGRAM
A constant used to identify a state diagram

See Also:
Constant Field Values
Constructor Detail

DiagramUtil

public DiagramUtil()
Method Detail

getDiagramType

public static java.lang.String getDiagramType(org.argouml.uml.diagram.ArgoDiagram diagram)
This method determines what the type of diagram.

Parameters:
diagram - The diagram whose type you want.
Returns:
One of the diagram type constants defined in this class.

getDiagramsByType

public static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getDiagramsByType(org.argouml.kernel.Project project,
                                                                                    java.lang.String diagramType)
This method is responsible for getting diagrams of a particular diagram type.

Parameters:
project - The top-level project object.
diagramType - The type of diagram (use one of the constants for this)
Returns:
A List of ArgoDiagrams

getDiagramsByType

public static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getDiagramsByType(org.argouml.kernel.Project project,
                                                                                    java.lang.Class diagramType)
This method gets diagrams by a particular diagram type.

Parameters:
project - The Argo project.
diagramType - The diagram class. Should be an implementation of ArgoDiagram.
Returns:
A list of ArgoDiagrams of a given type.

getMembersByType

public static java.util.List<org.tigris.gef.presentation.Fig> getMembersByType(org.argouml.uml.diagram.ArgoDiagram diagram,
                                                                               java.lang.Class memberType)
This method gets the members of a particular diagram. For example, get the use cases found on a use case diagram.

Parameters:
diagram - The diagram being interrogated.
memberType - The member class (an implementation of the Fig interface).
Returns:
A list of members.

getMemberDescription

public static java.lang.String getMemberDescription(org.tigris.gef.presentation.Fig fig)
This method gets a description of the member.

Parameters:
fig - The member of a diagram whose description you want.
Returns:
The description of the member.

getMemberTaggedValue

public static java.lang.String getMemberTaggedValue(org.tigris.gef.presentation.Fig fig,
                                                    java.lang.String tagname)
This method gets a tagged value for a particular member of a diagram.

Parameters:
fig - the member of a diagram (FigUseCase, FigClass, etc)
tagname - the name of the tag you want to get.
Returns:
A string value containing the tagged value.

getTaggedValue

public static java.lang.String getTaggedValue(org.argouml.kernel.Project project,
                                              java.lang.String tagname)
This method gets tagged values for the current namespace used by the project. These tagged values typically include the "author" and project description.

Parameters:
project - The current project.
tagname - The name of the tag.
Returns:
A string containing the tagged value

getAuthor

public static java.lang.String getAuthor(org.argouml.kernel.Project project)
This is a convenience method for returning the project author name.

Parameters:
project - The current project
Returns:
A string containing the author name

getProjectDescription

public static java.lang.String getProjectDescription(org.argouml.kernel.Project project)
This is a convenience method for returning the project description.

Parameters:
project - The current project.
Returns:
A string containing the project description.

getProjectName

public static java.lang.String getProjectName(org.argouml.kernel.Project project)

getDiagramAsSVG

public static java.lang.String getDiagramAsSVG(org.argouml.uml.diagram.ArgoDiagram diagram)
This method gets the diagram as an SVG snippet.

Parameters:
diagram - The diagram.
Returns:
An SVG document containing the diagram.

getDiagramAsJPEG

public static java.lang.String getDiagramAsJPEG(org.argouml.uml.diagram.ArgoDiagram diagram)
This method gets the diagram as a JPEG bytearray and Base64 encodes it so that it can be embedded into HTML, or XML-based file formats that support Base64 encoded images.

Parameters:
diagram - The diagram to be converted.
Returns:
A Base64 encoded JPEG byte array

getDiagramDim

public static java.awt.Rectangle getDiagramDim(org.argouml.uml.diagram.ArgoDiagram diagram)
This method gets the diagram dimensions.

Parameters:
diagram - The diagram of interest.
Returns:
A Rectangle representing the drawing area of the diagram.

getUseCaseDiagrams

public static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getUseCaseDiagrams(org.argouml.kernel.Project project)
This method gets the use case diagrams for a particular project.

Parameters:
project - The argo project.
Returns:
List of UMLUseCaseDiagram objects.

getClassDiagrams

public static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getClassDiagrams(org.argouml.kernel.Project project)
This method gets the class diagrams for a particular project.

Parameters:
project - The argo project.
Returns:
List of UMLClassDiagram objects.

getCollaborationDiagrams

public static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getCollaborationDiagrams(org.argouml.kernel.Project project)
This method gets the collaboration diagrams for a particular project.

Parameters:
project - The argo project.
Returns:
List of UMLCollaborationDiagram objects.

getDeploymentDiagrams

public static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getDeploymentDiagrams(org.argouml.kernel.Project project)
This method gets the deployment diagrams for a particular project.

Parameters:
project - The argo project.
Returns:
List of UMLDeploymentDiagram objects.

getComponents

public static java.util.List<org.tigris.gef.presentation.Fig> getComponents(org.argouml.uml.diagram.ArgoDiagram diagram)
Gets the components found in a deployment diagram.

Parameters:
diagram -
Returns:

getSequenceDiagrams

public static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getSequenceDiagrams(org.argouml.kernel.Project project)
This method gets the sequence diagrams for a particular project.

Parameters:
project - The argo project.
Returns:
List of UMLSequenceDiagram objects.

getSequenceClassifiers

public static java.util.List<org.tigris.gef.presentation.Fig> getSequenceClassifiers(org.argouml.uml.diagram.ArgoDiagram diagram)
Gets the classifiers from a sequence diagram.

Parameters:
diagram - The sequence diagram whose classifiers you want.
Returns:
A list of FigClassifierRole objects.

getStateDiagrams

public static java.util.List<org.argouml.uml.diagram.ArgoDiagram> getStateDiagrams(org.argouml.kernel.Project project)
This method gets the state diagrams for a particular project.

Parameters:
project - The argo project.
Returns:
List of UMLStateDiagram objects.

getStates

public static java.util.List<org.tigris.gef.presentation.Fig> getStates(org.argouml.uml.diagram.ArgoDiagram diagram)
Gets the states found in a State diagram.

Parameters:
diagram - the State diagram.
Returns:
a list of FigState objects representing the states in the diagram.

getUseCases

public static java.util.List<org.tigris.gef.presentation.Fig> getUseCases(org.argouml.uml.diagram.ArgoDiagram diagram)
This method gets the use cases for a use case diagram.

Parameters:
diagram - The use case diagram.
Returns:
A list of FigUseCases

getClasses

public static java.util.List<org.tigris.gef.presentation.Fig> getClasses(org.argouml.uml.diagram.ArgoDiagram diagram)
This method gets the classes for a class diagram.

Parameters:
diagram - The class diagram.
Returns:
A list of FigClasses

getMethods

public static java.util.Map<java.lang.String,java.lang.String> getMethods(org.argouml.uml.diagram.static_structure.ui.FigInterface figClass)

getMethods

public static java.util.Map<java.lang.String,java.lang.String> getMethods(org.argouml.uml.diagram.static_structure.ui.FigClass figClass)

getAttributes

public static java.util.Map<java.lang.String,java.lang.String> getAttributes(org.argouml.uml.diagram.static_structure.ui.FigClass figClass)
This method gets the attributes and their descriptions for a specific class.

Parameters:
figClass - The class you want to examine.
Returns:
A Map of class attributes where the keys are the attribute names and the values are the attribute descriptions.

getInterfaces

public static java.util.List<org.tigris.gef.presentation.Fig> getInterfaces(org.argouml.uml.diagram.ArgoDiagram diagram)
This method gets the interfaces for a class diagram.

Parameters:
diagram - The class diagram.
Returns:
A list of FigInterfaces