Make it possible to change the spot letter by stereotype

0 votes
asked Mar 2 in Closed feature request by matthewadams12 (240 points) shows that I can change the spot character on a class-by-class basis, but how do I change the spot based on the presence of a stereotype with a specific value?

For example, I'd like all classes with the stereotype PartyPlaceThing to have the spot character P, or all classes with the stereotype MomentInterval to have the spot character M, in a manner similar to skinned stereotypes.

1 Answer

0 votes
answered Mar 2 by plantuml (149,480 points)
selected 1 day ago by Anthony-Gaudino
Best answer
This is not possible yet (except if you do but I think that this is what you want to avoid).

Note that the preprocessor can also help you

 Otherwise, we could think about implementing something like this ;

class foo1 << (P)artyPlaceThing >>
class foo2 << (M)omentInterval >>

What do you think about it ? Do not hesitate to propose a better syntax if you have any idea : we are out-of-inspiration :-)
commented Mar 2 by matthewadams12 (240 points)
I was thinking more along the lines of the following (note commented line):

' PartyPlaceThing
skinparam class {
  BackgroundColor<<PartyPlaceThing>> TECHNOLOGY
  BorderColor<<PartyPlaceThing>> Black
  Spot<<PartyPlaceThing>> P '<------- my proposal
skinparam stereotypeCBackgroundColor<<PartyPlaceThing>> DarkSeaGreen

That way the rendering concerns are orthogonal to the actual UML metadata.

commented Mar 2 by matthewadams12 (240 points)
It just occurred to me that would also be nice to control spot formatting as well with SpotBackgroundColor, SpotBorderColor, and any other relevant settings here.
commented Mar 6 by plantuml (149,480 points)
Yes, that's a good idea !
With last beta you can have :

skinparam classHeaderBackgroundColor #4FF
skinparam classBackgroundColor #77F
skinparam classBorderColor #F0F
skinparam stereotypeC<<stereo1>> {
  BackgroundColor #FFF
  BorderColor #FF0
skinparam spotChar<<stereo1>> Z
class foo1 << stereo1 >>
class foo2

I think it's what you were expecting.
We've made this change in quick&dirty mode, so now it's time to think about the best skinparam names.

"stereotypeCBackgroundColor" was really a bad choice (named like this for historical reason). I think it's time to rename it to something more logical. classSpot would make sense, but the issue is that there is right now a stereotypeI (for interface), stereotypeA (for abstract class), stereotypeE (for enum) and stereotypeN (for annotation) with different default backcolors.

I am uncomfortable with creating interfaceSpotBackgroundColor (again, we must have a specific setting for interface) because there is today no specific settings like interfaceBackgroundColor / interfaceBorderColor for interface. We could go that way, but if we do, there will be a lot of different settings.

So we're lost now, and any suggestions to put all this back to order is welcome! :-)