Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
com Page1
TipsforUsingaVisioTemplateforUML2.2
ThisdocumentcontainstipsandsuggestionsforcreatingUML2.2diagramsusingthestencilsandtemplatesavailableat
http://softwarestencils.com.ItispossibletodrawallUMLsymbolsanddiagramsspecifiedintheOMGdocument
formal/20090202,OMGUnifiedModelingLanguage(OMGUML),Superstructure,version2.2,availableat
http://www.omg.org/spec/UML/2.2/.
Thispdffileisforreferenceonly.Thelatestversionofthisdocumentisathttp://softwarestencils.com.
Macros
Thestencilsandtemplatedonotcontainmacros.IfVisioasksyouwhetheryouwanttoenableordisablemacros,disable
them.
ImportantTips
ThesetipsareusefulespeciallyforthosewhoarenewtoVisio.Pleasereadthisdocumentbeforeaskingmequestions.
However,Iamalwaysinterestedinyourfeedback,suggestionsandcomments.Ifyouhaveadditionaltipsthatcouldbe
includedinthisdocumentpleasecontactme,PavelHruby,atph@phruby.com.
Startbyopeningthetemplate"UML2.2Template".Thetemplatedefines
allrequiredVisiosettings,andopensautomaticallytwostencils:"UML2.2
Symbols",and"UMLIconsandStereotypes".
Thetemplateandthestencilsaredesignedtoworktogether.When
startingcreatinganewdiagramusing"New/GettingStarted",lookfor
thistemplateicon.
Ifforsomereason,youopenfirstanothertemplate(suchasablank
template,ortheUMLModelDiagramtemplatebuiltinVisio)andthen
opentheUML2.2stencilsfromthisothertemplate,youneedtochange
somesettings.
ClickTools,Snap&GlueandplacecheckmarksintheGlueandShape
Verticescheckboxes.
WiththesesettingswillVisioautomaticallycreateconnectionpointson
Lifelinesinsequencediagrams,whenyouconnectMessages,Fragments,
orInteractionOccurrencestoLifelines.
InVisio2000andVisio5,moreover,inTools,Options,Advancedtab,place
checkmarksintheEnableMicrosoftBasicforApplications,LoadVisual
BasicforApplicationsfromtext,andenableAutomationEventscheck
boxes.
TipsforusingaVisiotemplateforUML2.2,availableathttp://softwarestencils.com Page2
Whenyourightclickmostoftheshapes,ausefulmenu
appears.
Youcanopenadditionalcompartmentsofaclass,object,package,part,
component,node,state,andusecase.Todoso,clickthecontrolonthe
bottomlineoftheshapeanddragitup.
Youcanedittextintheadditionalcompartments.Toinsert
newtext,selecttheshapeandclickonceontheadditional
compartment.ItturnsgrayinVisio4.15.0andinVisio
20002002itchangesitscornerstoalightgreensymbolthat
lookslike(x).Then,typeinthetext.
Toeditexistingtext,selecttheadditionalcompartmentand
pressF2,orselectTextTool(clickiconAonthemenu
bar),orrightclicktheselectedcompartmentandselectEdit
Textfromthemenu.EditTextmenuisavailableonlyin
Visio2000andVisio2002.
Toaddassociationrolesandcardinalities (multiplicities)toassociations,
selecttheshapeandclickonceontheyellowcontrol(greeninVisio2000).
Itselectstheunderlyingtextbox,whichturnsgreen.Then,typetextin.To
editexistingtext,clickonceontheyellowcontrol,andpressF2,orselect
TextToolfromthemenu.
TextoftheLabelshapecanbemovedtotherightorleftsideoftheyellow
control(greeninVisio2000).SelecttheLabelshape,andClickAlignRight
buttononFormattingToolbartomovetexttotheleftsideofthecontrol.
AlignLeftmovestextright,andAligncentermovesthecontroltothe
middleofthetext.
TipsforusingaVisiotemplateforUML2.2,availableathttp://softwarestencils.com Page3
Inthebottomleftcornerofmosttwodimensionalshapesthereisapool
ofconnectionpointsthatyoucanmovearoundusingcontrols.For
example,youcanmovethemneartoclassoperationsorattributes,and
thenconnectRelationshipsorNotestothem.
Thereisanalternativewayofaddingconnectionpointstoashapeside.
IfyourightclicktheshapeRegion/Partition,youcanturnitintoa
ConnectionPointsLine,whichisaninvisiblelinecontaining80
connectionpoints.
YoucangluetheRegion/Partitiontoanothershapeandinthisway
increasethenumberofconnectionpointsonitssides.
TheStateLifelineinTimingDiagramcanbemodifiedbymovingthe
controlsattherightside.
InVisio2003andearlierversions,youcaneasilychangeaclasstoan
object,andviceversa,bychangingitstextstylefrom"UMClassifier"to
"UMInstance".Inthisway,youcaneasilycreateacommunicationdiagram
fromaclassdiagrambycopyingandpastingtheclassdiagramandthen
selectingalltheclassesandchangingtheirtextstyle.
InVisio2007,Microsofthasdisablesstyles,unlessyourunadeveloper
mode.Howtoenabledevelopermode,pleasereadahelpiteminVisio
2007Whathappenedtostyles?
TipsforusingaVisiotemplateforUML2.2,availableathttp://softwarestencils.com Page4
ThestencilcontainsbothUML2.2 shapesandnonnormativeshapes,
whicharetheshapesnotdefinedinthestandard,butusedinsomeUML
booksandpapers.
Thenonnormativeshapeoptionsarealwaysatthebottomoftheright
clickmenus;thenonnormativestereotypesandiconsareplacedafterthe
iconNonnormativeUML.
UnlessyouhaveaverygoodknowledgeofUML,dontusethenon
normativeshapes.Rather,trytofindthecorrectUMLwaytoexpressyour
softwaredesign.
StereotypesareinthestencilforVisio2000andearlierversions
availablefromtherightclickmenu.
InVisio2002andlaterversions,Microsoftforsecurityreasonsremoved
thefunctionalitythatmadethispossible,therefore,pleaseinsert
stereotypesastext.
YoucansettheautocorrectoptionsofMicrosoftOfficetoreplace<<by
and>>by,tomakeiteasier.Todoso,pleaseselectVisiomenuitem
Tools/AutoCorrectOptions.Thecharactersandareaccessiblefrom
CharacterMapinWindows.CharacterMapcanusuallybeopenedby
selectingAllPrograms/Accessories/SystemTools/CharacterMap.
TipsforusingaVisiotemplateforUML2.2,availableathttp://softwarestencils.com Page5
InformationforAdvancedUsers
Thestencilandtemplatecontainthefollowingstyles:
o UMNormal:basedonstyleNormal,withArial8pt.regularfont,andLineweight1
o UMConnector(textstyle):basedonUMNormal,buttextisalignedleft
o UMClassifier(textstyle):basedonUMNormal,buttextisbold,notextbackground
o UMInstance(textstyle):basedonUMNormal,buttextisunderlined,notextbackground
Thecontrolsusedfortextpositioningensurethataconstantdistanceiskeptbetweenthetextandtheclosestlineend,
orthetextandtheclosestsideorsidesofatwodimensionalshape.Likewise,ifthetextispositionedinthemiddleof
theshape,itwillremaininthemiddleregardlessofhowyouchangetheshapesize.
ForVisio5.0andVisio4.1:VisioautomaticallycreatesnewconnectionpointsonObjectlifelinesandActivationswhen
youconnectmessagestothem.(Ifitdoesnt,clickTools,Snap&GlueandplacecheckmarksintheGlueandShape
Verticescheckboxes.)Ifyoulaterdisconnecttheobjectlifelineandthemessage,Visio5.0andearlierversionsdonot
removetheconnectionpointsautomatically.Ifyoudontwanttoseetheextraconnectionpoints,youcanclickView
anddeselectConnectionPoints.Alternatively,youcandeletethemmanuallybyselectingConnectionPointTool.You
canthenselecttheextraconnectionpoint,whichturnsmagenta,andpresstheDeletekey.Visio2000removesthe
connectionpointsautomatically.
ForVisio5.0:TheroutableconnectorintheVisio5.0stencilsometimeschangesitspathunexpectedly,forexample,
whenoneendoftheconnectorisinsideandtheotherendisoutsideasymbol,suchaspackageandclass.Visiofixed
thisprobleminVisio2000andlaterversionsbutnotinVisio5.0.Therefore,ifyouuseVisio5.0,andtheroutable
connectorwouldntbehaveasyouexpect,Irecommendthatyouusetheangledorstraightconnectors
DetailsabouttheStencilDesign
Somerelatedshapeshavethesamedesignanddifferonlyintheirinitialstates.Thismeansthatifyouredesignone,
youmustredesignall.Thefollowingshapesarehavethesameorsimilardesign:
o StraightRelationshipandRoutableRelationshiparethesameshape
o Package,Class,Object,andPartarethesameshape
o Activity/EventandObject/Signalarethesameshape
o Region/PartitionandFork/JoinNodearethesameshape
o PseudostateandFlow/Activity/Initial/Finalarealmostthesame;theydifferonlyintherightclickmenus.
o FrameandInteractionOccurrencearealmostthesame;doubleclickonFrameeditsthetextofthepentagon
inupperleftcorner,anddoubleclickonInteractionOccurrenceeditsthetextoftheshapebody.From
developerperspective,FramehasdisabledEditGroupText,andControl3isinvisible.
Althoughthestencilisdesignedtoallowmaximaldrawingfreedom,thereisasmallrestrictiononformattingthe
textintheadditionalcompartmentsofPackage,Class,Object,Part,State,Node,ComponentandUseCase.Ifyou
formatthetextintheadditionalcompartmentsusinghorizontalalignment=centerandverticalalignment=middle,
thefirstcharactercannotbeunderlinedortypedinboldface.(Itcan,however,beboldandunderlined).Ifyouchoose
oneofthesetwoformatsforthefirstcharacter,theformatautomaticallyswitchestothedefaultformatforthis
compartment,whichishorizontalalignment=left,verticalalignment=top,andregularfont.Thesetwoformatsare
rarelyused.Youmightcomeacrossthissituationpracticallyonlyifyouapplyyourowntextstylestotheshape.