Author Topic: Colour and shapescript inheritance in UML profiles  (Read 1101 times)

matthew.james

  • EA User
  • **
  • Posts: 155
  • Karma: +7/-3
  • Am I supposed to say something here ... ?
    • View Profile
Colour and shapescript inheritance in UML profiles
« on: May 23, 2018, 01:51:01 pm »
So - I've created a UML Profile to extend an Archimate shape (ie a non-UML shape).
This I've done (based on instructions) by Extending the base Activity class and Generalising the Archimate shape - Archimate_BusinessFunction.

Mostly this is working fine but the colour inheritence is interesting - the new stereotype is inheriting the default fill colour from the Activity class, but the shapescript from the BusinessFunction stereotype ... is this normal or have I done something wrong ?

Of note:
- The UML profile has bgcolor="-1" which (I believe) says 'inherit from ancestor'
- Obviously there are two ancestors in this case, however I would have thought that appearance would be inherited from the stereotype ancestor not the class ancestor
- I can work around this by explicitly setting the colour for the new metaclass, but this then loses the benefits of inheriting appearance

Thoughts ?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10129
  • Karma: +326/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Colour and shapescript inheritance in UML profiles
« Reply #1 on: May 23, 2018, 02:21:00 pm »
Matthew,

Have you tried setting the default appearance of your stereotype object?

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 11121
  • Karma: +262/-246
  • I'm no guru at all
    • View Profile
Re: Colour and shapescript inheritance in UML profiles
« Reply #2 on: May 23, 2018, 03:32:30 pm »
When using shape script, did you call DrawParentShape rather than DrawNativeShape?

q.

matthew.james

  • EA User
  • **
  • Posts: 155
  • Karma: +7/-3
  • Am I supposed to say something here ... ?
    • View Profile
Re: Colour and shapescript inheritance in UML profiles
« Reply #3 on: May 24, 2018, 09:41:47 am »
Have you tried setting the default appearance of your stereotype object?

Yes - I can do that and it works, but as i indicated this then overrides the inheritence. Specifically the base stereotype is yellow but my stereotype gets the normal class orangey default colour.  If I set the default appearance of my stereotype to yellow then I do get the right yellow colour when use the stereotype.  *But* if the base stereotype is changed in the future then my stereotype won't inherit that change.

When using shape script, did you call DrawParentShape rather than DrawNativeShape?

I'm not (explicitly) using a shapescript, the shapescript is inherited fropm the base stereotype ancestor.  I am only extending the stereotype to add attributes / tagged values so I want the shapescript behaviour to come from the ancestor.  This is working, the stereotype gets the shape appearance - just not the colour.
Specifically the base stereotype is Archimate2::Archimate_BusinessFunction and (from the MDG XML) this stereotype has the yellow bgcolor set.  So somehow the new stereotype seems to inheriting all the shapescript behaviour from the base stereotype *except* the bgcolor.

** Note this is with v12, I am working through the process of getting us upgraded to v14 and there might be some changes to this behaviour (although that would imply that the behaviour I'm seeing is an EA bug with v12)

qwerty

  • EA Guru
  • *****
  • Posts: 11121
  • Karma: +262/-246
  • I'm no guru at all
    • View Profile
Re: Colour and shapescript inheritance in UML profiles
« Reply #4 on: May 24, 2018, 05:58:20 pm »
I doubt that this will have changed in any further version to V12. There have been a few threads dealing with style inheritance along with MDG extensions. You might send a bug report to see what Sparx says (it might end up in "this is a feature, not a bug", though).

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 10129
  • Karma: +326/-30
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Colour and shapescript inheritance in UML profiles
« Reply #5 on: May 24, 2018, 06:07:14 pm »
The problem is that the default color is not defined in the shapescript, but in the default appearance for the stereotype element, and that cannot be inherited.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 11121
  • Karma: +262/-246
  • I'm no guru at all
    • View Profile
Re: Colour and shapescript inheritance in UML profiles
« Reply #6 on: May 24, 2018, 07:21:55 pm »
Ah, Geert is right. That was the essence. In other words: it's a feature. And hoping for a change is futile.

q.

matthew.james

  • EA User
  • **
  • Posts: 155
  • Karma: +7/-3
  • Am I supposed to say something here ... ?
    • View Profile
Re: Colour and shapescript inheritance in UML profiles
« Reply #7 on: May 25, 2018, 11:02:31 am »
The problem is that the default color is not defined in the shapescript, but in the default appearance for the stereotype element, and that cannot be inherited.

The colour is definitely being inherited - but from the base class and not the base stereotype.
In the example I have been using the base class is Activity (in-built) my new stereotype gets its shapescript from the base stereotype (Archimate_BusinessFunction) but has the orangey color from Activity.  If I do the same thing but use Class as the base class instead of Activity then the white / grey background from Class is used as opposed to the Orangey colour from Activity.

Given that stereotypes are to identify a specific role for the element, and to include visual cues for that, this seems like a 'constraint' or 'oversight' rather than a deliberately thought out feature.
However, it is what it is ...