how can I mark several class's fields in one same note in the class diagram

0 votes
asked Dec 22, 2020 in Question / help by anonymous
I'd like to just make the same note on several fields in class diagram, how could I do it?
commented Dec 22, 2020 by albert (3,520 points)
Please show the diagram where you want to place notes and indicate with which items you want to have a note.
commented Dec 22, 2020 by anonymous
for example:

interface HostSession{
      +spawn_removed(): void
      +child_added(): void
      +child_removed(): void
      +process_crashed(): void
      +output(): void
      +uninjected(): void
    }
I hope to put note left of HostSession::process_crashed, output and uninjected.
the note is: these 3 functions are implemented in LinuxHostSeesion.

I didn't know how to attach pics, so upload one pic in address below:

https://imgchr.com/i/rsud29

thanks.
commented Dec 22, 2020 by albert (3,520 points)

An idea I had was to use a syntax like:

@startuml
interface HostSession{
      +spawn_removed(): void
      +child_added(): void
      +child_removed(): void
      +process_crashed(): void
      +output(): void
      +uninjected(): void
    }
note left of HostSession::process_crashed, HostSession::uninjected
   This method is now explained in a UML note
endnote


@enduml

a bit analogous to the "note over" with the sequence diagrams (https://forum.plantuml.net/83/how-to-put-note-over-several-participants-sequence-diagrams), but this doesn't work.

Maybe there is a solution or an enhancement to plantuml is needed.

commented Dec 23, 2020 by anonymous
Thanks, it's a good idea, The-Lu also gives a proposal below

1 Answer

0 votes
answered Dec 22, 2020 by The-Lu (63,920 points)

Hello A.,

You can use floating note, here is a proposal:

@startuml
interface HostSession{
      +spawn_removed(): void
      +child_added(): void
      +child_removed(): void
      +process_crashed(): void
      +output(): void
      +uninjected(): void
    }

note "These 3 functions are implemented\nin LinuxHostSeesion." as N1

N1 -> HostSession::process_crashed
N1 -> HostSession::output
N1 -> HostSession::uninjected
@enduml


[See on PlantUML server]

See also documentation here:

If that can help,
Regards,
Th.

commented Dec 23, 2020 by H

Thanks, it's a good proposal, plantuml is really a good tool!  but there is another problem:


@startuml vala

    class Device{ 
        +id: string 
        +name: string 
        +icon:Icon? 
        +dtype: DeviceType 
        +provider: HostSessionProvider 
        +manager: DeviceManager 
        +main_context: MainContext 

        -check_open (): void 
        -check_process(): Process 
        -on_host_session_closed(): void 
        -attach_host_session(): void 
        -detach_host_session(): void
        -on_agent_session_closed(): void
        -on_spawn_added(): void
        -on_spawn_removed(): void
        -on_child_added(): void
        -on_child_removed(): void
        -on_process_crashed(): void
        -on_output(): void
        -on_uninjected(): void
        -create<T> ():T 
    }

note "N1 These 2 functions are implemented\nin BaseHostSeesion." as N1
note "N2 These 2 functions are implemented\nin LinuxHostSeesion." as N2

N1 -> Device::check_open
N1 -> Device::check_process

N2 -> Device::on_output
N2 -> Device::on_uninjected

@enduml


you could find that the link line of N1 looks not good, the only way I can do is to put one note right of class, "N2 -left[hidden]- Device", but if there are more notes, it will be messy again. the note direction can only be adjusted in left, right, up and down. if the note direction can be adjusted vertically(it seems the note aligns with class and can't move vertically), it will be perfect!

commented Dec 23, 2020 by Serge Wenger Work (15,620 points)

You could try to use together also:

together {
note "N1 These 2 functions are implemented\nin BaseHostSeesion." as N1
note "N2 These 2 functions are implemented\nin LinuxHostSeesion." as N2
N1 -[hidden]down- N2
}
together {
note "N3 These 2 functions are implemented\nin aaaaaaaaaa." as N3
note "N4 These 2 functions are implemented\nin bbbbbbbbbbbb." as N4
note "N5 These 2 functions are implemented\nin ccccccccccccc." as N5
N3 -[hidden]down- N4
N4 -[hidden]down- N5
}

See on PlantUML Server

commented Dec 23, 2020 by anonymous
wow!! it works, you are so good!! thanks!
...