@startumlstartif (condition A) then (yes):Text 1;elseif (condition B) then (yes):Text 2;stop(no) elseif (condition C) then (yes):Text 3;(no) elseif (condition D) then (yes):Text 4;else (nothing):Text else;endifstop@enduml
複数条件(垂直モード)
!pragma useVerticalIf onコマンドを使用すると、垂直モードの分岐になります:
@startuml!pragma useVerticalIf onstartif (condition A) then (yes):Text 1;elseif (condition B) then (yes):Text 2;stopelseif (condition C) then (yes):Text 3;elseif (condition D) then (yes):Text 4;else (nothing):Text else;endifstop@enduml
@startumlstartrepeat :foo as starting label;:read data;:generate diagrams;backward:This is backward;repeat while (more data?)stop@enduml
repeat 節を中断する [break]
アクションの後でbreakキーワードを使うと、ループを中断することができます。
@startumlstartrepeat:Test something;if (Something went wrong?) then (no)#palegreen:OK;breakendif->NOK;:Alert "Error with long text";repeat while (Something went wrong with long text?) is (yes) not (no)->//merged step//;:Alert "Success";stop@enduml
You can use label and goto keywords to denote goto processing, with:
label <label_name>
goto <label_name>
@startumltitle Point two queries to same activity\nwith `goto`startif (Test Question?) then (yes)'space label only for alignmentlabel sp_lab0label sp_lab1'real labellabel lab:shared;else (no)if (Second Test Question?) then (yes)label sp_lab2goto sp_lab1else:nonShared;endifendif:merge;@enduml
@startumlstart:foo1;floating note left: This is a note:foo2;note rightThis note is on several//lines// and cancontain <b>HTML</b>====* Calling the method ""foo()"" is prohibitedend notestop@enduml
戻り方向(backward)のアクティビティに注釈をつけることもできます。
@startumlstartrepeat :Enter data;:Submit;backward :Warning;note right: Noterepeat while (Valid?) is (No) not (Yes)stop@enduml
パーティションにノートを追加することもできます。
@startumlstartpartition "**process** HelloWorld" {noteThis is my note----//Creole test//end note:Ready;:HelloWorld(i)>:Hello-Sent;}@enduml
@startuml:foo1;-> You can put text on arrows;if (test) then-[#blue]->:foo2;-[#green,dashed]-> The text canalso be on several linesand **very** long...;:foo3;else-[#black,dotted]->:foo4;endif-[#gray,bold]->:foo5;@enduml
@startuml|#pink|Actor_For_red|startif (color?) is (red) then#pink:**action red**;:foo1;else (not red)|#lightgray|Actor_For_no_red|#lightgray:**action not red**;:foo2;endif|Next_Actor|#lightblue:foo3;:foo4;|Final_Actor|#palegreen:foo5;stop@enduml
@startuml:Ready;:next(o)|:Receiving;split:nak(i)<:ack(o)>split again:ack(i)<:next(o)on several lines|:i := i + 1]:ack(o)>split again:err(i)<:nak(o)>split again:foo/split again:bar\\split again:i > 5}stopend split:finish;@enduml
完全な例
@startumlstart:ClickServlet.handleRequest();:new page;if (Page.onSecurityCheck) then (true):Page.onInit();if (isForward?) then (no):Process controls;if (continue processing?) then (no)stopendif if (isPost?) then (yes):Page.onPost();else (no):Page.onGet();endif:Page.onRender();endifelse (false)endifif (do redirect?) then (yes):redirect process;elseif (do forward?) then (yes):Forward request;else (no):Render page template;endifendifstop@enduml
@startumlstart:init;-> test of color;if (color?) is (<color:red>red) then:print red;else:print not red;note right: no colorendifpartition End {:end;}-> this is the end;end@enduml
グローバル(global)スタイルの使用
スタイル有り
スタイルを指定して要素の見た目を変更することができます。@startuml<style>activityDiagram {BackgroundColor #33668EBorderColor #33668EFontColor #888FontName arial diamond {BackgroundColor #ccfLineColor #00FF00FontColor greenFontName arialFontSize 15}arrow {FontColor goldFontName arialFontSize 15}partition {LineColor redFontColor greenRoundCorner 10BackgroundColor PeachPuff}note {FontColor BlueLineColor NavyBackgroundColor #ccf}}document {BackgroundColor transparent}</style>start:init;-> test of color;if (color?) is (<color:red>red) then:print red;else:print not red;note right: no colorendifpartition End {:end;}-> this is the end;end@enduml