a way to set note leveling by a skinparam

0 votes
asked Jan 22 in Wanted features by boshka (2,770 points)
edited Jan 23 by boshka
I would want to be able to define and use note levels in a way similar to commonly known "log level".

Such as:

note right INFO

         info text

end note

note right WARN: warn text

note right ERROR: error text

Then, depending on a skinparam, for example:

skinparam noteLevel WARN

I would display all WARN notes and hide all other notes.

skinparam noteLevel should also support NONE value for an ability to hide all notes (as requested in http://forum.plantuml.net/7011/a-parameter-to-disable-hide-all-notes-in-a-diagram)

By default, i think, all notes can be considered as INFO level

3 Answers

0 votes
answered Jan 25 by Anthony-Gaudino (7,640 points)

Currently you can set styles for notes.

Ex of blue note:

note right of a #Blue: This is a blue note.

You can also specify a stereotype on notes and use those on skinparam, see 

http://forum.plantuml.net/3891.

commented Jan 25 by boshka (2,770 points)
edited Jan 25 by boshka
hukameniz, thank you. However, my request was not about styling, but about controlling if the note would appear or not in the diagram based on the noteLevel setting. Similar to log level - commonly known logging technique - where if one wants to filter log messages based on message severity, he mey define the severity for each message and use the log level setting for the logging.

Say, my diagram has notes of the following levels:
- INFO
- WARN
- ERROR
Now, I want to filter INFO and WARN from the diagram. So, I set a param, say noteLevel  to ERROR (severity to be displayed >= ERROR)
If I want ERRORs and WARNs to appear - i set the param to WARN (severity to be displayed > =WARN),
If I want all messages to appear - i set the param to INFO, or skip the parameter.
0 votes
answered Jan 26 by Serge Wenger Work (9,630 points)

You can use macros. I create a little proof of concept:

@startuml
!define SHOW_NOTE
!define SHOW_WARNING
!define SHOW_ERROR

!definelong NoteInfo(TEXT_NOTE)
!ifdef (SHOW_NOTE)
note right
TEXT_NOTE
end note
!endif
!enddefinelong
!definelong NoteError(TEXT_NOTE)
!ifdef (SHOW_ERROR)
note right
TEXT_NOTE
end note
!endif
!enddefinelong
participant Bob
participant Alice

Bob -> Alice : hello
NoteInfo(aaa)
Alice -> Bob: hello
NoteError(bbb)
@enduml

commented Jan 26 by boshka (2,770 points)
edited Jan 26 by boshka
thank you, that is a workaround, however, does require refactoring of all existing iuml codes.
I would prefer something similar, but available "out of box", so that i don't need to call a special macro and keep backward compatibility. However, when i need i could mark some notes as needed and make filtration.

Also, notes have different notations in different diagrams, so (with this workaround) I would need to create specific macro for all notations... Such a thing would not be straightforward for everyone.

A built-in simple notation for that would be much more preferable.
Thank you!
0 votes
answered Feb 18 by Anthony-Gaudino (7,640 points)

OK, so it would be better to have a hide note command and a way to hide notes based on their stereotype.

...