NShape Concepts
Templates

<< Click to Display Table of Contents >>

Navigation:  Concepts >

NShape Concepts
Templates

Previous pageReturn to chapter overviewNext page

In many applications, shapes are not individuals but represent a certain category. They are class symbols in an UML diagram, electric lines in a wiring diagram, actions in a flowchart and so forth. All shapes of the same category will than have to look and behave in the same way. They have the same shape type, use the same colors, have the same glue and connection points and map the model object properties in the same way. If the program or the user modifies one of these characteristics, they should be modified for all shapes belonging to this category.

This feature is realized in NShape via templates. The available templates are displayed in the toolbox and when the user creates a new shape based on one of these templates, the shape stays linked to it. All future changes to the template will be reflected in each of its shapes.

Well, almost all changes. A shape can also partially detach from its template and decide to keep a certain property private. This is always the case for the position of the shape and also for its size. Other properties like the color are taken from the template as long as no explicit value has been assigned. When a shape has its private color, color changes in the template will no more be reflected in the shape until the private color is removed, in which case the shape re-attaches to the template.

Which property of a shape are usually taken from the template depends on the shape's implementation. The pre-defined shape classes take all properties with the exception of the position, the size and the rotation.

 

Concepts_Templates_ChangingColor1

Editing the template will change all shapes created from this particular template.
In this case, the shape color will be changed from white to green.

 

Concepts_Templates_ChangingColor2

After applying the changes to the template, all shapes will take over the new characteristics of the template.
In this particular case, all (former) white label shapes become green when applying the changes.