Book a Demo

Author Topic: UML Profile, don't show the stereotype  (Read 6885 times)

Kristofer

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
UML Profile, don't show the stereotype
« on: January 24, 2018, 09:09:56 pm »
Hi!

I am creating an UML profile, extending the Component meta class to add a few tagged values, and set it to show the tagged values in the diagram (_Tag = 1). However, when I do this, the stereotype text is also shown (in addition to the icon). Can I change this behavior so that it acts the same as the original Component, only showing the icon and not the stereotype text?

Arshad

  • EA User
  • **
  • Posts: 291
  • Karma: +21/-1
    • View Profile
Re: UML Profile, don't show the stereotype
« Reply #1 on: January 24, 2018, 09:26:02 pm »
Hi Kristofer

Yes stereotype can be set to hidden.

Add Shape scripts to that stereotype.
Or in
Diagram Properties -> Elements Tab -> Element Appearance -> Uncheck Show Element Stereotypes.
« Last Edit: January 24, 2018, 09:44:51 pm by Arshad »

Nabil

  • EA User
  • **
  • Posts: 149
  • Karma: +5/-2
    • View Profile
    • View My LinkedIn Profile Here
Re: UML Profile, don't show the stereotype
« Reply #2 on: January 24, 2018, 10:21:46 pm »
As arshad mentioned adding Shape script is an option.
You can even extend a diagram for your profile and set Hide Element Stereotypes "True". But this will hide the stereotypes of all Elements in the diagram

Cheers,
Nabil
Nabil

Kristofer

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
Re: UML Profile, don't show the stereotype
« Reply #3 on: January 24, 2018, 10:36:27 pm »
I would prefer to not do this for all elements in the diagram, but only for this element. But I cannot figure out how to do this in a shape script. Or do you mean that I need to create the shape from scratch? I thought about using DrawNativeShape and change it somehow. But perhaps that does not work?
« Last Edit: January 24, 2018, 10:42:01 pm by Kristofer »

Nabil

  • EA User
  • **
  • Posts: 149
  • Karma: +5/-2
    • View Profile
    • View My LinkedIn Profile Here
Re: UML Profile, don't show the stereotype
« Reply #4 on: January 24, 2018, 10:51:49 pm »
Refer the example scripts here
http://www.sparxsystems.com/enterprise_architect_user_guide/13.5/modeling_tools/example_scripts.html

Drawnativeshape would bring the same component element with stereotype

There is no attribute to hide stereotype. So we need to create from scratch

shape main
{
   layouttype="border";

   defsize(90,70);
   rectangle(0,0,100,100);
   addsubshape("padding","n");
      
   if(hasproperty("rectanglenotation","0"))
   {
      addsubshape("port","w");
   }
   addsubshape("name","center");
   
   shape port
   {
      preferredwidth=20;
      scalable=false;
      rectangle(-10,-10,10,0);
      rectangle(-10,10,10,20);
   }
      
   shape padding
   {
      preferredheight=15;
   }
   
   shape name
   {
      h_align="center";
      print("#name#");
   }
}

decoration component
{
   orientation="ne";
   
   if(hasproperty("rectanglenotation","0"))
   {
   }
   else
   {
      rectangle(0,0,60,100);
      rectangle(-10,10,10,30);
      rectangle(-10,50,10,70);
   }
}

decoration composite
{
   orientation="SE";
   if(hasproperty("iscomposite","true"))
   {
      ellipse(0,40,40,60);
      ellipse(60,40,100,60);
      moveto(30,50);
      lineto(70,50);
   }
}

Try this
« Last Edit: January 24, 2018, 11:08:10 pm by Nabil »
Nabil

Kristofer

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
Re: UML Profile, don't show the stereotype
« Reply #5 on: January 24, 2018, 11:03:24 pm »
Thanks, now I understand!