Book a Demo

Author Topic: Stereotype and Icons  (Read 56811 times)

Philipp91

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Stereotype and Icons
« Reply #30 on: October 28, 2020, 06:18:02 am »
It's sad that I cannot add two different stereotype with different images and show both of them because in the UML extensions mechanism
we should be able to do something like that..

Unfortunately your code did not worked. It didn't displayed any image, did it worked for you?

The way I achieved to add three images next to each other is :


decoration mail

{

     orientation= "NE";
   
     image ("tablet.png",100, 0, 0, 100);
     image ("smartphone.png", 0, 0, -100, 100);
          image("laptop.png", -100, 0, -300,100);
}

However if I have 3 different stereotypes with different images then there will be scenarios that a will apply the two of them, three of them and so..so in the end to cover of the cases I have to create 8 different "stereotypes" to be able to do something like that..and it will not be user-friendly..

Any hack or something to do it differently?

Kind Regards,
Philipp

 
« Last Edit: October 28, 2020, 06:36:57 am by Philipp91 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Stereotype and Icons
« Reply #31 on: October 28, 2020, 08:38:42 am »
Yes, it worked for me, but you might need to change the names of the images as they might not exist in your model.

You should be able to add the images conditonally based on the stereotypes (of it not that, based on tagged values that you can define in your stereotype)
That way all of your stereotypes could have the same shapescript.

Geert

Philipp91

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Stereotype and Icons
« Reply #32 on: October 28, 2020, 10:48:30 am »
Thanks!! It worked for me also. So in the end I was able to add conditionally the images  based on tagged values of  a stereotype and it worked.
However, you mentioned "add the images conditonally based on the stereotypes" how can that be achieved? I tried things like hasStereotype and so but I did not found something in the documentation.

Also, is there a way to add in the method "HasTag" something like  if (HasTag ("Example", "*")) where example is a char type attribute
and the start means "whatever text"?

Kind Regards,
Philipp

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Stereotype and Icons
« Reply #33 on: October 28, 2020, 10:56:46 am »
Well, yes. It's in the documentation and even the picker when typing the operation in the script editor suggests that.

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Stereotype and Icons
« Reply #34 on: October 28, 2020, 11:29:27 am »
Hi Philipp,

I'm interested in why you need multiple stereotypes.  I suspect there may be a conceptual modelling issue "in play" here.  We have (after more than a decade of EA use) not used more than a single stereotype to define an item.  This, in turn, defines a single metatype.

It seems to me that you may be trying to use stereotypes as properties.  We have many properties which we can assign to various metatypes and our shapescripts react to them in a consistent way.  We can also suppress the rendering of the various types of properties on a per-diagram basis - to make simplified diagrams for various user communities/perspectives.

We can have upwards of half a dozen "widgets" on a given diagram item (in various corners) if required.

Can you say why you need more than one stereotype and why that need couldn't be satisfied by the use of properties?

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

Philipp91

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Stereotype and Icons
« Reply #35 on: October 29, 2020, 01:46:12 am »
qwerty, I will have a look. To add in the property of the hasTag a star or something that represents any character can be done?

Paolo,

actually what I want to achieve is to create a stereotype called for instance "migratable" extending the metaclass "action". Furthermore, I would
like to show between which devices that action is "migratable" and I had the idea to add the devices as Icons which can be more than 1.
So this is the scenario.

So for now the way I did it is I created the stereotype migratable with its properties and another stereotype called "devices" which has as tagged values the devices that are included and I added both stereotypes on an action . Then I created a shapescript depending on which devices the user added in the properties and the icons are shown.  However, the thing I still want to achieve is to have a "random" image for
general devices which i will not have a standard icon ( that's actually related to my question I did in the last post and to qwerty on this one.)

You think if I do something like this I will have consistency problems? And how I understood your point, you mean I should better skip the second stereotype "devices" and add it as a property(tagged value) in the stereotype "migratable"?

Kind Regards,
Philipp

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Stereotype and Icons
« Reply #36 on: October 29, 2020, 03:18:18 am »
Not really (your question was not clear). There is no wild card. You'd need an add-in to do that. You only have a) exact match ignoring case when specifying a string and b) testing the mere existence of a TV by leaving away the 2nd string.

q.

Philipp91

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Stereotype and Icons
« Reply #37 on: October 29, 2020, 05:51:10 am »
Sorry for not making my question clear. I also got confused by your answer. Let me ask it differently on an example

For instance, when I have the command if( hasTag("device","tablet")) --> i show the icon for tablet
if(hasTag("device","")) --> i show no icon and so on..
So what I want is for all the other cases that the attribute is not blank("") or I don't have a predefined icon to show a particular icon.
So when the user adds device = "adadasfaa" or device = "blahblah" or whatever I show this particular icon.

Can something like that be achieved?
Kind Regards,
Philipp

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Stereotype and Icons
« Reply #38 on: October 29, 2020, 06:00:52 am »
Unfortunately Shapescript is a very, very poor language. Its parents did not give him any string operations. Even no operations at all. Means: no boolean operations. So if you have a complex construct you have to copy/paste.

if (A and B) <stmt> -> if (A) { if (B) { <stmt> }}
if (A or B) <stmt> -> if (A)  { <stmt>}; if (B) { <stmt> }

where <stmt> is any (complex) block of statements.

q.

Philipp91

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Stereotype and Icons
« Reply #39 on: October 29, 2020, 06:33:31 am »
Its parents did not took good care of him :P j/k

Thanks for your help I will give it a try :)

Kind Regards,
Philipp


KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Stereotype and Icons
« Reply #40 on: October 29, 2020, 07:51:37 am »
For instance, when I have the command if( hasTag("device","tablet")) --> i show the icon for tablet
if(hasTag("device","")) --> i show no icon and so on..
So what I want is for all the other cases that the attribute is not blank("") or I don't have a predefined icon to show a particular icon.
So when the user adds device = "adadasfaa" or device = "blahblah" or whatever I show this particular icon.

Can something like that be achieved?

if()
{
}
else if()
{
}
else
{
}
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Stereotype and Icons
« Reply #41 on: October 29, 2020, 10:56:17 am »
[SNIP]

Do you think if I do something like this I will have consistency problems? And how I understood your point, you mean I should better skip the second stereotype "devices" and add it as a property(tagged value) in the stereotype "migratable"?

Kind Regards,
Philipp
Hi Philipp,

Having read your response, I'm not really sure what you are trying to do.  As I understand UML (I assume you are using UML):
16. Actions
An Action is the fundamental unit of behavior specification in UML. An Action may take a set of inputs and produce a
set of outputs, though either or both of these sets may be empty. Some Actions may modify the state of the system in
which the Action executes.


Thus, "migratable" is not an action, it is a property of something.

Not sure I can help further.

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

Philipp91

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Stereotype and Icons
« Reply #42 on: October 29, 2020, 11:16:53 pm »
KP,

Thanks, I got that it can be done only by nested if's.

Paolo,

Well actually I am creating a "new" language to cover characteristics of Cross-device applications which UML does not consider.
So I choose to not create a whole new language but to extend UML with profiles and not change the metamodel to keep the consistency.
So in the end in CDA we can migrate from one device to another while an action is executed. So I am showing that this action is Migratable
while its running and want to show between which devices it can migrate. So i created the migratable stereotype and the device stereotype to cover this requirement.

You mean that something like that is not allowed...?

Kind Regards,
Philipp

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Stereotype and Icons
« Reply #43 on: October 30, 2020, 09:15:51 am »
KP,

Thanks, I got that it can be done only by nested if's.

Paolo,

Well, actually I am creating a "new" language to cover characteristics of Cross-device applications which UML does not consider.
So I choose to not create a whole new language but to extend UML with profiles and not change the metamodel to keep the consistency.
So in the end in CDA we can migrate from one device to another while an action is executed. So I am showing that this action is Migratable
while its running and want to show between which devices it can migrate. So i created the migratable stereotype and the device stereotype to cover this requirement.

You mean that something like that is not allowed...?

Kind Regards,
Philipp
OK, Phillip,

Migratable is a property of the Action (an item). Presumably, not all actions are migratable.  If an action is migratable, it has two related devices (also items), the "migrating from" device and the "migrating to" device..  You could implement this concept as two relationships, between the action and the appropriate device.  Personally, I would add the property "can handle migration" to the device item so that you could check that the devices are appropriate to attempt the migration.

If you look carefully at the language I've used, you'll see that it (hopefully) correctly describes the semantics of what you're trying to do.  When creating a new language, you have to be able to express the model in narrative form.  Try that with your implementation - that should guide you into what needs to change.

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

Philipp91

  • EA User
  • **
  • Posts: 45
  • Karma: +0/-0
    • View Profile
Re: Stereotype and Icons
« Reply #44 on: November 02, 2020, 09:09:31 am »
Hey Paolo,

Thanks for your help! I am also working on the semantics which will also depend on the tool being used for this extension and your example was helpful.

Kind Regards,
Philipp