Sunteți pe pagina 1din 249

Fifty Enterprise Architect

Tricks
Probably the most popular book
about Enterprise Architect in the
world

Peter Doomen
This book is for sale at http://leanpub.com/entarch

This version was published on 2014-03-01

This is a Leanpub book. Leanpub empowers authors and


publishers with the Lean Publishing process. Lean
Publishing is the act of publishing an in-progress ebook
using lightweight tools and many iterations to get reader
feedback, pivot until you have the right book and build
traction once you do.

©2012 - 2014 Peter Doomen


Tweet This Book!
Please help Peter Doomen by spreading the word about
this book on Twitter!
The suggested hashtag for this book is #entarch.
Find out what other people are saying about the book by
clicking on this link to search for this hashtag on Twitter:
https://twitter.com/search?q=#entarch
Contents

Introduction . . . . . . . . . . . . . . . . . . . . . 1
Preface . . . . . . . . . . . . . . . . . . . . . . . 1
Copyright notice . . . . . . . . . . . . . . . . . 2
Thanks to . . . . . . . . . . . . . . . . . . . . . 2
About the author . . . . . . . . . . . . . . . . . 2
Online . . . . . . . . . . . . . . . . . . . . . . . 3

Chapter 1: Elementary, my dear Watson . . . . . 4


Trick 1: Adding an element of the same type . . 6
Trick 2: Adding related elements to the diagram 7
Trick 3: Put target element in diagram . . . . . . 11
Trick 4: Bookmarking elements . . . . . . . . . 13
Trick 5: Element styles . . . . . . . . . . . . . . 15
Trick 6: Finding elements in the tree . . . . . . . 19
Trick 7: Nesting elements . . . . . . . . . . . . . 21
Trick 8: Locking elements . . . . . . . . . . . . . 23
Trick 9: Adding elements directly to a package . 25
Trick 10: Mimic multilanguage support . . . . . 27

Chapter 2: Connecting things . . . . . . . . . . . 29


CONTENTS

Trick 11: Exact placement of connectors . . . . . 31


Trick 12: Repeat connector . . . . . . . . . . . . 32
Trick 13: Pressing shift while dragging to add a
bend . . . . . . . . . . . . . . . . . . . . . 33
Trick 14: A bezier curve . . . . . . . . . . . . . . 35
Trick 15: Prompt on connector deletes . . . . . . 37
Trick 16: Adding notes to a connector . . . . . . 40
Trick 17: Docking elements . . . . . . . . . . . . 42
Trick 18: Parent-child relations, drag and drop style 44
Trick 19: Converting linked element to local copy 47
Trick 20: Connecting notes to internal documen-
tation . . . . . . . . . . . . . . . . . . . . 51

Chapter 3: Diagrams . . . . . . . . . . . . . . . . 54
Trick 21: Copy a diagram to the clipboard . . . . 56
Trick 22: Same size . . . . . . . . . . . . . . . . 59
Trick 23: Save as shortcut . . . . . . . . . . . . . 62
Trick 24: Change diagram type . . . . . . . . . . 63
Trick 25: Package on a diagram . . . . . . . . . 66
Trick 26: Quick zooming . . . . . . . . . . . . . 68
Trick 27: Shallow or deep copy? . . . . . . . . . 69
Trick 28: A legend . . . . . . . . . . . . . . . . . 72
Trick 29: Status colors on diagrams . . . . . . . 76
Trick 30: Manual layouting . . . . . . . . . . . . 80

Chapter 4: Toolbox, types and tree . . . . . . . . 84


Trick 31: Toolbox visibility . . . . . . . . . . . . 86
Trick 32: Create your own toolbox . . . . . . . . 88
Trick 33: General types . . . . . . . . . . . . . . 92
Trick 34: Auto name counters . . . . . . . . . . 95
CONTENTS

Trick 35: Stereotypes . . . . . . . . . . . . . . . 98


Trick 36: Tagged value types . . . . . . . . . . . 101
Trick 37: Inheriting tagged values . . . . . . . . 103
Trick 38: Apply a tagged value to multiple elements 106
Trick 39: Sorting tree . . . . . . . . . . . . . . . 107
Trick 40: Finding orphans . . . . . . . . . . . . . 110

Chapter 5: A bit more advanced . . . . . . . . . . 112


Trick 41: Slideshow . . . . . . . . . . . . . . . . 114
Trick 42: Searches . . . . . . . . . . . . . . . . . 116
Trick 43: Relationship matrix . . . . . . . . . . . 118
Trick 44: Hierarchy window and traceability . . 122
Trick 45: List view . . . . . . . . . . . . . . . . . 124
Trick 46: Filtering . . . . . . . . . . . . . . . . . 126
Trick 47: Printing large diagrams . . . . . . . . . 129
Trick 48: The Team Review . . . . . . . . . . . . 132
Trick 49: Database access . . . . . . . . . . . . . 136
Trick 50: Visualize workflow . . . . . . . . . . . 138

Bonus Chapter 1: various extra tips . . . . . . . . 141


Trick 1: a simple todo list . . . . . . . . . . . . . 141
Trick 2: quickly copying an element with its
properties . . . . . . . . . . . . . . . . . . 142
Trick 3: Hide stereotypes for information items
on information items conveyed by a con-
nector . . . . . . . . . . . . . . . . . . . . 143
Trick 4: Show Namespaces . . . . . . . . . . . . 145
Trick 5: A bunch of relations . . . . . . . . . . . 148
Trick 6: Reporting on some specific elements . . 151
Trick 7: Inserting images the easy way . . . . . . 153
CONTENTS

Trick 8: Updating the status of all requirements


in a package . . . . . . . . . . . . . . . . 155
Trick 9: How to make a diagram the model de-
fault, and how to undo it . . . . . . . . . . 158
Trick 10: coupling roles to swimlanes . . . . . . 159

Bonus Chapter 2: Still more various extra tips . . 166


Trick 1: semi-batch creation of elements . . . . . 166
Trick 2: sorting a list on tagged values . . . . . . 167
Trick 3: using lists for easy export to spreadsheets 172
Trick 4: really advanced search . . . . . . . . . . 174
Trick 5: convert a scenario to a diagram - auto-
matically! . . . . . . . . . . . . . . . . . . 177
Trick 6: how to make structured text from diagrams 180
Trick 7: Importing visio drawings . . . . . . . . 184
Trick 8: Links in notes . . . . . . . . . . . . . . 193
Trick 9: Operations as activities . . . . . . . . . 197
Trick 10: Working with working sets . . . . . . . 200

Bonus Chapter 3: Building your own toolbox . . 205


Trick 1: the order of the elements in the toolbox 206
Trick 2: setting a default element size . . . . . . 208
Trick 3: an icon for elements in the toolbox . . . 210
Trick 4: working with metatypes . . . . . . . . . 213
Trick 5: creating autohiding connectors . . . . . 215
Trick 6: how to create an arrow with shapescripting 219
Trick 7: the shapescripting canvas . . . . . . . . 224
Trick 8: some shapescripting limitations . . . . . 230
Trick 9: hiding connector labels . . . . . . . . . 233
CONTENTS

Trick 10: what to do when an MDG Technology


is lost . . . . . . . . . . . . . . . . . . . . 237

Overview of shortcuts . . . . . . . . . . . . . . . 240


Introduction
Preface

“Enterprise Architect is an intuitive, flexible and pow-


erful UML analysis and design tool for building robust
and maintainable software. From requirements gathering,
through analysis, modeling, implementation and testing
to deployment and maintenance, Enterprise Architect is a
fast, feature-rich, multi-user UML modeling tool, driving
the long-term success of your software project”, states
the Enterprise Architect Manual. Hmm. As an everyday
Enterprise Architect user, I know that Enterprise Architect
is very feature rich, but it can be hard to get the most out
of the tool initially because there is so much functionality
to learn. I once prepared a document with four Enterprise
Architect tricks and presented these to a user forum. I was
surprised that no participant, though every single one of
them an expert user, knew all four. So I concluded there
was a real need for a book like this. It is suited for those who
have at least some working knowledge of Sparx Systems
Enterprise Architect but don’t want to struggle their way
through the 2000+ pages electronic manual that comes
with the current version, 9.1. With these fifty different
Enterprise Architect tricks, I barely scratched the surface
of all Enterprise Architect possibilities. On the other hand,
Introduction 2

I carefully selected these tricks because they will be useful


for most daily users. And be assured that I have enough
material for another book like this, with more tricks and
more advanced stuff. Happy reading!

Copyright notice
© 2011 Peter Doomen. Sparx and the names of Sparx’s
products referenced in this book are trademarks or regis-
tered trademarks of Sparx Systems Pty Ltd.

Thanks to
Thanks to Estelle Bell and Scott Hebbard from Sparx Sys-
tems for their help. Thanks to Jonathan Feinberg for his
famous Wordle application that generated the word clouds
in this book. Thanks to Helmut Ortmann for providing
me with additional tricks, and to Philippe Backx, Thomas
Kilian and Ramsey Millar for their support in marketing
this book. Thanks to my family and colleagues for their
support and advice. Special thanks to my colleague Stephan
for proofreading the manuscript and to colleague Herman
for tip 9 in bonus chapter 2.

About the author


Peter is a full-time enterprise architect at SD Worx, a
leading HR company, and vice president of the Belgian
Chapter of the Association of Enterprise Architects.
Introduction 3

Online

Website of the author¹


Section about Enterprise Architect²
¹http://www.AbOrigineMundi.com
²http://www.AbOrigineMundi.com/index.php/tag/enterprise-architect/
Chapter 1: Elementary, my dear Watson 5

Chapter 1: Elementary,
my dear Watson
Chapter 1: Elementary, my dear Watson 6

In which we find ten tricks to work with elements, the basic


stuff of any Enterprise Architect model.

Trick 1: Adding an element of the


same type

When you are building a model, more often than not you
need exactly the same type of element more than once.
Instead of returning to the toolbox every time, just press
“ctrl” and click on the diagram. For example: you need five
“objects” to appear on the diagram.

Screenshot 1-1

First, create a new object: click “object” in the toolbox and


click on the diagram. A rectangle appears and a dialog
window pops up. Name the object “app1” and press “OK”
so that the dialog window closes. Now keep the ctrl-
key pressed and click on the diagram again. A second
rectangle appears and the dialog window opens again. You
just created a second “object” without having to visit the
Chapter 1: Elementary, my dear Watson 7

toolbox again. As simple as this sounds, it struck me that


even experienced Enterprise Architect users did not know
this little trick. A related trick is Trick 12: Repeat connector.

Trick 2: Adding related elements to


the diagram

This trick goes right into the heart of what a modeling tool
is about: modeling instead of just drawing. The difference?
When modeling, you understand there is a difference be-
tween the model and the diagrams, while when you are just
drawing the model and the diagram are the same. Let’s say
you are building a model for an organization that releases
the wine magazine “Vinimble” six times a year. You have
modeled the subscription process, a part of the application
landscape, and some roles that work with the software to
support the business process. The model quickly becomes
complicated. The solution? Split up the diagram in separate
diagrams, each showing a part of the model. The function
“add related elements” is very useful for that. For example,
let’s focus on the “Staff” role. Drag the “Staff” role from the
model tree to a new diagram. Right click on it and choose
“Advanced | Add | Related elements”.
Chapter 1: Elementary, my dear Watson 8

Screenshot 2-1

A dialog window “Insert related elements” appears.

Screenshot 2-2

For the moment, just press OK. The result is a diagram with
all elements directly linked to the “Staff” role.
Chapter 1: Elementary, my dear Watson 9

Screenshot 2-3

The options on the “Insert related elements” dialog window


will be useful when there are lots of elements linked to the
source element on the diagram.

Insert Elements to X Levels

Choose 2 as a value and Enterprise Architect will also show


elements that are not directly linked to the source element,
but to the elements that are linked to it.

For Link Type

This option limits the action to elements that are linked


with a specific link type. For example, choosing “aggre-
gation” in our model would show only “VinimbleGroup”
Chapter 1: Elementary, my dear Watson 10

since the link type between VinimbleGroup and Staff is


of that type. The links to the process activities “Check
subscription”, “Register new subscriber” and “send previ-
ous issues for free” are typed as “Association” hence these
process activities would not show up.

With Link Direction

The default for this option is two-way, but you can limit
this to source->target or target->source.

Limit to Element Type

The same as link type, only that you limit the action
depending on the type of the connected elements.

Layout Diagram when Complete

You probably will want to turn this option off unless you
trust the autolayout function of Enterprise Architect really
well. I don’t, so I turn it off unless I have a diagram that
has not been layouted by hand so far.

Limit to Namespace

Another way of dividing complex projects so that the


pieces become manageable. This will only work if you have
namespaces defined. To define a package as a namespace
root, right-click on the package in the model tree, choose
Chapter 1: Elementary, my dear Watson 11

“Code Engineering” and press “Set as Namespace Root”.


The package icon changes so that you can recognize it as
a namespace root. Useful if the model is very complicated
and you use the “Add | Related Elements” function a lot
and don’t have the time to delete elements on a diagram
that you don’t need.

Screenshot 2-4

Trick 3: Put target element in


diagram

When consulting a complex model, it pays to have the


relationships pane in front of you. It shows an overview of
all elements connected to the currently selected element on
Chapter 1: Elementary, my dear Watson 12

the diagram. Open it by choosing “View | Relationships”. It


will dock to the bottom of the Enterprise Architect window,
which is just fine.

Screenshot 3-1

It not only shows the element, but also the connector type
and other information you often need.
Select an element on the diagram. Go to the Relationships
Chapter 1: Elementary, my dear Watson 13

pane and select any element that is not shown on the


current diagram and right click on it.

Screenshot 3-2

Then choose “Place Target Element in Diagram”, go back


to the diagram (the cursor will change) and click. The
connected element is shown now. Together with Trick 2:
Adding related elements to the diagram on page 14, this
allows you to quickly build a new diagram based on an
existing model.

Screenshot 3-3

Trick 4: Bookmarking elements

Building models involves being able to focus on aspects


of a problem. Often you want to focus on one aspect and
suddenly you get information on another aspect. A book-
mark is what you need, as a reminder that you still have to
work on an element. Putting a bookmark on an element is
easy: select the element and press shift+space bar. The same
key combination removes the bookmark. Later, in Trick
Chapter 1: Elementary, my dear Watson 14

42: Searches on page 97, we discover how we can come


up with a list of all bookmarked elements in the model. I
discovered this trick by accident. A colleague asked how he
could get rid of the “red triangle” that suddenly showed up
on a diagram. I said I had the same problem, and realized
that it was probably some odd key combination. Looking
up the table of Enterprise Architect shortcuts revealed the
culprit. But now, I use this function fairly often either as a
reminder to myself or to point a colleague to “some work
to do”.
Chapter 1: Elementary, my dear Watson 15

Screenshot 4-1

Trick 5: Element styles


The success of a diagram is strongly related to its readabil-
ity. Especially if your diagram has to convey a message to
non-experts. That’s when colors and fonts come into play:
use them to support meaning and the diagram instantly
becomes more readable.
Chapter 1: Elementary, my dear Watson 16

Screenshot 5-1

Element styles can save you a considerable amount of time


when layouting diagrams. Color an element, save this as a
style and use it to color other elements in a consistent way.
Chapter 1: Elementary, my dear Watson 17

Screenshot 5-2

In the diagram above, I’ve used two styles: a gray back-


ground with a bold font means “Organization”, while a
light blue background with a normal font means “Business
Process Activity”. The difference with the previous dia-
gram is obvious. Suppose we want to distinguish visually
between automatic and manual process activities: manual
processes are light blue, automated ones are light green.
Select the activity “Check subscription”, which is supported
by software, and color it green the usual way. Now click on
the arrow in the pane at the bottom of the window, next to
the style list. Select “Save as New Style” and give it a name
of 12 characters or less (like “BusProcAut”). The style list is
saved on a project base, which means that (1) you can use
different conventions for different projects and (2) when
Chapter 1: Elementary, my dear Watson 18

you work on a project as a team and you use the same


underlying Enterprise Architect database, you can share
conventions so that the model is consistent with the visual
style guide you probably have to use.

Screenshot 5-3

Then we are going to use our new style. Select the activity
“Register new subscriber” and click on the styles list. Select
“BusProcAut” and the activity turns light green.
Chapter 1: Elementary, my dear Watson 19

Screenshot 5-4

If we would have selected a different font or font color or a


border color and style, it would change too. It even works if
you select multiple elements with ctrl-click or by dragging
around them. Neat huh?

Trick 6: Finding elements in the


tree

As we noted in Trick 2: Adding related elements to the


diagram, there’s a difference between the model, as rep-
resented in the model tree, and the diagrams. An ele-
ment can appear on one diagram, on many diagrams and
even on no diagram. An element can even be twice in
the model: nothing prevents you from having two actors
Chapter 1: Elementary, my dear Watson 20

“Subscriber”, for example. If this is the case, then how do


you know which diagram element corresponds to which
model element? Simple: select the diagram element and
press “alt+g”. The focus will switch to the model tree
and the corresponding element is selected. You will find
yourself using this shortcut often to delete elements from
the model, but you can save yourself time by selecting
such an unwanted element from the diagram and pressing
“ctrl+delete”. Only do this if you really want to delete an
item from the model, not only from the current diagram!
A related trick is Trick 40: Finding orphans on page 92. For
the reverse action of alt+g, knowing which model element
corresponds to which diagram element, there is also a
shortcut. Select the element in the tree and press “ctrl+u”. If
the element appears on exactly one diagram, that diagram
is shown and the element is selected. If the element appears
on more than one diagram, a dialog window with the list
of these diagrams is shown. Double click the diagram (or
select it and press “open”) to open the diagram you were
looking for.
Chapter 1: Elementary, my dear Watson 21

Screenshot 6-1

If the element does not appear on any diagram, the same


dialog window opens but with an empty list. I consider this
a bug in Enterprise Architect: Enterprise Architect should
tell you that the element is an orphan.

Trick 7: Nesting elements

Often you need to visualize that an element is composed


of other elements. For example, a component is composed
of other components. Sometimes you only need the master
component, sometimes you want to know the details and
thus have the smaller components on a diagram. For such
cases, you use element nesting. Suppose we have a cus-
Chapter 1: Elementary, my dear Watson 22

tom built application that uses a SubscriberManagement


component. This component is composed of several other
components: one that takes care of the subscriber lists, one
that archives old subscriptions etc.

Screenshot 7-1

We would like to represent this visually by drawing the


main component around the other components. Just put
the components on a diagram and drag the child compo-
nents into the parent component. The border of the parent
changes to a dotted line, indicating that it is ready to
accept children. In the model tree, or the project browser
in Enterprise Architect speak, the component structure is
reflected by a hierarchical relationship. When you drag the
child component outside its parent’s border, it will become
detached in the model tree too.
Chapter 1: Elementary, my dear Watson 23

Screenshot 7-2

Trick 8: Locking elements

Once you will have done real hard work modeling a piece
of reality or of your dreams, you will want to protect
it against unwanted changes. For example changes by
your project team colleagues who always argue with you
about… well, you know what I mean. That’s the right
time to start locking your work. Select the element to
protect, right click on it and press “lock element”. Until you
get the lock off, you and others won’t be able to change
its properties (name, notes etc). The OK button on the
properties window is grayed out.
Chapter 1: Elementary, my dear Watson 24

Screenshot 8-1

However, you can still move the element around in di-


agrams and even delete it from diagrams and from the
model. If you want to protect the diagram, you guessed it,
you have to lock the diagram by right clicking on empty
diagram space and selecting “Lock Diagram”.
Chapter 1: Elementary, my dear Watson 25

Trick 9: Adding elements directly to


a package

You don’t have to open a diagram to add elements to a


package. You can also right-click on the package in the tree,
then select “Add | Add Element”.

Screenshot 9-1

A dialog window will open, asking you to provide En-


terprise Architect with the information about the new
element.
Chapter 1: Elementary, my dear Watson 26

Screenshot 9-2

Why would you do that? You don’t use every element every
day. Therefore, sometimes it can be hard to remember
where in the toolboxes an element is hidden. In this dialog,
when you click the “Type” drop down box, a list with lots
of elements shows up, making it easier to find the right one.
Chapter 1: Elementary, my dear Watson 27

Saves time and frustration!

Trick 10: Mimic multilanguage


support

Enterprise Architect does not support multiple (natural)


languages. So if your organization happens to have let’s say
a Spanish subsidiary, and you need to translate diagrams
in Spanish, you’re in for trouble in the form of manually
keeping two models in sync. Or do you? A little trick
to mimic multilanguage support is by adhering to the
following convention: put the English name of an element
as the “Name” and the foreign name as the “Alias”. Or vice
versa, it does not matter as long as you are consistent.

Screenshot 10-1

Then, when a translated diagram is needed, open the


diagram properties window by right clicking on an empty
Chapter 1: Elementary, my dear Watson 28

part of the diagram and check the option “Use Alias if


Available”.

Screenshot 10-2

The diagram will instantly use the Spanish translations, as


far as you have used them in the alias field of the different
elements. Neat!
Chapter 2: Connecting things 30

Chapter 2: Connecting
things
Chapter 2: Connecting things 31

In which we discover ten tricks to connect elements with


each other.

Trick 11: Exact placement of


connectors

For drawing connections between elements, Enterprise Ar-


chitect’s default behavior is to draw the lines from the
middle of one element to the middle of the other element.
This can be a nuisance when you work with large elements
that have lots of links, because you typically want the con-
nector lines to be well separated. Open the menu “Tools”
and choose “Options”. In the dialog window that opens,
choose “Links” (left side). Then change the radio button
for the option “New Connector End-Points:” to “Exact
placement”. From now on, Enterprise Architect will draw
the connection where you put it. Quite a time saver!
Chapter 2: Connecting things 32

Screenshot 11-1

Trick 12: Repeat connector

Just like you can repeat the last element you drew (see Trick
1: Adding an element of the same type), you can repeat a
connector. The shortcut is even simpler: just press F3. Then
point to the source element and the cursor will indicate that
you can start drawing the connector. You really need to
memorize that one, because you’ll find yourself drawing
the same connectors over and over again.
Chapter 2: Connecting things 33

Screenshot 12-1

Trick 13: Pressing shift while


dragging to add a bend

When a diagram becomes really crowded, adding a new


connector without crossing existing ones is not easy. But if
you press and release “shift” while dragging the connector,
Enterprise Architect will add a bend point to the connector.
You can even add multiple bend points, just press and
release shift every time you want to have another one.
Chapter 2: Connecting things 34

Screenshot 13-1

You can bend a connector by pressing ctrl and clicking on


the connector. However, when the connector style is set to
“direct”, this is not possible. Right click, choose “connector
properties” and set the style to custom to be able to bend it
properly.
Chapter 2: Connecting things 35

Screenshot 13-2

Trick 14: A bezier curve

A colleague of mine once told me, that IT people like


their connectors straight and business people like to have
them rounded. I don’t know if that is true or not, but in
some diagrams, it would be nice if you could work with
curved lines to connect elements. Here’s how to do it: open
the connector properties window by double clicking on it,
select the tagged values tab and add a new tagged value
named “_bezier” with value 1.
Chapter 2: Connecting things 36

Screenshot 14-1

The result will be a line with an extra handle that changes


the curvature of the bezier curve. This trick is little known
and hard to find. Be proud you know this and use it to
impress your colleagues with your in-depth knowledge of
Enterprise Architect.
Chapter 2: Connecting things 37

Screenshot 14-2

Extra tip: if you keep forgetting how to do this, consult


Trick 37: Inheriting tagged values.

Trick 15: Prompt on connector


deletes

When you’ve just installed Enterprise Architect, the tool


will warn you when you delete a connector from the model.
Chapter 2: Connecting things 38

Screenshot 15-1

I suggest you turn this feature off. After a while, you will
know exactly what happens when you press delete so you
save time again. Then which default option should you
choose? Hiding the relationship or deleting it altogether?
It depends:
Chapter 2: Connecting things 39

Screenshot 15-2

Complicated diagrams

If you work with complicated diagrams where you often


need to hide relations because you are not interested in
them (but you want to keep them in de model), it’s best
to have “Hide the connector” as a default. This is probably
when you already have a model and your main work is to
exploit it. That way, you don’t have to use the cumbersome
“right mouse click - visibility - hide connector” again.
Deleting relations is then a matter of pressing ctrl-delete
with a quick confirmation.
Chapter 2: Connecting things 40

Delete connectors often used

On the other hand, when you find yourself needing to


delete connectors often, obviously it’s better to check “Delete
the connector from the model” to save time. This is prob-
ably when you are still building a model and your main
work is to add new things to it. In any case, you can return
to the default Enterprise Architect setting with the warning
by checking Tools - Options - Links - Prompt on connector
deletes. Or you can switch between the default options
“delete” and “hide” whenever you need to, by visiting
“Tools | Options | Links | Prompt on Connector Deletes”.

Trick 16: Adding notes to a


connector

Attaching notes to elements is easy and there are several


ways to do it. But can a connector have notes attached to
it? Probably, otherwise you would not be reading this trick.
Chapter 2: Connecting things 41

Screenshot 16-1

Here’s how to do it. Right click on the connector, choose


“attach note or constraint” then check all relations that
the connector should be attached to and confirm with
OK. When you need to edit the links, right click on the
note and choose “Advanced | Set Attached Links”. The
Link relations dialog appears again and you can check and
uncheck relations.
Chapter 2: Connecting things 42

Screenshot 16-2

Trick 17: Docking elements

Strictly speaking, docking elements is not really connecting


them. The “connection” between docked elements is not
included in the model, it does not show up in any relations
window. But sometimes it’s useful to have some relation
between elements that is very loose. More lose than even
the weakest real connector. That’s when you use docking.
Docking can be compared to the grouping function of
Microsoft Office, only that docked elements do not move
together. They just stick to each other’s sides. Here’s how
to dock elements. Select the elements to be docked, right
mouse click on any one of them, and choose Dockable. Now
deselect the elements, select one again and drag it to the
side of the other. It snaps to the side as soon as it is close
enough.
Chapter 2: Connecting things 43

Screenshot 17-1

Docking is useful for several reasons:

Docking saves space

Suppose you have a list of hundred or more applications.


With docking, you can neatly arrange them in the smallest
space possible.
Chapter 2: Connecting things 44

Docking can be used to mimic tables or


columns

This is why elements like the activity partition are dockable


by default.

Screenshot 17-2

Trick 18: Parent-child relations,


drag and drop style

The fastest way to organize elements, is by having support


for composite objects turned on. You can then drag and
drop elements to each other and Enterprise Architect will
automatically arrange them hierarchically in the model
tree, as we saw in Trick 7: Nesting elements on page 24.
First check in “Tools | Options” if “Support for Composite
Objects” is checked:
Chapter 2: Connecting things 45

Screenshot 18-1

Then drag an element to another element that would accept


it. You can see that it works when the border of the
parent element changes from normal to dotted. UML savvy
readers will have objected to my using an aggregation
relation between the actor and the object representing the
actor’s organization in Trick 2: Adding related elements to
the diagram on page 14. But there’s a good reason for that
and it has to do with nesting: when building diagrams, I
try to show hierarchical relations by nesting elements. If
you use an aggregation relationship, Enterprise Architect
will automatically hide the relation. The readability of the
diagram improves and there’s less work to do, that’s what
I call “pragmatism”! Here’s the normal view, showing the
Chapter 2: Connecting things 46

relation explicitly:

Screenshot 18-2

And here’s the composite view, showing the relation im-


plicitly:
Chapter 2: Connecting things 47

Screenshot 18-3

This is much more readable, especially when you have


lots of elements, and on top of that, when the elements
are nested, the child elements move with their parent,
saving time when making diagrams. It is important to know
that these are just alternate views of the same model. In
both cases, the relation window will show the aggregation
relation between “Layouter” and “SurePrint”.

Trick 19: Converting linked


element to local copy

Any element on a diagram that belongs to another package


than the package of the diagram itself, is considered a
“linked element” by Enterprise Architect. For example, the
element “Editor in chief” on the diagram below is “linked”,
while the element “Approve for press” is not.
Chapter 2: Connecting things 48

Screenshot 19-1

You can recognize linked elements by their “namespace in-


dicator”: the label that starts with “(from”. By the way, you
can remove these namespace indicators by right-clicking
on the diagram, then choosing “Properties | Diagram” and
removing the check before “Show Namespaces”. Suppose
you now want to have a duplicate of the role “Editor in
chief”. Right click on the element, choose “Advanced |
Convert Linked Element to Local Copy”.
Enterprise Architect will react with a rather cryptic mes-
sage:
Chapter 2: Connecting things 49

Screenshot 19-2

It actually just means that the new copy will inherit all
local connections from its parent element. In this example,
the “Editor in chief” was copied and also both links to the
business process were automatically copied, but not the
aggregation link to the VinimbleGroup element, since it is
not a local connection.

Screenshot 19-3

From a modeling point of view, you should only create


Chapter 2: Connecting things 50

copies of elements when you discover that something


which you thought was one thing is actually two separate
things. It is not a good modeling practice to duplicate
elements that refer to one and the same thing: it limits
the maintainability of the model and you also lose some
information that is contained in the links.

Screenshot 19-4
Chapter 2: Connecting things 51

Trick 20: Connecting notes to


internal documentation

You probably know that certain elements, like classes,


can have attributes. For example, we are modeling the
subscription procedure. Our class “Person” has attributes
like “FirstName” and “FamilyName”. We will even keep
extra info like the reason why we have a separate first
name from a family name in our model. Now it would
be nice when we could also show this documentation on
a diagram. That’s when we use notes connected to the
internal documentation of an element, like in the diagram
below.

Screenshot 20-1

The advantage of using connected notes is of course that


they will synchronize. For example, if we would change
the attribute “Name” to “FirstName”, the note would also
show “FirstName”, like below.
Chapter 2: Connecting things 52

Screenshot 20-2

Here’s how to make connected notes: On the diagram, find


the element and select the feature you want to connect a
note to. It will light up. Then right click and select “Create
Linked Note”.
Chapter 2: Connecting things 53

Screenshot 20-3

It will show not only the name of the feature, but also the
notes attached to it, exactly what we had in mind.
Chapter 3: Diagrams 55

Chapter 3: Diagrams

Wordle 3
Chapter 3: Diagrams 56

In which we work with diagrams, the main reason we use


a modeling tool after all.

Trick 21: Copy a diagram to the


clipboard

This one is a beauty: simple, but versatile. The shortcut


ctrl+b copies the current diagram to the clipboard. That
way, you can easily use diagrams in other applications such
as a drawing tool, a text processor or presentation software.
Here’s a simple diagram copied to Microsoft Visio:
Chapter 3: Diagrams 57

Screenshot 21-1

If you don’t like the frame around the diagram, you can
turn this off via “Tools | Options”. Remove the checkmark
before “On Clipboard Images”.
Chapter 3: Diagrams 58

Screenshot 21-2

Also the format is determined in “Tools | Options”. You can


choose between “Metafile”, a vector format, and “Bitmap”,
which is, well, a bitmap. Usually you will need the metafile
format, because it allows you to resize the diagram without
quality loss. Also the file size of a metafile is a lot smaller
than that of a bitmap. In rare cases, for example when the
target application cannot work with metafiles, change the
setting to “Bitmap” (but don’t forget to reset it afterwards).
Chapter 3: Diagrams 59

Screenshot 21-3

Trick 22: Same size

Experienced users will know this one for sure, but even
they will underestimate the visual impact of giving dia-
gram elements the same size.
Chapter 3: Diagrams 60

Screenshot 22-1

For example, this diagram explains the business process ac-


tivities of the editor in chief. The first version has unequally
sized elements. It looks as if the “Register new subscriber”
is a very important activity to the editor in chief (which
is not the case, he is simply informed of new subscribers).
Due to the different format (height larger than width) the
“Write redactional column” seems to be something totally
different from the other two activities, while in fact it is not.
The solution is to make all three activities the same size.
Chapter 3: Diagrams 61

Screenshot 22-2

Here’s how to do it:


Step 1: Select the elements you want to make the same size.
You can do this with ctrl+click or by dragging around the
elements to be selected.
Step 2: Right click on the element that is the norm (all
other elements, if possible, will get their height and width
from this element). A striped band will appear around the
element that is the norm.
Step 3: Choose “Same Height and Width” from the context
menu.
Chapter 3: Diagrams 62

Screenshot 22-3

Trick 23: Save as shortcut

This trick can save you time when you are working on
a project and you have different hats on. For example,
you are business analyst but also technical architect. As a
business analyst, you would probably need diagrams like
the organizational model, the business processes and the
requirements model. As a technical architect, you’ll open
the component diagram, the technical architecture diagram
and the like. Did you know you can have two shortcuts
to the same Enterprise Architect model, each leading to a
different set of diagrams open by default? Here’s how to do
that.
Step 1: In the File menu, choose “Save As”
Chapter 3: Diagrams 63

Step 2: As “Type of Save” choose “shortcut” (right side of


the dialog box). Give the shortcut any name you remember
and link to the diagrams it will open. In our example,
the shortcut “business analysis.eap” will only open those
diagrams that are relevant to the business analyst.
Step 3: Select some diagrams and press “OK”. The link
will be created. Test it by closing Enterprise Architect and
clicking on the link.

Screenshot 23-1

Trick 24: Change diagram type

One frustrating aspect of Enterprise Architect is that there


are many toolboxes but it is difficult to make your own
(see Trick 32: Create your own on page 75). On top of
that, each time you activate a diagram, the toolbox settings
Chapter 3: Diagrams 64

change. Luckily, they don’t change in a random way. The


toolboxes shown are determined by two factors: Visibility
settings (see page 74 for Trick 31: Toolbox visibility) and the
diagram type.

Screenshot 24-1

So you can influence what toolbox is shown by giving a


diagram the right type when it is created. But you can also
change the diagram type. Just press “Diagram | Change
Type…” and you get the dialog window below.
The tooltip warns you for restrictions: you cannot change
any diagram type in any other type. Unfortunately, it is
not clear what is allowed and what not. When you see the
following warning:
Chapter 3: Diagrams 65

You will have to use another trick to have Enterprise


Architect do what you want:
Step 1: Make a new diagram of the type you need and open
it.
Step 2: Open the old diagram, select all objects with ctrl+a
and press ctrl+c.
Step 3: Activate the new diagram and press ctrl+v. The
contents will be copied. If needed, you can delete the old
diagram; remember that diagrams are nothing more than a
view on a model so you don’t lose information apart from
some diagram-owned elements, possibly.

Screenshot 24-2

Old diagram of type “Documentation”, to be changed to a


sequence diagram:
Chapter 3: Diagrams 66

Screenshot 24-3

New sequence diagram:

Screenshot 24-4

Trick 25: Package on a diagram

Enterprise Architect has a nice feature to make lists from


elements that are present in the model tree. Just make a new
diagram and drag one or more packages to the diagram.
The result will be something like this:
Chapter 3: Diagrams 67

Screenshot 25-1

Note that the packages are kept up to date automatically:


for example if you add an actor to the roles package, the
diagram will reflect this change immediately. There are
several uses for this feature. To name but two:

Combination with “Diagrams Only Export”

In combination with the “Diagrams Only Export” function,


you have an automatic table of contents that gives the
reader a bit of context.

Combination with html export

In combination with the html export, an overview diagram


serves as a landing page for the reader. Just indicate this
diagram as the default diagram (see below).
Chapter 3: Diagrams 68

Screenshot 25-2

Trick 26: Quick zooming

If you happen to have a mouse with a mouse wheel, you


can easily zoom in Enterprise Architect diagrams. Just keep
the ctrl key pressed and use the mouse wheel to zoom in
(roll from bottom to top) or out (roll from top to bottom).
This diagram is at 50% zoom, useful if the diagram is
complicated and you want to have an overview:
Chapter 3: Diagrams 69

Screenshot 26-1

Returning to the normal zoom factor (100%) is as easy: just


ctrl+click with the mouse wheel and the diagram returns
to standard zoom.

Trick 27: Shallow or deep copy?

In some cases it might be necessary to copy an entire


diagram. There are two types of diagram copies, which
are somewhat mysteriously named “shallow” and “deep”.
Right click on the diagram, then choose “copy diagram”.
Go to the target package in the model tree, right click again
Chapter 3: Diagrams 70

and choose “paste diagram”. You get the following dialog


window.

Screenshot 27-1

The diagram below has two elements, one in the same


package and the other from a different package (Enterprise
Architect sometimes calls this a “namespace”, confusingly).
Chapter 3: Diagrams 71

Screenshot 27-2

The first copy is a shallow copy, the second a deep. Each


copy is made in a separate package. As you can see, the
shallow copy has not copied the “owned” element (it links
to the old element “WebBuilderPro” in the tree), but it has
made a copy of the “non-owned” element “Vinimble.com”.
If you duplicate the diagram in the same package, all
elements will be duplicated irrespective of copy mode. As
stated before, it is not good modeling practice to duplicate
elements when they represent one and the same thing in
the real world. Therefore, only use copies when you really
want to have different elements:

One thing is actually two

Either when you discover that one thing is actually two


(you might for example learn that there are two applica-
tions called “subscribermanagement”). In that case, it is
Chapter 3: Diagrams 72

good modeling practice to name them differently, if only


with a version number or something like that.

Playing with elements

Or when you want to “play” with the elements on a


diagram, for example when you want to develop different
scenarios. In that case, either delete the copy after your
study is done, either associate the corresponding elements
with each other so you can keep the overview when the
model evolves.

Screenshot 27-3

Trick 28: A legend

Adding a legend to a diagram can improve its readability,


but unfortunately, making legends in Enterprise Architect
version 8 is largely a manual business. First, find the
“Diagram Legend” icon in the toolbox “Common”. Click
the icon, go to the diagram and click where you want the
legend to appear.
Chapter 3: Diagrams 73

Screenshot 28-1

The dialog window “Legend” appears.

Screenshot 28-2

With the screen elements “Name”, “Fill Color”, “Line Color”


Chapter 3: Diagrams 74

and “Line Thickness” and with the controls “New”, “Save”,


“Delete” and both hand icons, you can create and edit
legend elements. There are two kinds of line elements:
“Fills” and “Lines”. This might not be too obvious, but
“Fills” stands for elements and “Lines” for connectors”.
Elements will come first, lines second. You cannot change
that. Each time you added a legend element, press “new” to
add a new element. If you forget, the current element will
be overwritten. Here’s what the Legend dialog box and the
legend box on a diagram look like:

Screenshot 28-3

You can change the order of the diagram elements by using


the up hand and down hand icons. The “Style Options”
window serves for giving the legend box on the diagram
its own colors. The different options here speak for their
Chapter 3: Diagrams 75

own:

Screenshot 28-4

Once you’ve made a legend, you can change it by double


clicking it on the diagram. Now what’s more important:
you can use the same legend on multiple diagrams. You
can even choose to paste it as a copy or as a link. If you
paste it as a copy, the resulting legends become unrelated.
Change one, and the other one does not change with it.
When you paste it as a link, however, the two legends will
keep a relation. Change one and the other one changes too.
This is handy when you work with multiple diagrams of
the same type.
So if you work with legends a lot, you can reuse them by
making a collection of legends and copying/pasting them
into the diagrams where you need them. It will help you to
Chapter 3: Diagrams 76

maintain consistency and therefore improve the readability


and ultimately the usability of your diagrams.

Screenshot 28-5

Trick 29: Status colors on diagrams

Certain elements, such as requirements, have a “status”


and are able to show this status by means of a color on
a diagram. At least when the setting “Show Status Colors
on Diagrams” is turned on. Select “Tools | Options”, go to
the “Objects” pane and check this option:
Chapter 3: Diagrams 77

Screenshot 29-1

From then on, each requirement on a requirements diagram


will show its status, like this:
By default, these are the statuses and their associated
colors:
Approved: Blue Implemented: Gray Mandatory: Orange
Proposed: Yellow Validated: Green
Now how can you define the statuses available and the
colors that go with these? Click “Settings | General Types”
and you get this dialog window:
Chapter 3: Diagrams 78

Screenshot 29-2

To me, the following statuses make sense:

Proposed

A requirement is proposed, but not yet validated let alone


implemented.

Validated

The requirement is validated as being useful to the project,


but business has not yet released it to IT so IT cannot yet
implement it.
Chapter 3: Diagrams 79

Approved

The requirement is handed over to IT so that they can work


on it to implement it.

Implemented

IT has implemented the requirement.

Mandatory: something else entirely

The status “Mandatory” does not fit into this list: it is


not a status, but a kind of priority assignment. I would
suggest you remove this from the status list. Furthermore,
you would probably need some way of saying that a
requirement has not been validated or approved, so it
becomes obsolete, and some way of saying that it has been
postponed. With the General Types dialog window, it’s
easy to add these types if needed. Until the colors you
choose are common knowledge in the project team and
to the relevant stakeholders, it also might be a good idea
to show a color legend on each requirements diagram.
See Trick 28: A legend on page 62 to learn how to work
with legends and how to reuse them. Be sure to follow the
lifecycle of the requirements as described above.
Chapter 3: Diagrams 80

Screenshot 29-3

Trick 30: Manual layouting

You’ve probably discovered the autolayout task panel (in


case you have not, it’s under “View | Layout tools”, after
Chapter 3: Diagrams 81

which a task pane appears to the left hand side of the


workspace). Then you’ve also discovered that this function
does not always work. And that you need to do some
manual work to get the layout you want. This section gives
you an overview of shortcuts. I suggest you learn them by
heart, especially if you want your diagrams to be economic
(in terms of space used) and readable (in terms of readers
rolling their eyes and mumbling “I am too dumb for this”).
Besides these two reasons, there’s another good reason to
layout a diagram nicely. A sloppy diagram like the one
below looks like you did not do your homework well. It
encourages your readers to treat your work as an “alpha
version”, and they won’t read it because they don’t have
the time�hey’ll wait for the final version instead!

Screenshot 30-1

Basically, there are three actions you can take to give a


diagram a nice layout:
Chapter 3: Diagrams 82

Sizing elements

Adjusting the height and the width of elements such that


they are equal in one or in two directions.

Aligning elements

So that they line up nicely along an (invisible) edge.

Spacing elements

Adjust the spaces between a series (3 or more) elements so


that the spaces are equally wide.
Usually, layouting a diagram is done in the order shown in
the diagram below.

Screenshot 30-2

So you resize the elements, then loop through aligning and


spacing them until it’s done. The final result will be like
this.
To resize elements, select them, then right click on the
element that already has the right height and width, then
Chapter 3: Diagrams 83

choose “same height and width”. Since you’ll do this only


once, you don’t really need a shortcut for that. Then, to
align the elements, select them (in our example, first align
the top elements, then the bottom elements, then the right
elements, then the left elements) and press alt+ctrl+arrow.
For example, to align the top edges of the top elements,
press alt+ctrl+arrow up. Again, the element with the thick
black-and-white striped border is the reference element. It
is the element clicked on or selected last. To finish, adjust
the position of the elements by selecting them and pressing
shift+

Screenshot 30-3

Note that only the middle elements will move when you
space items across. The left and the right item keep their
places. The same holds for the top and the bottom elements
when spacing vertically.
Chapter 4: Toolbox, types and tree 85

Chapter 4: Toolbox,
types and tree

Wordle 4
Chapter 4: Toolbox, types and tree 86

Were we work with the magical three t’s: toolbox, types,


and the tree.

Trick 31: Toolbox visibility

Getting the right toolbox is as important for the Enterprise


Architect user as it is for the carpenter. As we discussed
in Trick 24: Change diagram type on page 55, it depends
on the diagram type which toolboxes are visible and which
ones are not. But there is an exception. You can force certain
toolboxes to be visible in any case. Click “More tools” at the
top of the toolbox pane to get the dialog window “Visible
Toolbox Pages”.
Chapter 4: Toolbox, types and tree 87

Screenshot 31-1

Then simply check those toolboxes you need. At the bottom


of the window, check “Show Relationship Pages” if you
need specific relationships that go with element toolboxes
you don’t need. As you will see when you close the “Visible
Toolbox Pages” and you change diagram type, the diagram
specific toolbox comes first, then the toolboxes you checked
to be always visible. Good to know: instead of dragging
elements from the toolbox to a diagram, you can also
right click on the diagram and choose “New element or
Chapter 4: Toolbox, types and tree 88

connector”. The toolboxes shown are the same as those that


are shown on the toolbox pane.

Screenshot 31-2

Trick 32: Create your own toolbox

It is quite possible, though not straightforward, to develop


your own Enterprise Architect toolbox. Follow these steps:

Create a package

First, create a package and stereotype it as “Profile”. Add a


diagram of type “Class” to it.
The toolbox “Profile” will open automatically.
Chapter 4: Toolbox, types and tree 89

Screenshot 32-1

Add metaclasses

Second step: for every element or connector in the toolbox,


do the following 1. Add an element of type “MetaClass” and
choose the right metaclass to start from. For example: the
metaclass of “MyApplication” is “Object”, since we model
an application as “Object”.

1. Add an element of type “Stereotype” and give it the


name you want to appear in the toolbox.
2. Add an “Extends” relationship from the stereotype
to the metaclass.
3. Optional but nice: change the default color of the
stereotype to the default color you want these ele-
ments to get when using the toolbox.

The final result looks like this:


Chapter 4: Toolbox, types and tree 90

Screenshot 32-2

Save the package

Third step: right click on the package in the model tree


and choose “Save package as an UML profile”. Go to
the Resources pane (menu “View | Other Project Tools
| Resources”) and right click on “UML Profiles”. Choose
“Import UML profile”. Choose the xml file you just saved
and click “Import”.
Chapter 4: Toolbox, types and tree 91

Screenshot 32-3

Import the package

Fourth step: you can now open the toolbox by clicking


“More Tools…” in the bar on top of the toolbox pane and
start using it. There’s a lot more to be said about toolboxes:
you can define your own shapes, add tagged values to your
own stereotypes (see Trick 37: Inheriting tagged values) and
more. But this basic introduction will probably be enough
to start experimenting.
Chapter 4: Toolbox, types and tree 92

Screenshot 32-4

Trick 33: General types

Screenshot 33-1

We’ve met one general type in Trick 29: Status colors on


diagrams, but there are five in total.

Status

The one we already discussed.


Chapter 4: Toolbox, types and tree 93

Constraint

A constraint is something that limits something else. For


example, in requirements analysis, a constraint can limit
the solutions you can come up with: you have to use a
specific technology, the solution needs to be implemented
on specific hardware,…

Constraint status

Like requirements, constraints can have statuses. The list of


statuses is by default the same as the requirements statuses
mentioned above, but you can manage each list separately.

Requirement

A requirement is a need that the solution you will build


has to comply to. Enterprise Architect requirements can
be internal (belonging to an element) or external (existing
on their own, so you can connect them to more than one
element). If you really want to work with requirements
(which is a good idea if you want your customer to be
happy with the project result), I suggest you change the
default list of requirement types in Enterprise Architect
with the Volere classification (http://www.volere.co.uk/);
functional, data, look/feel, usability, performance, opera-
tional, maintainability, security, cultural, legal.
Chapter 4: Toolbox, types and tree 94

Scenario

Working with scenarios is useful if you work with use


cases as an analysis tool, but most elements in Enterprise
Architect can have scenarios included (see the properties
window of the element). The default list provided with En-
terprise Architect includes simple, basic path and alternate.
Usually, having a basic scenario with exceptions (alternate)
is enough even for fairly complicated analysis types.
Adapting these general types to your own needs can greatly
increase the usefulness of Enterprise Architect as a mod-
eling tool. Furthermore, since these general types are set
per project, they help impose standards for a project. The
weights indicated are useful if you calculate metrics. The
dialog window of general types can be found in the menu
Settings - General Types.
Chapter 4: Toolbox, types and tree 95

Screenshot 33-2

Trick 34: Auto name counters

In the menu “Settings”, there is an option “Auto Name


Counters” that is very useful when you work with elements
Chapter 4: Toolbox, types and tree 96

you need to refer to by name. The usual suspects are


requirements, changes, and issues. Auto name counters
give each element of that type a unique number, so you
can make lists and refer to each item by its number without
worries that you point to the wrong one.

Screenshot 34-1

First, indicate the type of element you want to setup an auto


name counter for. Then give it a prefix (like “issue”) and a
suffix (for example, to refer to the project in case you have
multiple projects running at the same time). As a counter,
type as many zeroes as needed to “pad” the counter, then a
“1”. This indicates that you want the auto name counter to
start with the number 1, appearing as “issue 0001 prX” on
the diagram.
Chapter 4: Toolbox, types and tree 97

Screenshot 34-2

Of course, you can start with any value you want. If you
input “0100” as a counter value, the first issue will be “0100”,
the next one “0101” and so on. You don’t have to give a
suffix and a prefix: neither of them or one of them is okay
too. Put a checkmark before “Active”, confirm with “Save”
and you will be able to use the auto name counter.
Chapter 4: Toolbox, types and tree 98

Screenshot 34-3

Trick 35: Stereotypes

In Trick 5: Element styles, I showed you how to work


with styles to give elements the appearance you want.
Chapter 4: Toolbox, types and tree 99

But there’s an even better way of accomplishing this. It


is somewhat more complicated, but much more flexible.
You cannot only change the colors of the text, the line and
the background of an element, but you can even give an
element exactly the appearance you want.

Screenshot 35-1

You could for example draw a nice picture for all actors that
belong to the Vinimble staff. When you use a stereotype, it
will automatically be the default appearance for all staff
actors. Here’s how to do it:
Step 1: Use any painting tool that supports metafiles (en-
Chapter 4: Toolbox, types and tree 100

hanced metafiles or *.emf are widely spread) to draw the


icon you want to be associated with a stereotype. Save it as
an emf file.
Step 2: In Enterprise Architect, click “Settings | UML…”
Step 3: In the dialog window that appears, type the name
of the new stereotype, indicate a base class and choose
“Metafile”. Click “assign” and point to the file you just
made.
Step 4: Don’t forget to press “save” when you are done.

Screenshot 35-2

When you now use an actor that is part of the Vinimble


staff, give it the stereotype “ActorStaff” and it will appear
as the image you made up.
There’s more to be said about stereotypes. They are indeed
one of the three mechanisms to extend UML in Enterprise
Architect. But this little trick gives at least an idea of how
powerful stereotypes are.
Chapter 4: Toolbox, types and tree 101

Trick 36: Tagged value types

Enterprise Architect users will know that they can add


tagged values to elements to keep information about spe-
cific properties of elements. For example, we could define
a tagged value called “BusinessValue” and attach it to the
requirements.

Screenshot 36-1

With tagged value types, we can go even further. When we


define a custom type, we can enforce a standard and protect
the user from entering wrong data.
The example below shows how to limit the values of the
tag “BusinessValue” to 1, 2 or 3.
Chapter 4: Toolbox, types and tree 102

Screenshot 36-2

As you can see, the spin control does not allow other
values than the ones we like to have as values for the tag
BusinessValue. Here’s how to do it:
Step 1: Click Settings - UML and choose the tab Tagged
Value Types.
Step 2: Enter a new tagged value type. Name it Business-
Value and give a description.
Step 3: As detail, add the following lines: Type=Spin; Up-
perBound=3; LowerBound=1;
Step 4: Press save.
Step 5: Open the properties of a requirement, choose the tab
with tagged values, and add the tag “BusinessValue”. You’ll
see the spin controls appearing on the screen.
Chapter 4: Toolbox, types and tree 103

Screenshot 36-3

Instead of working with a spin, you can also work with a


drop down box: a discrete list of possible values, like ‘high’,
‘medium’, ‘low’. The details field reads: Type=Drop down;
Values=high, medium, low;

Trick 37: Inheriting tagged values

If you develop your own toolbox (see Trick 32: Create


your own), you can add tagged values automatically to
elements. Turn to the profile package again and choose the
stereotype element of the item you want to add an inherited
Chapter 4: Toolbox, types and tree 104

tagged value to. Right click on the element and choose


“Attributes”. For example, we will add the tagged value
“BusinessValue” to all our requirements. Add an attribute
named “BusinessValue” to the attributes of MyRequire-
ment. The BusinessValue is of type “char” and the initial
value is “medium”.

Screenshot 37-1

Delete the old profile in the resources pane and re-import


Chapter 4: Toolbox, types and tree 105

the profile (see Trick 32: Create your own). If you now add a
requirement from your own toolbox, it will have the tagged
value “BusinessValue” and it is set to “medium”. Nice, but
it can be even nicer. Remember that we want to protect our
users from typing in wrong data. So we’ll limit the options
a business value can have. Add BusinessValueOptions (an
element of type “enumeration”) to the profile diagram and
add as its attributes the value list. In our example, we
would add three attributes to the enumeration “Business-
ValueOptions”: “Low”, “Medium” and “High”. Also indicate
“BusinessValueOptions” as the “Type” for the Business-
Value attribute of the MyRequirement element.

Screenshot 37-2

Re-import the profile after having deleted the old one, and
you can start using the BusinessValue tagged value with
limited options.
Chapter 4: Toolbox, types and tree 106

Screenshot 37-3

Trick 38: Apply a tagged value to


multiple elements

You’ve gathered a bunch of requirements and want them


to have the tag “BusinessValue”? Here’s how to do that:
Step 1: Select the elements, either by dragging over them or
by using ctrl+click if you want to select them one by one.
Step 2: Press ctrl+shift+t.
Step 3: The tagged value dialog window appears. Now just
select the tagged value from the list (or type it in the combo
box) and confirm.
Step 4: You can now set the value of the tag per element.
Chapter 4: Toolbox, types and tree 107

Screenshot 38-1

If you work with tagged values a lot, you can open the
Tagged Values pane and dock it to one side of the workspace.
The shortcut is ctrl+shift+§ but you’ll probably use the
menu View - tagged values.

Trick 39: Sorting tree

There are at least two good reasons to sort the model tree
in a convenient way:

Visual inspection and finding an element

When a package has lots of elements, it’s much easier to


find your way in it when it is sorted somehow.

Output

By default, the order of the output is the order of the tree.


When the order of the elements follows roughly the order
of the diagrams, output is easier to understand.
Chapter 4: Toolbox, types and tree 108

Screenshot 39-1

The tree above is not sorted in any meaningful way, except


that the elements are grouped by type. When you generate
a rtf document from this package, readers will have dif-
ficulties deciphering the logical order of the subscription
process. To get a more meaningful element order, first be
sure that the option “Tools - Options - General - Allow Free
Sorting” is checked.
Chapter 4: Toolbox, types and tree 109

Screenshot 39-2

Then use the green arrows on top of the model tree to put
items in the right order.

Screenshot 39-3

The result would be this:


Chapter 4: Toolbox, types and tree 110

Screenshot 39-4

Trick 40: Finding orphans

While modeling, the analyst sometimes adds elements to


the model tree to find out later that they are not needed.
Often, the element gets deleted from the diagram but not
from the model. The result is what we call an orphan:
elements that appear in the tree, but not on any diagram.
With one of the default searches, Enterprise Architect helps
us to find orphans like these. First, press ctrl+alt+a to open
the model search window in the main workspace. Then,
select as search type “Find orphans” and press “run”.

Screenshot 40-1
Chapter 4: Toolbox, types and tree 111

From this window, you can manipulate the object and


even delete it if it is really not needed anymore. Select the
element, click “delete” (the red cross icon) and it’s gone.
There are other searches available and even a sql-based
search builder. See Trick 42: Searches on page 97 for more
about searching.
Chapter 5: A bit more advanced 113

Chapter 5: A bit more


advanced
Chapter 5: A bit more advanced 114

Where we tackle some advanced topics, and also meet a


few strange uses of Enterprise Architect.

Trick 41: Slideshow

If you need to present your work, you can export your


work (for one nice way of doing that, see Trick 21: Copy
a diagram to the clipboard). But it is equally possible to
stay in Enterprise Architect and give a custom presentation
right from your workspace. Here’s how to proceed:

Screenshot 41-1

Step 1: Open the model view pane (menu “View | Model


Views”).
Step 2: Either select an existing model view or add a new
one, for example “Presentations” in the model view tree by
pressing the “New Model View” icon.
Chapter 5: A bit more advanced 115

Screenshot 41-2

Step 3: Add a Views folder to this model view by pressing


the “New Views folder”.
Step 4: Add a slideshow folder to this views folder with the
“New Slideshow Folder” icon.

Screenshot 41-3
Chapter 5: A bit more advanced 116

Step 5: Now drag diagrams from the project browser to the


slideshow you just created. You can add as many as you
like. Sort them with the green arrows.
You can choose whether to have an automatic presentation
or a manual one by double clicking its icon in the model
view tree. For automatic presentations, you can choose the
number of seconds that pass before the next slide is shown.

Screenshot 41-4

To run a slideshow, just right click it in the model view tree


and choose “Run Slideshow” or “Run Slideshow Fullscreen”.
Enterprise Architect then opens the diagrams in sequence
and closes them when the next one is shown.
When you disable the automatic presentation, each time
you click the diagram a small toolbar with controls appears
next to the cursor. Press the play button to advance to the
next slide (or press the spacebar).

Trick 42: Searches

We already encountered one search option in Trick 40:


Finding orphans on page 92. Here, we look for some more
nice search features. After all, when your model has be-
come an accurate representation of reality, you will consult
it to get answers to your questions. Searching for specific
Chapter 5: A bit more advanced 117

information is then one option to really use the model. Now


there’s a lot to say about searches. We will discuss only the
most useful aspects of it here.

Screenshot 42-1

Step 1: First, open the model search window by pressing


ctrl+alt+a.
Step 2: Then, choose any of the predefined searches. For
example, if you work with bookmarks as explained in Trick
4: Bookmarking elements on page 19, we can look for all
elements that bear a bookmark. Very useful if you need a
list of all model elements that still need work.

Screenshot 42-2

Step 3: Press “Run”. In the model search pane, a list of


corresponding elements appears.
Step 4: To group elements by any property, drag the column
Chapter 5: A bit more advanced 118

heading to the grouping row on the top of the results.


Step 5: To sort elements, just click on the column.
When you’re happy with the result, there are a few output
options. For example, you can copy and paste the list to
any other application, like a spreadsheet application, by
selecting the elements, right click and “Copy Selected to
Clipboard”, then paste it in the spreadsheet application.
This is how the list looks when pasted in the spreadsheet
application:

Screenshot 42-3

Alternatively, you can choose “Documentation” and send


the results to an rtf file. Note that in the search result list,
you can still edit the elements and their properties. This
gives you a quick way of accessing only those elements you
need, without having to scroll through the project browser.

Trick 43: Relationship matrix

Modeling is all about defining the right relationships be-


tween elements. Sometimes, we are lucky and the rela-
tionships are hierarchical. Like for example the organiza-
tional tree view: each unit is part of a department, every
Chapter 5: A bit more advanced 119

department is part of the company. In most cases, however,


relationships are many-to-many: every role acts in more
than one process, and every process has more than one role
taking part in it. A component is used by more than one
application, but an application can use no components at
all, a single component or several different components.
When we want to work with complex relationships like
these, we often want to represent them as a table. Enterprise
architect calls this the relationship matrix. From version
8 onwards, this view has interesting functionalities. Let’s
explore a few of them.

Screenshot 43-1

Step 1: First, select a package with the source elements in


the model tree. Right click it and choose “Documentation |
Open in Relationship Matrix | As Source…”.
Chapter 5: A bit more advanced 120

Screenshot 43-2

Step 2: Then, select some appropriate values for the fields


on top of the relationship matrix. The source has already
been filled in and we don’t bother with the profile yet. The
result should be a matrix like this one.
A first nice feature is that you can create and delete
relationships from this view, at least when we did specify
a direction (source -> target or the other way round). Right
click any cell to edit the relationship (if there is one) or
create it (if there isn’t). Then we can set some options. Click
options and choose “Matrix Options” to make this dialog
window appear. The options speak for themselves.
Chapter 5: A bit more advanced 121

Screenshot 43-3

When we achieve the result we had in mind, we can save


the matrix either as a drawing (metafile or png) or as a CSV
so we can import the matrix in our spreadsheet application.

Screenshot 43-4

Finally, we can save the options we have set to a profile.


This is just a way to quickly set the same options again
Chapter 5: A bit more advanced 122

in the future, for the same or for other packages. It has


nothing to do with UML profiles. Press “Profiles” to access
this feature. Saved profiles will be available in the main
relationship matrix window (top right).

Trick 44: Hierarchy window and


traceability

The traceability window (in Enterprise Architect below


version 8 called “Hierarchy View”) is a nice feature for
when you have a complicated model that you want to
consult. Select any element on a diagram and press “View
|Traceability” to get the traceability pane docked to the side
of the workspace.
Chapter 5: A bit more advanced 123

Screenshot 44-1

The relationship buttons at the top allow you to only


show those relationships that are currently of interest.
Furthermore, you can:
Step 1: right click any element in this tree to get a context
menu where you can switch to the related element so you
can navigate through the model, each time focusing on a
different element
Step 2: view the properties of the element
Chapter 5: A bit more advanced 124

Step 3: locate it in all diagrams (“Find in all Diagrams…”).

Screenshot 44-2

Trick 45: List view

Diagrams, while flexible to work with, can become so


complicated that it is difficult to keep the overview. For
example, in a diagram with different element types and
lots of connections, it can be hard to locate an element, or to
count how many items of one type are present. The solution
is to switch to list view by right clicking on the diagram:
The result is a list like this:
Chapter 5: A bit more advanced 125

Screenshot 45-1

Here you can group by columns, change the placement of


columns, sort columns (by clicking the black arrow that
appears when you hover over a column header), edit items,
make rtf reports of the list and more. Changing back to
diagram mode is a matter of right clicking the list and
choosing “Switch to Diagram Mode”. Warning: in previous
versions of Enterprise Architect, you could copy the list to
the clipboard so as to paste it in other applications. If you
try the same in Enterprise Architect version 7.5 or higher,
you will get undesired effects:
Step 1: Pressing ctrl-c empties the description of the first
item in the list and “undo” is not available.
Step 2: Choosing “Edit | Copy” copies the diagram to the
clipboard as a diagram, not as an element list.
Chapter 5: A bit more advanced 126

Screenshot 45-2

Trick 46: Filtering

Filtering is a feature new to Enterprise Architect 8, it might


even be the most useful new feature of that software ver-
sion. Before version 8, we had no way but the manual and
tedious one to show the difference between “as is” and “to
be”, or between the deliverables of different project phases,
or of different scenarios. So filtering is what we needed
and finally got. Here’s how to work with filters. First, we’ll
define some filters. Click “View | Diagram Filters”. The
filter pane appears to the side of the workspace. Press the
“New Filter” icon, choose a name for the filter (for example,
“Phase 1”). Then choose the filter conditions.
Chapter 5: A bit more advanced 127

Screenshot 46-1

Here, I only require that an element’s phase description


contains the character ‘1’. When I use the filter on a
diagram, this is the result:
Chapter 5: A bit more advanced 128

Screenshot 46-2

So we see that in phase 1 of the project, we only have the


SubscriberList component available. The archive compo-
nent and the link to the website will come in phases 2 and
3. We can combine filters to show the full result:
Chapter 5: A bit more advanced 129

Screenshot 46-3

Instead of showing the deliverables for next phases as


faded or gray, we can also hide them or select them. By
cleverly combining filters and properties of elements and
connectors, we can show exactly what we want with little
effort. A truly useful new feature!

Trick 47: Printing large diagrams

This trick has little to do with Enterprise Architect itself,


but if you don’t have the money to buy a big printer, it can
help you to print large diagrams so you can communicate
effectively. Here’s an example of an impact diagram that
won’t fit on a standard page from your printer, especially
after the analysis is done:
Chapter 5: A bit more advanced 130

Screenshot 47-1

Now how to print this? We’ll need a standard printer,


scissors and glue for that! First, print the diagram on
multiple pages. Then, cut off the edges this way:
Step 1: Top left page: don’t cut off the edges
Step 2: Top pages starting from the second one: cut off the
left edge
Chapter 5: A bit more advanced 131

Step 3: Second and following rows: for the leftmost page,


only cut off the top edge. For all other pages, cut off the
top and the left edge. (edges to be cut off are indicated in
black).
Step 4: Now glue the pages together, each time using the
blank edge to put the glue on. (glue is indicated in green).
Step 5: Tip: it helps if you have a diagram frame around the
diagram. That way you can at least position the outer pages
correctly. See Trick 21: Copy a diagram to the clipboard.

Printing large diagrams


Chapter 5: A bit more advanced 132

Trick 48: The Team Review

Formerly called the “Discussion Forum”, the “Team Re-


view” pane facilitates teamwork on a model. The inte-
gration of a discussion forum in the Enterprise Architect
interface has two advantages:

Ease of use

No need to leave your daily work environment and switch


to another tool.

Links

You can put links to elements from the model tree in the
discussion forum, so it’s easy to point to elements that need
work.
Chapter 5: A bit more advanced 133

Screenshot 48-1

To start, open the Team Review pane by clicking “View |


Team Review” (or with the shortcut ctrl+alt+u).
In the empty team review pane, make a new discussion and
a new post. Double click the post and a blank sheet of paper
will open in the main workspace. Here you can type the
body of the post. To pinpoint the element or the diagram
you are talking about, select a word or a group of words,
right click the selection and press “Create | Link to Existing
Element”.
Chapter 5: A bit more advanced 134

Screenshot 48-2

From the dialog window that appears, choose the right


element and a link will be created in the document. When
you or a teammate clicks it, he will be brought to the right
element in the tree, making it easy to discuss the model.
There are lots of other features connected with the team
review function. To name a few useful ones:

Rich text

Each discussion post is a “rich text” fragment, so you


can copy/paste objects from other applications. Sounds
obvious, but it makes posts lively and rich.
Chapter 5: A bit more advanced 135

Glossary definitions

You can create glossary definitions from a text in a dis-


cussion post. Often you’ll find yourself talking about a
word without having given it a clear definition. Right click
the word, choose “Create | Glossary Definition” and give
in the definition in the dialog window that pops up. The
glossary is available in the menu “Project | Documentation
| Glossary”.

Standard workflow

There is a standard workflow available for the posts in


the team review pane. Right click a post, choose “Review
Status” and indicate the status. Depending on the status
chosen, the post will show a different icon: a yellow tri-
angle for posts awaiting approval, a green checkmark for
approved posts, and a red cross for rejected posts.
Chapter 5: A bit more advanced 136

Screenshot 48-3

Trick 49: Database access

Some operations would be very difficult, time consuming


or nearly impossible to carry out in Enterprise Architect.
Especially difficult to work with are connectors, since
they don’t show up in the repository. That makes batch
operations, like for example, finding all connectors of type
“controlflow” and stereotyping them as “Businessflow”, te-
dious and error-prone. If you work on a local database, the
trick is to access the database directly. As an example, let’s
change all connectors of type “UseCase” to “Dependency”:
Step 1: Close Enterprise Architect.
Step 2: Make a backup copy of the file containing the model.
Chapter 5: A bit more advanced 137

Step 3: Rename extension of the original file from *.eap to


*.mdb.
Step 4: Open this file in Microsoft Access.
Step 5: Locate the table t_connector and open it.
Step 6: Filter the table so as to show only the UseCase
connectors.
Step 7: Change these to “Dependency”.
Step 8: Close the file and re-rename it to *.eap.
Step 9: Open it in Enterprise Architect and verify that the
model is still okay.

Screenshot 49-1

Warning:

Not all changes will lead to the desired results. Always have
a backup copy of your model, always verify that the model
is not corrupt and that there are no undesired side effects.
Use this trick only if you understand how the Enterprise
Architect datamodel works. If you don’t feel safe, don’t do
it.
Chapter 5: A bit more advanced 138

Trick 50: Visualize workflow


Agile methods have become increasingly popular in IT and
rightfully so. When used well, methods like scrum and
kanban can really help you achieve succes. One common
guideline among agile methods is to visualize workflow.
This basically means: keeping an overview of what needs
to be done, what is being done and what has been done.
Surprisingly, Enterprise Architect is a reasonably good tool
to keep an overview like this. For modeling projects, a
big advantage is that you don’t need to switch to another
tool: you can keep your work list in your main working
environment. The task list presented here might not be as
flexible as a wall with post it notes, but it has the advantage
that it works even for distributed teams. Here’s how to do
it:
Step 1: Make a new root level folder called “TO DO”. Add
a diagram of type “UML Behavioral | Activity”.
Step 2: Add three elements of type “Partition”. Name them
“TO DO”, “In progress” and “Done” respectively. Change
their orientation to vertical (by clicking the fourth little
icon on the top right of the partition element on the
diagram, or by right clicking and choosing “Advanced |
Vertical Partition”).
Step 3: Stitch the partitions to each other (they are dockable
by default, see Trick 17: Docking elements on page 39).
Step 4: Now for each task, add an element of a type you
otherwise don’t use (like “Action”). This way, you can
Chapter 5: A bit more advanced 139

use searches (see Trick 42: Searches97 on page 97) without


getting your model mixed up with your task list. The text
of the item should reflect the task.
Step 5: Put each task in the right partition: TO DO if it is
untouched yet, In progress if someone is working on it, and
Done if it’s finished. To change the status of a task, simply
drag it to the next partition. The diagram will look like this:

Screenshot 50-1

And the model tree looks like this:

Screenshot 50-2

As you can see, the actions are “owned” by their partitions,


so it is easy to keep an overview or to extract reports.
Chapter 5: A bit more advanced 140

Some more tips

Tip 1: If a task is related to a diagram or a specific element,


include the path to this diagram or element in the notes
(right click “Copy Reference | Copy Node Path to Clip-
board).
Tip 2: If you have a specific workflow each task goes
through, split the “In progress” column in more columns,
each indicating a workflow stage. For example, you might
have “Analysis”, “Documentation” and “Review”.
Tip 3: For each “work in progress column”, add a maximal
number of tasks that can be here at the same time. In our
example, we have only one such column and it has a work
in progress limit of 4. This simple addition implements
the kanban guideline “Limit work in progress”. When you
stick to it, it helps you to keep focus and become aware of
bottlenecks in your workflow.
Tip 4: If a task is high priority, give it a distinct color (in our
example: orange). When a task moves from “In progress” to
“Done”, there is room for a new task. Which one to choose
from the TO DO column? Easy: the one that is high priority,
in this case “complete application landscape”.
Bonus Chapter 1:
various extra tips
Trick 1: a simple todo list

When you are developing a model, you’ll want to put some


things off your head. Suppose you are currently designing
the system and you suddenly remember that you have
still to flesh out the code for a component you use on the
diagram.

Screenshot 1-1

I’ve just attached a note to the component, but I could have


put this in the notes of the component description as well.
Bonus Chapter 1: various extra tips 142

Now you can easily search your entire model by pressing


ctrl-f and using “todo:” (without quotes) as a search term.
Enterprise Architect will come up with a list of items where
todo: appears in the body or in the description.

Screenshot 1-2

Of course this works with all search terms, not just “todo:”.
You could even use @tags if you like (like, “@john”, to
indicate John has to work on this). Unfortunataly, hashtags
won’t work (“#urgent”) so I stick with the “:” marker.

Trick 2: quickly copying an element


with its properties

To quicly copy an element with all its properties, select the


element, press ctrl+c and shift+ctrl+v. You will get a dialog
window like this:
Bonus Chapter 1: various extra tips 143

Screenshot 2-1

Now you can change the name if you like. You probably
will, since having two elements with the same name does
not make much sense from a modeling perspective. It can
only create confusion.
The element and its properties, but not its links, will be
copied.
You can repeat the shift+ctrl+v to get additional copies.

Trick 3: Hide stereotypes for


information items on information
items conveyed by a connector

Some connections, such as “information flow”, allow to


indicate the information that is conveyed by the flow in a
more structured way than by just naming the flow. That
Bonus Chapter 1: various extra tips 144

way, you can reuse the information model you built by


having the classes or objects appear as flow labels.
Now if such a class or object has a stereotype, it will show
on the connector, like here:

Screenshot 3-1

While sometimes this is a useful piece of information, at


other times it clutters the diagram. Luckily, there is a way
to turn these stereotype labels off.
Open Tools | Options and uncheck “Show Stereotypes in the
box “Project Browser”. Restart EA. The stereotype label has
gone!
Bonus Chapter 1: various extra tips 145

Screenshot 3-2

As a side effect, the stereotypes disappear from the tree as


well. Here is what you get:

Screenshot 3-3

Trick 4: Show Namespaces


By default, Enterprise Architect diagrams show for every
element outside the diagram package the name of the
Bonus Chapter 1: various extra tips 146

package it belongs to. Especially for diagrams with lots of


foreign elements, this adds to the clutter and readability
suffers.

Screenshot 4-1

It is good to know you can turn this off in the diagram


properties window. For some reason, Enterprise Architect
calls the package name a “namespace” even if you did
not indicate it as such. Open diagram properties by right-
clicking on an empty part of the diagram, and clicking on
“Properties”, choose the “Diagram” tab and uncheck the
option “Show Namespace”.
Bonus Chapter 1: various extra tips 147

Screenshot 4-2

The result is a much more readable diagram:


Bonus Chapter 1: various extra tips 148

Screenshot 4-3

Trick 5: A bunch of relations

In my work as a business analist for Vinimble, I discovered


that there are three main groups of stakeholders, each
with their own specific requirements. On the other hand, I
also discovered that there are some requirements that are
shared by all stakeholders. Let’s model that with Enterprise
Architect.
Bonus Chapter 1: various extra tips 149

Screenshot 5-1

How to connect the general requirements on top to all


three stakeholders? Drawing the relations one by one is
cumbersome and there’s a risk you miss one.
The solution is to turn to the relationship matrix. Right-
click on the package with the general requirements in the
model tree and choose “Documentation | Open in Relation-
ship Matrix | As Source”:
Bonus Chapter 1: various extra tips 150

Screenshot 5-2

Then select all cells by clicking the topmost left cell, press-
ing shift and clicking the bottom right cell. Release the shift
button and right click any of the selected cells. Then choose
“Create Relationship | UML::Dependency”:

Screenshot 5-3

Turn to the diagram again, and there’s the result we ex-


pected:
Bonus Chapter 1: various extra tips 151

Screenshot 5-4

Or, as my colleague Erwin put it, “the result is an ugly


diagram”. Indeed, but I am sure you can beautify it! And,
being an architect, you are well aware that it is the model
that counts, not the diagram…

Trick 6: Reporting on some specific


elements

Sometimes you need reports. For example when meeting


with non-EA users about a specific piece of your model.
Suppose you have this big package full of well-documented
elements. How to pick only those that are relevant for the
review meeting? Of course, you could just generate the
whole document and then strip out what you don’t need.
Bonus Chapter 1: various extra tips 152

But that is rather time-consuming and error-prone. There


is a better way:

• Right click the package in the tree


• Choose “package browser”. The middle pane will
now show the list of elements in the current package
instead of a diagram.
• Select the relevant elements with ctrl+click
• Right-click any selected element and choose “Docu-
mentation” | “RTF Report on Selected Items…”.

Screenshot 6-1

Now just continue generating the RTF report. The result


will be a nicely formatted RTF document with exactly the
elements you need!
Bonus Chapter 1: various extra tips 153

Screenshot 6-2

Trick 7: Inserting images the easy


way

In my work as a business analyst, I’ve created diagrams,


models, drawings and other artifacts outside Enterprise
Architect. For example, I’ve made this Mind Map with
seven types of waste typically found in processes.
Now I would like to add this picture to a diagram, for
example to take it to a stakeholder meeting as one single
piece of paper. How to do that?
This is really easy. Grab the picture in Explorer and drag it
to the diagram:
Bonus Chapter 1: various extra tips 154

Screenshot 7-1

Then choose “Insert”:

Screenshot 7-2

The result is exactly what we want: we have a diagram with


the addition image. It is even resizable. It shows up as a
“boundary”. You can change its properties like its name by
right-clicking it and choosing “Properties”, like any other
EA element.
Bonus Chapter 1: various extra tips 155

Screenshot 7-3

Trick 8: Updating the status of all


requirements in a package

After the meeting with the business, all of the general


requirements I gathered so far have been approved by the
business stakeholders. How can I update their status with-
out the time consuming action sequence “open requirement
- change status - close requirement”?
Simple: right click the package, select “package control”
then “update package status…”
Bonus Chapter 1: various extra tips 156

Screenshot 8-1

The dialog that opens now lets you update the statuses of
all the elements, but also the version and phase:
Bonus Chapter 1: various extra tips 157

Screenshot 8-2

In case you have a diagram with requirements open, and


the requirements show a color to reflect their status (see
trick 29), you need to close and reopen the diagram to see
the effect:

Screenshot 8-3
Bonus Chapter 1: various extra tips 158

Trick 9: How to make a diagram the


model default, and how to undo it

Do you find yourself opening the same diagram each time


you start up Enterprise Architect? Or do you want to focus
the team on the to do list when they open the model in EA?
Here’s how you can indicate the default model to open
when starting up the tool.
Open the diagram. In the “Diagram” menu, click “ad-
vanced” and “make model default”.

Screenshot 9-1

Now every time anyone opens the diagram, this diagram


will be shown. This is especially useful for overviews or to
do lists.
Remark that there is no way to undo this. Or is there?
Just create some empty diagram, indicate it as the model
Bonus Chapter 1: various extra tips 159

default, and delete it.

Trick 10: coupling roles to


swimlanes

In business modelling, there are two competing ways to


model a process:

Implicit

Put activities in swimlanes, representing a role or an actor.


This is the “implicit” way of working.
A clear advantage of this approach is that for simple
processes, it is a very simple, understandable picture. Peo-
ple won’t need uml training to grasp the meaning: the
swimlane represents the responsibility area of a role.
Screenshot 1 gives an example of a simple process descrip-
tion using swimlanes.
Bonus Chapter 1: various extra tips 160

Screenshot 10-1

There are also disadvantages:

• Shared responsibilities: It is difficult to represent


shared responsibilities. Suppose you want to indi-
cate that both the reviewing editor and the editor-
in-chief are responsible for the final review of an
article, you’ll have to clutter the diagram either by
duplicating the activity, either by adding a swimlane
for the combination “reviewing editor” and “editor-
in-chief”.
• Traceability: a modeling tool ultimately leads to a
model that is more than the sum of the diagrams.
Bonus Chapter 1: various extra tips 161

For example, once you start designing the applica-


tion landscape, you could benefit from the business
process model to connect the applications with the
business activities. Later, you could easily find which
roles are most likely users of what applications by
exploiting the model.
• Space: often, the swimlane notation takes a lot of
space, most of which is empty. Especially when there
are actors who don’t do a lot in the process. There are
a few tricks you can use so your diagrams don’t grow
too large (like having a swimlane “others” where you
combine roles that appear only once), but even then
the problem remains.

Explicit

In the explicit approach, you connect the activities directly


to elements representing the roles. This gives compact
diagrams with full traceability, but they can be somewhat
harder to read, especially for those who are used to swim-
lane style process diagrams.
Screenshot 2 gives an example of a simple process descrip-
tion using the explicit notation.
Bonus Chapter 1: various extra tips 162

Screenshot 10-2

Combining the explicit and the implicit


way of working

Is there a way to have the advantages of both modelling ap-


proaches, without too much duplication or other overhead
Bonus Chapter 1: various extra tips 163

work? Yes there is!


First, describe the process using the swimlane notation.
Add the roles to the diagram and connect them to the
activities. Then delete the roles and open the swimlane
editor (right click on an empty space of the diagram, choose
“Swimlanes and Matrix…”).
Now edit the swimlanes one by one by clicking the swim-
lane and choosing “Modify”. Next to the “Classifier” label
and text box, there is a button with “…” (screenshot 3). Click
it, and search for the role in the tree that appears. Click OK
and the role will be connected to the swimlane.
Bonus Chapter 1: various extra tips 164

Screenshot 10-3

It will even be indicated in the diagram (see screenshot


4: instead of just “editor” the swimlane header label says
“editor:reviewing editor”).
Bonus Chapter 1: various extra tips 165

Screenshot 10-4
Bonus Chapter 2: Still
more various extra tips
Trick 1: semi-batch creation of
elements

Sometimes, you need to add a batch of elements that have a


few properties in common, but not all. Like when you want
to create ten or more actors stereotyped as “BusinessRole”.
Here’s how to do that efficiently:

• switch to list view: right-click on the diagram and


choose “List view”
• choose “New element” (ctrl+N or press the “new”
icon, top left of the list)
• Indicate the element type (“Actor”) and the stereo-
type (“Businessrole”)
• uncheck “Open Properties Dialog on Creation” and
“Close Dialog on OK”
• Now give the name of the first element, press create,
change the name to that of the second element and
repeat.
Bonus Chapter 2: Still more various extra tips 167

Screenshot 1-1

Simple, but very effective! I even use this instead of import-


ing via csv if the list to import is relatively short.

Trick 2: sorting a list on tagged


values

Suppose we keep track of our main technologies. Currently,


we use Java, Python and HTML. Most components and
applications use only one of these technologies, some can
use two or even all three. We also want to keep track of the
version of the technology used: SE 6 and SE 7 for Java, 4
and 5 for HTML and so on.
Bonus Chapter 2: Still more various extra tips 168

A good way to do that is to use tagged values. The tags


are “JavaVersion”, “PythonVersion” and “HTMLVersion”.
Values are “SE 6” and “SE 7” for Java and so on.
We now want to sort a list of all our components and
applications based on these tagged values, so we can discuss
with the architect which elements need an upgrade and
which are fine for now.
Here’s how to do that.
Step 1: Define it in the UML types window (“Settings | UML
Types | Tagged Value Types”)
Bonus Chapter 2: Still more various extra tips 169

Screenshot 2-1

Step 2: Use the tagged value by accessing the properties


dialog of the element and clicking on “Tagged Values”.
Bonus Chapter 2: Still more various extra tips 170

Screenshot 2-2

Step 3: Sort the list view: open the diagram in list view, right
click and choose “Add tag value column”
Bonus Chapter 2: Still more various extra tips 171

Screenshot 2-3

Extra tips

• It is also possible to use a tagged value that is not


defined in the UML types window. Select an element
in the list view, right click it and indicate “Tagged
Value types from the Selected Element”. Then choose
the tagged value from the list.
• You can even drag the tagged values to the column of
the list window, so as to hide any elements for which
a certain technology is not used. This allows you to
focus quickly on those applications that use HTML,
for example.
Bonus Chapter 2: Still more various extra tips 172

Screenshot 2-4

• If you leave the tagged values window opened (“View


| Tagged values”), it is easier to manage the tagged
values for the elements you are working with.

Trick 3: using lists for easy export


to spreadsheets

Exporting data from Enterprise Architect can be a time


consuming process. Like when you want to export all
elements from a diagram (not a node in the tree). And when
you want specific data like tagged values to be exported as
well.
Here is a little trick that can save you some valuable time.
Bonus Chapter 2: Still more various extra tips 173

Open the diagram in list view, apply the previous tricks to


get the right data in the list. Then select the first row, press
shift and select the last row.

Screenshot 3-1

Now press ctrl-c, switch to the spreadsheet and press ctrl-v.


The result will be a nicely formatted table with exactly the
data you wanted.

Screenshot 3-2

Note: depending on the spreadsheet settings, you might not


get a properly formatted table in the spreadsheet applica-
tion. In that case, paste the data in a text processor like
Bonus Chapter 2: Still more various extra tips 174

Notepad. Save the file as a csv file and import it into the
spreadsheet application.

Trick 4: really advanced search

Underneath the graphical user interface of Enterprise Ar-


chitect, there is a database. Wouldn’t it be fantastic if you
could query this database from within the user interface?
Well, you can. Here’s how:
Step 1: press ctrl-f to open the search window. Then click
the builder button (the one with the blue triangle).

Screenshot 4-1

Step 2: switch the tab from “search builder” to “sql” by


clicking the sql tab
Bonus Chapter 2: Still more various extra tips 175

Screenshot 4-2

Step 3: start typing “select * from”. Bring up the list of tables


by clicking ctrl+space and choose a table, for example “t_-
authors”
Bonus Chapter 2: Still more various extra tips 176

Screenshot 4-3

Step 4: click “Run SQL” or F5. The list of currently defined


project authors appears.

Extra tips

• Since this result list is a normal Enterprise Architect


list, you can select some items, press ctrl+c, open up
a spreadsheet and paste them in the spreadsheet with
ctrl+v.
• Relating what you see in the table list and what is
there in the user interface is tricky. For example,
tagged values related to elements are not stored in
the t_taggedvalues table, but in the t_objectproper-
ties table. Thomas Kilian has published a valuable
leanpub book about querying Enterprise Architect.
You can find it here: http://leanpub.com/InsideEA
Bonus Chapter 2: Still more various extra tips 177

Trick 5: convert a scenario to a


diagram - automatically!

How often are you pondering “should I model this as a


diagram, or present it as a text”? The answer is, of course:
it depends. It depends for a large part on the demands of
the audience. Some people prefer to read text, other imme-
diately grasp the meaning of a well-structured diagram.
Thanks to a nice Enterprise Architect feature, you don’t
even have to choose. You can please your IT colleague, who
wants the details in the form of text, and your manager who
never has the time to read (but inspects any diagram with
great care).
Here is how it works. Suppose we are modeling the func-
tionality of the Vinimble website with use cases. Open the
properties of a use case and choose “Rules - Scenarios”.
Then click the tab “Structured specification”.
Bonus Chapter 2: Still more various extra tips 178

Screenshot 5-1

Now gradually add the scenario steps. When the scenario


is complete, press the “Generate Diagram” button and the
scenario will appear as a diagram:
Bonus Chapter 2: Still more various extra tips 179

Screenshot 5-2

Extra tips

• Next to the “Generate Diagram” button, there is a


dropdown button that allows you to choose the type
of diagram. Default is a simple activity diagram, but
other options include ruleflow, state and robustness
diagrams.
• For each scenario step, you can indicate whether
it is a human being who carries out the step, or a
Bonus Chapter 2: Still more various extra tips 180

computer. Just right click the icon in front of the step


and choose the appropriate option.
• You can add alternate scenarios and exceptions as
well. If you add steps to these alternate scenarios,
they will show up as decision diamonds in the gen-
erated diagram.

Trick 6: how to make structured


text from diagrams

Once you have run the diagram export as explained in tip


5, you can choose if you want to work on the text or on
the diagram. Enterprise Architect has this nice little feature
that allows you to change the diagram you generated from
a structured scenario, then reimport this diagram into the
structured text. Here’s how to do that.
Bonus Chapter 2: Still more various extra tips 181

Screenshot 6-1

First, make a change to the generated diagram.


Bonus Chapter 2: Still more various extra tips 182

Screenshot 6-2

For example, let’s add a step. If you are done, save the
diagram.
Bonus Chapter 2: Still more various extra tips 183

Screenshot 6-3

Then, open the structured specification editor and right


click. Choose “Create structure from generated activity
diagram”. The validation window will open, and Enterprise
Architect asks to confirm that you want to overwrite the
old structured specification. Click “yes” and the step has
been added to the structured specification!
Bonus Chapter 2: Still more various extra tips 184

Screenshot 6-4

Alas, this won’t work if you make up your own diagram


instead of generating it from a structured specification. So
the trick is to generate a diagram as fast as possible, then
continue working on the diagram, regularly going back to
the structured specification to reimport it.

Trick 7: Importing visio drawings

During my work as a consultant for Vinimble, the chief ed-


itor told me someone already studied the “Call for Articles”
process. “I’ll send you the Visio diagrams,” he said. And he
kept his promise.
Would there be some clever way to import these diagrams
in Enterprise Architect, saving me time from redrawing
them? Yes there is! First, we’ll find and install the Visio
Bonus Chapter 2: Still more various extra tips 185

importer on the SparxSystems website. Then, I’ll show you


an example of how to work with it. And last, I tell you
how the importer works for three frequently used Visio
stencils: the Basic Shapes, the Basic Flowchart Shapes, and
the UML Activity Diagram. Importing from diagrams made
with other Visio stencils behaves the same way as these
three, so you can experiment with it yourself to find out
what works and what not.

Finding and installing the Visio Importer

Finding the Visio Importer on the SparxSsytems website is


not trivial, even if you know it exists and how it is called.
Here are the links:
Link to the products page: http://www.sparxsystems.com/products/#link
Direct link: http://www.sparxsystems.com/bin/VisioImporter.exe

An example of Visio imports

First step: install the MDG Link for Microsoft Visio.


Bonus Chapter 2: Still more various extra tips 186

Screenshot 7-1

Second step: this is the Visio process model we will import,


as seen in the Visio GUI:
Bonus Chapter 2: Still more various extra tips 187

Screenshot 7-2

Third step: In Enterprise Architect, select “Extensions |


Bonus Chapter 2: Still more various extra tips 188

Import Visio Documents…”.

Screenshot 7-3

Fourth step: choose a default model. If you want to deviate


from the suggested default Diagram Type, Object Type and
Connector Type, choose “Custom…”.

Screenshot 7-4

Fifth step: take a look at the report after the import is


finished. This will tell you how Enterprise Architect inter-
preted the Visio model.
Bonus Chapter 2: Still more various extra tips 189

Screenshot 7-5

Sixth step: the final result. As you can see, most elements
have been translated correctly, be it that only the appear-
ance is correct (color, shape, position and connections). If
I want the element type to be correct as well, I need to
instruct the creator of the Visio diagram to work with an
other Visio stencil (UML Activity) or I can tweak the results
Bonus Chapter 2: Still more various extra tips 190

after import.

Screenshot 7-6

Basic shapes

Basic shapes from Visio are not recognized by Enterprise


Architect. Importing shapes like squares, rectangles,… re-
sults in an element of a default type (for example, “activity”
when the type of diagram is “activity diagram”) with a
stereotype that is equal to the Visio shape name. Spaces
Bonus Chapter 2: Still more various extra tips 191

in the shape name result in underscores.


The exact result depends on the stereotypes present in
Enterprise Architect. By default:

• Visio circles, squares, rectangles and triangles result


in transparant Enterprise Architect elements with a
standard border
• Rounded rectangles: stereotyped “rounded_rectan-
gle” results in a filled Enterprise Architect element
with the stereotype and the element name shown.

Basic flowchart shapes

• Process and decision seem to be recognized and get


the correct Enterprise Architect element type (an
“activity” and a “decision” respectively)
• Other visio shapes (Document, Start/End, Subpro-
cess, Database, Data, External Data) are not recog-
nized and get a default element type with a stereo-
type that reflects the visio shape name, spaces be-
coming underscores.

UML Activity

• Swimlanes become boundaries, resulting in a correct


looking diagram
• ActivityInitial, ActivityFinal, State and Decision from
Visio are translated properly into Enterprise Archi-
tect elements.
Bonus Chapter 2: Still more various extra tips 192

• Action States from Visio become Activities in Enter-


prise Architect
• Transition (Fork) and Transition (Join) get lost and
the importer window shows an error message
• Signal Send, Signal Receipt, Object in State and
Constraints are converted to Activity in Enterprise
Architect

An example of a simple Activity Diagram with two swim-


lanes, an activityinitial, an activityfinal, two activities and
a decision, imported from a Visio model based on the UML
Activity stencil.
Bonus Chapter 2: Still more various extra tips 193

Screenshot 7-7

Trick 8: Links in notes

Most Enterprise Architect users have noticed the hyperlink


icon that appears in the toolbar on top of every notes
field. Those who have tried it, surely have wondered what
Bonus Chapter 2: Still more various extra tips 194

it does. Nothing, most of the time. Unless you link to


elements, or when you start exporting the model to rtf
(Microsoft Word) or html (website).

Screenshot 8-1

Open an element, type some text in the notes field and


select a part of this text. Then click the hyperlink button
(the globe with a keychain on top of it). A dialog window
appears that allows you to choose a link type and some
parameters.
Most of these links do not work in the Enterprise Architect
GUI itself. Some links work when output is generated,
either to rtf either to html. This is true only if the target
is also included in the output, naturally.

Attribute

Links to an attribute of an element. Only works in output


and insofar the target attribute is present in the output.
Bonus Chapter 2: Still more various extra tips 195

Diagram

Links to a diagram. Only works in output and insofar the


target diagram is present in the output.

EA Command

Links to an EA Command. Makes sense only in the EA GUI,


but it does not work.

Element

This is the only link that actually works in de Enterprise


Architect GUI. When you hover over the element link,
three buttons appear.

• Open element properties: the leftmost button opens


the target element’s properties window on top of the
source element’s properties.
• Find element in diagrams: the middle button opens
a dialog with a list of all diagrams in which the
target element appears. You can then double click a
diagram to open it.
• Look up element in tree: the rightmost button looks
up the target element in the tree and brings the focus
to this element.
Bonus Chapter 2: Still more various extra tips 196

File

Links to any file. Only works in output and insofar the


target file can be reached from the location of the output
file.

Help

Links to the EA Help. Makes sense only in the EA GUI, but


it does not work.

Matrix

Links to any EA Matrix Definition. Makes sense only in the


EA GUI, but it does not work.

Operation

Links to an operation of an element. Only works in output


and insofar the target operation is present in the output.

Package

Links to a package. Only works in output and insofar the


target package is present in the output.

Search

Links to any EA Search Command. Makes sense only in the


EA GUI, but it does not work.
Bonus Chapter 2: Still more various extra tips 197

Team Review

Links to a post in the Team Review. Makes sense only in


the EA GUI, but it does not work.

Website

Links to any website or webpage. When generating html


output, it depends on the browser and its settings if the
target website can be opened in the frame.

Trick 9: Operations as activities

Analysts add operations to classes to document their be-


haviour. For example, I have the class “PublicityCalculator”
that will store data about the publicity that appears in
Vinimble. Some of its operations are intended to calculate
the ROI and to estimate the total printing costs of the
magazine.
Bonus Chapter 2: Still more various extra tips 198

Screenshot 9-1

Now I would like to indicate visually that some of these op-


erations are linked. For example, I need the total publicity
figures to calculate the ROI for the magazine.
To achieve that, I just add an activity diagram and drag
the operations from the tree to this diagram. Enterprise
Architect will then add an Action to the diagram (and to
the model tree).
This way, I have a visual representation of the behaviour
of this operation. For instance, I could use it to graphically
represent the calculation procedure, or to link it to other
elements in the three.
Bonus Chapter 2: Still more various extra tips 199

Screenshot 9-2

When inspecting the properties of the action, you will find


an action pin tied to the action. This action pin is called
“target” and it’s behaviour links to the operation.
Starting from a diagram, I can also find out what operations
are linked to which actions. Just select the action, right click
it and choose “Find | Locate Operation in Project Browser”.
Bonus Chapter 2: Still more various extra tips 200

Screenshot 9-3

Extra tip

Roughly the same holds for attributes that belong to a class.


Only they are represented as an object instead of an action.

Trick 10: Working with working


sets

Suppose you are working on two different aspects of the


same project. Of you fulfill two different roles within the
team, so you need two “views” on your model. In that case,
you can save time with “working sets”.
A working set is a collection of diagrams, matrix profiles,
searches and items from the team review that can be
opened together.
Here is how to make a working set:
Bonus Chapter 2: Still more various extra tips 201

• open some diagrams you want to include in the


working set. (tip: if you find yourself repeatedly
opening the same diagrams, this is a good indication
you would benefit from a working set)
• click “View | Personal Information” then choose the
last tab called “Working Sets”.
• click the “Create Working Set” icon (the only one
that is active, when no working sets already exist)

Screenshot 10-1

Now you can give the working set a name (like “Business
analysis”) and indicate which diagrams should be part of
it.
Bonus Chapter 2: Still more various extra tips 202

Screenshot 10-2

Add other

The “Add Other…” button shows four options:

Screenshot 10-3

• Diagram: add any diagram from the current model


Bonus Chapter 2: Still more various extra tips 203

• Matrix profile: add a matrix profile (relationship


matrix)
• Search (see screenshot 10-3): adds a search. You can
indicate the type of search (simple, extended,…) and
the search parameter.
• Team Review: any topic in the team review window.

Using and changing existing “working


sets”

Screenshot 10-4

Once you have created a working set, you can start using it.
Right click the working set and choose one of these actions:
Bonus Chapter 2: Still more various extra tips 204

• Open working set: opens the diagrams and other


views that are part of this working set
• Create working set and Create working set from:
to create new working sets, possibly based on an
existing working set or a set of open diagrams.
• Edit: edits the current working set (to add or remove
diagrams or views)
• Copy as New: to copy the current working set, so you
can make a new one based on this
• Add Active View: if a diagram or view is currently
open that does not already belong to this working
set, this menu option becomes available to add the
diagram or view to the current working set.
• Apply when Model opens: this toggle decides if the
current working set will be opened when the model
is opened. If the toggle is on, the button becomes
green.
• Store Main Tab View History: also a toggle. When
active, captures which diagrams and views are open
when you close Enterprise Architect. Upon reopen-
ing, creates a read-only working set that contains
these diagrams and views.
• Locate in project browser (only available if the active
item is a diagram): looks up the diagram in the
project browser and puts focus on it.
• Delete Working Set Item (only available if the active
item is a diagram or a view): deletes the item from
the working set.
Bonus Chapter 3:
Building your own
toolbox
For the tricks in this chapter, we will build on trick 32 in
chapter 4.
A quick review of the steps necessary to build an elemen-
tary toolbox:

• create a package stereotyped “profile” and add a class


diagram to it
• add metaclasses, one per element or connector, add
a stereotype and change its name to the name you
want to appear in the toolbox, and draw an “Ex-
tends” relationship from the stereotype to the mas-
terclass
• save the package as a UML profile and import it via
the Resources pane (UML Profiles - right click and
choose “Import profile”)
• open the toolbox via “More tools”

Before you start reading the rest of this chapter, make sure
you know these steps by heart, since you will find yourself
repeating them over and over. Especially the export-import
steps.
Bonus Chapter 3: Building your own toolbox 206

Trick 1: the order of the elements


in the toolbox

Wouldn’t it be nice if you could determine what order the


elements in the toolbox would have, so that you can put the
most frequently used ones on top? Or such that you can put
them in some “logical” order, for example ordered by level
of abstraction?
There are two ways to determine the order of the elements
in the toolbox. The first one is the better one, since you only
have to do this once. The second is useful if you want to
play with different order options without having to import-
export the whole package over and over again.

Method one: stereotype Z-order

Every element or connector stems from a “stereotype”


element in the generating diagram. The Z-order of the
stereotypes determines in which order they are exported
and therefore, the order of the elements in the resulting
toolbox.
Adapting the Z-order is easy: take the stereotypes one by
one, starting with the element you want on top, right click
the element and choose “Z-order | send to bottom”.
Bonus Chapter 3: Building your own toolbox 207

Screenshot 1-1

Method two: the xml file

The generated xml file is nothing more than an text file


with xml markup tags. Open it with a text editor, then
manually cut and paste the element sections in the order
you want them to appear in the toolbox. Make sure you
don’t inadvertently scramble the xml code, because this
will most likely render the file invalid and you’ll have to
regenerate the file.
Bonus Chapter 3: Building your own toolbox 208

Screenshot 1-2

Trick 2: setting a default element


size

Probably you will want to deviate from the default sizes


elements get when they are created. Suppose, for example,
that we have an element that “hosts” other elements. Or
you want to visually distinguish elements based on their
shape.
It is good to know that you can include default element
sizes in the profile definition.

Screenshot 2-1
Bonus Chapter 3: Building your own toolbox 209

Setting the default size is easy if you follow these steps:

• Right-click the stereotype (“MyApplication” in this


case) and choose “Attributes…”
• For the default width of the element, add an attribute
“_sizeX” of type int and give it the default value (20,
for example). Don’t forget to save the attribute and
to press “New” when going to the next step.
• For the height of the element, add an attribute “_-
sizeY” of type int and give it the default value (100,
for example).

Screenshot 2-2
Bonus Chapter 3: Building your own toolbox 210

Regenerate the toolbox, delete it from the resources and


import it again. Any MyApplication element you now drag
from the toolbox to a diagram will have a narrow and high
appearance.

Screenshot 2-3

Trick 3: an icon for elements in the


toolbox

Once your toolbox starts to grow, you will feel the need
to have separate icons for the elements and connectors in
your toolbox.
Bonus Chapter 3: Building your own toolbox 211

Screenshot 3-1

Here is how you can include them in your toolbox.

• add the following attribute Icon: int = icon_name.bmp


to the element
• also add an attribute called “_metatype: string =
metatype name” to the element (do not worry about
this metatype for the moment, we will talk about
metatypes in a following trick)
• put a suitable file in the location of the xml file that
contains the toolbox definition.

This icon should be a 16x16 bmp file with transparant


background (RGB 192,192,192). If you make this file by
Bonus Chapter 3: Building your own toolbox 212

resizing a larger picture, pay attention to the color of the


border. It really should be transparant or a border will
show.
For example, this is a large file with a light grey background
that will turn transparant:

Screenshot 3-2

But if you resize the picture, some border pixels take a


slightly different color. Correct this in your graphic editor.
Bonus Chapter 3: Building your own toolbox 213

Screenshot 3-3

Delete the old profile, import the new and your icons
should all be set up!

Trick 4: working with metatypes

In the previous trick, I promised to tell you more about


metatypes. Time to do exactly that!
Metatypes have following advantages:
Bonus Chapter 3: Building your own toolbox 214

• Default name: new elements derived from the tool-


box element will get a new name based on the
metatype (for example, MyApplication1) instead of
the base type (for example, Object1). This will make
it easier for toolbox users to provide a useful name
for the element.
• Relationship matrix: metatypes can be used in the
relationship matrix feature (also see Trick 43). That
way, it is far easier to select the right element type
if you have multiple types derived from the same
base type. Also, the matrix output will be easier to
interpret.
• Profile image: unless you provide an element type
with a metatype, EA will not always apply the visual
properties you define for the stereotype.
• Icon: when EA creates an project browser icon for a
new element, this will be based on the icon you made
up for the element instead of the standard base type
icon (also see the previous trick).

Screenshot 4-1
Bonus Chapter 3: Building your own toolbox 215

Metatypes are not difficult to define. In fact, it is so easy


and so valuable that you should give every element you
define in your own toolboxes their own metatype, unless
you have very good reasons not to do so.
Here is how to define a metatype:

• Add an attribute of type “string” named “_metatype”


and with initial value the name of the metatype (for
example, MyApplication)
• Just make sure the name of the metatype does not
conflict with an already existing name (such as
Object, Process and other names that are already
present in the standard EA toolboxes). If you still do
so, some of the metatype features will not work.
• Regenerate and reimport the toolbox as usual. The
metatype should be all in place now!

Trick 5: creating autohiding


connectors

Remember the “implicit” relationships of trick 18? The idea


was that diagrams are simpler to read when relationships
are hidden, or at least shown implicitly, by nesting elements
inside each other.
It’s perfectly possible to have relationships like these in
your own toolbox. Just derive the relationship from any of
these two base class connectors:
Bonus Chapter 3: Building your own toolbox 216

• composition: “composing” means relating elements


such that the composition is a thing on its own, but
the composing elements cannot exist without their
composition. Like the departments of an organiza-
tion, for example. A department only exists when it
is part of an organization: it cannot exist on its own.
UML compositions are shown as black diamonds
attached to the parent element.
• aggregation: “aggregating” is a more general and
“looser” way of relating elements. The aggregated
elements make sense on their own. Like the peo-
ple who form a department: even without the de-
partment, they still exist. Aggregated elements are
shown as unfilled diamonds attached to the parent.
Bonus Chapter 3: Building your own toolbox 217

Screenshot 5-1

Add a base class with the core connector “composition”


checked and a stereotype “MyComposition” that extends
it.

Screenshot 5-2

This is the result if you regenerate the toolbox. The diagram


shows the relationships explicitely.
Bonus Chapter 3: Building your own toolbox 218

Screenshot 5-3

But when you enlarge the parent object, the composition


and the aggregation disappear.
Bonus Chapter 3: Building your own toolbox 219

Screenshot 5-4

Trick 6: how to create an arrow


with shapescripting

Probably you want your own elements and connectors


to deviate visually from the standard EA elements and
connectors. One way of achieving that is explained in trick
35, about stereotypes.
There’s another way of doing that, however. A more pow-
erful way since it allows you to draw almost anything
you could want. That’s when shapescripting comes into
play. Some of the next tips will cover more aspects of
shapescripting, but this tip teaches you the basics.
Bonus Chapter 3: Building your own toolbox 220

Adding a shapescript to a connector

First, add a metaclass Informationflow to the toolbox dia-


gram. Also add two stereotypes: one for an open arrow and
one for a closed arrow.

Screenshot 6-1

Now add an attribute “_image” to each stereotype. Click


the three dotted “initial value” button. The shapescripting
window appears.
Bonus Chapter 3: Building your own toolbox 221

Screenshot 6-2

Click “refresh” to preview the shape, click “next shape” to


go to the next subshape that belongs to this shapescript.
If you have made an error in the script, clicking “refresh”
will give you an error message with the line number of the
error.
For example, if you type “shaep” instead of “shape”, EA will
give this error message:

1 Error parsing ShapeScript: There was an error pa\


2 rsing on line 1: Unexpected symbol: shaep

Code for an open arrow


Bonus Chapter 3: Building your own toolbox 222

1 shape main
2 {
3 // draw a dashed line
4 noshadow=true;
5 setlinestyle("SOLID");
6 hidelabel("MiddleBottomLabel");
7 moveto(0,0);
8 lineto(100,0);
9 }
10
11 shape target
12 {
13 // draw an arrowhead at the target end
14 rotatable = true;
15 noshadow=true;
16 moveto(0,0);
17 lineto(6,4);
18 moveto(0,0);
19 lineto(6,-4);
20 }

Code for a closed arrow


Bonus Chapter 3: Building your own toolbox 223

1 shape main
2 {
3 // draw a dashed line
4 noshadow=true;
5 setlinestyle("DASH");
6 moveto(0,0);
7 lineto(100,0);
8 }
9
10 shape target
11 {
12 // draw an arrowhead at the target end
13 rotatable = true;
14 startpath();
15 moveto(0,0);
16 lineto(16,6);
17 lineto(16,-6);
18 endpath();
19 fillandstrokepath();
20 }

This is the result in the toolbox diagram.


Bonus Chapter 3: Building your own toolbox 224

Screenshot 6-3

Regenerate the toolbox and reupload it in the resources


panel. This is what you get when you use the connectors
described above.

Screenshot 6-4

Trick 7: the shapescripting canvas

If you want to work with shapescripts effectively, you will


benefit from knowing the shapescripting canvas.
Bonus Chapter 3: Building your own toolbox 225

Screenshot 7-1

For drawing most elements, the bottom right part is where


the action happens: when drawing for example lineto(X,Y),
both X and Y are positive.
For connectors, you will often need the topright part of the
canvas too. Y then gets a negative value, like in the example
below. We will draw a giant arrowhead.
Bonus Chapter 3: Building your own toolbox 226

Screenshot 7-2

This is the shapescripting window in action.


Bonus Chapter 3: Building your own toolbox 227

Screenshot 7-3

Code for a giant closed arrow

1 shape main
2 {
3 // draw a line
4 noshadow=true;
5 moveto(0,0);
6 lineto(100,0);
7 }
8
9 shape target
10 {
Bonus Chapter 3: Building your own toolbox 228

11 // draw a giant arrowhead @ target end


12 rotatable = true;
13 startpath();
14 moveto(0,0);
15 lineto(40,30);
16 lineto(40,-30);
17 endpath();
18 fillandstrokepath();
19 }

And this is the result when applied in a diagram:

Screenshot 7-4

Using the topleft and bottomleft


quadrants of the shapescripting canvas

In rare cases, you might need the left side of the quadrant.
The shape, mostly a connector, will then overlap the ele-
ment it points to. This hourglass shape is an example.

Code for an hourglass shaped connector


arrow
Bonus Chapter 3: Building your own toolbox 229

1 shape main
2 {
3 // draw a line
4 noshadow=true;
5 moveto(0,0);
6 lineto(100,0);
7 }
8 shape target
9 {
10 // draw an hourglass @ target end
11 rotatable = true;
12 startpath();
13 moveto(0,0);
14 lineto(10,10);
15 lineto(-10,-10);
16 lineto(10,-10);
17 lineto(-10,10);
18 lineto(10,10);
19 endpath();
20 fillandstrokepath();
21 }

This is what it looks like on a diagram. As you can see, the


connector overlaps with the element it is attached to.
Bonus Chapter 3: Building your own toolbox 230

Screenshot 7-5

If you want to know which line is which,


just comment it out by putting // in front of
it and retest the shape.

Trick 8: some shapescripting


limitations

Shapescripting is a wonderful way of developing your own


toolbox, but it has its limitations and it is good to know
them up front, so you don’t spend hours to “debug” a script
that is actually executing to specifications.
In my experience, these are the limitations frequently met
in practice:

• initialisation attributes must come in front of the


script, before the drawing commands
• you cannot specify the font and the font color of text
used in shapescripts
Bonus Chapter 3: Building your own toolbox 231

Initialisation attributes up front

There are three commands that specify how the shape


should be drawn:

• noshadow: if true, the shape is drawn without a


shadow. The default value is “false”.
• h_align: specifies where label text should be put
horizontally. Valid values: left, center or right.
• v_align: specifies where label text should be put
vertically. Valid values: top, center or bottom.

An example script shows what I mean:

1 shape main
2 {
3 noshadow = "true";
4 h_align = "center";
5 v_align = "top";
6 rectangle(0,0,100,100);
7 println(#NAME#);
8 }

This is the result when applied to the existing application


shapes:
Bonus Chapter 3: Building your own toolbox 232

Screenshot 8-1

What to do if you want some text, let’s say the name of the
shape, to appear on the bottom of the shape, while another
label, such as the stereotype, is put on top? Then you will
have to work with subshapes. An example script shows you
the way:

1 shape main {
2 rectangle(0,0,100,100);
3 addsubshape("stereotypeshape", 100, 80);
4 addsubshape("nameshape", 100, 80);
5
6 shape stereotypeshape {
7 h_align = "center";
8 println("#stereotype#");
9 }
10
11 shape nameshape {
12 h_align = "center";
13 println("#name#");
14 }
15 }

This is the result:


Bonus Chapter 3: Building your own toolbox 233

Screenshot 8-2

Trick 9: hiding connector labels

Connector labels often make diagrams hard to read. By


default, some labels like stereotype names are shown. How
to hide them?
There is a shapescripting command that hides the labels:
hidelabel(“LabelName”).
These are the labels you can hide:

• middletoplabel
• middlebottomlabel
• lefttoplabel
• leftbottomlabel
• righttoplabel
• rightbottomlabel

Each of these labels are detached, meaning you can change


their position on the diagram. Their default position is
described by their name.
Bonus Chapter 3: Building your own toolbox 234

Screenshot 9-1

How can you know which labels are visible? Make a


diagram where the connector appears. Right click the con-
nector and choose “Visibility | Label Visibility…”. A dialog
appears:
Bonus Chapter 3: Building your own toolbox 235

Screenshot 9-2

Let’s visit our hourglass shaped connector again and try to


hide the MyHourglass stereotype label:

Code for an hourglass shaped connector


arrow without the stereotype label

1 shape main
2 {
3 // draw a line
4 noshadow=true;
5 hidelabel("MiddleBottomLabel");
6 moveto(0,0);
7 lineto(100,0);
8
9 }
10 shape target
Bonus Chapter 3: Building your own toolbox 236

11 {
12 // draw an hourglass @ target end
13 rotatable = true;
14 startpath();
15 moveto(0,0);
16 lineto(10,10);
17 lineto(-10,-10);
18 lineto(10,-10);
19 lineto(-10,10);
20 lineto(10,10);
21 endpath();
22 fillandstrokepath();
23 }

Remember to put this drawing command after the initali-


sation attribute “noshadow”.
The result is this.

Screenshot 9-3

Even when you try to make the label visible by checking


the visibility checkbox, it will not reappear: the shapescript
takes precedence.
Bonus Chapter 3: Building your own toolbox 237

Notes

• There is a drawing command “showlabel” with com-


parable use but the opposite effect.
• Depending on the version of EA, it is important
to write the label names exactly as shown in the
example (capital first letter for each word)

Trick 10: what to do when an MDG


Technology is lost

MDG Technologies (Model Driven Generation) are a fan-


tastic way to customize Enterprise Architect to your needs.
In short, you create your own package that contains:

• several profiles, for example, the elements and con-


nectors we created in this bonus chapter
• a toolbox that hosts these profiles, so you can easily
use them on your diagrams
• one or more diagram types tied to the toolbox, so
that the right toolbox opens every time you create a
diagram of this type.

The MDG Wizard helps you to create an MDG technology


that contains these items (and possibly more). You can find
it here: Tools | Generate MDG Technology file”. The wizard
will result in an MTS file, that you import via “Tools | MDG
Technology Import”.
Bonus Chapter 3: Building your own toolbox 238

Screenshot 10-1

From time to time, you will see that the full MDG technol-
ogy gets lost. It appears to be beyond repair. Or is it?
This little trick seems to work. Open the UML Types dialog
(“Settings | UML Types…”). Then check the stereotypes you
created. Probably you will see that the shapescripts got de-
selected. Reselect them, then regenerate the MTS file with
the MDG Technology wizard and the MDG technology will
work again!
Bonus Chapter 3: Building your own toolbox 239

Screenshot 10-2

Note

Working with MDG Technologies and creating own dia-


gram types, toolboxes and the like will be far easier in EA
Version 10.x
When this book gets updated once version 10 is released,
we will talk about the new functionality in more detail.
Overview of shortcuts
Copy the shortcut page, cut out the rectangle, fold along the
vertical lines and glue along the dotted line so you have a
tall pyramid with three sides. Put it next to your computer
and use it until you know the shortcuts by heart. Don’t
forget to make a copy for your colleagues too!
This file is available for download at the website³.
³http://www.aboriginemundi.com/index.php/2010/12/shortcuts-for-
enterprise-architect-free-download/
Overview of shortcuts 241

shortcuts

S-ar putea să vă placă și