Question

I just started using Dia. I'm trying to build a sequence diagram. I would like to represent self-calls. How does one do that in Dia? I can't figure it out.

Thanks.

Was it helpful?

Solution

First place a UML Message object with it's base attached to your lifeline.

Then, double-click the arrow (or right-click, Properties), and change the Message Type drop-down field to Recursive, and you'll get something like this:

enter image description here

Now you can drag the green anchor point around to make the Message arrow look as you'd like. (A note of caution: it seems that with a Recursive Message object, you can ONLY select the object by clicking on it exactly where the green anchor point WOULD BE. I say "would be" because of course you can't actually see that green anchor point when the object isn't selected.)

If you like, you can create another UML Lifeline object, and place it overlapping the existing lifeline, like this:

extra lifeline example

This isn't ideal, though, because there isn't actually anything attached to this second lifeline. The Recursive Message object doesn't let you choose where to attach it's arrowhead, because it's automatically attached to the lifeline from which it originated. And because the second lifeline isn't attached to anything, if you go moving objects around it will get left behind. But, it does look pretty, if that's what you're after. :)

OTHER TIPS

A self call(or any other association) in UML is better expressed using the standard association notation instead of the message one. In DIA, insert an association notation from the toolbox on the left and add it to your canvas. Then in order to have it connect a class recursively(to itself) double click it and click select "Autoroute" as no. This will enable you to shape the route yourself and wont constrain you to the automatic straight line that gets drawn when linking a class to itself.

You would end up with something like this(in this example its a representation of a Node in a linked list): enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top