Chapter 6
Component diagrams
Here is an example of component diagram you can draw:
Now, we will talk about elements that compose such diagrams:
6.1 To define a component
A component can be defined with the
Both options
You can also define the width of an empty component with the
You can define a component in another component or in a package. Then, the coordinates of the sub-component are relative to the parent component or package:
Notice that you can define a class inside a component.
If you want to define a component without detailing it, you can use the
Every
6.2 To define a provided/required interface
On a component, you can define 2 kinds of interfaces: provided interfaces and required interfaces. For that
purpose, you can use
The
You can change these default names with the
The
The
The
If you look at the previous example, you can notice the padding between the interface symbols on
sub-components, and the boundary of the parent component. You can change it with the
This option will be very useful when you draw connectors, as you will see in the next section.
6.3 To define an assembly connector
An assembly connector is a relation between 2 different components. It is graphically the provided interface of
one of them with the required interface of the other. For that purpose, you can use the
The assembly connector symbol is drawn only if the
You can also name the assembly connector with the option
6.3.1 To define the geometry of an assembly connector
As for
-
umlHVassemblyconnector: - shortcut of
umlassemblyconnector with geometry=-| -
umlVHassemblyconnector: - shortcut of
umlassemblyconnector with geometry=|- -
umlHVHassemblyconnector: - shortcut of
umlassemblyconnector with geometry=-|- -
umlVHVassemblyconnector: - shortcut of
umlassemblyconnector with geometry=|-|
6.3.2 To place the assembly connector symbol
To place the assembly connector symbol, you can use the
6.3.3 To adjust the geometry of an assembly connector
As for
The position of the ports is automatically evaluated according to the values given to these options and to the
6.4 To define a delegate connector
A delegate connector is a connector between a sub-component and its parent component. For this purpose, you
can use the
6.5 To define a port on a component
Sometimes, as in the previous example, you have to draw manually a port. For this purpose, you can use the
The first argument is the component name, the second one is the anchor of the component node where you want
to draw the port. You can set the size of the port with the
6.6 To change preferences
Thanks to the
-
text: - allows to set the text color (=black by default),
-
draw: - allows to set the color od edges and arrows (=black by default),
-
fill component: - allows to set the background color of components (=yellow !20 by default),
-
fill port: - allows to set the background color of ports (=yellow !20 by default),
-
fill assembly connector: - allows to set the background color for assembly connector symbols (=white by default),
-
font: - allows to set the font style (=
\ small by default).
You can also use the options
There is an exception:
6.7 Examples
6.7.1 Example from introduction, step by step
Definition of the components
There is 6 components A, D, E, F, G and H, and 2 sub-components of A: B and C.
Definition of the interfaces
We define a required interface for the component B, and a provided interface for the component C. We prepare the delegate connector by setting the padding.
Definition of the connectors
We define 5 assembly connectors and 1 delegate connector.
Definition of the notes
We add notes to explain the node names.