Pré. | Proc. |
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 repository
t_diagram
Diagram Attributes
Attribute |
Remarks |
See also |
---|---|---|
Author |
String Notes: Read/Write The name of the author. |
|
CreatedDate |
Date Notes: Read/Write The date the diagram was created. |
|
cx |
Long Notes: Read/Write The X dimension of the diagram (the default is 800). |
|
cy |
Long Notes: Read/Write The Y dimension of the diagram (the default is 1100). |
|
DiagramGUID |
Variant Notes: Read/Write A globally unique ID for this diagram. |
|
DiagramID |
Long Notes: Read only A local ID for the diagram. |
|
DiagramLinks |
Collection Notes: Read only A list of DiagramLink objects, each containing information about the display characteristics of a connector in a diagram. |
DiagramLink Class Collection Class |
DiagramObjects |
Collection Notes: 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 Collection Class |
ExtendedStyle |
String Notes: Read/Write An extended style attribute. |
|
FilterElements |
String Notes: Read/Write Applies a comma-separated list of object ids (from SelectedObjects) to the currently-applied diagram filter, overriding the filter. The effect persists until another filter is applied, or the diagram is closed. |
|
HighlightImports |
Boolean Notes: Read/Write A flag to indicate that elements from other Packages should be highlighted. Corresponds with the 'Show Namespace' option in the diagram 'Properties' dialog. |
Configure Diagram Display |
IsLocked |
Boolean Notes: Read/Write A flag indicating whether this diagram is locked or not. |
|
MetaType |
String Notes: Read/Write The diagram's domain-specific meta type, as defined by an MDG Technology. When writing, the meta type must be fully qualified and from an existing profile. |
|
ModifiedDate |
Variant Notes: Read/Write The date the diagram was last modified. |
|
Name |
String Notes: Read/Write The diagram name. |
|
Notes |
String Notes: Read/Write Set or retrieve notes for this diagram. |
|
ObjectType |
ObjectType Notes: Read only Distinguishes objects referenced through a Dispatch interface. |
ObjectType |
Orientation |
String Notes: Read/Write The page orientation: P for Portrait or L for Landscape. |
|
PackageID |
Long Notes: Read/Write The ID of the Package that this diagram belongs to. |
|
PageHeight |
Long Notes: Read The number of pages high the diagram is. |
|
PageWidth |
Long Notes: Read The number of pages wide the diagram is. |
|
ParentID |
Long Notes: Read/Write The optional ID of an element that 'owns' this diagram; for example, a Sequence diagram owned by a Use Case. |
|
Scale |
Long Notes: Read/Write The zoom scale (the default is 100). |
|
SelectedConnector |
Connector Notes: Read/Write The currently selected connector on this diagram. Null if there is no currently selected diagram. |
Connector Class |
SelectedObjects |
Collection Notes: 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. |
Collection Class |
ShowDetails |
Long Notes: Read/Write A flag to indicate that the Diagram Details text should be shown: 1 = Show, 0 = Hide. |
|
ShowPackageContents |
Boolean Notes: Read/Write A flag to indicate that the Package contents should be shown in the current diagram. |
|
ShowPrivate |
Boolean Notes: Read/Write A flag to show or hide Private features. |
|
ShowProtected |
Boolean Notes: Read/Write A flag to show or hide Protected features. |
|
ShowPublic |
Boolean Notes: Read/Write A flag to show or hide Public features. |
|
Stereotype |
String Notes: Read/Write Sets or gets the stereotype for this diagram. |
|
StyleEx |
String Notes: Read/Write Advanced style settings, reserved for the use of Sparx Systems. |
|
Swimlanes |
String Notes: Read/Write Information on swimlanes contained in the diagram. Please note that this property is superseded by SwimlaneDef. |
SwimlaneDef Class |
SwimlaneDef |
SwimlaneDef Notes: Read/Write Information on swimlanes contained in the diagram. |
SwimlaneDef Class |
Type |
String Notes: Read only The diagram type; see the t_diagramtypes table in the .eap file for more information. |
|
Version |
String Notes: Read/Write The version of the diagram. |
Diagram Methods
Method |
Details |
See also |
---|---|---|
ApplyGroupLock (string aGroupName) |
Boolean Notes: 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:
|
|
ApplyUserLock () |
Boolean Notes: 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. |
|
FindElementInDiagram (long ElementID) |
Boolean Notes: This function activates the Diagram View and displays the diagram with the diagram object selected. If the diagram is too large to display all of it on the screen, the portion of the diagram containing the object is displayed with the object shown in the center of the screen. Diagram objects flagged as non-selected are shown but are not selected Returns True if the diagram object was found, the diagram displayed and the object selected (or at least displayed) in the view. Returns False if the diagram object was not found in the diagram and the diagram not displayed. Parameter
|
|
GetDiagramObjectByID (long ID, string DUID) |
DiagramObject Notes: Returns the DiagramObject object, if it exists on the diagram. Parameters:
|
DiagramObject Class |
GetElementByGrid (string GridX, string GridY) |
Element Notes: Uses the Excel type of format to specify the column and row of a grid at which an element should be found: A 5, CB 1. Returns null if no element is at the specified position. Parameters:
|
|
GetElementByName (string Name) |
Element Notes: Locates an element with the specified name. Returns null if no element is found with that name. Parameters:
|
|
GetObjectByGrid (string GridX, string GridY) |
DiagramObject Notes: Uses the Excel type of format to specify the column and row of a grid at which an object should be found: A 5, CB 1. Returns null if no element is at the specified position. Parameters:
|
|
GetLastError () |
String Notes: Returns a string value describing the most recent error that occurred in relation to this object. |
|
ReadStyle (string StyleName) |
String Notes: Returns the current value of the named diagram style. Use GetLastError() to retrieve error information. Parameters:
|
|
ReleaseUserLock () |
Boolean Notes: 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 Notes: 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 Notes: Exports the diagram to a PDF document. Returns True on success. Parameters:
|
|
SaveImagePage(long x, long y, long sizeX, long sizeY, string filename, long flags) |
Boolean Notes: Saves a page of the diagram to disk. Returns True if the operation is successful; returns False if the operation is unsuccessful. Use GetLastError() to retrieve error information. Parameters:
The image type is determined by the extension of the filename. Currently only .emf, .bmp and .png formats are supported. |
|
ShowAsElementList (bool ShowAsList, bool Persist) |
Boolean Notes: 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:
|
Diagram List |
Update () |
Boolean Notes: Updates this diagram object after modification or appending a new item. If False is returned, use GetLastError() to retrieve error information. |
|
VirtualizeConnector (int ConnectorID, int Action, int X, int Y) |
Boolean Notes: Creates a virtual copy of the source or target element on a connector, and sets its location on the diagram as a waypoint on the connector. If the source element is being virtualized, the waypoint is created as the first on the connector, and if the target element is being virtualized, the waypoint is created as the last on the connector. If called again on the same connector, removes the virtual element. However, the waypoint remains in place. As waypoints and therefore virtual elements can only be created on connectors with the Custom line-style, if the connector does not have this line style the method sets it. So, after this method executes, an Update function should be called for the connector as well as for the diagram. All parameters are required for the function to complete successfully. Returns True if the operation is successful; returns False if the operation is unsuccessful. Parameters:
For example, to virtualize the source element of the selected connector: function main() { var diagram as EA.Diagram; var conn as EA.Connector; diagram = Repository.GetCurrentDiagram(); if(diagram != null) { var connector as EA.Connector. connector = diagram.SelectedConnector; diagram.VirtualizeConnector(connector.ConnectorID, 1, 100, 150); connector.Update(); diagram.Update(); Repository.ReloadDiagram(diagram.DiagramID); } else { Session.Output("Script requires a diagram to be visible"); } } main(); |
Virtual Connector Ends - Represent One Element Several Times on a Diagram |
WriteStyle (string StyleName, string StyleValue) |
Void Notes: Sets the value of the named diagram style. Use GetLastError() to retrieve error information. Parameters:
|