Customize Stereotype display

0 votes
asked Mar 19, 2019 in Wanted features by javabien (120 points)

When building a diagram the Stereotype title always display the << and >> ... is there a way to remove these or customize these?

The only hack I found is to put a :

skinparam StereotypeFontSize 0

Then I rewrite the title by myself, but then I cannot customize the FontSize.

My suggestion would be to have something like:

skinparam StereotypeTitleOpening [
skinparam StereotypeTitleClosing ]

If the value is left "empty", then nothing would be displayed.

Thanks,

2 Answers

0 votes
answered Mar 20, 2019 by zimchaa (1,040 points)
Hi, it is possible to hide the stereotype using: ``hide stereotype`` at the top of the script, which is close to what you're asking - it's covered here: http://forum.plantuml.net/1710/hide-stereotype-in-component-diagrams
commented Mar 20, 2019 by javabien (120 points)
Yes, it's close to what I did as a workaround:

skinparam StereotypeFontSize 0

While the official way to do it is:

hide stereotype

But it's not really solving my issue, if I want to put a different FontSize on the Stereotype, than the regular FontSize, but I don't want to print the ugly << and >> then I'm screwed.
I have to hide the Stereotype, but then I cannot change the FontSize or the Color.

In other word, I still see value to have a Stereotype, I just don't understand why we get automatically a formatting for use which we cannot disable (I'm talking about the << and >>).

Thanks!
commented Mar 20, 2019 by plantuml (295,000 points)
Right now, there is no way of doing what you want.
It's because << / >> are the standard way of printing Stereotype.

There is one skinparam which somehow changes this :

http://www.plantuml.com/plantuml/uml/1S713O0W30NGErDq449OfT6F8RP0-ENWzhvN6RhZk2M-VIpTwlASRWP7I5CZqcLAIfjJScPWOyQtK4gg6FTn-m40

@startuml
skinparam guillemet false
class foo <<stereotype>>
@enduml

But this is still not what you are looking for.

If you really want to, we could add another value (for example none), so that

@startuml
skinparam guillemet none
class foo <<stereotype>>
@enduml
Would print stereotype, but without the << and >>.
Is this what you are looking for ?
commented Mar 20, 2019 by javabien (120 points)
Yes, that's what I wanted, but what I suggested was even more flexible, because maybe some people want to keep a special formatting for the stereotypes, they just don't want this one.

So instead of:
<< stereotype >>
We could want:
[ stereotype ]
It's just in my case, I want
stereotype
... because in my case, anyway, I just prefer to put a line:


http://www.plantuml.com/plantuml/png/SoWkIImgAStDuSh8J4bLA2v9BKhDBwaiIEKgBKvDJYnELKZBprUmiK58sDaf91OhA76LP9Raf7BfwdAL9UQKfXf2A2Ck9Iw7rBmKe840
0 votes
answered Mar 22, 2019 by plantuml (295,000 points)

Ok, so with last beta http://beta.plantuml.net/plantuml.jar you can now have:

@startuml
skinparam guillemet none
class foo <<stereotype>>
@enduml
@startuml
skinparam guillemet [ ]
class foo <<stereotype>>
@enduml
@startuml
skinparam guillemet $$ $$
class foo <<stereotype>>
@enduml

Is it what you are expecting ?

commented Mar 23, 2019 by anonymous
Thanks, that's what I was suggesting

The problem is, it works well with the examples you provided, but in my case, I replaced class by usecase and it doesn't work with "none"


java.lang.UnsupportedOperationException
    at net.sourceforge.plantuml.Guillemet.manageGuillemet(Guillemet.java:77)
    at net.sourceforge.plantuml.cucadiagram.Stereotype.getLabel(Stereotype.java:248)
    at net.sourceforge.plantuml.svek.image.EntityImageUseCase.<init>(EntityImageUseCase.java:91)
    at net.sourceforge.plantuml.svek.GeneralImageBuilder.createEntityImageBlock(GeneralImageBuilder.java:400)
    at net.sourceforge.plantuml.svek.GeneralImageBuilder.printEntityInternal(GeneralImageBuilder.java:308)
    at net.sourceforge.plantuml.svek.GeneralImageBuilder.printEntity(GeneralImageBuilder.java:288)
    at net.sourceforge.plantuml.svek.GeneralImageBuilder.printEntities(GeneralImageBuilder.java:280)
    at net.sourceforge.plantuml.svek.GeneralImageBuilder.buildImage(GeneralImageBuilder.java:150)
    at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFileInternal(CucaDiagramFileMakerSvek.java:105)
    at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek.createFile(CucaDiagramFileMakerSvek.java:71)
    at net.sourceforge.plantuml.cucadiagram.CucaDiagram.exportDiagramInternal(CucaDiagram.java:379)
    at net.sourceforge.plantuml.UmlDiagram.exportDiagramNow(UmlDiagram.java:248)
    at net.sourceforge.plantuml.AbstractPSystem.exportDiagram(AbstractPSystem.java:135)
    at net.sourceforge.plantuml.PSystemUtils.exportDiagramsCuca(PSystemUtils.java:236)
    at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(PSystemUtils.java:92)
    at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:157)
    at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:508)
    at net.sourceforge.plantuml.Run.processArgs(Run.java:403)
    at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:372)
    at net.sourceforge.plantuml.Run.main(Run.java:188)

Could you double check please?
commented Mar 23, 2019 by plantuml (295,000 points)
Thanks for the feedback.
This is solved in last beta http://beta.plantuml.net/plantuml.jar
Tell us if you find other issues : this has been only slightly tested.
...