Decomposed States and Sub-states

A decomposed state is a state that contains sub-states. The decomposed state behaves like a specialized package or container. A sub-state can itself be decomposed into further sub-states, and so on.

Note: To display all states in the model in the List of States, including those belonging to decomposed states, click the Include Composite States tool.

You can decompose states either directly in the diagram using an editable composite view or by using sub-diagrams. Sub-objects created in either mode can be displayed in both modes, but the two modes are not automatically synchronized. Editable composite view allows you to quickly decompose states and show direct links between states and substates, while Read-only (Sub-Diagram) mode favors a more formal decomposition and may be more appropriate if you decompose through many levels.

You can choose how to view composite states on a per-object basis, by right-clicking the symbol and selecting the desired mode from the Composite View menu.

You cannot create a package or any other UML diagram type in a decomposed state, but you can use shortcuts to packages.

Working in Editable Composite View Mode

You can decompose a state and create substates within it simply be creating or dragging another state onto its symbol. You can resize the parent symbol as necessary and create any number of substates inside it. You can decompose a substate by creating or dragging another state onto its symbol, and so on.

Transitions can link states at the same level, or can link states in the parent diagram with sub-states in the Editable Composite View mode:


Composite States

Working with Sub-State Diagrams

You can convert an atomic state to a decomposed state in any of the following ways:

  • Press Ctrl and double-click the state symbol (this will open the sub-state directly)

  • Open the property sheet of the state and, on the General tab, select the Decomposed State radio button

  • Right-click the state and select Decompose State

When you create a decomposed state, a sub-state diagram, which is empty at first, is added below its entry in the browser:



To open a sub-state diagram, press Ctrl and double-click on the decomposed state symbol, or double-click the appropriate diagram entry in the Browser.

You can add objects to a sub-state diagram in the same way as you add them to an state diagram. Any states that you add to a sub-state diagram will be a part of its parent decomposed state and will be listed under the decomposed state in the Browser.

You can create several sub-state diagrams within a decomposed state, but we recommend that you only create one unless you want to design exception cases, such as error management.

Note: You can locate any object or any diagram in the Browser tree view from the current diagram window. To do so, right-click the object symbol, or the diagram background and select Edit > Find in Browser.