Make it possible to change the spot letter by stereotype

0 votes
asked Mar 2, 2018 in Closed feature request by matthewadams12 (240 points)

http://plantuml.com/class-diagram 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, 2018 by plantuml (294,960 points)
selected Mar 21, 2018 by Anthony-Gaudino
 
Best answer
This is not possible yet (except if you do http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuKhEIImkLaZBppTKiB5Hq0ZGIIzAJStJL0W0obS6v2GcfuPaPEQbAzZP8PGQWPNwwXIbfcWg-ERdfkQLUEQLf1QL9UQ0r3cavgK0ZGO0 but I think that this is what you want to avoid).

Note that the preprocessor can also help you http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuL9CIKtBp4jLY8yF08fK1kGa9gU6P6JcfSV7AoZOs2Xe1EYa5wMcvcageCahsDaXQVRDpqtDA_7CAqajAalCGUWjIatHL42L16bCpaaiBbP8oyytn6OnGje8Yz5S3gbvAK2d0m00

 Otherwise, we could think about implementing something like this ;

@startuml
class foo1 << (P)artyPlaceThing >>
class foo2 << (M)omentInterval >>
@enduml

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, 2018 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.

WDYT?
commented Mar 2, 2018 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, 2018 by plantuml (294,960 points)
Yes, that's a good idea !
With last beta http://beta.plantuml.net/plantuml.jar you can have :

@startuml
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
@enduml

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! :-)
commented Feb 4, 2019 by AlexL (140 points)
This never made it into the released verision in any way?
...