1. 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.

1.1. 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
  1. Open the class diagram User Registration: Design-Class Model .

  2. Select the 'create class' button from the toolbar. The mouse should now appear as a crosshair.

  3. Place the crosshair to the right of the class 'User' and click the mouse button to create the new class.

  4. Select the 'generalization' button from the toolbar. The mouse will again appear as a crosshair.

  5. 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.

  6. 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.

1.2. 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.

Rapid buttons for a class element.

New in Poseidon 5.x, the rapid buttons have been cleaned up and organized. Right-click on a rapid button to see all available related rapid buttons. Once a command has been selected from the expanded selection, this command 'sticks' as the default for that rapid button location.

Figure 13.2. Expanded rapid buttons for a class element.

Expanded rapid buttons for a class element.

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.3. Toggled representations of actors and interfaces

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.4. Additional rapid buttons for a class element.

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.

Documentation Rapid Button

Poseidon 5.x also introduces a documentation rapid button. An element with documentation entered in the documentation properties tab will have a small, faint icon in the lower-left corner.

When the element is moused-over, the icon will change into a comment rapid button.

Clicking this rapid button will attach a comment to the element, and the documentation text from the documentation tab will be entered into the comment.