Skip to content
Pharo support for PlantUML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.project
README.md

README.md

PlantUMLPharoGizmo

Pharo support for PlantUML.

Note: The GUI part of this project was initially done in Spec 2, which works best in Pharo 8. However, the baseline will load a GUI that works with Pharo 7.

Demo video of prototype

TODO:

  • drop-down menu of example diagrams

Loading

Metacello new
  repository: 'github://fuhrmanator/PlantUMLPharoGizmo/src';
  baseline: 'PUGizmo';
  load.

Example

Class diagrams using a Moose Java model

One reason I wanted to get PlantUML working in Pharo was to use it with Moose. There's a utility method to generate PlantUML source for a Java model in Moose. Prerequisite: I generated an MSE file for the sample project FactoryVariants and loaded it in Moose.

| classes pUMLSource commaFlag |
classes := (MooseModel root first allClasses reject:#isStub) 
  select: [:c | c mooseName beginsWith: 'headfirst::designpatterns::factory::pizzaaf'].
pUMLSource := PUGizmo plantUMLSourceForMooseJavaClasses: classes.
key := pUMLSource asPlantUMLKey.
"using a local server"
serverUrl := 'http://localhost:8080/plantuml/img/', key .
imageMorph := (ZnEasy getPng: serverUrl asUrl) asAlphaImageMorph .
imageMorph layout: #scaledAspect.
w := imageMorph openInWindow.
w center; fitInWorld.

Class diagram

Simple class diagram

plantUMLSource := ('@startuml' , String cr ,
'skinparam style strictuml' , String cr ,
'skinparam backgroundcolor transparent' , String cr ,
'skinparam classbackgroundcolor Yellow/LightYellow' , String cr ,
'class Banana' , String cr ,
'note right #red: Ceci n''est pas\nune banane. ' , String cr ,
'@enduml').

codePart := plantUMLSource plantDeflateAndEncode.

serverUrl := 'https://www.plantuml.com/plantuml/img/', codePart.
(ZnEasy getPng: serverUrl) asMorph openInWindow.

"Get the Source back from a URL"
recoveredSource := serverUrl plantUrlStringToPlantSourceString.

self assert: recoveredSource equals: plantUMLSource.

Class diagram

Mind map

plantUMLSource := Character cr join: #('@startmindmap' '* Debian' '** Ubuntu' '*** Linux Mint' '*** Kubuntu' '*** Lubuntu' '*** KDE Neon' '** LMDE' '** SolydXK' '** SteamOS' '** Raspbian with a very long name' '*** <s>Raspmbc</s> => OSMC' '*** <s>Raspyfi</s> => Volumio' '@endmindmap').

codePart := plantUMLSource plantDeflateAndEncode.

serverUrl := 'https://www.plantuml.com/plantuml/img/', codePart.
(ZnEasy getPng: serverUrl) asMorph openInWindow.

Mind map

You can’t perform that action at this time.