MagicDraw 18.5 Documentation

Skip to end of metadata
Go to start of metadata


The layout templates functionality, which is driven by <<layoutTemplate>> stereotype, assists you in creating well-formed diagrams. It allows you to define Class appearance once, and reuse it later when creating Parts typed by that Class and Ports in different diagrams. Parts and their Ports are represented identically as part's type Class whose layout and style is defined in the layout template diagram. Often, Port position reflects its physical location in the system, so it is beneficial to maintain the same appearance of Parts, layout, and style of Ports throughout the whole model. In the figure below, the appearance of the Modem Card Block is the same in two different diagrams, SysML Block Defiition diagram and SysML Internal Block diagram

Additional information

You can reuse layout templates in other projects by exporting packages to new projects.


 

Usage of a layout template. The illustration displays concepts from SysML Plugin.

To create a layout template and use it in other diagrams, follow these steps:

  1. Define the appearance of Class, layout, and style of its Ports in the Class diagram.

  2. Set that Class diagram as the layout template.

  3. Apply the layout template to other diagrams.

Important

Only one Class shape with its Ports can be defined in one layout template diagram.

 

How to define the appearance of Class and its Ports layout in the Class diagram

If you want to reuse the style and layout of Class with its Ports in another diagram, you need to define the appearance of the Class, the style, and position of its Ports in the Class diagram. When defining the appearance of the Class, you can change its color, font, size, layout, and other style properties. To do this, follow the procedure below.

 

To define the appearance of Class and its Ports layout in the Class diagram


  1. Create the Class diagram. How to create diagrams >
  2. Create a new or represent an existing Class with its Ports on the diagram pane.
  3. Specify the appearance of all shapes by using the Symbol Properties dialog and diagram toolbar.
  4. Set the positions of Ports on Class shape manually.
    The appearance of Class and its Ports shapes are defined (see the figure below).

     The comparison of default and defined appearance of the Modem Card Block, style, and the position of its ports. The illustration displays concepts from SysML Plugin.

Back to Top

How to set the Class diagram as layout template

After the appearance of the required Class and its Ports is defined in the Class diagram, you can now use it as the layout template, which you can reuse in other diagrams. The procedure below describes how to set the diagram as the layout template. Note that the layout template name automatically becomes the same as diagram name. This will be important when applying the layout template, and choosing which template you want to apply.

 

To set the Class diagram as the layout template, do one of the following


  • From the diagram shortcut menu, point to Display > Layout Template, and select the Use as Layout Template command.
  • Ensure that nothing is selected on the diagram pane, then, in the diagram toolbar, select Display, point to the Layout Template and select the Use as Layout Template command.
    The <<layoutTemplate>> stereotype appears on the diagram header (see the figure below).
The Definition BDD is set as the layout template named Definition. The illustration displays concepts from SysML Plugin.


Back to Top

How to stop using the Class diagram as a layout template

If you no longer want to use the Class diagram as a layout template, you need to remove the <<layoutTemplate>> stereotype from the diagram. To do this, follow the procedure below.

 

To stop using the Class diagram as a layout template


  1. Ensure that nothing is selected on the diagram pane.
  2. Open its shortcut menu.
  3. Select the Stereotype command.
  4. In the Stereotype dialog, clear the layoutTemplate check box.

  5. Click Apply.
    The <<layoutTemplate>> stereotype disappears from the header of the Class diagram, and it can no longer be applied as the layout template.


Back to Top

How to apply the layout template

If you want to use the layout template in another diagram (usually the Composite Structure diagram), the following conditions must be met beforehand:

  • The Part must be typed by the Class or subtype of Class in the Composite Structure diagram.
  • The appearance of the Part type Class or subtype of Class must be defined in the Class diagram.
  • That Class diagram must be set as the layout template.

You can apply layout templates directly from the diagram toolbar or shape's shortcut menu by using the Apply Template command. This command provides different suggestions in those two situations:

  • Apply Template without drop-down arrow appears when only one layout template is available for the selected element.
  • Apply Template with drop-down arrow appears when multiple layout templates are available for the selected element. The multiple layout templates are listed according to the following rules:
      - If you set the default layout template, it will always be first on the list, and the others are then listed alphabetically. How to set the default layout template >>
      - If you haven't set the default layout, all layout templates are listed alphabetically.

The procedures below explain how to apply the layout template for the:


Applying the layout template for the Part

To apply the layout template for the Part, do one of the following


  • When modifying already displayed Parts in a Composite Structure diagram. Select the Part shape to which you want to apply the layout template:
      - From its shortcut menu, point to Display > Layout Template > Apply Template, and select an appropriate layout template by its name.
      - In the diagram toolbar, select the Display and point to Layout Template > Apply Template, and select an appropriate layout template by its name.
  • When creating a new Parts in a Composite Structure diagram. Drag the Class, that Part you want to create in the model, on the diagram pane and:
      - Drop the Class.
      - Hold down until the Tooltip appears (long drag), drop that Class, and select the Create Property Symbol and Apply Default Template command.


Applying the layout template for the Class and all classifiers

You can apply the layout template for the same Class and all classifiers that are set as the layout template, but are represented in other Class diagrams. To do this, follow the procedure below.

To apply the layout template for the Class and all classifiers


  1. Select the Class shape or another classifier shape that has the layout template defined.
  2. Do one of the following:
      - From the shape shortcut menu, point to Display > Layout Template > Apply Template, and select an appropriate layout template by its name.
      - In the diagram toolbar, select the Display and point to Layout Template > Apply Template, and select an appropriate layout template by its name.


Applying the layout template for the diagram frame

When creating the internal structure for the Class that has a layout template defined, you can keep the same layout and style of its Ports on the Composite Structure Diagram frame.


To apply the layout template for the diagram frame


  1. Select the diagram frame.
  2. Do one of the following:
    - From the shape shortcut menu, point to Display > Layout Template > Apply Template, and select an appropriate layout template by its name.
    - In the diagram toolbar, select the Display and point to Layout Template > Apply Template, and select an appropriate layout template by its name.

The example below illustrates how the appearance of ports defined in the Air Transfer System layout template is applied to the Internal Block diagram of the Air Transfer System Block.

The layout template applied on the Air Transfer System Internal Block Diagram frame.

How to remove the applied layout template from the shape

You can remove the applied layout template on the Part, Class, or classifier shape, if you want to see their predefined style notations. To remove it, follow one of these steps:

  • Revert the Apply Template command by using the Undo button from the main toolbar, or press Ctrl+Z.
  • Delete those shapes and display them again by using the Display Parts/Ports dialog. Ensure that the Use Layout Template check box is cleared.


Back to Top

The multiple layout template

You can represent the same Class with a different appearance according to the context of Class usage in the Composite Structure diagram. To accomplish this, define multiple diagrams for the same Class element with different names, and set them as layout templates. The diagram names identify the differences between layout templates and simplify layout template selection when applying it. The procedures below explain how to create and apply multiple layout templates.

 

To create multiple layout templates


  1. Create the Class diagram with a name that identifies the layout template name.
  2. Define the appearance of Class and its Ports shapes in the Class diagram. How to >>

  3. Set that Class diagram as the layout template. How to >>

  4. Repeat steps 1, 2, and 3 until you have the required number of layout templates of the same Class element.
  5. Apply multiple layout templates to other diagrams. How to >>

 

The example below shows how the port's position on the Modem Card Block is represented differently: on the left side and on the right side of the Block shape. According to the illustration, the names of the Block Definition Diagrams are appropriate: DefinitionPortsRight and DefinitionPortsLeft. You can find the same layout templates when trying to apply one of those layout templates for the Part shape in the Internal Block Diagram.

Two different layout templates of the Modem Card Block can be found as selection when applying it in any Internal Block Diagram. The illustration displays concepts from SysML Plugin.


Back to Top

Setting the layout template as the default template

If you have a commonly used layout template, you can set it as the default. The default layout template will always be the first and separated by a line when trying to apply or open the layout templates. Only one layout template can be set as the default. The procedures below explain how to:

Setting the layout template as default template

 

To set the layout template as default template


  1. From the diagram shortcut menu, select Specification.
  2. In the Specification window, select the Tags property group.
  3. Find the <<layoutTemplate>> tag, and select its default property.
  4. Click the Create Value button to create a new value for the <<layoutTemplate>> tag, if it is not already created.
  5. Ensure that the Value check box is selected and set to true.
  6. Click Close.
    The layout template diagram is now set as the default layout.

Changing the default layout template

 

To change the default layout template


  1. Open the Specification window of the default layout template diagram.
  2. Select the Tags property group.
  3. Clear the Value check box to set it to false.
  4. Click Close.
  5. Open the layout diagram template that you want to be the default template.
  6. Repeat all steps of the previous procedure: Setting the layout template as default the template.


Back to Top

Navigation to layout templates

You can navigate from usage to definition layout template by using the Open Template command. This command provides different suggestions in those two situations:

  • Open Template without drop-down arrow appears when only one layout template is available for the selected element.
  • Open Template with drop-down arrow appears when multiple layout templates are available for the selected element. The multiple layout templates are listed according to the following rules:
      - If you set the default layout template, it will always be the first in the list, and the others are listed alphabetically. How to set the default layout template >>
      - If you haven't set the default layout, all layout templates are listed alphabetically.

The procedure below describes two ways to open the layout template.

 

To open the layout template diagram


  • From the shortcut menu of the Part or Class shape, point to Display > Layout Template > Open Template, and select an appropriate template. 
  • Select Part or Class shape, in the diagram toolbar, select Display and point to Layout Template > Open Template, and choose an appropriate template.  

Using layout templates with diagram aspects

The Class diagram that is used as as the layout template can have a specific diagram aspect defined. In other words, the layout template can only be used in another diagram with the same aspect. In the example below, the Control System Block Definition Diagram is a layout template with the electrical aspect defined, so the Control System layout template can only be used in the electrical view of the system. In this case, the Control System layout template is used in the Climate Hardware Internal Block Diagram that is defined as electrical. This layout template can't be applied in the diagram with a different aspect defined, e.g., Communication.

Usage of a layout template with aspect. The illustration displays concepts from SysML Plugin.
On this page

Sample Model

The sample models used in the figures of this page are Modem Cable and Diagram Aspects that comes with SysML Plugin. To open those samples properly you need to install the SysML plugin in the MagicDraw and:


  • No labels