Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: gunterkoenigsmann on February 26, 2024, 11:29:41 pm

Title: A stereotype that changes the color of a port according to a Tagged value
Post by: gunterkoenigsmann on February 26, 2024, 11:29:41 pm
I have used knowledge from this forum for many shape scripts, already. But now I have a question that exceeds what I found out widely: I want to create a stereotype that

What I know is:

But all that combined doesn't add up to what I think I need...
Title: Re: A stereotype that changes the color of a port according to a Tagged value
Post by: Eve on February 27, 2024, 08:36:17 am
  • ideally comes with its own tag (like the FlowPort stereotype does come with a direction tag)
https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_frameworks/definestereotypetags.html (https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_frameworks/definestereotypetags.html)

  • that changes the line color of the ports it affects and
https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_frameworks/example_scripts.html (https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_frameworks/example_scripts.html)
Examples of both checking a tag and setting a color.

  • that can be combined with other stereotypes like flowport (that does change the port decoration) or a stereotype that only changes the background color

That could be hard since only one shape script will draw.

Based on that I'll recommend an alternative. Using a legend to colour your elements based on the tagged value created based on the first link.
https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_fundamentals/add_a_legend.html (https://sparxsystems.com/enterprise_architect_user_guide/16.1/modeling_fundamentals/add_a_legend.html)
Title: Re: A stereotype that changes the color of a port according to a Tagged value
Post by: gunterkoenigsmann on March 04, 2024, 06:38:12 pm
Tested it for a few days now and legends work fine. Thanks a lot!