May 072014
 

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.

Requirement

Figure 1. Id and Text properties are visible on shape

Requirement specification4

Figure 2. More properties are visible in specification

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 Appliedtrue, 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.

Figure 3. Owner and ID properties have Multiplicity and Default Value properties specified to be shown on shape by default

Figure 3. Owner and ID properties have Multiplicity and Default Value properties specified to be shown on shape by default

When the custom requirement is created only the ID and Owner properties are shown on the shape.

Figure 4. ID and Owner properties are shown on shape by default

Figure 4. ID and Owner properties are shown on shape by default

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.

Figure 5. ID property with > applied

Figure 5. ID property with <> applied

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.

Figure 6. Only Owner property is shown on shape

Figure 6. Only Owner property is shown on shape

Figure 7. All properties can be specified in custom requirement specification

Figure 7. All properties can be specified in custom requirement specification

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.

5.00 avg. rating (99% score) - 3 votes

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

Time limit is exhausted. Please reload CAPTCHA.