Enhancements to the UML Modeler component
As of IBM® Rational® Software Architect Standard Edition Version 8, IBM® Rational® Software Modeler is included as a component called UML Modeler. Thus, what was two products is now only one. This provides BPMN 2 (Business Process Modeling Notation), UML 2 (Unified Modeling Language) modeling, code visualization, and reconciled modeling support for Java™, C#, and VB.NET (Microsoft® Visual Basic® .NET). You can augment this foundation platform with a set of optional extensions that provide capabilities from collaboration and simulation through to deployment modeling or the use of integrated architecture frameworks. IBM® Rational® Software Modeler users benefit from this change, because you now get the code visualization and round-trip engineering capabilities as part of your move to Rational Software Architect Version 8.
This article describes many of the enhancements included in the UML Modeler component to help you create clearer diagrams, prevent or resolve problems, and collaborate with colleagues.
Cleaner, more convenient views
As part of this significant change, the Modeling perspective has been improved.
If you start from a new workspace or reset your perspective (from Window > Reset Perspective), you will no doubt recognize that the default Modeling perspective has changed in IBM Rational Software Architect Version 8.0. By default, the Modeling perspective contains only four views:
- Project Explorer
- Layers (new)
The rest of the views (such as the Inheritance Explorer) are available as Fast Views by clicking the Fast View button at the bottom-left of the application window.
The previous perspective has been renamed to Classic Modeling. It remains only for compatibility purposes, so it is better to use the new one.
Although the classic Properties view is still supported, a more convenient kind of view is now available in the form of a pop-up dialog window, shown in Figure 1. It gives you easy access to the properties of selected elements without taking up a large portion of the screen. To access the new view, select Properties from the element's context menu from either the Project Explorer or the diagram.
In the example in Figure 1, the General properties for the selected element (Central System::Main) are shown. To show other properties of the element, use the left or right arrows in the title bar to switch property pages. The down arrow (next to "General") displays a list of the property pages that are available for the selected element, which corresponds to the property tabs available in the classic Properties view.
Figure 1. Showing the properties of an element from the Project Explorer
Properties and simplified navigation
You can also access the Properties pop-up window by using clickable hyperlinks that simplify navigation. Hovering your cursor over the names of elements in diagrams will display a pop-up tip with one or more hyperlinks (see Figure 2). Clicking the hyperlink will show the properties of that element. Hovering over attributes will display a link to both the attribute itself and the type of the attribute (if a type has been set). Hovering over operations will display a link to the operation and each of its parameters. In addition, some tables contain columns where you can select a type. Cells in those columns contain a button labelled with a right-facing arrow
->. You can also access the properties in the pop-up window by pressing that arrow button; from there, you can jump to the properties of the type that you have selected.
Figure 2. Hyperlinks appear in a pop-up tool tip
In addition to simplifying navigation to the properties of elements, navigation to the element in the Project Explorer has also been improved. Apart from being able to navigate to the primary element, it is also possible to navigate to certain referenced elements. As in previous versions of the software, you locate the element in the Project Explorer by using the Navigate submenu of the element's context menu or drop-down menu. In sequence diagrams, if you select a lifeline on the diagram, in addition to being able to navigate to the corresponding lifeline in the Project Explorer, you can navigate to the chosen lifeline's property or type. For a Behavior Execution Specification, you can navigate to the referenced behavior. On activity diagrams, you can also navigate to the referenced element for elements, such as the Send Signal action (which references a signal) and the Call Behavior operation (which references a behavior).
You can use the arrow button in the Properties toolbar to navigate to the element in the Project Explorer, while the arrow button in the cell of the Type column (Figure 3) can be used to navigate to the properties of the type.
Figure 3. The Attributes property page
You can programmatically extend this hyperlink functionality by implementing the public
INavigationProvider interfaces in
Diagramming features are now easier to use, and many enhancements make the diagrams more aesthetically pleasing and clearer.
It is frequently desirable to apply a certain formatting style to shapes and connectors on diagrams. To support this, the UML Modeler feature now uses the concept of themes: reusable styles that can be automatically applied onto shapes and connectors. Existing shapes and connectors can have styles individually applied onto them. Thus, it is possible to apply different themes to different elements in the diagram.
The UML Modeler includes 10 predefined themes, and you can customize them to create your own version. To create your own themes, or to select the default theme:
- From the Preferences view (from the Window menu, click Preferences), select Modeling and then Appearance.
- In the Appearance pane, you will find a list of all the default themes, along with any themes that you added. At the end of that list of themes, you can select the New option to create a new theme (see Figure 4).
Figure 4. The Appearance pane in the Preferences view
To add a new theme, select the Add item or the Details button. New themes are created by customizing an existing theme. Therefore, when the Theme Details window appears, it displays the details of an existing theme.
Figure 5. The Theme Details view displays the details of an existing theme
The element types listed in each row of the Theme Details view are the types for which a specific style has been applied. The buttons at the bottom pertain to the overall theme, while the buttons on the right pertain to adding and deleting styles for a particular theme. Thus, for example, the Delete button on the right pertains to deleting the appearance associated with an element type, while the Delete button at the bottom is used to delete the entire theme currently displayed.
- To customize the styles for additional element types not yet defined by the current theme, follow these steps:
- Click the Add button on the right. This brings up the Element Types wizard.
- Select the element types that should be given a particular appearance. It's a good idea to select only shapes and connectors that should be given the same appearance, or style.
After selecting the element types and clicking the Next button, you are prompted to select an existing appearance to apply to the element types that you checked. There are 48 default shapes and 12 default connectors to choose from, and you can add your own.
- To customize the appearance, choose the last item in the list: New.
- When either the Shape Appearance Details or Connector Appearance Details window appears, you can choose the details for your shape or connector.
- Be sure to click the Save As button at the bottom of the screen to save your customized appearance.
Figure 6. Use the Element Types wizard to choose the appearance for shapes and connectors
You can repeat the process for additional element types and choose different appearances for them. (Again, it is a good idea to select only shapes and connectors that should be given the same appearance style, and then continue repeating the process.)
To adjust the appearances for individual element types after they have been added, you have two options.
- The first is to select the element type from the Theme Details options, and then click Delete and re-add it using the Add button.
- The other is to select the element type and click the ellipses (…) button that appears. This will show a drop-down menu with all of the default appearances, as well as any that you defined.
Applying themes to diagram elements
If you want to apply a specific appearance to a diagram element, you can do so in one of two ways.
- Select the element and show its properties, either by choosing Properties from the element's context menu (by right-clicking the element) or by showing the classic Properties view. Next, choose the Appearance page from the properties and, in the Select an existing appearance drop-down menu, choose the theme that you want to apply to the shape or connector.
- Show the shape's context menu and choose the Appearance menu item. The Shape Appearance Details dialog window will appear. From there, you can make customizations before applying the appearance.
Figure 7. Choose the gradient from the Shape Appearance Details window
Customizing shapes further
While working with themes, you probably will have noticed many more appearance options to choose from. For shapes, these include transparency, improved gradients, and more control over line widths. Also, the individual compartments in a shape now support the shape's border style. For connectors, these include rounded corners and line attributes, including a choice of line widths, line types, and arrow types.
Further customization of the shapes is available from within the Appearance property tab. Setting the line thickness is done from Use the Line width drop-down menu in the Border group to set the line thickness, and choose a gradient fill by using the Fill color drop-down menu in the Fill group.
Figure 8 shows a class overlapping an actor. Being able to set the transparency is particularly useful when you have shapes overlapping other shapes.
Figure 8. A class overlapping an actor
To follow the UML specification, not all line parameters are configurable for UML connectors. For example, it would not make sense to be able to represent an association by using a dashed line. To take advantage of the line enhancements on your diagram, use the Line palette item in the Geometric Shapes palette drawer. This way, you can draw freeform lines not bound by UML constraints.
Saving a diagram element's appearance
After you are satisfied with the ways that you have customized your shape or connector, you might wish to preserve the appearance so that it can easily be applied to other shapes or connectors.
- To capture a shape or connector's appearance, select the shape or connector and right-click to show the context menu of the shape and choose Add to Appearances.
- Next, type in the name of the appearance.
The appearance is saved and can now be reused.
Figure 9. Use Add to Appearances to save a diagram element's appearance
When drawing connectors from one shape to another, it might not be obvious which shape was the source or the target. This is particularly true on a crowded diagram with many shapes. Now, however, the target shape is highlighted, making it absolutely clear where the connector target is.
Similarly, when clicking the connector, the label is highlighted. This makes it obvious which label belongs to which connector. This is particularly helpful when many connectors are close together.
In addition, it could be unclear why the connector might not have been created as you expected it to be. An explanation box appears to describe why it's not possible to create the connector. The example in Figure 10 shows an attempt to create a package import from one class to another class. Of course, this is not possible, because the target end of the import must be a package.
Figure 10. A message explains why a package import cannot be created
It is possible to adjust the settings, including what type of messages should be displayed, and the delay before the message should be displayed. To do so, show the Preferences dialog and choose Modeling > Appearance >Feedback.
Documentation tool tip
If you hover your mouse cursor over a diagram element, a tool tip from the documentation for that element will pop up. (This is similar to how Javadoc shows up when you hover over a method in a Java™ file in Eclipse.) In addition, it offers hyperlinks to the relevant element and its parents, if any.
Figure 11. A tool tip about a diagram element
To control the tool tip settings, such as transparency and delay, use the Modeling > General preference page.
Figure 12. General Preferences page settings to control the appearance of tool tips
Rich text support
Rich text support has been improved again to make it more stable. Also, rich text is now fully supported on notes and comments. In addition to being able to edit the documentation of an element by using rich text, you can now edit the actual content of the note or the comment using rich text.
Figure 13. Editing a comment in rich text
Preferences have been added to control the rich text, too. The most significant is the ability to alter the default font settings. This enables you to make the text in your diagrams consistent, for a better appearance, without having to change the settings every time that you create rich text. To see other text-related settings, show the Preferences dialog and select Modeling > Text.
Figure 14. Rich text preferences
A diagram can be simplified if only the elements that you're interested in are shown and the rest of the diagram is hidden. For example, you might want to show only the external parts of a system for an application. To do this, separate the shapes that represent the internal classes onto a separate layer, and then hide the layer to instantly simplify your diagram.
If you had existing diagrams, or if you do not explicitly work with layers, all of the shapes on the diagram are placed on the default layer. This layer cannot be deleted or hidden, and it is not shown in the Layers view.
Figure 15. The Layers view appears in the bottom-left corner by default
As mentioned previously, the Layers view is shown by default in the Modeling perspective. All of the layers (except the default layer) are controlled through that view. To add a layer, click the green plus button in the view. (If you have not already added any layers to the diagram, you can also use the Click here to add a new layer to the diagram hyperlink.)
You can activate a layer by selecting it in the Layers view. An active layer is highlighted in the view. When a layer is active, new shapes and connectors that you create on the diagram are automatically added to the layer. To add existing shapes and connectors to the layer, select the diagram elements and click the Add diagram elements to layer button in the Layers view.
The three boxes located on the left of each layer in the Layers view are used to control (from left to right) visibility of the layer, locking the layer, and selection. If the layer is visible, an eye appears in the left-most box. Clicking the box hides the layer.
When a layer is hidden, the connectors that connect shapes inside the layer to shapes outside the layer are also hidden. This prevents connecting a shape to nothing.
The middle box toggles between locking and unlocking a layer. If a layer is locked, it cannot be edited on the diagram, although shapes on locked layers will be updated when there are changes in the model. For example, if the shape's underlying element is a class and the class is renamed, the name in the diagram element will update automatically. Similarly, if the class is deleted, the diagram element will also be deleted.
Lastly, the box on the right is used both to select elements and to indicate whether elements on the diagram have been selected. Clicking the selection box will select all of the elements in the layer on the diagram. Likewise, if an element belonging to a layer is selected on the diagram, the selection box will show a cursor with a circle. You can also double-click on a layer to select all of the elements in the layer.
On crowded diagrams where shapes overlap, it is also useful to be able to quickly rearrange the order of which shapes appear in front of other shapes. When shapes are placed into layers, the top-most layers appear at the front of the diagram, while the bottom-most layers appear at the bottom of the diagram. If you subsequently specify ordering using Format > Order from the context menu, that will be respected unless you perform an operation that requires recalculating the order of the layers (such as using the Up or Down buttons to reorder the layers).
The way that shapes are arranged on the diagram has been improved significantly. Rational Software Architect now uses the well-respected layout algorithms provided through ILOG integration. In addition to the improved layout, there are also many more layout options. You can automatically lay out all of the elements on a diagram in many predefined layout configurations with only a few clicks of your mouse.
Consider the diagram shown in Figure 16. It has only five shapes, yet I've still managed to make the connectors into an absolute mess.
Figure 16. Connectors overlap shapes in this poorly laid out diagram
The layout could be improved. To do this automatically, select the diagram surface and show the Properties pop-up window. Next, select the Graph Layout property page. Choose from any one of the predefined layouts, and click Apply the selected graph layout configuration. You have made the diagram far clearer without much effort!
Figure 17. Use the Graph Layout properties page to control the layout of a diagram
To turn off the animation while the diagram is being laid out, show the Preferences dialog and choose Modeling > Appearance. Then, check the Optimize layouts for performance check box.
This article provided an overview of the new functionality in the UML Modeler component of Rational Software Architect Version 8.0. By taking advantage of these enhancements, you will be able to model more effectively and efficiently, with an emphasis on clearer diagrams, problem prevention and resolution, and workflows that support collaboration.
The next article in this three-part series describes other enhancements specific to UML modeling, involving these areas:
- The Project Explorer view
- Model validation
- Model fragments
- UML compliance
- Viewpoints and active language
The author expresses his gratitude to Dusko Misic and Michael Hanner for reviewing this article and to Judith Broadhurst for editing.
- Read this author's related articles to learn more about modeling with Rational Software Architect:
- Migrating models to the IBM Rational Software Architect 8.0 format, a developerWorks article by the author of this article. Follow the "More content in this series" link in this article to Parts 2 and 3.
- Using the new features of the UML Modeler in Rational Software Architect Version 7.5, an IBM developerWorks article by Wayne Diu (September 2008)
- Learn more about Rational Software Architect versions available.
- Visit the Rational software area on developerWorks for technical resources and best practices for Rational Software Delivery Platform products.
- Stay current with developerWorks technical events and webcasts focused on a variety of IBM products and IT industry topics.
- Attend a free developerWorks Live! briefing to get up to speed quickly on IBM products and tools, as well as IT industry trends.
- Follow developerWorks on Twitter.
- Watch developerWorks on-demand demos, ranging from product installation and setup demos for beginners to advanced functionality for experienced developers.
- Explore Rational computer-based, Web-based, and instructor-led online courses. Hone your skills and learn more about Rational tools with these courses, which range from introductory to advanced. The courses on this catalog are available for purchase through computer-based training or Web-based training. Additionally, some "Getting Started" courses are available free of charge.
Get products and technologies
- Download either or both versions for a trial:
- Evaluate IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.
- Join the discussion in the Rational Development Tools forum.
- Get involved in the My developerWorks community. Connect with other developerWorks users while exploring the developer-driven blogs, forums, groups such as the Rational Café, and wikis.