Diagram templates

 

Introduction to diagram templates

Diagram templates, also known as view templates, are used to automatically create or update diagrams on model elements.

 

Navigation nodes are used to browse elements, in order to locate those which you wish to unmask in the diagram.

 

A browsed element is not necessarily unmasked in the diagram. To unmask an element, a display node must be created in the navigation node, which will also allow the definition of the elements unmasked properties (color, detailed display, and so on).

 

When a new UML 1.4 diagram is created, the automatic layout feature ensures the correct positioning of the elements. This feature is not available for the creation of UML 2.0 diagrams.

 

When an existing diagram is updated, the position of the elements that the user has modified since the creation of the diagram is retained.

 

 

Creating a diagram template

To create a new diagram template, click on the  icon from a J profile implementation in the "Behavior profiles" folder of a J MDA component and select the type of diagram the template must create.

 

Note:      Diagram templates can only be created on J profile implementations in J MDA components.  It is not possible to create a diagram template for a Java MDA component.

 

There are two groups of diagram type:

·         The UML 2.0 diagrams: activity diagram, class diagram, collaboration diagram, communication diagram, deployment diagram, object diagram, sequence diagram and use case diagram. With the “Scope Manager” MDA component, the business rule diagram, dictionary diagram, goal diagram and requirement diagram can be created with diagram templates.

·         The UML 1.4 diagrams: state diagram

 

According to the diagram type, the template editor is a little different.

 

Figure 118. Selection of the diagram type created by the template

 

After the selection of diagram type, The “Diagram template” window then appears (for details on this window, see “General principles of template design”).

 

Figure 119. The diagram template editor

 

Toolbar

On the top-right of the template design window, the icons (which are presented on the top-right of the template design window as shown in Figure 119) available on a diagram template to create nodes are detailed below.

 

Icon

Description

This icon is used to create a navigation node. It is available on the template root or on a navigation node.

This icon is used to create a diaplay node. It is available on a navigation node.

This icon is used to reference an internal node in order to execute an existing node. It is available on the template root and on a navigation node.

This icon is used to reference a node from another diagram template. It is available on the template root and on a navigation node only for UML 1.4 diagram templates.

 

 

UML 2.0 diagram template properties

The properties specific to UML 2.0 diagram templates are as follows:

 

Property

Description

Naming rules

This defines the name of the diagram created by the template.

For example, you can write the following J code:

"Detailed diagram for " + Name

In this case, you obtain the following diagram name:

"Detailed diagram for MyClass".

For more information on entering J code, please see “Inserting J code”.

 

 

UML 1.4 diagram template properties

The properties specific to UML 1.4 diagram templates are as follows:

 

Property

Description

Detailed visibility

This indicates whether or not the visibility and path are detailed.

For example, the “+,-,#” symbols are shown on class members.

The class name includes the package paths “P1:P2:C1”.

Naming rules

This defines the name of the diagram created by the template.

For example, you can write the following J code:

"Detailed diagram for " + Name

In this case, you obtain the following diagram name:

"Detailed diagram for MyClass".

For more information on entering J code, please see “Inserting J code”.

Stereotype display

This indicates the form of stereotype display.

Stereotypes are presented as icons only if the element contains no other elements.

For example, a class can present an icon stereotype if it does not show its members.

Tagged values visible

This indicates whether or not tagged values are presented in the diagram.

 

 

Adding a display node

To add a new display node to your diagram template in order to unmask elements, simply click on the icon on the top-left of the “View template” window (Figure 154). The new display node automatically appears, together with its properties and their values.

 

Only one node can be created under a navigation node. An existing display node can be copied in order to unmask severals elements with the same properties.

 

 

Display node properties for UML 2.0 diagram

The properties available on a display node (which are presented on the top-right of the template design window) are detailed below.

 

Property

Description

Background color

This defines the background color of the graphic element.

Objecteering has a predefined set of color names.

Each name in this set is associated with a specific RGB triplet.

If a color is not specified by a predefined name but by an RGB value, this color gets a default name of the following form: “#RRRRGGGGBBBB”, where each of the red, green and blue values is represented by four hexadecimal digits.

Example: yellow, red, blue, #ACACF5F5DCDC.

Font

This defines the font applied to the text. The value has the following form:

“%family-size-style-foundry”

where:

-     family is the string specified as the parameter family (time, courier, etc.).

-     size is the ASCII representation of the parameter size.

-     style is a combination of the letters B, I and U, standing respectively for bold, italic and underlined.

-     foundry is an optional string. It often identifies the company that designed the font. This field is seldom specified. When it is ignored, the trailing “-” can be omitted too.

Examples:

-     “%helvetica-12-“

-     “%time-12-BU”

-     “%courier-14-i-adobe”

Foreground color

This defines the foreground color and font color of the graphic element.

Objecteering has a predefined set of color names.

Each name in this set is associated with a specific RGB triplet.

If a color is not specified by a predefined name but by an RGB value, this color gets a default name of the following form: “#RRRRGGGGBBBB”, where each of the red, green and blue values is represented by four hexadecimal digits.

Example: yellow, red, blue, #ACACF5F5DCDC.

Namespacing

This defines whether or not the element's complete access path (namespacing) is displayed.

Signature

This displays the signature (attribute type, operation parameters...).

Stereotype

This defines the way in which stereotypes are:

-      image: the graphic element is represented by the large stereotype icon

-      text/icon: the element's graphic representation includes stereotypes (names or icons)

-      none: no particular information on the stereotype is presented

Tagged value

This displays tagged values textually.

For example, {tag1, tag2, tag3}.

Visibility

This displays the element's UML visibility (+,-,#,~).

 

 

Display node properties for UML 1.4 diagram

The properties available on a display node (which are presented on the top-right of the template design window) are detailed below.

 

Property

Description

Background color

This defines the color applied to box backgrounds.

Foreground color

This defines the color applied to box foreground.

Inclusion

This indicates whether or not the element is unmasked in its owner.

For example, if the property value is “true”, a class is unmasked in its owner package (if the owner package is also unmasked).

If the value is “false”, the class and its package are unmasked separately.

Stereotype display

This indicates the form of stereotype display.

Stereotypes are presented as icons only if the element contains no other elements.

For example, a class can present an icon stereotype if it does not show its members.

Detailed visibility

This indicates whether or not the visibility and path are detailed.

For example, the “+,-,#” symbols are shown on class members.

The class name includes the package paths “P1:P2:C1”.

Tagged values visible

This indicates whether or not tagged values are presented in the diagram.

 

 

Example of a UML 2.0 diagram template: Creating and unmasking classes in a package diagram

In this example, we are going to create a diagram template which will be used to unmask the classes of a package in a diagram.

 

In order to do this, the following operations must be carried out:

·         create the navigation node allowing you to retrieve classes

·         create a display node

 

Note:      A longer and more complete example of building a diagram template is available in “Quick tour of MDA Modeler - Building a diagram template”.

 

To create the navigation node, carry out the steps shown in Figure 120 below.

 

Figure 120. Creating the navigation node

 

Steps:

1.      Position yourself in the root of the diagram template.

2.      Click on the  icon. The “Create a scan method” window then appears.

3.      In this window, select “Classes”. This will allow classes to be retrieved when the template is applied.

4.      Click on “OK” to confirm. The new navigation node immediately appears.

 

To create the display node, proceed as shown in Figure 121.

 

Figure 121. Creating the display node

 

Steps:

1.      Position yourself in the navigation node.

2.      Click on the  icon. The new display node immediately appears.

 

The “Background color” and “Foreground color” properties do not need to be defined, as their default values will be used during the unmasking of classes.

 

When executed, this diagram template will automatically unmask classes in the diagram in question.