How to draw a self-call in Dia?
Asked Answered
H

2

12

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.

Huneycutt answered 2/8, 2012 at 22:7 Comment(0)
S
18

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. :)

Stringer answered 8/8, 2012 at 14:58 Comment(2)
Great thanks. It's interesting that the non-recursive self-call seem to be missing.Huneycutt
I think you've got the wrong idea of "recursive" here. Typically when we think of recursion we think of a "recursive function," but here instead of a "function calling itself," we have an "object calling itself." In this sense, any self-call is by definition recursive.Stringer
S
-1

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

Sackey answered 10/1, 2013 at 11:29 Comment(1)
The question was about self-call in a Sequence Diagram, not in a Class Diagram.Alunite

© 2022 - 2024 — McMap. All rights reserved.