Poseidon for UML: User Guide
Prev |  | Next

# Chapter 13. Using Elements

# Creating New Elements

A new diagram, of course, requires elements in order for it to have significance. There are several ways to add elements to a diagram, as you will see in the next couple of sections.

## Diagram Pane Toolbar

The diagram pane toolbar contains buttons to create elements that are specific to that diagram. For example, the button to create an initial state will not appear in a class diagram toolbar. This reduces the amount of buttons that you must deal with at one time.

The create buttons for most elements act as stamps, so that the element is placed wherever you click within a diagram. The exceptions are associations and ports.

Ports are created by first selecting the component that will have a port, then selecting the port tool from the toolbar. At this point the port will be automatically added, you need not click on the component to add the port.

Any sort of relationship needs to exist between two model elements; therefore, both elements of the association must be included in the creation process instead of just stamping a line anywhere. To create a new association element with the toolbar, select the type of association and place the cursor over the first element in the relationship. Click and hold the mouse button, then drag it to the second element in the relationship. Note that for some of the association types, the order in which the elements are connected affects the definition of the association.

Try it Yourself - Create new elements with the toolbar
Open the class diagram `User Registration: Design-Class Model`. Select the 'create class' button from the toolbar. The mouse should now appear as a crosshair. Place the crosshair to the right of the class 'User' and click the mouse button to create the new class. Select the 'generalization' button from the toolbar. The mouse will again appear as a crosshair. Place the crosshair in the new class, press and hold the mouse button, then drag it to 'User'. * Note that the order in which they are connected determines the direction of the inheritance. You are now ready to incorporate the new class into the model. Look through the rest of this guide to learn how to change the name of the class, color-code it, add elements and operations, and more.

## The Rapid Buttons

The toolbar is not the only way to create new diagram elements or associations. Poseidon for UML provides an intelligent shortcut that can speed up the development of a diagram. Select a class and wiggle your mouse near the edge of the class and several additional buttons will appear. They are called Rapid Buttons and are only available if an element is selected.

These rapid buttons can be used in several ways. You can either click on it to create and associate a new corresponding model element with appropriate connection in one step, or keep the mouse button pressed and drag it to an existing model element to create a new association without creating a new class.

Rapid buttons are available for many diagram elements in each of the editors. Here is a class example:

Figure 13-1. Rapid buttons for a class element.

For a class element, the rapid buttons to the left and right represent directed associations, the button on top represents specialization of superclasses, below is the generalization of subclasses, and self-associations are in the bottom right corner.

Try to click on the rapid button underneath your new class and you will see that a new subclass appears close to it. If you click and hold the button, you can move the mouse and place the new element where you want it to be. Or if you click, hold, and move the cursor over an existing element, only a connection between these elements is created.

Rapid buttons for some elements change the way the element is presented. For interface elements, you can toggle between lollipop (or ball) representation and box representation. Similarly, for actor elements you can toggle between stickman and box representation.

Figure 13-2. Toggled representations of actors and interfaces

The rapid buttons displayed are some of the more commonly used buttons. To display additional buttons as rapid buttons, hold down the 'shift' button while rolling over the element with the mouse.

Figure 13-3. Additional rapid buttons for a class element.

- Attributes and Operations - You can create new attributes and operations by clicking the rapid button that appears when you hover over the attribute or operation compartment of a class.

- Delete - Press Ctrl while hovering over an element to display a rapid button that will not open a confirmation dialog.

- Go to Sub-Diagrams - If an element contains diagrams, an additional rapid button will appear in the top right-hand corner that will take you to the sub-diagram.

Prev | Home | Next
States |  | Editing Elements