Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
Collection Class
Topic |
Detail |
See also |
||||||||
---|---|---|---|---|---|---|---|---|---|---|
General Usage |
This is the main collection Class used by all elements within the Automation Interface. It contains methods to iterate through the collection, refresh the collection and delete an item from the collection. It is important to realize that when AddNew is called, the item is not automatically added to the current collection. The typical steps are:
Delete is much the same; until Refresh is called, the collection still contains a reference to the deleted item, which should not be called. Each can be used to iterate through the collection for languages that support this type of construct.
|
|
Collection Attributes
Attribute |
Type |
Notes |
---|---|---|
Count |
Short |
Read only The number of objects referenced by this list.
|
ObjectType |
Read only Distinguishes objects referenced through a Dispatch interface.
|
Collection Methods
Method |
Type |
Notes |
See also |
||||
---|---|---|---|---|---|---|---|
AddNew ( |
Object |
Adds a new item to the current collection. Note that the interface is the same for all collections; you must provide a Name and Type argument. What these are used for depends on the actual collection member. Also note that you must call Update() on the returned object to complete the AddNew. If Update() is not called the object is left in an indeterminate state. Parameters:
|
|
||||
Delete ( |
Void |
Deletes the item at the selected reference. Parameters:
|
|
||||
DeleteAt ( |
Void |
Deletes the item at the selected index. The second parameter is currently unused. Parameters:
|
|
||||
GetAt ( |
Object |
Retrieves the array object using a numerical index. If the index is out of bounds, an error occurs. Parameters:
|
|
||||
GetByName ( |
Object |
Gets an item in the current collection by Name. If the collection does not contain any items, the method returns a null value. If the collection contains items, but it was unable to find an object with the specified name, the method raises an exception. Only supported for the following collections: Model, Package, Element, Diagram, and element TaggedValue. Parameters:
|
|||||
GetLastError () |
String |
Returns a string value describing the most recent error that occurred in relation to this object.
|
|
||||
Refresh () |
Void |
Refreshes the collection by re-querying the model and reloading the collection. Should be called after adding a new item or after deleting an item.
|
|