<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>&nbsp;</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 -&gt; Bob: synchronous call
Alice -&gt;&gt; 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>下载&nbsp;<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>&nbsp;到你的硬盘上(<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>在&nbsp;<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>&nbsp;里添加配置,把&nbsp;<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>&nbsp;添加到&nbsp;<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>&nbsp;加载语言列表里。</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>然后把刚下载到的&nbsp;<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>&nbsp;文件的存放路径也添加到&nbsp;<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>&nbsp;文件中,以方便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>&nbsp;(英文)</li>
<li><a href="http://www.plantuml.com/running.html" target="_blank">在各种软件里运行PlantUML的相关配置</a>&nbsp;(英文)</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 &amp; 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">&nbsp;</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>顺序图用&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-&gt;</code>&nbsp;,&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">--&gt;</code>,&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;-</code>,&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;--</code>&nbsp;来绘制参与者(Participants)之 间的消息(Message)。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s1.png
Alice -&gt; Bob: Authentication Request
Bob --&gt; Alice: Authentication Response

Alice -&gt; Bob: Another atuhentication Request
Alice &lt;-- 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>申明参与者,可以使用&nbsp;<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>&nbsp;关键词,也可以使用下面的参与者 分类关键词来申明参与者:</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 -&gt; Foo2 : To boundary
Foo1 -&gt; Foo3 : To control
Foo1 -&gt; Foo4 : To entity
Foo1 -&gt; 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>使用&nbsp;<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>&nbsp;关键词可以为参与者起一个别名,这样在对引用长名的参与者时, 会方便很多。在参与者申明语句后行尾可以追加背景色的设置,只要把标准 的<a href="http://www.w3schools.com/HTML/html_colornames.asp" target="_blank">HTML颜色值</a>&nbsp;写在后面就行了。</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
'/

Alice -&gt; Bob: Authentication Request
Bob -&gt; Alice: Authentication Response
Bob -&gt; 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>针对非字母的参与者名,我们可以使用双引号,同样也可以为比较长的名字 起个别名,方法同上使用&nbsp;<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>&nbsp;关键词。</p>
<p>使用上面的关键词来申明参与者,是一种显示申明;而采用引号来申明参与 者则是一种隐示申明方法,它不需要专门的位置去定义。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s4.png
Alice -&gt; "Bob()" : Hello
"Bob()" -&gt; "This is very\nlong" as Long
' You can also declare:
' "Bob()" -&gt; Long as "This is very\nlong"
Long --&gt; "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>一个参与者可以给自己发送消息,消息名如果需要有多行文本,可以用&nbsp;<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>&nbsp;来表示换行。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s5.png
Alice -&gt; 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>使用&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">\</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">/</code>&nbsp;来替换&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&gt;</code>&nbsp;可以让箭头只显示上半部分或下半 部分。</li>
<li>重复输入箭头或斜杠(&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&gt;&gt;</code>&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">//</code>&nbsp;),用来绘制空心箭头。</li>
<li>使用双横线&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">--</code>&nbsp;替代&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-</code>&nbsp;可以用来绘制点线。</li>
<li>在箭头后面加个&nbsp;<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>&nbsp;可以在箭头前绘制一个圆圈。</li>
<li>使用&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;-&gt;</code>&nbsp;可用来绘制双向箭头。</li>
</ul>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s6.png
Bob -&gt; Alice
Bob -&gt;&gt; Alice
Bob -\ Alice
Bob \\- Alice
Bob //-- Alice

Bob -&gt;o Alice
Bob o\\-- Alice

Bob &lt;-&gt; Alice
Bob &lt;&lt;-\\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]&gt; Alice : hello
Alice -[#0000FF]-&gt;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>关键词&nbsp;<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>&nbsp;用来给自动的给消息添加上序号。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s8.png
autonumber
Bob -&gt; Alice : Authentication Request
Bob &lt;- 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>如果需要指定一个起始号码,可以直接在&nbsp;<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>&nbsp;后面加个数字就行 了,如果要设置自增量,再在后面加一个数字就行了(&nbsp;<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>&nbsp;)。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s9.png
autonumber
Bob -&gt; Alice : Authentication Request
Bob &lt;- Alice : Authentication Response

autonumber 15
Bob -&gt; Alice : Another authentication Request
Bob &lt;- Alice : Another authentication Response

autonumber 40 10
Bob -&gt; Alice : Yet another authentication Request
Bob &lt;- 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>&nbsp;来执行的(&nbsp;<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>&nbsp;表示数字,&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">#</code>&nbsp;缺省补零位数)。</p>
<p>同样的,也可以使用一些HTML标签来控制数字的样式。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s10.png
autonumber "&lt;b&gt;[000]"
Bob -&gt; Alice : Authentication Request
Bob &lt;- Alice : Authentication Response

autonumber 15 "&lt;b&gt;(&lt;u&gt;##&lt;/u&gt;)"
Bob -&gt; Alice : Another authentication Request
Bob &lt;- Alice : Another authentication Response

autonumber 40 10 "&lt;font color=red&gt;Message 0 "
Bob -&gt; Alice : Yet another authentication Request
Bob &lt;- 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>要给图形加一个标题可以用&nbsp;<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>&nbsp;关键词来设置。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s11.png
title Simple Comunication example

Alice -&gt; Bob : Authentication Request
Bob --&gt; 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>使用&nbsp;<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>&nbsp;和&nbsp;<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>&nbsp;关键词可以设置图形的图例。图例可以设 为左对齐、右对齐和居中对齐。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s12.png
Alice -&gt; 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>关键词&nbsp;<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>&nbsp;是用来把图形分割成几个图片的。每一个被分割出来的 图片可以看作是一个新的页面(&nbsp;<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>&nbsp;),如果要给新的页面添加一 个标题,可以紧跟在关键词&nbsp;<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>&nbsp;之后来设置。</p>
<p>使用这个方法可以方便的在Word里把比较长的图形分别打印到几个不同的页 面上(有点分页符的概念)。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s13.png
Bliss -&gt; Tia : I love you
Bliss -&gt; Tia : I miss you

newpage

Bliss -&gt; Tia : Let's go home
Bliss -&gt; Tia : Quick

newpage A title for the\nlast page

Tia -&gt; Bliss : Give me money
Tia -&gt; 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>上面的关键词后可以添加一些文本用来显示在头部(注:&nbsp;<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>&nbsp;除外,因 为它后面的文本用来显示在组名称的位置)。在组嵌套组的结构里可以用关 键词<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>&nbsp;来关闭组或者说是表示一个组符号的结束符(类似&nbsp;<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>&nbsp;)。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s14.png
Alice -&gt; Bob: Authentication Request

alt successful case
Bob -&gt; Alice: Authentication Accepted
else some kind of failure
Bob -&gt; Alice: Atuhentication Failue
group My own label
Alice -&gt; Log : Log attack start
loop 1000 times
Alice -&gt; Bob: DNS Attack
end
Alice -&gt; Log : Loag alice end
end
else Another type of failue
Bob -&gt; 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>我们可能经常会在消息的左边或右边使用注解,要添加注解,只要使用&nbsp;<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>&nbsp;或&nbsp;<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>&nbsp;关键词就可以了。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s15.png
Alice -&gt; Bob : hello
note left: this is a first note

Bob -&gt; Alice : ok
note right: this is anther note

Bob -&gt; 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>通过使用关键词&nbsp;<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>&nbsp;,&nbsp;<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>&nbsp;或&nbsp;<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>&nbsp;, 我们还可以把注解放置在与之相关的参与者的左边或右边,或下方。</p>
<p>通过改变注解的<a href="http://www.w3schools.com/HTML/html_colornames.asp" target="_blank">背景色</a>,我们还可以高亮一个注解文本块。</p>
<p>如果要使用多行注解,可以使用关键词&nbsp;<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>&nbsp;来表示注解的结束。</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;">&lt;b&gt;</code>&nbsp;加粗文本</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;">&lt;u&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;u:#AAAAAA&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;u:colorName&gt;</code>&nbsp;用来加下划线</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;">&lt;i&gt;</code>&nbsp;斜体</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;">&lt;s&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;s:#AAAAAA&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;s:colorName&gt;</code>&nbsp;用来加删除线</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;">&lt;w&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;w:#AAAAAA&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;w:colorName&gt;</code>&nbsp;用来加波浪线</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;">&lt;color:#AAAAAA&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;color:colorName&gt;</code>&nbsp;用来设置文本颜色</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;">&lt;back:#AAAAAA&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;back:colorName&gt;</code>&nbsp;用来设置背景色</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;">&lt;size:nn&gt;</code>&nbsp;设置字体大小</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;">&lt;img src="file"&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;img:file&gt;</code>&nbsp;用来添加图片,图片文件必须 是可以访问得到才行。</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;">&lt;img src="http://url"&gt;</code>&nbsp;或&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">&lt;img:http://url&gt;</code>&nbsp;用来添加一个互 联网图片,同样的图片地址必须是可用的才行。</li>
</ul>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-s17.png
participant Alice
participant "The &lt;b&gt;Famous&lt;/b&gt; Bob" as Bob

Alice -&gt; Bob : A &lt;i&gt;well formated&lt;/i&gt; message
note right of Alice
This is &lt;back:cadetblue&gt;&lt;size:18&gt;displayed&lt;/size&gt;&lt;/back&gt;
&lt;u&gt;left of&lt;/u&gt; Alice.
end note
note left of Bob
&lt;u:red&gt;This&lt;/u&gt; is &lt;color #118888&gt;displayed&lt;/color&gt;
&lt;b&gt;&lt;color purple&gt;left of&lt;/color&gt; &lt;s:red&gt;Alice&lt;/strike&gt; Bob&lt;/b&gt;
end note
note over Alice, Bob
&lt;w:#FF33FF&gt;This is hosted&lt;/w&gt; by &lt;img ../img/code.png&gt;
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>用例可以用一对小括号括起来表示,也可以使用&nbsp;<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>&nbsp;关键词来定义。 用例也可以通过使用&nbsp;<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>&nbsp;关键词来设置别名,在建立关系的时候可以使用 别名。</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>定义参与者时,可以把参与者的名称放在两个冒号的中间,也可以用&nbsp;<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>&nbsp;关键词来定义参与者。同样参与着也可以使用别名。</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) .&gt; (payment) : include
(help) .&gt; (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 &gt;
Department "*" --* "0..1" Department
Office &lt;|-do- Headquarters
Department "*" -do- "member 1..*" Person
Person "1 {subsets member}" -u- "*" Department : manager
Person .ri.&gt; ContactInformation
Person ..&gt; 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>在活动图中,你可以使用&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">(*)</code>&nbsp;来表示活动开始点和结束点。使用&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">--&gt;</code>&nbsp;来表示箭头。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a1.png
(*) --&gt; "First Activity"
"First Activity" --&gt; (*)
#+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>缺省情况下,活动图的箭头是没有标注的。但我们可以通过方括号&nbsp;<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
(*) --&gt; "First Activity"
--&gt;[You can put also labels] "Second Activity"
--&gt;(*)
#+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>我们可以使用&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-&gt;</code>&nbsp;创建一个水平箭头,也可以通过下面的方式来改变箭头 的方向:</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-&gt;</code>&nbsp;向下(这个是默认的,等同于 =–&gt;=)</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-&gt;</code>&nbsp;向右</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-&gt;</code>&nbsp;向左</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-&gt;</code>&nbsp;向上</li>
</ul>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a3.png
(*) --&gt; "1"
-right-&gt; "2"
-down-&gt; "3"
-left-&gt; "4"
-le-&gt; "5"
-up-&gt; "6"
-l-&gt; "7"
-do-&gt; "8"
-d-&gt; "9"
-&gt; "10"
--&gt; (*)
#+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>在描述箭头时,&nbsp;<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>&nbsp;这几个单词的写法可以简化, 用单词开头的一个或两个字母来替换就行了,比如&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-down-&gt;</code>&nbsp;也可以写成&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-d-&gt;</code>&nbsp;或者<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">-do-&gt;</code>&nbsp;。</p>
</div>
</li>
<li><a id="orgc4f24e5" target="_blank"></a>分支(Branches)
<div id="text-orgc4f24e5" class="outline-text-4">
<p>在PlantUML里,我们可以使用&nbsp;<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>&nbsp;关键词来定义分支。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a4.png
(*) --&gt; "Initialisation"

if " Some Test" then
--&gt;[ture] "Some Activity"
--&gt; "Another Activity"
-right-&gt; (*)
else
-&gt;[false] "Something else"
--&gt;[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
(*) --&gt; if "Some Test" then
--&gt;[true] "1"

if "" then
-&gt; "3" as a3
else
if "Other test" then
-left-&gt; "5"
--&gt; (*)
else
--&gt; "6"
--&gt; (*)
endif
endif

else
-&gt;[false] "2"
--&gt; (*)
endif

a3 --&gt; if "last test" then
--&gt; "7"
--&gt; (*)
else
-&gt; "8"
--&gt; (*)
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
(*) --&gt; ===B1===
--&gt; "parallel Activity 1"
--&gt; ===B2===

===B1=== --&gt; "Parallel Activity 2"
--&gt; ===B2===

--&gt; (*)
#+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
(*) --&gt; "Select site"
--&gt; "Commission architect"
--&gt; "Develop plan"
--&gt; "Bid plan" as bp
if "" then
--&gt;[else] ===B1===
--&gt; "Do site work"
--&gt; ===B2===
===B1=== --&gt; "Do trade work"
--&gt; ===B2===
--&gt; "Finish construction"
--&gt; (*)
else
-u-&gt;[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>在定义活动的时候,有时候需要用多行文字来描述这个活动,这时我们可以 在描述里添加换行符&nbsp;<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>&nbsp;,也可以使用少量的HTML标签。</p>
<p>以下是可以使用的HTML标签:</p>
<pre name="code" class="example">&lt;b&gt;
&lt;i&gt;
&lt;font size="nn"&gt; or &lt;size:nn&gt; to change font size
&lt;font color="#AAAAAA"&gt; or &lt;font color="colorName"&gt;
&lt;color:#AAAAAA&gt; or &lt;color:colorName&gt;
&lt;img:file.png&gt; 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-&gt; "this &lt;size:20&gt;activity&lt;/size&gt;
<span class="linenr">3: is &lt;b&gt;very&lt;/b&gt; &lt;color:red&gt;long&lt;/color&gt;
<span class="linenr">4: and defined on serveral lines
<span id="coderef-alias" class="coderef-off"><span class="linenr">5: that contains many &lt;i&gt;text&lt;/i&gt;" as A1
<span class="linenr">6: -up-&gt; "Another activity\n on serveral lines"
<span class="linenr">7:
<span id="coderef-useA1" class="coderef-off"><span class="linenr">8: A1 --&gt; "Short activity\n&lt;img:../img/code.png&gt;"
<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可以通过在脚本里使用&nbsp;<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>&nbsp;来添加注释文本块。</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用上面列表里的命令来标注一个注释块的开始,然后用&nbsp;<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
(*) --&gt; "Some Activity" as s
note right: This activity has to be defined
s --&gt; (*)
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>通过分区关键词&nbsp;<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>&nbsp;可以定义一个分区,并且可以使用HTML的 颜色码或颜色名来设置分区的背景色。在你申明一个活动时,PlantUML会自动 的把这个活动对象放置到最后使用的分区中。当然,也可以使用&nbsp;<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>&nbsp;关闭分区定义。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a10.png
partition Conductor
(*) --&gt; "Climbs on Platform"
--&gt; === S1 ===
--&gt; Bows
end partition

partition Aduience #LightSkyBlue
=== S1 === --&gt; Applauds

partition Conductor
Bows --&gt; === S2 ===
--&gt; WavesArmes
Applauds --&gt; === S2 ===
end partition

partition Orchestra #CCCCEE
WavesArmes --&gt; Introduction
--&gt; "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>标题关键词&nbsp;<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>&nbsp;用来设置一个图形的标题文本,我们可以在&nbsp;<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>&nbsp;和<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>&nbsp;两个关键词之间放置比较长的标题文本。</p>
<pre name="code" class="example">#+BEGIN_SRC plantuml :file ../img/plantuml-quickstart-a11.png
title Simple example\nof title
(*) --&gt; "First activity"
--&gt; (*)
#+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>皮肤命令&nbsp;<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>&nbsp;可以改变图形的颜色和字体。这些命令可以在以下 的位置中使用:</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

(*) --&gt; "Climbs on Platform"
--&gt; === S1 ===
--&gt; Bows
--&gt; === S2 ===
--&gt; WavesArmes
--&gt; (*)
#+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>使用&nbsp;<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>&nbsp;命令可以把活动图形改成八角 形的。(好像没效果!)</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

(*) --&gt; "ClickServlet.handleRequest()"
--&gt; "new Page"

if "Page.onSecurityCheck" then
-&gt;[true] "Page.onInit()"

if "isForward?" then
-&gt;[no] "Process controls"

if "continue processing?" then
--&gt;[yes] ===RENDERING===
else
--&gt;[no] ===REDIRECT_CHECK===
endif

else
--&gt;[yes] ===RENDERING===
endif

if "is Post?" then
--&gt;[yes] "Page.onPost()"
--&gt; "Page.onRender()" as render
--&gt; ===REDIRECT_CHECK===
else
--&gt;[no] "Page.onGet()"
--&gt; render
endif

else
--&gt;[false] ===REDIRECT_CHECK===
endif

if "Do redirect?" then
-&gt;[yes] "redirect request"
--&gt; ==BEFORE_DESTORY===
else
if "Do Forward?" then
-left-&gt;[yes] "Forward request"
--&gt; ==BEFORE_DESTORY===
else
-right-&gt;[no] "Render page template"
--&gt; ==BEFORE_DESTORY===
endif
endif

--&gt; "Page.onDestory()"
--&gt;(*)
#+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版本的活动图简化了活动图的符号定义,从&nbsp;<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>&nbsp;这个版本开始, PlantUML就开始引入了一些简化写法,当然到目前(20140627)为止还不是 很完善,但这个版本里的一些简化写法已经是PlantUML后续版本的发展方向。</p>
<p>下文中将会用几个简单的示例来介绍Beta版活动图的新功能,有兴趣的朋友 也可以试一下,在使用新的写法之前需要把&nbsp;<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>&nbsp;更新到最新版本。</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>在这个例子里,活动元素从一个&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">:</code>&nbsp;开始,然后到一个&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">;</code>&nbsp;结束。 开始和结束符号,可以用&nbsp;<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>&nbsp;和&nbsp;<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>&nbsp;两个关键词来表示。之前版 本的开始和结束符都是用同一个符号&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">(*)</code>&nbsp;来表示的,个人觉得新的写法 逻辑更清晰,代码可读性更高。</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>和之前一样,还是使用&nbsp;<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>&nbsp;,&nbsp;<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>&nbsp;和&nbsp;<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>&nbsp;关键词,但分支条件的 标签<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>&nbsp;可以直接写在关键词&nbsp;<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>&nbsp;和&nbsp;<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>&nbsp;的后面,并用小括 号括起来就可以了(如:&nbsp;<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>&nbsp;)。</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>在新版本里除了使用&nbsp;<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>&nbsp;外,还新加了一个&nbsp;<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>&nbsp;关键词,有了这 个语法,我们就可以绘制一系列条件的活动图。</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>通过&nbsp;<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>&nbsp;和&nbsp;<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>&nbsp;关键词可以创建循环结构的图形。</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>要创建条件循环结构的图形可以通过使用&nbsp;<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>&nbsp;和&nbsp;<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>&nbsp;两个关 键词来实现。如果要给条件分支加上标注,可以在&nbsp;<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>&nbsp;条件后加上一 个&nbsp;<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>&nbsp;关键词,然后用小括号括上要标注的内容;在&nbsp;<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>&nbsp;后可 以直接用小括号括上要标注的内容。</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>&nbsp;,&nbsp;<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>&nbsp;和&nbsp;<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>&nbsp;三个关键词用来表示并行处理结 构。</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>注解里的文本样式是通过&nbsp;<a href="http://www.plantuml.com/creole.html" target="_blank">Creole wiki syntax</a>&nbsp;来实现的。关于<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 &lt;b&gt;HTML&lt;/b&gt;
====
* 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>为活动元素指定背景色可以直接在活动开始标记&nbsp;<code style="padding: 0.25em 0.5em; color: #bf616a; font-family: Menlo, Monaco, 'Courier New', monospace; font-size: 13.6px; background-color: #f9f9f9;">:</code>&nbsp;前加上颜色描述符:</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>) &nbsp;<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>

plantuml 基本语法(转摘)的更多相关文章

  1. Android Studio UML 插件 PlantUML 使用语法

    活动标签(activity label)以冒号开始,以分号结束. 文本格式支持creole wiki语法. 活动默认安装它们定义的顺序就行连接. @startuml :Hello world; :Th ...

  2. plantuml语法

    活动图(新语法) 当前活动图(activity diagram)的语法有诸多限制和缺点,比如代码难以维护. 所以从V7947开始提出一种全新的.更好的语法格式和软件实现供用户使用(beta版). 就像 ...

  3. (一)PlantUML 语法之时序图

    文章目录 前言 `-> -->` 信息传递 声明参与者的几个关键字 `as` 重命名参与者 `#` 添加颜色 `order` 定义参与者顺序 `""` 参与者名字 给自 ...

  4. c#与wpf的一些基础语法问题(摘用)

    1 .在vs里不同cs文件,位于同一个namespace,是什么情况. 答:http://msdn.microsoft.com/zh-cn/library/0d941h9d(v=vs.80).aspx ...

  5. Android Studio插件:PlantUML

    标记语言式的UML图编写工具,插件全名:PlantUML integration. 注意这个还要安装另一个软件:http://www.graphviz.org 并在PlantUML的设置中指定其路径. ...

  6. 【转】使用Sublime + PlantUML高效地画图

    project: blog status: publish target: how-to-use-sublime-and-plant-uml-draw-diagram.md date: 2015-12 ...

  7. [Android新手区] SQLite 操作详解--SQL语法

    该文章完全摘自转自:北大青鸟[Android新手区] SQLite 操作详解--SQL语法  :http://home.bdqn.cn/thread-49363-1-1.html SQLite库可以解 ...

  8. 图解SQL的Join(转摘)

    转摘网址:http://coolshell.cn/articles/3463.html 对于SQL的Join,在学习起来可能是比较乱的.我们知道,SQL的Join语法有很多inner的,有outer的 ...

  9. 【转】Lua脚本语法说明简介

    Lua 的语法比较简单,学习起来也比较省力,但功能却并不弱. 所以,我只简单的归纳一下Lua的一些语法规则,使用起来方便好查就可以了.估计看完了,就懂得怎么写Lua程序了. 在Lua中,一切都是变量, ...

随机推荐

  1. 控制shell终端提示符格式和颜色

    字体颜色值 (ASCII) 背景颜色值 (ASCII) 显示颜色 30 40 黑色 31 41 红色 32 42 绿色 33 43 黄色 34 44 蓝色 35 45 紫红色 36 46 青蓝色 37 ...

  2. [Python] list vs tupple

    前言 列表(list)和 元组(tupple) 是 Python 中常见的两种数据结构.这两者使用方法有一定的相似,俩者都是 Python 内置类型,都可以保存数据集合,都可以保存复合数据,我们同样可 ...

  3. Python 简明教程 --- 21,Python 继承与多态

    微信公众号:码农充电站pro 个人主页:https://codeshellme.github.io 程序不是年轻的专利,但是,它属于年轻. 目录 我们已经知道封装,继承和多态 是面向对象的三大特征,面 ...

  4. Flv.js文档使用随记

    关键字:Flv.js | Flv js | Flv-js | HTML5 FLV Player | 0x001: 前言以下涉及到 flv.js 所有内容均是V1.5.0版本内的,如方法.属性.常量.监 ...

  5. pandas 模拟生成数据集的快速方法

    快速生成一个DataFrame的方法: #模拟生成数据集的方法 import pandas as pd import numpy as np boolean=[True,False] gender=[ ...

  6. #pragma comment(linker,"/SECTION:shared,RWS")

    Windows在一个Win32程序的地址空间周围筑了一道墙.通常,一个程序的地址空间中的数据是私有的,对别的程序而言是不可见的.但是执行多个执行实体表示了程序的所有执行实体之间共享数据是毫无问题的.当 ...

  7. Redis实例讲解

    简介 Redis是一个key-value的nosql产品,和我们熟知的Memcached有些类似,但他存储value类型相对更加丰富,包括string(字符串),list(链表),set(集合),zs ...

  8. 汉王JAVA笔试题

    汉王JAVA笔试题 1,jsp中动态include与静态include的区别? (1)动态包含总是会检查文件中的变化,适合用于包含动态页面,并且可以带参数. (2)静态包含不会检查所含文件的变化,适用 ...

  9. DVWA学习记录 PartⅧ

    Weak Session IDs 1. 题目 用户访问服务器的时候,为了区别多个用户,服务器都会给每一个用户分配一个 session id .用户拿到 session id 后就会保存到 cookie ...

  10. POJ 1063 Flip and Shift 最详细的解题报告

    题目来源:Flip and Shift 题目大意:一个椭圆形的环形容器中有黑色和白色两种盘子,问你是否可以将黑色的盘子连续的放在一起.你可以有以下两种操作: 1.顺时针旋转所有的盘子 2.顺时针旋转3 ...