Poseidon for UML: User Guide
Prev | Chapter 4. A Short Tour of Poseidon for UML | Next

# Modify Elements

Once we have arrived at a desired element, we may need to make some modifications. Poseidon provides several ways of changing information relating to an element.

## Change Elements

The quickest and easiest way to change information relevant to an element is to change it directly in the diagram. Be aware, however, that not all information can be changed in this way.

At this point in the tour, the Diagram pane should be displaying the class diagram titled, 'Entity Class Model Overview' and the Details pane should be displaying information about the attribute 'number'. This diagram has been set to hide attributes and operations, so we will change to a new diagram that displays this information. Select the diagram titled, 'Member Identification: Design-Class Model' from the Navigation pane. We will now change the name of an operation from the class 'MemberIdentificationController'.

In the Diagram pane, double-click on the operation 'findMember()' in the class 'MemberIdentificationController'. The Details pane displays the information about this operation, and the text in the Diagram pane itself is now editable from a text box. Change the name of the operation to 'searchMember()' and then press Ctrl-Return or click elsewhere in the diagram.

Figure 4-14. Change an operation name in a diagram

The name change will be propagated throughout the model, with 'MemberIdentificationController.findMember()' replaced by 'MemberIdentificationController.searchMember()' in every instance.

Another method of changing information is via the Details pane. Select the operation 'searchMember()' again. Notice that the Details pane provides lots of information about this operation. In the 'name' field, change the name from 'searchMember()' back to 'findMember()' and press return or change the focus of the window by moving the mouse out of the Details pane. The change will now be reflected back in the diagram.

Figure 4-15. Change operation name from the Details pane

## Create Elements

Creating new elements is just as simple as modifying existing ones. And just like changing elements, there are several ways to create new ones.

Perhaps we would like to associate a discount program with members. Let's create a new package, Discount. In the 'Package Dependencies Overview' class diagram, click on the 'Package' button from the Diagram pane toolbar. A cross-hair appears. Click in the Diagram pane to place the new package into the diagram. Rename this class 'discount' using one of the methods outlined in the previous section.

Now that we have the package, we need to associate it with the package 'member'. We could do this by creating a new association through the toolbar and connecting the association ends to the classes, or we could speed things up and use the aptly-named 'Rapid Buttons'. Click on the new package 'discount'. Several buttons appear around the edges of the package. Click and hold the mouse button down on the left rapid button. Drag the crosshair that appears onto the package 'member' and release the mouse button. An association has now been created.

Now perhaps we need to make a connection between 'discount' and a region because different discount schemes are offered in different regions. This will require the addition of another package and another association. One rapid button can take care of everything. Select 'discount' in the diagram. Click (and this time do not hold) the mouse button on the right rapid button for the package 'discount'. An new package and an association have been added to the diagram. Rename the new package 'region'.

Figure 4-16. Add a package to a diagram with the rapid buttons

## Delete Elements

So after further review, we have decided that the package 'discount' is a good idea, but not for this diagram. We have further decided that the 'region' package is unnecessary and will not be used elsewhere in the model. Let's first delete 'region' completely.

Select the package 'region' in the Diagram pane. Now press the 'Del' key. A dialog box will prompt you before removing the class. Notice that the association has been deleted as well, as there is no point to an association with only one end.

Figure 4-17. Delete an element from a model

To delete an element without encountering the dialog box, you can press Ctrl and mouseover the element. A delete rapid button will appear in the upper right corner.

The package 'discount' is a different story. We may need to use this again elsewhere, so we just want to remove it from this one diagram, not from the entire model. To remove it from this diagram, select the class in the Diagram pane and press the 'Remove from Diagram' button. A rapid button exists to do this as well; hold Ctrl and mouseover the element. Then use the 'Remove from Diagram' button.

The previous method of removing an element from a diagram is still available also; cut it from the diagram using either the Cut option from the main toolbar, Cut from the Edit menu, or the shortcut Ctrl-Shift-X. You will not encounter a warning here, but the package still exists within the model and can be viewed from the Navigation pane.

Notice that the element no longer appears in the Navigation pane under the class diagram. Change the Navigation pane to display the Model Index view and take a look at the packages listed there. You will see that, although it is not included in any current diagrams, the package 'discount' still exists and is ready to be used in another diagram.

Figure 4-18. Remove an element from a diagram

Now that you have seen some of the basic ways of working with models in Poseidon, you should be ready to strike out on your own and see all that Poseidon has to offer.

Prev | Home | Next
Navigation | Up | Interface