Set Element Templates Package
In building up a model, you might want to represent or emphasize certain characteristics of elements in the appearance of those elements, 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 diagrams. You could also define a set of characteristics to use for each development stage of a project.
To do all this, you create a diagram with all the characteristics you require, and store it in an element Templates package. Enterprise Architect then checks this folder whenever you start to create an element in a diagram and, if it finds a template for that diagram type, applies the settings in that template to the new element or to the display options of the diagram. For example, you could save a diagram under the name ClassTemplate, to apply a set of display characteristics to all new Class elements.
You should create the Templates package in an administrative View of the project file, rather than in any work area. This prevents the package from being changed or lost in any project development work.
There are two other ways in which you can modify the appearance of elements in diagrams:
- You can define the default appearance of elements (and other structures) grouped in a diagram by using UML Profiles. These provide a means of extending the UML Language, which enables you to build UML models in particular domains. They are based on additional stereotypes and Tagged Values that are applied to elements, attributes, methods, connectors, connector ends and so on.
- You can modify the appearance of elements (and connectors) of a specific type using stereotypes. Stereotypes take precedence over templates; if you drop an unstereotyped element - a Class, for example - onto a diagram, Enterprise Architect searches the Templates package for a Class diagram that defines an unstereotyped Class, and applies that definition to the new Class. If you drop a stereotyped Class onto a diagram, the stereotype defines the Class appearance so the template is not accessed. Stereotypes are much more flexible for defining the appearance of an element under different scenarios.
To set up the element Templates package, follow the steps below:
- Create a new package in the appropriate administration View. You can give this package any name; Templates is an unambiguous option.
- Within the Templates package create new diagrams, one for each type of diagram to template. Give them easily recognized names; for example ClassTemplate for the template for Class diagrams.
- Add new elements to the template diagrams from the Toolbox and configure the size, appearance, notes, version and other properties.
- Select the Settings | Template Package menu option to set the templates as the default element templates. The Browse Project window displays.
- Locate and click on the Templates package, and click on the OK button to set the package as the default element template.
Now each new element you add to your project is created with the settings from the appropriate Template diagram.
If you decide not to use the default element template, set the default element template to <none> in the Browse Project window. The <none> package is at the bottom of the hierarchy shown in the Browse Project window.