Sunday 5 November 2023

Styling Decisions: Enhancing Conditions in PlantUML Activity Diagrams

Following condition styles are supported in activity diagram.

a.   Inside style : It is the default style

b.   Diamond style

c.    InsideDiamond style

 

Inside style

Inside style is the default one.

 

insideConditionStyle.txt

@startuml

skinparam conditionStyle inside

title "Print the file data to console"

!pragma useVerticalIf on

start

repeat
	:read next 1024 bytes from file into the buffer;
	:print the buffer data to console;
repeat while (have more data?) is (yes)

->no;

stop
@enduml

Above snippet generate below diagram.



 

Have a note about (have more data?) widget in the above diagram, let's compare this widget in diamond style.

skinparam conditionStyle diamond

diamondConditionalStyle.txt

@startuml

skinparam conditionStyle diamond

title "Print the file data to console"

!pragma useVerticalIf on

start

repeat
	:read next 1024 bytes from file into the buffer;
	:print the buffer data to console;
repeat while (have more data?) is (yes)

->no;

stop
@enduml

 


Inside Diamond

skinparam conditionStyle InsideDiamond

insideDiamondStyle.txt

@startuml

skinparam conditionStyle InsideDiamond

title "Print the file data to console"

!pragma useVerticalIf on

start

repeat
	:read next 1024 bytes from file into the buffer;
	:print the buffer data to console;
repeat while (have more data?) is (yes)

->no;

stop
@enduml

 


 

You can observe that the condition text (have more data?) appeared inside the diamond.

 

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment