# State

Currently BOUML manages only the behavioral states.

A state represents a state machine, a sub machine, a composite state or a simple state. By definition each state placed in a class view, a use case view or a use case is a state machine, and a state machine may contains sub machines and states. By default at the creation time a state machine is stereotyped machine, and a sub machine is stereotypes submachine.

Note : for reasons of simplification the final state is considered to be a pseudo state.

In the browser a state may contain sub states, regions, pseudo states, transitions, actions and state diagrams :

The state's properties will be exposed below.

## Menus

The state menu appearing with a right mouse click on its representation in the browser is something like these, supposing the state not read-only nor deleted (see also menu in a diagram) :

### Menu : add ...

These entries of the menu allow to add a state diagram, a sub state or a region, the sub machine will have the stereotype submachine. The state diagrams nested in a state are the ones for the state, this means that in case you use this state diagram to create a new state or pseudo state these ones will be a child of the state in the browser.

### Menu : edit

edit allows to show/modify the state properties. In case the state is read-only, the fields of the dialog are also read-only.

#### State dialog, tab Uml

The tab Uml is a global tab :

The proposed stereotypes are the default one specified through the Default stereotypes dialog more the current one (empty here). It is possible to choose into the list or to give a new one, or to empty it.

The specification allows to set the operation the state implements, this button can show a menu proposing depending on the cases to select the current specification operation in the browser or to choose the operation may be selected in the browser

The editor button visible above and associated here to the description, allows to edit the description in an other window, or to call an external editor (for instance Xcoral) specified through the environment dialog. Note that this external editor have to create an own window, its parameter is the pathname of the file containing the description, its execution is done in parallel with BOUML which looks each second at the file contents to get the new definition until the dialog is closed (I do not like very much this polling but this works even QT isn't compiled with the thread support).

A states without child except transitions and entry or exit pseudo states can be transformed into state reference or allow to change the referenced state by an other one :

To add a connection point reference to a submachine state reference add an entry or exit point then edit it to specify the reference.

#### State dialog, tab Ocl

The Ocl tab allows to specify the state behavior using the Ocl language, but in fact BOUML doesn't check the syntax, this is just a convention.

#### State dialog, tab C++

This tab allows to specify the state behavior in C++, but in fact BOUML doesn't check the syntax, this is just a convention.

#### State dialog, tab Java

This tab allows to specify the state behavior in Java, but in fact BOUML doesn't check the syntax, this is just a convention.

### Menu : duplicate

The menu entry duplicate clone the state without its children

### Menu : extract it from X

The menu entry extract it from X is present when the stste is nested in X (perhaps X is itself nested in another one, but it is not visible here). Choosing this entry the current stste became a children of the parent of X.

### Menu : referenced by

To know who reference the current stste through a transition.

### Menu : mark

See mark

### Menu : delete

The menu entry delete is only present when the state is not read-only.

Delete the state and all its children, and all the representation of them in the opened diagrams. After that it is possible to undelete them (from the browser) until you close the project : obviously the deleted items are not saved !

### Menu : tool

The menu entry tool is only present in case at least a plug-out may be applied on a state. The selected tool is called and applied on the current state.

## Default stereotypes

The dialog allowing to set the default stereotypes :

## Drawing

A state is drawn in a diagram as a rectangle with rounded corners :

In case of a sub machine state reference the name of the referenced state is also written.

A right mouse click on a state in a diagram calls the following menu (supposing the state editable) :

### Menu : show/hide decomposition indicator

To draw or not the icon indicating the state contains or not sub states (in theory in case they are not drawn). Note Bouml follow your choice without checking if this has sense, except that the indicator can't be hidden in case of a sub machine state reference.

### Menu : edit drawing settings

These drawing settings concerns only the picture for which the menu is called.

A settings valuing default indicates that the setting specified in the upper level (here the diagram) must be followed, obviously this one may also be default ... up to the project level. When you add a state in a diagram, all the settings are set to default.

#### show activities :

Allows to show or not the state's activities in a compartment depending on the drawing language.

#### drawing language :

Allows to specify the used language in case the state's activities are shown.

#### drawing regions horizontally :

Allows to indicate if the regions are drawn horizontally or vertically, for instance :

Note : the regions are not visible while the state picture is too small.

#### State color :

To specify the fill color.

### Menu : set associated diagram

set associated diagram allows to automatically open the current diagram when a double mouse click is made on the state representation in a diagram or the browser. After that the only way to edit the state is to choose the edit entry in the menu.

### Menu tools :

Appears only when at least one plug-out is associated to the states. To apply a plug-out on the state.

Previous : class instance

Next : state action