Element
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 |
|||
Abstract |
String |
Read/Write. Indicates if the element is Abstract (1) or Concrete (0). |
|||
ActionFlags |
String |
Read/Write. A structure to hold flags concerned with Action semantics. |
|||
Alias |
String |
Read/Write. An optional alias for this element. |
|||
Attributes |
Read only. Collection of Attribute objects for current element. Use the AddNew and Delete functions to manage attributes. |
||||
AttributesEx |
Read only. Collection of Attribute objects belonging to the current element and its parent elements. |
||||
Author |
String |
Read/Write. The element author (see the Repository: Authors list for more details). |
|||
BaseClasses |
Read only. List of Base Classes for this element presented as a collection for convenience. |
||||
ClassfierID |
Long |
Deprecated. See ClassifierID. |
|||
ClassifierID |
Long |
Read/Write. ElementID of a Classifier associated with this element; that is, the base type. Only valid for instance type elements (such as Object, Sequence). |
|||
ClassifierName |
String |
Read/Write. Name of associated Classifier (if any). |
|||
ClassifierType |
String |
Read only. Type of associated classifier. |
|||
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. |
|||
CompositeDiagram |
Read only. If the element is Composite, returns its associated diagram; otherwise returns null. |
||||
Connectors |
Read only. Returns a collection containing the connectors to other elements. |
||||
Constraints |
Read only. Collection of Constraint objects. |
||||
ConstraintsEx |
Read only. Collection of Constraint objects belonging to the current element and its parent elements. |
||||
Created |
Date |
Read/Write. The date the element was created. |
|||
CustomProperties |
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. |
||||
Diagrams |
Read only. Returns a collection of sub-diagrams (child diagrams) attached to this element as seen in the tree view. |
||||
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. |
|||
Efforts |
Read only. Collection of Effort objects. |
||||
ElementGUID |
String |
Read only. A globally unique ID for this element; that is, 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. |
|||
ElementID |
Long |
Read only. The local ID of the Element. Valid for this file only. |
|||
Elements |
Read only. Returns a collection of child elements (sub-elements) attached to this element as seen in the tree view. |
||||
EmbeddedElements |
Read only. List of elements that are embedded into this element, such as Ports, Parts, Pins and Parameter Sets. |
||||
EventFlags |
String |
Read/Write. A structure to hold a variety of flags to do with signals or events. |
|||
ExtensionPoints |
String |
Read/Write. Optional extension points for a Use Case as a comma-separated list. |
|||
Files |
Read only. Collection of File objects. |
||||
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. |
|||
Genlinks |
String |
Read/Write. Links to other Classes discovered at code reversing time; Parents and Implements connectors only. |
|||
GenType |
String |
Read/Write. The code generation type; for example, 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. |
|||
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. |
|||
Issues |
Read only. Collection of Issue objects. |
||||
Locked |
Boolean |
Read/Write. Indicates if the element has been locked against further change. |
|||
MetaType |
String |
Read only. The element's domain-specific meta type, as defined by an applied stereotype from an MDG Technology. |
|||
Methods |
Read only. Collection of Method objects for current element. |
||||
MethodsEx |
Read only. Collection of Method objects belonging to the current element and its parent elements. |
||||
Metrics |
Read only. Collection of Metric elements for current element. |
||||
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:
and so on. |
|||
Modified |
Date |
Read/Write. The date the element was last modified. |
|||
Multiplicity |
String |
Read/Write. Multiplicity value for this element. |
|||
Name |
String |
Read/Write. The element name; should be unique within the current package. |
|||
Notes |
String |
Read/Write. Further descriptive text about the element. |
|||
ObjectType |
Read only. Distinguishes objects referenced through a Dispatch interface. |
||||
PackageID |
Long |
Read/Write. A local ID for the package containing 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. |
|||
Partitions |
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. |
||||
Persistence |
String |
Read/Write. The persistence associated with this element. Can be Persistent or Transient. |
|||
Phase |
String |
Read/Write. Phase this element scheduled to be constructed in. Any string value. |
|||
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. |
|||
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. |
||||
PropertyType |
Long |
Read/Write. The ElementID of a Type associated with this element. Only valid for Port and Part elements. |
|||
Realizes |
Read only. List of Interfaces realized by this element for convenience. |
||||
Requirements |
Read only. Collection of Requirement objects. |
||||
RequirementsEx |
Read only. Collection of Requirement objects belonging to the current element and its parent elements. |
||||
Resources |
Read only. Collection of Resource objects for current element. |
||||
Risks |
Read only. Collection of Risk objects. |
||||
RunState |
String |
Read/Write. The object's runstate list as a string. |
|||
Scenarios |
Read only. Collection of Scenario objects for current element. |
||||
StateTransitions |
Read only. List of State Transitions that an element can support. Applies in particular to Timing elements. |
||||
Status |
String |
Read/Write. Sets or gets the status, such as Proposed or Approved. |
|||
Stereotype |
String |
Read/Write. The primary element stereotype. This is the first of the list of stereotypes you can access using the StereotypeEx attribute. |
|||
StereotypeEx |
String |
Read/Write. All the applied stereotypes of the element in a comma-separated list. |
|||
StyleEx |
String |
Read/Write. Advanced style settings. Reserved for the use of Sparx Systems. |
|||
Subtype |
Long |
Read/Write. A numeric subtype that qualifies the Type of the main element. For example:
Note that there are many more Types than indicated in the above examples. |
|||
Tablespace |
String |
Read/Write. Associated tablespace for a Table element. |
|||
Tag |
String |
Read/Write. Corresponds to the Keywords field in the Enterprise Architect user interface. See the General Settings topic. |
|||
TaggedValues |
Collection of type TaggedValue |
Read only. Returns a collection of TaggedValue objects. |
|||
TaggedValuesEx |
Collection of type TaggedValue |
Read only. Returns a collection of TaggedValue objects belonging to the current element and the elements specialized or realized by the current element. |
|||
Tests |
Read only. Collection of Test objects for current element. |
||||
TreePos |
Long |
Read/Write. Sets or gets the tree position. |
|||
String |
Read/Write. The element type (such as 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 |
InteractionOccurrence |
||||
Version |
String |
Read/Write. The version of the element. |
|||
Visibility |
String |
Read/Write. The Scope of this element within the current package. Valid values are: Public, Private, Protected or Package. |
|||
Element Methods
Method |
Type |
Notes |
ApplyGroupLock (string aGroupName) |
Boolean |
Applies a group lock to the element 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:
|
ApplyUserLock () |
Boolean |
Applies a user lock to the element 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. |
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. |
GetRelationSet (EnumRelationSetType Type) |
String |
Returns a string containing a comma-separated list of ElementIDs of directly- and indirectly-related elements based on the given type. See EnumRelationSetType. Recurses using the same relation type on all elements it finds, retrieving all dependencies and sub-dependencies of the current element; for example, Object1 depends on Object2, which depends on Object3. Therefore this method returns Object2 and Object3. To obtain only the direct relationships of the element, use the Connector collection instead. |
GetStereotypeList () |
String |
Returns a comma-separated list of stereotypes allied to this element. |
LoadLinkedDocument (string Filename) |
Boolean |
Loads the RTF document from the specified file into the element's linked document. Parameter:
|
Refresh () |
Void |
Refreshes the element features in the Project Browser. Usually called after adding or deleting attributes or methods, when the user interface is required to be updated as well. |
ReleaseUserLock () |
Boolean |
Releases a user lock or group lock on the element object. Throws an exception if the operation fails. Use GetLastError() to retrieve error information. |
SaveLinkedDocument (string Filename) |
Boolean |
Saves the linked document for this element to the specified RTF file. Parameter:
|
SetAppearance (long Scope, long Item, long Value) |
Void |
Sets the visual appearance of the element. Parameter:
|
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. |