While the UML specification identifies many different relationships and possible sub-types, UMLBoard only uses a subset of them. This subset, however, should be suitable for most diagrams, associations, generalizations and dependencies.
In UMLBoard, associations can be split further into compositions and aggregations:
Use compositions to express that the lifetime of one class depends on its related type. E.g., suppose an
Orderclass has a composition relation to
OrderItems: If you delete the
Orderclass, all corresponding
OrderItemswill be deleted accordingly.
Aggregations describe a similar relation, but both elements of the connection can exist independently of each other. For example, a
Tiremight still exist if you delete the
Carto which it belongs (although this might depend on your use case).
If you're unsure about the concrete type of association (or it does not matter in your case), choose the more general and unspecified type association.
To specify a generalization relationship, UMLBoard provides the Inheritance or Implementation relation. The concrete type of generalization depends on the target class type. In the case of a class, the generalization will be Inheritance; in the case of an interface, it will be an Implementation. Changing the target class type will automatically change the kind of generalization.
Finally, the dependency relation is not further distinguished. If you need a more fine-grained dependency classification, you could use a meaningful description like «use», «create» or «call» for your relation's text.
Creating and Editing
To create a relationship between two classes, start by dragging one of the connection points that appear when you hover the mouse over a class rectangle onto the target class.
After releasing the mouse on the target, a dialog with the list of available relationships should appear. The available options might vary depending on your source and target class type.
The created link will have a predefined description depending on the chosen relationship type. You can change it by long-pressing or double-clicking the text. Right-clicking on the connection opens a context menu with additional editing options: Switching the Connections allows you to
UMLBoard will always draw an orthogonal connection path by choosing the least distant connection points as start and endpoints. The relation automatically updates if you move either the source or target element.
The automatic routing algorithm should work for most basic scenarios but can be limited regarding more advanced layouts. To provide extra guidance to the automatic routing, you can add additional anchor points to a line by pressing Cmd / Ctrl + Click while clicking on a connection line. When drawing a connection between two elements (classes or notes), the algorithm will now always ensure that the line also goes through all anchor points associated with the relation line.
Just click and hold the mouse to drag the anchor point to a different position and see the changes applied to the routing instantly. In that way, you can force the connection to take a specific direction or move around elements.
To delete an anchor point again, select it by clicking on it and press the Del or Backspace key.
Anchor points don't change their position if you move the source/end of a relation separately (but do if you move both source and target simultaneously). Therefore, adjusting the anchor points might sometimes be necessary after moving one of the connection's elements.
Choose and Lock Docking Points
Using anchor points to customize the routing is suitable for more complex scenarios. Still, it can be a bit cumbersome for more straightforward designs. Here, it is often sufficient to define which sides of an element should be used for docking the connection line.
For this, you have two possibilities:
- For new lines: While drawing a new connection, just drag its end directly on the connection point of the target element you wish your line to connect to.
- For existing lines: Drag the connection's end marker (the blue dot at the end of a line) and drop it onto an arbitrary connection point. In that way, you can also change the source/target element of a connector after creating it.
After that, the line's ending is locked to this specific point. The layout algorithm will no longer choose a different docking point, no matter where the source and target elements are placed. If you want to remove this constraint and enable auto-docking again, grab the line's end (the blue dot) and drop it directly over the element (and not over one of its docking points). The routing will then choose the docking point that guarantees the shortest connection between two elements.
Another way of locking/unlocking a line to a connection point is to right-click on the end indicator and choose the corresponding menu entry from the context menu.
Custom Docking Points
Suppose your class has many incoming or outgoing connections. In that case, only a single docking point for all links can impair the overview.
To dock your connection to an arbitrary point, press the Shift key while drawing the connection line over a class's border. A small dot will indicate the position of your new docking point. Release the mouse (while keeping Shift pressed) to create your connection.
Your new docking point will keep its position relative to the total length of the classifier's edge. So if you grow or shrink the classifier, the docking point will adjust its position according to the new size.
You can also use this approach when moving a connection's endpoint. Just press Shift and dock the endpoint at the desired position.
Associations and Properties
Whether you want to express a relation as an association or through an attribute is totally up to you. You can even start one way and later convert it to the other. For doing so, click on your property/relation and choose the corresponding menu element. You can, of course, undo or revert your decision any time by executing the contrary menu element.
Navigability in UML describes how easy it is for a class instance to reach the object on the other side of a connection. If, for example, a connection has navigation arrows for both of its ends, that means there must be an efficient way during runtime to navigate from one edge to the other and vice versa (think, for example, of a double-linked list). How this navigation should actually be realized is implementation specific.
UMLBoard supports navigability for all types of associations and the usage relation. To set the navigation of a relation, you can pick the connection directly or choose one of its endpoints and select one of the Navigation context menu entries: Source, target, or both. Picking the same menu item again will remove the navigation from the corresponding edge.
Making the source of an aggregation/composition relation navigable does technically work. However, you won't see the resulting navigation arrowhead as it would overlap with the diamond symbol. Instead, you can draw two relations, one for the aggregation and the other for expressing the navigability from target to source.
When loading diagrams created with a version older than 1.8.0, UMLBoard will automatically change the navigability of each usage relation to target to render the arrowhead correctly.
Moving Relations Vertically/Horizontally
Sometimes, you want to draw several relations in parallel between two elements, e.g., when a class has more than one outgoing connection to another. So far, you have had to drag the endpoints of each relation separately to the desired positions. This can be cumbersome, especially if the space between your lines is small. Instead, you can now click on the relation's name and drag it up/down (or left/right) to move the whole connection to the desired position.
This works for all relations as long as they are orthogonally attached to their elements (either on two horizontal docking points or two vertical ones).
Instead of using the mouse, you can also use the arrow keys. Just click on the relation to select it and move the up/down or left/right keys to move the relation.
Moving a Relation's Name
While dragging a relation lets you change its position, pressing Shift while dragging its name allows you to move only the title while keeping the other parts untouched. This can be useful for long texts that would otherwise be overlapped by other diagram elements. The new text position will be "locked" and will have the following behavior:
- When moving both ends of the relationship, the text will keep its new place relative to both ends.
- Dragging only one end will not affect the text position. It stays "locked" at its current custom position.
You can always go back to the auto-positioning mode by right-clicking on the text and unchecking the lock menu entry. The layout algorithm will then calculate the new text position depending on the shape of the relation.
Choosing between Overlapping Lines
Ever had the problem that you could not grab a line because it was hidden by another one? Press Cmd (macOS) or Ctrl (Windows/Linux) and use the right/left arrow keys while hovering over the lines to step through them one by one. The currently top most line will be marked in bold color. After you reached the desired connection, click with the mouse to select it. Now you can easily manipulate the line.
References and further readings