<div id="topics">
<div class="post">
<h1 class="postTitle">
<a id="cb_post_title_url" class="postTitle2" href="http://www.cnblogs.com/ningskyer/articles/5397750.html">plantuml使用教程【轉】</a>
</h1>
<div class="clear"></div>
<div class="postBody">
<div id="cnblogs_post_body"><div id="table-of-contents" style="font: 16px/25px 'Kostic Serif', Georgia, serif; color: #303c40; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; box-sizing: border-box; widows: 1; font-size-adjust: none; font-stretch: normal; background-color: #fcfcfa; -webkit-text-stroke-width: 0px;" data-mce-="">
<h2 style="color: inherit; line-height: 1.0416; font-family: 'Adelle Sans', 'Helvetica Neue', sans-serif; font-size: 1.14em; font-weight: 500; margin-top: 25px; margin-bottom: 12.5px; box-sizing: border-box;" data-mce-="">圖跪了,請看原文:<a href="http://archive.3zso.com/archives/plantuml-quickstart.html" target="_blank">http://archive.3zso.com/archives/plantuml-quickstart.html</a></h2>
<h2 style="color: inherit; line-height: 1.0416; font-family: 'Adelle Sans', 'Helvetica Neue', sans-serif; font-size: 1.14em; font-weight: 500; margin-top: 25px; margin-bottom: 12.5px; box-sizing: border-box;" data-mce-="">Table of Contents</h2>
<div>
<ul>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-1">前言</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-2">什麼是PlantUML</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-3">在Emacs裏配置PlantUML(參考:Run it from Emacs)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-4">其餘軟件裏的PlantUML下載和安裝</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5">如何使用</a>
<ul>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1">順序圖(Sequence Diagram)</a>
<ul>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-1">簡單示例</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-2">註釋語句</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-3">申明參與者</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-4">使用非字母的參與者名稱(Use non-letters in participants)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-5">發送消息給本身(Message to Self)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-6">改變箭頭的樣式(Change arrow style)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-7">改變箭頭的顏色(Change arrow color)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-8">消息序號(Message sequence numbering)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-9">標題(Title)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-10">圖形圖例(Legend the diagram)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-11">分割圖形(Splitting diagrams)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-12">消息分組(Grouping message)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-13">消息註解(Notes on messages)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-14">一些其餘的註解方式(Some other notes)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-1-15">使用HTML進行格式化(Formatting using HTML)</a></li>
</ul>
</li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-2">用例圖(Use Case Diagram)</a>
<ul>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-2-1">用例(Usecase)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-2-2">參與者(Actors)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-2-3">示例</a></li>
</ul>
</li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-3">類圖(Class Diagram)</a>
<ul>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-3-1">示例1</a></li>
</ul>
</li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4">活動圖(Activity Diagram)</a>
<ul>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-1">簡單活動(Simple Activity)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-2">帶標註的箭頭(Label on arrows)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-3">改變箭頭的方向(Changing arrow direction)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-4">分支(Branches)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-5">多分支(More on Branches)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-6">同步塊(Synchronization)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-7">長文本的活動描述(Long activity description)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-8">註釋(Notes)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-9">分區(Partition)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-10">圖形標題(Title the diagram)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-11">皮膚(Skinparam)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-4-12">完整示例(Complete Example)</a></li>
</ul>
</li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5">活動圖Beta</a>
<ul>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5-1">簡單活動(Simple Activity)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5-2">條件符號(Conditional)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5-3">重複循環(Repeat Loop)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5-4">條件循環(While Loop)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5-5">並行處理(Parallel Processing)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5-6">註解的文本樣式(Notes)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5-7">顏色(Color)</a></li>
<li><a href="http://archive.3zso.com/archives/plantuml-quickstart.html#sec-5-5-8">完整示例(Complete Example)</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<p> </p>
<div id="outline-container-org96a7398" class="outline-2" style="font: 16px/22.85px 微軟雅黑, 'Kostic Serif', Georgia, serif; text-align: left; color: #303c40; text-transform: none; text-indent: 0px; letter-spacing: 1px; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;">
<h2 id="org96a7398">前言</h2>
<div id="text-org96a7398" class="outline-text-2">
<p>本文多數內容引用自官網文檔,並不是本人原創,也談不上翻譯,只是把本身 理解的東西用中文寫出來。</p>
<p>編寫本文的目的旨在記錄我的在學習PlantUML時對官網上一些內容的理解,以 及總結學習過程當中遇到的問題,並將其分享。文章中若有不對之處歡迎你們直 言指正,以避免形成誤導。</p>
<p>版權:本文可自由轉載,但不能商用,不能衍生,保持署名。轉載請註明做者及出處.</p>
<p><a href="http://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank">Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.</a></p>
</div>
</div>
<div id="outline-container-orga48c875" class="outline-2" style="font: 16px/22.85px 微軟雅黑, 'Kostic Serif', Georgia, serif; text-align: left; color: #303c40; text-transform: none; text-indent: 0px; letter-spacing: 1px; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;">
<h2 id="orga48c875"><a name="t1" target="_blank"></a>什麼是PlantUML</h2>
<div id="text-orga48c875" class="outline-text-2">
<p>PlantUML是一個快速建立UML圖形的組件,官網上之因此稱它是一個組件,我 想主要是由於多數狀況下咱們都是在Eclipse、NetBenas、Intellijidea、 Emacs、Word等軟件裏來使用PlantUML(<a href="http://www.plantuml.com/running.html" target="_blank">參看各軟件相關配置</a>)。</p>
<ul class="org-ul">
<li>PlantUML支持的圖形有:
<ul class="org-ul">
<li>sequence diagram,</li>
<li>use case diagram,</li>
<li>class diagram,</li>
<li>activity diagram (here is the new syntax),</li>
<li>component diagram,</li>
<li>state diagram,</li>
<li>object diagram,</li>
<li>wireframe graphical interface</li>
</ul>
</li>
<li>
<p>PlantUML經過簡單和直觀的語言來定義圖形,它能夠生成PNG、SVG和二進制 圖片。下面是一個簡單的示例:</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/orgmode-babel-sequenceuml.png
Alice -> Bob: synchronous call
Alice ->> Bob: asynchronous call
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.15209521705089513" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/orgmode-babel-sequenceuml.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.15209521705089513',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 196px; height: 148px;" frameborder="0" scrolling="no"></iframe></p>
</div>
<p>在官網上有一個簡單的<a href="http://www.plantuml.com/plantuml/" target="_blank">在線Demo服務</a>, 有興趣的朋友能夠上去看下。</p>
</li>
</ul>
</div>
</div>
<div id="outline-container-org4b3c9f2" class="outline-2" style="font: 16px/22.85px 微軟雅黑, 'Kostic Serif', Georgia, serif; text-align: left; color: #303c40; text-transform: none; text-indent: 0px; letter-spacing: 1px; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;">
<h2 id="org4b3c9f2"><a name="t2" target="_blank"></a>在Emacs裏配置PlantUML(參考:<a href="http://www.plantuml.com/emacs.html" target="_blank">Run it from Emacs</a>)</h2>
<div id="text-org4b3c9f2" class="outline-text-2"><ol class="org-ol">
<li>下載 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">plantuml.jar</code> 到你的硬盤上(<a href="http://www.plantuml.com/download.html" target="_blank">官網下載頁面</a>)</li>
<li>
<p>安裝生成圖片用的軟件<a href="http://www.plantuml.com/graphvizdot.html" target="_blank">Graphviz</a></p>
<div class="org-src-container">
<pre name="code" class="src src-sh"><em>## </em><em>若是是Ubuntu系統,能夠直接運行下面的命令安裝</em>
sudo apt-get install graphviz
</pre>
</div>
</li>
<li>
<p>在 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">.emacs</code> 裏添加配置,把 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">plantuml</code> 添加到 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">org-babel-load-languages</code> 加載語言列表裏。</p>
<div class="org-src-container">
<pre name="code" class="src src-emacs-lisp"><em>;; </em><em>active Org-babel languages</em>
(org-babel-do-load-languages
'org-babel-load-languages
'(<em>;; </em><em>other Babel languages</em>
(plantuml . t)))
</pre>
</div>
<p>而後把剛下載到的 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">plantuml.jar</code> 文件的存放路徑也添加到 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">.emacs</code> 文件中,以方便Emacs調用。</p>
<div class="org-src-container">
<pre name="code" class="src src-emacs-lisp">(<strong>setq</strong> org-plantuml-jar-path
(expand-file-name "~/path/to/plantuml.jar"))
</pre>
</div>
</li>
</ol>
<p>重啓Emacs,複製上面的示例代碼試一下吧!</p>
</div>
</div>
<div id="outline-container-org55e2e73" class="outline-2" style="font: 16px/22.85px 微軟雅黑, 'Kostic Serif', Georgia, serif; text-align: left; color: #303c40; text-transform: none; text-indent: 0px; letter-spacing: 1px; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;">
<h2 id="org55e2e73"><a name="t3" target="_blank"></a>其餘軟件裏的PlantUML下載和安裝</h2>
<div id="text-org55e2e73" class="outline-text-2">
<ul class="org-ul">
<li><a href="http://www.plantuml.com/index.html" target="_blank">PlantUML官網首頁</a></li>
<li><a href="http://www.plantuml.com/download.html" target="_blank">PlantUML各版本的下載頁面</a> (英文)</li>
<li><a href="http://www.plantuml.com/running.html" target="_blank">在各類軟件裏運行PlantUML的相關配置</a> (英文)</li>
<li><a href="http://www.plantuml.com/screenshot.html" target="_blank">Screenshots</a></li>
<li><a href="http://plantuml.sourceforge.net/qa" target="_blank">Question & Answer</a></li>
</ul>
</div>
</div>
<div id="outline-container-orgf96f587" class="outline-2" style="font: 16px/22.85px 微軟雅黑, 'Kostic Serif', Georgia, serif; text-align: left; color: #303c40; text-transform: none; text-indent: 0px; letter-spacing: 1px; word-spacing: 0px; white-space: normal; widows: 1; font-size-adjust: none; font-stretch: normal; background-color: #ffffff; -webkit-text-stroke-width: 0px;">
<h2 id="orgf96f587"><a name="t4" target="_blank"></a>如何使用</h2>
<div id="text-orgf96f587" class="outline-text-2"> </div>
<ul class="org-ul">
<li><a id="org1a92ec6" target="_blank"></a>順序圖(Sequence Diagram)
<ul class="org-ul">
<li><a id="orgf832891" target="_blank"></a>簡單示例
<div id="text-orgf832891" class="outline-text-4">
<p>順序圖用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-></code> , <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">--></code>, <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><-</code>, <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><--</code> 來繪製參與者(Participants)之 間的消息(Message)。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s1.png
Alice -> Bob: Authentication Request
Bob --> Alice: Authentication Responsejavascript
Alice -> Bob: Another atuhentication Request
Alice <-- Bob: Another authentication Response
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.14350880860517456" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s1.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.14350880860517456',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 295px; height: 207px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orgbe5cae4" target="_blank"></a>註釋語句
<div id="text-orgbe5cae4" class="outline-text-4">
<p>以單引號開始頭行,便是一個單行註釋。多行註釋可使用"'"表 示註釋內容的開始,而後使用"'"來表示註釋內容的結束。</p>
</div>
</li>
<li><a id="orge3ff445" target="_blank"></a>申明參與者
<div id="text-orge3ff445" class="outline-text-4">
<p>申明參與者,可使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">participant</code> 關鍵詞,也可使用下面的參與者 分類關鍵詞來申明參與者:</p>
<ul class="org-ul">
<li>actor</li>
<li>boundary</li>
<li>control</li>
<li>entity</li>
<li>database</li>
</ul>
<p>不一樣的參與者類型,其圖標也是不同的。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s2.png
actor Foo1
boundary Foo2
control Foo3
entity Foo4
database Foo5
Foo1 -> Foo2 : To boundary
Foo1 -> Foo3 : To control
Foo1 -> Foo4 : To entity
Foo1 -> Foo5 : To database
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.6118402025698506" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s2.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6118402025698506',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 311px; height: 303px;" frameborder="0" scrolling="no"></iframe></p>
</div>
<p>使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">as</code> 關鍵詞能夠爲參與者起一個別名,這樣在對引用長名的參與者時, 會方便不少。在參與者申明語句後行尾能夠追加背景色的設置,只要把標準 的<a href="http://www.w3schools.com/HTML/html_colornames.asp" target="_blank">HTML顏色值</a> 寫在後面就好了。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s3.png
actor Bob #red
' The only defference between actor
' and participant is the drawing
participant Alice
participant "I have a really\nlong name" as L #99ff99
/' You can also declare:
participant L as "I have a really\nlong name" #99ff99
'/html
Alice -> Bob: Authentication Request
Bob -> Alice: Authentication Response
Bob -> L: Log transaction
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.7073942727993694" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s3.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7073942727993694',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 354px; height: 273px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org86a9cd7" target="_blank"></a>使用非字母的參與者名稱(Use non-letters in participants)
<div id="text-org86a9cd7" class="outline-text-4">
<p>針對非字母的參與者名,咱們可使用雙引號,一樣也能夠爲比較長的名字 起個別名,方法同上使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">as</code> 關鍵詞。</p>
<p>使用上面的關鍵詞來申明參與者,是一種顯示申明;而採用引號來申明參與 者則是一種隱示申明方法,它不須要專門的位置去定義。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s4.png
Alice -> "Bob()" : Hello
"Bob()" -> "This is very\nlong" as Long
' You can also declare:
' "Bob()" -> Long as "This is very\nlong"
Long --> "Bob()" : ok
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.32259944165117416" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s4.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.32259944165117416',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 230px; height: 195px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org10d10f5" target="_blank"></a>發送消息給本身(Message to Self)
<div id="text-org10d10f5" class="outline-text-4">
<p>一個參與者能夠給本身發送消息,消息名若是須要有多行文本,能夠用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">\n</code> 來表示換行。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s5.png
Alice -> Alice: This is a signal to self.\nIt also demonstrates\nmultiline \ntext
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.6750191507072947" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s5.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6750191507072947',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 183px; height: 178px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org6226391" target="_blank"></a>改變箭頭的樣式(Change arrow style)
<div id="text-org6226391" class="outline-text-4">
<p>在用例圖裏能夠經過如下方式來改變箭頭的樣式:</p>
<ul class="org-ul">
<li>使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">\</code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">/</code> 來替換 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><</code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">></code> 可讓箭頭只顯示上半部分或下半 部分。</li>
<li>重複輸入箭頭或斜槓( <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">>></code> <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">//</code> ),用來繪製空心箭頭。</li>
<li>使用雙橫線 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">--</code> 替代 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-</code> 能夠用來繪製點線。</li>
<li>在箭頭後面加個 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">o</code> 能夠在箭頭前繪製一個圓圈。</li>
<li>使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><-></code> 可用來繪製雙向箭頭。</li>
</ul>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s6.png
Bob -> Alice
Bob ->> Alice
Bob -\ Alice
Bob \\- Alice
Bob //-- Alicejava
Bob ->o Alice
Bob o\\-- Alicegit
Bob <-> Alice
Bob <<-\\o Alice
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.5552630581578053" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s6.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5552630581578053',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 116px; height: 216px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org081e3be" target="_blank"></a>改變箭頭的顏色(Change arrow color)
<div id="text-org081e3be" class="outline-text-4">
<p>要改變箭頭的顏色,可使用<a href="http://www.w3schools.com/HTML/html_colornames.asp" target="_blank">HTML顏色符號</a>,參看下面的例子:</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s7.png
Bob -[#red]> Alice : hello
Alice -[#0000FF]->Bob : ok
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.5717255657653986" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s7.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5717255657653986',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 116px; height: 148px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orgfa7a402" target="_blank"></a>消息序號(Message sequence numbering)
<div id="text-orgfa7a402" class="outline-text-4">
<p>關鍵詞 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">autonumber</code> 用來給自動的給消息添加上序號。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s8.png
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Response
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.3934301605328623" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s8.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.3934301605328623',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 254px; height: 148px;" frameborder="0" scrolling="no"></iframe></p>
</div>
<p>若是須要指定一個起始號碼,能夠直接在 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">autonumber</code> 後面加個數字就行 了,若是要設置自增量,再在後面加一個數字就好了( <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">autonumber start increment</code> )。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s9.png
autonumber
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Responseweb
autonumber 15
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Response微信
autonumber 40 10
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.38504865116977305" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s9.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.38504865116977305',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 340px; height: 265px;" frameborder="0" scrolling="no"></iframe></p>
</div>
<p>咱們也能夠爲序號指定數字格式,這個格式化的過程其實是<a class="replace_word" title="Java 知識庫" href="http://lib.csdn.net/base/java" target="_blank">Java</a>類<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">DecimalFormat</code> 來執行的( <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">0</code> 表示數字, <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">#</code> 缺省補零位數)。</p>
<p>一樣的,也可使用一些HTML標籤來控制數字的樣式。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s10.png
autonumber "<b>[000]"
Bob -> Alice : Authentication Request
Bob <- Alice : Authentication Responsebabel
autonumber 15 "<b>(<u>##</u>)"
Bob -> Alice : Another authentication Request
Bob <- Alice : Another authentication Responseasync
autonumber 40 10 "<font color=red>Message 0 "
Bob -> Alice : Yet another authentication Request
Bob <- Alice : Yet another authentication Response
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.5315873836555247" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s10.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5315873836555247',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 407px; height: 265px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org1817ced" target="_blank"></a>標題(Title)
<div id="text-org1817ced" class="outline-text-4">
<p>要給圖形加一個標題能夠用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">title</code> 關鍵詞來設置。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s11.png
title Simple Comunication exampleide
Alice -> Bob : Authentication Request
Bob --> Alice : Authentication Response
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.6717940008780068" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s11.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6717940008780068',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 259px; height: 179px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orgde4cef2" target="_blank"></a>圖形圖例(Legend the diagram)
<div id="text-orgde4cef2" class="outline-text-4">
<p>使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">legend</code> 和 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end legend</code> 關鍵詞能夠設置圖形的圖例。圖例能夠設 爲左對齊、右對齊和居中對齊。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s12.png
Alice -> Bob : Hello
legend right
Short
legend
endlegend
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.4361730346353505" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s12.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.4361730346353505',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 116px; height: 179px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org299ed4f" target="_blank"></a>分割圖形(Splitting diagrams)
<div id="text-org299ed4f" class="outline-text-4">
<p>關鍵詞 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">newpage</code> 是用來把圖形分割成幾個圖片的。每個被分割出來的 圖片能夠看做是一個新的頁面( <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">new page</code> ),若是要給新的頁面添加一 個標題,能夠緊跟在關鍵詞 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">newpage</code> 以後來設置。</p>
<p>使用這個方法能夠方便的在Word裏把比較長的圖形分別打印到幾個不一樣的頁 面上(有點分頁符的概念)。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s13.png
Bliss -> Tia : I love you
Bliss -> Tia : I miss youoop
newpage
Bliss -> Tia : Let's go home
Bliss -> Tia : Quick
newpage A title for the\nlast page
Tia -> Bliss : Give me money
Tia -> Bliss : No money No love
#+END_SRC
</pre>
</div>
</li>
<li><a id="orgcb29ffc" target="_blank"></a>消息分組(Grouping message)
<div id="text-orgcb29ffc" class="outline-text-4">
<p>有時候可能須要對消息進行分組,那麼可使用下面的關鍵詞來實現:</p>
<ul class="org-ul">
<li>alt/else</li>
<li>opt</li>
<li>loop</li>
<li>par</li>
<li>break</li>
<li>critical</li>
<li>group, 這個關鍵詞後面的文字會做爲組名顯示在圖形上</li>
</ul>
<p>上面的關鍵詞後能夠添加一些文本用來顯示在頭部(注: <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">group</code> 除外,因 爲它後面的文本用來顯示在組名稱的位置)。在組嵌套組的結構裏能夠用關 鍵詞<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end</code> 來關閉組或者說是表示一個組符號的結束符(相似 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">if/endif</code> )。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s14.png
Alice -> Bob: Authentication Request
alt successful case
Bob -> Alice: Authentication Accepted
else some kind of failure
Bob -> Alice: Atuhentication Failue
group My own label
Alice -> Log : Log attack start
loop 1000 times
Alice -> Bob: DNS Attack
end
Alice -> Log : Loag alice end
end
else Another type of failue
Bob -> Alice: Please repeat
end
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.6852117694628488" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s14.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6852117694628488',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 352px; height: 417px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orge376179" target="_blank"></a>消息註解(Notes on messages)
<div id="text-orge376179" class="outline-text-4">
<p>咱們可能常常會在消息的左邊或右邊使用註解,要添加註解,只要使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">note left</code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">note right</code> 關鍵詞就能夠了。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s15.png
Alice -> Bob : hello
note left: this is a first note
Bob -> Alice : ok
note right: this is anther note
Bob -> Bob : I am thinking
note left
a note
can also be defined
on several lines
end note
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.7835892993949944" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s15.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7835892993949944',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 354px; height: 238px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org4a51875" target="_blank"></a>一些其餘的註解方式(Some other notes)
<div id="text-org4a51875" class="outline-text-4">
<p>經過使用關鍵詞 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">note left of</code> , <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">note right of</code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">note over</code> , 咱們還能夠把註解放置在與之相關的參與者的左邊或右邊,或下方。</p>
<p>經過改變註解的<a href="http://www.w3schools.com/HTML/html_colornames.asp" target="_blank">背景色</a>,咱們還能夠高亮一個註解文本塊。</p>
<p>若是要使用多行註解,可使用關鍵詞 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end note</code> 來表示註解的結束。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s16.png
participant Alice
participant Bob
note left of Alice #aqua
This is displayed
left of Alice.
end note
note right of Alice: This is displayed right of Alice.
note over Alice: This displayed over Alice.
note over Alice, Bob #FFAAAA: This is displayed\n over Bob and Alice.
note over Bob, Alice
This is yet another
example of
a long note.
end note
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.209966702903434" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s16.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.209966702903434',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 363px; height: 346px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orgbbb668d" target="_blank"></a>使用HTML進行格式化(Formatting using HTML)
<div id="text-orgbbb668d" class="outline-text-4">
<p>咱們可使用少許的HTML標籤來格式化文本:</p>
<ul class="org-ul">
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><b></code> 加粗文本</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><u></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><u:#AAAAAA></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><u:colorName></code> 用來加下劃線</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><i></code> 斜體</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><s></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><s:#AAAAAA></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><s:colorName></code> 用來加刪除線</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><w></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><w:#AAAAAA></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><w:colorName></code> 用來加波浪線</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><color:#AAAAAA></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><color:colorName></code> 用來設置文本顏色</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><back:#AAAAAA></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><back:colorName></code> 用來設置背景色</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><size:nn></code> 設置字體大小</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><img src="file"></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><img:file></code> 用來添加圖片,圖片文件必須 是能夠訪問獲得才行。</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><img src="http://url"></code> 或 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;"><img:http://url></code> 用來添加一個互 聯網圖片,一樣的圖片地址必須是可用的才行。</li>
</ul>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s17.png
participant Alice
participant "The <b>Famous</b> Bob" as Bob
Alice -> Bob : A <i>well formated</i> message
note right of Alice
This is <back:cadetblue><size:18>displayed</size></back>
<u>left of</u> Alice.
end note
note left of Bob
<u:red>This</u> is <color #118888>displayed</color>
<b><color purple>left of</color> <s:red>Alice</strike> Bob</b>
end note
note over Alice, Bob
<w:#FF33FF>This is hosted</w> by <img ../img/code.png>
end note
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.750528966897736" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-s17.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.750528966897736',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 314px; height: 358px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
</ul>
</li>
<li><a id="orge211e8b" target="_blank"></a>用例圖(Use Case Diagram)
<ul class="org-ul">
<li><a id="orgff64737" target="_blank"></a>用例(Usecase)
<div id="text-orgff64737" class="outline-text-4">
<p>用例能夠用一對小括號括起來表示,也可使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">usecase</code> 關鍵詞來定義。 用例也能夠經過使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">as</code> 關鍵詞來設置別名,在創建關係的時候可使用 別名。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-u1.png
@startuml
(Usecase One)
(Usecase Two) as (UC2)
usecase UC3
usecase (Last\nusecase) as UC4
@enduml
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.7956155829418377" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-u1.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7956155829418377',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 319px; height: 158px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org6996dbf" target="_blank"></a>參與者(Actors)
<div id="text-org6996dbf" class="outline-text-4">
<p>定義參與者時,能夠把參與者的名稱放在兩個冒號的中間,也能夠用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">actor</code> 關鍵詞來定義參與者。一樣參與着也可使用別名。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-u2.png
@startuml
:Actor 1:
:Another\nactor: as Men2
actor Men3
actor :Last actor: as Men4
@enduml
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.01495766692310041" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-u2.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.01495766692310041',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 169px; height: 262px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orgbe31866" target="_blank"></a>示例
<div id="text-orgbe31866" class="outline-text-4">
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-u99.png
left to right direction
skinparam packageStyle rect
actor customer
actor clerk
rectangle checkout {
customer -- (checkout)
(checkout) .> (payment) : include
(help) .> (checkout) : extends
(checkout) -- clerk
}
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.8261839861785552" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-u99.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.8261839861785552',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 350px; height: 330px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
</ul>
</li>
<li><a id="org3966f49" target="_blank"></a>類圖(Class Diagram)
<ul class="org-ul">
<li><a id="orge3305fd" target="_blank"></a>示例1
<div id="text-orge3305fd" class="outline-text-4">
<div class="org-src-container">
<pre name="code" class="src src-plantuml">class Company {
}
class Department {
name : Name
}
class Office {
address : String
phone : Number
}
class Headquarters {
}
class Person {
name : Name
employeeID : Integer
title : String
getPhoto() : Photo
getPhone() : Number
getContactInformation() : ContactInformation
getPersonalRecords() : PersonnelRecord
}
class ContactInformation {
address : String
}
class PersonnelRecord {
taxID
employmentHistory
salary
}
Company "1" *-do- "1..*" Department
Company "1" *-do- "1..*" Office
'(Department, Office) -up-* Company
Department "*" -ri- "*" Office : Location >
Department "*" --* "0..1" Department
Office <|-do- Headquarters
Department "*" -do- "member 1..*" Person
Person "1 {subsets member}" -u- "*" Department : manager
Person .ri.> ContactInformation
Person ..> PersonnelRecord
PersonnelRecord -() ISecureInformation
</pre>
</div>
</div>
</li>
</ul>
</li>
<li><a id="org5182468" target="_blank"></a>活動圖(Activity Diagram)
<ul class="org-ul">
<li><a id="orge5ca3a0" target="_blank"></a>簡單活動(Simple Activity)
<div id="text-orge5ca3a0" class="outline-text-4">
<p>在活動圖中,你可使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">(*)</code> 來表示活動開始點和結束點。使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">--></code> 來表示箭頭。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a1.png
(*) --> "First Activity"
"First Activity" --> (*)
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.47032198423909555" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a1.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.47032198423909555',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 118px; height: 172px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org27d2c08" target="_blank"></a>帶標註的箭頭(Label on arrows)
<div id="text-org27d2c08" class="outline-text-4">
<p>缺省狀況下,活動圖的箭頭是沒有標註的。但咱們能夠經過方括號 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">[labels]</code>來設置標註,只要把它放在箭頭定義的後面就能夠了。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a2.png
(*) --> "First Activity"
-->[You can put also labels] "Second Activity"
-->(*)
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.32704297302882934" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a2.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.32704297302882934',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 230px; height: 268px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org347a00d" target="_blank"></a>改變箭頭的方向(Changing arrow direction)
<div id="text-org347a00d" class="outline-text-4">
<p>咱們可使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-></code> 建立一個水平箭頭,也能夠經過下面的方式來改變箭頭 的方向:</p>
<ul class="org-ul">
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-down-></code> 向下(這個是默認的,等同於 =–>=)</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-right-></code> 向右</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-left-></code> 向左</li>
<li><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-up-></code> 向上</li>
</ul>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a3.png
(*) --> "1"
-right-> "2"
-down-> "3"
-left-> "4"
-le-> "5"
-up-> "6"
-l-> "7"
-do-> "8"
-d-> "9"
-> "10"
--> (*)
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.5253458836386424" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a3.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5253458836386424',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 196px; height: 320px;" frameborder="0" scrolling="no"></iframe></p>
</div>
<p>在描述箭頭時, <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">up|down|left|right</code> 這幾個單詞的寫法能夠簡化, 用單詞開頭的一個或兩個字母來替換就好了,好比 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-down-></code> 也能夠寫成 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-d-></code> 或者<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-do-></code> 。</p>
</div>
</li>
<li><a id="orgc4f24e5" target="_blank"></a>分支(Branches)
<div id="text-orgc4f24e5" class="outline-text-4">
<p>在PlantUML裏,咱們可使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">if/then/else</code> 關鍵詞來定義分支。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a4.png
(*) --> "Initialisation"
if " Some Test" then
-->[ture] "Some Activity"
--> "Another Activity"
-right-> (*)
else
->[false] "Something else"
-->[Ending process] (*)
endif
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.7848449279491216" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a4.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7848449279491216',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 321px; height: 358px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org62a8e10" target="_blank"></a>多分支(More on Branches)
<div id="text-org62a8e10" class="outline-text-4">
<p>直接給例子:</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a5.png
(*) --> if "Some Test" then
-->[true] "1"
if "" then
-> "3" as a3
else
if "Other test" then
-left-> "5"
--> (*)
else
--> "6"
--> (*)
endif
endif
else
->[false] "2"
--> (*)
endif
a3 --> if "last test" then
--> "7"
--> (*)
else
-> "8"
--> (*)
endif
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.21997309990968894" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a5.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.21997309990968894',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 293px; height: 496px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org4865926" target="_blank"></a>同步塊(Synchronization)
<div id="text-org4865926" class="outline-text-4">
<p>同步塊能夠用「=== code ===」來表示。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a6.png
(*) --> ===B1===
--> "parallel Activity 1"
--> ===B2===
===B1=== --> "Parallel Activity 2"
--> ===B2===
--> (*)
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.0024593582996490504" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a6.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.0024593582996490504',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 293px; height: 268px;" frameborder="0" scrolling="no"></iframe></p>
</div>
<p>一個小實例</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a7.png
(*) --> "Select site"
--> "Commission architect"
--> "Develop plan"
--> "Bid plan" as bp
if "" then
-->[else] ===B1===
--> "Do site work"
--> ===B2===
===B1=== --> "Do trade work"
--> ===B2===
--> "Finish construction"
--> (*)
else
-u->[not accepted] bp
endif
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.605196379731219" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a7.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.605196379731219',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 249px; height: 754px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org7381077" target="_blank"></a>長文本的活動描述(Long activity description)
<div id="text-org7381077" class="outline-text-4">
<p>在定義活動的時候,有時候須要用多行文字來描述這個活動,這時咱們能夠 在描述裏添加換行符 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">\n</code> ,也可使用少許的HTML標籤。</p>
<p>如下是可使用的HTML標籤:</p>
<pre name="code" class="example"><b>
<i>
<font size="nn"> or <size:nn> to change font size
<font color="#AAAAAA"> or <font color="colorName">
<color:#AAAAAA> or <color:colorName>
<img:file.png> to include an image
</pre>
<p>針對較長文本描述活動,能夠起一個較短別名(如:<a class="coderef" href="http://archive.3zso.com/archives/plantuml-quickstart.html#coderef-alias" target="_blank">"long text" as A1</a>), 在圖形定義腳本中能夠直接使用別名,參看下面的例子中的<a class="coderef" href="http://archive.3zso.com/archives/plantuml-quickstart.html#coderef-useA1" target="_blank">A1</a>。</p>
<pre name="code" class="example"><span class="linenr">1: #+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a8.png
<span class="linenr">2: (*) -l-> "this <size:20>activity</size>
<span class="linenr">3: is <b>very</b> <color:red>long</color>
<span class="linenr">4: and defined on serveral lines
<span id="coderef-alias" class="coderef-off"><span class="linenr">5: that contains many <i>text</i>" as A1
<span class="linenr">6: -up-> "Another activity\n on serveral lines"
<span class="linenr">7:
<span id="coderef-useA1" class="coderef-off"><span class="linenr">8: A1 --> "Short activity\n<img:../img/code.png>"
<span class="linenr">9: #+END_SRC
</span></span></span></span></span></span></span></span></span></span></span></pre>
<div class="figure">
<p><iframe id="iframe_0.9713808778482296" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a8.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.9713808778482296',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 266px; height: 366px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orge579177" target="_blank"></a>註釋(Notes)
<div id="text-orge579177" class="outline-text-4">
<p>PlantUML能夠經過在腳本里使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">note</code> 來添加註釋文本塊。</p>
<p>note commands:</p>
<ul class="org-ul">
<li>note left</li>
<li>note right</li>
<li>note top</li>
<li>note bottom</li>
</ul>
<p>PlantUML用上面列表裏的命令來標註一個註釋塊的開始,而後用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end note</code>來標註註釋塊的結束。同時note命令也容許使用單行定義一個文本塊, 詳見下面的例子。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a9.png
(*) --> "Some Activity" as s
note right: This activity has to be defined
s --> (*)
note left
This note is on
serveral lines
end note
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.7035071513085953" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a9.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7035071513085953',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 448px; height: 192px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org61e9e2e" target="_blank"></a>分區(Partition)
<div id="text-org61e9e2e" class="outline-text-4">
<p>經過分區關鍵詞 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">partition</code> 能夠定義一個分區,而且可使用HTML的 顏色碼或顏色名來設置分區的背景色。在你申明一個活動時,PlantUML會自動 的把這個活動對象放置到最後使用的分區中。固然,也可使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end partitio</code> 關閉分區定義。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a10.png
partition Conductor
(*) --> "Climbs on Platform"
--> === S1 ===
--> Bows
end partition
partition Aduience #LightSkyBlue
=== S1 === --> Applauds
partition Conductor
Bows --> === S2 ===
--> WavesArmes
Applauds --> === S2 ===
end partition
partition Orchestra #CCCCEE
WavesArmes --> Introduction
--> "Play music"
end partition
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.26003361821954707" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a10.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.26003361821954707',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 358px; height: 636px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org0b0c6ef" target="_blank"></a>圖形標題(Title the diagram)
<div id="text-org0b0c6ef" class="outline-text-4">
<p>標題關鍵詞 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">title</code> 用來設置一個圖形的標題文本,咱們能夠在 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">title</code> 和<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end title</code> 兩個關鍵詞之間放置比較長的標題文本。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a11.png
title Simple example\nof title
(*) --> "First activity"
--> (*)
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.30664345716586894" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a11.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.30664345716586894',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 142px; height: 213px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orga2efce6" target="_blank"></a>皮膚(Skinparam)
<div id="text-orga2efce6" class="outline-text-4">
<p>皮膚命令 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">skinparam</code> 能夠改變圖形的顏色和字體。這些命令能夠在如下 的位置中使用:</p>
<ul class="org-ul">
<li>在圖形定義裏使用,</li>
<li>在包含的文件裏使用,</li>
<li>在一個配置文件裏使用,這個配置文件通常由命令行或ANT的Task來提供。</li>
</ul>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a12.png
skinparam backgroundColor #AAFFFF
skinparam activityStartColor red
skinparam activityBarColor SaddleBrown
skinparam activityEndColor Silver
skinparam activityBackgroundColor Peru
skinparam activityBorderColor Peru
skinparam activityFontName Impact
skinparam activityShape octagon
(*) --> "Climbs on Platform"
--> === S1 ===
--> Bows
--> === S2 ===
--> WavesArmes
--> (*)
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.46408603824829253" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a12.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.46408603824829253',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 134px; height: 422px;" frameborder="0" scrolling="no"></iframe></p>
</div>
<p>使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">skinparam activityShape octagon</code> 命令能夠把活動圖形改爲八角 形的。(好像沒效果!)</p>
</div>
</li>
<li><a id="orgb13b053" target="_blank"></a>完整示例(Complete Example)
<div id="text-orgb13b053" class="outline-text-4">
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a13.png
'http://click.sourceforge.net/images/activity-diagram-small.png
title Servlet Container
(*) --> "ClickServlet.handleRequest()"
--> "new Page"
if "Page.onSecurityCheck" then
->[true] "Page.onInit()"
if "isForward?" then
->[no] "Process controls"
if "continue processing?" then
-->[yes] ===RENDERING===
else
-->[no] ===REDIRECT_CHECK===
endif
else
-->[yes] ===RENDERING===
endif
if "is Post?" then
-->[yes] "Page.onPost()"
--> "Page.onRender()" as render
--> ===REDIRECT_CHECK===
else
-->[no] "Page.onGet()"
--> render
endif
else
-->[false] ===REDIRECT_CHECK===
endif
if "Do redirect?" then
->[yes] "redirect request"
--> ==BEFORE_DESTORY===
else
if "Do Forward?" then
-left->[yes] "Forward request"
--> ==BEFORE_DESTORY===
else
-right->[no] "Render page template"
--> ==BEFORE_DESTORY===
endif
endif
--> "Page.onDestory()"
-->(*)
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.42938107770657763" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-a13.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.42938107770657763',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 621px; height: 1134px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
</ul>
</li>
<li><a id="org09b8cf0" target="_blank"></a>活動圖Beta
<div id="text-org09b8cf0" class="outline-text-3">
<p>Beta版本的活動圖簡化了活動圖的符號定義,從 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">V7947</code> 這個版本開始, PlantUML就開始引入了一些簡化寫法,固然到目前(20140627)爲止還不是 很完善,但這個版本里的一些簡化寫法已是PlantUML後續版本的發展方向。</p>
<p>下文中將會用幾個簡單的示例來介紹Beta版活動圖的新功能,有興趣的朋友 也能夠試一下,在使用新的寫法以前須要把 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">GraphViz</code> 更新到最新版本。</p>
<p>關於更多的PlantUML版本更新信息能夠參考官網頁面(<a href="http://www.plantuml.com/news.html" target="_blank">What's New?</a>)</p>
</div>
<ul class="org-ul">
<li><a id="org1b5eed5" target="_blank"></a>簡單活動(Simple Activity)
<div id="text-org1b5eed5" class="outline-text-4">
<p>在這個例子裏,活動元素從一個 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">:</code> 開始,而後到一個 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">;</code> 結束。 開始和結束符號,能夠用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">start</code> 和 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end</code> 兩個關鍵詞來表示。以前版 本的開始和結束符都是用同一個符號 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">(*)</code> 來表示的,我的以爲新的寫法 邏輯更清晰,代碼可讀性更高。</p>
<p>至於更多的文本格式,你們能夠參考:<a href="http://www.plantuml.com/creole.html" target="_blank">Creole engine</a></p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab1.png
start
:Hello world;
:This is on defined on
serveral **lines**;
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.6362483730284616" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab1.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6362483730284616',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 170px; height: 201px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org29d4dd4" target="_blank"></a>條件符號(Conditional)
<div id="text-org29d4dd4" class="outline-text-4">
<p>和以前同樣,仍是使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">if</code> , <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">then</code> 和 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">else</code> 關鍵詞,但分支條件的 標籤<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">Labels</code> 能夠直接寫在關鍵詞 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">then</code> 和 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">else</code> 的後面,並用小括 號括起來就能夠了(如: <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">(Labels)</code> )。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab2.png
start
if (graphviz installed?) then (yes)
:process all\ndiagrams;
else (no)
:process only
__sequence__ and __activity__ diagrams;
endif
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.31869159645983136" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab2.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.31869159645983136',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 398px; height: 225px;" frameborder="0" scrolling="no"></iframe></p>
</div>
<p>在新版本里除了使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">else</code> 外,還新加了一個 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">elseif</code> 關鍵詞,有了這 個語法,咱們就能夠繪製一系列條件的活動圖。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab3.png
start
if (condition A) then (yes)
:Text1;
elseif (condition B) then (yes)
:Text2;
stop
elseif (condition C) then (yes)
:Text 3;
elseif (condition D) then (yes)
:Text 4;
else (nothing)
:Text else;
endif
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.06746846727992084" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab3.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.06746846727992084',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 523px; height: 276px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org8e26ba5" target="_blank"></a>重複循環(Repeat Loop)
<div id="text-org8e26ba5" class="outline-text-4">
<p>經過 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">repeat</code> 和 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">repeat while</code> 關鍵詞能夠建立循環結構的圖形。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab4.png
start
repeat
:read data;
:generate diagrams;
repeat while (more data?)
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.4812186068609827" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab4.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.4812186068609827',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 176px; height: 275px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orgccae1a3" target="_blank"></a>條件循環(While Loop)
<div id="text-orgccae1a3" class="outline-text-4">
<p>「條件循環」和上面的「重複循環」不太同樣,上面的「重複循環」是先執行一次 循環體裏的內容,而後再執行斷言條件,看是否重複執行循環體;而條件循 環則將斷言放到了最前面,所以它是先判斷是否知足條件再執行循環體裏的 內容。</p>
<p>要建立條件循環結構的圖形能夠經過使用 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">while</code> 和 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end while</code> 兩個關 鍵詞來實現。若是要給條件分支加上標註,能夠在 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">while</code> 條件後加上一 個 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">is</code> 關鍵詞,而後用小括號括上要標註的內容;在 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end while</code> 後可 以直接用小括號括上要標註的內容。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab5.png
start
while (data available?) is (not empty)
:read data;
:generate diagrams;
end while (empty)
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.7585128116394388" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab5.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.7585128116394388',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 195px; height: 277px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orga6f4136" target="_blank"></a>並行處理(Parallel Processing)
<div id="text-orga6f4136" class="outline-text-4">
<p><code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">fork</code> , <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">fork again</code> 和 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">end fork</code> 三個關鍵詞用來表示並行處理結 構。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab6.png
start
if (multiprocessor?) then (yes)
fork
:Treatment 1;
fork again
:Treatment 2;
end fork
else (monoproc)
:Treatment 1;
:Treatment 2;
endif
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.024868222654619743" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab6.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.024868222654619743',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 416px; height: 280px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="orgc550e28" target="_blank"></a>註解的文本樣式(Notes)
<div id="text-orgc550e28" class="outline-text-4">
<p>註解裏的文本樣式是經過 <a href="http://www.plantuml.com/creole.html" target="_blank">Creole wiki syntax</a> 來實現的。關於<a href="http://en.wikipedia.org/wiki/Creole_(markup)" target="_blank">Creole引擎</a>, 你們能夠參考維基百科上的介紹。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab7.png
start
:fool;
note left: This is a note
:foo2;
note right
This note is on serveral
//lines// and can
contain <b>HTML</b>
====
* Calling the method ""foo()"" is prohibited
end note
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.995456728741829" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab7.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.995456728741829',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 489px; height: 224px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org956674a" target="_blank"></a>顏色(Color)
<div id="text-org956674a" class="outline-text-4">
<p>爲活動元素指定背景色能夠直接在活動開始標記 <code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">:</code> 前加上顏色描述符:</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab8.png
start
#purple:starting progress;
:reading configuration files
These files must do be edited at this point;
#00AAAA:ending of the process;
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.6624437929051581" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab8.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.6624437929051581',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 306px; height: 255px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
<li><a id="org45b0c44" target="_blank"></a>完整示例(Complete Example)
<div id="text-org45b0c44" class="outline-text-4">
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-ab9.png
start
:ClickServlet.handleRequest();
:new page;
if (Page.onSecurityCheck) then (true)
:(Page.onInit();
if (isForward?) then (no)
:Process controls;
if (continue processing?) then (no)
stop
endif
if (isPost?) then (yes)
:Page.onPost();
else (no)
:Page.onGet();
endif
:Page.onRender();
endif
else (false)
endif
if (do redirect?) then (yes)
:redirect process;
else
if (do forward?) then (yes)
:Forward request;
else (no)
:Render page template;
endif
endif
stop
#+END_SRC
</pre>
<div class="figure">
<p><iframe id="iframe_0.5072774617846536" src="data:text/html;charset=utf8,%3Cstyle%3Ebody%7Bmargin:0;padding:0%7D%3C/style%3E%3Cimg%20id=%22img%22%20src=%22http://archive.3zso.com/img/plantuml-quickstart-ab9.png?_=5397750%22%20style=%22border:none;max-width:896px%22%3E%3Cscript%3Ewindow.onload%20=%20function%20()%20%7Bvar%20img%20=%20document.getElementById('img');%20window.parent.postMessage(%7BiframeId:'iframe_0.5072774617846536',width:img.width,height:img.height%7D,%20'http://www.cnblogs.com');%7D%3C/script%3E" style="border: none; width: 685px; height: 962px;" frameborder="0" scrolling="no"></iframe></p>
</div>
</div>
</li>
</ul>
</li>
</ul>
</div>
</div></div><div id="MySignature" style="display: block;"><p style="color:#666;padding-left:-50px;">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</p>
<h2 style="width:100%;text-algin:center">用以至學,學以至用</h2></div>
<div class="clear"></div>
<div id="blog_post_info_block">
<div id="BlogPostCategory">分類: <a href="http://www.cnblogs.com/ningskyer/category/424971.html" target="_blank">方法操做</a></div>
<div id="EntryTag"></div>
<div id="blog_post_info"><div id="green_channel">
<a href="javascript:void(0);" id="green_channel_digg" onclick="DiggIt(5397750,cb_blogId,1);green_channel_success(this,'謝謝推薦!');">好文要頂</a>
<a id="green_channel_follow" onclick="follow('2d163654-a822-e211-aa8f-842b2b196315');" href="javascript:void(0);">關注我</a>
<a id="green_channel_favorite" onclick="AddToWz(cb_entryId);return false;" href="javascript:void(0);">收藏該文</a>
<a id="green_channel_weibo" href="javascript:void(0);" title="分享至新浪微博" onclick="ShareToTsina()"><img src="//common.cnblogs.com/images/icon_weibo_24.png" alt=""></a>
<a id="green_channel_wechat" href="javascript:void(0);" title="分享至微信" onclick="shareOnWechat()"><img src="//common.cnblogs.com/images/wechat.png" alt=""></a>
</div>
<div id="author_profile">
<div id="author_profile_info" class="author_profile_info">
<a href="http://home.cnblogs.com/u/ningskyer/" target="_blank"><img src="//pic.cnblogs.com/face/462486/20130502152310.png" class="author_avatar" alt=""></a>
<div id="author_profile_detail" class="author_profile_info">
<a href="http://home.cnblogs.com/u/ningskyer/">小天兒</a><br>
<a href="http://home.cnblogs.com/u/ningskyer/followees">關注 - 22</a><br>
<a href="http://home.cnblogs.com/u/ningskyer/followers">粉絲 - 17</a>
</div>
</div>
<div class="clear"></div>
<div id="author_profile_honor"></div>
<div id="author_profile_follow">
<a href="javascript:void(0);" onclick="follow('2d163654-a822-e211-aa8f-842b2b196315');return false;">+加關注</a>
</div>
</div>
<div id="div_digg">
<div class="diggit" onclick="votePost(5397750,'Digg')">
<span class="diggnum" id="digg_count">0</span>
</div>
<div class="buryit" onclick="votePost(5397750,'Bury')">
<span class="burynum" id="bury_count">0</span>
</div>
<div class="clear"></div>
<div class="diggword" id="digg_tips">
</div>
</div>
</div>
<div class="clear"></div>
<div id="post_next_prev"></div>
</div>
</div> <div class="postDesc">posted @ <span id="post-date">2016-04-16 10:07</span> <a href="http://www.cnblogs.com/ningskyer/">小天兒</a> 閱讀(<span id="post_view_count">5950</span>) 評論(<span id="post_comment_count">1</span>) <a href="https://i.cnblogs.com/EditArticles.aspx?postid=5397750" rel="nofollow">編輯</a> <a href="#" onclick="AddToWz(5397750);return false;">收藏</a></div> </div> <script type="text/javascript">var allowComments=true,cb_blogId=132377,cb_entryId=5397750,cb_blogApp=currentBlogApp,cb_blogUserGuid='2d163654-a822-e211-aa8f-842b2b196315',cb_entryCreatedDate='2016/4/16 10:07:00';loadViewCount(cb_entryId);</script> </div>