plantuml

PlantUml Sequence diagram - Adding Space Before Activate


How can I have a gap/space before an activate? This is similar to this question, except mine isn't about having a gap/space after an arrow, but after an activate (the blue vertical line below).

Sample plantuml:

actor Client
participant Server

Client->Server: before space, with no activate

||45|| 

Client->Server: after space with no activate

Client->Server: before space with activate

||45|| 

activate Client #blue
Client->Server: after activate with space

deactivate Client

Client->Server: after deactivate

This produces the following:

enter image description here

I want it to look like this:

enter image description here


Solution

  • Although it's not standard UML (since an activation box is usually associated with an incoming message that signifies how an object becomes activated), it is possible to make space before an activation object by putting a hidden message -[hidden]> Client that comes from no place before the activation.

    @startuml
    actor Client
    participant Server
    
    Client->Server: before space, with no activate
    
    ||45|| 
    
    Client->Server: after space with no activate
    
    Client->Server: before space with activate
    
    -[hidden]> Client
    
    ||45|| 
    
    activate Client #blue
    Client->Server: after activate with space
    
    deactivate Client
    
    Client->Server: after deactivate
    @enduml
    

    Sequence diagram with hidden message to make vertical space before an activation bar