Book a Demo

Author Topic: Shapescripts for objects  (Read 6474 times)

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Shapescripts for objects
« on: May 04, 2008, 04:24:00 pm »
Hi a couple of questions about shapescripts and objects:
1) How can I add in profile/UML settings a shape script for an instance of an element (e.g.: an instance of a UI control) which doesn't have stereotype.
2) How can I override EA native shapes. I tried creating a shape script for object with stereotype screen, but EA overrides it with its own shape... my mistake, i menaged ot do it.


thanks.
« Last Edit: May 04, 2008, 04:59:03 pm by MartinT »
Recursion definition:
If you don’t understand the definition read "Recursion definition".

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shapescripts for objects
« Reply #1 on: May 05, 2008, 08:29:40 am »
Shape scripts can only be applied to something with a stereotype.  This means that your instance will also need a stereotype.

(However, I have had success using Classifier.Stereotype or Classifier.Metatype to change the display of a shape scripted instance based on what it is actually an instance of.)

Martin Terreni

  • EA User
  • **
  • Posts: 672
  • Karma: +0/-0
  • Sorry, I can't write
    • View Profile
Re: Shapescripts for objects
« Reply #2 on: May 05, 2008, 02:49:28 pm »
thanks
Recursion definition:
If you don’t understand the definition read "Recursion definition".

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Shapescripts for objects
« Reply #3 on: May 05, 2008, 09:35:38 pm »
Quote
Shape scripts can only be applied to something with a stereotype.  This means that your instance will also need a stereotype.

(However, I have had success using Classifier.Stereotype or Classifier.Metatype to change the display of a shape scripted instance based on what it is actually an instance of.)
Could you please elaborate Simon? I'm not quite sure where you are using what setting, and what changes...

Thanks much,
David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shapescripts for objects
« Reply #4 on: May 06, 2008, 08:22:55 am »
Okay, I'll elaborate.

Some time ago I wrote a profile for EA (that so far hasn't seen the light of day) that specifies that the instances have the same notation as the classifier, but with the ': classfier' after the name.  This required accessing the stereotype/classifier of the classifier from the shape script so that it could draw the appropriate notation.

Think of two stereotypes, a circle and square.  In the object shape script you can say if my classifier stereotype is a circle, draw a circle, if otherwise draw a square.

If misused this would certainly add fuel to anti-shape script movement, but for some domains, such as the one that I was working on at the time it is necessary.  I'm not talking about UML here, and it would not fit with UML at all.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Shapescripts for objects
« Reply #5 on: May 06, 2008, 09:36:52 pm »
Simon,

Interesting.

A while ago I ran into something where it would be (very) desirable to be able to use the 'standard' EA engine to draw a shape. The problem was that the stereotype involved was applied to a different classifier.

For example, imagine a case where a class might have one (or neither) of two stereotypes: «foo» and «bar». When it comes time to render the class, we have three possibilities:
  • No stereotype; this is just an ordinary class, so go ahead and draw it. [This is how EA reacts now of course.]
  • Stereotype «foo»; in this case apply a shape script. Perhaps a decoration or something might be used, applied to the expected rendering of the 'usual' classifier (i.e. a Class).
  • Stereotype «bar»; in this case I would want the shape to be drawn using the default EA rendering, but for a use case, with whatever conventions (i.e. response to EA options settings) would normally apply if the classifier were Use Case all along.
Any way that can be done?

AFAIK using the drawnativeshape method gives me no choice; it always uses the native shape of the 'underlying' classifier.

Any chance of extending to this in future?

David
No, you can't have it!

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Shapescripts for objects
« Reply #6 on: May 07, 2008, 02:01:27 am »
I would add to this that it would be desirable to be able to have a decoration for foo, a decoration for bar, and a decoration that applied when both foo and bar applied.

Particularly nice if it could trigger on tagged values.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shapescripts for objects
« Reply #7 on: May 07, 2008, 07:39:23 am »
David.  No, I don't think there is any way that could be done.

As for two different decorations.  It may be possible to do both decorations, but I suspect only one shape script can be drawn.

I was also hoping that you may be able to get the additional stereotype from the one shape script, but that doesn't appear to be possible.

For tagged values you can check the HasTag for the two tags in question and draw the appropriate decoration.  You just need to have a stereotyped object to do it.
« Last Edit: May 07, 2008, 07:40:48 am by simonm »

Thomas Mercer-Hursh

  • EA User
  • **
  • Posts: 386
  • Karma: +0/-0
  • Computing Integrity
    • View Profile
Re: Shapescripts for objects
« Reply #8 on: May 07, 2008, 07:49:49 am »
Yes, well, referencing the tags is better than not being able to reference the tags, but the real point is having to apply a stereotype to do it.