Formatting of repeat loops spread trough several swimlanes

0 votes
asked Apr 30, 2016 by marcobaldo (160 points)

Is there any way of having the if condition of a repeat loop in the same swimlane as the preceding node, and not in the swimline where the loop was defined? This is my activity diagram, it looks a little bit strange:

 

@startuml
 
|Author|
Start
repeat
repeat
if (New document?) then (yes)
:Create;
else (no)
:Update;
endif
->Document Draft;
 
|Reviewer|
:Review Document;
repeat while (Document agreed?)
->Document Reviewed;
 
|Approver|
:Approve Document --> Update;
repeat while (Document approved?)
->Document Verified;
 
|Owner|
:Archive;
->Document Archived;
 
stop
 
@enduml
 
Tnx
 
Marco

1 Answer

+1 vote
answered May 4, 2016 by plantuml (134,510 points)
selected May 6, 2016 by marcobaldo
 
Best answer
Thanks for the report.

This was more difficult to implement that we have initially though, but here is a beta version that should work with your example:

https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

Tell us what if it's ok for you !
commented May 6, 2016 by marcobaldo (160 points)
It works, thank you!

If I can have now an additional question, as for the sake of clarity it would be really nice I could  have a yes/no indication near the if box of the if statement, i.e. (repeat loop taken for the on-line documentation)

repeat while (more data?) (yes, no)

Where yes and no are the optional text to be put near the if condition for a true and a false result.

And tnx again for your nice work.
commented May 10, 2016 by plantuml (134,510 points)
This is not very documented (because we are not 100% satisfied by the syntax), but you can have:

start
repeat
  :read data;
  :generate diagrams;
repeat while (more data?) is (yes) not (no)
stop

http://plantuml.com/plantuml/uml/BSfB2e0m30N0VK_nbkqLxCAp1Fge1ViX2OYt5yNbm9YBUb0kYWTWKqf14PVygd9GnOdIfAfqot_5TRIJY7qglxudD4EyQGbZEkAOAPZFzG00

Is this what you are expecting ?
commented May 10, 2016 by anonymous
Yes, that's what I was looking for.

Maybe the syntax could be simply

repeat while (more data?, yes, no)

->

repeat while [([ifbox_text][,true_text][,false_text])]

And for the repeat statement i.e.

repeat (repeat loop starts here)

->

repeat [(repeat_initial_text)]

Repeat_initial_text is as on optional text be put inside the object at the beginning of the loop.

Tnx for your valuable work.
...