Dynamic Property Overriders

Description

The pre-defined figure types (ClassFigures, AttributeFigures, ReferenceFigures, RichAttributeFigures and RichReferenceFigures) allows to statically adjust several appearance properties like colors, font style, and so on.

Once these properties have been defined, it is applied on every figure instance. For example, on the school sample, if the background color of the student's ClassFigure has been set to green, all the students appear as green nodes on the diagram. In some cases, one may need several apperance properties to become dynamic.

For example, in the school sample, we may want to build dynamically the body background color of the students with their age. Let's imagine we want to use gray colors indexed on the age of the student. this can be done by doing the following actions :

  1. Add a Dynamic Property Overrider to the student's ClassFigure
  2. Select the bodyBackgroundColor in the Property To Override entry
  3. Enter "newColor(256 - age*2, 256 - age*2, 256 - age*2)" in the Overriding Expression entry
You should get the following result (standard diagram on the left, diagram with dynamic colors on the right where you can notice the students node colors) :

Most of the figure's appearance properties are overridable. Here is a complete list of them :

Figure typeOverridable properties
ClassFigurelabelStyle, headerBackgroundColor, bodyBackgroundColor
AttributeFigurelabelStyle
RichAttributeFigurelabelStyle
ReferenceFiguretargetArrowType, sourceArrowType, customTargetArrow, customSourceArrow, color, style, minimumEdgeLength
RichReferenceFiguretargetArrowType, sourceArrowType, customTargetArrow, customSourceArrow, color, style, minimumEdgeLength, sourceLabelStyle, standardLabelStyle, targetLabelStyle, labelDistance, labelAngle

Properties

The DynamicPropertyOverrider accepts the following properties :

CategoryNameDescriptionDefault literal
- enabledA boolean indicating if the dynamic property overrider is enabled or nottrue
overridingExpressionThe OCL expression to be used to retrieve the overriding property value 
propertyToOverrideThe figure's appearance property to override