Class Diag.

The graphical editor dedicated to the Class Diagram has been specified from the UML 2.0 Superstructure Specification document. Feel free to bring your own remarks about the way UML concepts were represented in this diagram : we could discuss about that on the user mailing list .

1. Creation of the diagram

1.1. From the wizard

You can use the creation wizard to create a new class diagram. Select the corresponding Template to initialize the model.

selectTemplate

The root element of the UML model is a Model and it contains a Package as its children element. The diagram is then linked with the Package.

1.2. From an existing diagram

The class diagram is necessarily associated with a Package model object.

modelHierarchy

Then you can create a new diagram by selecting a Package node in the Outline : " Right Click > Add Diagram " and select " Class Diagram ".

2. Editing of the Diagram

2.1. Basic editing

2.1.1. Package

To create a new Package , select the 'Package' creation tool in the palette and then click on the diagram. The name of the Package is editable directly in the editor or in the Properties View. Then, you can associate a new diagram by double clicking on the element.

2.1.2. Class

To create a new Class , select the 'Class' creation tool in the palette and then click on the diagram. The name of the Class is editable directly in the editor or in the Properties View.

You can easily add Properties and Operations on a Class by selecting the appropriate creation tool in the palette and clicking on the containing Class. The name of the Properties and Operations are editable in the editing window : others properties (type, visibility, operation parameters, ...) can be changed through the Properties View.

2.1.3. Interface

To create a new Interface , select the 'Interface' creation tool in the palette and then click on the diagram. The name of the Interface is editable directly in the editor or in the Properties View. Then, its behaviour is very similar to the Class object : you can add properties and operations and customize them through the Properties View.

2.1.4. DataType

To create a new DataType , select the 'DataType' creation tool in the palette and then click on the diagram. The name of the DataType is editable directly in the editor or in the Properties View. Then, its behaviour is very similar to the Class or Interface object : you can add properties and operations and customize them through the Properties View.

2.1.5. Property

To create a new Property , select the 'Property' creation tool in the palette and then click on a Class , an Interface or a DataType .

2.1.6. Operation

To create a new Operation , select the 'Operation' creation tool in the palette and then click on a Class , an Interface or a DataType .

2.1.7. InstanceSpecification

An InstanceSpecification is a representation of an instance of a class. To add an InstanceSpecification to your class diagram, use the 'InstanceSpecification' creation tool in the palette.

Then, you can double click on the graphical element to open a dialog, and edit many features of the model object :


2.1.8. Association

You can create an Association connection between Classes and Interfaces.


  1. The creation of an Association has three steps using the mouse :
  2. Select the 'Association' creation tool in the palette.
  3. Click on a Class or an Interface, this is the first association end of the Association.
  4. Click on a Class or an Interface, this is the second association end of the Association.

Then, you can use the Properties View to customize the Association and its Properties.

2.1.9. Generalization

You can create a Generalization (or Inheritance) connection between two Classes or two Interfaces.

The creation of a Generalization has three steps using the mouse :
  1. Select the 'Generalization' creation tool in the palette.
  2. Click on a Class or an Interface, this is the source of the inheritance relationship.
  3. Click on a Class or an Interface (depending on the type of the source node), this is the target of the inheritance relationship.

2.1.10. InterfaceRealization

You can create an InterfaceRealization (or Implementation) connection between a Class and an Interface.

The creation of an InterfaceRealization has three steps using the mouse :
  1. Select the 'InterfaceRealization' creation tool in the palette.
  2. Click on a Class, this is the source of the implementation relationship.
  3. Click on an Interface, this is the target of the implementation relationship.

2.1.11. Dependency

You can create a Dependency connection between any element in this diagram.

The creation of a Dependency has three steps using the mouse :
  1. Select the 'Dependency' creation tool in the palette.
  2. Click on an element of the class diagram, this is the source of the dependency relationship.
  3. Click on another element of the class diagram, this is the target of the dependency relationship.

2.1.12. Enumeration

To create a new Enumeration, select the 'Enumeration' creation tool in the palette and then click on the diagram. The name of the Enumeration is editable directly in the editor or in the Properties View. Then, its behaviour is very similar to the Class or Interface object : you can add enumeration literals and customize them through the Properties View.

2.1.13. EnumerationLiteral

To create a new EnumerationLiteral, select the 'Enumeration Literal' creation tool in the palette and then click on an Enumeration.

2.1.14. PrimitiveType

To create a new PrimitiveType, select the 'Primitive Type' creation tool in the palette and then click on the diagram. The name of the PrimitiveType is editable directly in the editor or in the Properties View. Then, its behaviour is very similar to the Class or Interface object : you can add properties and operations and customize them through the Properties View.

2.1.15. PackageImport

You can create a PackageImport connection between two Packages.

The creation of a PackageImport has three steps using the mouse :
  1. Select the 'Package Import' creation tool in the palette.
  2. Click on a Package, this is the source of the import relationship.
  3. Click on another Package, this is the target of the import relationship.

2.1.16. PackageMerge

You can create a PackageMerge connection between two Packages.

The creation of a PackageMerge has three steps using the mouse :
  1. Select the 'Package Merge' creation tool in the palette.
  2. Click on a Package, this is the source of the merge relationship.
  3. Click on another Package, this is the target of the merge relationship.

2.2. Advanced editing

2.2.1. Editing of a Property

You can edit a Property through the Properties View : you can specify its name, type and visibility in the 'Model' tab. The 'Advanced' tab enables you to view and edit all the existing properties of the element : you should be well informed before trying to modify them.

editProperty

2.2.2. Editing of an Operation and its Parameters

The Properties View has been customized to facilitate the editing of an Operation. Thus, you can edit the general properties of the Operation as its name, but also indicate whether the Operation has a return Parameter (before choosing the type of the return Parameter), you should check the check box on the right of the corresponding widget.

editOperation

Then you can also control the Parameters that are handled by the Operation, you have to activate the 'Parameters' tab under the 'Model' tab. There you have a read only table that list all the Parameters that the Operation contains : you can add or remove a Parameter. When a Parameter is selected, you can edit its properties in the corresponding fields below.

editParameters

2.2.3. Editing of an Association

The Properties View has been customized to facilitate the editing of an Asscociation. Thus, you can edit the general properties of the Association as its name, but also define its behaviour through its Properties (association end). Each Property correspond to an extremity of the Association, and you can specify the cardinality, type and other useful properties in the corresponding tab of each association end.

editAssociation

You should have a look to the metamodel for further informations on these properties.

3. Diagram Example

classDiagram

_______________________________________

By Jacques LESCOT, Anyware Technologies

September, 1 2006