Chapter 4: Working with Templates


About Templates

UMLStudio notation template files have a .not ending (e.g., UML.not). A template stores information about the diagrams and symbols of a notation. Templates are referenced by projects. For example, a project that uses the UML notation will reference the UML.not template.

Unlike project files, you cannot directly open a template file. (If you open (or double-click) a template file in the Windows Explorer, UMLStudio will create a new project based on that template for you.) However, you can indirectly view and edit the contents of a template via any project that is based on that template.

When you open a project, the explorer pane contains a template folder directly below the Models folder, that gives you access to the template. This folder has the same name as the notation template on which the project is based (e.g., UML.not).

As of version 2.0, a user-specified default template is used for creating a new project when UMLStudio is first launched. The shipped software uses UML.not as the default template. The user can specify the default template using the Tools:Options dialog.

A template file contains the following:

The tool definitions provided by a template correspond to the tools in the custom toolbar of UMLStudio. When you use a tool in the custom toolbar to create a drawable, UMLStudio creates the drawable using the definition provided by the template.

If you modify the tool definition in a template, your changes will be immediately reflected in an open project that is based on that template.

Because templates separate the definition of a notation from the definition of the drawings created in that notation, they provide you with considerable flexibility. You can, for example, quickly and consistently change your diagrams by simply adjusting the template.

In addition to the templates shipped with UMLStudio, you can design your own templates and share them with others. Templates are a great way of enforcing consistency of drawings in an organization.


Tool Categories

The link and place tools of a template fall into 3 categories:

Diagram Types

A diagram type is designed as a collection of symbols (links and places) that can be used to create diagrams of that type. Any combination of the link and place tools provided by the template can be used to define a diagram type.

When the user creates a diagram of a given type, only those link and place tools that are part of the diagram type will be available for editing. The other tools will be disabled in the custom toolbar.

UMLStudio supports 8 diagram types:

The definition of a diagram type can be modified through its property sheet.


Link Tool Design

To view the design of a link tool, select its button from the custom toolbar and press the Tool Design Edit button (alternatively, you can directly select the toolís model in the explorer pane). A magnified view of the link toolís design is displayed in the drawing pane, as a model that is partitioned into 3 areas. The boundaries of these 3 partitions appear as dashed red lines. For example, the design of the UML Uni-Composite link tool looks like this:

Drawables that you place in the left partition specify the link attachment at the source. Similarly, drawables that you place in the right partition specify the link attachment at the destination. Drawables that you place in the middle partition specify the middle attachment of the link. The default size of the link is shown in the locater page of the info pane. You can drag the knob at the bottom-right corner of this view to change the default size:

If you want the link to have an editable label, place an editable text box primitive in the middle attachment. If you put more than one editable text box in the middle attachment, only one of them will be used.

When designing or modifying a link tool model, you should ensure that each drawable appears completely within one of the 3 partitions. A drawable that overlaps the partition boundaries is regarded as not belonging to the link and is therefore ignored by UMLStudio.


Place Tool Design

To view the design of a place tool, select its button from the custom toolbar and press the Tool Design Edit button (alternatively, you can directly select the toolís model in the explorer pane). A magnified view of the place toolís design is displayed in the drawing pane. The boundary of this model appears as dashed red lines. For example, the design of the UML Actor place tool looks like this:

The default size of the place tool is shown in the locater page of the info pane. You can drag the knob at the bottom-right corner of this view to change the default size:

If you want the place to have an editable name, place an editable text box primitive in its model. If you put more than one editable text box in the place model, only one of them will be used.

It is generally unusual for a place tool not to have an editable name. In such a case, places created using the tool will still have proper names; this is because every place has a named master. However, you will not be able to directly edit the place name, but you will be able to edit the name via the placeís property sheet.


Tool Icon Design

When you have created a new tool model or changed the design of an existing tool, you should also change the design of its icon so that the new design is apparent to the users by simply looking at the custom toolbar.

To view the icon design of a custom tool, select its button from the custom toolbar (if itís not already selected) and press the Tool Icon Edit button. A magnified view of the toolís icon design is displayed in the drawing pane. For example, the icon design of the UML Actor place tool looks like this:

The default size of the icon is shown in the locater page of the info pane:

You can use the primitive tools to draw pixels into the icon design. Holding down the control key while drawing causes the pixels to be erased instead.


Tool Semantics

As of version 5.0, each tool model has user-defined semantics. This is denoted by the Semantics combo in the property sheet of the tool model.

A place toolís semantics may take one of the following values:

A link toolís semantics may take one of the following values: The specific semantics of a tool has implications, especially for code generation and reverse engineering. Specifically:

Generic Editing Tasks

This section describes the generic tasks which you would do when manipulating existing notation templates or designing new ones.

To create a new notation template

To modify an existing template

To modify a diagram type

To create a new tool model

A new tool model is created and added to the Template\Links or Template\Places folder. The toolís icon is added to the extra links menu or the extra places menu in the custom toolbar.

The tool model is automatically selected and its design is displayed in the drawing pane. The new tool model is initially named Untitled but can be renamed using the model property sheet.

The tool design is initially empty, so that you can populate it with drawables as you wish.

To create a new stereotype model

A new stereotype model is created and added as a child of the toolís model in the explorer pane. The toolís icon is added to the custom toolbar. If the parent tool is a standard tool then positioning the cursor on the tool button will display a popup menu that contains the stereotype. If the parent tool is an extra tool, then the stereotype appears as an icon underneath the parent toolís icon in the extra popup menu.

The stereotype model is automatically selected and its design is displayed in the drawing pane. The new tool model is initially named Untitled but can be renamed using the model property sheet.

The stereotype design is initially empty, so that you can populate it with drawables as you wish.

To delete an extra tool or stereotype model

You will be asked to confirm the delete.

To modify an existing tool model

Tip: While editing a tool model or tool icon, you can quickly go back to the last custom model you were working with by pressing the Model Edit button in the custom toolbar.

To modify a tool icon

You can also copy, cut, paste, and delete tool icons. If the icon youíre designing is similar to another one in this or another template, simply go to that icon, copy it, go back to the icon youíre editing, and paste it there. To completely erase an icon so that you can redesign it, use the Edit:Delete command.

When using clipboard operations, make sure the drawing pane is the active pane. To make the drawing pane active, simply click the mouse pointer inside it.

Changes to a toolís icon will not be reflected in the custom toolbar until you switch to another model.

To modify a toolís properties

To modify a toolís default size

To modify the drawables in tool models

To modify the shaft of a link tool model

To apply a different template to the current project

The template is immediately applied to the project. This may affect the appearance of the models. The project will be based on the new template from now on.


Table of Contents | Chapter 3 | Chapter 5

Copyright © 1996-2010 PragSoft Corporation (www.pragsoft.com)