Applies ToVisio Premium 2010 Visio 2010 Visio 2007

Use the tools in Visio to build your with classes and objects.

Important: The UML static structure diagram is not available in Visio 2013 and later versions. For information, see UML diagrams in Visio.

In this article:

Add an interface to a class, component, or other element

  1. In a static structure, component, or deployment diagram, drag the lollipop Interface shape (represented by a line and circle) onto the drawing page.

  2. Glue the endpoint without the circle to a connection point Connection point image - blue Xon the class component, or other element.

  3. Double-click the Interface shape to add a name, operations, and other property values.

    Tip: You can also represent an interface with a rectangular Interface shape that resembles a class. Use this shape when you want to display a list of the interface operations.

    Tip: To change the type of shape that appears for an interface, right-click the Interface shape and click Show as Class-like Interface or Show as Lollipop Interface.

Indicate a realizes relationship between a class and an interface or other element

  1. In a static structure diagram, right-click any class shape (Class, Parameterized Class, Utility or MetaClass), click Shape Display Options, and then, under General Options, select Realization Link.

  2. Glue the control handle Control handle image - yellow diamondfor the realization link on a class shape to a connection point Connection point image - blue Xon the interface, class, or other element.

Add receptions to a classifier

  1. Double-click the shape representing the classifier you want to add receptions to, and then click the Receptions category.

  2. Click New to add a new reception.

  3. Click the Reception category. Type a name for the reception in the Reception column. In the Signal column, choose the signal to which the classifier, prepared by the reception, reacts, and then choose the other property values you want.

    Note: A signal element must exist in the model for it to be available in the Signal list.

  4. In the Exceptions category, choose the exceptions, if any, that can be generated by the reception.

    Note: An exception element must exist in the model for it to be available in the Signal list.

  5. Add any constraints or tagged values you want, and then click OK until you close the shape's UML Properties dialog box.

Add template parameters to a class

  1. Double-click the shape (Parameterized Class, Class, Utility, Metaclass, or Bound Element) representing the element that you want to add parameters to, and then click Template Parameters.

  2. Click New to add a new parameter.

  3. In the Template parameters list:

    • To edit an existing parameter, type a new name in the Template Parameter column.

    • To edit the type, click a Type field, click the arrow, and then select the type from the list.

    • To add documentation, type in the Documentation box.

  4. Click OK to accept the changes and close the UML Class Properties dialog box.

    Tip: You can make any class a parameterized class by adding parameters to a class shape. To hide parameters on any class shape, right-click the shape, click Shape Display Options and then, under Suppress, select Template Parameters.

Add operations to a class, data type, or interface

  1. Double-click the shape (Class, Data Type, or Interface) representing the element that you want to add operations to, and then click Operations in the Categories list on the left.

  2. Click New to add a new operation.

  3. Select Properties to edit the item's properties.

    Property

    Description

    Stereotype

    Choose the stereotype you want from the drop-down list. If a stereotype you want to use isn't listed, you can add a new stereotype or edit an existing one by clicking Stereotypes on the UML menu.

    Prefix

    Type any language-specific annotation text here you want to use to further identify an operation return type.

    Suffix

    Type any language-specific annotation text here you want to use to further identify an operation return type.

    Return Type

    Choose an implementation type for the value returned by the operation. If the data type you want isn't listed, right-click a data types package in the tree view, point to New and click Data Type, or create a new class.

    Expression

    Displays the result of data you've added under Prefix, Return Type, and Suffix.

    Visibility

    Choose the visibility (public, private, or protected) that applies to the operation. Public means the operation is publicly available to any class. Protected means the operation is available inside the class and to its subclasses. Private means that the operation can only be used inside the class.

    OwnerScope

    Choose instance for owner scope if the operation is only applicable to objects created using the class. Choose classifier if the operation can be applied to the class itself.

    IsPolymorphic

    Select if the implementation of the operation can be overridden by subclasses and methods can be defined by subclasses. Leave clear if the method realizing the operation is inherited unchanged by all descendants.

    IsQuery

    Select when an application of the operation will not modify the state of its element.

    Call Concurrency

    Concurrency specifies the semantics of concurrent calls to the same passive instance (i.e., an instance originating from a classifier with IsActive=false). Sequential means only one call to an instance can be outstanding at once. Guarded means that multiple calls from concurrent threads can occur simultaneously but only one can commence, with the others blocked until the first operation is complete. Concurrent means that multiple calls from concurrent threads can occur simultaneously and all can proceed concurrently.

    Click OK to save these settings.

  4. Select Methods, as needed, to edit the item's methods.

    Property

    Description

    Class name

    The UML Model Diagram template automatically provides full information about the class name. You can't edit this information.

    Operation name

    Displays all operations that can have method bodies for this particular class. This includes all operations from the current class, polymorphic operations from base classes, and operations from interfaces that are implemented by the class.

    Choose the operation for which you want to specify a method.

    Has Method

    Select if the operation has a method that realizes it.

    Language

    Choose the language you want to write the method in.

    Method Body

    Type the body of the method.

    For example a simple C++ method body could be:

    {
    if (x == 0)
    {
    RunCommand();
    ProcessResults();
    }
    }

Bind template parameters to a class

  1. Drag a Bound Element shape from the UML Static Structure stencil onto the drawing page near the Parameterized Class shape with parameters you want to bind.

  2. Drag a Binding shape onto the drawing page and glue the endpoint without an arrowhead to a connection point Connection point image - blue Xon the bound element.

  3. Glue the Binding endpoint with an arrowhead to a connection point on the Parameterized Class shape.

  4. Double-click the Binding shape, and then click Bound Arguments.

  5. Under Bound Arguments, select a parameter to which you want to bind a type (if the parameter has no type specified) or select a value (if the parameter has a type specified). Click Properties, choose the type or type the value you want, and then click OK.

  6. Click OK to close the UML Binding Properties dialog box.

Attributes and operations associated with the parameterized class are passed to the bound element. Unbound parameters (with no specified type) that you have assigned to the class as attribute types or operation return types, are replaced in the bound element by the types you specified in step 5 above.

Create an object as an instance of a class

  1. In a static structure diagram, drag a Class shape onto the drawing page to represent the class you want the object to be an instance of.

  2. (Optional)  Double-click the Class shape to open the UML Class Properties dialog box. Click Attributes, and then click New to add attributes to the class. Click OK, and then click OK again.

  3. Drag an Object shape onto the drawing page, and then double-click the shape.

  4. In the UML Object Properties dialog box, click Object and type a name for the object. Under Class, select the class you want the object to be an instance of.

  5. Click Attribute Values and select the attribute you want to add an instance value to, and then click Properties. Type a value for the attribute.

  6. Click Attribute Link, add any other property values you want, and then click OK.

  7. Repeat steps 5 and 6 for all the attributes you want to add instance values to, and then click OK.

Delete template parameters from a class

  1. Double-click the shape (Parameterized Class, Class, Utility, Metaclass, or Bound Element) representing the element with parameters you want to delete, and then click Template Parameters.

  2. Select the template parameter you want to delete, click Delete, and then click OK.

Edit template parameters for a class

  1. Double-click the shape (Parameterized Class, Class, Utility, Metaclass, or Bound Element) representing the element with the parameters you want to edit, and then click Template Parameters.

  2. In the Template parameters list, for each parameter you want to edit, click a Type field. Then, click the arrow and select a type from the list.

    Note: You can assign parameters with no type specified to attributes as types or to operations as return types.

  3. In the Template parameters list, for each parameter that you want to edit, type a new name.

  4. In the Documentation box, type the documentation you want.

  5. Click New to add another parameter (and follow steps 3 through 5), or click OK to close the UML Class Properties dialog box.

Hide the attribute and operations sections of a class

  1. Right-click the Class shape, and then click Shape Display Options.

  2. In the UML Shape Display Options dialog box, under Suppress, select Attributes to hide the attributes section, and then select Operations to hide the operations section.

    Tip: To show the attributes and operations sections again, right-click the shape, click Shape Display Options, and then clear Attributes and Operations.

Indicate that classes in a package may be referenced

  1. In a package diagram, drag a Dependency shape onto the drawing page.

  2. Glue the Dependency endpoint without an arrowhead to a connection point on the package that will reference the classes in another package.

  3. Glue the Dependency endpoint with an arrowhead to a connection point Connection point image - blue Xon the package that contains the target classes that will be referenced.

  4. Double-click the Dependency shape to open the UML Dependency Properties dialog box.

  5. Under Name, type a name for the dependency. Under Stereotype, choose Import, and then click OK.

Note: Connecting packages with an <<import>> dependency only indicates that classes can be referenced. You still need to set the appropriate visibility for the target classes.

Show the implementation of a type by an implementation class

  1. In a static structure diagram, drag a Class shape onto the drawing page. Double-click the shape.

  2. In the UML Class Properties dialog box, click Class and type a name for the class. Under Stereotype, choose Type, and then click OK.

  3. Drag a second Class shape onto the drawing page. Double-click the shape.

  4. In the UML Class Properties dialog box, click Class and type a name for the class. Under Stereotype, choose Implementation Class, and then click OK.

  5. Right-click the implementation class and click Shape Display Options. In the UML Shape Display Options dialog box, under General Options, select Realization Link, and then click OK.

  6. Drag the control handle Control handle image - yellow diamondon the implementation class shape to create a connector representing a realizes relationship.

  7. Glue the endpoint on the realization connector arrowhead to a connection point Connection point image - blue Xon the Class shape representing the type.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.