Open tpotter7 opened 5 years ago
Is this what you are looking for ?
Not really. Let's say that the conditional question is "Color?" and you want the possible paths to be "Red", "Blue", "Green". When I create a sequence digram in Visio, I just create a conditional with "Color?" in the shape and then have 3 lines coming out of it, one for each color. In the legacy puml syntax, I was able to do something similar. In the new method, it appears that all conditionals are necessarily binary so I have to make it harder to read by having a "Red?" conditional, where no leads to a "Blue?" conditional, where no leads to a "Green?" conditional. It just makes for more conditionals when what I am really asking is "what color is it?". So, that will work, but it is not what I was looking for.
I think I've got the point. This is not implemented yet, but we will propose something like:
@startuml
start
switch (color)
case (red)
:Text 1;
case (blue)
:Text 2;
case (green)
:Text 3;
endswitch
stop
@enduml
Please be patient : we'll post a message here when this will be working. Thanks!
That would be awesome. Thanks lots for looking into this and helping to get the issue clear.
On Mar 30, 2019, at 8:02 AM, arnaudroques notifications@github.com wrote:
I think I've got the point. This is not implemented yet, but we will propose something like:
@startuml start switch (color) case (red) :Text 1; case (blue) :Text 2; case (green) :Text 3; endswitch stop @enduml Please be patient : we'll post a message here when this will be working. Thanks!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/plantuml/backlog/issues/37, or mute the thread https://github.com/notifications/unsubscribe-auth/AsRcrK9NagblPSpkuj-nUNvfUacNYGpaks5vb3x4gaJpZM4cCATF.
This is really an early version, but with last beta http://beta.plantuml.net/plantuml.jar you can have
@startuml
start
switch (color)
case (red)
:Text 1;
case (blue)
:Text 2;
case (green)
:Text 3;
endswitch
stop
@enduml
But at least it gives you an idea of what we'll get at the end.
Last beta http://beta.plantuml.net/plantuml.jar now prints links
Wow. This needs to be mentioned in the docs... Mark it as beta in red with flashing, but it is worth mentioning anyway... :-)
Hi! Got a bug here... See:
@startuml
title Payment Router Flow
skinparam DefaultTextAlignment center
skinparam DefaultMonospacedFontName Lucida Sans Typewriter
start
:Load settings;
partition Alternative {
switch (Alternative ""GatewayID"" defined for...)
case (**SomeOne**'s Country Code nd **Selected** Payment Method?)
case (**ANY** Country Code and **Selected** Payment Method?)
case (else)
:Get Main ""GatewayID""/
endswitch
:Get **Alternative**\n""GatewayID""/
}
stop
@enduml
...and got this:
You may think it is because it got somehow constrained by the partition
box... Nope:
@mlopezgva Thanks for the feedback. This should be better in last beta http://beta.plantuml.net/plantuml.jar
Yes. Better, but not quite. :-)
Odd line paths are now OK, but there are no arrow notes (and they're quite large). If I force them to appear (adding block elements, of course), tey will appear, but their space does not grow with them.
@startuml
title Switch Test
start
legend top
Using:
PlantUML version 1.2019.07beta12
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 1.8.0_181-8u181-b13-2~deb9u1-b13
Operating System: Linux OS Version: 4.9.0-8-amd64
Default Encoding: UTF-8
PLANTUML_LIMIT_SIZE: 4096
Dot executable is /usr/bin/dot
Dot version: dot - graphviz version 2.38.0 (20140413.2041)
end legend
:Step One;
partition "Paths OK?" {
note
Arrow comments
are quite tight.
end note
switch (Test a variable)
case (case 1)
:Select One;
case (case 2)
:Select Two;
case (case 3)
:Select Three;
case (case 4)
:Select Four;
endswitch
}
partition "Not always" {
note
But it still breaks
under some conditions:
(Also, I don't get why
is there so much space
because of this note...)
end note
switch (Test a variable)
case (case 1)
:What if this is wider than expected?;
case (case 2)
case (case 3)
endswitch
:It's //a bit// broken on the left;
switch (Test a variable)
case (case 1)
case (case 2)
case (case\n it \nbreaks)
:What if this is wider?/
endswitch
:Also on the right!;
note
If you use "What if this is a bit wider?"
string above, it works better, although
it still breaks in the beginning of
the arrow.
end note
}
partition "Comments\nhidden" {
note
I suppose this is something
that happen by design, but
it could at least throw an
error... This is in fact a
simple ""if"" sentence.
end note
switch (Test a variable)
case (case 1)
case (case 2)
case (case 3)
:Select 3/
endswitch
}
partition "Miscalculated upper\nmargin or padding" {
switch (Test a variable)
case (This is a multiple\nline and long text\narrow comment)
:Option One/
case (This is another multiple\nline and long text\narrow comment)
:Multiple\nline option Two/
case (else\nwith \three \nlines)
:In else case.../
endswitch
}
:Let's go}
stop
@enduml
In the legacy syntax, you could have more than 2 paths out of a conditional. For example: () --> Activity if (color?) then () --> [red] "Activity 1" else () --> [blue] "Activity 2" else () --> [green] "Activity 3" endif
In the new syntax, I cannot find a way to do this. It appears that every conditional is assumed to be a binary question. Would it be possible to support trinary or quaternary conditionals in the new syntax?