Book a Demo

Author Topic: Can I show connector tagged-values on a diagram?  (Read 3466 times)

dr_shorthair

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Can I show connector tagged-values on a diagram?
« on: November 24, 2008, 12:45:16 pm »
By judicious use of linked diagram notes, and application of diagram settings it is possible to get most model information to show automatically on a diagram. But I am stumped on this one:

we use tagged values on association-ends and on attributes, but I can't find how to get them displayed on a diagram. Any suggestions?

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Can I show connector tagged-values on a diagra
« Reply #1 on: November 24, 2008, 06:30:23 pm »
I faced this problem some months ago for the following reason:

EA offers no way to control the sorting of links on an element. So when I want to generate code from associations (as opposed to attributes, whose sort order can be modified), I have no means of controlling the order in which the properties represented by associations are processed during code generation, although this can be important, e.g. when creating a complex serializable object model (with the need to deserialize dependencies first).

After some discussion in this forum and pestering Sparx support for a week or so I settled with this solution:

I gave a stereotype a tagged value "SortIndex" and this shape script:

Code: [Select]
label middlebottomlabel
{
      println("<#STEREOTYPE#>");
      println("SortIndex=#TAG:SortIndex#");
}


All attempts to print the tagged value directly led to strange results, but this one works. It replaces the label which by default displays the stereotype to display the tagged value as well.

Of course this is hardly documented. But then many shape script techniques aren't.