Author Topic: Stereotypes custom icon and element display  (Read 8809 times)

Tree

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Stereotypes custom icon and element display
« on: November 12, 2013, 08:11:27 am »
I attempted to assign a metafile to a custom stereotype hoping the element would change appearance when I set the custom stereotype to the element.  Took the following steps... It did not work as I expected
Created stereotype as follows:
  • Settings...UML Types...Stereotype tab...selected new...specified the following

Stereotype:  KC135
Base Class:  class
Assigned Metafile (emf file image of K135)
[/list]
Assigned stereotype
  • Created class diagram

Added a class
Set stereotype to KC135
[/list]Relevant Diagram Properties
Use stereotype icons
Show element stereotypes both selected
[/list]
Class element did not change to image...

What is the expected behavior of sterotypes defined with images?
I think I may ultimately want to create custom stereotype icons to add to any element, but could not find a clear example in the resources provided.  Also is there a size guideline (pixels or inches) for stereotype images and sterotype icons.  Our models are viewed by individuals with unique perspectives and we find visual ques highly effective.  

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #1 on: November 12, 2013, 08:21:48 am »
I usually use shape scripts. So for a test I'd suggest to try a simple JPG instead of the EMF. Maybe EA is picky about it without letting you know. JPG should work. Let us know what the outcome is.

q.

Tree

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #2 on: November 12, 2013, 08:33:02 am »
Thank you for a timely response.  
When setting up the stereotype...settings...uml types...stereotypes, I changed the image type to a jpeg.  (the image did not show up on the preview as it did with the .emf file)
Closed and reopened EA
Went to the class diagram... stereo type is listed <<KC135>> image not changed.  

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #3 on: November 12, 2013, 08:48:44 pm »
Would you please try to set the following shape script
Code: [Select]
shape main {
rectangle(10,20,80,50);
println("foo bar");
}
and see whether that works?

(I just noted that I sent you on a wrong path with JPG as EA accepts only EMF/WMF besides shape scripts.)

q.

Tree

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #4 on: November 13, 2013, 12:41:13 am »
I followed your instructions...added a shapescript via Settings...UML Types...Stereotype
Edited the KC135 stereotype to include the script you provided.
The preview window in the dialog stated above showed the rectangle with foo bar outside the box in the upper left corner.
This change did not appear in the clas diagram for the class with the KC135 stereotype.
I also opened and closed EA then created a new class with this stereotype with no success.  
Runnig EA version 9.2.921  bug???

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #5 on: November 13, 2013, 01:24:50 am »
Hmm. 9.2? I run 10.0 and have also tested with 9.3. Could you install the current build? It's pretty safe. Just rename your current program folder to EA9.2 and install 10.0. Just acknowledge all questions. Once you have 10.0 installed you can rename the new EA folder to EA10 and the other one back. You can start the new build right out of the EA10 program folder. No problem with compatibility.

I doubt it being an old bug. Maybe something very strange. But testing the new build could shed a bit light on it.

And just another test: try with a new empty repository and turn off all MDGs.

q.
« Last Edit: November 13, 2013, 01:25:54 am by qwerty »

philchudley

  • EA User
  • **
  • Posts: 744
  • Karma: +21/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #6 on: November 13, 2013, 01:25:17 am »
I have got this work as follows

1) Create your stereotype as normal using UML Settings...
2) Create a shapescript similar to that below

shape main {
      image("firewall", 0, 0, 100, 100);
}


The name firewall is the Image id obtained by examining the Images resource fro the repository (Settings | Images...)

Here I have used one of the standard Sparx Images

Using the same technique the shapescript also worked for PNG images

Hope this helps

Phil
Models are great!
Correct models are even greater!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #7 on: November 13, 2013, 01:27:11 am »
Useful side note, Phil :-) But he does not see any change at all in the class diagram. So it's something more basic.

q.

Tree

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #8 on: November 13, 2013, 02:14:40 am »
Hi All,
Both approaches work...in a brand new .eap project.  I am suspicious of a couple of things...
In the first model I was working with (the one that had the problem) i also had a checkbox tagged value with an option for KC135.  I am wondering if it was some sort of naming collision or even order of creation issue.  
I went back to the problem project and got it to work...
I changed KC135 in the tagged value checkbox list to KC5 then recreated the stereotype...That worked
Then I reset the tagged value checkbox item to KC135 all is well.  
Not sure what the issue was here...may try to recreate it in a brand new model later. Thanks again.. :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #9 on: November 13, 2013, 03:37:03 am »
There is some connection between TVs and stereotypes: when applying stereotypes from a MDG they create TVs. Not sure why your project showed that strange behavior, though. Maybe simply bad luck. You could try to run a consistency check (Tools/Data Management/Project...) which is a good idea in any case where strange things seem to happen.

q.

Tree

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #10 on: November 13, 2013, 04:45:43 am »
Thanks, I ran the check (report only at first) ...it had orphaned stereotypes.  Was unable to investigate further which was a bit disconcerting.  It was a test model so I didn't mind letting it clean up, but I would not feel comfortable selecting that option unless I could drill down and verify some of the issue.  Is there a way to do that?
I have a couple of questions about Stereo type icons also...should I start a new topic?  (I'm new to the forum)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Stereotypes custom icon and element display
« Reply #11 on: November 13, 2013, 06:20:05 am »
It's a good idea to start a new thread for a new topic. So go ahead.

Running the consistency check is harmless. No idea why it is not forced like for fsck under Linux. Sparx knows... However, let it run once a week or so.

q.