You can choose which custom properties are shown on an element shape via the “Edit Compartment” dialog. Perhaps you may wonder if there is a way to set the specific tag values to always display for a particular (stereotyped) element type by default.
An example of such a case is with a requirements element which has Id and Text properties visible by default. Other custom properties such as Risk, Source, and Verify Method are visible in the element specification only.
It’s not a surprise that there are a few different solutions available in MagicDraw to achieve this
1. Two Stereotypes and “Show Properties When Not Applied” Usage
This is the actual case we have with requirement element. There are two stereotypes. The first one is <<Requirement>> with tag definition Id and Text. All requirements have this stereotype applied by default.
The default symbol property of the requirement Show Tagged Values value is In Compartment. This results in the above behavior where the Id and Text properties are visible on the requirement shape.
For other properties, another stereotype, <<extendedRequirement>> exists. It has the tag definitions Risk, Source, and Verify Method. This stereotype has the DSL customization created with the properties Show Properties When Not Applied – true, and Show Properties When Not Applied Limited By Element Type – Requirement. For more about DSL see UML Profiling and DSL User Guide.
The result is that extended requirements properties are visible by default only in requirement specification, and become visible on the shape once the value of the property is specified.
2. [1] Multiplicity and Default Value Usage
Let’s say you have only one stereotype <<customRequirement>> with multiple tag definitions, from which only ID and Owner shall be visible on shape by default.
To achieve this:
1. Set tag definition Multiplicity value to 1 or to 1..*
2. Set the Default Value property for tag definition. Space character can be used as value also.
When the custom requirement is created only the ID and Owner properties are shown on the shape.
Other custom properties will appear on shape once the values are specified.
3. Hidden Stereotype Usage
In case you do not want to show specific tags, even if they have values assigned, apply the <<InvisibleStereotype>> for the particular tag definition.
When custom requirement will be created such property (in our case this is ID property) it will not be shown on the shape regardless of whether a value is specified or not.
In Summary, we have three methods to control, which cause properties to be shown on shapes by default. The first two methods are used when you need properties to show on shape if the value is created for them. Use the third in the case where you do not want to show specific custom properties, even if they have values assigned.