Hi,
I'm running into the same problem time to time, with no luck with the solution yet. The situation is rather simple in terms of EA customization: In a profile, I introduced a stereotype for activities, and defined a couple of tagged values for the sterotype. Let's say the stereotype is called
stereo and the tagged value is called
tvA1,
tvA2 and
tvB1 with a string type.
tvA1 and
tvA2 belongs to the tag group
A, while
tvB1 belongs to tag group
B.
When using the profile in a test project, I've tried to turn on displaying tags both the diagram containing an activity of that stereotype, as well as turning on visibility in
Feature and Compartment Visibility. None of the options reveled my tags. I remembered this may be caused by the fact that activities redraws the rectangle of the
Class metaclass to a rounded rectangle.
Then I've tried a couple of shape scripts:
[*] A script which calls DrawNativeShape() in
shape main, and then calls
SetCompartmentName and
AppendCompartmentText. Nothing is displayed.
[*] A script which creates a subshape and adds the subshape in shape main. The subshape uses
print/println/printwrapped to display the tagged values. The text was overflowing the activity.
[*] A script like above, without calling
DrawNativeShape(). I've recreated the rounded rectangle. When I set it to the size of 100x100, the text was overflowing. When I set it to the size of 160x160, and used
moveto and
lineto to draw a horizontal line in the middle with a width of 160, it was overflowing on the left and right side of the activity (with the overflown segments suming cc 100 pixels or whatever the measurement unit is).
[*] A script which calls
DrawNativeShape() and then adds the tagged values using simple print/println/printwrapped. This works, the results, however, looks bad: I can not make group headings (A and B) bold, so the results is not really intelligible. In addition, I found resizing does not work properly: while the activitiy is displayed so that text fits it, when I try to select it, the selection handlers reveal a much smaller rectangle.
[/list]
Two of my attempts:
shape main
{
h_align = "center";
editablefield = "name";
roundrect(0,0,160,160,30,30);
printwrapped("#name#");
SetCompartmentName("My Tag Section");
AppendCompartmentText("Hello World");
}
This script did not work. The result was the same if I called DrawNativeShape instead of drawing it myself.
The other type of script was:
shape main
{
h_align = "center";
editablefield = "name";
roundrect(0,0,160,160,30,30);
printwrapped("#name#");
AddSubShape("tagA", 160, 60);
AddSubShape("tagB", 160, 60);
shape tagA {
h_align = "left";
v_align= "bottom";
moveto(0,50);
lineto(100,50);
printwrapped("Tags A");
printwrapped("Tag 1: #TAG:tvA1#");
printwrapped("Tag 2: #TAG:tvA2#");
}
shape tagB {
h_align = "left";
v_align= "bottom";
moveto(0,110);
lineto(160,110);
printwrapped("Tags B");
printwrapped("Tag 1: #TAG:tvB1#");
}
}
This neither worked.
Please note that I have edited these scripts for this forum, and any syntax error I might have introduced are not present in my actual code in EA. :)
Could anyone help in creating a shape script which displays tagged values on activities? It was great if I could add them to multiple compartments.
Thanks for reading.