Home
Topic diagrams
Topic diagrams provide another way to create structural diagrams from the code in your application. They are used to quickly create a query based view of relationships between existing elements in your application. These queries are called topics and represent commonly required views of your code, such as showing the super type or sub types of a given class. Topic diagrams are applicable to various elements, such as Java classes, EJBs or WSDL files. Like browse diagrams these diagrams are not editable, but they can be saved as editable UML diagrams and shared with other team members.
A new topic diagram of an application element is created by the Topic Diagram wizard. To launch this wizard, right-click the desired element in the Enterprise Explorer and select Visualize Æ Add to New Diagram File Æ Topic Diagram. After the wizard has started, on the Topic Diagram Location page, enter or select the parent folder and provide a name for the file as shown in Figure | -31. Then click Next.
![]()
Figure 7-31 Topic Diagram wizard (1)
The Topics page shown in Figure | -32 provides a list of standard topics Rational Application Developer can create. Select a predefined query and click Finish. This creates a new topic diagram based on default values associated with the selected topic.
![]()
Figure 7-32 Topic Diagram wizard (2)
To review or change these values, click Next instead. The Related Elements page shown in Figure | -33 appears.
![]()
Figure 7-33 Topic Diagram wizard (3)
This page shows the details of the previous selected topic and allows you to change these values. You can select different types of relationship that should be included in the query along with the expansion direction:
![]()
If you select Incoming, all elements are shown that are related to the context element.
![]()
On the other hand, if you want to see all elements that have a relationship to the context element, select Outgoing.
![]()
You can further specify the number of levels of relationships to query and the layout type for the diagram. The possible values are Default and Radial. These values map to the generalization and radial tree layout type described previously. After a topic diagram is created, you can review or change the underlying query. To do this, right-click the empty space inside the topic diagram and select Customize Query.
Like browse diagrams, topic diagrams are not editable, so the tool palette and the modeling assistant are not available. You can add more elements to the diagram by right-clicking them in the Enterprise Explorer and selecting Visualize Æ Add to Current Diagram.
It is also possible to save a topic diagram as an editable diagram or as an image as we did previously with browse diagrams. To do this, right-click the empty space in a topic diagram and select either File Æ Save as Diagram File or File Æ Save as Image File.
The query and the context element that you have specified are persisted in the topic diagram. Every time you open a topic diagram the underlying elements are queried and the diagram is automatically populated with the most current results. If you make changes to the underlying elements when a topic diagram is already open, the diagram might not represent the current status of the elements until you refresh the diagram manually. To do this, right-click the empty space in the topic diagram and select Refresh.
ibm.com/redbooks