Jump to Menu

UML Stereotype Tutorial - Working with Styles

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.

Compatible edition(s): Enterprise, Professional, Standard, Modeler

  • June 24, 2015
  • Views: 41,880
  • PDF

  1. Download Simple-Shape-Generator.vpp. You can also find this file at the bottom of this tutorial.
  2. Open the downloaded .vpp file in Visual Paradigm. To open a project, select Project > Open from the application toolbar. You can see the class diagram below.
    class diagram
  3. 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 Windows > Configuration > Configure Stereotypes... from the toolbar.
  4. In the Configure Stereotypes window, expand the tree node Class, and select Class. Click Add... at the bottom.
    to add stereotype
  5. In the stereotype specification, enter API as name.
  6. 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.
    change fill
  7. Similar, check Use for Line and edit its properties. Select a style of dotted line, set 3 as weight, blue as color.
    format line
  8. 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.
    set font
  9. Click OK to confirm the changes in Stereotype Specification. Click OK in Configure Stereotype dialog box to close it.
  10. 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.
    stereotype shape
  11. The appearance of class is updated to follow that defined for the stereotype API.
    final diagram

Resources

  1. Simple-Shape-Generator.vpp

Turn every software project into a successful one.

We use cookies to offer you a better experience. By visiting our website, you agree to the use of cookies as described in our Cookie Policy.

OK