Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

Diagram Class

Topics:

Topic

Detail

See also

General Usage

A Diagram corresponds to a single Enterprise Architect 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 element to the diagram (the element must already exist). When adding a new diagram, you must set the diagram type to a valid type; these are:

  • Activity
  • Analysis
  • Component
  • Custom
  • Deployment
  • Logical
  • Sequence
  • Statechart
  • Use Case

 

Use the Analysis type for a Collaboration Diagram.

Associated table in .EAP file: t_diagram

 

Diagram Attributes

Attribute

Type

Notes

See Also

Author

String

Read/Write. The author.

 

CreatedDate

Date

Read/Write. The date the diagram was created.

 

cx

Long

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

 

cy

Long

Read/Write. The Y dimension of the diagram (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. Flag to indicate elements from other packages should be highlighted.

 

IsLocked

Boolean

Read/Write. 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/retrieve notes for this diagram.

 

ObjectType

ObjectType

Read only. Distinguishes objects referenced through a Dispatch interface.

 

Orientation

String

Read/Write. Page orientation: P for Portrait or L for Landscape.

 

PackageID

Long

Read/Write. An ID of the package that this diagram belongs to.

 

ParentID

Long

Read/Write. An 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 (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. 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. Flag to indicate Diagram Details text should be shown. 1 = Show, 0 = Hide.

 

ShowPackageContents

Boolean

Read/Write. Flag to indicate package contents should be shown in the current diagram.

 

ShowPrivate

Boolean

Read/Write. Flag to show or hide Private features.

 

ShowProtected

Boolean

Read/Write. Flag to show or hide Protected features.

 

ShowPublic

Boolean

Read/Write. 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.

Throws an exception if the operation fails. 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.

Throws an exception if the operation fails. Use GetLastError() to retrieve error information.

 

GetLastError ()

String

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

This function is rarely used as an exception is thrown when an error occurs.

 

ReleaseUserLock ()

Boolean

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

Throws an exception if the operation fails. Use GetLastError() to retrieve error information.

 

ReorderMessages ()

Void

Resets the display order of Sequence and Collaboration messages. Typically used after inserting or deleting messages in the diagram.

 

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.