Book a Demo

Author Topic: Display tagged value content  (Read 6166 times)

Thomas H.

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Display tagged value content
« on: November 27, 2008, 09:35:50 pm »
Is it possible to modify the shape script for a stereotyped association so that the content of a tagged value is shown?

Currently it is possible to show the following standard attributes in an editable field: alias, name, note, stereotype

Example:
Stereotype "MyAssociation" extends Metaclass "Association" with the
   attribute/tag: CurrentState, type String

the shape script:

shape main
{
    noshadow=true;
    addsubshape("currentstatecompartment", 100, 100);
    setlinestyle("SOLID");
    moveto(0,0);
    lineto(100,0);

    shape currentstatecompartment
    {
         h_align = "center";
         editablefield = "CurrentState";
         println("Z: #CurrentState#");
    }
}
 
shape target
{
  rotatable = true;
  startpath();
  setfillcolor(255,255,255);
  setpencolor(0,0,0);
  moveto(0,0);
  lineto(16,6);
  lineto(16,-6);
  endpath();
  fillandstrokepath();
}




Maybe the following is a bug:
If you use this and make a recursive association the text is written four times.
Or if you have an association between two elements: With every angle in an association between these elements the text is written again.

I would expect that it is written only one time, no matter how many angles are used?
« Last Edit: November 27, 2008, 10:50:00 pm by snowy »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Display tagged value content
« Reply #1 on: November 27, 2008, 10:51:07 pm »
That is certainly counter intuitive.

Have you reported the bug to Sparx?
No, you can't have it!

Thomas H.

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Display tagged value content
« Reply #2 on: November 27, 2008, 11:16:54 pm »
I reported a bug about repeating the content of the subshape with every new angle.

But I still have no idea how I could display specific tagged value content...
It seems that this is currently not possible  :(

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Display tagged value content
« Reply #3 on: November 28, 2008, 12:55:50 am »
Not intuitive maybe, but not really illogical either. If it wasn't like this, how would you go about graphical elements which you actually want to be repeated in each line segment (like a small circle  in the middle or whatever)?

The only solution I found so far is printing the tagged value in a label; shape scripting allows to redefine the labels for the connector, though this still seems to be undocumented.

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1227491116

Thomas H.

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Display tagged value content
« Reply #4 on: November 28, 2008, 01:21:27 am »
Quote
Not intuitive maybe, but not really illogical either. If it wasn't like this, how would you go about graphical elements which you actually want to be repeated in each line segment (like a small circle  in the middle or whatever)?

The only solution I found so far is printing the tagged value in a label; shape scripting allows to redefine the labels for the connector, though this still seems to be undocumented.

http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1227491116

Thank you for the link information there. Now I can display the tag information, but still it is repeated if there is an angle.

Maybe a boolean flag like "repeatForEveryLinePart" (default=false) would be nice ;)


And some effect that I would not expect as well:

shape main
{
  noshadow=true;
  setlinestyle("SOLID");
  moveto(0,0);
  lineto(100,0);
  print("#TAG:MyTag#");
}

The result:
whenever you add a point (Ctrl+left mouse click) you get the information repeated as follows:

initial: information is shown once

1st extra angle:
- initial information in one line
- second: the information is shown twice

2nd extra angle:
- initial information in one line
- second: the information is shown twice
- third: information is shown three times

Would not expect that.
« Last Edit: November 28, 2008, 01:50:15 am by snowy »

Thomas H.

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Display tagged value content
« Reply #5 on: November 28, 2008, 02:03:51 am »
OK, I made a mistake by placing the code you linked to.

It has to be used as a separate shape, not inside the - for example - start shape:

shape main
{
    noshadow=true;
    setlinestyle("SOLID");
    moveto(0,0);
    lineto(100,0);
}

shape middletoplabel
{
    h_align= "center";
    v_align= "center";
    println("#TAG:MyTag#");
}

 
shape target
{
    rotatable = true;
    startpath();
    setfillcolor(255,255,255);
    setpencolor(0,0,0);
    moveto(0,0);
    lineto(16,6);
    lineto(16,-6);
    endpath();
    fillandstrokepath();
}



Thank you very much :)
« Last Edit: December 02, 2008, 08:48:13 pm by snowy »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Display tagged value content
« Reply #6 on: November 28, 2008, 04:43:00 am »
This still seem more like a kludge than a dependable (or predictable) feature. Shape scripts have been around for a while now. It is time for a major update. Fortunately the core features are sound. Building out from there should work well; there would be little if any disruption to legacy code.

Of course that's just my opinion...
No, you can't have it!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Display tagged value content
« Reply #7 on: November 28, 2008, 06:29:53 am »
Quote
Shape scripts have been around for a while now. It is time for a major update

Probably Roy has more urgent things to see to, but I think before they update the shape scripting engine, they should bring the shape script documentation up to date and add some none-trivial samples.

Anyway, it's no major concern of mine. I'm using it as rarely as possible cause I don't like these Neanderthal macro languages. Gimme an OnPaint event in the API, and maybe I'll use it.

Just my personal opinion of course. Or not even opinion really, just my personal preference. I just won't use shape scripts, MDA transformation templates or code generation templates if it can be avoided at all. I even try to avoid the automation interface, cause moving lots of data from there isn't much fun either.

The only Neanderthal language I frequently use is XSL 1. It's an awful language too, but it's one language for almost everything. And the main advantage is that all the information is there when you transform the xmi file. Whereas all the inbuilt EA languages have gaps when it comes to retrieving information. The API won't give you tagged values for parameters, shape scripting will allow no loops, and god knows what is missing in the code generation and MDA transformation template languages.

So I'm generating code from XMI as well as data (like some simple state machine stuff, e.g. screen transitions in an SDI application). Next thing I'm planning is to create DB scripts, so I can overcome the limitations of what EA offers there. And if the powers that be ever want to have reports transcending the standard templates, I'll transform XMI to HTML. Or hire someone who does.

As for MDA transformations, if the need ever arises I'll write a template to simply call an AddIn method. And an AddIn method to export to xmi, transform by xsl and import back.

So my top priority for EA bug fixing is on XMI 2.1 exports (I don't want to waste my time analysing the structure of obsolete stuff like XMI 1.3 or whatever they use for version control due to lack of reliable XMI 2 serialization). However there's been something in almost every build recently, so I'm hoping for the best.

And one more reason for using XSL: if the worst happens and Sparx goes busted, I can use some other tool (like Poseidon or Visual Paradigm, which aren't so bad either) and do my transformations with just some minor changes (like accessing stereotypes or navigability of associations, where I had to use the extensions section). Once burnt, twice shy. It happened to us years ago when we built an application around an OLAP control which turned out to be full of subtle bugs.  After a year of answering bug reports the vendor eventually announced that the control was not supported (let alone developed further) anymore because the developer who had written the code had left the company and was out of reach.

All in all my philosophy is keeping vendor dependency to a minimum and using common standards where ever possible. No offense meant to Sparx of course, and I wish them a long life, but I like to be on the safe side. EA has helped a lot to improve our productivity (much more than Rose, which we had in times of Visual Basic 6), and it sort of has become our daily bread and butter. But I wouldn't be comfortable if we were relying too heavily on EA alone.

Ok, I've been digressing. Just some thoughts I wanted to get off my chest.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Display tagged value content
« Reply #8 on: November 28, 2008, 11:19:15 am »
Quote
All in all my philosophy is keeping vendor dependency to a minimum and using common standards where ever possible. No offense meant to Sparx of course, and I wish them a long life, but I like to be on the safe side. EA has helped a lot to improve our productivity (much more than Rose, which we had in times of Visual Basic 6), and it sort of has become our daily bread and butter. But I wouldn't be comfortable if we were relying too heavily on EA alone..
Seconded...

I also endorse Frank's comments regarding inadequacies in the implemented interfaces to the model.  My approach, however is database based rather than XSL (not surprising for a Data Architect, I suppose) but conceptually it's the same...

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Thomas H.

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Display tagged value content
« Reply #9 on: December 02, 2008, 09:01:17 pm »
Thank you for all your answers, I think it is important to add some complete examples for shape scripting as long as the documentation doesn't contain a "complete" description for all shape scripting features.

I will try to add an example whenever I found out something (for example by receiving an answer in this forum) that is not included in the documentation.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Display tagged value content
« Reply #10 on: December 03, 2008, 05:18:52 am »
Quote
... I think it is important to add some complete examples for shape scripting as long as the documentation doesn't contain a "complete" description for all shape scripting features.
...
Thomas (et al),

Please send in a suggestion - or even a bug report if you feel this damages the usability of EA - directly to Sparx. Use the Report a Bug or Feature Request links under the Support link near the bottom of any forum page.

The user community has often commented on the limited examples - they are somewhat dated as well as being 'thin' - provided in the EA documentation. I for one have sent suggestions and requests to Sparx regarding this. They are certainly aware of my personal opinion on this need, but I am only one user (if an inconveniently verbose one). If enough of us (i.e. enough of you) take the time to bring this to Sparx' attention they will know that this isn't just a(nother) pet peeve of That Nice Mister Grey.

David
No, you can't have it!