Attributes and Operations may be displayed on a class diagram. Often, a class diagram is created specifically for this purposeit shows the structure and behavior of the classes in a package. Relationships typically are not shown on this diagram. CREATING A CLASS DIAGRAM TO SHOW THE ATTRIBUTES AND OPERATIONS FOR A PACKAGE -
Right-click to select the package in the browser and make the shortcut menu visible. -
Select the New:Class Diagram menu choice. A class diagram called NewDiagram will be added to the browser. -
With the new diagram selected, enter the name of the diagram. ADDING CLASSES TO A DIAGRAM USING THE QUERY MENU -
Double-click on the diagram in the browser to open the diagram. -
Select the Query:Add Classes menu choice. -
Select the desired package. -
Click to select the desired classes and click the >>>> button to add the classes to the diagram or click the All >> button to add all the classes to the diagram. FILTERING RELATIONSHIPS IN RATIONAL ROSE -
Double-click on the diagram in the browser to open the diagram. -
Select the Query:Filter Relationships menu choice. -
Click the None button in the Type field to hide all relationships shown on the open diagram. -
Click the OK button to close the Relations window. DISPLAYING SOME ATTRIBUTES OR OPERATIONS IN RATIONAL ROSE -
Right-click to select the class on an open class diagram and make the shortcut menu visible. -
Select the Options:Select Compartment Items menu choice. -
Click to select the attributes and operations to be displayed. -
Click the >>>> button. -
Click the OK button to close the Edit Compartment window. SHOWING ALL ATTRIBUTES AND OPERATIONS IN RATIONAL ROSE -
Right-click on the class in a diagram to make the shortcut menu visible. -
Select the Options:Show All Attributes menu choice to display all the attributes for the class. -
Repeat step 1 and select the Options:Show All Operations menu choice to display all the operations for the class. Note To always display the attributes and operations for a class, you can set the Show All Attributes and Show All Operations selections using the Tools:Options menu. SETTING STEREOTYPE DISPLAY IN RATIONAL ROSE -
Right-click on the class in a diagram to make the shortcut menu visible. -
Select the desired Options:Stereotype Display menu choice (None = do not display stereotype, Label = show stereotype in << >>, Icon = show class using Stereotype icon). The class diagram called Attributes and Operations for the University Artifacts package is shown in Figure 7-6. For this type of diagram I prefer to show the stereotypes of the classes as labels. Figure 7-6. Displaying Attributes and Operations |