Working with links

 

Different ways of drawing links

In Objecteering diagrams, there are three different ways of drawing links:

 

The way in which links are drawn has a direct impact on the overall clarity of the diagram.  By default, links in UML 2 diagrams are drawn in orthogonal mode, while in UML 1.4 state diagrams they are drawn by default in free mode.

 

In UML 2 diagrams, if you try to create a link that is not authorized (for example, if you try to create an association between a package and a class), the  icon appears, indicating that the operation you are trying to carry out is not allowed.  If you leave your mouse over the unauthorized element, a help message appears, explaining the problem and suggesting a solution. 

 

Note:      In UML 1.4 state diagrams, this "model expert" feature is not available.

 

 

Drawing a link in orthogonal mode

Links drawn in orthogonal mode are made up of straight lines and right angles.  In orthogonal mode, you can draw your link with as many intermediate points as you like.

 

To draw a link in orthogonal mode, simply carry out the steps shown below.

 

Drawing an association between two classes in orthogonal mode

 

Steps:

1.      Click on the "Create an association" icon.

2.      Click on the origin class.

3.      Draw your link, with any desired intermediate points, and finally click on the destination class.

 

Note:      In UML 1.4 state diagrams, a link is always drawn in free mode. If you want to draw a link in orthogonal mode, simply hold down the "Shift" key on your keyboard while you are drawing the link.

 

 

Drawing a link in free mode

Links drawn in free mode can contain acute or obtuse angles. In free mode, you can draw your link with as many intermediate points as you like.

 

By default, a link in a UML 2 diagram is always drawn in orthogonal mode.  If you want to draw a link in free mode, simply hold down the "Shift" key on your keyboard while you are drawing the link.

 

To draw a link in free mode, simply carry out the steps shown in the screenshot below.

 

Drawing an association between two classes in free mode

 

Steps:

1.      Click on the "Create an association" icon.

2.      Click on the origin class.

3.      Hold down the "Shift" key and draw your link, with any desired intermediate points, and finally click on the destination class.

 

Note:      In UML 1.4 state diagrams, a link is drawn in free mode by default, so you don't have to hold down the "Shift" key on your keyboard while you are drawing the link.

 

 

Drawing a link in rake bar mode (shared target links)

Inheritance links linking more than two elements are automatically presented in rake bar mode.  They can be drawn vertically, horizontally, pointing up or pointing down.

 

Additional elements can be added to the same rake bar link, simply by clicking on the link itself.

 

Creating an inheritance link in rake bar mode

 

Steps:

1.      Click on the  "Create an inheritance link" icon.

2.      Select the origin class by left-clicking.

3.      Select the existing inheritance link going to the same destination class.  The inheritance link is then transformed into rake bar form.

 

 

Drawing reflexive links

To draw a reflexive link, simply click on the icon representing the type of link you want to create, and click a first time and then a second time on the same element.  According to where you click, the reflexive link will be graphically represented at the top right corner, top left corner, bottom right corner or bottom left corner of the element.

 

Note:      Reflexive links can only be graphically represented on one of the corners of the selected element.

 

 

Moving a link or a part of a link

Simple links with no intermediate points can be moved by clicking on the link, holding down the left mouse button, moving the link to the desired new position and releasing the mouse button.

 

For links with one or more intermediate points, you can move each individual part of the link.

 

Moving two parts of an association

 

Steps:

1.      Select the link some of whose parts you want to reposition.

2.      Select the first part of the link and reposition it as you wish.

3.      Select the second part of the link and reposition it as you wish.

 

The result of the operation shown in our example is presented below.

 

Two parts of the association shown above have been moved

 

 

Moving a link end or intermediate point

To move a link end or an intermediate point, simply click on the left mouse button over the corresponding point which you wish to move, and drag it to the new position.  When you release the left mouse button, the link end (or intermediate point) is repositioned.

 

When when moving a link end, additional intermediate points can be added to a link in the usual way (by left-clicking).

 

Note:      If you try to move a link end to an unauthorized position in a UML 2 diagram, the cursor will display the  icon.  If you leave your mouse over the unauthorized element, a help message appears, explaining the problem and suggesting a solution.  This "model expert" feature is not available in UML 1.4 state diagrams.

 

 

 

 

Redrawing a link

If you want to redraw a link, you have two ways of activating the "Redraw link" command:

 

The graphic representation of the link then disappears, leaving you free to redraw the path of the link as you wish.

 

 

Adding additional intermediate points to links in UML 1.4 state diagrams

In UML 1.4 state diagrams, if you want to add additional intermediate points to a link, simply hold down the "Ctrl" key, click on the link where you want to create the new intermediate point and drag the new intermediate point to the desired location.

 

If the link is free, acute or obtuse angles will be produced. Conversely, if the link is orthogonal and this operation is carried out, the link will be shown in its new form, but only using right angles.

 

 

Removing intermediate points

To delete intermediate points, click on the link to select it, and then click on the intermediate point you want to delete.  Drag the selected intermediate point in line with the two intermediate points surrounding it, and then release the mouse button.  The intermediate point then disappears and the two intermediate points surrounding it are now linked by a straight line.

 

 

Modifying link values

If you want to enter or modify values for a link, you can do this directly in the diagram.

 

Directly entering a value for an association

 

Steps:

1.      Select the link.  Once selected, the value entry boxes appear.

2.      Select a value entry box, press F2 and enter a value directly over the highlighted zone.

 

Link values can also be entered or changed through the associated dialog boxes, which can be opened by double-clicking on the link.