You are on page 1of 475

Visual Paradigm for the

Unified Modeling Language


VP-UML 2.0

Tutorial
Table of contents

Table Of contents
Table Of contents .......................................................................................................................................... 1
Table of Figures............................................................................................................................................. 6
Table of tables ............................................................................................................................................... 6
Case Study..................................................................................................................................................... 6
Chapter 2 Textual Analysis............................................................................................................................ 6
What is Textual Analysis? ..................................................................................................................... 6
Creating a Document for Textual Analysis............................................................................................ 6
The Textual Analysis Toolbar................................................................................................................ 6
Importing a Text File as the Problem Statement............................................................................ 6
Searching Text in the Problem Statement...................................................................................... 6
Creating a New Candidate Item .................................................................................................... 6
Showing/Hiding a Type of Candidates.......................................................................................... 6
Rearranging the Locations of Candidate Classes .......................................................................... 6
Setting the Textual Analysis Window Layout ............................................................................... 6
Editing the Candidates in Candidate Table.................................................................................... 6
Creating Models for Existing Candidates...................................................................................... 6
Adding Generated Models on Diagrams ....................................................................................... 6
Exercise................................................................................................................................................. 6
Chapter 3 Use Case Diagram ........................................................................................................................ 6
What is a Use Case Diagram? ............................................................................................................... 6
Creating a Use Case Diagram ............................................................................................................... 6
The Use Case Diagram Palette.............................................................................................................. 6
Drawing a Use Case Diagram ............................................................................................................... 6
Creating a Use Case ...................................................................................................................... 6
Creating an Actor .......................................................................................................................... 6
Creating a System.......................................................................................................................... 6
Creating a Collaboration ............................................................................................................... 6
Creating an Association Link ........................................................................................................ 6
Defining the Multiplicity of a Role of an Association Link .......................................................... 6
Creating an <<extend>> Relationship Link .................................................................................. 6
Defining Extension Point .............................................................................................................. 6
Creating an <<include>> Relationship Link ................................................................................. 6
Creating a Generalization Relationship Link ................................................................................ 6
Editing the Use Case Specification ............................................................................................... 6
Editing the Use Case Description.................................................................................................. 6
Performing Textual Analysis with a Use Case .............................................................................. 6
Editing the Actor Specification ..................................................................................................... 6
Scheduling the use cases ............................................................................................................... 6
Generating Sequence Diagram with a Use Case ........................................................................... 6
Example......................................................................................................................................... 6
Exercise................................................................................................................................................. 6

1
Table of contents

Chapter 4 Sequence Diagram........................................................................................................................ 6


What is a Sequence Diagram?............................................................................................................... 6
Creating a Sequence Diagram ............................................................................................................... 6
The Sequence Diagram Palette.............................................................................................................. 6
Drawing a Sequence Diagram............................................................................................................... 6
Creating an Actor .......................................................................................................................... 6
Creating an Object......................................................................................................................... 6
Creating a Message ....................................................................................................................... 6
Creating a Constraint..................................................................................................................... 6
Creating a Duration Message ........................................................................................................ 6
Creating a Self Message ................................................................................................................ 6
Creating a Create Message ............................................................................................................ 6
Creating a Concurrent ................................................................................................................... 6
Creating a Recursive ..................................................................................................................... 6
Creating a Subsystem .................................................................................................................. 6
Editing an Actor Specification ...................................................................................................... 6
Editing an Object Specification..................................................................................................... 6
Editing a Message Type................................................................................................................. 6
Setting Base Classifier .................................................................................................................. 6
Setting Object Active .................................................................................................................... 6
Setting Show Destruction.............................................................................................................. 6
Generating a Collaboration Diagram............................................................................................. 6
Example......................................................................................................................................... 6
Exercise................................................................................................................................................. 6
Chapter 5 Activity Diagram .......................................................................................................................... 6
What is an Activity Diagram? ............................................................................................................... 6
Creating an Activity Diagram ............................................................................................................... 6
The Activity Diagram Palette ................................................................................................................ 6
Drawing an Activity Diagram ............................................................................................................... 6
Creating an Action State................................................................................................................ 6
Creating a Sub Activity ................................................................................................................. 6
Create an Initial State .................................................................................................................... 6
Create a Final State........................................................................................................................ 6
Creating a Horizontal Synchronization ......................................................................................... 6
Creating a Vertical Synchronization .............................................................................................. 6
Creating a Decision Point.............................................................................................................. 6
Creating a Signal Receipt .............................................................................................................. 6
Creating a Signal Sending ............................................................................................................. 6
Creating an Object......................................................................................................................... 6
Creating a Transition ..................................................................................................................... 6
Creating an Object Flow................................................................................................................ 6
Creating a Swimlane ..................................................................................................................... 6
Example......................................................................................................................................... 6
Exercise................................................................................................................................................. 6

2
Table of contents

Chapter 6 Collaboration Diagram ................................................................................................................. 6


What is Collaboration Diagram? ........................................................................................................... 6
Creating a Collaboration Diagram ........................................................................................................ 6
The Collaboration Diagram Palette ....................................................................................................... 6
Drawing a Collaboration Diagram ........................................................................................................ 6
Creating an Object......................................................................................................................... 6
Creating an Actor .......................................................................................................................... 6
Creating a Package ........................................................................................................................ 6
Creating a Subsystem .................................................................................................................... 6
Creating a Classifier Role.............................................................................................................. 6
Creating a Link.............................................................................................................................. 6
Creating an Association Role ........................................................................................................ 6
Creating a Message to ................................................................................................................... 6
Creating a Message from............................................................................................................... 6
Reorder Sequence Numbers of Messages ..................................................................................... 6
Creating a Swimlane ..................................................................................................................... 6
Creating a Generalization Relationship......................................................................................... 6
Editing an Object Specification..................................................................................................... 6
Editing an Actor Specification ...................................................................................................... 6
Generating a Sequence Diagram ................................................................................................... 6
Example......................................................................................................................................... 6
Exercise................................................................................................................................................. 6
Chapter 7 State Diagram ............................................................................................................................... 6
What is a State Diagram? ...................................................................................................................... 6
Creating a State Diagram ...................................................................................................................... 6
The State Diagram Palette..................................................................................................................... 6
Drawing a State Diagram ...................................................................................................................... 6
Creating an Initial State ................................................................................................................. 6
Creating a State ............................................................................................................................. 6
Creating a Concurrent State........................................................................................................... 6
Creating a Submachine State......................................................................................................... 6
Creating a Call State...................................................................................................................... 6
Creating an Action State................................................................................................................ 6
Creating a Junction Point .............................................................................................................. 6
Creating a State Dynamic Choice Point ........................................................................................ 6
Creating a History State ................................................................................................................ 6
Creating a Transition ..................................................................................................................... 6
Creating a Synch state ................................................................................................................... 6
Creating a Vertical Synchronization Bar ....................................................................................... 6
Creating a Horizontal Synchronization Bar................................................................................... 6
Editing a State Object Specification.............................................................................................. 6
Example......................................................................................................................................... 6
Exercise................................................................................................................................................. 6
Chapter 8 Class Diagram .............................................................................................................................. 6

3
Table of contents

What is a Class Diagram? ..................................................................................................................... 6


Creating a Class Diagram...................................................................................................................... 6
The Class Diagram Palette .................................................................................................................... 6
Creating a Class............................................................................................................................. 6
Adding an Attribute....................................................................................................................... 6
Adding an Operation ..................................................................................................................... 6
Sorting Attributes and Operations ................................................................................................. 6
Visibility Setting............................................................................................................................ 6
Defining an Abstract Class ............................................................................................................ 6
Defining Active Class.................................................................................................................... 6
Defining the Stereotype of a Class ................................................................................................ 6
Creating a Package ........................................................................................................................ 6
Creating a Collaboration ............................................................................................................... 6
Defining a Constraint .................................................................................................................... 6
Creating an Association Link ........................................................................................................ 6
Creating an Aggregation Relationship Link .................................................................................. 6
Creating a Composition Relationship Link ................................................................................... 6
Defining a Association Role.......................................................................................................... 6
Creating a Generalization Relationship Link ................................................................................ 6
Creating a Realization Relationship Link...................................................................................... 6
Creating a Dependency Relationship Link.................................................................................... 6
Creating an Association Class ....................................................................................................... 6
Creating an N-ary Association between Classes ........................................................................... 6
Creating a Containment Relationship............................................................................................ 6
Creating a Class Diagram with Real Time Code Generation ........................................................ 6
Real Time Code Generation for a Class ........................................................................................ 6
Real Time Code Generation for a Class Attribute ......................................................................... 6
Real Time Code Generation for a Class Operation ....................................................................... 6
Real Time Code Generation for a Class with Package .................................................................. 6
Real Time Code Generation for Importing a Package................................................................... 6
Real Time Code Generation for Importing a Class ....................................................................... 6
Example......................................................................................................................................... 6
Exercise................................................................................................................................................. 6
Chapter 9 Component Diagram..................................................................................................................... 6
Creating a Component Diagram............................................................................................................ 6
The Component Diagram Palette .......................................................................................................... 6
Drawing a Component Diagram............................................................................................................ 6
Creating a Component................................................................................................................... 6
Creating a Component Instance .................................................................................................... 6
Creating an Interface ..................................................................................................................... 6
Chapter 10 Deployment Diagram ................................................................................................................. 6
What is Deployment Diagram? ............................................................................................................. 6
Create a Deployment Diagram .............................................................................................................. 6
The Deployment Diagram Palette ......................................................................................................... 6

4
Table of contents

Draw Deployment Diagram .................................................................................................................. 6


Create Node................................................................................................................................... 6
Create Component......................................................................................................................... 6
Create Component......................................................................................................................... 6
Create Component Instance........................................................................................................... 6
Create Interface ............................................................................................................................. 6
Create Object................................................................................................................................. 6
Create Association Relationship.................................................................................................... 6
Creating a Dependency Relationship ............................................................................................ 6
Chapter 11 Report Generator ........................................................................................................................ 6
HTML Report........................................................................................................................................ 6
Generating HTML Report ............................................................................................................. 6
Browsing HTML Report Generated .............................................................................................. 6
PDF Report ........................................................................................................................................... 6
Generating PDF Report................................................................................................................. 6
Browsing PDF Report Generated.................................................................................................. 6
Chapter 12 Code Generation ......................................................................................................................... 6
Java Code Generation............................................................................................................................ 6
Syntax Checking for a Project....................................................................................................... 6
Checking Syntax for a Class ......................................................................................................... 6
Generating Code for a Project ....................................................................................................... 6
Generating Code for a Class.......................................................................................................... 6
Real-Time Code Generation.......................................................................................................... 6
Chapter 13 Code Reverse Engineering ......................................................................................................... 6
Java Code Reverse Engineering ............................................................................................................ 6
Real-Time Reverse Engineering for a Class.................................................................................. 6
Reverse Engineering from Java Files ............................................................................................ 6
Adding the reversed class models to class diagrams. .................................................................... 6
Updating Class Models from Java files......................................................................................... 6
Chapter 14 Print Preview Window................................................................................................................ 6
Print Preview Window .......................................................................................................................... 6
The Print Preview Toolbar .................................................................................................................... 6
Printing.................................................................................................................................................. 6
Printing Diagrams ......................................................................................................................... 6
Print Settings ................................................................................................................................. 6
Page Settings ................................................................................................................................. 6
Adjusting the Paper Margins ......................................................................................................... 6
Zooming ........................................................................................................................................ 6
Setting the Diagram Base Layout.................................................................................................. 6
Set Paper Place Style..................................................................................................................... 6
Fit to Ratio..................................................................................................................................... 6
Fit to Pages.................................................................................................................................... 6
Setting the Overlapping of a Diagram........................................................................................... 6
Showing the Image Clip Mark ...................................................................................................... 6

5
Table of contents

Editing the Header/Footer of the Pages......................................................................................... 6


Multi Page Mode........................................................................................................................... 6
Exit Print Preview Window........................................................................................................... 6

6
Table of figures

Table of Figures
Figure 2.1 A problem statement having textual analysis performed ............................................................. 6
Figure 2.2 Create Textual analysis by Menu ................................................................................................. 6
Figure 2.3 Create Textual Analysis by Toolbar ............................................................................................. 6
Figure 2.4 Create textual analysis by project explorer .................................................................................. 6
Figure 2.5 A blank new textual analysis document is created. ...................................................................... 6
Figure 2.6 A problem statement .................................................................................................................... 6
Figure 3.1 A use case diagram....................................................................................................................... 6
Figure 3.2 Create new use case using main menu......................................................................................... 6
Figure 3.3 Create use case using toolbar....................................................................................................... 6
Figure 3.4 Create use case using Project Explorer ........................................................................................ 6
Figure 3.5 A blank new use case diagram is created. .................................................................................... 6
Figure 3.6 Maintain Rental Records Use Case.............................................................................................. 6
Figure 3.7 Main Use Cases ........................................................................................................................... 6
Figure 3.8 Create an actor by resource centric .............................................................................................. 6
Figure 3.9 Create another use case................................................................................................................ 6
Figure 3.10 Another Actor............................................................................................................................. 6
Figure 3.11 Generalization of actor............................................................................................................... 6
Figure 3.12 Create an extend use case .......................................................................................................... 6
Figure 3.13 Completed use case diagram...................................................................................................... 6
Figure 3.14 Use Case Scheduling dialog....................................................................................................... 6
Figure 3.15 Justification of Main Rental Recrods......................................................................................... 6
Figure 3.16 Textual analysis.......................................................................................................................... 6
Figure 3.17 Find out candidate use case........................................................................................................ 6
Figure 3.18 A use case diagram .................................................................................................................. 6
Figure 4.1 Sequence Diagram ....................................................................................................................... 6
Figure 4.2 Create sequence diagram using menu bar.................................................................................... 6
Figure 4.3 Create sequence diagram using toolbar ....................................................................................... 6
Figure 4.4 Create sequence diagram using Project Explorer......................................................................... 6
Figure 4.5 A blank new sequence diagram is created.................................................................................... 6
Figure 4.6 Select an actor.............................................................................................................................. 6
Figure 4.7 Sequence Diagram Exercise ........................................................................................................ 6
Figure 5.1 An activity diagram...................................................................................................................... 6
Figure 5.2 Create activity diagram by menu ................................................................................................. 6
Figure 5.3 Create activity diagram by toolbar............................................................................................... 6
Figure 5.4 Create activity diagram by project explorer................................................................................. 6
Figure 5.5 A blank new activity diagram is created. ..................................................................................... 6
Figure 5.6 Initial State................................................................................................................................... 6
Figure 5.7 Create the actor state.................................................................................................................... 6
Figure 5.8 Create the decision point.............................................................................................................. 6
Figure 5.9 Create another decision point....................................................................................................... 6
Figure 5.10 Create another action state ......................................................................................................... 6

7
Table of figures

Figure 5.11 Create the final state................................................................................................................... 6


Figure 5.12 Completed Activity Diagram ..................................................................................................... 6
Figure 5.13 An activity diagram.................................................................................................................... 6
Figure 6.1 Collaboration Diagram ................................................................................................................ 6
Figure 6.2 A blank new collaboration diagram is created. ............................................................................ 6
Figure 6.3 Create a swimlane........................................................................................................................ 6
Figure 6.4 Give a name to swimlane............................................................................................................. 6
Figure 6.5 Create more swimlane ................................................................................................................. 6
Figure 6.6 Create an actor ............................................................................................................................. 6
Figure 6.7 Create another actor ..................................................................................................................... 6
Figure 6.8 Create an object ........................................................................................................................... 6
Figure 6.9 Open Sepcification....................................................................................................................... 6
Figure 6.10 Object specification dialog ........................................................................................................ 6
Figure 6.11 Change the stereotype of the object ........................................................................................... 6
Figure 6.12 Interface of Search Vehicle UI ................................................................................................... 6
Figure 6.13 Create another object ................................................................................................................. 6
Figure 6.14 Specification Dialog .................................................................................................................. 6
Figure 6.15 Set the stereotype as control ...................................................................................................... 6
Figure 6.16 Interface of Rental Vehicle control ............................................................................................ 6
Figure 6.17 Interface of the diagram ............................................................................................................. 6
Figure 6.18 To Message ................................................................................................................................ 6
Figure 6.19 Rename the message .................................................................................................................. 6
Figure 6.20 Completed Collaboration Diagram ............................................................................................ 6
Figure 6.21 Collaboration Diagram Exercise................................................................................................ 6
Figure 7.1 ...................................................................................................................................................... 6
Figure 7.2 Create State Diagram by menu .................................................................................................... 6
Figure 7.3 Create State Diagram by toolbar.................................................................................................. 6
Figure 7.4 Create State Diagram by Project Explorer ................................................................................... 6
Figure 7.5 A blank new state diagram is created. .......................................................................................... 6
Figure 7.6 Initial State button........................................................................................................................ 6
Figure 7.7 Create new state ........................................................................................................................... 6
Figure 7.8 Rename the state .......................................................................................................................... 6
Figure 7.9 Resize the state............................................................................................................................. 6
Figure 7.10 Drag the state ............................................................................................................................. 6
Figure 7.11 Rename the state ........................................................................................................................ 6
Figure 7.12 Give the name of state ............................................................................................................... 6
Figure 7.13 Create more states...................................................................................................................... 6
Figure 7.14 Connect the state........................................................................................................................ 6
Figure 7.15 Drag the Repairing state............................................................................................................. 6
Figure 7.16 Format the connector ................................................................................................................. 6
Figure 7.17 Drag to appropriate location ...................................................................................................... 6
Figure 7.18 Open Specification..................................................................................................................... 6
Figure 7.19 Specification Dialog .................................................................................................................. 6
Figure 7.20 Enter the name ........................................................................................................................... 6

8
Table of figures

Figure 7.21 Named transition........................................................................................................................ 6


Figure 7.22 Place the caption to a right place ............................................................................................... 6
Figure 7.23 Completed State Diagram .......................................................................................................... 6
Figure 7.24 Exercise state diagram. .............................................................................................................. 6
Figure 8.1 A class diagram. ........................................................................................................................... 6
Figure 8.2 A blank new class diagram is created........................................................................................... 6
Figure 8.4 A blank new class diagram is created........................................................................................... 6
Figure 8.5 The vehicle class .......................................................................................................................... 6
Figure 8.6 UML style of a class .................................................................................................................... 6
Figure 8.7 Create the Branch Class ............................................................................................................... 6
Figure 8.8 Define the multiplicity ................................................................................................................. 6
Figure 8.9 Create the Customer class............................................................................................................ 6
Figure 8.10 Create the RentalLine class........................................................................................................ 6
Figure 8.11 Create the staff class .................................................................................................................. 6
Figure 8.12 Self Assoiciation ........................................................................................................................ 6
Figure 8.13 Complete class diagram ............................................................................................................. 6
Figure 8.14 A class diagram .......................................................................................................................... 6
Figure 9.1 Create Component Diagram by menu.......................................................................................... 6
Figure 9.2 Create Component Diagram by toolbar ....................................................................................... 6
Figure 9.3 Create Component Diagram by Project Explorer ........................................................................ 6
Figure 9.4 A blank new component diagram is created................................................................................. 6
Figure 10.1 Deployment Diagram................................................................................................................. 6
Figure 10.2 Create deployment diagram by menu ........................................................................................ 6
Figure 10.3 Create deployment diagram by toolbar...................................................................................... 6
Figure 10.4 Create deployment diagram by project explorer ........................................................................ 6
Figure 10.5 A new deployment diagram is created. ...................................................................................... 6
Figure 14.1 Visual Paradigm for UML with IDE .......................................................................................... 6
Figure 14.2 The Print Preview Window ........................................................................................................ 6

9
Table of tables

Table of tables
Table 2-1 Textual Analysis Palette of VPUML ............................................................................................. 6
Table 3-1 The Use Case Diagram Palette of VPUML................................................................................... 6
Table 4-1 The Sequence Diagram Palette of VPUML .................................................................................. 6
Table 4-2 Message flow of the sequence diagram......................................................................................... 6
Table 4-3 Completed sequence diagram........................................................................................................ 6
Table 5-1 The Activity Diagram Palette of VPUML..................................................................................... 6
Table 6-1 Objects of the diagram .................................................................................................................. 6
Table 6-2 Messages if the diagram................................................................................................................ 6
Table 7-1 The State Diagram Palette of VPUML.......................................................................................... 6
Table 7-2 Transitions table ............................................................................................................................ 6
Table 9-1 The Component Diagram Palette of VPUML ............................................................................... 6
Table 10-1 Deployment Diagram Palette ...................................................................................................... 6
Table 14-1 The Print Preview Toolbar .......................................................................................................... 6

10
Case Study

Case Study
Power Driver is a vehicle rental company. Power Driver has 105 branches over the world. Currently
there is no linkage between these branches. Power Driver needs a computer system to connect all these
branches together to support better services to the customer in a more efficient way. Following are the
requirements of the computer system.

The system should be able to store the vehicle records. A vehicle record includes model number, serial
number, status, booking schedule and booking history. The status of the vehicle should be available, rented,
repairing or reserved. Staffs only allow in searching the vehicle records. Only the branch’s manager allows in
maintaining vehicle records. The system stores the customer records. The customer record includes name, ID,
status and rental history. The status of the customer can be normal, VIP or suspend. The normal and VIP
customers can rent vehicles but suspended customers are not allowed to rent vehicles. All staffs can maintain
customer records. But only the branch’s manager allows changing the status of the customers. Each branch
has one manager.

The system should provide a function for staffs to input the rental record. The staff can only create the
rental record for the car in his own working branch. The staff cannot create a rental record for other branches.
After the vehicle is returned, the staff needs to update the rental record. The system should have a reserved
car function for booking the car. The start of the booking period should be within next 7 days. Normal staff
cannot make a booking request to another branch. Only the manager can request a booking to another branch.

The staff can use the system to check the availability of the car by using model number, or booking
schedule. If there are suitable car(s) for renting, the staff can use the system to reserve or rent the car. If the
car is rented, other staffs should not rent the car to another customer until the rental period is over. The staff
can search the customer records by using customer’s name, ID or telephone.

The system should provide a report generation function to generate a monthly report of the branch.

11
Chapter 2 Textual Analysis

Chapter 2 Textual Analysis

What is Textual Analysis?


Textual analysis is a process to analyze the system domain. It helps to identify the candidate classes in a
problem statement.

Figure 2.1 A problem statement having textual analysis performed

12
Chapter 2 Textual Analysis

Creating a Document for Textual Analysis


Method 1 – Creating a blank new textual analysis document using the main menu

1. Click on File on the main menu. The file menu appears.


2. Click on New Diagram on the file menu. A cascading menu appears.
3. Click on New Textual Analysis on the cascading menu. A blank new textual analysis document appears.

Figure 2.2 Create Textual analysis by Menu

13
Chapter 2 Textual Analysis

Method 2 – Creating a blank new textual analysis document using the toolbar

1. Click on Create Textual Analysis on the toolbar. A pop-up menu appears.

2. Click on Create Textual Analysis on the pop-up menu. A blank new textual analysis document appears.

Figure 2.3 Create Textual Analysis by Toolbar

14
Chapter 2 Textual Analysis

Method 3 – Creating a blank new textual analysis document using the Project Explorer

1. Right click on the Textual Analysis directory in the Project Explorer. A pop-up menu appears.
2. Click on Create Textual Analysis on the pop-up menu. A blank new class diagram appears.

Figure 2.4 Create textual analysis by project explorer

Figure 2.5 A blank new textual analysis document is created.

15
Chapter 2 Textual Analysis

The Textual Analysis Toolbar

Icon Notation Description


Import Text Import problem statement from a text file
File
Save Text File Save the problem statement file
Save Text As… Save the problem statements as another file
Cut Cut text
Copy Copy text
Paste Paste text
Search Search text
Add Candidate Add a new candidate class
Class
Show All View Show all panes
Hide Text Area Hide the text pane
Show Show the candidate class table
Candidate
Class Table
Only
Show/Hide Show/hide candidate classes
Candidate
Classes
Show/Hide Show/hide candidate actors
Candidate
Actors
Show/Hide Show/hide candidate use cases
Candidate Use
Cases
Show/Hide Show/hide candidate work flows
Candidate
Work Flows
Show/Hide Show/hide candidate unspecified items
Candidate
Unspecified
Items

Table 2-1 Textual Analysis Palette of VPUML

16
Chapter 2 Textual Analysis

Importing a Text File as the Problem Statement


You can import a text file or type in the problem statement directly in the text area of the textual analysis
window.

1. Click on Import Text File on the toolbar. An Open dialog box appears.

2.Select the text file that contains the problem statement. Click on the Open button in the dialog to import the
file. The problem statement is imported to the text pane.

17
Chapter 2 Textual Analysis

Searching Text in the Problem Statement


1. Click on the Find Text button. A input dialog appears.

2.Input the desired text in the input dialog. Click on Find button in the dialog. If the text is found, the text
will be highlighted.

18
Chapter 2 Textual Analysis

Creating a New Candidate Item


Method 1 – Creating a new candidate item using the textual analysis toolbar

1. Click on the Add Candidate button on the textual analysis toolbar. A cascading menu appears.

19
Chapter 2 Textual Analysis

2.Click on the Add text as Class, Add text as Actor, Add text as Use Case or Add text as Work Flow
button on the cascading menu. An input dialog appears. (If you select a phrase in the text pane, the input
dialog will not appear. The selected phrase will be the candidate.)

3.Input the candidate name. Click on the OK button in the input dialog. The input dialog is close. The
candidate is added to the candidate pane and all the occurrences of the candidate in the text pane are
highlighted in green.

20
Chapter 2 Textual Analysis

Method 2 – Creating a new candidate item with drag-and-drop technique

1. Select a word or a phrase in the text pane.

2.Drag the word or phrase to the candidate pane. A new candidate class is added to the candidate pane. All
the occurrences of the candidate are highlighted (occurrences of the most recently candidate added are
highlighted in green and the other candidate occurrences are highlighted in yellow.

21
Chapter 2 Textual Analysis

Method 3 – Creating a new candidate item using the popup menu

1. Select a word or a phrase in the text pane.

2. Right click on the word or phrase. A popup menu appears.

22
Chapter 2 Textual Analysis

3. Click on Add text as Class button on the popup menu. The candidate is added to the candidate pane.

Method 4 – Creating a new candidate item using the candidate pane

1. Right click on the candidate pane. A popup menu appears.

23
Chapter 2 Textual Analysis

2. Click on Add Candidate button on the popup menu. A cascading menu appears.

3. Click Actor in the cascading menu. An input dialog appears.

24
Chapter 2 Textual Analysis

4. Input the candidate actor name.

5. Click on the OK button in the input dialog. The new candidate is added to the candidate pane.

25
Chapter 2 Textual Analysis

Showing/Hiding a Type of Candidates

1. Click Show/Hide Candidate Classes button to show or hide the candidate classes.

26
Chapter 2 Textual Analysis

2. Click Show/Hide Candidate Actors button to show or hide the candidate actors.

3. Try other Show/Hide Candidate button to show or hide the other type of candidate items.

27
Chapter 2 Textual Analysis

Rearranging the Locations of Candidate Classes


Cascade Layout

1. To rearrange candidate classes in the candidate pane, right click on the container. A pop-up menu appears.
2. Click on Cascade Layout button on the popup menu. The locations of candidate classes were rearranged.

28
Chapter 2 Textual Analysis

Title Layout
To rearrange candidate classes in the candidate pane, right click on the container. A pop-up menu appears.

Click on the Title Layout button on the popup menu. The locations of candidate classes were rearranged.

29
Chapter 2 Textual Analysis

Setting the Textual Analysis Window Layout

1. Click on the Hide Text Area button on the textual analysis toolbar. The text area is hidden.

30
Chapter 2 Textual Analysis

2.Click on the Show Candidate Class Table Only button on the textual analysis toolbar. Only the
candidate class table is shown in the textual analysis window.

3.Click on the Show All View button on the textual analysis toolbar. All the panes are shown in the
textual analysis window.

31
Chapter 2 Textual Analysis

Editing the Candidates in Candidate Table


1. Click on the Hide Text Area button on the textual analysis toolbar. The text area is hidden.

2. Click on a cell in the Candidate Class column in the candidate table.

32
Chapter 2 Textual Analysis

3. Rename the candidate name.

4. Rename the candidate name. Press Ctrl + Enter to finish the operation.

33
Chapter 2 Textual Analysis

5.To change the type of the candidate, click on the cell in the Type column in the candidate table. A list of
types is shown.

6. Select one of the type in the list.

34
Chapter 2 Textual Analysis

7. To edit the description of a candidate, click on the cell in the Class Description column.

8. Input the description is the cell.

35
Chapter 2 Textual Analysis

9. Press Ctrl + Enter to finish the operation.

Creating Models for Existing Candidates

36
Chapter 2 Textual Analysis

1. Right click a candidate in the candidate pane. A popup menu appears.

2. Click on the Create Class/Actor/Use Case/Work Flow Model button in the popup menu.

37
Chapter 2 Textual Analysis

3. The type of the candidate is set to Generated Model.

4. Repeat the above step to create a model for other candidates.

38
Chapter 2 Textual Analysis

5. Click on the Model Tree View tab in the Project Explorer. The generated models are shown.

Adding Generated Models on Diagrams


1. Drag a generated actor from the model tree to a use case diagram.

39
Chapter 2 Textual Analysis

2. An actor is added in the use case diagram.

3. Drag a generated class from the model tree to a class diagram.

40
Chapter 2 Textual Analysis

4. A class is added in the class diagram.

41
Chapter 2 Textual Analysis

Exercise
Perform textual analysis on the problem statement below.

Power Driver is a vehicle rental company. Power Driver has 105 branches over the world. Currently there
is no linkage between these branches. Power Driver needs a computer system to connect all these branches
together to support better services to the customer in a more efficient way. Following are the requirements of
the computer system.

The system should be able to store the vehicle records. A vehicle record includes model number, serial
number, status, booking schedule and booking history. The status of the vehicle should be available, rented,
repairing or reserved. Staffs only allow in searching the vehicle records. Only the branch’s manager allows
maintaining vehicle records. The system stores the customer records. The customer record includes name,
ID, status and rental history. The status of the customer can be normal, VIP and suspend. The normal and VIP
customers can rent vehicle but suspended customers are not allow to rent a vehicle. All staffs can maintain the
customer record. But only the branch’s manager allows changing the status of the customer. Each branch has
one manager.

The system should provide a function for staffs to input the rental record. The staff can only create the
rental record for the car in his own working branch. The staff cannot create a rental record for other branch.
After the vehicle is returned, the staff needs to update the rental record. The system should have a reserved
car function for booking the car. The start of the booking period should be within next 7 days. Normal staff
can not make a booking request to another branch. Only the manager can request a booking to another
branch.

The staff can use the system to check the availability of the car by using model number, booking schedule.
If there are suitable car(s) for renting, the staff can use the system to reserve or rent the car. If the car is rented,
other staff should not rent the car to another customer until the rental period is over. The staff can search the
customer records by using customer’s name, ID or telephone.

The system should provide a report generation function to generate a monthly report of the branch.

Figure 2.6 A problem statement

42
Chapter 3 Use Case Diagram

Chapter 3 Use Case Diagram

What is a Use Case Diagram?

Figure 3.1 A use case diagram

43
Chapter 3 Use Case Diagram

Creating a Use Case Diagram


Method 1 – Creating a blank new use case diagram using the main menu

1. Click on File on the main menu. The file menu appears.


2. Click on New Diagram on the file menu. A cascading menu appears.
3. Click on New Use Case Diagram on the cascading menu. A blank new Use Case Diagram appears.

Figure 3.2 Create new use case using main menu

44
Chapter 3 Use Case Diagram

Method 2 – Creating a blank new use case diagram using the toolbar

1.Click on the Create Use Case Diagram button on the toolbar. A blank new use case diagram

appears.

Figure 3.3 Create use case using toolbar

45
Chapter 3 Use Case Diagram

Method 3 – Creating a blank new use case diagram using the Project Explorer

1. Right click on the Use Case Diagram directory in the Project Explorer. A pop-up menu appears.
2. Click on the Create Use Case Diagram. A blank new use case diagram appears.

Figure 3.4 Create use case using Project Explorer

Figure 3.5 A blank new use case diagram is created.

46
Chapter 3 Use Case Diagram

The Use Case Diagram Palette

Icon Notation Definition


Note The note notation is available on all diagram palettes. A note
can be used for commenting additional explanation,
specification and requirement in a diagram element or at a
link in the diagram. It is not included in generated code.
The contents of a note do not alter the meaning of the model
to which it is attached. A note can contain any combination of
text and graphics. It can also be used in defining a stereotype
and entering a noted element.
Anchor The anchor notation is available on all diagram palettes. An
anchor is used to line a diagram element and a note.
Constraint A constraint is a semantic condition or restriction on model
elements that must be enforced by a correct
design of a system. It is represented as a linguistic, enclosed
in braces ({}), statement in some formal
(OCL, C++, and other), or natural language. There are 14
standard constraints in the UML such as association, global,
parameter. You may also define your own constraints.
Package Package is a mechanism for organizing elements into groups.
It is used in the Use Case, Class, and Component diagrams.
Packages may be nested within other packages. A package
may contain both subordinate packages and ordinary model
elements. The entire system description can be thought of as
a single high-level subsystem package with everything else in
it.
Subsystem A subsystem groups diagram elements together.
System A system/system boundary groups use cases together to
accomplish a purpose. Each use case diagram can only have
one system.
Dependency The dependency link is a semantic relationship between the
two elements. It indicates that when a change occurs in one
element, there may be a change necessary to the other
element. A dependency link can include label and stereotype
can be set.
Use Case Use case describes the behavior of a system. It is used to
structure things in a model. It contains multiple scenarios,
each of which describes a sequence of actions that is clear
enough for outsiders to understand. (adapted from
UMLUG-p)
Actor An actor represents a coherent set of roles that users of a
system play when interacting with the use cases of the system.

47
Chapter 3 Use Case Diagram

An actor participates in use cases to accomplish an overall


purpose. An actor can represent the role of a human, a
device, or any other systems.
Association Association is used to associate an actor to a use case. It
shows participation of an actor in a use case. It is a set of links
in which a link is a connection among objects.
Include Include is a link that links an inclusion use case with a base
use case.
Extend Extend is a link that links an extension use case with a base
use case. Extension use case exents the behaviour of the base
use case.
Generalization Generalization is a relationship between a general element
and a more specific kind of that element. It means that the
more specific element can be used whenever the general
element appears. This relation is also known as specialization
or inheritance link.
Realization
Collaboration

Table 3-1 The Use Case Diagram Palette of VPUML

Drawing a Use Case Diagram

Creating a Use Case


Method 1 – Creating a use case using the Use Case Diagram Palette
1.Click on the Use Case button on the Use Case Diagram Palette. Click on the desired location on
the diagram. A new use case appears.

2. Rename the newly created use case. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a use case using the resource centric interface

48
Chapter 3 Use Case Diagram

1. Click on an existing actor on the diagram. Resource icons appear around the actor.

2. Press on the Association -> Use Case resource icon . A new use case appears.

3. Drag the use case to the desired location. Release the mouse button.

4. Rename the newly created use case. Press Ctrl + Enter to finish the operation.

49
Chapter 3 Use Case Diagram

50
Chapter 3 Use Case Diagram

Creating an Actor
Method 1 – Creating an actor using the Use Case Diagram Palette
1.Click on the Actor button on the Use Case Diagram Palette. Click on the desired location on the
diagram. A new actor appears.

2. Rename the newly created actor. Press Ctrl + Enter to finish the operation.

Method 2 – Creating an actor using the resource centric interface


1. Click on an existing use case on the diagram. Resource icons appear around the use case.

2. Press on the Association -> Actor resource icon . A new actor appears.

51
Chapter 3 Use Case Diagram

3. Drag the actor to the desired location. Release the mouse button.

4. Rename the newly created actor. Press Ctrl + Enter to finish the operation.

Creating a System
You can create one and only one system on a use case diagram.

52
Chapter 3 Use Case Diagram

1.Click on the System button on the Use Case Diagram Palette. Click on the desired location on the
diagram. A new system appears.

2. Rename the newly created system. Press Ctrl + Enter to finish the operation.

53
Chapter 3 Use Case Diagram

3. Click on the use case once so that the system contains the use case.

It is suggested that a system boundary should be created before creating use cases of the
system. If the use cases are created in the system boundary, the system boundary will
contain the use cases. If the system boundary does not contain a use case, drag the use case
in the system boundary to make the system boundary contains the use case.

Please note that a system boundary will never contain actors.

It is not allowed to create more than one system on a use case diagram. A warning dialog
box is shown when you try to create more than one system on a use case diagram.

54
Chapter 3 Use Case Diagram

Creating a Collaboration
Method 1 – Creating a collaboration using the Use Case Diagram Palette
1.Click on the Collaboration button on the Use Case Diagram Palette. Click on the desired location
on the diagram. A new collaboration appears.

2. Rename the newly created collaboration. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a collaboration using the resource centric interface


1. Click on an existing use case on the diagram. Resource icons appear around the use case.

2. Press on the Generalization -> Collaboration resource icon . A new collaboration appears.

3. Drag the collaboration to the desired location. Release the mouse button.

55
Chapter 3 Use Case Diagram

4. Rename the newly created collaboration. Press Ctrl + Enter to finish the operation.

Creating an Association Link


Method 1 – Creating an association link using the Use Case Diagram Palette
An association relationship can be created between:
z A use case and a use case ,
z An actor and an actor , or
z An actor and a use case

1.Click on the Association button on the Use Case Diagram Palette. Drag from either the actor or
the use case to the target diagram element.

2. Release the mouse button. A new association is created between the diagram elements.

56
Chapter 3 Use Case Diagram

Method 2 – Creating an association link using the resource centric interface


Diagram elements that an association link can be created from, using the resource centric interface are:
z Actor
z Use Case

1.Click on an existing diagram element listed above on the use case diagram. Resource icons appear around
the diagram element.

2.Press on the Association -> Use Case resource icon (Note: Click association -> actor
resource icon for creating association between actors, or between use case and actor). A new diagram
element appears.

57
Chapter 3 Use Case Diagram

3. Drag the new diagram element to the target diagram element. The target diagram element is selected.

4. Release the mouse button. The association link is created between the diagram elements.

Defining the Multiplicity of a Role of an Association Link


You can define the multiplicity of a role.

1. Right click on an existing association link on the diagram. A pop-up menu appears.

58
Chapter 3 Use Case Diagram

2. Choose the Role A(xxx) on the menu. A cascading menu appears.

3. Choose the Multiplicity on the menu. A cascading menu appears.

4.Choose one of the multiplicities (0, 0..1, 0..*, 1, 1..*, *, Unspecified, Other…) on the cascading menu.
Then the multiplicity of the role is set.

59
Chapter 3 Use Case Diagram

5. Repeat the above steps to set the display the multiplicity cascading menu for Role B(xxx).

6. Choose Other… on the menu to specify the multiplicity of the use case. An input dialog box appears.

7. Input the multiplicity of the role such as 0..n. The multiplicity of the other role is set.

60
Chapter 3 Use Case Diagram

Creating an <<extend>> Relationship Link


Method 1 – Creating an <<extend>> relationship link using the Use Case Diagram Palette

1.Click on the Extend button on the Use Case Diagram Palette. Drag from a use case to the other
use case.

2. Rename the newly created <<extend>> relationship link. Press Ctrl + Enter to finish the operation.

Method 2 – Creating an <<extend>> relationship link using the resource centric interface

61
Chapter 3 Use Case Diagram

1. Click on an existing use case on the diagram. Resource icons appear around the use case.

2. Press on the Extend -> Use Case resource icon . A new use case appears.

3. Drag the new use case to the target use case. Release the mouse button.

4. A new <<extend>> relationship link is created between the use cases.

62
Chapter 3 Use Case Diagram

5. Double Click on the <<extend>> relationship link. A text box appears.

6. Rename the <<extend>> relationship link. Press Ctrl + Enter to finish the operation.

7. Drag the <<extend>> relationship name and move it to the desired location.

63
Chapter 3 Use Case Diagram

Defining Extension Point


1. Right Click on the base use case. A pop-up menu appears.

2. Check the Extension Point checkbox. The extension point of the base use case appears.

=>

64
Chapter 3 Use Case Diagram

3.Click on the extension point. A text box appears. Rename the extension point. Press Ctrl + Enter to finish
the operation.

4. The extension point definition is set.

65
Chapter 3 Use Case Diagram

Creating an <<include>> Relationship Link


Method 1 – Creating an <<include>> relationship link using the Use Case Diagram Palette

1.Click on the Include button on the Use Case Diagram Palette. Drag from a use case to the other
use case.

2. Rename the newly created <<include>> relationship link. Press Ctrl + Enter to finish the operation.

Method 2 – Creating an <<include>> relationship link using the resource centric interface

1. Click on an existing use case on the diagram. Resource icons appear around the use case.

66
Chapter 3 Use Case Diagram

2. Press on the Include -> Use Case resource icon . A new use case appears.

3. Drag the new use case to the target use case.

4. Release the mouse button. A new <<include>> relationship link is created between the use cases.

Creating a Generalization Relationship Link


You can create a generalization relationship link between actors, or between use cases.

Method 1 – Creating a generalization relationship link using the Use Case Diagram Palette

67
Chapter 3 Use Case Diagram

1.Click on the Generalization Relationship button on the Use Case Diagram Palette. Drag
from the source diagram element to the target diagram element.

2. Release the mouse button. A new generalization relationship link is created between diagram elements.

Method 2 – Creating a generalization relationship link using the resource centric interface

1.Click on an existing diagram element (actor or use case) on the diagram. Resource icons appear around the
diagram element.

68
Chapter 3 Use Case Diagram

2. Press on the Generalization resource icon . A new diagram element appears.

3. Drag the new diagram element to the target diagram element.

4.Release the mouse button. The new generalization relationship link is created between the diagram
elements.

Editing the Use Case Specification


All the properties of a class can be modified using the class specification dialog box.

69
Chapter 3 Use Case Diagram

1. Right click on an existing use case on the diagram. A pop-up menu appears.

2.Click on Open Specification on the pop-up menu. The Specification dialog box appears. The properties
such as name, priority rank, stereotype and so on can be modified in the dialog box.

70
Chapter 3 Use Case Diagram

3.Click on the Use Case Description tag. The use case description of the use case appears. (Read the
Editing Use Case Description with a Use Case section for more details.)

71
Chapter 3 Use Case Diagram

Editing the Use Case Description

1. Right click on the use case. A popup menu appears.

2. Click on the Use Case Description on the popup menu. The use case description of the use case appears.

72
Chapter 3 Use Case Diagram

3.To change the template of the use case, click on the Available Template combo box. Select the desired
template in the combo box.

4. The template of the use case description is changed. Select the Main template again.

73
Chapter 3 Use Case Diagram

5. To add a new item in the template, click Add Item button in the dialog. An input dialog appears.

6. Input the item name in the input dialog box. Click OK button to finish the operation.

74
Chapter 3 Use Case Diagram

7. To rearrange the items of the template, click the Move Up button and Move Down button.

8. Click on the Value column to edit the use case description.

75
Chapter 3 Use Case Diagram

9. To edit the flow of events in the use case description, click on the Value column of the Flow of Event item.
Click on the table in the Value column to insert a new Actor Input or System Response.

76
Chapter 3 Use Case Diagram

10. After editing a new Actor Input, a new input row will automatically added in the table.

11. Click on the table to adding a new System Response. Then click OK button to finish editing the use case
description.

77
Chapter 3 Use Case Diagram

Performing Textual Analysis with a Use Case


1. Right click on an existing use case. A pop-up menu appears.

2. Click on Sub Diagrams. A cascading menu appears.

78
Chapter 3 Use Case Diagram

3. Click on Textual Analysis. A cascading menu appears.

4. Click on the Create Textual Analysis. The textual analysis window appears.

79
Chapter 3 Use Case Diagram

5.Find out the nouns in the problem statement. Drag the candidate classes to the Candidate Class Container.
The candidate classes are highlighted. (See Chapter 1 - Textual Analysis for more details)

Editing the Actor Specification


All the properties of an actor can be modified using the specification dialog box.

1. Right click on the actor. A pop-up menu appears.

80
Chapter 3 Use Case Diagram

2.Click on Open Specification. The specification dialog box appears. You can modify the actor’s properties
in the specification dialog box.

Scheduling the use cases


Use cases can be prioritized into 4 categories - Unspecified, Low, Medium and High.

1. Right click on an empty area on the diagram. A pop-up menu appears.

81
Chapter 3 Use Case Diagram

2. Click on Use Case Scheduling on the pop-up menu. The Use Case Scheduling dialog box for the use
case diagram appears. It shows a list of use cases on the diagram.

3. Click on a cell in the Rank column of the table. A pull-down box appears.

82
Chapter 3 Use Case Diagram

4.Choose one of the priority categories for the use case. Then the priority is set for the use case. Prioritize
other use cases in the table.

83
Chapter 3 Use Case Diagram

5. Click on a cell in the Justification column to input the justification for the priority setting.

6.Click on the Fit Selected Row Height button to adjust the row height (or click on the Fit All Rows Height
to adjust the heights of all the rows).

84
Chapter 3 Use Case Diagram

7.Click on the Rank column heading, the use case will be sorted. The use cases can be sorted in either
ascending or descending order with the priority ranking.

85
Chapter 3 Use Case Diagram

Generating Sequence Diagram with a Use Case

1. Right click on the use case. A popup menu appears.

2.Click Generate Sequence Diagram in the popup menu. A new sequence diagram (System level) will be
generated according to the flow of events defined in the use case description of the use case.

86
Chapter 3 Use Case Diagram

Example

1.Click on the Use Case button on the Use Case Diagram Palette. Click on an empty area on the use case
diagram. A new use case appears. Rename the use case as “Maintain Rental Records”.

Figure 3.6 Maintain Rental Records Use Case

2.Repeat the steps above to create more use cases with the names: Issue Vehicle Rental, Maintain Rental
Records, Maintain Vehicle Records and Maintain Customer Records and Analyze Rental Report.

Figure 3.7 Main Use Cases

87
Chapter 3 Use Case Diagram

3.Click on the use case named as Issue Vehicle Rental. Resource icons appear around the use case. Click on
the Association -> Actor resource icon. A new actor appears. Drag it to a desired location and
rename it as “Staff”.

Figure 3.8 Create an actor by resource centric

4.Click on the use case named as Maintain Rental Records. Resource icons appear the use case. Click on the
Association -> Actor resource icon. A new actor appears. Drag the new actor to the actor named
as Staff. An association relationship link is created between the actor and the use case.

Figure 3.9 Create another use case

88
Chapter 3 Use Case Diagram

5.Repeat the steps above to create a new actor as “BranchManager” and create association relationship links
between the actor and the use cases with the names: Maintain Rental Records, Maintain Customer Records
and Analyze Rental Report.

Figure 3.10 Another Actor

89
Chapter 3 Use Case Diagram

6.Click on the actor named as Staff. Resource icons appear around the actor. Click on the Generalization
-> Actor resource icon. A new actor appears. Drag the new actor to the BranchManager actor. The
new actor disappears. Then a generalization relationship link is created between the actors.

Figure 3.11 Generalization of actor

90
Chapter 3 Use Case Diagram

7.Click on the use case Issue Vehicle Rental. Resource icons appear around the use case. Click on the
Extend -> Use Case resource icon. A new use case appears. Drag the new use case to the desired
location. Rename the use case as “Request Other Branch for Vehicle Rental”. Then the new use case
becomes extension use case.

Figure 3.12 Create an extend use case

91
Chapter 3 Use Case Diagram

8.Create an association relationship between the actor named BranchManager and the use case named
Request Other Branches for Vehicle Rental. Then rearrange the diagram elements.

92
Chapter 3 Use Case Diagram

9.Right click on the use case named Issue Vehicle Rental. A pop-up menu appears. Check Extension Point
on the pop-up menu. The extension point of the use case appears. Click on the extension point. A text box
appears. Rename the extension point as “vehicle available”.

10. Double-Click on the extension link. A text box appears. Rename the link as “(available vehicle) [request
other branch for vehicle rental]”.

93
Chapter 3 Use Case Diagram

11. Click on the system button on the Use Case Diagram Palette. Click on the use case diagram. A system
boundary appears. Rename the system as “Vehicle Rental System”. Drag the use cases into the system
boundary to make the system boundary to contain the use cases.

Figure 3.13 Completed use case diagram

94
Chapter 3 Use Case Diagram

12. Right click on an empty area on the diagram. A pop-up menu appears. Click Open Specification on
the pop-up menu. The use case diagram specification dialog box appears. Click on the Schedule tab.
A list of use case is shown.

Figure 3.14 Use Case Scheduling dialog

13. Set the priorities of the use cases and input the justifications for the priorities. Then click OK to exit the
dialog box.

Use Case Priority


Maintain Vehicle Records High
Issue Vehicle Rental High
Maintain Vehicle Records Medium
Maintain Customer Records Medium
Request Other Branches for Vehicle Rental Low

95
Chapter 3 Use Case Diagram

Figure 3.15 Justification of Main Rental Recrods

14. Right click on the use case named Maintain Rental Records on the use case diagram. A pop-up menu
appears. Click Sub Diagrams. A cascading menu appears. Click Textual Analysis. A cascading menu
appears. Click Create Textual Analysis. A blank textual analysis document is opened. Input the
following text in the document.
Maintain Rental Records

Flow of events

1. The staff login the system

2. The system validates the staff identity with user name and password

3. After validation, the staff can maintain the rental records. The staff can query, insert, update or archive the
rental records.

a) Query rental records

i) Get the query criteria

ii) Find the rental records with the criteria

b) Insert rental record

i) Create a new rental record

ii) Fill in the rental information

iii) Confirm the changes

c) Update rental records

i) Find the rental record with record ID

ii) Update the rental information in the record

iii) Confirm the changes

4. Logout the system.

96
Chapter 3 Use Case Diagram

Figure 3.16 Textual analysis

15. Perform textual analysis with the statements. Find out all candidate use case, actor and class in the
statements and add them to the Candidate Container. (Read the Textual Analysis tutorial for more
details.)

Figure 3.17 Find out candidate use case

97
Chapter 3 Use Case Diagram

Exercise
Draw the diagram below according to the guidelines given in this chapter.

Figure 3.18 A use case diagram

98
Chapter 4 Sequence Diagram

Chapter 4 Sequence Diagram

What is a Sequence Diagram?

Figure 4.1 Sequence Diagram

Creating a Sequence Diagram


Method 1 – Creating a Sequence Diagram using the Menu Bar
1. Click on File on the menu bar. The file menu appears.
2. Click on New Diagram on the file menu. A cascading menu appears.
3. Click on New Sequence Diagram on the cascading menu. A blank new sequence diagram appears.

Figure 4.2 Create sequence diagram using menu bar

99
Chapter 4 Sequence Diagram

Method 2 – Creating Sequence Diagram using the Toolbar


1. Click the Create Sequence Diagram button on the toolbar. A blank new sequence diagram appears.

Figure 4.3 Create sequence diagram using toolbar

100
Chapter 4 Sequence Diagram

Method 3 – Creating a Sequence Diagram using the Project Explorer


1. Right click on the Sequence Diagram directory in the Project Explorer. A popup menu appears.
2. Click on Create Sequence Diagram. A blank new sequence diagram appears.

Figure 4.4 Create sequence diagram using Project Explorer

101
Chapter 4 Sequence Diagram

Figure 4.5 A blank new sequence diagram is created.

102
Chapter 4 Sequence Diagram

The Sequence Diagram Palette

Icon Notation Definition


A note can be used for comments additional explanation,
specification and requirement in a diagram element or at a
link in the diagram. The contents of a note do not alter the
Note
meaning of the model to which it is attached. It can contain
any combination of text and graphics. It can also be used in
defining a stereotype and entering a noted element.
Anchor An anchor is to link a diagram element and a note.
Constraint A constraint is a semantic condition or restriction on model
elements that must be enforced by a correct
design of a system. It is represented as a linguistic, enclosed
in braces ({}), statement in some formal
(OCL, C++, and other), or natural language. There are 14
standard constraints in the UML such as association, global,
parameter. You may also define your own constraints.
Subsystem A subsystem groups use cases or packages together.
Object can be viewed as an entity at a particular point in time
with a specific value and as a holder of identity that has
Object different values over time. Associations among objects are
not shown. When you place an object tag in the design area, a
lifeline is automatically drawn and attached to that object tag.
An actor represents a coherent set of roles that users of a
system play when interacting with the use cases of the system.
Actor An actor participates in use cases to accomplish an overall
purpose. An actor can represent the role of a human, a
device, or any other systems.
A message is a sending of a signal from one sender object to
other receiver object(s). It can also be the call of an operation
on receiver object by caller object. The arrow can be labeled
Message with the name of the message (operation or signal) and its
argument values. A sequence number that shows the
sequence of the message in the overall interaction as well as a
guard condition can also be labeled at the arrow.
A message that indicates an action will cause transition from
Duration Message
one state to another state.
A message that indicates an action will perform at a particular
Self Message
state and stay there.
A message that indicates an action that will perform between
Create Message
two states.
Concurrent means several actions of the same type can be
Concurrent
executed simultaneously.

103
Chapter 4 Sequence Diagram

Recursive Action state that enables repeated actions.

Table 4-1 The Sequence Diagram Palette of VPUML

Drawing a Sequence Diagram

Creating an Actor
Method 1 – Creating an Actor using the Diagram Palette
1.To create an actor in your sequence diagram, click on the Actor button on the diagram palette and
click on the desired location on diagram. A new actor is created.

2. Rename the newly created actor name. Press Ctrl + Enter to finish the operation.

104
Chapter 4 Sequence Diagram

3. The actor name is set.

Double-click on the toolbar button to set the button as default on the toolbar.
(Press Escape or click on any other button to de-select)

Method 2 – Creating an actor using the resource centric interface


Diagram element that an actor can be created from, using the resource centric interface is:
z Object

1. Click on an existing object on the diagram. Resource icons appear around the object.

105
Chapter 4 Sequence Diagram

2. Press one of the resource icons with Object ( , ). A new actor appears.

3. Drag the actor to the desired location. The actor is created.

106
Chapter 4 Sequence Diagram

Creating an Object
Method 1 – Creating an Object using the diagram palette
1.Creating an object in your sequence diagram, click on the Object button on the diagram palette and
click on the desired location on the diagram. A new object appears.

2. Rename the newly created object. Press Ctrl + Enter to finish the operation.

3. The object name is set.

Method 2 – Creating an object using the resource centric interface


Diagram element that an object can be created from, using the resource centric interface is:
z Actor

107
Chapter 4 Sequence Diagram

Creating a Message
Method 1 – Creating a message using the diagram palette
1. Click on the Message button on the diagram palette.
2. Click anywhere on the message sender, and drag to the target diagram element.

3. Rename the newly created message.

When message is being dragged, a new focus of control will create. There are two methods to maintain the
message connected to the same focus of control and not to create a new one.
1. Drag the message with a little of distance each time.
2. Press the Shift button when dragging the message.

108
Chapter 4 Sequence Diagram

Creating a Constraint
Method 1 – Creating a Constraint using the diagram palette
1. Click on the Constraint button on the diagram palette.
2. Click anywhere on the source diagram element. Drag to the target diagram element.

3. Input the constraint in the text field. Press Ctrl + Enter to finish the operation.

109
Chapter 4 Sequence Diagram

Creating a Duration Message


Method 1 – Creating a Duration Message using the diagram palette
1. Click on the Duration Message button on the diagram palette.
2. Click anywhere on the source diagram element. Drag to the target diagram element.

3. Rename the newly created duration message. Press Ctrl + Enter to finish the operation.

110
Chapter 4 Sequence Diagram

Creating a Self Message


Method 1 – Creating a Self Message using the diagram palette
1. Click on the Self Message button on the diagram palette.

2. Click on an existing object or the focus of control that you want to create self message.

3. Press F2 to rename the self message. Press Ctrl + Enter to finish the operation.

111
Chapter 4 Sequence Diagram

4. The self message name is set.

Creating a Create Message


Method 1 – Creating a Create Message using the diagram palette
1. Click on the Create Message button on the diagram palette.

2. Press on an existing diagram element. Drag to the target diagram element.

3. Press F2 to rename the newly created create message. Press Ctrl + Enter to finish the operation.

112
Chapter 4 Sequence Diagram

4. The create message name is set.

Creating a Concurrent
Method 1 – Creating a concurrent using the diagram palette
1. Click on Concurrent button on the diagram palette.

2. Click on an existing object that you want to create concurrent.

113
Chapter 4 Sequence Diagram

3. Rename the newly created concurrent. Press Ctrl + Enter to finish the operation.

4. The concurrent name is set.

Creating a Recursive
Method 1 – Creating a recursive using the diagram palette
1. Click on Recursive button on the diagram palette.

114
Chapter 4 Sequence Diagram

2. Click on an existing object that you want to create recursive.

3. Rename the newly created recursive. Press Ctrl + Enter to finish the operation.

4. The recursive name is set.

115
Chapter 4 Sequence Diagram

Creating a Subsystem
Method 1 – Creating a Subsystem using the diagram palette
1.Creating a subsystem in your sequence diagram, click on the Subsystem button on the diagram
palette and click on the desired location on the diagram. A new subsystem appears.

2. Rename the newly created subsystem. Press Ctrl + Enter to finish the operation.

3. The subsystem name is set.

116
Chapter 4 Sequence Diagram

Editing an Actor Specification


1. Right click on an existing actor that you want to edit. A popup menu appears.

2.Click on Open Specification on the pop-up menu. The Specification dialog box appears. The name,
description and so on can be modified in the dialog box.

117
Chapter 4 Sequence Diagram

Editing an Object Specification

1. Right click on an existing object. A popup menu appears.

2.Click on Open Specification on the popup menu. A Specification dialog appears. The name, description
and so on can be modified in the dialog.

118
Chapter 4 Sequence Diagram

Editing a Message Type


1. Right click on an existing message that you want to edit.

2. A popup menu is appears, choose the message type you want.

3. The popup menu disappears, and the message type is set.

119
Chapter 4 Sequence Diagram

Setting Base Classifier


Method 1 – Setting in the Object Specification dialog
1. Right click on an existing object. A popup menu appears.

2. Click on Open Specification on the popup menu. A Specification dialog appears.

120
Chapter 4 Sequence Diagram

3. Click on Base classifier, a list will be display showing all the class in the current project.

4.Click on an existing class or click on Create Class to create a new class. Click on Create Class, the Class
Specification dialog appears. Setting the new class property, then click OK button.

5. The Base classifier is set. Click OK to finish the operation.

121
Chapter 4 Sequence Diagram

Method 2 – Setting in the Popup menu


1. Right click on an existing object. A popup menu appears.

2.Click on Select Class on the popup menu. A submenu appears. Click on Create Class to create a new class
or click on an existing class. To search a class, enter the class name in the Search textfield.

122
Chapter 4 Sequence Diagram

Setting Object Active

1. Right click on an existing object. A popup menu appears.

2. Click on Active on the popup menu.

3. The object is set to active.

123
Chapter 4 Sequence Diagram

Setting Show Destruction

1. Right click on an existing object. A popup menu appears.

2. Click on Show Destruction on the popup menu.

3. The object is set to show Destruction.

124
Chapter 4 Sequence Diagram

Generating a Collaboration Diagram

1.Open a collaboration diagram from the Project Explorer. Double click on a blank place on the diagram to
generate a new sequence Diagram.

2. A new sequence diagram is generated.

125
Chapter 4 Sequence Diagram

3. A new sequence diagram is generated from the collaboration diagram.

=>

126
Chapter 4 Sequence Diagram

Example
1.Click on the Actor button on the toolbar and click on the desired location on diagram. A new actor is
created.

Figure 4.6 Select an actor

2. Rename the newly created actor as “Customer”. Press Ctrl + Enter to finish the operation.

Î Î

3.Select the newly created actor, the resource icons appear around it. Press Actor Resource icon, and then
drag to right side and release the mouse button. A new actor is created.

Î Î

127
Chapter 4 Sequence Diagram

4.Double-click the newly created actor and rename it as “Staff”. Press Ctrl + Enter to finish the operation.
Press the Object Resource icon, and then drag to the right side and release the mouse button to create a
new object. Rename the newly created object as “Vehicle Rental System”.

5. Double click on the Customer to Staff message. A textfield appears, input “rent a vehicle”.

6. Double click on the Staff to Vehicle message. A textfield appears, input “validate customer by id”.

128
Chapter 4 Sequence Diagram

7.Create a message form “Vehicle Rental System” to” Staff”. Rename the newly created message as
“customer is valid”.

8.Right click on the “customer is valid” message. A popup menu appears. Select “return” to change the
message type.

9. According to the above steps, create the following messages :

Direction Message name Message type


From Staff to Vehicle Rental search vehicle based on the customer criteria send
System
From Vehicle Rental System vehicle is available return
to Staff
From Staff to Vehicle Rental create rental record send
System
From Staff to Customer vehicle’s key and receipt return

Table 4-2 Message flow of the sequence diagram

129
Chapter 4 Sequence Diagram

10. The completed diagram will look like the following.

Table 4-3 Completed sequence diagram

130
Chapter 4 Sequence Diagram

Exercise
Draw the following diagram according to the guidelines given in this chapter.

Figure 4.7 Sequence Diagram Exercise

131
Chapter 5 Activity Diagram

Chapter 5 Activity Diagram

What is an Activity Diagram?

Figure 5.1 An activity diagram

132
Chapter 5 Activity Diagram

Creating an Activity Diagram


Method 1 – Creating an activity diagram using the menu bar

1. Click on File on the menu bar. The file menu appears.


2. Click on New Diagram on the file menu. A cascading menu appears.
3. Click on New Activity Diagram on the cascading menu. A blank new activity diagram appears.

Figure 5.2 Create activity diagram by menu

133
Chapter 5 Activity Diagram

Method 2 – Creating an activity diagram using the toolbar

1. Click on Create Activity Diagram on the toolbar. A blank new activity diagram appears.

Figure 5.3 Create activity diagram by toolbar

134
Chapter 5 Activity Diagram

Method 3 – Creating an activity diagram using the Project Explorer

1. Right click on Activity Diagram directory in the Project Explorer. A pop-up menu appears.
2. Click on Create Activity Diagram on the pop-up menu. A blank new activity diagram appears.

Figure 5.4 Create activity diagram by project explorer

135
Chapter 5 Activity Diagram

Figure 5.5 A blank new activity diagram is created.

The Activity Diagram Palette

Icon Notation Definition


Note A note is used for comments additional explanation,
specification and requirement in a diagram element or at a
link in the diagram. It is not included in generated code.
The contents of a note do not alter the meaning of the model
to which it is attached. A note can contain any combination of
text and graphics. It can also be used in defining a stereotype
and entering a noted element.
Anchor An anchor is used to line a diagram element and a note.

Subsystem A subsystem groups diagram elements together.

Action State A state that represents the execution of an atomic action,


mostly the invocation of an operation.
Sub Activity An sub activity is the activity that will perform within a larger
activity.
Initial State A pseudo state to establish the start of the event into an actual
state.
Final State A final state will signify when a state transition ends.

Transition A transition is a relationship between two states. This


transition indicates that control is passed from the one state to
another state once the work of the source state is completed.

136
Chapter 5 Activity Diagram

Icon Notation Definition


Note A note is used for comments additional explanation,
specification and requirement in a diagram element or at a
link in the diagram. It is not included in generated code.
The contents of a note do not alter the meaning of the model
to which it is attached. A note can contain any combination of
text and graphics. It can also be used in defining a stereotype
and entering a noted element.
Anchor An anchor is used to line a diagram element and a note.

Subsystem A subsystem groups diagram elements together.

Action State A state that represents the execution of an atomic action,


mostly the invocation of an operation.
Sub Activity An sub activity is the activity that will perform within a larger
activity.
Initial State A pseudo state to establish the start of the event into an actual
state.
Final State A final state will signify when a state transition ends.

Transition A transition is a relationship between two states. This


transition indicates that control is passed from the one state to
another state once the work of the source state is completed.
To emphasize functional flow of control, transitions can be
labeled, and can contain parameters, guard conditions and
action expressions.
Horizontal This merge branch bar symbol is also known as a
Synchronization “Synchronization Bar”. It merges concurrent transitions to a
single target. It splits a single transition into parallel
transitions.
Vertical This merge branch bar symbol is also known as a
Synchronization “Synchronization Bar”. It merges concurrent transitions to a
single target. It splits a single transition into parallel
transitions.
Decision Point Similar to flowchart, decision point is used to model the
conditional flow of control. A decision is shown by labeling
each output transition of a decision with a different guard
condition.
Signal Receipt A signal that may trigger a transition when received.

Signal Sending A signal that may trigger a transition to another state in its
state machine when sent.
Object
Object Flow A variety of control flow that represents the relationship
between an object and the object, operation, or transition that
creates it or uses it.

137
Chapter 5 Activity Diagram

Swimlane Swimlane is a partition on interaction diagram for organizing


responsibilities for activities. Each zone or lane represents the
responsibilities of a particular class. To use swimlane, you
must arrange activity diagrams into vertical zones separated
by dashed lines. Transitions may cross boundaries.

Table 5-1 The Activity Diagram Palette of VPUML

Drawing an Activity Diagram

Creating an Action State


Method 1 – Creating an action state using the Activity Diagram Palette
1.Click on the action state button on the Activity Diagram Palette. Click on the desired location on the
diagram. A new action state appears.

2. Rename the newly created action state. Press Ctrl + Enter to finish the operation.

138
Chapter 5 Activity Diagram

Method 2 – Creating an action state using the resource centric interface


Diagram elements that an action state can be created from, using the resource centric interface are:
z Action State
z Sub Activity
z Initial State
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the Action State resource icon . A new action state appears.

3. Drag the action state to the desired location. Release the mouse button.

139
Chapter 5 Activity Diagram

4. Rename the newly created action state. Press Ctrl + Enter to finish the operation.

Creating a Sub Activity


Method 1 – Creating a sub activity using the Activity Diagram Palette
1.Click on the sub activity button on the Activity Diagram Palette. Click on the desired location on the
diagram. A new sub activity appears.

2. Rename the newly created sub activity. Press Ctrl + Enter to finish the operation

Method 2 – Creating a sub activity using the resource centric interface


Diagram elements that a sub activity can be created from, using the resource centric interface are:
z Action State
z Sub Activity
z Horizontal Synchronization
z Vertical Synchronization
z Signal Receipt
z Signal Sending
z Object Flow

140
Chapter 5 Activity Diagram

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the sub activity resource icon . A new sub activity appears.

3. Drag the sub activity to the desired location. Release the mouse button.

4. Rename the newly created sub activity. Press Ctrl + Enter to finish the operation.

141
Chapter 5 Activity Diagram

Create an Initial State


1.Click on the initial state button on the Activity Diagram Palette. Click on the desired location on the
diagram. A new initial state appears.

2. Rename the newly created initial state. Press Ctrl + Enter to finish the operation.

Create a Final State


Method 1 – Creating a final state using the Activity Diagram Palette
1.Click on the final state button on the Activity Diagram Palette. Click on the desired location on the
diagram. A new final state appears.

2. Rename the newly created final state. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a final state using the resource centric interface


Diagram elements that a final state can be created from, using the resource centric interface are:
z Action State
z Sub Activity
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Sending
z Object

142
Chapter 5 Activity Diagram

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the final state resource icon . A new final state appears.

3. Drag the final state to the desired location. Release the mouse button.

4. Rename the newly created final state. Press Ctrl + Enter to finish the operation.

143
Chapter 5 Activity Diagram

Creating a Horizontal Synchronization


Method 1 – Creating a horizontal synchronization using the Activity Diagram Palette
1.Click on the horizontal synchronization button on the Activity Diagram Palette. Click on the desired
location on the diagram. A new horizontal synchronization appears.

2. Rename the newly created horizontal synchronization. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a horizontal synchronization using the resource centric interface


Diagram elements that a horizontal synchronization can be created from, using the resource centric interface
are:
z Action State
z Sub Activity
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

144
Chapter 5 Activity Diagram

2. Press on the horizontal synchronization resource icon . A new horizontal synchronization appears.

3. Drag the horizontal synchronization to the desired location. Release the mouse button.

4. Rename the newly created horizontal synchronization. Press Ctrl + Enter to finish the operation.

145
Chapter 5 Activity Diagram

Creating a Vertical Synchronization


Method 1 – Creating a vertical synchronization using the Activity Diagram Palette
1.Click on the vertical synchronization button on the Activity Diagram Palette. Click on the desired
location on the diagram. A new vertical synchronization appears.

2. Rename the newly created vertical synchronization. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a vertical synchronization using the resource centric interface


Diagram elements that a vertical synchronization can be created from, using the resource centric interface
are:
z Action State
z Sub Activity
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

146
Chapter 5 Activity Diagram

2. Press on the vertical synchronization resource icon . A new vertical synchronization appears.

3. Drag the vertical synchronization to the desired location. Release the mouse button.

4. Rename the newly created vertical synchronization. Press Ctrl + Enter to finish the operation.

Creating a Decision Point


Method 1 – Creating a decision point using the Activity Diagram Palette
1.Click on the decision point button on the Activity Diagram Palette. Click on the desired location on
the diagram. A new decision point appears.

2. Rename the newly created decision point. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a decision point using the resource centric interface


Diagram elements that a decision point can be created from, using the resource centric interface are:
z Action State

147
Chapter 5 Activity Diagram

z Sub Activity
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the decision point resource icon . A new decision point appears.

3. Drag the decision point to the desired location. Release the mouse button.

4. Rename the newly created decision point. Press Ctrl + Enter to finish the operation.

148
Chapter 5 Activity Diagram

Creating a Signal Receipt


Method 1 – Creating a signal receipt using the Activity Diagram Palette
1.Click on the signal receipt button on the Activity Diagram Palette. Click on the desired location on the
diagram. A new signal receipt appears.

2. Rename the newly created signal receipt. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a signal receipt using the resource centric interface


Below is a list of diagram elements that can create signal receipt with transition using the resource centric
interface:
z Action State
z Sub Activity
z Initial State
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Object

1.Click on any existing diagram elements listed above on the diagram. Resource icons appear around the
diagram element.

149
Chapter 5 Activity Diagram

2. Press on the signal receipt resource icon . A new signal receipt appears.

3. Drag the signal receipt to the desired location. Release the mouse button.

4. Rename the newly created signal receipt. Press Ctrl + Enter to finish the operation.

150
Chapter 5 Activity Diagram

Creating a Signal Sending


Method 1 – Creating a signal sending using the Activity Diagram Palette
1.Click on the signal sending button on the Activity Diagram Palette. Click on the desired location on
the diagram. A new signal sending appears.

2. Rename the newly created signal sending. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a signal receipt using the resource centric interface


Diagram elements that signal receipt can be created from, using the resource centric interface are:
z Action State
z Sub Activity
z Initial State
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Object

1.Click on any of the existing diagram elements listed above on the diagram. Resource icons appear around
the diagram element.

2. Press on the signal sending resource icon . A new signal sending appears.

151
Chapter 5 Activity Diagram

3. Drag the signal sending to the desired location. Release the mouse button.

4. Rename the newly created signal sending. Press Ctrl + Enter to finish the operation.

152
Chapter 5 Activity Diagram

Creating an Object
Method 1 – Creating an object using the Activity Diagram Palette
1.Click on the object button on the Activity Diagram Palette. Click on the desired location on the
diagram. A new object is created.

2. Rename the newly created object. Press Ctrl + Enter to finish the operation.

Method 2 – Creating an object using the resource centric interface


Below is a list of diagram elements that can create object with transition using the resource centric interface:
z Action State
z Sub Activity
z Initial State
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

153
Chapter 5 Activity Diagram

2. Press on the object resource icon . A new object appears.

3. Drag the object to the desired location. Release the mouse button.

4. Rename the newly created object. Press Ctrl + Enter to finish the operation.

154
Chapter 5 Activity Diagram

Creating a Transition
Method 1 – Creating a transition using the activity diagram palette
You can create transition between diagram elements listed below in the activity diagram.
z Action State
z Sub Activity
z Initial State (Note: Cannot be the target diagram element)
z Final State (Note: Cannot be the source diagram element)
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

1.Click on the transition button on the Activity Diagram Palette. Drag from the source diagram element
to the target diagram element.

2. Release the mouse button. A new transition is created between the diagram elements.

Method 2 – Creating a transition using the resource centric interface


Diagram elements that a transition can be created from, using the resource centric interface:
z Action State
z Sub Activity
z Initial State
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

155
Chapter 5 Activity Diagram

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2.Press on the any resource icon with transition (, , , …). A new diagram element appears. (Note:
You must choose the resource icon correspondent to the target diagram element)

3. Drag the new diagram element to the target diagram element. The target diagram element is selected.

4. Release the mouse button. The transition is created between the diagram elements.

156
Chapter 5 Activity Diagram

Creating an Object Flow


Method 1 – Creating an object flow using the activity diagram palette
You can create transition between diagram elements listed below in the activity diagram.
z Action State
z Sub Activity
z Initial State (Note: Cannot be the target diagram element)
z Final State (Note: Cannot be the source diagram element)
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

1.Click on the object flow button on the Activity Diagram Palette. Drag from the source diagram
element to the target diagram element.

2. Release the mouse button. A new object flow is created between the diagram elements.

Method 2 – Creating an object flow using the resource centric interface


Diagram elements that an object flow can be created from, using the resource centric interface:
z Action State
z Sub Activity
z Initial State
z Horizontal Synchronization
z Vertical Synchronization
z Decision Point
z Signal Receipt
z Signal Sending
z Object

157
Chapter 5 Activity Diagram

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the object flow to object resource icon . A new diagram element appears.

3. Drag the new diagram element to the target diagram element. The target diagram element is selected.

4. Release the mouse button. The object flow is created between the diagram elements.

158
Chapter 5 Activity Diagram

Creating a Swimlane

1.Click on the swimlane button on the Activity Diagram Palette. Click on the desired location on the
diagram. A new swimlane appears.

159
Chapter 5 Activity Diagram

2. Rename the newly created object. Press Ctrl + Enter to finish the operation.

160
Chapter 5 Activity Diagram

Example
1. Click on the Initial State button on the Activity Diagram Palette. Click on the desired
location on the diagram. A new initial state appears.

Figure 5.6 Initial State

2. Click on the initial state. The Resource icons appear around the initial state. Click on the
Transition -> Action resource icon. A new action state appears. Drag the action state to the
desired location. Rename it as “Validate Customer”.

Figure 5.7 Create the actor state

3. Click on the action state. Resource icons appear around the action state. Click on the
Transition -> Decision. A new decision point with a transition appears. Drag the decision
point to the desired location.

Figure 5.8 Create the decision point

161
Chapter 5 Activity Diagram

4. Click on the decision point. Resource icons appear around the decision point. Click on the
Transition -> Decision resource icon. A new decision point with a transition appears. Drag
the decision point to the desired location. Double click on the transition that between the
decision points. A text box appears. Rename the transition as “[invalid customer]”.

Figure 5.9 Create another decision point

5. Click on the lastly created decision point. Resource icons appear around the diagram element.
Click on the Transition -> Action resource icon. A new action state with a transition appears.
Rename the new action state as “Register Customer”. Rename the transition between the new
action state and the decision point as “[register]”.

162
Chapter 5 Activity Diagram

Figure 5.10 Create another action state

6. Click on the lastly created decision point. Resource icons appear around the diagram element.
Click on the Transition -> Final State resource icon. A new final state with a transition
appears. Drag the final state to the desired location, and rename the transition that between the
decision point. Rename the final state as “[exit]”.

Figure 5.11 Create the final state

163
Chapter 5 Activity Diagram

7. Click on the Initial Sate button on the Activity Diagram Palette. Click on the desired location on
the diagram. A new initial state appears. Click on the new initial state. Resource icons appear
around the initial state. Click on the Transition -> Action. A new action state appears. Drag the
new action state to the Register Customer action state. A transition is created between the new
initial state and the Register Customer action state.

Figure 5.12 Completed Activity Diagram

164
Chapter 5 Activity Diagram

Exercise
Draw the diagram below according to the guidelines given in this chapter.

Figure 5.13 An activity diagram

165
Chapter 6 Collaboration Diagram

Chapter 6 Collaboration Diagram

What is Collaboration Diagram?

Figure 6.1 Collaboration Diagram

166
Chapter 6 Collaboration Diagram

Creating a Collaboration Diagram


Method 1 – Creating a Collaboration Diagram using the Menu Bar
1.Click on File on the menu bar. The file menu appears.
2.Click on New Diagram on the file menu. A cascading menu appears.
3.Click on New Collaboration Diagram on the cascading menu. A blank new collaboration diagram
appears.

167
Chapter 6 Collaboration Diagram

Method 2 – Creating a Collaboration Diagram using the Toolbar


1.Click on Create Collaboration Diagram on the toolbar. A blank new collaboration diagram appears.

168
Chapter 6 Collaboration Diagram

Method 3 – Creating a Collaboration Diagram using the Project Explorer

1. Right click on Collaboration Diagram directory in the Project Explorer. A pop-up menu appears.
2. Click on Create Collaboration Diagram. A blank new collaboration diagram appears.

169
Chapter 6 Collaboration Diagram

Figure 6.2 A blank new collaboration diagram is created.

170
Chapter 6 Collaboration Diagram

The Collaboration Diagram Palette

Icon Notation Definition


A note can be used for comments additional explanation,
specification and requirement in a diagram element or at a link
in the diagram. It is not included in generated code. The
Note contents of a note do not alter the meaning of the model to
which it is attached. A note can contain any combination of text
and graphics. It can also be used in defining a stereotype and
entering a noted element.
Anchor An anchor is to line a diagram element and a note.
Constraint A constraint is a semantic condition or
restriction on model elements that must be
enforced by a correct
design of a system. It is represented as a
linguistic, enclosed in braces ({}), statement in
some formal
(OCL, C++, and other), or natural language. There
are 14 standard constraints in the UML such
asassociation, global, parameter. You may also
define your own constraints.
Package is a mechanism for organizing elements into groups. It
is used in the Use Case, Class, and Component diagrams.
Packages may be nested within other packages. A package may
Package
contain both subordinate packages and ordinary model
elements. The entire system description can be thought of as a
single high-level subsystem package with everything else in it.
Subsystem A subsystem groups use cases or packages together.
The dependency link is a semantic relationship between the two
elements. It indicates that when a change occurs in one element,
Dependency
there may be a change necessary to the other element. A
dependency link can include label and stereotype can be set.
An object can be viewed as an entity at a particular point in time
with a specific value and as a holder of identity that has different
values over time. Associations among objects are not shown.
Object
When you place an object tag in the design area, a lifeline is
automatically drawn and attached to that object tag. You can
define object attributes and assign initial values.
A classifier role is a specific role played by a participant in a
collaboration. It specifies
Classifier Role a restricted view of a classifier, defined by what is required in
the collaboration.

171
Chapter 6 Collaboration Diagram

A link is a connection between two objects. It is a tuple of object


Link
references, and also an instance of association. (UMLUG-red)
Relationships between classifier roles are defined by
association roles. An association role is shown with
the usual association line. The name string of the association
Association Role role follows the same syntax as for the
classifier role. If the name is omitted, a line connected to
classifier role symbols denotes an association
role.
Message to The action that performs from one object to another.
Message from The action that another object performs to itself.
An actor represents a coherent set of roles that users of a system
play when interacting with the use cases of the system. An
Actor actor participates in use cases to accomplish an overall purpose.
An actor can represent the role of a human, a device, or any
other systems
Generalization is a relationship between a general element and a
more specific kind of that element. It means that the more
Generalization specific element can be used whenever the general element
appears. This relation is also known as specialization or
inheritance link.
A swimlane is a way to group activities performed by the same
actor on an activity diagram or to group activities in a single
thread (Douglass 1999). Each zone or lane represents the
Swimlane
responsibilities of a particular class. To use swimlane, you must
arrange activity diagrams into vertical zones separated by
dashed lines. Transitions may cross boundaries

Table 6-1 Collaboration Diagram Palette of VPUML

Drawing a Collaboration Diagram

Creating an Object
Method 1 – Creating an Object using the Diagram Palette
1.Click on Object button on the Diagram Palette and click on the desired location on diagram. A new
object is created.

172
Chapter 6 Collaboration Diagram

2. Rename the newly created object. Press Ctrl + Enter to finish the operation.

Method 2 – Creating an object using the resource centric interface


Diagram element that an object can be created from, using the resource centric interface is:
z Actor

1. Click on an existing actor. The resource icons appear around the diagram element.

2. Press on the Link to Object resource icon . A new object appears.

3. Drag the object to the desired location. Release the mouse button.

173
Chapter 6 Collaboration Diagram

4. Rename the newly created object. Press Ctrl + Enter to finish the operation.

Creating an Actor
Method 1 – Creating an actor using the Diagram Palette
1.To create an actor in your collaboration diagram, click on the Actor button on the Diagram Palette
and click on to the desired location on diagram. A new actor appears.

2. Rename the newly created actor name. Press Ctrl + Enter to finish the operation.

3. The actor name is set.

174
Chapter 6 Collaboration Diagram

Method 2 – Creating an actor using the resource centric interface


Diagram element that an actor can be created from, using the resource centric interface is:
z Object

1. Click on an existing object. The resource icons appear around the diagram element.

2. Press on the Link to Actor resource icon . A new actor appears.

3. Drag the actor to the desired location. Release the mouse button.

4. Rename the newly created actor. Press Ctrl + Enter to finish the operation.

175
Chapter 6 Collaboration Diagram

Creating a Package
Method 1 – Creating a package using the Diagram Palette
1.To create a package in your collaboration diagram, click on the Package button on the Diagram
Palette and click on to the desired location on diagram. A new package appears.

2. Rename the newly created package name. Press Ctrl + Enter to finish the operation.

3. The package name is set.

Creating a Subsystem
Method 1 – Creating a subsystem using the Diagram Palette
1.To create a subsystem in your collaboration diagram, click on the Subsystem button on the Diagram
Palette and click on to the desired location on diagram. A new subsystem appears.

2. Rename the newly created subsystem name. Press Ctrl + Enter to finish the operation.

176
Chapter 6 Collaboration Diagram

3. The subsystem name is set.

Creating a Classifier Role


Method 1 – Creating a Classifier Role using the Diagram Palette
1.To create a classifier role in your collaboration diagram, click on the Classifier Role button on the
Diagram Palette and click on to the desired location on diagram. A new classifier role appears.

2. Rename the newly created classifier role name. Press Ctrl + Enter to finish the operation.

3. The classifier role name is set.

Creating a Link
Method 1 - Creating a link
1. Click on Link button on the diagram palette.

2. Click on an existing actor or object. Drag to the target diagram element.

177
Chapter 6 Collaboration Diagram

3. Release the mouse button.

Method 2 - Creating a link using the resource centric interface


Diagram elements that a link can be created from, using the resource centric interface are:
z Actor
z Object

1. Click on the object. The resource icons appear around the object.

2. Press on the Actor button . An actor appears.

3. Drag the actor to the target diagram element. The target diagram element is selected.

4. Release the mouse button. A link is created between the object and the actor.

178
Chapter 6 Collaboration Diagram

Creating an Association Role


Method 1 - Creating an association role
1. Click on Association Role button on the diagram palette.

2. Click on an existing classifier role. Drag to the target diagram element.

3. Release the mouse button.

Method 2 - Creating an association role using the resource centric interface


Diagram elements that an association role can be created from, using the resource centric interface are:

z Classifier Role

1. Click on the classifier. The resource icons appear around the classifier.

2. Press on the Classifier Role . A classifier role appears.

3. Drag the classifier to the target diagram element. The target diagram element is selected.

4.Release the mouse button. An association role is created between the ClassifierRole1 and the
ClassifierRole2.

179
Chapter 6 Collaboration Diagram

Creating a Message to

Method 1 - Creating a message to

1. Click on Message To button on the Diagram Palette.

2. Click on the link that you want to create message.

3. Rename the newly created message to. Press Ctrl + Enter to finish the operation.

Creating a Message from


Method 1 - Creating a message from

1. Click on Message from button on the Diagram Palette.

180
Chapter 6 Collaboration Diagram

2. Click on the link that you want to create message from.

3. Rename the newly created message from. Press Ctrl + Enter to finish the operation.

Reorder Sequence Numbers of Messages

1. Right click on a blank place on the diagram. A popup menu appears.

181
Chapter 6 Collaboration Diagram

2.Click on Reorder Messages… on the popup menu. The Collaboration Diagram Specification dialog
appears. A list of messages is shown with their sequence number.

3. Right click on a message in the dialog. A popup menu appears.

182
Chapter 6 Collaboration Diagram

4. Click Move Up / Move Down in the popup menu. The message will be moved up or down

5. Click on the Reset Sequence Number in the dialog. The sequence numbers of the messages are updated.

183
Chapter 6 Collaboration Diagram

6.Click on the OK button. The dialog is closed. The sequence numbers of the messages on the diagram are
updated.

Creating a Swimlane
Method 1 - Creating a swimlane

1. Click on Swimlane button on the Diagram Palette.

It is suggested that the swimlane should be created before any other diagram elements in
collaboration diagram. It is because the swimlane is a containment diagram element, if any
other diagram elements are created before the swimlane, these diagram elements may need
to relocate. Once the diagram element is contained by swimlane, when the swimlane is
moved, all the diagram elements contained by the swimlane will be moved too.

184
Chapter 6 Collaboration Diagram

2. Click on anywhere in the diagram. A new swimlane appears on the diagram.

The first created swimlane is always placed on the top of the diagram, and the second
created swimlane will be placed under the first created swimlane, and so on. You can move
the swimlane up or down by dragging the swimlane over the swimlane bar.

3. Rename the newly created swimlane. Press Ctrl + Enter to finish the operation.

If you want to resize the swimlane, you can move the cursor over the edge on the swimlane
bar. Then drag it to the appropriate size you want and release the mouse.

185
Chapter 6 Collaboration Diagram

Creating a Generalization Relationship


You can create generalization relationship between actors.

1. Click on the generalized actor. The resource icons appear around the actor.

2. Press on the generalization from actor resource icon . An actor appears.

3. Drag the actor to the target diagram element. The target diagram element is selected.

4.Release the mouse button. A generalization relationship is created between the generalized actor and the
specialized actor.

186
Chapter 6 Collaboration Diagram

Editing an Object Specification


You can edit the specification of an object.
1. Right click on the object you want to edit. A pop-up menu appears.

2.Click on Open Specification. The properties of the object can be modified using the object specification
dialog box.

187
Chapter 6 Collaboration Diagram

Editing an Actor Specification


1. Right click on the actor. A pop-up menu appears.

2.Click on Open Specification. The actor specification dialog box appears. The properties of the actor
specification can be modified using the actor specification dialog box.

188
Chapter 6 Collaboration Diagram

Generating a Sequence Diagram

1.Open a collaboration diagram from the Project Explorer. Double click on a blank place on the diagram to
generate a new sequence Diagram.

2. A new sequence diagram is generated.

189
Chapter 6 Collaboration Diagram

3. A new sequence diagram is generated from the collaboration diagram.

=>

190
Chapter 6 Collaboration Diagram

Example

1.Click on the Swimlane icon on the toolbar, and then click anywhere in the diagram. A swimlane appears in
the diagram.

Figure 6.3 Create a swimlane

2. Rename the newly created swimlane as “Actor”. Press Ctrl + Enter to finish the operation.

Figure 6.4 Give a name to swimlane

191
Chapter 6 Collaboration Diagram

3.Click on the Swimlane icon on the toolbar to create three more swimlane(s) on the diagram. Name it
as “UI”, “Control” and “Model”. The diagram will look as follow.

Figure 6.5 Create more swimlane

4. Click on the Actor button on the toolbar, and then click on the Actor swimlane. An actor is created.

Figure 6.6 Create an actor

5. Rename the newly created actor name as “Customer”. Press Ctrl + Enter to finish the operation.

192
Chapter 6 Collaboration Diagram

6. Click on the Actor button on the toolbar to create another actor as “Staff”.

7. Click on the Link button on the toolbar. Press on “Customer” and then drag to “Staff” to create a link.

Figure 6.7 Create another actor

8.Click on “Staff”, the resource icons appear around the “Staff”. Click on the Object icon , drag to “UI”
swimlane to create an object.

193
Chapter 6 Collaboration Diagram

9. Rename the newly created object as “Search Vehicle UI”.

Figure 6.8 Create an object

10. Right click on the mouse button on the “Search Vehicle UI”. A pop-up menu appears.

Figure 6.9 Open Specification

194
Chapter 6 Collaboration Diagram

11. Click on Open Specification, the object specification dialog box appears.

Figure 6.10 Object specification dialog

12. Click on the Stereotype pull-down box, choose boundary. Then click OK to close the dialog box.

Figure 6.11 Change the stereotype of the object

195
Chapter 6 Collaboration Diagram

13. The Interface of “Search Vehicle UI” will change as the following figure.

Figure 6.12 Interface of Search Vehicle UI

14. Press on the Object icon , drag to Control swimlane to create another object.

Figure 6.13 Create another object

196
Chapter 6 Collaboration Diagram

15. Rename the newly created object as “Rental Vehicle Control”, and then right click on it to open the
object specification dialog box.

Figure 6.14 Specification Dialog

16. Set the Stereotype type as control. Then click OK to close the dialog box.

Figure 6.15 Set the stereotype as control

197
Chapter 6 Collaboration Diagram

17. The interface of the “Rental Vehicle Control” will change as the following figure.

Figure 6.16 Interface of Rental Vehicle control

18. According to the following table, create other objects on the diagram.

Object Name Stereotype Link with Placement


Search Vehicle Control control Rental Vehicle Control swimlane
Control
Vehicle none Search Vehicle Model swimlane
Control
Validate Customer UI boundary Staff, Rental Vehicle UI swimlane
Control
Validate Customer control Rental Vehicle Control swimlane
Control Control
Customer none Validate Customer Model swimlane
Control
Table 6-2 Objects of the diagram

198
Chapter 6 Collaboration Diagram

19. The diagram will look like the following:

Figure 6.17 Interface of the diagram

20. Click on the Message To icon on the toolbar. Then click on the link which is between Customer and
Staff.

Figure 6.18 To Message

21. Rename the message to as “1. rent a vehicle”.

Figure 6.19 Rename the message

199
Chapter 6 Collaboration Diagram

22. According to the following table, create the message to and message from on the diagram.

From To Message Type name


Staff Validate Customer UI message to 2. input customer id
Validate Customer UI Rental Vehicle message to 3. validateCustomer
Control
Rental Vehicle Validate Customer message to 4. validateCustomer
Control Control
Validate Customer Customer message to 5. isSuspended
Control
Customer Validate Customer message from 6. boolean
Control
Validate Customer Rental Vehicle message from 7. customer
Control Control
Rental Vehicle Validate Customer UI message from 8. String
Control
Validate Customer UI Staff message from 9. customer is valid
Staff Search Vehicle UI message to 10. input model
number
Search Vehicle UI Rental Vehicle message to 11.
Control searchAvailableVehicle
Rental Vehicle Search Vehicle message to 12.
Control Control searchAvailableVehicle
Search Vehicle Vehicle message to 13. isAvailable
Control
Vehicle Search Vehicle message from 14. boolean
Control
Search Vehicle Rental Vehicle message from 15. vehicle
Control Control
Rental Vehicle Search Vehicle UI message from 16. String
Control
Search Vehicle UI Staff message from 17. vehicle is no
available
Staff Customer message from 18. suggest other
choice
Customer Staff message to 19. not accept other
choice
Table 6-3 Messages if the diagram

200
Chapter 6 Collaboration Diagram

23. The completed diagram will look like the following.

Figure 6.20 Completed Collaboration Diagram

201
Chapter 6 Collaboration Diagram

Exercise
Draw the following diagram according to the guidelines given in this chapter.

Figure 6.21 Collaboration Diagram Exercise

202
Chapter 7 State Diagram

Chapter 7 State Diagram

What is a State Diagram?

Figure 7.1 A state diagram

203
Chapter 7 State Diagram

Creating a State Diagram


Method 1 – Creating a State Diagram using the Menu Bar
1. Click on File on the menu bar. The file menu appears.
2. Click on New Diagram on the file menu. A cascading menu appears.
3. Click on New State Diagram on the cascading menu. A blank new state diagram appears.

Figure 7.2 Create State Diagram by menu

204
Chapter 7 State Diagram

Method 2 – Creating a State Diagram using the Toolbar


1. Click on Create State Diagram in the toolbar. A blank new state diagram appears.

Figure 7.3 Create State Diagram by toolbar

205
Chapter 7 State Diagram

Method 3 – Creating a State Diagram using the Project Explorer

1. Right click on Create State Diagram directory in the Project Explorer. A pop-up menu appears.
2. Click on Create State Diagram. A blank new state diagram appears.

Figure 7.4 Create State Diagram by Project Explorer

206
Chapter 7 State Diagram

Figure 7.5 A blank new state diagram is created.

207
Chapter 7 State Diagram

The State Diagram Palette

Icon Notation Definition


A note is used for comments additional explanation,
specification and requirement in a diagram element or at a
link in the diagram. It is not included in generated code.
Note The contents of a note do not alter the meaning of the model
to which it is attached. A note can contain any combination of
text and graphics. It can also be used in defining a stereotype
and entering a noted element.
Anchor An anchor is to line a diagram element and a note.
Constraint A constraint is a semantic condition or restriction on model
elements that must be enforced by a correct
design of a system. It is represented as a linguistic, enclosed
in braces ({}), statement in some formal
(OCL, C++, and other), or natural language. There are 14
standard constraints in the UML such as association, global,
parameter. You may also define your own constraints.
Subsystem A subsystem groups use cases or packages together.
A state is a condition or situation in the life of an object
during which it performs some activities, satisfies some
State conditions or waits for some events. An object is not always
in the same state at a given time. However, an object cannot
be in undefined/unknown state
A concurrent state (also known as a concurrent composite
state) is divided into two or more substates (called regions). It
is a state that contains other state vertices (states,
Concurrent State pseudostates, etc.). Naturally, any substate of a concurrent
state may also be a composite state of either type. Any state
enclosed within a composite state is called a substate of that
concurrent state.
A submachine state represents the invocation of a state
machine defined elsewhere.
The submachine state is depicted as a normal state with the
Submachine State appropriate “include” declaration within its internal
transitions compartment. As an option, the submachine state
may contain one or more stub
states, which represent already created states.
A call state is an action state that has exactly one call action
as its entry action. It is useful in object flow modeling to
Call State
reduce notational ambiguity over which action is taking
input or providing output.

208
Chapter 7 State Diagram

An action state is a shorthand for a state with an entry action


and at least one outgoing transition involving the implicit
event of completing the entry action (there may be several
such transitions if they have guard conditions). Action states
should not have internal transitions, outgoing transitions
based on explicit events, or exit actions, use normal states
Action State for this situation. Transitions leaving an action state should
not include an event signature. Such transitions are
implicitly triggered by the completion of the action in the
state. The transitions may include guard conditions and
actions. The normal use of an action state is to model a step
in the execution of an algorithm (a procedure) or a workflow
process.
A pseudo state to establish the start of the event into an actual
Initial State
state.
The final state symbol represents the completion of the
Final State
activity.
Junction point (see Figure 29 -- Junction point) is used for
joining and splitting transition paths.
Regardless of whether the junction point was reached from
state State 0 or from state State1, the
outgoing paths are the same for both cases. If the state
Junction Point
machine in this example is in state State1 and b
is less than 0 when event e1 occurs, the outgoing transition
will be taken only if one of the three
downstream guards is true. Thus, if a is equal to 6 at that
point, no transition will be triggered.
In the dynamic choice point (see Figure 30 -- Dynamic
choice point), a decision on which branch to take
is only made after the transition from State1 is taken and the
State dynamic
choice point is reached. Note that the action
choice point
associated with that incoming transition computes a new
value. This new value can then be used to
determine the outgoing transition to be taken.
History state is a state machine describes the dynamic
aspects of an object whose current behavior depends on its
past. It allows a sequential composite state to remember the
History State
last substate that was active in it prior to a transition from
the composite state. If transition to this state is activated, the
object resumes the state it last had.
A transition is a relationship between two states. This
transition indicates that control is passed from the one state to
Transition another state once the condition of the source state is
satisfied. To emphasize functional flow of control, transitions

209
Chapter 7 State Diagram

can be labeled, and can contain parameters, guard conditions


and action expressions.
A synch state is a special state that enables synchronization of
Synch state
control between two concurrent regions in a state machine.
This merge branch bar symbol is also known as a
Vertical “Synchronization Bar”. It merges concurrent transitions to a
synchronization single target. It splits a single transition into parallel
transitions.
This merge branch bar symbol is also known as a
Horizontal “Synchronization Bar”. It merges concurrent transitions to a
Synchronization single target. It splits a single transition into parallel
transitions.
A stub state can appear within a submachine state and
represents an actual subvertex
contained within the referenced state machine. It can serve as
a source or destination of
Stub State
transitions that connect a state vertex in the containing state
machine with a subvertex
in the referenced state machine.
StubState is a child of State.

Table 7-1 The State Diagram Palette of VPUML

210
Chapter 7 State Diagram

Drawing a State Diagram

Creating an Initial State


Method 1 – Creating an initial state using the diagram palette
1. To create an initial state in your state diagram, click on the initial State button on the diagram palette
and click on the desired location. A new initial state is created.

2. Rename the newly created initial state name. Press Ctrl + Enter to finish the operation.

3. The initial state name is set.

211
Chapter 7 State Diagram

Creating a State
Method 1 – Creating a state using the diagram palette
1. Click State button on the diagram palette and click on the desired location. A new state is created.

2. Rename the newly created state. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a state using the resource centric approach


Diagram elements that a state can be created from, using the resource centric interface are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point
z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

212
Chapter 7 State Diagram

1. Click on an existing initial state. The resource icons appear around the diagram element.

2. Press on the mouse button on the State icon . A new state appears.

3. Drag the state to the desired location.

4. Rename the newly created state, and press Ctrl + Enter to finish the operation.

213
Chapter 7 State Diagram

Creating a Concurrent State


Method 1 – Creating a concurrent state using the diagram palette
1. Click Concurrent State button on the diagram palette and click on the desired location. A new
concurrent state is created.

2. Rename the newly created concurrent state. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a concurrent state using the resource centric approach


Diagram elements that a concurrent state can be created from, using the resource centric interface are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point
z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

214
Chapter 7 State Diagram

Creating a Submachine State


Method 1 – Creating a submachine state using the diagram palette
1. Click submachine State button on the diagram palette and click on the desired location. A new
submachine state is created.

2. Rename the newly created submachine state. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a submachine state using the resource centric approach


Diagram elements that a concurrent state can be created from, using the resource centric interface are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point
z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

215
Chapter 7 State Diagram

Creating a Call State


Method 1 – Creating a call state using the diagram palette
1. Click call State button on the diagram palette and click on the desired location. A new call state is
created.

2. Rename the newly created call state. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a call state using the resource centric approach


Diagram elements that a call state can be created from, using the resource centric interface are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point
z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

216
Chapter 7 State Diagram

Creating an Action State


Method 1 – Creating an action state using the diagram palette
1. Click action state button on the diagram palette and click on the desired location. A new action state is
created.

2. Rename the newly created action state. Press Ctrl + Enter to finish the operation.

Method 2 – Creating an action state using the resource centric approach


Diagram elements that an action state can be created from, using the resource centric interface are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point
z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

217
Chapter 7 State Diagram

Creating a Junction Point


Method 1 – Creating a Junction Point using the diagram palette
1. Creating a junction point in your state diagram, click on the Junction Point icon on the diagram
palette and click to the desired location. A new junction point appears.

2. Rename the newly created junction point name. Press Ctrl + Enter to finish the operation.

3. The junction point name is set.

Method 2 – Creating a junction point using the resource centric interface


Diagram elements that a junction can be created from, using the resource centric interface are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point
z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

218
Chapter 7 State Diagram

Creating a State Dynamic Choice Point


Method 1 – Creating a state dynamic choice point using the diagram palette
1. To create a state dynamic choice point in your state diagram, click on the State Dynamic Choice Point
button on the diagram palette and click on the desired location. A new state dynamic choice point is
created.

2. Rename the newly created state dynamic choice point name. Press Ctrl + Enter to finish the operation.

3. The state dynamic choice point name is set.

Method 2 – Creating a State Dynamic Choice Point using the resource centric
interface
Diagram elements that a state dynamic choice point can be created from, using the resource centric interface
are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point
z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

219
Chapter 7 State Diagram

Creating a History State


Method 1 – Creating a History State using the diagram palette
1. To create a history state in your state diagram, click on the History State icon on the diagram palette
and click to the desired location. A history state is created.

2. Rename the newly created history state name. Press Ctrl + Enter to set the history state name.

3. The history state name is set.

Method 2 – Creating a History State using the resource centric interface


Diagram elements that a history can be created from, using the resource centric interface are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z State Dynamic Choice Point

220
Chapter 7 State Diagram

Creating a Transition
Method 1 – Creating a transition using the diagram palette
You can create transition between diagram elements listed below in the state diagram.
z Initial State
z State
z Final State
z Junction Point
z Dynamic Point
z History State
z Vertical Synchronization Bar

1. To create a transition in your state diagram, click on the transition icon on the diagram palette and
click on the source diagram element.

2. Then drag to the target diagram element.

3. A transition is created between the initial state and state.

221
Chapter 7 State Diagram

4. Right click the transition, a pop-up menu is displayed.

5. The transition specification dialog box is displayed.

222
Chapter 7 State Diagram

6. Enter “vehicle initial” in the Name field.

7. Click OK to close the transition specification dialog box.

8. Move the transition name to appropriate location.

223
Chapter 7 State Diagram

Method 2 – Creating a transition using the resource centric interface


Diagram elements that a transition can be created from, using the resource centric interface are:
z Initial State
z State
z Junction Point
z Dynamic Point
z History State
z Vertical Synchronization Bar

1. Click on the initial state. The resource icons appear.

2. Press on the mouse button on the include icon . A new state appears.

3. Drag the new state to the desired location. Release the mouse button.

4. A transition is created between the initial state and state.

224
Chapter 7 State Diagram

Creating a Synch state


Method 1 – Creating a Synch state using the diagram palette
1. To create a synch state in your state diagram, click on the synch state button on the diagram palette
and click to the desired location. A new synch state appears.

2. Rename the newly created synch state name. Press Ctrl + Enter to finish the operation.

3. The synch state name is set.

Method 2 – Creating a Synch State using the resource centric interface


Diagram elements that a synch state can be created from, using the resource centric interface are:
z Initial State
z Junction Point
z Dynamic Point
z History State
z Vertical Synchronization Bar

225
Chapter 7 State Diagram

Creating a Vertical Synchronization Bar


Method 1 – Creating a vertical synchronization bar using the diagram palette
1. Creating a vertical synchronization bar in your state diagram, click the vertical synchronization bar icon
on the diagram palette and click to the desired location. A new vertical synchronization appears.

2. Rename the newly created vertical synchronization name. Press Ctrl + Enter to finish the operation.

3. The vertical synchronization name is set.

Method 2 – Creating a vertical synchronization bar using the resource centric


interface
Diagram elements that a vertical synchronization can be created from, using the resource centric interface
are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point

226
Chapter 7 State Diagram

z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

Creating a Horizontal Synchronization Bar


Method 1 – Creating a horizontal synchronization bar using the diagram palette
1. Creating a horizontal synchronization bar in your state diagram, click the horizontal synchronization bar
icon on the diagram palette and click to the desired location. A new horizontal synchronization
appears.

2. Rename the newly created horizontal synchronization name. Press Ctrl + Enter to finish the operation.

3. The horizontal synchronization name is set.

227
Chapter 7 State Diagram

Method 2 – Creating a horizontal synchronization bar using the resource centric


interface
Diagram elements that a horizontal synchronization can be created from, using the resource centric interface
are:
z State
z Concurrent State
z Submachine State
z Call State
z Action State
z Initial State
z Junction Point
z State Dynamic Choice Point
z History State
z Synch State
z Vertical Synchronization Bar
z Horizontal Synchronization Bar
z Stub State

Editing a State Object Specification


You can edit the specification of a state.
1. Right click on the state that you want to edit. A pop-up menu appears.

228
Chapter 7 State Diagram

2. Click on Open Specification. A state specification dialog box appears. The name and other related
information in the General tab can be modified in the state specification.

229
Chapter 7 State Diagram

Example
1. Click on the initial state button on the toolbar, and then click to the desired location. A new initial
state appears.

Figure 7.6 Initial State button

2. Select the newly created initial state, the resource centric is displayed. Then click on state icon and drag to
the desired location.

3. Rename the newly created state as “Available”.

4. Click the state button on the tool bar to create one more state.

Figure 7.7 Create new state

5. Rename the newly created state as “Not Available”.

Figure 7.8 Rename the state

230
Chapter 7 State Diagram

6. Select the Not Available state, and then select the resize box.

Figure 7.9 Resize the state

7. Drag it to make the size of “Not Available” state larger.

Figure 7.10 Drag the state

231
Chapter 7 State Diagram

8. Click on the state button on the toolbar, and then click inside the “Not Available” state.

Figure 7.11 Rename the state

232
Chapter 7 State Diagram

9. Rename the newly created state as “Repairing”.

Figure 7.12 Give the name of state

233
Chapter 7 State Diagram

10. Then create two more states inside the “Not Available state” and rename them as “Rented” and “Booked”
respectively.

Figure 7.13 Create more states

11. Select the “Available” state, and then press on the state icon on the resource centric.

Figure 7.14 Connect the state

234
Chapter 7 State Diagram

12. Drag to the “Repairing” state to create a transition.

Figure 7.15 Drag the Repairing state

13. Press on the new transition.

Figure 7.16 Format the connector

235
Chapter 7 State Diagram

14. Drag it to the appropriate location.

Figure 7.17 Drag to appropriate location

15. Right click on the transition. A pop-up menu appears.

Figure 7.18 Open Specification

236
Chapter 7 State Diagram

16. Click on Open Specification. The transition specification dialog box appears.

Figure 7.19 Specification Dialog

17. Enter “send to repairing” in the Name field and click OK.

Figure 7.20 Enter the name

237
Chapter 7 State Diagram

18. The transition name is displayed on the diagram.

Figure 7.21 Named transition

19. Drag the transition name to appropriate location.

Figure 7.22 Place the caption to a right place

238
Chapter 7 State Diagram

20. According to above method, follow the table below to create more transitions on the diagram, and adjust
the transitions and transition names to appropriate locations.

From To Name
Repairing Available repaired
Available Rented rental issued
Rented Available returned
Available Booked booking issued
Booked Available booking cancelled
Booked Rented booking change to
rental
Table 7-2 Transitions table

21. The completed diagram will look as follow.

Figure 7.23 Completed State Diagram

239
Chapter 7 State Diagram

Exercise
Draw the below diagram according to the guidelines given in this chapter.

Figure 7.24 Exercise state diagram.

240
Chapter 8 Class Diagram

Chapter 8 Class Diagram

What is a Class Diagram?

Figure 8.1 A class diagram.

Creating a Class Diagram


Method 1 – Creating a blank new class diagram using the main menu

1. Click on File on the main menu. The file menu appears.


2. Click on New Diagram on the file menu. A cascading menu appears.
3. Click on New Class Diagram on the cascading menu. A blank new class diagram appears.

241
Chapter 8 Class Diagram

Method 2 – Creating a blank new class diagram using the toolbar

1. Click on Create Class Diagram on the toolbar. A pop-up menu appears.

2. Click on Create Class Diagram on the pop-up menu. A blank new class diagram appears.

242
Chapter 8 Class Diagram

Method 3 – Creating a blank new class diagram using the Project Explorer

1. Right click on the Class Diagram directory in the Project Explorer. A pop-up menu appears.
2. Click on Create Class Diagram on the pop-up menu. A blank new class diagram appears.

243
Chapter 8 Class Diagram

Figure 8.2 A blank new class diagram is created.

244
Chapter 8 Class Diagram

The Class Diagram Palette

Icon Notation Definition


Note A note is used for comments additional explanation,
specification and requirement in a diagram element or at a
link in the diagram. It is not included in generated code.
The contents of a note do not alter the meaning of the model
to which it is attached. A note can contain any combination of
text and graphics. It can also be used in defining a stereotype
and entering a noted element.
Anchor An anchor is used to line a diagram element and a note.
Constraint
Model
Package A package is a mechanism for organizing elements into
groups. It is used in the Use Case, Class, and Component
diagrams. Packages may be nested within other packages. A
package may contain both subordinate packages and ordinary
model elements. The entire system description can be
thought of as a single high-level subsystem package with
everything else in it
Subsystem A subsystem groups diagram elements together.
Class A Class is a description for a set of objects that shares the
same attributes, and has similar operations, relationships,
behaviors and semantics.
Generalization Generalization is a relationship between a general element
and a more specific kind of that element. It means that the
more specific element can be used whenever the general
element appears. This relation is also known as specialization
or inheritance link.
Usage Usage is a dependency situation in which one element (the
client) requires the presence of another element (the supplier)
for its correct functioning or implementation.
Realization Realization is the relationship between a specialization and its
implementation. It is an indication of the inheritance of
behavior without the inheritance of structure. One classifier
specifies a contract such that another classifier guarantees to
carry out Realization is used in two places: one is between
interfaces and the classes that realize them, and the other is
between use cases and the collaboration that realize them.
Association Association is represented by drawing a line between classes.
Associations represent structural relationships between
classes and can be named to facilitate model understanding.

245
Chapter 8 Class Diagram

If two classes are associated, you can navigate from an object


of one class to an object of the class.
Aggregation Aggregation is a special kind of association in which one
class represents as the larger class that consists of a smaller
class. It has the meaning of “has-a” relationship.
Composition Composition is a strong form of aggregation association. It
has strong ownership and coincident lifetime of parts by the
whole. A part may belong to only one composite. Parts with
non-fixed multiplicity may be created after the composite
itself. But once created, they live and die with it (that is, they
share lifetimes). Such parts can also be explicitly removed
before the death of the composite.
N-ary Association N-ary associations are associations that connect more than
two classes. Each instance of the association is an n-tuple of
values from the respective classes. There are several
characteristics for n-ary associations, which are: (i)
Multiplicity for ternary associations can be specifie; (ii) The
name of the association (if any) is shown near the diamond;
(iii) Role adornments can appear on each path as with a binary
association; (iv) The multiplicity on a role represents the
potential number of instance tuples in the association when
the other N-1 values are fixed. Indeed, binary association is
a special case that it has its own notation.
Association Class Association class is an association that is also a class. It has
both association and class properties. It can have attributes,
operations and even other associations. It usually helps to
further define a many-to-many relationship.
Dependency The dependency link is a semantic relationship between the
two elements. It indicates that when a change occurs in one
element, there may be a change necessary to the other
element. A dependency link can include label and stereotype
can be set.
Abstraction
Binding
Dependency
Permission
Collaboration
Containment

Table 8-1 The Class Diagram Palette of VPUML

246
Chapter 8 Class Diagram

Creating a Class
Method 1 – Creating a class using the Class Diagram Palette
1.Click on the Class button on the Class Diagram Palette. Click on the desired location on the
diagram. A new class appears.

2. Rename the newly created class. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a class using the resource centric interface


Diagram elements that a class can be created from, using the resource centric interface are:
z Class
z Package
z N-ary Association

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

247
Chapter 8 Class Diagram

2. Press one of the resource icons with Class ( , , , ...). A new class appears.

3. Drag the new class to the desired location. Release the mouse button.

4. Rename the newly created class. Press Ctrl + Enter to finish the operation.

Adding an Attribute
Method 1 – Adding an attribute to a class using the pop-up menu

248
Chapter 8 Class Diagram

1. Right click on the class. A pop-up menu appears.

2. Click on New attribute on the pop-up menu. A new attribute is added to the class.

3. Double click on the newly created attribute.

249
Chapter 8 Class Diagram

4. Press Ctrl + Enter to finish the operation.

Method 2 – Adding an attribute to a class using the specification dialog box


1. Right click on an existing class on the diagram. A pop-up menu appears.

250
Chapter 8 Class Diagram

2. Click on Open specification on the pop-up menu. The class specification dialog box appears.

3. Click on the Attributes tab in the specification dialog box. The attribute table appears.

251
Chapter 8 Class Diagram

4. Right click on the attribute table. A pop-up menu appears.

5.Click on Add… on the pop-up menu. The Attribute Specification dialog appears. In the General tab, edit
attribute properties – Name, Initial Value, Multiplicity, Visibility, Type, Scope, Documentation and
Visible.

252
Chapter 8 Class Diagram

6.Click on the Java Attribute Code Detail in the dialog. Set the final, transient, and volatile properties for
the attribute.

253
Chapter 8 Class Diagram

7.Click on OK button to close the Attribute Specification dialog box. The attribute is added to the class.
Click on OK button to close the Class Specification.

8. The new attribute is added to the class.

Adding an Operation
Method 1 – Adding an operation to a class using the pop-up menu

254
Chapter 8 Class Diagram

1. Right click on an existing class on the diagram. A pop-up menu appears.

2. Click on New operation in the pop-up menu. A new operation is added.

3. Rename the operation name. Press Ctrl + Enter to finish the operation.

255
Chapter 8 Class Diagram

Method 2 – Adding an operation in a class using the specification dialog box

1. Right click on an existing class. A pop-up menu appears.

256
Chapter 8 Class Diagram

2. Click on Open Specification in the pop-up menu. The class specification dialog box appears.

3. Click on the Operation tab. The operation table appears.

257
Chapter 8 Class Diagram

4. Right click on the operation table. A pop-up menu appears.

5.Click on Add... button on the popup menu. The Operation Specification dialog appears. In the General
tab, edit the properties – Name, Stereotype, Return Type, Visibility, Scope, Documentation, Abstract,
Query and Visible.

258
Chapter 8 Class Diagram

6. Click on the Parameter tab in the Operation Specification dialog.

259
Chapter 8 Class Diagram

7.To add parameter to the operation, click the Add… button in the dialog. The Parameter Specification
dialog appears. Edit the parameter properties – Name, Stereotype, Type, Direction, Default Value and
Documentation.

8.Click the Java Parameter Code Detail tab in the Parameter Specification dialog. Edit the final
properties for the parameter.

260
Chapter 8 Class Diagram

9. Click on OK to close the Parameter Specification dialog. The new parameter is added to the operation.

261
Chapter 8 Class Diagram

10. Click the Java Operation Code Detail in the Operation Speciation dialog. Edit the properties - final,
native and synchronized for the operation.

262
Chapter 8 Class Diagram

11. Click OK button to close the Operation Specification dialog. The new operation is added to the class.

12. Click OK button to close the Class Specification dialog.

Sorting Attributes and Operations

263
Chapter 8 Class Diagram

1. Right click on an existing class. A pop-up menu appears.

2. Click on Presentation Options in the popup menu. A cascading menu appears.

264
Chapter 8 Class Diagram

3. Click on Attribute Sort Type in the popup menu. A cascading menu appears.

4. Choose one of the sorting types in the cascading menu. The attributes of the class will be sorted.

265
Chapter 8 Class Diagram

5. Right click on the class again. A pop-up menu appears.

6. Click on Presentation Options in the popup menu. A cascading menu appears.

266
Chapter 8 Class Diagram

7. Click on Operation Sort Type in the popup menu. A cascading menu appears.

8. Choose one of the sorting types in the cascading menu. The operations of the class will be sorted.

Visibility Setting
By default, the visibility style is set to icon style. The visibility style for a class can be changed.

267
Chapter 8 Class Diagram

1. Right click on an existing class. A pop-up menu appears.

2. Click on Presentation Options on the pop-up menu. A cascading menu appears.

268
Chapter 8 Class Diagram

3.Click on Visibility Style on the pop-up menu. A cascading menu appears. Check the UML Style
option.

4. The visibility style of the class is set to UML style.

269
Chapter 8 Class Diagram

5. To disable the visibility, check the Off checkbox. The visibility is disabled.

Defining an Abstract Class

1. Right click on an existing class. A pop-up menu appears.

270
Chapter 8 Class Diagram

2. Check the Abstract Class option on the pop-up menu. The class is set to abstract class.

Defining Active Class

1. Right click on an existing class. A pop-up menu appears.

2. Check on the Action checkbox on the pop-up menu. The class is set to active.

271
Chapter 8 Class Diagram

Defining the Stereotype of a Class

1. Right click on an existing class. A pop-up menu appears.

272
Chapter 8 Class Diagram

2. Click on Open Specification on the pop-up menu. The specification dialog box appears.

3.Click on the General tab. Click on the Stereotype pull-down box and select one of the stereotypes
(Interface, Entity, Control, Boundary, or define a new stereotype by typing the stereotype name in the
pull-down box).

273
Chapter 8 Class Diagram

4. Click on OK to close the specification dialog box. The shape of the class will be changed.

Interface

Entity

Control

Boundary

User define

274
Chapter 8 Class Diagram

Creating a Package
Method 1 – Creating a package using the Class Diagram Palette
1.Click on the Package button on the Class Diagram Palette. Click on the desired location on the
diagram. A new package appears.

2. Rename the newly created package. Press Ctrl + Enter to finish the operation.

3. Create a class in the package. Then the package contains the class.

4. The project tree in the Project Explorer will show the hierarchy of the packages.

275
Chapter 8 Class Diagram

Method 2 – Creating a package using the resource centric interface


Diagram elements that a package can be created from, using the resource centric interface are:
z Class
z Package

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press one of the resource icons with Class ( , , ...). A new class appears.

276
Chapter 8 Class Diagram

3. Drag the new package to the desired location. Release the mouse button.

4. Rename the newly created package. Press Ctrl + Enter to finish the operation.

Creating a Collaboration
Method 1 – Creating a collaboration using the Class Diagram Palette
1.Click on the Collaboration button on the Class Diagram Palette. Click on the desired location
on the diagram. A new collaboration appears.

2. Rename the newly created collaboration. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a collaboration using the resource centric interface


Collaboration can be created from an existing collaboration , using the resource centric interface.

277
Chapter 8 Class Diagram

1. Click on a collaboration listed above on the diagram. Resource icons appear around the collaboration.

2. Press one of the resource icons with collaboration. A new collaboration appears.

3. Drag the new collaboration to the desired location. Release the mouse button.

4. Rename the newly created collaboration. Press Ctrl + Enter to finish the operation.

278
Chapter 8 Class Diagram

Defining a Constraint

A constraint can be created between diagram elements.

1.Click on the Constraint button on the Class Diagram Palette. Drag from the source diagram
element to the target diagram element.

2. Rename the newly created constraint. Press Ctrl + Enter to finish the operation.

279
Chapter 8 Class Diagram

Creating an Association Link


Method 1 – Creating an association link using the Class Diagram Palette
An association can be created between
z A class ,
z An Association Class , and
z A N-ary association .

1.Click on the Association button on the Class Diagram Palette. Drag from the source diagram element
to the target diagram element.

2. Release the mouse button. A new association is created between the diagram elements.

Method 2 – Creating association using the resource centric interface


Diagram elements that an association link can be created from, using the resource centric interface are:
z A class ,
z An association class , or
z An N-ary association .

280
Chapter 8 Class Diagram

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the Association -> Class button. A new class appears.

3. Drag the new class to the target diagram element. The target diagram element is selected.

4. Release the mouse button. The association link is created between the diagram elements.

281
Chapter 8 Class Diagram

Creating an Aggregation Relationship Link


Method 1 – Creating an aggregation relationship link using the Class Diagram Palette
An aggregation relationship link can be created between classes.

1.Click on the Aggregation button on the Class Diagram Palette. Drag from a class to the other
class.

2. Release the mouse button. A new aggregation relationship link is created between the classes.

Method 2 – Creating an aggregation relationship using the resource centric interface

1. Click on an existing class. Resource icons appear the class.

282
Chapter 8 Class Diagram

2. Press on the Aggregation -> class resource icon. A new class appears.

3. Drag the new class to the target class. The new class disappears. The target class is selected.

4. Release the mouse button. The aggregation relationship link is created between the classes.

Method 3 – Creating an aggregation relationship link using an existing association relationship link
You can change an existing association relationship link to an aggregation relationship link.

1. Right click on an existing association. A pop-up menu appears.

283
Chapter 8 Class Diagram

2. Click Role A / Role B on the popup menu. A cascading menu appears.

3. Click Aggregation Kind on the cascading menu. A list of aggregation kinds appears.

4.Click on Aggregation on the pop-up menu. The association relationship is changed to an aggregation
relationship link.

284
Chapter 8 Class Diagram

Creating a Composition Relationship Link


Method 1 – Creating a composition relationship link using the Class Diagram Palette
A composition relationship link can be created between classes.

1.Click on the Composition button on the Class Diagram Palette. Drag from a class to the other
class.

2. Release the mouse button. A new composition relationship link is created between the classes.

Method 2 – Creating a composition relationship link using the resource centric interface

1. Click on an existing class in the diagram. Resource icons appear the class.

285
Chapter 8 Class Diagram

2. Press on the Composition -> Class . A new class appears.

3. Drag the new class to the target class. The new class disappears. The target class is selected.

4. Release the mouse button. The composition relationship link is created between the classes.

Method 3 – Creating a composition relationship link using an existing association relationship link
An existing association relationship link can be changed to a composition relationship link.

1. Right click on an existing association link. A pop-up menu appears.

286
Chapter 8 Class Diagram

2. Click on Role A / Role B on the popup menu. A cascading menu appears.

3. Click on Aggregation Kind in the cascading menu. A list of aggregation kinds appears.

4.Click on Composition on the pop-up menu. The association relationship link is then changed to a
composition relationship link.

287
Chapter 8 Class Diagram

Defining a Association Role


Method 1 – Defining association roles using the pop-up menu

1. Right click on an existing association. A popup menu appears.

2. Click on Role A / Role B on the popup menu. A cascading menu appears.

288
Chapter 8 Class Diagram

3.To edit if the role is navigable or not, click on the Navigable check box. The navigation between the
elements is changed

4.To edit the multiplicity of a role, right click on the association. A popup menu appears. Click on Role A /
Role B on the popup menu. A cascading menu appears.

5. Click on Multiplicity on the cascading menu. A list of multiplicities appears.

289
Chapter 8 Class Diagram

6. Choose one of the multiplicities. The multiplicity of the role is set.

7. Use the same way to set the multiplicity of the other role.

8.To edit the visibility of the role, right click on the association. A popup menu appears. Click on Role A /
Role B. A cascading menu appears.

9. Click on Visibility on the cascading menu. A list of visibilities appears. Choose one of the visibilities.

290
Chapter 8 Class Diagram

10. To edit the aggregation kind, right click on the association. A popup menu appears. Click on Role A /
Role B. A cascading menu appears.

11. Click on Aggregation Kind on the cascading menu. A list of aggregation types appears.

12. Choose one of the aggregation kinds. The aggregation type of the role is changed.

291
Chapter 8 Class Diagram

13. To edit a role name, right click on the association. A popup menu appears. Click Role A / Role B on the
popup menu. A cascading menu appears.

14. Click Edit Role A/B Role Name on the cascading menu. An input dialog appears.

15. Click on the OK button to finish the operation.

292
Chapter 8 Class Diagram

Method 2 – Defining association roles using Association Specification dialog

1. Right click on the association. A popup menu appears.

293
Chapter 8 Class Diagram

2. Click Open Specification… on the popup menu. The Association Specification dialog appears.

294
Chapter 8 Class Diagram

3.Edit the Role name, Multiplicity and Navigable properties of the roles. Or click on the button near
the Role text field. The Association End Specification dialog appears. Edit the properties of the role.

4. Click on the Qualifier tab on the Association End Specification dialog.

295
Chapter 8 Class Diagram

5.Click the Add… button on the Association End Specification dialog. The Attribute Specification dialog
appears. (See Adding an Attribute Section)

6. Click on the OK button on the Attribute Specification dialog. The new attribute is added as a qualifier.

296
Chapter 8 Class Diagram

7. Click OK button on the Association End Specification dialog.

Creating a Generalization Relationship Link


Method 1 – Creating a generalization relationship link using the Class Diagram Palette
A generalization relationship link can be created between:
z A class and a class , or
z A package and a package .

1.Click on the Generalization button on the Class Diagram Palette. Drag from the source diagram
element to the target diagram element.

2.Release the mouse button. A new generalization relationship link is created between the diagram elements.

Method 2 – Creating a generalization relationship link using the resource centric interface
Diagram elements that a generalization relationship link can be created from, using the resource centric
interface:
z A class , and
z A package .

297
Chapter 8 Class Diagram

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the Generalization -> class button resource icon. A new diagram element appears.

3.Drag the new diagram element to the target diagram element. The new diagram element disappears. The
target diagram element is selected.

4. Release the mouse button. The generalization relationship link is created between the diagram elements.

298
Chapter 8 Class Diagram

Creating a Realization Relationship Link


Method 1 – Creating a realization relationship link using the Class Diagram Palette
A realization relationship link is created between classes.

1.Click on the Realization button on the Class Diagram Palette. Drag from a class to the other
class.

2. Release the mouse button. A new realization relationship link is created between the classes.

Method 2 – Creating a realization relationship link using the resource centric interface

299
Chapter 8 Class Diagram

1. Click on a class on the diagram. Resource icons appear around the class.

2. Press on the Realization -> class resource icon . A new class appears.

3. Drag the new class to the target class. The new class disappears. The target class is selected.

4. Release the mouse button. The realization relationship link is created between the classes.

300
Chapter 8 Class Diagram

Creating a Dependency Relationship Link


Method 1 – Creating a dependency relationship using the Class Diagram Palette
The dependency relationship link can be created between:
z A class and a class ,
z A packages and a package , or
z A class and a package

1.Click on the Dependency button on the Class Diagram Palette. Drag from the source diagram
element to the target diagram element.

2. Release the mouse button. A new dependency relationship link is created between the diagram elements.

Method 2 – Creating a dependency relationship link using the resource centric interface
Diagram elements that a dependency relationship link can be created from, using the resource centric
interface are:
z A class , and
z A package.

301
Chapter 8 Class Diagram

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the resource icon with dependency ( , ,…). A new diagram element appears.

3.Drag the new diagram element to the target diagram element. The new diagram element disappears. The
target diagram element is selected.

4. Release the mouse button. The dependency relationship link is created between the diagram elements.

Creating an Association Class


Method 1 – Creating an association class using the Class Diagram Palette
1.Click on the Association class button on the Class Diagram Palette. Drag on the association
relationship link to the target class.

302
Chapter 8 Class Diagram

2. Release the mouse button. The target class becomes an association class.

Method 2 – Creating an association class using the resource centric interface

1. Click on an existing association relationship link. Resource icons appear the association relationship link.

2. Press on the Association class resource icon . A new class appears.

3. Drag the class to the desired location. Release the mouse button.

4. Rename the newly created association class. Press Ctrl + Enter to finish the operation.

303
Chapter 8 Class Diagram

Creating an N-ary Association between Classes


Method 1 – Creating an n-ary association between classes using the Class Diagram Palette

1.Click on the n-ary button on the Class Diagram Palette. Click on the desired location on the
diagram. A new n-ary association element is created.

2.Click on the newly created n-ary association element. Resource icons appear around the n-ary association
element.

3.Click on one type of association (Association , Aggregation , or Composition -> Class ) on


the Class Diagram Palette. Drag from the n-ary association element to a class on the diagram.

304
Chapter 8 Class Diagram

4.Release the mouse button. A new association link is created between the class and the n-ary association
element. Repeat the steps above to make the n-ary association element to link to more classes.

Method 2 – Creating an n-ary association using the resource centric interface


1.Click on the n-ary button on the Class Diagram Palette. Click on the desired location on the
diagram. A new n-ary association element appears.

2.Click on the newly created n-ary association element. Resource icons appear around the n-ary association
element.

3. Click on one type of associations ( , , , …). A new class appears.

4.Drag the new class to the desired location. Release the mouse button. The association is created between
the new class and the n-ary association element.

305
Chapter 8 Class Diagram

5. Repeat the steps above to make the n-ary association element to link to more classes.

Creating a Containment Relationship


Method 1 – Creating an containment relationship using the Class Diagram Palette
A containment relationship can be created
z Between a class and a class ,
z Between a package and any type of diagram elements,
z Between a subsystem and any type of diagram elements,
z Between a model and any type of diagram elements,

1.Click on the Containment button on the Class Diagram Palette. Drag from the source diagram
element to the target diagram element.

2. Release the mouse button. A new containment relationship is created between the diagram elements.

306
Chapter 8 Class Diagram

Method 2 – Creating containment relationship using the resource centric interface


Diagram elements that a containment relationship can be created from, using the resource centric interface
are:
z A class ,
z A package ,
z A subsystem , or
z A model ,

1.Click on an existing diagram element listed above on the diagram. Resource icons appear around the
diagram element.

2. Press on the Containment -> Class button. A new class appears.

307
Chapter 8 Class Diagram

3. Drag the new class to the target diagram element. The target diagram element is selected.

4. Release the mouse button. The containment relationship is created between the diagram elements.

Creating a Class Diagram with Real Time Code Generation

Method 1 – Creating a blank new class diagram using with real time code generation the main menu

1.Click on File on the main menu. The file menu appears.


2.Click on New Diagram on the file menu. A cascading menu appears.
3.Click on New Class Diagram with Real Time Code Generation on the cascading menu. A blank new
class diagram appears.

308
Chapter 8 Class Diagram

Method 2 – Creating a blank new class diagram with real time code generation using the toolbar

1.Click on Create Class Diagram on the toolbar. A pop-up menu appears.

2.Click on Create Class Diagram with Real Time Code Generation on the pop-up menu. A blank new
class diagram appears.

309
Chapter 8 Class Diagram

Method 3 – Creating a blank new class diagram using the Project Explorer

1.Right click on the Class Diagram directory in the Project Explorer. A pop-up menu appears.
2.Click on Create Class Diagram with Real Time Code Generation on the pop-up menu. A blank new
class diagram appears.

Figure 8.3 A blank new class diagram is created.

310
Chapter 8 Class Diagram

Method 4 – Real Time Code Generation for an Existing Class Diagram

1. Right click on a blank place on an existing class diagram. A popup menu appears.

311
Chapter 8 Class Diagram

2. Check the Show Code Pane check box.

3. The Code Pane is shown below the class diagram.

312
Chapter 8 Class Diagram

4. Right click on the class diagram again. A popup menu appears.

5. Check the Real Time Generate Code check box.

313
Chapter 8 Class Diagram

6. Click on any existing class in the class diagram. The code will be generated in the Code Pane.

Real Time Code Generation for a Class

1. Create a new class on the class diagram. The generated code for the class is shown in the Code Pane.

314
Chapter 8 Class Diagram

2. Right click on the class. A popup menu appears.

3. Check the Abstract check box. The code is update immediately.

315
Chapter 8 Class Diagram

4. Right click on the class. A popup menu appears.

5. Click on Open Specification on the popup menu. The Class Specification dialog appears.

316
Chapter 8 Class Diagram

6.Click on the Java Class Code Detail tab in the Class Specification dialog. The class can be set to final or
interface.

7. Check the interface check box. The code will be updated.

317
Chapter 8 Class Diagram

Real Time Code Generation for a Class Attribute

1. Right click on an existing class on the class dialog. A popup menu appears.

2.Click on New Attribute on the popup menu. A new attribute is added to the class and the code in the Code
Pane is updated at the same time.

318
Chapter 8 Class Diagram

3. Right click on the class. A popup menu appears.

4. Click on Open Specification on the popup menu. The Class Specification dialog appears.

319
Chapter 8 Class Diagram

5. Click on the Attributes tab in the Class Speciation dialog. A list of attributes is shown.

6. Double click on an attribute. The Attribute Specification dialog appears.

320
Chapter 8 Class Diagram

7. Edit the attribute properties – Name, Initial Value, Visibility and Type.

321
Chapter 8 Class Diagram

8.Click on the Java Attribute Code Detail tab on the Attribute Specification dialog. Check the final check
box.

9.Click on the OK button on the Attribute Specification dialog to close it. The Class Specification dialog is
active again.

322
Chapter 8 Class Diagram

10. Click on the OK button on the Class Specification dialog to close it. The code for the attribute is
updated.

Real Time Code Generation for a Class Operation

1. Right click on an existing class. A popup menu appears.

323
Chapter 8 Class Diagram

2.Click on New Operation on the popup menu. A new operation is added to the class and the code generated
for the operation is added to the Code Pane.

3. Right click on the class. A popup menu appears.

324
Chapter 8 Class Diagram

4. Click on Open Specification on the popup menu. The Class Specification dialog appears.

5. Click on the Operations tab in the Class Specification dialog. A list of operations is shown.

325
Chapter 8 Class Diagram

6. Double click on an operation. The Operation Specification dialog appears.

326
Chapter 8 Class Diagram

7. Edit the operation properties – Name and Return Type.

327
Chapter 8 Class Diagram

8. Click on the Java Operation Code Detail tab in the Operation Specification dialog.

328
Chapter 8 Class Diagram

9. An operation can be set to be final, native or synchronized. Click on the Parameters tab in the dialog

329
Chapter 8 Class Diagram

10. Click on the Add… button to add a parameter. The Parameter Speciation dialog appears.

11. Edit the parameter properties – Name and Type.

330
Chapter 8 Class Diagram

12. Click the Java Parameter Code Detail in the Parameter Specification dialog.

331
Chapter 8 Class Diagram

13. A parameter can be set to be final. Click on the OK button in the dialog to close it. The Operation
Specification dialog is active again.

332
Chapter 8 Class Diagram

14. A new parameter is added to the operation. Click the OK button to close the Operation Speciation
dialog. The Class Specification dialog is active again.

15. Click the OK button in the Class Specification dialog. The code generated for the operation is updated.

333
Chapter 8 Class Diagram

Real Time Code Generation for a Class with Package

1. Create a new package on the class diagram.

2. Place an existing class in the package. The code generated for the class is updated.

334
Chapter 8 Class Diagram

Real Time Code Generation for Importing a Package

1. Create a new package on the class diagram.

2.Create a dependency relationship between an existing class and the new package. The code generated for
the class is updated.

335
Chapter 8 Class Diagram

Real Time Code Generation for Importing a Class

1. Create a new class on the class diagram.

2.Create a dependency relationship between a class and the new class. The code generated for the importing
class is updated.

336
Chapter 8 Class Diagram

Example
1.Click on the class button on the Class Diagram Palette. Click on the desired location on the class diagram.
A new class appears. Rename the class as “Vehicle”. Then right click on the class. A pop-up menu appears.
Click on N ew Attribute on the pop-up menu. A new attribute is added to the class. Double click on
the new attribute. A text box appears. Type “-regNo” in the text box. (- for private, + for public, # for
protected). Add more attributes: -modelNo, . Add more operations: +isAvailable():Boolean, .

Figure 8.4 The vehicle class

2.Right click on the Vehicle class. A pop-up menu appears. Click on Visibility Option on the pop-up
menu. A cascading menu appears. Click on UML Style on the cascading menu.

Figure 8.5 UML style of a class

3.Click on the Vehicle class. Resource icons appear around the class. Click on the Association -> Class
resource icon. A new class appears. Drag the new class to the desired location. Rename the new class as
“Branch”. An association relationship is created between the classes.

Figure 8.6 Create the Branch Class

337
Chapter 8 Class Diagram

4.Right click on the association link. A pop-up menu appears. Click on Role A(Vehicle). A cascading
menu appears. Click on Multiplicity on the cascading menu. A list of multiplicities appears. Click on 0..*.
The multiplicity of Vehicle role is set to 0..*. Right click on the association link again. A pop-up menu
appears. Click on Role B(Branch) in the pop-up menu. A cascading menu appears. Click on
Multiplicity on the cascading menu. A list of multiplicities appears. Click on 1 on the cascading menu. The
multiplicity of the Branch role is set to 1. Right click on the new association link. A pop-up menu appears.
Click on Role B(Branch). A cascading menu appears. Uncheck the Navigable checkbox on the
cascading menu.

Figure 8.7 Define the multiplicity

5.Create a new class. Rename the class as “Rental”. Then create another new class and rename the class as
“Customer”. Create an association relationship link between the Customer class and Rental class. Set the
multiplicity of Customer role to 1 and the Rental role to 0..*. Right click on the new association link. A
pop-up menu appears. Click on Role B(Rental) on the pop-up menu. A cascading menu appears. Uncheck
the Navigable checkbox on the cascading menu.

Figure 8.8 Create the Customer class

338
Chapter 8 Class Diagram

6.Click on the Rental class. Resource icons appear around the class. Click on Composition -> Class
resource icon. A new class appears. Drag the new class to the desired location. Rename the new class as
“RentalLine”. A composition relationship is created between the classes. Set the multiplicity of Rental role
to 1 and RentalLine role to 0..*., and set the Rental role to not navigable.

Figure 8.9 Create the RentalLine class

7.Click on the Branch class. Resource icons appear around the class. Click on Aggregation -> Class
resource icon. A new class appears. Drag the new class to the desired location. Rename the new class as
“Staff”. A composition relationship link is created between the classes. Set the multiplicity of Staff role to 1
and of Branch role to 0..*.

Figure 8.10 Create the staff class

339
Chapter 8 Class Diagram

8.Click on the Staff class. Resource icons appear around the class. Click on Self Association resource
icon. A new self association link is created with the class. Right click on the self association. A pop-up
menu appears. Click on Role A(Staff) in the pop-up menu. A cascading menu appears. Click Edit
Role A Role name on the cascading menu. A text box appears. Type in “Manager” as the role name.
Right click on the self association again. A pop-up menu appears. Click on Role B(Staff) in the pop-up
menu. A cascading menu appears. Click Edit Role B Rolename on the cascading menu. A text box
appears. Type in “Staff” as the role name. Set the Role A multiplicity to 1 and Role B multiplicity to 0..*.
Set the Role A to not navigable.

Figure 8.11 Self Assoiciation

340
Chapter 8 Class Diagram

9. Below is the completed class diagram.

Figure 8.12 Complete class diagram

341
Chapter 8 Class Diagram

Exercise
Draw the diagram below according to the guidelines given in this chapter.

Figure 8.13 A class diagram

342
Chapter 9 Component Diagram

Chapter 9 Component Diagram

Creating a Component Diagram


Method 1 – Creating a Component Diagram using the Menu Bar
1.Click on File on the menu bar. The file menu appears.
2.Click on New Component on the file menu. A cascading menu appears.
3.Click on New Component Diagram on the cascading menu. A blank new component diagram
appears.

Figure 9.1 Create Component Diagram by menu

343
Chapter 9 Component Diagram

Method 2 – Creating a Component Diagram using the Toolbar


1.Click on Create New Component Diagram icon on the toolbar. A blank new component
diagram appears.

Figure 9.2 Create Component Diagram by toolbar

Method 3 – Creating a Component Diagram using the Project Explorer


1. Right click on Component Diagram directory in the Project Explorer. A pop-up menu appears.
2. Click on Create Component Diagram. A blank new component diagram appears.

Figure 9.3 Create Component Diagram by Project Explorer

344
Chapter 9 Component Diagram

Figure 9.4 A blank new component diagram is created

The Component Diagram Palette

Icon Notation Definition


A note is used for comments additional explanation,
specification and requirement in a diagram element or at a
link in the diagram. It is not included in generated code. The
Note contents of a note do not alter the meaning of the model to
which it is attached. A note can contain any combination of
text and graphics. It can also be used in defining a stereotype
and entering a noted element.
Anchor An anchor is to line a diagram element and a note.
The dependency is a semantic relationship between the two
elements. It indicates that when a change occurs in one
Dependency element, there may be a change necessary to the other
element. A dependency link can include label and stereotype
can be set
A constraint is a semantic condition or restriction on model
elements that must be enforced by a correct
design of a system. It is represented as a linguistic, enclosed
Constraint in braces ({}), statement in some formal
(OCL, C++, and other), or natural language. There are 14
standard constraints in the UML such as association, global,
parameter. You may also define your own constraints.

345
Chapter 9 Component Diagram

A component is a physical and replaceable part of a system


that conforms to and provides the realization of a set of
Component interfaces. Components represent all kinds of elements
pertaining to the piecing together of software applications.
They could be simple files or dynamically loaded libraries.
Component Instance of a component.
Instance
An interface is a collection of operations that are used to
specify a service of a class or a component. Each interface
often specifies only a limited part of the behavior of an actual
class.
Characteristics of interface are:
Interface
(i) do not have internal structure specification;
(ii) do not have implementation;
(iii) lack of attributes, states and associations;
(iv) have operations only;
(v) may have generalization relationships.
Object can be viewed as an entity at a particular point in time
with a specific value and as a holder of identity that has
Object different values over time. Associations among objects are
not shown. When you place an object tag in the design area, a
lifeline is automatically drawn and attached to that object tag.
Subsystem A subsystem groups use cases or packages together.
A package is a mechanism for organizing elements into
groups. It is used in the Use Case, Class, and Component
diagrams. Packages may be nested within other packages. A
Package package may contain both subordinate packages and ordinary
model elements. The entire system description can be
thought of as a single high-level subsystem package with
everything else in it.

Table 9-1 The Component Diagram Palette of VPUML

Drawing a Component Diagram

Creating a Component
Method 1 – Creating a component using the diagram palette
1. To create a component in your component diagram, click on the Component button on the diagram
palette and click on the desire location. A component appears.

346
Chapter 9 Component Diagram

2. Rename the component name, and then press Ctrl + Enter to set the component name.

3. The component name is set.

Method 2 – Creating a component using the resource centric interface


Diagram element that a component can be created from, using the resource centric interface is:
z Component

1. Click on the component. The resource icons appear around the diagram element.

347
Chapter 9 Component Diagram

2. Press mouse button on the Component resource icon . A new component appears.

3. Drag the component to the desired location. The component is created.

Creating a Component Instance


Method 1 – Creating a Component Instance using the diagram palette
To create a Component Instance in your component diagram, click on the Component Instance button
on the diagram palette and click on the diagram window. A component instance appears.

1. Rename the newly created Component Instance name, and then press Ctrl + Enter to finish the operation.

2. The Component Instance name is set.

348
Chapter 9 Component Diagram

Method 2 – Creating a Component Instance using the resource centric interface


Diagram element that a component instance can be created from, using the resource centric interface is:
z Component Instance

1. Click on an existing component instance. The resource icons appear around the diagram element.

2. Press on the Component Instance resource icon . A new component instance appears.

3.Drag the component instance to the desired location. Release the mouse button. The component instance is
created.

Creating an Interface
Method 1 – Creating an Interface using the diagram palette
1.To create an Interface in your component diagram, click on the Interface icon on the diagram palette
and then click on the desired location on the diagram. A new interface is created.

349
Chapter 9 Component Diagram

2. Rename the newly created interface name. Press Ctrl + Enter to finish the operation.

3. The Interface name is set.

Method 2 – Creating an Interface using the resource centric interface


Diagram elements that an interface can be created from, using the resource centric interface are:
z Component
z Component Instance

1. Press on the Interface resource icon . A new interface appears.

350
Chapter 9 Component Diagram

2.Drag the interface to the Component or Component Instance that you want the interface to be placed in.
Release the mouse button. The Interface is created.

351
Chapter 10 Deployment Diagram

Chapter 10 Deployment Diagram

What is Deployment Diagram?

Figure 10.1 Deployment Diagram

Create a Deployment Diagram


Method 1 – Creating the Deployment Diagram using the Menu Bar

1. Click on File in the menu bar. The file menu appears.


2. Click on New Diagram in the file menu. A cascading menu appears.
3. Click on New Deployment Diagram on the cascading menu. A new Deployment Diagram appears.

352
Chapter 10 Deployment Diagram

Figure 10.2 Create deployment diagram by menu

Method 2 – Creating the Deployment Diagram using the Toolbar

1.Click on the Create Deployment Diagram icon in the toolbar. A new Deployment Diagram appears.

Figure 10.3 Create deployment diagram by toolbar

353
Chapter 10 Deployment Diagram

Method 3 – Creating the Deployment Diagram using the Project Explorer

1. Right click on Deployment Diagram directory in the Project Explorer. A pop-up menu appears.
2. Click on Create Deployment Diagram. A new Deployment Diagram appears.

Figure 10.4 Create deployment diagram by project explorer

354
Chapter 10 Deployment Diagram

Figure 10.5 A new deployment diagram is created.

355
Chapter 10 Deployment Diagram

The Deployment Diagram Palette

Icon Notation Definition


Note A note is used for comments additional explanation,
specification and requirement in a diagram element or at a
link in the diagram. It is not included in generated code. The
contents of a note do not alter the meaning of the model to
which it is attached. A note can contain any combination of
text and graphics. It can also be used in defining a stereotype
and entering a noted element.
Constraint A constraint is a semantic condition or restriction on model
elements that must be enforced by a correct
design of a system. It is represented as a linguistic, enclosed
in braces ({}), statement in some formal
(OCL, C++, and other), or natural language. There are 14
standard constraints in the UML such as association, global,
parameter. You may also define your own constraints.
Anchor An anchor is used to line a diagram element and a note.
Subsystem A subsystem groups diagram elements together.
Package A package is a mechanism for organizing elements into
groups. It is used in the Use Case, Class, and Component
diagrams. Packages may be nested within other packages. A
package may contain both subordinate packages and ordinary
model elements. The entire system description can be
thought of as a single high-level subsystem package with
everything else in it.
Node A node is a physical element that exists at run time and
represents a computational resource, generally having at least
some memory and often processing capability. It is a run-time
physical object and can be a Type or Instance. It can contain
components and objects.
Node Instance
Association The link is used to associate one node to the other node.
Component A component is a physical and replaceable part of a system
that conforms to and provides the realization of a set of
interfaces. Components represent all kinds of elements
pertaining to the piecing together of software applications.
They could be simple files or dynamically loaded libraries.
Component Instance of Component
Instance
Interface An interface is a collection of operations that are
used to specify a service of a class or a component.

356
Chapter 10 Deployment Diagram

Each interface often specifies only a limited part of


the behavior of an actual class. Characteristics of
interface are: (i) do not have internal structure
specification; (ii) do not have implementation; (iii)
lack of attributes, states and associations; (iv) have
operations only; (v) may have generalization
relationships.
Dependency Dependency is a semantic relationship between the two
elements. It indicates that when a change occurs in one
element, there may be a change necessary to the other
element. A dependency link can include label and stereotype
can be set.
Object Object can be viewed as an entity at a particular point in time
with a specific value and as a holder of identity that has
different values over time. Associations among objects are
not shown. When you place an object tag in the design area, a
lifeline is automatically drawn and attached to that object tag

Table 10-1 Deployment Diagram Palette

Draw Deployment Diagram

Create Node
Method 1 – Creating a node using the deployment diagram palette
1.Click on the node button in the deployment diagram palette. Click on the desired location in the
diagram. A new note appears.

357
Chapter 10 Deployment Diagram

2. Rename the newly added note. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a node using the resource centric interface

1. Click on an existing node in the diagram. Resource icons appear around the node.

358
Chapter 10 Deployment Diagram

2. Press on the resource icon with node ( , …). A new node appears.

3. Drag the node to the desired location. Release the mouse button.

4. Rename the newly added node. Press Ctrl + Enter to finish the operation.

359
Chapter 10 Deployment Diagram

Create Component
Method 1 – Creating a component using the deployment diagram palette
1.Click on the component button in the deployment diagram palette. Click on the desired location in
the diagram. A new component appears.

2. Rename the newly added component. Press Ctrl + Enter to finish the operation.

Method 2 – Creating a component using the resource centric interface


List of diagram elements that can create component with dependency using resource centric approach:
z Component
z Interface

1.Click on an existing diagram element listed above in the diagram. Resource icons appear around the
diagram element.

360
Chapter 10 Deployment Diagram

2. Press on the resource icon with component ( , …). A new component appears.

3. Drag the component to the desired location. Release the mouse button.

4. Rename the newly added component. Press Ctrl + Enter to finish the operation.

Create Component Instance


Method 1 – Creating a component Instance using the deployment diagram palette
1.Click on the component instance button in the deployment diagram palette. Click on the place
required in the diagram. A new component instance appears.

2. Rename the newly added component instance. Press Ctrl + Enter to finish the operation.

361
Chapter 10 Deployment Diagram

Method 2 – Creating a component instance using the resource centric interface


List of diagram elements that can create component instance with dependency using resource centric
approach:
z Component Instance
z Interface

1.Click on an existing diagram element listed above in the diagram. Resource icons appear around the
diagram element.

2. Press on a resource icon with component instance ( , …). A new component instance appears.

3. Drag the component instance to the desired location. Release the mouse button.

362
Chapter 10 Deployment Diagram

4. Rename the newly added component instance. Press Ctrl + Enter to finish the operation.

Create Interface
Method 1 – Creating an interface using the deployment diagram palette
1.Click on the interface button in the deployment diagram palette. Click on the desired location in the
diagram. A new interface appears.

2. Rename the newly added interface. Press Ctrl + Enter to finish the operation.

Method 2 – Creating an interface using the resource centric interface


List of diagram elements that can create interface with dependency using resource centric approach:
z Component
z Component Instance

363
Chapter 10 Deployment Diagram

1.Click on an existing diagram element listed above in the diagram. Resource icons appear around the
diagram element.

2. Press on the resource icon with interface ( , …). A new interface appears.

3. Drag the interface to the desired location. Release the mouse button.

4. Rename the newly added interface. Press Ctrl + Enter to finish the operation.

364
Chapter 10 Deployment Diagram

Create Object
1.Click on the object button in the activity diagram palette. Click on the desired location in the diagram.
A new object appears.

2. Rename the newly added object. Press Ctrl + Enter to finish the operation.

Create Association Relationship


Method 1 – Creating an association using the use case diagram palette
An association relationship can be created between nodes.

1.Click on the association button in the use case diagram palette. Drag from the source actor or the
target node.

365
Chapter 10 Deployment Diagram

2. Release the mouse button. A new association is created between the nodes.

Method 2 – Creating an association using the resource centric interface


An association can be created between notes using resource centric interface.

1. Click on an existing node in the diagram. Resource icons appear around the node.

366
Chapter 10 Deployment Diagram

2. Press on the association -> node . A new node appears.

3. Drag the new node to the target node. The target is selected.

4. Release the mouse button. The association is created between the nodes.

Creating a Dependency Relationship


Method 1 – Creating a dependency relationship using the class diagram palette
A dependency relationship can be created between:
z A component
z A component Instance
z An interface (Cannot be the source diagram element)

367
Chapter 10 Deployment Diagram

1.Click on the dependency button in the class diagram palette. Drag from the source diagram element
to the target diagram element.

2. Release the mouse button. A new dependency relationship is created between the diagram elements.

Method 2 – Creating a dependency relationship using the resource centric interface


List of diagram elements that can create dependency relationship between them using resource centric
interface :
z A component
z A component Instance
z An interface

1.Click on an existing diagram element listed above in the diagram. Resource icons appear around the
diagram element.

2.Press on a resource icon with dependency ( , , …). A new diagram element appears. (Note: the
resource icon must be correspondent to the target diagram element)

368
Chapter 10 Deployment Diagram

3. Drag the new diagram element to the target diagram element. The target diagram element is selected.

Release the mouse button. The dependency relationship is created between the diagram elements.

369
Chapter 11 Report Generator

Chapter 11 Report Generator

HTML Report
Generating HTML Report

1. Click on Tools on the menu bar. The Tools menu appears.

370
Chapter 11 Report Generator

2. Click on Report on the Tools menu. A cascading menu appears.

3. Click on HTML… on the cascading menu. The Generate HTML dialog appears.

371
Chapter 11 Report Generator

4.Input the directory for generating the report in the File location text field. Or click on the button near
beside the File location text field. The Open dialog appears.

5. Select the directory for generating report. Click on the OK button in the Open dialog.

372
Chapter 11 Report Generator

6. Check the Launch viewer check box to view the report after generation.

7.Check the check boxes in the tree of the Print Diagram frame to specific which diagrams will be used to
generate the report.

373
Chapter 11 Report Generator

8.Check the Generate diagrams check box to generate the diagrams to images and add to the report. Click
the Template combo box to select a template for the report. For example, select Use Case Diagram
Report to generate a report with use case diagrams only.

9.Check the Graphics antialiasing check box and the Text antialiasing check box.

374
Chapter 11 Report Generator

10. Click on the Header/Footer tab to edit the header and footer of the report.

11. Check the Use header check box and Use footer check box.

375
Chapter 11 Report Generator

12. Click on the Alignment combo box to select the header alignment. The Preview frame will be update to
show the format of the header and the footer.

13. Click on the Font name combo box to select the font of the header or footer.

376
Chapter 11 Report Generator

14. Click on the Font style combo box to select the style and click on the Font size combo box to select the
size of the font.

377
Chapter 11 Report Generator

15. Click on the button beside the Font color label. The Font Color dialog appears. Select a color
and click on the OK button in the dialog.

16. Click on the Document Info tab in the dialog. Input the title, author and keywords for the report.

378
Chapter 11 Report Generator

17. Click on the OK button in the dialog. The dialog will be close. The Generating HTML Document
dialog appears to show the progress.

18. When the progress reaches to 100%, click on the Close button in the dialog. The dialog will be closed.

379
Chapter 11 Report Generator

19. The browser will be opened automatically with the report generated.

Browsing HTML Report Generated

1.After the report is generated, open the report. The frame on the left hand side is a tree for browsing the
diagram and the diagram details.

380
Chapter 11 Report Generator

2. Click on the tree to select a diagram. The frame on the right hand side will show the diagram.

3. Click on the view detail link to see the details of the diagram.

381
Chapter 11 Report Generator

4. The frame on the right hand side will show the diagram details.

5. Scroll down to see the diagram details.

382
Chapter 11 Report Generator

6. Click on the link under the diagram to see a diagram element details.

7. The following is the report for a class diagram.

383
Chapter 11 Report Generator

384
Chapter 11 Report Generator

8. The following is the report for a sequence diagram.

9. The following is the report for a collaboration diagram.

385
Chapter 11 Report Generator

10. The following is the report for a state diagram.

11. The following is the report for an activity diagram.

386
Chapter 11 Report Generator

12. The following is the report for a component diagram.

13. The following is the report for a component diagram.

387
Chapter 11 Report Generator

14. The following is the report for the problem statement having textual analysis performed.

388
Chapter 11 Report Generator

389
Chapter 11 Report Generator

PDF Report

Generating PDF Report

1. To generate a PDF report, click on Tools on the menu bar. The Tools menu appears.

2. Click on Report on the menu. A cascading menu appears.

390
Chapter 11 Report Generator

3. Click on PDF on the cascading menu. The Generate PDF dialog appears.

4.Input the file name for generating the report in the File location text field. Or click on the button
near beside the File location text field. The Open dialog appears.

391
Chapter 11 Report Generator

5. Select the directory and the file name for generating report. Click on the OK button in the Open dialog.

6. Check the Launch viewer check box to view the report after generation.

392
Chapter 11 Report Generator

7.Check the check boxes in the tree of the Print Diagram frame to specific which diagrams will be used to
generate the report.

8.Check the Generate diagrams check box to generate the diagrams to images and add to the report. Click
the Template combo box to select a template for the report. For example, select Use Case Diagram
Report to generate a report with use case diagrams only.

393
Chapter 11 Report Generator

9. Click on the Diagram quality combo box to select the quality of the diagrams in the report.

10. Check the Graphics antialiasing check box and the Text antialiasing check box.

394
Chapter 11 Report Generator

11. Click on the Page tab in the dialog to edit the page layout of report.

12. Choose the page orientation of the report.

395
Chapter 11 Report Generator

13. Click on the Page size combo box to select the page size.

14. Input the margin values to adjust the margins.

396
Chapter 11 Report Generator

15. Click on the Header/Footer tab to edit the header and footer of the report.

16. Check the Use header check box and Use footer check box.

397
Chapter 11 Report Generator

17. Click on the Header style combo box to select one of the styles.

18. Click on the Alignment combo box to select the header alignment. The Preview frame will be update to
show the format of the header and the footer.

398
Chapter 11 Report Generator

19. Click on the Footer style combo box to select one of the styles.

20. Input the footer text in the Footer Text text field.

399
Chapter 11 Report Generator

21. Click on the Document Info tab in the dialog. Input the title, subject, author, keywords, info header and
info header content for the report. Check the Allow modify check box to allow the PDF report to be
modified.

22. Click on the Generate button in the dialog to generate the report.

400
Chapter 11 Report Generator

23. The Generating PDF Document dialog appears to show the progress.

24. When the progress reaches 100%, click on the Close button in the dialog. The dialog will be close.

401
Chapter 11 Report Generator

25. The PDF report document will be opened automatically.

Browsing PDF Report Generated

1.After the report is generated, open the report. The frame on the left hand side is a list for browsing the
diagram and the diagram details.

402
Chapter 11 Report Generator

2.Click on the list to select a diagram. The frame on the right hand side will show the diagram and the
diagram details. The following is the report for a use case diagram.

403
Chapter 11 Report Generator

3. The following is the report for a class diagram

404
Chapter 11 Report Generator

4. The following is the report for a sequence diagram.

5. The following is the report for a collaboration diagram.

405
Chapter 11 Report Generator

6. The following is the report for a state diagram.

7. The following is the report for a component diagram.

406
Chapter 11 Report Generator

8. The following is the report for the problem statement having textual analysis performed.

407
Chapter 12 Code Generation

Chapter 12 Code Generation

Java Code Generation

Syntax Checking for a Project


VPUML can check the UML syntax for java code generation. It checks the syntax for a project and display
warning messages and error messages in the Log Pane.

The followings are situations that the Log Pane will display warning messages or error messages:
z A class inherits from multiple classes.
z A class is set to be final and interface at the same time.
z A class realizes another class or another interface.
z An interface extends a class.

1.To perform syntax checking for the current project, click on Code on the menu bar. The Code menu
appears.

2. Click on Java on the menu. A cascading menu appears.

408
Chapter 12 Code Generation

3.Click Syntax Check in the cascading menu. The Check model with Java syntax dialog appears to show
the progress. (If the Code Engine Set Configuration dialog appears, click on the Code Generation tab
and input the working directory in the Working Directory text field.)

409
Chapter 12 Code Generation

4.When the progress reaches to 100%, click on the Close button in the dialog. The warning messages and
error message is shown in the Log Pane.

Checking Syntax for a Class


VPUML can check the UML syntax for java code generation for a signal class.

1. Click on an existing class on the class diagram. A popup menu appears.

410
Chapter 12 Code Generation

2.Click on the Code generation syntax check button on the menu. The Check model with Java syntax
dialog appears to show the progress.

3. When the progress reaches to 100%, click on the Close button in the dialog.

411
Chapter 12 Code Generation

4. Adjust the height of the Log Pane (if needed) to see the warning messages and error messages.

Generating Code for a Project


VPUML can generate Java code for the class models in a project.

412
Chapter 12 Code Generation

1. Click on Code on the menu bar. The Code menu appears.

2. Click Java in the menu. A cascading menu appears.

413
Chapter 12 Code Generation

3. Click on Generate on the cascading menu. The Java Code Generate Options dialog appears.

4. Click on the Default attribute type combo box. A list of attribute type appears.

414
Chapter 12 Code Generation

5. Select one of the attribute type in the list.

6.To add Java documentation to the header in class files, input the documentation in the Header description
text pane.

415
Chapter 12 Code Generation

7.Check the Generate JavaDoc check box. The Preview text pane is updated. The JavaDoc is added to the
sample source.

8.To generate import statement in the source, check the Automatic import statement generation checkbox.
The Preview text pane is updated. The import statements are added to the sample source.

416
Chapter 12 Code Generation

9.To set the brace style of the source code, click on the combo boxes in the Braces frame. A list of style
appears.

10. Select one of the brace style. The source code in the Preview text pane is updated.

417
Chapter 12 Code Generation

11. Click on the Code Generation tab.

12. Input the working directory in the Working directory text field for code generation.

418
Chapter 12 Code Generation

13. Set the other code generation preferences.

14. Check the check box of the project in the Available Classes for Code Engineering frame. All the check
boxes of the class models are checked.

419
Chapter 12 Code Generation

15. Click on the button to add the class models in the Selected Classes for Code Engineering frame
for code generation.

16. Click on the OK button in the dialog to close it. The Code generation dialog appears to show the
progress.

420
Chapter 12 Code Generation

17. When the progress reaches 100%, click on the Close button in the dialog to close it. The Code Preview
dialog appears.

18. A list of classes is shown in the Generated Classes tree. Click on one of the class in the tree. The Java
source generated is shown.

421
Chapter 12 Code Generation

19. Click on the Close button in the Code Preview dialog to close it.

422
Chapter 12 Code Generation

Generating Code for a Class

1.To generate Java code for an existing class in the class diagram, right click on the class. A popup menu
appears.

2. Click on Generate code on the popup menu. The Code Generation Options dialog appears.

423
Chapter 12 Code Generation

3. Set the preferences for code generation. Click on the OK button in the dialog to close it.

424
Chapter 12 Code Generation

4. The Code generation dialog appears to show the progress.

5.When the progress reaches to 100%, the source code is generated for the class. Click on the Close button in
the dialog to close it.

425
Chapter 12 Code Generation

Real-Time Code Generation

1. Open an existing project and open a class diagram in the project.

2. Right click on the class diagram. A popup menu appears.

426
Chapter 12 Code Generation

3. Check the Show Code Pane check box in the popup menu.

4. The Code Pane is shown.

427
Chapter 12 Code Generation

5. Right click on the class diagram. A popup menu appears.

6. Check the Real Time Code Generation check box.

428
Chapter 12 Code Generation

7.Click an existing class in the class diagram. The code is generated for the class and shown in the Code
Pane.

429
Chapter 12 Code Generation

8. Adjust the Code Pane (if needed) to see the generated source code.

430
Chapter 13 Code Reverse Engineering

Chapter 13 Code Reverse Engineering

Java Code Reverse Engineering

Real-Time Reverse Engineering for a Class


VPUML can reverse the code from the Code Pane to update a class in a class diagram.

1. Open a class diagram in the Project Explorer. The class diagram is shown.

431
Chapter 13 Code Reverse Engineering

2. Right click on the diagram. A popup menu appears.

3. Click on Show Code Pane in the popup menu.

432
Chapter 13 Code Reverse Engineering

4. The Code Pane is shown. Click on the class diagram again. A popup menu appears.

5. Click on Real Time Code Generation on the popup menu.

433
Chapter 13 Code Reverse Engineering

6. Click on a class in the class diagram. The code for the class is generated.

7. Add an attribute in the Code Pane. The class in the class diagram will be updated with the attribute added.

434
Chapter 13 Code Reverse Engineering

8.Add an operation in the Code Pane. The class in the class diagram will be updated with the operation
added.

435
Chapter 13 Code Reverse Engineering

Reverse Engineering from Java Files


VPUML can reverse Java files to class models. The class models can then be added to class diagram.

1.Click on Code in the menu bar. The Code menu appears.

436
Chapter 13 Code Reverse Engineering

2.Click on Java on the menu. A cascading menu appears.

3.Click Option in the cascading menu. The Code Engine Set Configuration dialog appears. Click on the
Code Generation tab in the dialog.

437
Chapter 13 Code Reverse Engineering

4.Input the working directory in the Working Directory text field.

5.Or click on the button. The Open dialog appears.

438
Chapter 13 Code Reverse Engineering

6.Select a directory in the dialog. The working directory is set.

7.Click on the Code Reverse Engineering tab in the dialog. The Source Paths and Classpaths are updated.
(The source paths are the path containing the Java files to be reserved. The class paths are the path
containing the class files to be referenced. To add more source path and class path, click on the Add…
button.)

439
Chapter 13 Code Reverse Engineering

8.Check the Lock for classes in classpath for reserving the class name fully qualified. (e.g. String =>
java.lang.String). Check the Merge mode and code for updating the already existing class in class
diagram from code.

9.Click on the OK button in the dialog. The dialog is closed.

440
Chapter 13 Code Reverse Engineering

10. Click Code in the menu bar. The Code menu appears.

11. Click Java in the menu. A cascading menu appears.

441
Chapter 13 Code Reverse Engineering

12. Click on Reverse on the cascading menu. The Code reserve engineering dialog appears to show the
progress. The Java files in the source path will be reserved to class models.

13. When the progress reaches 100%, click on Close in the dialog. The class models are added in the Model
Tree.

442
Chapter 13 Code Reverse Engineering

14. Click the refresh button to refresh the Model Tree.

15. Right click on the root directory in the Tree Model. A popup menu appears.

443
Chapter 13 Code Reverse Engineering

16. Click on Collapse All to collapse the tree to see all the class models generated.

Adding the reversed class models to class diagrams.

1.Click on File on the menu bar. The File menu appears.

444
Chapter 13 Code Reverse Engineering

2.Click on New Diagram in the menu. A cascading menu appears.

3.Click on New Class Diagram / New Class Diagram with Real Time Code Generation in the cascading
menu.

445
Chapter 13 Code Reverse Engineering

4.Drag the class models from the Model Tree to the new class diagram. The class models reserved from the
Java files will be added to the class diagram.

446
Chapter 13 Code Reverse Engineering

Updating Class Models from Java files

1.To update a class model from the Java file, right click on the class. A popup menu appears.

447
Chapter 13 Code Reverse Engineering

2.Click on Reverse code on the popup menu. The Code Reserve Engineering Options dialog appears.

3.Click on the OK button in the dialog. The Code reverse engineering dialog appears to show the progress.

448
Chapter 13 Code Reverse Engineering

4.When the progress reaches 100%, click on Close in the dialog. The class model and the class in the class
diagram will be updated.

449
Chapter 14 Print Preview Window

Chapter 14 Print Preview Window

Print Preview Window

Figure 14.1 Visual Paradigm for UML with IDE

450
Chapter 14 Print Preview Window

1. Click on File on the main menu. Click on Print... under the file menu. Alternatively, click on the
Print icon on the toolbar. The Print Preview Window appears.

Figure 14.2 The Print Preview Window

The Print Preview Toolbar

Icon Notation Definition


Print the selected diagrams. The Print dialog
Print
box appears.
Set the page properties for printing the
Setup Page
diagrams. The Setup Page appears.
Adjust the margins of the pages. The margins
can be edited by inputting the value in the text
Adjust Margin
boxes in the print preview area or dragging the
margin lines on the page.
Zoom Pages Zoom in/out the diagrams.
Paper Base Set the paper shown horizontally or vertically.
Layout
Paper Place By default, the setting is “Horizontal, then
Style Vertical” – the pages will be shown horizontally

451
Chapter 14 Print Preview Window

“Vertical, then Horizontal” – the pages will be


shown vertically.

Fit to Ratio Set the diagram size to fit into specified ratio.
Set the diagram size to fix into page(s).

Fit to Pages

To adjust the percentage of the margin of the


Overlapping
pages to be duplicated for printing.
Show Image Show the clip marks that surround the diagrams
Clip Mark in pages.
Edit the header/footer of the pages. The print
preview area appears with Multi Page Options.

You can insert the auto text below:

- Set Front

- Insert Page Number


Edit
Header/Footer - Insert Number of Pages

- Insert Date

- Insert Time

- Insert File Name

- Insert Diagram Name


Multi Page Set number of pages and the page style to be
Mode printed in a sheet.
Close the print preview window and switch
Close
back to VPUML.
Table 14-1 The Print Preview Toolbar

452
Chapter 14 Print Preview Window

Printing

Printing Diagrams

1.To print diagrams, check the check boxes of the desired diagrams in the Project Explorer. The print preview
area will show the selected diagram.

453
Chapter 14 Print Preview Window

2. Click on the Print button on the toolbar. The Print dialog box appears.

3. Click OK in the Print dialog box. The diagrams will be printed.

Print Settings

1. Click on the Print button on the toolbar. The Print dialog box appears.

2. Set the pages and the number of copies to be printed. Click OK to print the diagrams.

454
Chapter 14 Print Preview Window

Page Settings

1. Click on the Setup Page button on the toolbar. The Page Setup dialog box appears.

2. Click on the Size pull-down box to select the paper type. The page view will be updated.

455
Chapter 14 Print Preview Window

3. Click on the Source combo box to select the paper source.

4. Click on either the Portrait/Landscape Orientation. The page view will be updated.

456
Chapter 14 Print Preview Window

5.To set the Margins of the paper, click on the Left, Right, Top or Button text box and input the
corresponding margin sizes. The page view will be updated.

6. Click on OK to confirm the settings or click on Cancel to undo the settings.

Adjusting the Paper Margins

457
Chapter 14 Print Preview Window

1.Click on the Adjust Margin button on the toolbar. The preview area shows a blank paper and the

margins of the paper.

2.Edit the margins with the text boxes – Header, Footer, Top, Bottom, Left and Right. Alternatively, you
can drag the margin lines on the paper to adjust the margins.

458
Chapter 14 Print Preview Window

3.Click on the Adjust Margin button on the toolbar again to preview the diagram. The margins will

be updated.

Zooming

459
Chapter 14 Print Preview Window

1.Click on the Zoom Pages pull-down box to select the zoom percentage. The preview area will be updated.

460
Chapter 14 Print Preview Window

Setting the Diagram Base Layout

1.To set the diagram base layout in the preview area, Click on the Diagram Base Layout button on

the toolbar. The layout is changed.

461
Chapter 14 Print Preview Window

Set Paper Place Style


By Default, the place style is “Horizontal, then Vertical”. The place style can be set to “Vertical, then
horizontal”.

1.Click on the Paper Place Style button on the toolbar to set the place style. The style is now set to

“Vertical, then Horizontal”.

462
Chapter 14 Print Preview Window

Fit to Ratio

1. Click on the Fit to pull-down box to select the Ratio for fitting the diagram with ratio.

463
Chapter 14 Print Preview Window

2. Input the ratio, for example 50%, in the Ratio text box. The diagrams in the preview area will be updated.

Fit to Pages

464
Chapter 14 Print Preview Window

1. Click on the Fit to pull-down box to select Pages for fitting the diagram with pages.

2. Click on the Fit to Column and Row button on the toolbar. The page layout selector appears.

465
Chapter 14 Print Preview Window

3.Move the mouse cursor to select rows and columns. Then click on the selected cell. The diagram will be cut
into (row x column) pages.

Setting the Overlapping of a Diagram

466
Chapter 14 Print Preview Window

1.Click on the Overlapping text box to input the over lapping percentage, 20%. Then press Enter. The
pages will be updated in the preview area. The diagram image near the margin will be duplicated.

Showing the Image Clip Mark

467
Chapter 14 Print Preview Window

1.Click on the Show Image Clip Mark button on the toolbar. The diagrams will be surrounded by the

clip mark in the pages.

Editing the Header/Footer of the Pages

468
Chapter 14 Print Preview Window

1. Click on the Edit Header/Footer button on the toolbar. The Header/Footer editor appears.

2. Input the header and footer for the pages.

469
Chapter 14 Print Preview Window

3.Click on the Edit Header/Footer button again. The Header/Footer editor is closed. The header and

footer text are added to the pages.

Multi Page Mode

470
Chapter 14 Print Preview Window

1. Press Ctrl and select more diagrams.

2. Click on the Multi Page Mode button on the toolbar. The preview area with Multi Page Options

appears.

471
Chapter 14 Print Preview Window

2. Click on the page layout selector on the toolbar. Select the rows and columns.

3.Then click on the selected cell. The preview area will be updated. A sheet now contains (rows x columns)
pages.

472
Chapter 14 Print Preview Window

4. Click on the Page Style button to change the page style. The print preview area will be updated.

5. Click on the Multi Page Mode button again to exit the multi page mode.

473
Chapter 14 Print Preview Window

Exit Print Preview Window

1. Click on the Close button to close the Print Preview Window and switch back to the VPUML.

474

You might also like