Author Topic: MDG Profile - Re Use of Shape Script?  (Read 7411 times)

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
MDG Profile - Re Use of Shape Script?
« on: June 13, 2014, 06:50:48 pm »
I am building an MDG in which many element types will be required to change appearance based on the contents of their Tagged Values.

I have successfully written a Shape Script and added it to the profile for each of the stereotypes to which it should apply.

It now seems that if I wish to amend the Shape Script I will need to amend it individually in each Stereotype to which it applies.

This seems counter intuitive: surely there is a 'script once, use many' alternative?

By this I mean set the _image and Initial Value to point to where the script is located, rather than Initial Value actually containing the script.

Despite hours searching I can find no mention of anyone doing this.

If anyone knows how to do this I should be hugely grateful...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #1 on: June 13, 2014, 08:15:02 pm »
The answer is copy/paste. There is no such use-many-alternative.

q.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #2 on: June 13, 2014, 09:31:16 pm »
Quote
The answer is copy/paste. There is no such use-many-alternative.

q.

Thank you very much for your reply.
It seems strange that the software isn't able to accept a pointer, especially as it's my understanding that it does so if one wants to replace the default appearance with an image.
Maybe I've misunderstood?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #3 on: June 13, 2014, 10:16:34 pm »
If you want to use the same image in form of a shape script in a MDG more than once you actually can only copy/paste the contents of _image.

I once tried a generalization but it looks like (still? It was in times of 8.x IIRC) the _image is not inherited. So you need to copy/paste.

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #4 on: June 16, 2014, 09:24:20 am »
Quote
I once tried a generalization but it looks like (still? It was in times of 8.x IIRC) the _image is not inherited.
It should work now (fixed in EA 11), and I think that could be the OP's answer: have an abstract stereotype to supply the shape script and have many concrete stereotypes specialize it. This will work as long as you don't override the shape script (if you're using "decoration" shapes that shouldn't be an issue).
« Last Edit: June 16, 2014, 09:28:52 am by KP »
The Sparx Team
[email protected]

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #5 on: June 17, 2014, 10:53:14 pm »
Quote
It should work now (fixed in EA 11), and I think that could be the OP's answer: have an abstract stereotype to supply the shape script and have many concrete stereotypes specialize it. This will work as long as you don't override the shape script (if you're using "decoration" shapes that shouldn't be an issue).

Thanks. That was all the prompting I required to upgrade to EA11.

Having done so, I still can't figure out how to use 'specialize' as opposed to generalize in order to get the _image attribute to be inherited. (Yes: am adding only decoration as informative 'flags', so far...)

I'm sure it's the seat/keyboard interface that's at fault in this case, but I would appreciate a more detailed explanation please.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #6 on: June 17, 2014, 11:40:55 pm »
I just tried with a simple example and it worked:

I removed the _image from Deprecated and it inherited from TBD.

q.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #7 on: June 18, 2014, 12:55:32 am »
Many thanks for trying that.
Right then: it's definitely something which I'm doing wrong.

To test it I've just used the Profile alone(i.e. not done a full blown MTS and MDG process) and imported it as a resource into another project.

I've read through the XML and the code is contained within the correct stereotype.
The other attributes of that higher level stereotype are being inherited and are visible, but the image field is not being imported/processed.

The Shape Script that I've written has a catch-all which generates grey and works when cut and paste at the lower level - so it's not the code.

Can I just confirm that:
1) The arrow that you've shown between Deprecate and TBD is of type 'generalize', and;
2) Your Deprecate element is somewhere linked by 'Extends' to a Metaclass? and;
3) Your TBD is an abstract stereotype which is not an extension of a Metaclass?

Thanks again.
« Last Edit: June 18, 2014, 12:57:51 am by ZuluTen »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #8 on: June 18, 2014, 07:11:12 pm »
1) yes
2) no. Deprecate has only the Generalize to TBD
3) no. The many connectors you see on top of TBD are all <<extends>> to metaclasses where I want to apply TBD.

This way I can also apply Deprecate to those classes.

q.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #9 on: June 18, 2014, 09:37:03 pm »
Thank you ever so much for your patience.

I have gone back to first principles and generated a new MDG profile/diagram/toolbox with only the minimum number of elements.

They are associated exactly as you described above, and yet still the inheritance of shape script still doesn't work.

I wonder whether I've got an Option or Setting somewhere which is inhibiting the inheritance of appearance?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #10 on: June 18, 2014, 10:44:33 pm »
There is no such setting.

If your MDG is not confidential I could have a look at it. You can contact me via mail (see the page linked via the banner below my post).

q.

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: MDG Profile - Re Use of Shape Script?
« Reply #11 on: June 18, 2014, 10:58:01 pm »
Quote
There is no such setting.

If your MDG is not confidential I could have a look at it. You can contact me via mail (see the page linked via the banner below my post).

q.

Thank you very much: e-mail and attached MDG sent.
I shall post the outcome which may hopefully help others...

ZuluTen

  • EA User
  • **
  • Posts: 56
  • Karma: +0/-0
    • View Profile
Re: MDG Profile - Generalization of Shape Script?
« Reply #12 on: June 19, 2014, 05:23:20 pm »
For anyone reading this and looking for a solution:

q. has looked at my Profile, and even gone to the trouble of re-creating his own version of it, and consequently has very cleverly found YAEAB:

It seems that the Generalisation of Shape Scripts works correctly if the Shape Script is using a 'Shape Main' code module, but if like me you try to use the 'Decoration' feature then the inheritance falls over.

I've raised this with Sparx as a bug.

Finally I should like to publicly thank q. for all his help and patience.
« Last Edit: June 19, 2014, 05:26:47 pm by ZuluTen »