Usage of a computed color on a diagram background doesn't work in every case when the RGB value expressions of the computed color make use of the diagram variable.
Most of the time, the diagram variable is set, but it seems it is due to a side effect. There is no guarantee that the value is set to the active diagram. In some conditions, the variable is set to another diagram. When the Sirius session has just been opened before opening a diagram, the diagram variable is not set at all.
This workaround would not be necessary if Sirius were handling the case.
Attached to this ticket is a sample project to experience this limitation on ObeoDesigner-Community-11.8.
org.obeonetwork.safran-1111.design.zip contains a Viewpoint Specification Project defining a diagram with a computed color for the background, whose value is computed from the diagram contents.
DiagramContentDependentBackgroundColorTest.zip contains a test project ready to use.
When opening the representation for the first time, the diagram shows an intense blue background, which is not normal.
Adding or removing an element on the diagram has the effect of declaring the diagram variable and makes the control of the background color work as expected.
The more elements the diagram contains, the more intense the blue color is. The background color should be white when no elements are present on the diagram.
Close and reopen the modeling project to reproduce the wrong behavior.
Usage of a computed color on a diagram background doesn't work in every case when the RGB value expressions of the computed color make use of the diagram variable.
Most of the time, the diagram variable is set, but it seems it is due to a side effect. There is no guarantee that the value is set to the active diagram. In some conditions, the variable is set to another diagram. When the Sirius session has just been opened before opening a diagram, the diagram variable is not set at all.
The following workaround has been done in Information System Designer : https://github.com/ObeoNetwork/InformationSystem/commit/0876af41c05fc1abfd5a5c155cfc7ae82611b69d to override the
DDiagramEditPart
to make the diagram variable set in theconfigureBackground
method.This workaround would not be necessary if Sirius were handling the case.
Attached to this ticket is a sample project to experience this limitation on ObeoDesigner-Community-11.8.
org.obeonetwork.safran-1111.design.zip
contains a Viewpoint Specification Project defining a diagram with a computed color for the background, whose value is computed from the diagram contents.DiagramContentDependentBackgroundColorTest.zip
contains a test project ready to use.When opening the representation for the first time, the diagram shows an intense blue background, which is not normal. Adding or removing an element on the diagram has the effect of declaring the diagram variable and makes the control of the background color work as expected. The more elements the diagram contains, the more intense the blue color is. The background color should be white when no elements are present on the diagram.
Close and reopen the modeling project to reproduce the wrong behavior.