Book a Demo

Author Topic: Displaying Attributes in a Shape Script...  (Read 7797 times)

GothDog

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Displaying Attributes in a Shape Script...
« on: April 22, 2008, 04:46:43 am »
After searching the docs, looking at the sample Shape Scripts, hunting online, searching the forums, I have several frustratingly unanswered questions...

1)
How do I display all the attributes for my class from a Shape Script?  (I can see how to show many interesting properties but not the Attributes or the Operations.  How do I display them from a shape script?)

2)
How do I set the font color from a shape script?  Some playing with pen color and whatnot suggests that this is just an out-and-out bug but I'm not sure.  There may be a way that doesn't show up in the docs.  (Version 7.0xxx)

3)
I've built my own MDG with my own profiles for UML and Toolbox and Diagram and ModelTemplate...   But...

How do I allow the toolbox to instantiate an instance of my stereotyped class with some preconfigured Attributes and Operations and some pre-assigned embedded Ports?  I know I can use the Pattern stuff but that's not very helpful.  I want to be able to do it from the toolbox.

Thanks in advance for any answers you can provide.  These issues have really been frustrating me.

-- Mack

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile

GothDog

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Displaying Attributes in a Shape Script...
« Reply #2 on: April 29, 2008, 02:32:57 am »
Sorry my question wasn't clear.  Setpencolor() does not change the font color in any of my shapescript experiments.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Displaying Attributes in a Shape Script...
« Reply #3 on: April 29, 2008, 08:19:12 am »
Then I would send a bug report to sparx systems.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Displaying Attributes in a Shape Script...
« Reply #4 on: April 29, 2008, 04:33:35 pm »
Actually the online manual explicitely states that there is no way to change the font size, type or colour of a text, and that setpencolor only affects line drawing commands but not any text commands.

Shape script documentation is out of date though. Nobody really seems to know what can be done and what can't. Some examples are spread over this forum, but I have no idea how to show all attributes either. Loops are not supported, so probably it's not possible at all.

So much for points 1 and 2.

As to point 3: Probably there's nothing in the profile defining mechanism to support preconfigured attributes, operations, or whatever features. It could be done by complementing the MDG with an AddIn using broadcast event (adding preconfigured stuff in the EA_PostNewElement event). This would mean, of course, to have half the logic for an MDG technology in the profiles, and the other half in the AddIn. Ugly and hard to maintain, and quite some work to get it started.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Displaying Attributes in a Shape Script...
« Reply #5 on: April 29, 2008, 04:44:21 pm »
Quote
Actually the online manual explicitely states that there is no way to change the font size, type or colour of a text, and that setpencolor only affects line drawing commands but not any text commands.
Unfortunately, correct.

Quote
I have no idea how to show all attributes either. Loops are not supported, so probably it's not possible at all.
Unfortunately, correct.

Quote
Probably there's nothing in the profile defining mechanism to support preconfigured attributes, operations, or whatever features.
Tagged values only.

Quote
It could be done by complementing the MDG with an AddIn using broadcast event (adding preconfigured stuff in the EA_PostNewElement event).
Yes, I have had success doing this.

Quote
This would mean, of course, to have half the logic for an MDG technology in the profiles, and the other half in the AddIn
You would have the add-in load the technology, so the technology effectively becomes the add-in's data.
The Sparx Team
[email protected]

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Displaying Attributes in a Shape Script...
« Reply #6 on: April 29, 2008, 05:08:20 pm »
Quote
You would have the add-in load the technology, so the technology effectively becomes the add-in's data.

OK, but you still have one half defined in a static thing (the MDG xml file interpreted by EA) and the other half in your code. Unless you set up some schema for an "MDGExtension.xml" for your code to interpret. But that's a common problem, of course, not only with EA.

Back to shape scripting: when you want the shape for a class stereotype to show attributes and operations, you are forced to use the default shape. But you can still use decorations to show additional stuff. Decorations however are hardly documented at all, except for some postings in this forum.

baghira

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Displaying Attributes in a Shape Script...
« Reply #7 on: April 30, 2008, 12:33:03 am »
Quote
Back to shape scripting: when you want the shape for a class stereotype to show attributes and operations, you are forced to use the default shape. But you can still use decorations to show additional stuff. Decorations however are hardly documented at all, except for some postings in this forum.

Yes I have used
Code: [Select]
shape main {
        v_align = "top";
      h_align = "right";
      drawnativeshape();
      addsubshape("symbol", 100, 60);
      
      shape symbol
      {      
            scalable = "false";
            [......]
      }
}
to add a small symbol in the upper right corner of the original shape. But in theory there must be a way to set an icon, so that you can choose weather the symbol or the stereotype text should be displayed. I didn't found out how to do this yet.
« Last Edit: April 30, 2008, 12:34:56 am by baghira »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Displaying Attributes in a Shape Script...
« Reply #8 on: April 30, 2008, 02:44:03 am »
There is no way, at least not yet.

I have requested this in the past. In particular, I asked for some way to display an icon as often done with the default EA rendering engine. I also asked if we could 'open' the engine so we could use the icons that EA uses, which are not currently exposed as images. And I asked if there was any way we could display multiple icons - or decorations failing that - as EA does when several are appropriate.

No answer whatsoever to any of these.

David
No, you can't have it!