Prev Next

Set Up Templates Package

In building up a model, you might want to represent or emphasize certain characteristics of elements in the appearance of those elements on a diagram, or select particular display options as standard. For example, you could make new Interface elements a different default color to new Class elements, ensure all new Activity Partitions are vertical rather than horizontal, or set a specific group of display options for new Use Case diagrams.

To do this, you create an element or a diagram with all the characteristics you require, and store it in a Templates Package; the system then checks this Package:

  • Whenever you create a new diagram, or
  • Whenever you start to create an element using the Diagram Toolbox

When you are creating a new diagram, the system checks for the diagram type in the Templates Package and, if it finds that diagram type, will copy the display options of the template diagram into the new diagram.

When you are creating a new element, the system checks for that element type in the Templates Package and, if it finds that element type, will copy the template element as defined. The definition includes any default display options of the template element, so you can apply the template definition and switch to the default appearance for the new element, if you prefer.

In the image below, a 'Class' element has been dropped onto the diagram in the Templates Package.  It is created with the default appearance of the base element.

In the next image, the appearance of the element 'Template_Class' on the diagram 'Template Class Diagram' has been updated, using the tools from the Style panel of the Layout ribbon.  Note however, that the default appearance of the element 'Template_Class' remains unchanged.

When a new 'Class' element is created from the toolbox, it is created with the same default appearance properties as the underlying template element, however its appearance on the diagram where it is created, replicates the appearance of the template element on the template diagram.

You can revert the element's appearance back to the default, by selecting the element and applying the 'Default Style' from the Layout ribbon, or by choosing the ribbon option 'Layout > Diagram > Appearance > Reset Local Element Appearance'.

Similarly, if 'Class1' was deleted from 'New Class Diagram' (but not from the model) and then dropped back onto the diagram from the Browser window, it would be created using the default appearance copied from Template_Class, not the appearance displayed on the template diagram.

You can create the Templates Package anywhere in your model; however, it is better to create it in a location that is not likely to be accidentally changed or lost in any project development work.

Set up the Element Templates Package

Step

Action

See also

1

Create a new Package. 'Templates' is used as the Package name in the illustration, but you can give the Package any name you prefer.

2

Within the template Package create new diagrams, one for each type of diagram to template.

Give the diagrams easily recognized names; for example Class Template for the template for Class diagrams.

3

Add elements to the template Package (each element must also appear on one, and only one, diagram), and configure the size, appearance, notes, version and other properties that you want new elements to have. You can use a standard UML element or a stereotyped element as the base for your template definition.

4

To specify the package to use as the Templates Package, select the ribbon option 'Configure > Reference Data > Settings > Project Template Package'.

The Find Package window displays.

5

Locate and click on the package you wish to set as the Templates Package, then click on the OK button.  (You can set only one package at a time as the Templates Package.)

Now each new element or diagram you add to your project is created with the settings from the appropriate template element or diagram.

Notes

  • In the Corporate, Unified and Ultimate editions of Enterprise Architect, if security is enabled you must have 'Manage Reference Data - Update' permission to set up or access the Templates Package
  • The fill color for an element derived from the template can be overridden by the element fill color defined by a Shape Script applied to the element via a stereotype, or you can switch to or change the default appearance in the 'Default Appearance' dialog
  • If you decide not to use any templates, set the Templates Package to '<none>' in the Find Package window; the '<none>' Package is at the bottom of the hierarchy shown in the window
  • An alternative way in which you can modify the immediate appearance of elements as you create them in diagrams is to redefine them, either under the same type name or as new element types, in a UML Profile

Learn more