Activity beta: text of condition optionally outside the symbol?

+1 vote
asked Jul 29, 2016 in Wanted features by ivokrab (160 points)
Currently, for 'if', 'while' and 'repeat while' the condition text is put inside the diamond symbol entirely, which then expands to become a hexagon. For a complex condition, this can look rather ugly, so it would be nicer to have the text outside of the symbol, to the right (or optionally left) and above the diamond, with a suitably lengthened incoming arrow to prevent overlap with higher-up stuff. Could this become an option, either general for the diagram, or per-case with a marker on the text?

1 Answer

+1 vote
answered Jul 29, 2016 by plantuml (295,000 points)

There is an option with skinparam :

@startuml
skinparam conditionStyle diamond
start
if (test)
  :foo;
else (bar);
  :foo2;
endif
@enduml

This is not widely tested, so tell us if it's not working in some case.

Regards,

commented Jul 29, 2016 by ivokrab (160 points)
edited Jul 29, 2016 by ivokrab
Indeed this does what I propose, but the lay-outing does not handle it well. See example at: http://plantuml.com/plantuml/uml/hLNRRjiu47tNLyoRRQnHfm4MsoPf5egZj0PIsRKLB88e26Y9jhYXIPMaxQf5_ts7ekIBxAHzMBxO8i-SENCZzJCJEL5a0IGnRCLC0J-yNkkA9Czp9PSYxKik5TnJpkMwrVEkf4gfSfjJZYZFLqgkTpT-Udf3caYHCiEac9Y2KqWPMU3E3a1d99Lh9kOm8rnJTBqzcpP4h3DcQ6z4EFseA1M0SWmpI4lIVvVQX58j21_JELlGI4voch3wqzE6AEETQQcCrQGbPoanDBsdH6dm9_rp3zcHgZs8Wh4V1OUe3Z0DxLWy2FhDmCNqiecuw4ql7piUm8nBOcn8GXeAYiqpSmOeNH6R2P0hgi0geMaiTacWi7wGWCsWhUYAQGjFP4g1YVBmxmwO32DlFmXPkW8uIoaoBvYWqChG5TNcov9mB6GBv2mMX7F8gM8orPQbAJeMRSox1ACmsT2QKu4oEQWoRIrOI_Li8qb9eJldpc4YEQU9UOcr50ePMLcxhqvAB0OXj8FFezlXVH1quTQ_6jwDWt4NO1I4ay4mV1g4axkn7_Q33chMK0bnvHivJvN_ieZ7pc5QLA8cjjokhDR4vlFYxe-JazDtb_ivAiKlbQB2EDrOieCinC8Fh_7azVGqgPp3zvUni1A6urYyB257qUh_4B0bgjtN7LDGxHgcqUV74ddGwXN87M_wtAxVwFLO7FDHsVzYwkecEr2K7qhvJJ5D5njhsoMEjhSNBoo8IJAGegnaNSITHkjMAWEHTi4KESL0bvmefak_sqQmLNJGDzLWzErmV_W0-otXaE4mgj4BXjj45HEgLYoX1pLr2oSpBpO21JL6-bepDBQnNcEBTCiGRBECRNBqI56DbANCK5vXr3DcNaNzmqnsYBkHoXU69InlH3nJSW7xsJIoYYeMPHJVgPAOt7tKuqvOjYwDaS7Rf0uJRuqRlnyyVHw4zZwv3eAH-xyLCHp32wEtmpCQt0wZBjpS3Zv-YfxyA0h2Qp-CzgSObwrCRPCGV8UKRQ8tvUnUmEd9szCDj5xeVygKoUuTvktxF_-gQUjVs5pivJFuk5jMBEpvpYV5SyGPjTo7KNnfPzwnB_nVZTd3TXXIARRsDiMkosVskRKt2PSoF_BSxCcff60RRawtVd_bjJBUCDUM3LAt_HePdlq7

* The texts overlap with other elements
* For a 'while' the condition is displayed on the outgoing arrow, like the 'is'-clause text. This is not really logical, the test occurs _before_ entering the 'down path'. Moreover, both now are centered on the arrow instead of to the right of it (without this option the 'is'-clause text is correctly displayed to the right)

I found out in the mean time that I can kind of simulate this style by putting text explicitly on the incoming arrows (as in http://plantuml.com/plantuml/uml/hLLTSzeu57tdLzmtO9QMD3Cxkmqf6OSuNMPImu8pEvcuan6smDe8oIi9AEtql_VAiWqOalPX_GIwvvvxxfUadvd8Y29B8B5XQsQsyAtHRLwJ-7cXv4ea0ycbWWVAkTmqkurhgHAgtE6C8whXAIKt-mVV6xeYrIb9v8Q91Sm9rnIPTxPPBSOcPOPsnuJJZufI0HZDCCCfaEJVbJQ1L4l29tJ1bZIKqup6hFpRq8OeqxZGKXc8fT2IiuGOcZnGeZHuqq6lWUn8rHg6_iGB_MDK6vY6LYGU1VrYu7BMhoCkkxF-vtO3OCubCJOb8Gq5nHQfkG2Khl1K2f1hgi0geKaazabWQ-CWmOMYQwOjDfO91IPoorKFJMmEhJQO5DDlFGgPnqE7X2BzaWaApHJZKMt-NX6EpMg2d4U2S0uPLKmcshBLbKUYXSMNO1HM79eBAb0h1vNNhWaRgPvjEWdPwdRF1OmbvpGsBx7cWY4bQ-ltdvCIYM40BV_J-6xquFiTkFEkH_SJVz816Fl1T3WAdeR1z7xY1GE_ZPer549S3ySkKX4_x-GfEyosXQYfxRdhhNLvquVB-z_Epix_x1-MADU-KeeAusHZsuwA40alk47BwzMfKxc0x_kHi0f6aqYyB253pUh_4B0ZAiF3rPMhmVxqRAbsmrCR_5D5FPhz0kJCrU3RxnU6FnAdOXJ-Frd3Sk2E56N7KdvHJ3r4vNqHfnJt0OlcoBi7MSEIc3W5AVBcbdtT6xrEuUQBf0Dccr5CTyM9OZgFlfiDsrW7VLkioi2k_OSFS3Wb3XcCmXAzP7XCr7PArPh5j5SfFzddCYcPRIkvWXeZFQqPKjdyRt26Edb2Tfecjc1whAZ60BdeG5vZ3URCl8hwXvdq67ShbISCYrbMot-kv18EQsjaaMCayYo-KYMnr8UetbvQkDsrbSBBfimIBvLRR-0_VHe6zhgvyVsn-xtJC9gyT3liyOo7TwEm0xTtmuz_XKzU6Fh1ZHU4XrkEdsrJwHCJVAkKdQkt-MvVmldPk_CAMduOVyQKIHySvjtxt_yeQO-s-BZ7Z_dZ-Nc_pzZfVJH5E-ACMXt2g4ZOl553LUzA7O6_Y_ryt6rH8iME4_lWzc9ktsrx7N4fiqhuwUVhG6sX0SUsikua_4n0FO7IiqRgZbyZGziF  ).

However, then for the 'if' following the 'while' the 'is'-clause text on the arrow is _replaced by_ the explicit arrow text (not displayed separately and below it), see http://plantuml.com/plantuml/uml/hLLTSzeu57tdLzmtO9QMD3Cxkmqf6OSuNMPImu8pEvcuan6smDe8oIi9AEtql_VAiWqOalPXzMJh7frxxfUadvd8Y29B8B5XQsQsyAtHRLwJ-7cXv4ea0ycbWWVAkTmqkurhgHAgtEQC8whXAIKt-nlV6xeYrIb9v8Q91Sm9rnIPTxPPpSScPOPsnuJJZufI0UZDCCCfaEJVbJQ1L4l29tJ1bZIKqup6hFnjQ4EKQLnegGp4KcZ9MK8CJHueKHgywQ3NG7QaQWr3V-A5_Z6g3Kn3AnAFWdunS3dhrn6NtLd_Sxi1CEUI61kIa8Q2OelKN01ALxWh1SWrLM2Lq2GI-oImjNwGu4qV55qpRT6nJ2WmaTkkUcXaSsYrmQIOWDQZaBb7W8k4eeCb4nIQANgasloz8XpBrGGvZmJX73Agc4oqPQjhZqGBqo_1ACmvD1TKe5gEAcpsch2Hwja6b92jRlUSmrXoJcFp4cik65AojkV-Sr8YCGoWvNyQtuqUVBy3Tzxrw7xYJpe0Op-O3aV1qp2Ota-yOE2tKRE6GeYhujXvAlpdjJnbXzcs43MrLNVLjKSmhPVtlvsTdV_PFqnHhdsb51N6oSR27IKX4bvmWvRNirEdSWxVzoDX5OmcaNXPGeQQrVyXO4TKkeUhAvU3_UxPKksQfzRwfv9wrFq5o9chrhVh5ze_4gTy5ET_CeXbmnqfoewb_AAOkelgD7PCd5AS24oRe-yUn0rBOk8KfCZBMrPsh_awnJ5V91qmsunYm2jE5DEv_rrtsD8wwDjYM0Psy3zyWCC-SSXW59Re9SDjehPJgjOifhrA-ybAkuMpcsqhkO8Q8psj6LBP3DnW5tNoW6m_JMpAz5XHZGvoqO6ynXpCcNaLzGypwJ7kLYfF61Qph1R_NCab7ERMo2B6IEHHVALAOgeFKRsziB1QjQ72wwQC4g-LMs_WFtqQ1lR2kV7ziVlUQHXDNheVzdZ6mxjHs87Rk-77ly8dBmpzuCOBmiCvnsNBL9w92RvNodRMstowB-7yxDrv1IqN-fynPT87Xtdt_lS_IjgZEJwkyMF-W7xUhpDMUXzDqOuuerQ7C2eIDc_KKDNBKaVWTp6XZxivIgJOSM8Tt5pCxTjjBoGkPLO9F_s07QWjD63RLjQTX9y9g0TGdgoHkktNoD3s0m00
This can probably be considered a bug. It forces me to define the text as an activity---unless I put it as part of the 'is'-clause text with separating newlines, which is also kind of ugly.

BTW, I'm still learning how to express activity flow, so the style I came up with to express a 'FOR EACH' as a 'while' with 'ITERATE xxx' as condition may be a bit odd.

BTW. I used 'skinparam shadowing false' because I found out that the texts on outgoing down arrows are placed on top of the shadow of the preceding box. The spacing is more correct if I start the next with '\n' to have an explicit newline, but for me it is another layouting bug that this should be necessary
commented Jul 29, 2016 by plantuml (295,000 points)
Thanks for your examples.
It really helps! Working on real world examples allow us to improve PlantUML.

We're going to study all this to fix issues about text overload (including shadow issue and explicit newline)
We notice also that you have to use <U+0028> notation for parenthesis. We should also provide a better solution for this.

Finally, we should also provide a for loop notation, to avoid use of 'while' in that case.

Some works to do :-)

Thanks again,
commented Jul 30, 2016 by anonymous
Indeed, I did not find a way  to escape parentheses on a text that is grammatically enclosed in parentheses and the html-entity style &#0028; also did not work there
commented Aug 4, 2016 by ivokrab (160 points)
Here's the final version of the diagram I was working on, with several workarounds for mentioned issues, plus a bit of a mix of styles to define conditions for decision points
http://plantuml.com/plantuml/uml/hLZTRbev4Bw6fvYhXQXfIAljjarI8fBGBb92ie6gYdAgod26uCt1fhO9PLTzWxtOYpxEFasVPCVs-USlNIsH8ZYsnz_yVFCDw7ikfaon2R2XuG_SBE3FQgDsmeRtTqhEH7Wg8wdW1gD8pckDwebK8Ih_S13HhcfBAJdFF_XQrQbHFMQXd7Dn1oCMQQpMigL1wOhvc1jiNB48tob4aTywb2BaXalHCui88UHiGa-gXXlwnCBVPzfqfPgmw1hl-0JxiZV58Ky-LhLXobGFj5J6cj8ouY4p6DuWKnfQlTF3AbrEfkgTVlkwrMylxze1hg4UY5k1NmmS3Phb7KUDGVDZ80AXy85hWaesGWGkO46hnplLoYYIpDX826aG5ByRcmCWbnMpde5yG0KM8eQ1o5jt1dIrmaTGtm4pHW7rMo4_aic34EdyX0k4sfWCeZQ_pLX4IQo1706B8fYYuZBK5aWPSY3gb1C9Hb4ce7Q7Wh14e5pGQZ2Nwjx23Tb21mAO264KMTGNNCmCwi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BZbsvUZb4fGxddI9hT3ZajwCRCsTyQ8awwfK6CiDm0AS5cX4TUvub3mMD8fArz9vPFNCrRdTL6Z1kGCsljUMilfAeIRzTCtZ0pVZ4_9bnCr_ETwLXSD-0DpSS7qFN1t0V5-9LNTE0ENCvEHpmgYUxQY8z2zCScBpG_nb0p9EDViJiz_YdZfRJSjk4dTDUOlv_QWENF0Xkp_X0nCBD-Iaq-_K1aQOR02WEycVJDUjN9O77AkccaqmFuKsqZ6gCU939-8pdHzm2r5BTHuAAazVUolP80At97GVK-ohgcVNfNvRdZVjoXTJjk-jL2rX-91FIrEW5LjOexM1S75th5j7D-B8Khk2HtVFG53JMFCrAMTdIzTBwMAfafpPqfcIiyMlJPNL-fHhGNPKMT7QDuMnr9cCck7AVhYkC_zGwBV8U1oa-jCjuTdvuNZaLED_3ySZ5EbhSMRBjQfYHyXkYAUkPEAmGqRX9uNDOrRXLujC60e_Nz38y_mN7-zSHw_dGxzyvWaKV_Im2Ndr8aaVfSgVRxxv4GFxFpi3BWHnZ58zI2AoSQmjTEduHD6GVxZ92Atz2m00

It would be nice to have also a way to influence the background color of partitions (in general and individually) and of individual notes (skinparam noteBackgroundColor exists for color of all notes).

Other note: where an arrow ends in a horizontal line that represents a continuation of the flow (a horizontal displacement for layout reasons---see start of if-elseif-else block---or multiple flows merging into one---see multiple lines leading up to activity "test: need to set anomaly C0017?") the arrowheads are for me superfluous.
commented Aug 8, 2016 by ivokrab (160 points)
I noticed something that qualifies as a bug with 'conditionStyle diamond': for the 'if' followed by an 'elseif' the option is ignored and the condition is displayed inside the diamond anyway:
http://plantuml.com/plantuml/uml/hL9HRzCm47wUVyL9FAIL9ZOc9AH0DxNh2fLADxRoWEY4hl4bDNFiOZkj8iH_nqxSBWKUUOdZky_VVNVVsIUXDcYm1CoSs0fNmqzsbemmUogChXI_rb8R-49IwbronaRQS39jS2KzYWsDqRjku1Up1rAxHgvtGXMGexJKoMHQSU64LW-kbWHSOEaZp0ddRuSaIbb_r5jwG8ccPjQXSIoN6btWLDfH2Yprd9MpAMp82CrFWPDrT_5_BOgrltwgKFhcbYffGGa82svDa1IaoA04GuKeAOaa7lZCSW2NwB9rgDo2GEUG71T87fd8eNSSXEaSUdVJsUtY52QpwViFYs_3nU9cFXxE5tsukke7SWMzhpNPnpux2GnjXPS_8iDW0BFXwFRp_Srzzu7I0Tyyw92WWNTmSVxgeacUl7WplduzcQJVA-j4NljEIxtr7NlrRPMt0TKEqpQ33lsAGcb375QKOMLfgOJpTkfAXX08bScA-xHGIsKtb0bFw6rpHgogu5nayipaZT_BkXnqTAN8-RvWRdIvdwhJ7GU3DlBRaFipRPJJi-f0VTHxd5ealOJpK2aAECxvWJR9lqdZ9D1QKOwnje3I4F8Q0imlXfVNs6iWciEYm5X7kv0xte0_NEre-8Vz_qTIAwPTaAXl__qD

Also note the ugly 'swing' in the arrow leading up to the 'if'-'elseif' sequence, where the line (unnecessarily) first goes to a centerpoint before going to the first condition (similar problem as existed before and was fixed for the _outgoing_ arrows of a block).

Note also that the workaround that I used in the other diagram of integrating the condition text of a following 'if' inside the branches' true/false texts does not work here:
http://plantuml.com/plantuml/uml/hLB1RXen43t7Np5I3mjIsgHHfKgRGWGXj4Y4f0azL0LLPZqBRhmsjRsWLTL_xvWrP4bxx6MzdXc_zsRUk2Ufrzpo0dZcvKRw2dwniwJFiwUbDQKMrqOP2rzHARDDpbZVM86s3YuKLR6UjMRR3FncxW3gLboOhTHBoBbosCXaHWlffT6Flb88GlA28inBJxT3aYjLtPeDFdB5RSMSvzQpN1dk0wOs7bDWAM6MtgMmHYkDE0M1pj_7_vLShkZwkUIAcflff2vAG3hmAuHaYHejLs1nAGjC8WWLFgCSYWlkirLWhel0v90S4oHpzhhxWXH64sZTZyPtqrCOZaSVFqs_zwRJcycWDvcsuUhgaiaSMkt0eA7rhK8td-cPhZdU_8mWdGwCU_sxBmyt3_IcpKwE7capfz392o1kuGDSdB-zs2LFNhqVNByR3jCVfVCohwZbmcoeTMgZ9hiCLVLKtMxYeN6vrCQYW0Lcl7GuqzAJhwPK8GHIPweKb9OasQqnamH8_dah5sMmC28HCj86x6LrEmrTAHTYJvXRK-p7wqt3og0DQIroEjETSdnM7Q2FUe_3Yw1TE0zCKS1nZkQwI_uD6YV1dPF5W5SEkBB8HGMXZ3Q4vEsCjX0zOb5Wv34-v8vteUbiGy0_70rhyDzarOBg9OaQzzy_

On the other hand, putting an explicit arrow text just before the subsidiary 'if's also does not work, because then those texts _replace_ the true/false condition texts as I noted above(plus they are located at the start of the branches, instead of at their destination point as I would like).

Hope this helps finding fixes.
commented Aug 25, 2016 by plantuml (295,000 points)
With version 8047, we've fixed some bugs about text overlaping.
Works is still in progress, but we are interested if you could post here examples that are still not working well with this last version.
Thanks for your help!
...