Book a Demo

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

Prev Next

Composite Elements

You might want to use one element to represent a structure composed of other elements; for example, a general Use Case representing a collection of more specific Use Cases. To achieve this, you can make the 'general' element a composite element, as a pointer to a child diagram containing the 'detail' elements. The elements that you can turn into composites include Classes, Objects, Activities and Use Cases.

Access

Ribbon

With an element selected in the Browser window:

Design > Diagram > Add : Type - UML | Structural | UML Structural | Composite Structure | <one of the two diagram types>

There are several Perspective groups and Perspectives that lead you to the UML Structural group; the one provided is an example.

Context Menu

Right-click element in diagram | New Child Diagram | Composite Structure Diagram or

Right-click element in Browser window | Add | Composite Structure Diagram

Make an element composite

Images

Step / Action

See also

When you select to make an element composite, it displays in the diagram and in the Browser window as illustrated on the left.

Note:

  • The small icon in the bottom right hand corner of the element shape, indicating that this is now a composite element
  • The icon against the child diagram name in the Browser window, indicating that this diagram was created as a child of the composite element

To access the child diagram that the composite element points to, either:

  • Double-click on the composite element in the diagram, or
  • Click on the composite element and press the = key

If you have selected the 'Enable Concise Diagram Navigation' checkbox on the 'Application Look' (Visual Style) dialog, the child diagram replaces the parent in the Diagram View. Otherwise the child diagram opens in a separate tab.

You can populate the child diagram with elements and connectors to represent the internal structure of the (parent) composite element. In this process, structural (embedded) elements cannot be directly added to the child diagram. However, you can add them using a different, modified procedure.

If you have selected the 'Enable Concise Diagram Navigation' checkbox, to return to the parent diagram containing the composite element click on the arrow in the right hand end of the diagram tab. If you accessed the child diagram by:

  • Double-clicking on the composite element, the parent diagram displays
  • Pressing the = key, the parent diagram displays with the composite element selected

The composite element and its child diagram are now represented in the Browser window as shown. ClassX, ClassY and ClassZ are elements added to the child diagram.

Show Structural Elements In Composite Diagram Visual Styles

If you already have, or subsequently create, another diagram that better represents the content of your composite element, you can select that diagram as the child of the composite.

Right-click on the composite element in its diagram and select the 'New Child Diagram | Select Composite Diagram' option. The 'Select Classifier' browser displays, through which you can browse the entire project to locate the alternative diagram. Click on the diagram and on the OK button to apply it as the child of the composite element.

Neither the original nor the alternative child diagram move location or change icons in the Browser window (unless you specifically make these changes as a separate operation).

Alternative Notation

You can display the contents (the child diagram) of a Composite element in a number of other ways.

Display Format

Detail

See also

Display Composite Diagram in Popup window

On the parent diagram, click on the composite element and then on the 'eye' icon () above the top left corner of the element, or press the Backslash (\) key.  The child composite diagram displays in a floating Popup window. To close the pop-up window, press the Backslash key again or click on a different point in the work area.

Display Composite Element as Frame

Composite elements can show their contents in place of their usual notation.

  1. Right-click on the composite element in the diagram; the context menu displays.
  2. Select the 'New Child Diagram | Show Composite Diagram in Frame' option.

The composite element is replaced by a frame containing the child diagram. The frame label shows the composite element name. The element is resized to contain the diagram; whilst it can be enlarged, it cannot be reduced to less than the diagram size.

Some technologies, such as SysML, qualify the frame label to show the diagram type, element type, element name and child diagram name. If you design custom diagram profiles, you can also qualify the frame label as required.

Create Custom Diagram Profiles

Display Composite Element Content In Compartment

Composite elements can also show their contents in addition to their usual notation, in a separate compartment of the element.

  1. Right-click on the composite element in the diagram to open the context menu.
  2. Select the 'New Child Diagram | Show Composite Diagram in Compartment' option.

A compartment is added to the element, containing the child diagram. The element is resized to contain the diagram; whilst it can be enlarged, it cannot be reduced to less than the diagram size.

You can also display a Composite diagram inside its parent element using a Shape Script. The diagram is displayed in a custom compartment in the center of the element and not necessarily with the standard compartments (such as attributes, tags).

Show Composite Diagram

Notes

  • If the 'Composite' option is not listed in the context menu, the option is not available for the type of element you have selected
  • If you select either the frame or compartment options to display the child diagram on the composite element, and then you select a different child diagram, the display settings are cleared; reselect the appropriate option to display the new diagram on the composite element
  • Automation support is available for Composite elements - Element has an Elements collection and a Diagrams collection; additionally you can set the Composite diagram with SetCompositeDiagram

Learn more