Salt with minimum flowchat capabilities

0 votes
asked Sep 10, 2014 in Wanted features by alexro (120 points)
edited Sep 16, 2014 by alexro

Currently, I can represent only one screen for each PlantUML file using Salt. It would be very nice if we could represent many screens and the transition between them.

Something like this:

@startuml
 
choose -right-> wait
 
wait -right-> success
wait -down-> error
 
choose:{+
<b>an example
choose one option
()one
()two
[ok]
}
 
wait:{+
<b>please wait
operation in progress
<&clock>
[cancel]
}
 
success:{+
<b>success
congratulations!
[ok]
}
 
error:{+
<b>error
failed, sorry
[ok]
}
 
@enduml
 

2 Answers

0 votes
answered Sep 11, 2014 by plantuml (295,800 points)
selected Sep 16, 2014 by alexro
 
Best answer

With the last beta:

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

There is a experimental feature that allows to include diagrams into notes & text.

You have to use {{ and }} as separator for this. And if you want to have salt diagram, you have to put "salt" on the first line.

Example:

 
@startuml
(*) --> "
{{
salt
{+
<b>an example
choose one option
()one
()two
[ok]
}
}}
" as choose
 
choose -right-> "
{{
salt
{+
<b>please wait
operation in progress
<&clock>
[cancel]
}
}}
" as wait
wait -right-> "
{{
salt
{+
<b>success
congratulations!
[ok]
}
}}
" as success
 
wait -down-> "
{{
salt
{+
<b>error
failed, sorry
[ok]
}
}}
"
@enduml
 
Note that this is not working with state diagram, because you cannot have long text in state diagram.
 
All these are really subject to change : we are not 100% satisfied by the syntax, so ideas & suggestions are welcome!
 

 

commented Sep 16, 2014 by alexro (120 points)
I tested it and found it's a good starting point. I agree the syntax is not the best, but it's something I can live with. For me, there are two fixes more important than the syntax:

1 - It's not possible to define the screen separated from the flow. It would be nice to have something like:

@startuml

alias choose = "{{
salt
{+
<b>an example
choose one option
()one
()two
[ok]
}
}}"

(*) --> choose

@enduml

2 - All the screens are inside an activity, which means they all have a red rectangle around them. I got a little better result playing with skinparam, but it's still far from ideal.

If just the fix (1) is made, we will adopt it here at work.

Thanks.
0 votes
answered Sep 17, 2014 by plantuml (295,800 points)

Using the last beta (8008beta3), you can have !define on severals lines (see http://plantuml.sourceforge.net/qa/?qa=1527/define-a-multi-line-macro )

So the following example is working with 8008beta3 :

@startuml
!definelong SALT(x)
"{{
salt
_##x
}}
" as x
!enddefinelong

!definelong _choose
{+
<b>an example
choose one option
()one
()two
[ok]
}
!enddefinelong

!definelong _wait
{+
<b>please wait
operation in progress
<&clock>
[cancel]
}
!enddefinelong

!definelong _success
{+
<b>success
congratulations!
[ok]
}
!enddefinelong
 
!definelong _error
{+
<b>error
failed, sorry
[ok]
}
!enddefinelong

(*) --> SALT(choose)
-right-> SALT(wait)
wait -right-> SALT(success)
wait -down-> SALT(error)

@enduml


Note that the SALT macro has to be defined before the others macros (and this is not working with the current official release).
You should probably use !include feature to define your screens in different files

Any thoughts ?
 

commented May 22, 2019 by Ye
Is there anyway to comment the arrows?
commented Sep 18, 2019 by valexiev (1,220 points)

You should be able to add Arrow labels in the normal way, eg

   wait -down-> SALT(error) : error

But this now gives IllegalArgumentException on PSystemSalt.createElement.

commented Sep 19, 2019 by plantuml (295,800 points)

There have been some changes in the preprocessor.

You should now use this syntax.

commented Jan 29, 2020 by Ilya-Z
I have few files with salt diagrams (or I can combine them in one)

I want to reuse them in activity diagram. how can I do it?
commented Oct 28, 2020 by rm

The last syntax doesn't work now, this one worked for me.

...