Control Shape Appearance with Stereotype
You can extend a model element from a stereotype to give it specific identify and specify its domain specific properties. Moreover, you can define formatting properties to stereotype, such as fill color and border style, to make model elements that extend the stereotype follow. In this tutorial, we will make use of a simple class diagram to show how to format a stereotype called API, and how to format an API class by applying stereotype.
- Download the project Simple-Shape-Generator.vpp attached to this tutorial.
- Start VP-UML in a new workspace.
- Open Simple-Shape-Generator.vpp and class diagram Simple Shape Generator. You can see the class diagram below.

- We want to model the fact that class Shape is an API class. We can do this by defining and applying an API stereotype. Select Tools > Configure Stereotypes... from the main menu.

- In the Configure Stereotypes dialog box, expand the tree node Class, and select Class. Click Add... at the bottom.

- In the stereotype specification, enter API as name.
- Here you can see three options in the specification dialog box. They are Fill, Line and Font. By setting them, you can make classes that extend the API stereotype share the formatting properties defined. Let's try Fill first. Check Use for Fill. Click on the ... button. Select gray as color.

- Similar, check Use for Line and edit its properties. Select a style of dotted line, set 3 as weight, blue as color.

- Finally, check Use for Font and edit its properties. Select a font you like (Comic Sans MS is used in this tutorial), set bold, and select 14 as font size, which makes the text bigger than default.

- Click OK to confirm the changes in Stereotype Specification. Click OK in Configure Stereotype dialog box to close it.
- Now, we need to make the class Shape extend the API stereotype. Right click on the class Shape and select Stereotypes > API from the popup menu.

- The appearance of class is updated to follow that defined for the stereotype API.

Resources
- Simple-Shape-Generator.vpp
Rate this Article
Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).
One Moment Please
Thanks for rating this article.
Comments (0)