Search code examples
umlvisibilityvisioclass-diagram

Microsoft Visio Class Diagram - Package Visibility


I am creating a class diagram in Microsoft Visio 2010 for a Java Program. I would like to set an operation's visibility as being package/default, but that is not an option. The only choices are public, protected, or private.

enter image description here

I realize this isn't a typical visibility option for most programming languages, so Visio most likely doesn't support it. However, is there a way that I can define a custom visibility option for my diagram?


Edit:

BobRodes got it right. If anyone is interested in how to do this, I will explain below. Please note that I am using Visio 2010. If you have a different version, the process might be slightly different.

  1. Click on the part of the diagram that you want to edit. In my case, I needed to change the visibility of the operations, so I clicked on that section twice. Once to select the class, and again to select the operation section.
  2. Right click on the selected section, and click 'Show ShapeSheet'. This should open a separate dialog with a bunch of properties you can mess with.
  3. Scroll down to the section entitled 'Protection', and change the value of 'LockTextEdit' to 0. You may now close the ShapeSheet dialog.
  4. With the same section still selected, click on 'Text' at the top of the page. This can be found on the Ribbon under Home->Tools.
  5. This will put the selected section into edit mode and you may what text is displayed.

** Important ** If you make any changes to the shape properties such as adding/changing a method or variable, this will rewrite the shape and remove any custom changes that you have made.


Solution

  • Package visibility in Java corresponds (pretty much) to internal visibility in C# (or Friend in VB). Visio doesn't support this level of visibility as you may see here. Now, UML uses a ~ in front of an attribute or method to denote package visibility. If all you care about is the diagram (and I find that that is the mindset I use when using Visio to create UML diagrams), you can set it to private, and overwrite the - with a ~.