# 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 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 variable BOUML_EDITOR. 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).

#### 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 :

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

### 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