Creating a new diagram template

 

Creating a new J profile implementation

Diagram templates, like code templates and documentation templates, are created inside J profile implementations in the "Behavior profiles" folder of a J MDA component. This means that the next step in this quick tour project is to create a J profile implementation inside which you will then create and develop your new diagram template.

 

To create your new J profile implementation, select the “Behavior profiles” folder and click on the  icon. In the window that then appears, name the J profile implementation ("MyTemplates") and confirm by clicking on the “OK” button.

 

For more information on creating J profile implementations, please see “Defining a J profile implementation”.

 

 

Creating a new diagram template

To create your new diagram template, select the “MyTemplates” J profile implementation you have just created, click on the  icon and click on “OK” to confirm. The “Select diagram type” window then appears. Select “Class” and click on the “OK” button.

 

Figure 63. The “Select diagram type” window

 

The “Diagram template creation” window then appears.

 

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.

 

For the purposes of our example, we are going to change the name of the diagram template we have just created, by carrying out the following steps:

1.      Select the name of the diagram template on the top left of the window shown in Figure 64.

2.      Click once on it (or press F2).

3.      Enter the new name (in our example, “Static diagram template”) for the diagram template.

 

Note:      This operation can also be carried out in the MDA Modeler explorer.

 

Figure 64. The “Diagram template creation” window

 

 

Defining the diagram naming rule

To define the rule that will be used to name new diagrams created through the new diagram template, the “Naming rules” property is used (Figure 65).

 

Figure 65. Defining the “Naming rules” property for your diagram template

 

Steps:

1.      Select the new diagram template on the left of the window.

2.      In the list of properties on the right of the window, select the “Naming rules” property and double-click in the “Value” column to activate the field. Enter "Project diagram - " + Name (please make sure you enter this exact text, since any text which is not J code has to be surrounded by double quotes). For more information on entering J code, please see “Inserting J code”.

 

For more information on diagram template properties, please see “Diagram templates”.

 

 

Creating a navigation node to retrieve classes

We are now going to create a navigation node, which will be used to retrieve the classes of the package and to unmask them in a diagram.

 

Steps:

1.      Select the “Static diagram template” template root.

2.      Click on the  icon. The “Create a navigation node” window then appears.

3.      Select “Classes” from the list.

4.      Click on “OK” to confirm.

 

Figure 66. Creating the “Classes” navigation node.

 

For more information on creating navigation node, please see “Creating navigation nodes”.

 

 

Creating a display node on the “Classes” navigation node

We will now proceed with the creation of our first display node, which will be created on the “Classes” navigation node.

This “display” node allows to specify that the classes will be unmasked in the generated diagram.

 

Steps:

1.      Select the “Classes” navigation node.

2.      Click on the  icon.

 

We are now going to continue by defining the background and foreground colors that will be used for unmasked classes, as shown in Figure 67.

 

1.      Select the display node you have created for the “Classes” navigation node.

2.      Click on the “Value” column for the “Background color” property, and enter the color you wish to use for the background of classes: in our example, wheat.

3.      Click on the “Value” column for the “Foreground color” property, and enter the color you wish to use for the background of classes: in our example, blue.

 

Figure 67. Creating a display node for the "Classes" navigation node

 

For more information on creating display node, please see “Diagram templates”.

 

 

Creating a navigation node to retrieve attributes

We are now going to create a navigation node inside the “Classes” navigation node, which will allow us to unmask the attributes belonging to the classes unmasked in a diagram.

 

Steps:

1.      Select the “Classes” navigation node.

2.      Click on the  icon. The “Create a navigation node” window then appears.

3.      Select “Attributes” from the list.

4.      Click on “OK” to confirm.

 

The next step in our quick tour project is to create a filter on the "Attributes" navigation node, to indicate that only attributes with public visibility should be unmasked.

To carry out this operation, select the “Attributes” navigation node. In the “Value” column for the “Filter” property, enter the following: Visibility == Public.

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

 

Figure 68. Creating the “Attributes” navigation node.

 

For more information on creating navigation node, please see “Creating navigation nodes” and “Filters”.

 

 

Creating a display node on the “Attributes” navigation node

We will now proceed with the creation of our second display node, which will be created on the “Attributes” navigation node.

This “display” node allows to specify that the attributes will be unmasked in the generated diagram.

 

Steps:

1.      Select the “Attributes” navigation node.

2.      Click on the  icon.

 

We are now going to continue by defining the foreground color that will be used for unmasked attributes, and by indicating that we wish to have detailed visibility and the signature of these attributes, as shown in Figure 69.

 

Note:      Detailed visibility for attributes means that they are displayed with their visibility symbols (+, - and #).

 

1.      Select the display node you have created for the “Attributes” navigation node.

2.      Click on the “Value” column for the “Foreground color” property, and enter the color you wish to use for the font color of attributes: in our example, violet.

3.      Check the tickbox for the “Detailed visibility” property.

4.      Check the tickbox for the “Signature” property.

 

Figure 69. Creating a display node for the “Attributes” navigation node

 

For more information on creating display node, please see “Diagram templates”.

 

Click on the “OK” button to validate the template. At any time, you can save your modifications without closing the window by clicking on the “Apply” button.