Book a Demo

Author Topic: Show stereotypes of child packages in package  (Read 4521 times)

Henrik Possung

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Show stereotypes of child packages in package
« on: January 07, 2015, 09:08:00 pm »
I want to show the stereotype of the child packages and the child elements in a package element in a diagram. I guess it would be possible with a shape script, but I can't figure out how to change the native compartment for sub elements in the package element.

Package element example:

--------------------
Package Name
--------------------
(icon) + ChildPackageName
(icon) + ChildElementName
-----------------------------------------------

Do you know if it possible to write a shape script that adds the stereotype of the child packages?



qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Show stereotypes of child packages in package
« Reply #1 on: January 07, 2015, 11:33:28 pm »
Quote
shape ChildElement { <block> }
defines the script to be executed for any child element.

and as an example

Code: [Select]
shape ChildElement { // add Child Compartments to the parent.
  if(HasProperty("stereotype", "part")) {
    SetCompartmentName("Parts");
  }
  else if(HasProperty("stereotype", "mystereotype")) {
    SetCompartmentName("My Stereotype");
  }
  AppendCompartmentText("#NAMe#"); // case insensitive...
}

(taken from my ShapeScript book)

q.

Henrik Possung

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Show stereotypes of child packages in package
« Reply #2 on: January 08, 2015, 12:36:22 am »
Thanks q!

I tried this, but I can only get it to work on elements (e.g. a class elements) but not for packages. Do you know if there is any difference between packages and other elements, when using shape scripts?

Packages already have a native compartment for the child packages (showing the type icon and the name ). I would like to modify this and show the stereotypes of the child elements in this compartment.

/Henrik



Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Show stereotypes of child packages in package
« Reply #3 on: January 08, 2015, 01:06:41 am »
Hej!


Child elements are children of another element, not of packages, so I wouldn't expect this to work.

There are some options to manipulate the presentation of package contents in diagrams, in the Diagram - Behavior section of the options dialog. You can select whether to display linked elements (as well as contained ones) and whether to display element scope, but there's no option for stereotypes.


/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Show stereotypes of child packages in package
« Reply #4 on: January 08, 2015, 02:00:06 am »
Shape script is rather limited. I guess you should look for alternative ways to show what you want.

q.