Diagram Class

A Diagram corresponds to a single UML diagram. It is accessed through the Package Diagrams collection and in turn contains a collection of diagram objects and diagram connectors. Adding to the DiagramObject Class adds an existing element to the diagram. When adding a new diagram, you must set the diagram type to one of the valid types:

Activity
Analysis
Component
Custom
Deployment
Logical
Sequence
Statechart
Use Case

 

For a Collaboration (Communication) diagram, use the Analysis type.

Associated table in .EAP file     t_diagram

Diagram Attributes

Attribute

Type

Notes

See also

Author

String

Read/Write

The name of the author.

 

 

CreatedDate

Date

Read/Write

The date the diagram was created.

 

 

cx

Long

Read/Write

The X dimension of the diagram (the default is 800).

 

 

cy

Long

Read/Write

The Y dimension of the diagram (the default is 1100).

 

 

DiagramGUID

Variant

Read/Write

A globally unique ID for this diagram.

 

 

DiagramID

Long

Read only

A local ID for the diagram.

 

 

DiagramLinks

Collection

Read only

A list of DiagramLink objects, each containing information about the display characteristics of a connector in a diagram.

A DiagramLink is only created once a user modifies a connector in a diagram in some way. Until this condition has been met, default values are used and the DiagramLink is not in use.

 

DiagramLink Class

DiagramObjects

Collection

Read only

A collection of references to DiagramObjects. A DiagramObject is an instance of an element in a diagram, and includes size and display characteristics.

 

DiagramObject Class

ExtendedStyle

String

Read/Write

An extended style attribute.

 

 

HighlightImports

Boolean

Read/Write

A flag to indicate that elements from other packages should be highlighted.

 

 

IsLocked

Boolean

Read/Write

A flag indicating whether this diagram is locked or not.

 

 

MetaType

String

Read only

The diagram's domain-specific meta type, as defined by an MDG Technology.

 

 

ModifiedDate

Variant

Read/Write

The date the diagram was last modified.

 

 

Name

String

Read/Write

The diagram name.

 

 

Notes

String

Read/Write

Set or retrieve notes for this diagram.

 

 

ObjectType

ObjectType

Read only

Distinguishes objects referenced through a Dispatch interface.

 

 

Orientation

String

Read/Write

The page orientation: P for Portrait or L for Landscape.

 

 

PackageID

Long

Read/Write

The ID of the package that this diagram belongs to.

 

 

ParentID

Long

Read/Write

The optional ID of an element that 'owns' this diagram; for example, a Sequence diagram owned by a Use Case.

 

 

Scale

Long

Read/Write

The zoom scale (the default is 100).

 

 

SelectedConnector

Connector

Read/Write

The currently selected connector on this diagram. Null if there is no currently selected diagram.

 

 

SelectedObjects

Collection

Read only

Gets a collection representing the currently selected elements on the diagram.

You can remove objects from this collection to deselect them, and add elements to the collection by passing the Object ID as a name to select them.

 

 

ShowDetails

Long

Read/Write

A flag to indicate that the Diagram Details text should be shown: 1 = Show, 0 = Hide.

 

 

ShowPackageContents

Boolean

Read/Write

A flag to indicate that the package contents should be shown in the current diagram.

 

 

ShowPrivate

Boolean

Read/Write

A flag to show or hide Private features.

 

 

ShowProtected

Boolean

Read/Write

A flag to show or hide Protected features.

 

 

ShowPublic

Boolean

Read/Write

A flag to show or hide Public features.

 

 

Stereotype

String

Read/Write

Sets or gets the stereotype for this diagram.

 

 

StyleEx

String

Read/Write

Advanced style settings, reserved for the use of Sparx Systems.

 

 

Swimlanes

String

Read/Write

Information on swimlanes contained in the diagram.

Please note that this property is superseded by SwimlaneDef.

 

SwimlaneDef Class

SwimlaneDef

SwimlaneDef

Read/Write

Information on swimlanes contained in the diagram.

 

 

Type

String

Read only

The diagram type; see the t_diagramtypes table in the .EAP file for more information.

 

 

Version

String

Read/Write

The version of the diagram.

 

 

 

Diagram Methods

Method

Type

Notes

See also

ApplyGroupLock (
string aGroupName)

Boolean

Applies a group lock to this diagram object, for the specified group, on behalf of the current user.

Returns true if the operation is successful; returns false if the operation is unsuccessful. Use GetLastError() to retrieve error information.

Parameter:

aGroupName: String - the name of the user group for which to set the group lock
 

 

ApplyUserLock ()

Boolean

Applies a user lock to this diagram object, for the current user.

Returns true if the operation is successful; returns false if the operation is unsuccessful. Use GetLastError() to retrieve error information.

 

 

GetDiagramObjectByID (
long ID,
string DUID)

DiagramObject

Returns the DiagramObject object, if it exists on the diagram.

Parameters:

ID: Long - the ID of the diagram object
DUID: String - the optional Diagram Unique ID of the diagram object.
 

DiagramObject Class

GetLastError ()

String

Returns a string value describing the most recent error that occurred in relation to this object.

 

 

ReadStyle (
string StyleName)

String

Returns the current value of the named diagram style.

Use GetLastError() to retrieve error information.

Parameters:

StyleName: String - the name of the diagram style whose value is to be retrieved; valid StyleNames are:
Show Element Property String
Show Connector Property String
Show Feature Property String
 

 

ReleaseUserLock ()

Boolean

Releases a group lock or user lock on this diagram object.

Returns true if the operation is successful; returns false if the operation is unsuccessful. Use GetLastError() to retrieve error information.

 

 

ReorderMessages ()

Void

Resets the display order of Sequence and Collaboration messages.

This is typically used after inserting or deleting messages in the diagram.

 

 

SaveAsPDF (
string FileName)

Boolean

Export the diagram to a PDF document.  Returns true on success.

Parameters:

FileName: String - full path to file location

 

 

ShowAsElementList (
bool ShowAsList,
bool Persist)

Boolean

Toggles the diagram display between diagram format and Diagram List depending on the value of ShowAsList.

If Persist is set, the display format is written to the database so the diagram always opens in that format (diagram or list). Otherwise, the display format falls back to the default (diagram) once the display is closed.

Parameters:

ShowAsList: Boolean - indicates diagram or Diagram List
Persist: Boolean - indicates set (maintain ShowAsList value) or not (revert to default)

 

Diagram List

Update ()

Boolean

Updates this diagram object after modification or appending a new item.

If false is returned, use GetLastError() to retrieve error information.

 

 

WriteStyle (
string StyleName,
string StyleValue)

Void

Sets the value of the named diagram style.

Use GetLastError() to retrieve error information.

Parameters:

StyleName: String - the name of the diagram style whose value is to be retrieved; valid StyleNames are:
Show Element Property String
Show Connector Property String
Show Feature Property String
 
StyleValue: String - the value to be set in the named diagram style; valid values for the StyleNames listed above are 0 and 1.