📄 3activitydiagrams.html
字号:
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Together Tutorial -- Part 3</title>
<link href="tutor.css" rel="styleSheet" type="text/css">
</head>
<body bgcolor="white" link="#003399" alink="#999999" vlink="#000066">
<p class="head2" align="left"><span style="font-size: 9pt"><a href="mailto:%20e.w@263.net">翻译: 李颖(e.w@263.net)</a></span></p>
<center>
<p class="head2" align="center"><a name="top"></a>Together 教程<br>
3: 业务规则与活动图</p>
</center>
<p>业务规则中包含了问题的部分需求.
在前面用例图的讨论中我们将航空公司的需求限制为以下四点:</p>
<ul>
<li>预定航班.
<li>购买机票.</li>
<li>确定航班上是否还有足够的座位可以预定.
<li>计算航班的机票收入总数.
</ul>
<p>在这一课中,
我们将通过活动图来确定 "预定航班"
的具体含义.</p>
<p><b>目录:</b></p>
<ul>
<li><a class="onPage" href="#business">基于业务规则创建活动图</a>
<li><a class="onPage" href="#swim">使用泳道来组织活动,
开始状态和结束状态</a>
<li><a class="onPage" href="#activity">创建活动和转换</a>
<li><a class="onPage" href="#fork">使用分支,
合并和决策改变控制流</a>
<li><a class="onPage" href="#tip">技巧</a>
</li>
</ul>
<p></p>
<p><img height="2" width="900" src="images/generic/rainbow2.gif"></p>
<p class="head3"><a name="business"></a>基于业务规则创建活动图</p>
<p>你怎样才能 "预定航班"
呢? 我们的航空公司使用以下业务规则
(不可否认非常幼稚):</p>
<dl>
<dd><b>如果售出的机票数不超过该航班容量,
那么你可以预定航班.</b>
</dl>
<p>现在我们来关心一下当用户请求预定航班时到底发生了哪些事情.</p>
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#993300" width="100%">
<tr>
<td bgcolor="#993300">
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#ffffcc" width="100%">
<tr>
<td bgcolor="#ffffcc"><b>操作步骤:</b>
在 <default>
模型图中新建一个活动图,
命名为 <nobr><b>Request Reservation</b></nobr>.</td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc">
<tr>
<td bgcolor="#cccccc">
<table border="0" cellpadding="5" cellspacing="2">
<tr>
<td valign="top" bgcolor="white">
<p>点击 Designer
面板水平工具条中的"New
Diagram"按纽<nobr>(</nobr><nobr><img src="images/icons/diagrambutton.gif" width="12" height="14" border="0" alt="New diagram icon" hspace="2"></nobr><nobr>)</nobr>.</p>
<p>模型图名称在
"New Diagram"
对话框最上方的文本框中.</p>
<p>我们再次看道,
描述信息对文档时很重要的,
Together
可以用描述信息来生成工程文档.</p>
<p><img src="images/airline/includeincurrentdiag.gif" width="145" height="14" border="0" alt="include" hspace="5"></p>
<p>如果你选择了
"include in current diagram," <default>
模型图中将显示活动图的一个快捷方式.</p>
<p><img src="images/airline/activitydiagramshortcut.gif" width="127" height="63" border="0" hspace="5" alt="Shortcut node" vspace="5"></p>
</td>
<td valign="top" bgcolor="white"><img src="images/airline/activitydialogwindow1.png" width="596" height="416" border="0" alt="New diagram window" hspace="5"></td>
</tr>
</table>
</td>
</tr>
</table>
<p>在这一课中,
垂直工具条中的下列八个活动图按纽是非常有用的.</p>
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#cccccc">
<tr>
<td bgcolor="#cccccc">
<table border="0" cellpadding="2" cellspacing="2">
<tr>
<td align="center" valign="middle" bgcolor="white"><img src="images/icons/swimlaneicon.gif" width="15" height="8" border="0" hspace="1" alt="Swimlane icon"></td>
<td bgcolor="white">泳道</td>
<td bgcolor="white"><img src="images/icons/activitytransitionicon.gif" width="15" height="15" border="0" hspace="5" vspace="2" alt="Icon"></td>
<td bgcolor="white">转换</td>
</tr>
<tr>
<td align="center" valign="middle" bgcolor="white"><img src="images/icons/startactivityicon.gif" width="6" height="6" border="0" alt="Start button" hspace="5" align="bottom" vspace="2"></td>
<td bgcolor="white">开始状态</td>
<td bgcolor="white"><img src="images/icons/horizontalforkicon.gif" width="15" height="16" border="0" alt="Icon" hspace="5" vspace="2"></td>
<td bgcolor="white">水平分支</td>
</tr>
<tr>
<td align="center" valign="middle" bgcolor="white"><img src="images/icons/stopactivityicon.gif" width="12" height="12" border="0" align="top" alt="Stop button" hspace="5" vspace="2"></td>
<td bgcolor="white">结束状态</td>
<td bgcolor="white"><img src="images/icons/veticalforkicon.gif" width="16" height="15" border="0" alt="Icon" hspace="5" vspace="2"></td>
<td bgcolor="white">垂直分支</td>
</tr>
<tr>
<td align="center" valign="middle" bgcolor="white"><img src="images/icons/activitybuttonicon.gif" width="16" height="11" border="0" hspace="5" vspace="2" alt="Icon"></td>
<td bgcolor="white">活动</td>
<td bgcolor="white"><img src="images/icons/activitydecisionicon.gif" width="14" height="14" border="0" hspace="5" vspace="2" alt="Icon"></td>
<td bgcolor="white">决策</td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<hr>
<p class="head3"><a name="swim"></a>使用泳道来组织活动,
开始状态和结束状态</p>
<p>我们把 "预定航班"
的请求分为三个部分.</p>
<ul>
<li><b>Airplane/Flight Description</b>
用于航班容量
<li><b>Flight Reservations</b>
用于已预定信息的列表
<li><b>Reservation/Ticket Services</b>
用于创建预定信息并发出机票
</ul>
<p>现在确定泳道与实际对象的对应关系还太早.
我们可以等到设计类图时再做决定!</p>
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#993300" width="100%">
<tr>
<td bgcolor="#993300">
<table border="0" cellpadding="0" cellspacing="2" bgcolor="#ffffcc" width="100%">
<tr>
<td bgcolor="#ffffcc"><b>操作步骤:</b>
在模型图中建立三个泳道.
<ol>
<li><b>Airplane/Flight Description</b>
在左侧
<li><b>Flight Reservations</b>
在中间
<li><b>Reservation/Ticket Services</b>
在右侧
</ol>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#cccccc">
<tr>
<td bgcolor="#cccccc">
<table border="0" cellpadding="5" cellspacing="2">
<tr>
<td valign="top" bgcolor="white">
<p>要创建泳道,
点击 Diagram
面板垂直工具条中的
"swimlane" 按纽<nobr>(</nobr><nobr><img src="images/icons/swimlaneicon.gif" width="15" height="8" border="0" hspace="1" alt="Swimlane icon"></nobr><nobr>)</nobr>即可.</p>
<p>你可以点击泳道名称,
并在内嵌编辑器中修改其名称.
你也可以拖动它的一个角来修改其大小.</p>
</td>
<td valign="top" bgcolor="white"><img src="images/airline/adchangename.png" width="334" height="92" border="0"></td>
</tr>
</table>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -