In this lab you will practice using the UML diagram tool Violet
(see Violet in the menu to the left)
to create class, sequence, and state diagrams.
This section describes basic operations for class diagrams in Violet,
such as creating a
new diagram and manipulating its parts.
This short overview is not a complete description of Violet; it is just
intended to get you started.
Dismiss the opening informational dialog and click
File > New > Class
Diagram to obtain the tool below. This is the tool for creating
class diagrams.
All tools in Violet run in their own window. The main Violet windonw is
like a mini-desktop that allows several tools running at once.
Each tool has window controls in the upper right like this:
Clicking on the left-most control will minimize the class diagram tool
as shown below, with the minimized window placed at the lower left in a
a task bar. Now other tools can be used. To maximize a minimized tool
window, click its icon on the task bar.
Click to select the
Class icon on the tool bar:
Any time a tool is selected, that is the type of diagram component
(whether it is a class, relationship arrow, etc.) that will be created
when you click again.
Locate a place in the window where you want to
put a node (class icon), and click there. An empty rectangle will appear.
You can move the node around by dragging it with the mouse. If you
right-click in the rectangle you will get a
Properties dialog that will
allow you to enter a class name, attributes, and methods.
Experiment until you get two nodes that look like this:
Since a team is an aggregate of players, select the
Aggregation
icon:
Click anywhere in the
Team class, and drag to anywhere in the
Player class.
If the classes occupy the same horizontal strip within
the diagram, you will get an edge (connecting line) like:
Click the
Select icon on the tool bar:
Now drag the
Player class icon down an
inch or so:
All edges have a
bentStyle property that defines the style of
the edge.
The
bentStyle of our edge is currently
HVH
(
horizontal-vertical-horizontal).
You can control the
bentStyle of an edge by right-clicking on it
to get the edge's property editor:
Here the edge's
bentStyle property has been changed to
VH (
vertical-horizontal):
Violet will attempt to maintain the
bentStyle properties of an
edge as you move associated nodes around.
Below, the
Player class icon has been dragged up, but
the
bentStyle property of the edge is still
VH (
vertical-horizontal).
You can use an edge's property editor to indicate the class
multiplicities for the nodes that it connects:
You can add notes to a diagram by selecting the
Note icon on the
tool bar:
Click anywhere in the diagram to produce a note.
Then, right-click on the note icon to get the note's property
editor. You can enter the note's text and change its background color:
Finally, select the
Note connector icon on the tool bar:
to connect the note to some aspect of the diagram:
Your job is to create diagrams as described
in this section.
For each diagram, use the
File > Save as option in Violet:
Do not use the
Export image option.
In the resulting dialog, give the file the required name, leaving
the
Files of Type: selection set to
Violet Files.
If the required name is "
MyDiagram," Violet will create the full
file name as "
MyDiagram.violet."
Create a class diagram that looks like the one below, except
that
<YOUR NAME HERE> is replaced by your name.
Save your diagram as
Class. Violet will actually create
the file
Class.violet.
Create a state diagram that looks exactly like the one below.
Note the extensive use of notes and the property editor to change a
note's background color.
Save your diagram as
State. Violet will actually create
the file
State.violet.
Submit your files:
- Class.violet
- Sequence.violet
- State.violet
by going to
and clicking
Submission under
Lab 3: UML Diagrams.
Note that the grader
will open your diagrams in Violet.
- Class Diagram: 3 points
- Sequence Diagram: 4 points
- State Diagram: 3 points