Element

Return to Introduction  Previous page  Next page

public Class

An Element is the main modeling unit. It corresponds to (for example) Class, Use Case, Node or Component. You create new elements by adding to the Package Elements collection. Once you have created an element, you can add it to the DiagramObjects collection of a diagram to include it in the diagram.

Elements also have a collection of connectors. Each entry in this collection indicates a relationship to another element.

There are also some extended collections for managing addition information about the element, including things such as Tagged Values, Issues, Constraints and Requirements.

Associated table in .EAP file: t_object

Element Attributes

Attribute

Type

Notes

Attributes

Collection

Read only. Collection of Attribute objects for current element. Use the AddNew and Delete functions to manage attributes.

AttributesEx

Collection

Read only. Collection of Attribute objects belonging to the current element and its parent elements.

Methods

Collection

Read only. Collection of Method objects for current element.

MethodsEx

Collection

Read only. Collection of Method objects belonging to the current element and its parent elements.

TaggedValues

Collection

Read only. Collection of TaggedValue objects.

TaggedValuesEx

Collection

Read only. Collection of TaggedValue objects belonging to the current element and the elements specialized or realized by the current element.

Requirements

Collection

Read only. Collection of Requirement objects.

RequirementsEx

Collection

Read only.  Collection of Requirement objects belonging to the current element and its parent elements.

Constraints

Collection

Read only.  Collection of Constraint objects.

ConstraintsEx

Collection

Read only.  Collection of Constraint objects belonging to the current element and its parent elements.

Scenarios

Collection

Read only.  Collection of Scenario objects for current element.

Files

Collection

Read only.  Collection of File objects.

Efforts

Collection

Read only.  Collection of Effort objects.

Issues

Collection

Read only.  Collection of Issue objects.

Risks

Collection

Read only.  Collection of Risk objects.

Resources

Collection

Read only.  Collection of Resource objects for current element.

Tests

Collection

Read only.  Collection of Test objects for current element.

Metrics

Collection

Read only. Collection of Metric elements for current element.

ElementID

Long

Read only.  The local ID of the Element. Valid for this file only.

PackageID

Long

Read/Write.  A local ID for the package containing this element.

Name

String

Read/Write.  The element name; should be unique within the current package.

Stereotype

String

Read/Write.  The primary element stereotype. This is the first of the list of stereotypes you can access using the StereotypeEx attribute.

Visibility

String

Read/Write.  The Scope of this element within the current package. Valid values are: Public, Private, Protected or Package.

Notes

String

Read/Write.  Further descriptive text about the element.

Locked

Boolean

Read/Write.  Indicates if the element has been locked against further change.

Author

String

Read/Write.  The element author (see the Repository: Authors list for more details).

StyleEx

String

Read/Write:  Advanced style settings. Not currently used.

Alias

String

Read/Write.  An optional alias for this element.

Version

String

Read/Write.  The version of the element.

Multiplicity

String

Read/Write.  Multiplicity value for this element.

ElementGUID

String

Read only.  A globally unique ID for this element; ie. unique across all model files. If you have to set this value manually, you should only do so when the element is first created, and make sure you format the GUID exactly as Enterprise Architect expects.

ExtensionPoints

String

Read/Write.  Optional extension points for a Use Case as a comma-separated list.

Tablespace

String

Read/Write.  Associated tablespace for a Table element.

Tag

String

Read/Write.  Optional Tag value for additional user-defined information and searching.

Genlinks

String

Read/Write.  Links to other classes discovered at code reversing time;  Parents and Implements links only.

Abstract

String

Read/Write.  Indicates if the element is Abstract (1) or Concrete (0).

Complexity

String

Read/Write.  A complexity value indicating how difficult the element is. Can be used for metric reporting and estimation. Valid values are: 1 for Easy, 2 for Medium, 3 for Difficult.

Priority

String

Read/Write.  The priority of this element as compared to other project elements. Only applies to Requirement, Change and Issue types, otherwise ignored. Valid values are: Low, Medium and High.

Phase

String

Read/Write.  Phase this element scheduled to be constructed in. Any string value.

Persistence

String

Read/Write.  The persistence associated with this element. Can be Persistent or Transient.

IsActive

Boolean

Read/Write.  Boolean value indicating whether the element is active or not. 1 = True, 0 = False.

IsLeaf

Boolean

Read/Write.  Boolean value indicating whether the element is in leaf node or not. 1 = True, 0 = False.

IsNew

Boolean

Read/Write.  Boolean value indicating whether the element is new or not. 1 = True, 0 = False.

IsSpec

Boolean

Read/Write.  Boolean value indicating whether the element is a specification or not. 1 = True, 0 = False.

Type

String

Read/Write.  The element type (eg. Class, Component).

Note that type is case sensitive inside Enterprise Architect and should be provided with an initial capital (proper case). Valid types are:

Action
Activity
ActivityPartition
ActivityRegion
Actor
Artifact
Association
Boundary
Change
Class
Collaboration
Component
Constraint
Decision
DeploymentSpecification
DiagramFrame
EmbeddedElement
Entity
EntryPoint
Event
ExceptionHandler
ExitPoint
ExpansionNode
ExpansionRegion
GUIElement InteractionFragment
 

InteractionOccurrence
InteractionState
Interface
InterruptibleActivityRegion
Issue
Node
Note
Object
Package
Parameter
Part
Port
ProvidedInterface
Report
RequiredInterface
Requirement
Screen
Sequence
State
StateNode
Synchronization
Text
TimeLine
UMLDiagram
UseCase
 

Subtype

Long

Read/Write.  A numeric subtype that varies the type of the main element:

·For Event: 0 = Receiver, 1 = Sender
·For Class: 1 = Parameterised, 2 = Instantiated, 3 = Both, 0 = Neither,
17 = Association Class

NB: If 17, Miscdata(3) should contain the ID of the related Association.

·For Note: 1 = Note linked to connector, 2 = Constraint linked to connector
·For StateNode: 100 = ActivityIntitial, 101 = ActivityFinal
·For Activity: 0 = Activity, 8 = StructuredActivity
·For Synchronization: 0 = Horizontal, 1 = Vertical.

ClassifierID

Long

Read/Write.  Local ID of a Classifier associated with this element; that is, the base type. Only valid for instance type elements (eg. Object).

ClassifierName

String

Read/Write.  Name of associated Classifier (if any).

ClassifierType

String

Read only.  Type of associated classifier.

Created

Date

Read/Write.  Date element created.

Modified

Date

Read/Write.  Date element last modified.

Difficulty

String

Read/Write.  A difficulty level associated with this element for estimation/metrics; only useable for Requirement, Change and Issue element types, otherwise ignored. Valid values are: Low, Medium, High.

Genfile

String

Read/Write.  The file associated with this element for code generation and synchronization purposes. Can include macro expansion tags for local conversion to full path.

GenType

String

Read/Write.  The code generation type; eg. Java, C++, C#, VBNet, Visual Basic, Delphi.

Header1

Variant

Read/Write.  A user defined string for inclusion as header in the source files generated.

Header2

Variant

Read/Write.  Same as for Header1, but used in the CPP source file.

EventFlags

String

Read/Write.  A structure to hold a variety of flags to do with signals or events.

ActionFlags

String

Read/Write.  A structure to hold flags concerned with Action semantics.

Elements

Collection

The child elements of this element.

Diagrams

Collection

The child diagrams of this element

ParentID

Long

Read/Write.  If this element is a child of another, used to set or retrieve the ElementID of the other element.  If not, returns 0.

Connectors

Collection

Read only. Returns a collection containing the connectors to other elements.

ClassifierID

Long

Read/Write.  Sets or gets the ElementID of the Classifier.

Status

String

Read/Write.  Sets or gets the status, such as Proposed or Approved.

TreePos

Long

Read/Write.  Sets or gets the tree position.

Elements

Collection

Read only.  Returns a collection of sub-elements attached to this element as seen in the tree view.

Diagrams

Collection

Read only.  Returns a collection of sub-diagrams attached this element as seen in the tree view.

ObjectType

ObjectType

Read only.  Distinguishes objects referenced through a Dispatch interface.

Partitions

Collection

Read Only. List of logical partitions into which an element can be divided. Only valid for elements that support partitions, such as Activities and States.

CustomProperties

Collection

Read only. List of advanced properties for an element. The collection of advanced properties differs depending on element type; for example, an Action and an Activity have different advanced properties. Currently only editable from the user interface.

StateTransitions

Collection

Read only. List of State Transitions that an element can support. Applies in particular to Timing elements.

EmbeddedElements

Collection

Read only.  List of elements that are embedded into this element, such as  Ports, Parts, Pins and Parameter Sets.

BaseClasses

Collection

Read only.  List of Base Classes for this element presented as a collection for convenience.

Realizes

Collection

Read only.  List of Interfaces realized by this element for convenience.

MiscData

String

Read only.  This low-level property provides information about the contents of the PDatax fields.  These database fields are not documented and developers must gain understanding of these fields through their own endeavors to use this property.

MiscData is zero based, therefore:

·MiscData(0) corresponds to PDATA1
·MiscData(1) to PDATA2

and so on.

StereotypeEx

String

Read/Write.  All the applied stereotypes of the element in a comma-separated list.

PropertyType

Long

Read/Write.  The GUID of the type which defines either a Port or a Part.

Properties

Properties

Returns a list of specialized properties that apply to the element that might not be available using the automation model.  The properties are purposely undocumented because of their obscure nature and because they are subject to change as progressive enhancements are made to them.

MetaType

String

Read only: The element's domain-specific meta type, as defined by an applied stereotype from an MDG Technology.

RunState

String

Read/Write. The object's runstate list as a string.

Element Methods

Method

Type

Notes

Update () 

Boolean 

Update the current element object after modification or appending a new item. If false is returned, check the GetLastError function for more information.

GetLastError () 

String 

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

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

Refresh () 

void 

Refresh the element features in the Project Browser window. Usually called after adding or deleting attributes or methods, when the user interface is required to be updated as well.

GetRelationSet (EnumRelationSetType Type)

String

Returns a string containing a comma-separated list of ElementIDs of related elements based on the given type. See EnumRelationSetType.

GetLinkedDocument ()

String

Returns a string value containing the element's linked document contents, in RTF format.

If the element contains no linked document, an empty string is returned.

GetStereotypeList ()

String

Returns a comma-separated list of stereotypes allied to this element.

SetAppearance (long Scope, long Item, long Value)

Long

Sets the visual appearance of the element.

Scope: Scope of appearance set to modify

0 ?Local (Diagram-local appearance)

1 ?Base (Default appearance across entire model)

Item: Appearance item to modify

0 ?Background color

1 ?Font Color

2 ?Border Color

3 ?Border Width

Value: Value to set appearance to.

LoadLinkedDocument (String Filename)

Boolean

Loads the RTF document from the specified file into the element's linked document.

SaveLinkedDocument (String Filename)

Boolean

Saves the linked document for this element to the specified RTF file.