This section describes the state diagram operations that you
can perform in Violet.
After launching Violet, click
File > New > State Diagram to get
the tool window below.
We will describe the
State and
State Transition
tools. The
Note and
Note connector tools work as with the
other diagram types. We will not use the
Initial State
and
Final State tools.
Click to select the "
State" icon on the tool bar:
Locate a place in the window where you want to
put a state and click there. An empty rounded rectangle will appear.
You can move the node around by dragging it with the mouse. If you
right-click in the rectangle you get a
Properties dialog that will
allow you to enter a state name.
Here is a diagram in which three states of a voice mail system have
been created:
When a voice mail system is in a
connected state
and an extension is dialed, it goes into a
recording state.
To show in a diagram how a state transitions to another when an event occurs, click
the
State transition icon on the tool bar:
Click in a state and drag to the state to which it transitions. Here is
the previous diagram with four transitions added:
Transitions should be labeled with the event that causes the
transition.
To label a transition, select the
Select icon on the tool bar:
Right-click the transition and enter a label in the
Properties dialog.
Here is the previous diagram with the transitions labeled:
Occasionally it is helpful to specify in a state diagram a computation
that should occur upon entry to or exit from a state.
UML allows states to be annotated with
actions to specify such
computations.
For example, a voice mail system may need to increment a count when a
recording has been completed.
To add an action to a state, simply edit the state's
Properties.
Here is the previous diagram with an
exit
action added: