Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: robbierzzz on May 11, 2009, 09:38:22 pm
-
Hi there,
I'm searching for a feature for conditional formatting in EA. I want to give certain elements a kind of 'label' (maybe Tagged Value fits in this context?) and then give these elements a certain background color. This feature would spare me loads of clicks ;). Does anyone know wheter this feature is covered by EA?
Thanks in advance!
-
Try a shape script. You would need to stereotype the elements, but the formatting should work.
-
Yes I also do something like this...
My shapscript for UC's checks for the value of the UC['s tagged field and then sets the Background color based on the value (e.g., Red, Yellow, Green)
Here is a sciprt fragement that might help you... David
================================
// Author - David Rains ([email protected]) Copyright 2009
// Release:
//
// Script Version: 1.0
// Script's Purpose: ... Set background color based on precision values...
Shape Main
{
//Default Property Initializations
noShadow = "false";
dockable = "none";
//Stereotyped Derived Settings
//Adorment - FillColorByPrecision
//check for Any Missing Precision FlaggedValues
If(hastag("Precision"))
{
IF(hastag("PrecisionTarget"))
{
//Check if Precison is N/A
if(hastag("PrecisionTarget","N/A"))
{
SetFillColor(255,255,255); //RGB - White
}
if(hastag("Precision","N/A"))
{
SetFillColor(255,255,255); //RGB - White
}
//Determine Fill Color by Precision
if(hastag("Precision","0"))
{
SetFillColor(255,0,0); //RGB - DarkRed
}
if(hastag("Precision","1"))
{
SetFillColor(255,128,128); //RGB - LightRed
}
if(hastag("Precision","2"))
{
SetFillColor(255,255,0); //RGB - LightYellow
}
if(hastag("Precision","3"))
{
//If at 3 and Informal, then target met so DarkGreen
if(hastag("PrecisionTarget","Informal"))
{
SetFillColor(0,128,0); //RGB - DarkGreen
}
//If at 3 and Formal, then target not yet met so LightGreen
if(hastag("PrecisionTarget","Formal"))
{
SetFillColor(128,255,0); //RGB - DarkGreen
}
}
if(hastag("Precision","4"))
{
SetFillColor(0,128,0); //RGB - DarkGreen
}
}
}
//Draw Shape
DrawNativeShape();
//Stereotyped Static Adornments
}
================================
-
This isn't what you've asked for, but it may be helpful.
There is a toolbar called the format tool. It applies formatting to the current object on a single diagram only. But it also allows you to copy styles from one object to another. Even saving named styles that you can re-use.
If what you are wanting is the coloring, this may be the easiest way to do that.