diff --git a/.github/workflows/plantuml_docs_synd_and_process.yml b/.github/workflows/plantuml_docs_synd_and_process.yml new file mode 100644 index 00000000..34021f4a --- /dev/null +++ b/.github/workflows/plantuml_docs_synd_and_process.yml @@ -0,0 +1,45 @@ +name: PLANTUML DOCS Sync docs from alphadoc and process antora + +on: + workflow_dispatch: + inputs: + fetch_docs: + description: 'Fetch docs from alphadoc?' + required: true + default: true + type: boolean +concurrency: + group: 'plantuml_docs_sync_and_process' + cancel-in-progress: true +jobs: + ci: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: plantuml-docs + steps: + - name: Checkout Source + uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 19 + - run: npm ci + - name: Fetch docs from alphadoc + run: | + npm run fetchDocsFromAlphadoc + if: ${{ inputs.fetch_docs }} + - name: Process antora docs + run: | + npm run processAntoraDocsComponent + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v4 + with: + commit-message: Fetch latest docs from alphadoc + delete-branch: true + title: '[Sync Docs] Fetch latest docs' + body: | + Automated sync docs from alphadoc. + labels: | + automated pr diff --git a/plantuml-docs/.gitignore b/plantuml-docs/.gitignore new file mode 100644 index 00000000..dd87e2d7 --- /dev/null +++ b/plantuml-docs/.gitignore @@ -0,0 +1,2 @@ +node_modules +build diff --git a/plantuml-docs/_antora/supplemental-ui/.nojekyll b/plantuml-docs/_antora/supplemental-ui/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/plantuml-docs/_antora/supplemental-ui/css/site-extra.css b/plantuml-docs/_antora/supplemental-ui/css/site-extra.css new file mode 100644 index 00000000..c5fb5dcb --- /dev/null +++ b/plantuml-docs/_antora/supplemental-ui/css/site-extra.css @@ -0,0 +1,13 @@ +.plantuml-diagram { + overflow: hidden; +} + +.plantuml-diagram .listingblock { + float: left; + overflow: hidden; +} + +.plantuml-diagram .img { + float: left; + overflow: hidden; +} diff --git a/plantuml-docs/_antora/supplemental-ui/helpers/removeFileExtension.js b/plantuml-docs/_antora/supplemental-ui/helpers/removeFileExtension.js new file mode 100644 index 00000000..2024ab08 --- /dev/null +++ b/plantuml-docs/_antora/supplemental-ui/helpers/removeFileExtension.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports = (string) => { + return string.replace(/\.[^/.]+$/, "") +} diff --git a/plantuml-docs/_antora/supplemental-ui/img/github-mark-white.png b/plantuml-docs/_antora/supplemental-ui/img/github-mark-white.png new file mode 100644 index 00000000..50b81752 Binary files /dev/null and b/plantuml-docs/_antora/supplemental-ui/img/github-mark-white.png differ diff --git a/plantuml-docs/_antora/supplemental-ui/js/site-extra.js b/plantuml-docs/_antora/supplemental-ui/js/site-extra.js new file mode 100644 index 00000000..1c6d9138 --- /dev/null +++ b/plantuml-docs/_antora/supplemental-ui/js/site-extra.js @@ -0,0 +1,6 @@ +(function() { + // uml diagrams are toggled by default + if(window.location.pathname.endsWith('docs/main/index.html')){ + document.querySelector('.nav-item[data-depth="0"]:nth-child(2)').classList.add("is-active") + } + })(); diff --git a/plantuml-docs/_antora/supplemental-ui/partials/footer-scripts.hbs b/plantuml-docs/_antora/supplemental-ui/partials/footer-scripts.hbs new file mode 100644 index 00000000..f53e6479 --- /dev/null +++ b/plantuml-docs/_antora/supplemental-ui/partials/footer-scripts.hbs @@ -0,0 +1,6 @@ + + + +{{#if env.SITE_SEARCH_PROVIDER}} +{{> search-scripts}} +{{/if}} diff --git a/plantuml-docs/_antora/supplemental-ui/partials/head-meta.hbs b/plantuml-docs/_antora/supplemental-ui/partials/head-meta.hbs new file mode 100644 index 00000000..41952e13 --- /dev/null +++ b/plantuml-docs/_antora/supplemental-ui/partials/head-meta.hbs @@ -0,0 +1 @@ + diff --git a/plantuml-docs/_antora/supplemental-ui/partials/header-content.hbs b/plantuml-docs/_antora/supplemental-ui/partials/header-content.hbs new file mode 100644 index 00000000..53b0340b --- /dev/null +++ b/plantuml-docs/_antora/supplemental-ui/partials/header-content.hbs @@ -0,0 +1,73 @@ +
+ +
diff --git a/plantuml-docs/_antora/supplemental-ui/partials/toolbar.hbs b/plantuml-docs/_antora/supplemental-ui/partials/toolbar.hbs new file mode 100644 index 00000000..9706cebe --- /dev/null +++ b/plantuml-docs/_antora/supplemental-ui/partials/toolbar.hbs @@ -0,0 +1,13 @@ + diff --git a/plantuml-docs/_antora/supplemental-ui/ui.yml b/plantuml-docs/_antora/supplemental-ui/ui.yml new file mode 100644 index 00000000..1f02564c --- /dev/null +++ b/plantuml-docs/_antora/supplemental-ui/ui.yml @@ -0,0 +1 @@ +static_files: [.nojekyll] diff --git a/plantuml-docs/_antora/ui-bundle.zip b/plantuml-docs/_antora/ui-bundle.zip new file mode 100644 index 00000000..2488177d Binary files /dev/null and b/plantuml-docs/_antora/ui-bundle.zip differ diff --git a/plantuml-docs/_asciidoc/extensions/plantuml-source-block.js b/plantuml-docs/_asciidoc/extensions/plantuml-source-block.js new file mode 100644 index 00000000..02752ddd --- /dev/null +++ b/plantuml-docs/_asciidoc/extensions/plantuml-source-block.js @@ -0,0 +1,20 @@ +const plantumlEncoder = require('plantuml-encoder') + +module.exports = function (registry) { + registry.block(function () { + const self = this + self.named('plantuml') + self.onContext('listing') + self.process(function (parent, reader) { + const lines = reader.getLines() + + const codeBlock = `
${lines.join("\n")}
` + + const imagePath = plantumlEncoder.encode(lines.join("\n")) + const imageBlock = `` + + const html = `
${codeBlock} ${imageBlock}
` + return self.createBlock(parent, 'pass', html, {}, {}) + }) + }) +} diff --git a/plantuml-docs/antora-playbook.yml b/plantuml-docs/antora-playbook.yml new file mode 100644 index 00000000..0d527d84 --- /dev/null +++ b/plantuml-docs/antora-playbook.yml @@ -0,0 +1,23 @@ +site: + title: PlantUML Alternative Docs + start_page: docs::index.adoc + robots: disallow + # keys: + # google_analytics: XX-123456 + # url: https://plantuml.github.io/plantuml-alternative-docs/ +content: + sources: + - url: .. + branches: HEAD + start_path: plantuml-docs +ui: + bundle: + url: _antora/ui-bundle.zip + snapshot: true + supplemental_files: _antora/supplemental-ui +antora: + extensions: + - require: '@antora/lunr-extension' +asciidoc: + extensions: + - ./_asciidoc/extensions/plantuml-source-block.js \ No newline at end of file diff --git a/plantuml-docs/antora.yml b/plantuml-docs/antora.yml new file mode 100644 index 00000000..81686e6a --- /dev/null +++ b/plantuml-docs/antora.yml @@ -0,0 +1,5 @@ +name: docs +version: 'main' +title: Docs +nav: + - modules/ROOT/nav.adoc diff --git a/plantuml-docs/docs_from_alphadoc/.gitkeep b/plantuml-docs/docs_from_alphadoc/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/plantuml-docs/docs_from_alphadoc/a_begin_for_this_wiki.adoc b/plantuml-docs/docs_from_alphadoc/a_begin_for_this_wiki.adoc new file mode 100644 index 00000000..055b4a53 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/a_begin_for_this_wiki.adoc @@ -0,0 +1,364 @@ +== A begin for this wiki... + +__(in order to be on the top of the TOC... ;-)__ + + +== For starting + +You can read : link::start[the start page]. + + +== Issues: __"If you see something, say something"__ + +For that, you can go the link::issues[issues page]. + + +== Improve Documentation + +Contribute by: +* by improving the English PlantUML documentation +* by translating the English pages +* by adding new topics... +* helping with the huge categorized list of https://github.com/plantuml/plantuml/issues/261[Undocumented plantuml features] (100-200 tasks gathered from the forum) that needs your help! +* here is the page, on **this wiki**, for follow link::undocumented[Undocumented PlantUML features in order to document] + +Here's how to start: +* go to the http://alphadoc.plantuml.com/toc/[TOC] or mini-TOC (below) +* select your preferred wiki syntax +* select your language __(if you want to translate)__ +* and select a topic. + + +== Wiki Mini TOC + +This section lists all pages in a categorized listing, whereas http://alphadoc.plantuml.com/toc/markdown/en[Wiki TOC] also lists all subsections. + +=== This Documentation Wiki +* link::start[Start] +* link::a_begin_for_this_wiki[A Begin for This Wiki] +* link::menu[Menu translation] +* link::formatting[formatting] +* link::syntax-asciidoc[syntax-asciidoc] +* link::syntax-dokuwiki[syntax-dokuwiki] +* link::syntax-markdown[syntax-markdown] +* link::poll-about-wiki-syntax[poll-about-wiki-syntax] + +=== Intro +* link::index[Index] +* link::starting[Quick Start] +* link::faq[FAQ] +* http://plantuml.com/guide[PlantUML Language Reference Guide] +* https://plantuml.com/running[Running with Other Tools] +* link::what-is-a-software-modeling-tool[What is a Software Modeling Tool] + +=== Diagrams + +The default header/footer (or StartTag/EndTag) are `+@startuml+`/`+@enduml+`. + +|=== +| Diagram | Diagram Issues | Header | Keyword | Sub-diagram Keyword + +| link::activity-diagram-beta[Activity] +| link::activity-diagram-issues[Activity Issues] +| +| +| + +| link::activity-diagram-beta#vmm58ifz7wd3k362kj5w[Activity - Specification and Description Language (SDL)] +| +| +| +| + +| link::activity-diagram-legacy[Activity-legacy] [[#FF6600#deprecated]] +| +| +| +| + +| link::archimate-diagram[Archimate] +| +| +| +| + +| link::bpmn[Business Process Modeling Notation (BPMN)] +| +| @startbpm +| +| + +| link::board-diagram[Board or User Story Maps+++
+++(๐Ÿšง __under construction__)] +| +| @startboard +| +| {{board + +| link::class-diagram[Class] +| link::class-diagram-issues[Class Issues] +| +| +| + +| link::component-diagram[Component] +| link::deployment-diagram-issues[Deployment Issue] +| +| +| + +| link::deployment-diagram[Deployment] +| link::deployment-diagram-issues[Deployment Issue] +| +| +| + +| link::ebnf[EBNF+++
+++(๐Ÿ†• functionality)] +| link::ebnf-issues[EBNF Issues] +| @startebnf +| +| {{ebnf + +| link::gantt-diagram[Gantt project planning] +| +| @startgantt +| +| {{gantt + +| link::ie-diagram[Information Engineering (IE) / Entity Relationship (ER)] +| +| +| +| + +| link::json[JSON] +| link::json-issues[JSON Issues] +| @startjson +| +| {{json + +| link::mindmap-diagram[MindMap] +| +| @startmindmap +| +| {{mindmap + +| link::nwdiag[Network (nwdiag)] +| link::nwdiag-issues[Network Issue] +| @startnwdiag +| nwdiag {+++
+++} +| + +| link::object-diagram[Object] +| +| +| +| + +| link::problem-diagram[Problem diagram] +| +| +| +| + +| link::sequence-diagram[Sequence] +| +| +| +| + +| link::state-diagram[State] +| link::state-diagram-issues[State Issue] +| +| +| + +| link::timing-diagram[Timing] +| link::timing-diagram-issues[Timing Issue] +| +| +| + +| link::use-case-diagram[Use-Case] +| link::deployment-diagram-issues[Deployment Issue] +| +| +| + +| link::wbs-diagram[Work Breakdown Structure (WBS)] +| +| @startwbs +| +| {{wbs + +| link::salt[Wireframe (SALT)] +| +| @startsalt +| salt+++
+++{+++
+++} +| + +| link::wire-diagram[Wire or Block Diagram+++
+++(๐Ÿ†• __beta version to test__)] +| +| @startwire +| +| {{wire [[#00CC00#Version 1.2021.01]] + +| link::yaml[YAML] +| +| @startyaml +| +| {{yaml [[#00CC00#Version 1.2021.01]] + +|=== + +=== Other Diagrams/Games + +|=== +| Diagram | Header | Keyword | Sub-diagram Keyword | Command + +| link::creole[Creole] +| @startcreole +| +| +| + +| link::ditaa[ditaa] +| @startditaa +| ditaa +| +| (--no-separation, --no-shadows, scale=) + +| link::dot[Dot] +| @startdot +| digraph {+++
+++} +| +| + +| link::ascii-math[Math] +| @startmath +| `+...+` +| +| + +| link::ascii-math[LaTeX] +| @startlatex +| `+...+` +| +| + +| link::oregon-trail[Oregon Trail] +| +| +| +| run oregon trail + +| link::sudoku[Sudoku] +| +| +| +| sudoku + +| link::xearth[XEarth] +| +| +| +| xearth + +|=== + +=== Common/Markup/Layout +* link::commons[commons] +* link::ascii-math[๐Ÿงฎ AsciiMath] +* link::color[๐ŸŒˆ color] +* link::creole[creole] +* link::font[๐Ÿ”ค font] +* link::gfm-support[GFM-support] +* link::handwritten[โœ handwritten] +* link::notes[๐Ÿ—จ notes] +* link::link[๐Ÿ”— link] +* link::openiconic[openiconic] +* link::skinparam[skinparam] +* link::sprite[sprite] +* link::style-evolution-history[style-evolution-history] +* link::style-evolution[๐ŸŽจ๐Ÿ–Œ๏ธstyle-evolution (Style or CSS like style)] +* link::using-a-citation-manager[using-a-citation-manager] +* link::poll-about-package-and-namespace[poll-about-package-and-namespace] + +=== Preprocessing/Libraries +* link::stdlib[๐Ÿ“š stdlib] +* link::theme[๐Ÿ–ผ๏ธ theme] +* link::theme-gallery[๐Ÿ–ผ๏ธ๐Ÿ—ƒ theme Gallery] +* link::preprocessing[โš™ preprocessing __(new)__] +* link::preprocessing-json[preprocessing-json] +* link::preprocessing-gallery[โš™๐Ÿ—ƒ Preprocessing Gallery] +* link::preprocessing-v2[preprocessing-v2 __(old)__] [[#FF6600#deprecated]] +* link::plantumlshell[plantumlshell __(very old)__] [[#FF6600#deprecated]] + +=== URL Authentication +* link::url-authentication[URL-Authentication] +** link::url-basicauth[URL-BasicAuth] +** link::url-oauth[URL-OAauth] +** link::url-tokenauth[URL-TokenAuth] + +=== Alternative Layouters +* link::smetana02[Smetana] +* link::elk[ELK] +* link::svek[Svek] +* link::teoz[Teoz] +* link::vizjs[VizJs] + +=== Executing +* link::command-line[Command-line] +* link::faq-install[FAQ-install] +* link::ftp[FTP] +* link::gui[GUI] +* link::graphviz-dot[Graphviz-dot] +* link::server[Server] +* link::sources[Sources] +* link::security[Security] +* link::starting[Starting] +* link::statistics-report[Statistics-report] +* link::text-encoding[Text-encoding] +* link::unicode[Unicode] +* link::versioning-scheme[Versioning-scheme] + +=== Alternative Output +* link::ascii-art[ASCII-art] +* link::eps[EPS] +* link::latex[LaTeX] +* link::pdf[PDF] +* link::svg[SVG] + +=== Integrations + +__(see https://plantuml.com/running[running] for a lot more links, unfortunately that page is not on alphadocs)__ + +* link::ant-task[Ant-task] +* link::doclet[Doclet] +* link::docutils[Docutils] +* link::doxygen[Doxygen] +* link::eclipse[Eclipse] +* link::emacs[Emacs] +* link::javadoc[Javadoc] +* link::jquery[JQuery] +* link::pmwiki[PmWiki] +* link::word[Word] +* link::xmi[XMI] + +=== Programming +* link::developers[Developers] +* link::api[API] +* link::code-groovy[code-groovy] +* link::code-javascript-asynchronous[code-javascript-asynchronous] +* link::code-javascript-synchronous[code-javascript-synchronous] +* link::code-php[code-php] + +=== Support and Appreciation +* link::patreon-support[Patreon-support] +* link::donors[Donors] +* link::external-links[External-links]: Projects using PlantUML, Learn & Teach with PlantUML, etc. +* link::professional[Professional] +* link::issues[Wiki Issues] +* link::dedication[Dedication] +* link::steve[Steve Jobs] + + diff --git a/plantuml-docs/docs_from_alphadoc/activity-diagram-beta.adoc b/plantuml-docs/docs_from_alphadoc/activity-diagram-beta.adoc new file mode 100644 index 00000000..f5943601 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/activity-diagram-beta.adoc @@ -0,0 +1,1289 @@ +== Activity Diagram (new) + +Old link::activity-diagram-legacy[syntax for activity diagram] had several limitations and +drawbacks (for example, it's difficult to maintain). + +So a completely new syntax and implementation is now available to users. Another advantage of this implementation is that it's done without the need of having +Graphviz installed (as for sequence diagrams). + +This syntax will replace the old legacy one. However, for compatibility reason, the old syntax will still be recognized, to ensure __ascending compatibility__. + +Users are simply encouraged to migrate to the new syntax. + + +== Simple action +Activities label starts with `+:+` and ends with `+;+`. + +Text formatting can be done using link::creole[creole wiki syntax]. + +They are implicitly linked in their definition order. + +@startuml +:Hello world; +:This is defined on +several **lines**; +@enduml + + + +== Start/Stop/End + +You can use `+start+` and `+stop+` keywords to denote the +beginning and the end of a diagram. + + +@startuml +start +:Hello world; +:This is defined on +several **lines**; +stop +@enduml + + +You can also use the `+end+` keyword. + +@startuml +start +:Hello world; +:This is defined on +several **lines**; +end +@enduml + + + +== Conditional + +You can use `+if+`, `+then+` and `+else+` keywords to put tests in your diagram. +Labels can be provided using parentheses. + +The 3 syntaxes are possible: +* `+if (...) then (...)+` + +@startuml + +start + +if (Graphviz installed?) then (yes) + :process all\ndiagrams; +else (no) + :process only + __sequence__ and __activity__ diagrams; +endif + +stop + +@enduml + + +* `+if (...) is (...) then+` + +@startuml +if (color?) is (red) then +:print red; +else +:print not red; +@enduml + + +* `+if (...) equals (...) then+` + +@startuml +if (counter?) equals (5) then +:print 5; +else +:print not 5; +@enduml + + +__[Ref. https://forum.plantuml.net/301/activity-diagram-beta?show=302#a302[QA-301]]__ + +=== Several tests (horizontal mode) + +You can use the `+elseif+` keyword to have several tests __(by default, it is the horizontal mode)__: + + +@startuml +start +if (condition A) then (yes) + :Text 1; +elseif (condition B) then (yes) + :Text 2; + stop +(no) elseif (condition C) then (yes) + :Text 3; +(no) elseif (condition D) then (yes) + :Text 4; +else (nothing) + :Text else; +endif +stop +@enduml + + +=== Several tests (vertical mode) + +You can use the command `+!pragma useVerticalIf on+` to have the tests in vertical mode: + + +@startuml +!pragma useVerticalIf on +start +if (condition A) then (yes) + :Text 1; +elseif (condition B) then (yes) + :Text 2; + stop +elseif (condition C) then (yes) + :Text 3; +elseif (condition D) then (yes) + :Text 4; +else (nothing) + :Text else; +endif +stop +@enduml + + +You can use the `+-P+` link::command-line[command-line] option to specify the pragma: + +---- +java -jar plantuml.jar -PuseVerticalIf=on +---- + +__[Refs. https://forum.plantuml.net/3931/please-provide-elseif-structure-vertically-activity-diagrams[QA-3931], https://github.com/plantuml/plantuml/issues/582[issue-582]]__ + + +== Switch and case [switch, case, endswitch] + +You can use `+switch+`, `+case+` and `+endswitch+` keywords to put switch in your diagram. + +Labels can be provided using parentheses. + + + +@startuml +start +switch (test?) +case ( condition A ) + :Text 1; +case ( condition B ) + :Text 2; +case ( condition C ) + :Text 3; +case ( condition D ) + :Text 4; +case ( condition E ) + :Text 5; +endswitch +stop +@enduml + + + +== Conditional with stop on an action [kill, detach] + +You can stop action on a if loop. + +@startuml +if (condition?) then + :error; + stop +endif +#palegreen:action; +@enduml + + +But if you want to stop at the precise action, you can use the `+kill+` or `+detach+` keyword: + +* `+kill+` + +@startuml +if (condition?) then + #pink:error; + kill +endif +#palegreen:action; +@enduml + + +__[Ref. https://forum.plantuml.net/265/new-activity-diagram-syntax-direction-of-links?show=306#a306[QA-265]]__ + +* `+detach+` + +@startuml +if (condition?) then + #pink:error; + detach +endif +#palegreen:action; +@enduml + + + +== Repeat loop + +You can use `+repeat+` and `+repeatwhile+` keywords to have repeat loops. + + +@startuml + +start + +repeat + :read data; + :generate diagrams; +repeat while (more data?) is (yes) +->no; +stop + +@enduml + + +It is also possible to use a full action as `+repeat+` target and insert an action in the return path using the `+backward+` keyword. + + +@startuml + +start + +repeat :foo as starting label; + :read data; + :generate diagrams; +backward:This is backward; +repeat while (more data?) + +stop + +@enduml + + + +== Break on a repeat loop [break] + +You can use the `+break+` keyword after an action on a loop. + +@startuml +start +repeat + :Test something; + if (Something went wrong?) then (no) + #palegreen:OK; + break + endif + ->NOK; + :Alert "Error with long text"; +repeat while (Something went wrong with long text?) is (yes) not (no) +->//merged step//; +:Alert "Success"; +stop +@enduml + + + +__[Ref. https://forum.plantuml.net/6105/possible-to-draw-a-line-to-another-box-via-id-or-label?show=6107#a6107[QA-6105]]__ + + +== Goto and Label Processing [label, goto] + +โš  It is currently only experimental ๐Ÿšง + +You can use `+label+` and `+goto+` keywords to denote goto processing, with: +* `+label +` +* `+goto +` + + +@startuml +title Point two queries to same activity\nwith `goto` +start +if (Test Question?) then (yes) +'space label only for alignment +label sp_lab0 +label sp_lab1 +'real label +label lab +:shared; +else (no) +if (Second Test Question?) then (yes) +label sp_lab2 +goto sp_lab1 +else +:nonShared; +endif +endif +:merge; +@enduml + + +__[Ref. https://forum.plantuml.net/15026/[QA-15026], https://forum.plantuml.net/12526/[QA-12526] and initially https://forum.plantuml.net/1626[QA-1626]]__ + + +== While loop + +You can use `+while+` and `+endwhile+` keywords to have repeat loops. + + +@startuml + +start + +while (data available?) + :read data; + :generate diagrams; +endwhile + +stop + +@enduml + + +It is possible to provide a label after the `+endwhile+` keyword, or using the `+is+` keyword. + + +@startuml +while (check filesize ?) is (not empty) + :read file; +endwhile (empty) +:close file; +@enduml + + +If you are using `+detach+` to form an infinite while loop, then you will want to also hide the partial arrow that results using `+-[hidden]->+` + + +@startuml +:Step 1; +if (condition1) then + while (loop forever) + :Step 2; + endwhile + -[hidden]-> + detach +else + :end normally; + stop +endif +@enduml + + + +== Parallel processing [fork, fork again, end fork, end merge] + +You can use `+fork+`, `+fork again+` and `+end fork+` or `+end merge+` keywords to denote parallel processing. + +=== Simple `+fork+` + +@startuml +start +fork + :action 1; +fork again + :action 2; +end fork +stop +@enduml + + +=== `+fork+` with end merge + +@startuml +start +fork + :action 1; +fork again + :action 2; +end merge +stop +@enduml + +__[Ref. https://forum.plantuml.net/5320/please-provide-fork-without-join-with-merge-activity-diagrams?show=5321#a5321[QA-5320]]__ + + +@startuml +start +fork + :action 1; +fork again + :action 2; +fork again + :action 3; +fork again + :action 4; +end merge +stop +@enduml + + + +@startuml +start +fork + :action 1; +fork again + :action 2; + end +end merge +stop +@enduml + + +__[Ref. https://forum.plantuml.net/13731[QA-13731]]__ + +=== Label on `+end fork+` (or UML joinspec): + +@startuml +start +fork + :action A; +fork again + :action B; +end fork {or} +stop +@enduml + + +@startuml +start +fork + :action A; +fork again + :action B; +end fork {and} +stop +@enduml + + +__[Ref. https://forum.plantuml.net/5346/please-inplement-joinspec-for-join-nodes?show=5348#a5348[QA-5346]]__ + +=== Other example + +@startuml + +start + +if (multiprocessor?) then (yes) + fork + :Treatment 1; + fork again + :Treatment 2; + end fork +else (monoproc) + :Treatment 1; + :Treatment 2; +endif + +@enduml + + + +== Split processing + +=== Split +You can use `+split+`, `+split again+` and `+end split+` keywords to denote split processing. + + +@startuml +start +split + :A; +split again + :B; +split again + :C; +split again + :a; + :b; +end split +:D; +end +@enduml + + +=== Input split (multi-start) +You can use `+hidden+` arrows to make an input split (multi-start): + +@startuml +split + -[hidden]-> + :A; +split again + -[hidden]-> + :B; +split again + -[hidden]-> + :C; +end split +:D; +@enduml + + + +@startuml +split + -[hidden]-> + :A; +split again + -[hidden]-> + :a; + :b; +split again + -[hidden]-> + (Z) +end split +:D; +@enduml + +__[Ref. https://forum.plantuml.net/8662[QA-8662]]__ + +=== Output split (multi-end) + +You can use `+kill+` or `+detach+` to make an output split (multi-end): + + +@startuml +start +split + :A; + kill +split again + :B; + detach +split again + :C; + kill +end split +@enduml + + +@startuml +start +split + :A; + kill +split again + :b; + :c; + detach +split again + (Z) + detach +split again + end +split again + stop +end split +@enduml + + + +== Notes + +Text formatting can be done using link::creole[creole wiki syntax]. + +A note can be floating, using `+floating+` keyword. + +@startuml + +start +:foo1; +floating note left: This is a note +:foo2; +note right + This note is on several + //lines// and can + contain HTML + ==== + * Calling the method ""foo()"" is prohibited +end note +stop + +@enduml + + +You can add note on backward activity: + + +@startuml +start +repeat :Enter data; +:Submit; +backward :Warning; +note right: Note +repeat while (Valid?) is (No) not (Yes) +stop +@enduml + + +__[Ref. https://forum.plantuml.net/11788/is-it-possible-to-add-a-note-to-backward-activity?show=11802#a11802[QA-11788]]__ + + +You can add note on partition activity: + +@startuml +start +partition "**process** HelloWorld" { + note + This is my note + ---- + //Creole test// + end note + :Ready; + :HelloWorld(i)> + :Hello-Sent; +} +@enduml + +__[Ref. https://forum.plantuml.net/2398/is-it-possible-to-add-a-comment-on-top-of-a-activity-partition?show=2403#a2403[QA-2398]]__ + + +== Colors + +You can specify a link::color[color] for some activities. + + +@startuml + +start +:starting progress; +#HotPink:reading configuration files +These files should be edited at this point!; +#AAAAAA:ending of the process; + +@enduml + + +You can also use link::color[gradient color]. + +@startuml +start +partition #red/white testPartition { + #blue\green:testActivity; +} +@enduml + +__[Ref. https://forum.plantuml.net/4906/setting-ad-hoc-gradient-backgrounds-in-activity?show=4917#a4917[QA-4906]]__ + + +== Lines without arrows + +You can use `+skinparam ArrowHeadColor none+` in order to connect activities using lines only, without arrows. + + +@startuml +skinparam ArrowHeadColor none +start +:Hello world; +:This is on defined on +several **lines**; +stop +@enduml + + + + +@startuml +skinparam ArrowHeadColor none +start +repeat :Enter data; +:Submit; +backward :Warning; +repeat while (Valid?) is (No) not (Yes) +stop +@enduml + + + +== Arrows + +Using the `+->+` notation, you can add texts to arrow, and change +their link::color[color]. + +It's also possible to have dotted, dashed, bold or hidden arrows. + + +@startuml +:foo1; +-> You can put text on arrows; +if (test) then + -[#blue]-> + :foo2; + -[#green,dashed]-> The text can + also be on several lines + and **very** long...; + :foo3; +else + -[#black,dotted]-> + :foo4; +endif +-[#gray,bold]-> +:foo5; +@enduml + + + + +== Connector + +You can use parentheses to denote connector. + + +@startuml +start +:Some activity; +(A) +detach +(A) +:Other activity; +@enduml + + + + +== Color on connector + +You can add link::color[color] on connector. + + +@startuml +start +:The connector below +wishes he was blue; +#blue:(B) +:This next connector +feels that she would +be better off green; +#green:(G) +stop +@enduml + + +__[Ref. https://forum.plantuml.net/10077/assigning-color-to-connectors?show=10080#c10080[QA-10077]]__ + + +== Grouping or partition + +=== Group +You can group activity together by defining group: + +@startuml +start +group Initialization + :read config file; + :init internal variable; +end group +group Running group + :wait for user interaction; + :print information; +end group + +stop +@enduml + + +=== Partition +You can group activity together by defining partition: + + +@startuml +start +partition Initialization { + :read config file; + :init internal variable; +} +partition Running { + :wait for user interaction; + :print information; +} + +stop +@enduml + + + +It's also possible to change partition link::color[color]: + + +@startuml +start +partition #lightGreen "Input Interface" { + :read config file; + :init internal variable; +} +partition Running { + :wait for user interaction; + :print information; +} +stop +@enduml + + +__[Ref. https://forum.plantuml.net/2793/activity-beta-partition-name-more-than-one-word-does-not-work?show=2798#a2798[QA-2793]]__ + +It's also possible to add link::link[link] to partition: + +@startuml +start +partition "[[http://plantuml.com partition_name]]" { + :read doc. on [[http://plantuml.com plantuml_website]]; + :test diagram; +} +end +@enduml + +__[Ref. https://forum.plantuml.net/542/ability-to-define-hyperlink-on-diagram-elements?show=14003#c14003[QA-542]]__ + +=== Group, Partition, Package, Rectangle or Card +You can group activity together by defining: +* group; +* partition; +* package; +* rectangle; +* card. + +@startuml +start +group Group + :Activity; +end group +floating note: Note on Group + +partition Partition { + :Activity; +} +floating note: Note on Partition + +package Package { + :Activity; +} +floating note: Note on Package + +rectangle Rectangle { + :Activity; +} +floating note: Note on Rectangle + +card Card { + :Activity; +} +floating note: Note on Card +end +@enduml + + + +== Swimlanes + +Using pipe `+|+`, you can define swimlanes. + +It's also possible to change swimlanes link::color[color]. + +@startuml +|Swimlane1| +start +:foo1; +|#AntiqueWhite|Swimlane2| +:foo2; +:foo3; +|Swimlane1| +:foo4; +|Swimlane2| +:foo5; +stop +@enduml + + +You can add `+if+` conditional or `+repeat+` or `+while+` loop within swimlanes. + +@startuml +|#pink|Actor_For_red| +start +if (color?) is (red) then +#pink:**action red**; +:foo1; +else (not red) +|#lightgray|Actor_For_no_red| +#lightgray:**action not red**; +:foo2; +endif +|Next_Actor| +#lightblue:foo3; +:foo4; +|Final_Actor| +#palegreen:foo5; +stop +@enduml + + +You can also use `+alias+` with swimlanes, with this syntax: +* `+|[#|]| +` + + +@startuml +|#palegreen|f| fisherman +|c| cook +|#gold|e| eater +|f| +start +:go fish; +|c| +:fry fish; +|e| +:eat fish; +stop +@enduml + + +__[Ref. https://forum.plantuml.net/2681/possible-define-alias-swimlane-place-alias-everywhere-else?show=2685#a2685[QA-2681]]__ + + +== Detach or kill [detach, kill] + +It's possible to remove an arrow using the `+detach+` or `+kill+` keyword: + +* `+detach+` + + +@startuml + :start; + fork + :foo1; + :foo2; + fork again + :foo3; + detach + endfork + if (foo4) then + :foo5; + detach + endif + :foo6; + detach + :foo7; + stop +@enduml + + +* `+kill+` + + + +@startuml + :start; + fork + :foo1; + :foo2; + fork again + :foo3; + kill + endfork + if (foo4) then + :foo5; + kill + endif + :foo6; + kill + :foo7; + stop +@enduml + + + +== SDL (Specification and Description Language) + +By changing the final `+;+` separator, you can set different rendering for the activity: +* `+|+` +* `+<+` +* `+>+` +* `+/+` +* `+\\+` +* `+]+` +* `+}+` + +@startuml +:Ready; +:next(o)| +:Receiving; +split + :nak(i)< + :ack(o)> +split again + :ack(i)< + :next(o) + on several lines| + :i := i + 1] + :ack(o)> +split again + :err(i)< + :nak(o)> +split again + :foo/ +split again + :bar\\ +split again + :i > 5} +stop +end split +:finish; +@enduml + + + +== Complete example + + + +@startuml + +start +:ClickServlet.handleRequest(); +:new page; +if (Page.onSecurityCheck) then (true) + :Page.onInit(); + if (isForward?) then (no) + :Process controls; + if (continue processing?) then (no) + stop + endif + + if (isPost?) then (yes) + :Page.onPost(); + else (no) + :Page.onGet(); + endif + :Page.onRender(); + endif +else (false) +endif + +if (do redirect?) then (yes) + :redirect process; +else + if (do forward?) then (yes) + :Forward request; + else (no) + :Render page template; + endif +endif + +stop + +@enduml + + + +== Condition Style + +=== Inside style (by default) + +@startuml +skinparam conditionStyle inside +start +repeat + :act1; + :act2; +repeatwhile (end) +:act3; +@enduml + + +@startuml +start +repeat + :act1; + :act2; +repeatwhile (end) +:act3; +@enduml + + +=== Diamond style + +@startuml +skinparam conditionStyle diamond +start +repeat + :act1; + :act2; +repeatwhile (end) +:act3; +@enduml + + + + +=== InsideDiamond (or __Foo1__) style + +@startuml +skinparam conditionStyle InsideDiamond +start +repeat + :act1; + :act2; +repeatwhile (end) +:act3; +@enduml + + +@startuml +skinparam conditionStyle foo1 +start +repeat + :act1; + :act2; +repeatwhile (end) +:act3; +@enduml + + + +__[Ref. https://forum.plantuml.net/1290/plantuml-condition-rendering[QA-1290] and https://github.com/plantuml/plantuml/issues/400#issuecomment-721287124[#400]]__ + + +== Condition End Style + +=== Diamond style (by default) + +* With one branch + +@startuml +skinparam ConditionEndStyle diamond +:A; +if (decision) then (yes) + :B1; +else (no) +endif +:C; +@enduml + + +* With two branches (`+B1+`, `+B2+`) + +@startuml +skinparam ConditionEndStyle diamond +:A; +if (decision) then (yes) + :B1; +else (no) + :B2; +endif +:C; +@enduml +@enduml + + +=== Horizontal line (hline) style +* With one branch + +@startuml +skinparam ConditionEndStyle hline +:A; +if (decision) then (yes) + :B1; +else (no) +endif +:C; +@enduml + + +* With two branches (`+B1+`, `+B2+`) + +@startuml +skinparam ConditionEndStyle hline +:A; +if (decision) then (yes) + :B1; +else (no) + :B2; +endif +:C; +@enduml +@enduml + + + +__[Ref. https://forum.plantuml.net/4015/its-possible-to-draw-if-else-endif-without-merge-symbol[QA-4015]]__ + + +== Using (global) style + +=== Without style __(by default)__ + +@startuml +start +:init; +-> test of color; +if (color?) is (red) then +:print red; +else +:print not red; +note right: no color +endif +partition End { +:end; +} +-> this is the end; +end +@enduml + + + +=== With style + +You can use link::style-evolution[style] to change rendering of elements. + + +@startuml + +start +:init; +-> test of color; +if (color?) is (red) then +:print red; +else +:print not red; +note right: no color +endif +partition End { +:end; +} +-> this is the end; +end +@enduml + + + diff --git a/plantuml-docs/docs_from_alphadoc/activity-diagram-issues.adoc b/plantuml-docs/docs_from_alphadoc/activity-diagram-issues.adoc new file mode 100644 index 00000000..6583db40 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/activity-diagram-issues.adoc @@ -0,0 +1,173 @@ +== Activity Diagram issues (activity-diagram-issues) + +This page lists issues on link::activity-diagram-beta[Activity Diagram]. + + +== Backward Error on swim-lanes + + +@startuml +|Swimlane1| +start +repeat :foo as starting label; + :read data; + :generate diagrams; +|Swimlane2| +backward:This is backward; +repeat while (more data?) +|Swimlane1| +stop +@enduml + + + +@startuml +|Swimlane1| +start +repeat :foo as starting label; + :read data; +|Swimlane2| + :generate diagrams; +repeat while (more data?) +|Swimlane1| +stop +@enduml + + +__[Ref. https://forum.plantuml.net/12427[QA-12427]]__ + +''' + + +@startuml +|#AntiqueWhite|Sistem| +|Admin| +repeat :Generate Again; +:Generate Foo; +|Sistem| +:Bar; +backward: Do bar; +repeat while (Is foo?) is (yes) +->no; +:finish foo; +stop +@enduml + + + +@startuml +|Admin| +repeat :Generate Again; +:Generate Foo; +|#AntiqueWhite|Sistem| +:Bar; +backward: Do bar; +repeat while (Is foo?) is (yes) +->no; +:finish foo; +stop +@enduml + + +__[Ref. https://forum.plantuml.net/14473[QA-14473]]__ + + +== If test on swimlane + + +@startuml +|Lane 1| +|Lane 2| +|Lane 1| +start +if (sure?) then (yes) +else (no) + |Lane 2| + :baz; +endif +|Lane 2| +:foo; +@enduml + + +VS + + +@startuml +|Lane 2| +|Lane 1| +start +if (sure?) then (yes) +else (no) + |Lane 2| + :baz; +endif +|Lane 2| +:foo; +@enduml + + + +__[Ref. https://forum.plantuml.net/3689[QA-3689]]__ + + +== A example of `+goto+` + +The first example of `+goto+` is broken... + + +@startuml +title Example of QA-1626 +:foo1; +label lab1 +:foo2; +if (some test) then + :foo3; + goto lab1 +else + :foo4; +endif +stop +@enduml + + +__[Ref. https://forum.plantuml.net/1626/there-refer-existing-activity-inside-activitydiagram-goto?show=2342#a2342[QA-1626]]__ + + +== Overlap of arrow on Switch [fixed on V1.2022.4+] + + +@startuml +switch (Long long long Long long long condition?) +case (Long long long long long long long long long case 1) + :Action 1; +case (Arrow Error\nLong long long long long long long long long case 2) + :Action 2; +endswitch +footer \nObserved on: 1.2022.3b2\n(current version: %version()) +@enduml + + +or + + +@startuml + +switch (Long long long Long long long condition?) +case (Long long long long long long long long long case 1) + :Action 1; +case (Arrow Error\nLong long long long long long long long long case 2) + :Action 2; +endswitch +footer \nObserved on: 1.2022.3b2\n(current version: %version()) +@enduml + + +See: +* https://forum.plantuml.net/14529/activity-style-allow-style-diamond-internal-label-external[QA-14529] + + diff --git a/plantuml-docs/docs_from_alphadoc/activity-diagram-legacy.adoc b/plantuml-docs/docs_from_alphadoc/activity-diagram-legacy.adoc new file mode 100644 index 00000000..c75d7e72 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/activity-diagram-legacy.adoc @@ -0,0 +1,367 @@ +== Activity Diagram (legacy) + +This is the old **Activity Diagram (legacy)** syntax, to see the new current version see: link::activity-diagram-beta[**Activity Diagram (new)**]. + + +== Simple Action + +You can use `+(*)+` for the starting point and ending point of +the activity diagram. + +In some occasion, you may want to use `+(*top)+` to force the starting point to be at the top of the diagram. + + +Use `+-->+` for arrows. + + +@startuml + +(*) --> "First Action" +"First Action" --> (*) + +@enduml + + + +== Label on arrows + + + +By default, an arrow starts at the last used activity. + +You can put a label on an arrow using brackets `+[+` and +`+]+` just after the arrow definition. + +@startuml + +(*) --> "First Action" +-->[You can put also labels] "Second Action" +--> (*) + +@enduml + + + +== Changing arrow direction + + +You can use `+->+` for horizontal arrows. It is possible to +force arrow's direction using the following syntax: +* `+-down->+` (default arrow) +* `+-right->+` or `+->+` +* `+-left->+` +* `+-up->+` + + +@startuml + +(*) -up-> "First Action" +-right-> "Second Action" +--> "Third Action" +-left-> (*) + +@enduml + + + +== Branches + + +You can use `+if/then/else+` keywords to define branches. + + +@startuml +(*) --> "Initialization" + +if "Some Test" then + -->[true] "Some Action" + --> "Another Action" + -right-> (*) +else + ->[false] "Something else" + -->[Ending process] (*) +endif + +@enduml + + +Unfortunately, you will have to sometimes repeat the same activity in the diagram text: + +@startuml +(*) --> "check input" +If "input is verbose" then +--> [Yes] "turn on verbosity" +--> "run command" +else +--> "run command" +Endif +-->(*) +@enduml + + + +== More on Branches + + +By default, a branch is connected to the last defined activity, but it +is possible to override this and to define a link with the `+if+` keywords. + +It is also possible to nest branches. + + +@startuml + +(*) --> if "Some Test" then + + -->[true] "action 1" + + if "" then + -> "action 3" as a3 + else + if "Other test" then + -left-> "action 5" + else + --> "action 6" + endif + endif + +else + + ->[false] "action 2" + +endif + +a3 --> if "last test" then + --> "action 7" +else + -> "action 8" +endif + +@enduml + + + +== Synchronization + +You can use `+=== code ===+` to display synchronization bars. + + +@startuml + +(*) --> ===B1=== +--> "Parallel Action 1" +--> ===B2=== + +===B1=== --> "Parallel Action 2" +--> ===B2=== + +--> (*) + +@enduml + + + +== Long action description + + +When you declare activities, you can span on several lines the +description text. You can also add `+\n+` in the description. + +You can also give a short code to the activity with the `+as+` +keyword. +This code can be used latter in the diagram description. + + +@startuml +(*) -left-> "this action +is very long2 +and defined on several lines +that contains many text" as A1 + +-up-> "Another action\n on several lines" + +A1 --> "Short action " +@enduml + + + +== Notes + + +You can add notes on a activity using the commands +`+note left+`, +`+note right+`, `+note top+` or `+note bottom+`, +just after the description of the activity you want to note. + +If you want to put a note on the starting point, define the note +at the very beginning of the diagram description. + +You can also have a note on several lines, using the +`+endnote+` keywords. + +@startuml + +(*) --> "Some action" +note right: This action has to be defined +"Some action" --> (*) +note left + This note is on + several lines +end note + +@enduml + + + +== Partition + +You can define a partition using the `+partition+` keyword, and +optionally declare a background color for your partition (Using a html +color code or name) + +When you declare activities, they are automatically put in the +last used partition. + +You can close the partition definition using a closing bracket `+}+`. + +@startuml + +partition Conductor { + (*) --> "Climbs on Platform" + --> === S1 === + --> Bows +} + +partition Audience #LightSkyBlue { + === S1 === --> Applauds +} + +partition Conductor { + Bows --> === S2 === + --> WavesArmes + Applauds --> === S2 === +} + +partition Orchestra #CCCCEE { + WavesArmes --> Introduction + --> "Play music" +} + +@enduml + + + + +== Skinparam + + +You can use the link::skinparam[skinparam] +command to change colors and fonts for the drawing. + +You can use this command : +* In the diagram definition, like any other commands, +* In an link::preprocessing[included file], +* In a configuration file, provided in the link::command-line[command line] or the link::ant-task[ANT task]. +You can define specific color and fonts for stereotyped activities. + + +@startuml + +skinparam backgroundColor #AAFFFF +skinparam activity { + StartColor red + BarColor SaddleBrown + EndColor Silver + BackgroundColor Peru + BackgroundColor<< Begin >> Olive + BorderColor Peru + FontName Impact +} + +(*) --> "Climbs on Platform" << Begin >> +--> === S1 === +--> Bows +--> === S2 === +--> WavesArmes +--> (*) + +@enduml + + + + +== Octagon + +You can change the shape of activities to octagon using the `+skinparam activityShape octagon+` +command. + +@startuml +'Default is skinparam activityShape roundBox +skinparam activityShape octagon + +(*) --> "First Action" +"First Action" --> (*) + +@enduml + + + +== Complete example + + + +@startuml +title Servlet Container + +(*) --> "ClickServlet.handleRequest()" +--> "new Page" + +if "Page.onSecurityCheck" then + ->[true] "Page.onInit()" + + if "isForward?" then + ->[no] "Process controls" + + if "continue processing?" then + -->[yes] ===RENDERING=== + else + -->[no] ===REDIRECT_CHECK=== + endif + + else + -->[yes] ===RENDERING=== + endif + + if "is Post?" then + -->[yes] "Page.onPost()" + --> "Page.onRender()" as render + --> ===REDIRECT_CHECK=== + else + -->[no] "Page.onGet()" + --> render + endif + +else + -->[false] ===REDIRECT_CHECK=== +endif + +if "Do redirect?" then + ->[yes] "redirect request" + --> ==BEFORE_DESTROY=== +else + if "Do Forward?" then + -left->[yes] "Forward request" + --> ==BEFORE_DESTROY=== + else + -right->[no] "Render page template" + --> ==BEFORE_DESTROY=== + endif +endif + +--> "Page.onDestroy()" +-->(*) + +@enduml + + + diff --git a/plantuml-docs/docs_from_alphadoc/ant-task.adoc b/plantuml-docs/docs_from_alphadoc/ant-task.adoc new file mode 100644 index 00000000..8e996c93 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/ant-task.adoc @@ -0,0 +1,141 @@ +== Writing an Ant Task +You must have something like this into your https://en.wikipedia.org/wiki/Apache_Ant[**Ant**] `+build.xml+` file: + +---- + + + + + + + + + +---- + + +The https://en.wikipedia.org/wiki/Apache_Ant[**Ant**] task processes all **.c**, **.h**, **.cpp**, **.tex**, **.html**, **.htm** or **.java** of the provided directory (`+./src+` in this example). It looks for `+@startXYZ+` and generates `+.png+` images. + + +== Output Directory +You can also specify a output directory for all generated images, using +`+output+` tag. +---- + + + + +---- + + + +== Recurse through directories + +You can also use **Ant** standard http://www.163jsp.com/help/antman1.7.1/CoreTypes/fileset.html[fileset] +or http://www.163jsp.com/help/antman1.7.1/CoreTypes/filelist.html[filelist]. + +For example, if you want to process all java file in `+c:/src+` and subdirectories, (except files ending by `+Test.java+`), and generate images into `+d:/images+`, you can use: +---- + + + + + + + + +---- + + +== SVG or EPS Support + + +You can also use `+format="svg"+` or `+format="eps"+` in the **Ant** task definition. +---- + + + +---- + + +== Configuration file + + +You can also provide a configuration file which will be included before each diagram. + +---- + + + +---- + + + +== Other parameters + +|=== +| Parameter | Default | Description + +| nbthread +| 1 +| Number of thread for processing + +| graphvizDot +| +| Path of the dot executable + +| format +| png +| Format for image generation: xmi, xmi:argo, xmi:start, eps, svg, txt, utxt + +| verbose +| `+false+` +| `+true+` for more logs + +| config +| +| File config to include before all diagrams + +| charset +| +| Charset to use when reading files + +| output +| +| Output directory for generated images + +| dir +| +| Input directory to process (You can use `+/+` instead) + +| failonerror +| `+false+` +| `+true+` to fail the build if some syntax error occurs + +| checkonly +| `+false+` +| `+true+` if you want to only check the syntax of files without generating images + +| overwrite +| `+false+` +| `+true+` if you want overwrite read-only files + +| enablestats +| `+false+` +| `+true+` to enable statistics + +| htmlstats +| `+false+` +| `+true+` to output general statistics in file plantuml-stats.html + +| xmlstats +| `+false+` +| `+true+` to output general statistics in file plantuml-stats.xml + +| realtimestats +| `+false+` +| `+true+` to generate statistics on the fly rather than at the end + +|=== + + diff --git a/plantuml-docs/docs_from_alphadoc/api.adoc b/plantuml-docs/docs_from_alphadoc/api.adoc new file mode 100644 index 00000000..cc4fb395 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/api.adoc @@ -0,0 +1,58 @@ +== Calling PlantUML from Java +You can easily integrate **PlantUML** with your own code by adding __plantuml.jar__ in your classpath. + + + +== PNG generation from a String +If your diagram description is stored in a `+String+`, you can use the `+SourceStringReader+` class to generate some PNG file. + +---- +import net.sourceforge.plantuml.SourceStringReader; +OutputStream png = ...; +String source = "@startuml\n"; +source += "Bob -> Alice : hello\n"; +source += "@enduml\n"; + +SourceStringReader reader = new SourceStringReader(source); +// Write the first image to "png" +String desc = reader.outputImage(png).getDescription(); +// Return a null string if no generation +---- + + +== PNG generation from a File + +If your diagram description is stored in a `+File+`, you can use the `+SourceFileReader+` class to generate some PNG file. + +---- +File source = ...; +SourceFileReader reader = new SourceFileReader(source); +List list = reader.getGeneratedImages(); +// Generated files +File png = list.get(0).getPngFile(); +---- + + + +== SVG generation from a String + +If your diagram description is stored in a `+String+`, you can use the `+SourceStringReader+` class to generate some SVG file. + +---- +String source = "@startuml\n"; +source += "Bob -> Alice : hello\n"; +source += "@enduml\n"; + +SourceStringReader reader = new SourceStringReader(source); +final ByteArrayOutputStream os = new ByteArrayOutputStream(); +// Write the first image to "os" +String desc = reader.generateImage(os, new FileFormatOption(FileFormat.SVG)); +os.close(); + +// The XML is stored into svg +final String svg = new String(os.toByteArray(), Charset.forName("UTF-8")); +---- + + + + diff --git a/plantuml-docs/docs_from_alphadoc/archimate-diagram.adoc b/plantuml-docs/docs_from_alphadoc/archimate-diagram.adoc new file mode 100644 index 00000000..f6c9d434 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/archimate-diagram.adoc @@ -0,0 +1,309 @@ +== Archimate Diagram + ++++This is only a proposal and subject to change+++. + +You are very welcome http://forum.plantuml.net[to create a new discussion] on this future syntax. Your feedbacks, ideas and suggestions help us to find the right solution. + + + +== Archimate keyword + +You can use the `+archimate+` keyword to define an element. Stereotype can optionally specify an additional icon. Some colors (`+Business+`, `+Application+`, `+Motivation+`, `+Strategy+`, `+Technology+`, `+Physical+`, `+Implementation+`) are also available. + + +@startuml +archimate #Technology "VPN Server" as vpnServerA <> + +rectangle GO #lightgreen +rectangle STOP #red +rectangle WAIT #orange +@enduml + + + + +== Defining Junctions + +Using the `+circle+` keyword and the link::preprocessing[preprocessor], you can also create junctions. + + +@startuml +!define Junction_Or circle #black +!define Junction_And circle #whitesmoke + +Junction_And JunctionAnd +Junction_Or JunctionOr + +archimate #Technology "VPN Server" as vpnServerA <> + +rectangle GO #lightgreen +rectangle STOP #red +rectangle WAIT #orange +GO -up-> JunctionOr +STOP -up-> JunctionOr +STOP -down-> JunctionAnd +WAIT -down-> JunctionAnd +@enduml + + + + +== Example 1 + + + +skinparam rectangle<> { + roundCorner 25 +} +sprite $bProcess jar:archimate/business-process +sprite $aService jar:archimate/application-service +sprite $aComponent jar:archimate/application-component + +rectangle "Handle claim" as HC <<$bProcess>><> #Business +rectangle "Capture Information" as CI <<$bProcess>><> #Business +rectangle "Notify\nAdditional Stakeholders" as NAS <<$bProcess>><> #Business +rectangle "Validate" as V <<$bProcess>><> #Business +rectangle "Investigate" as I <<$bProcess>><> #Business +rectangle "Pay" as P <<$bProcess>><> #Business + +HC *-down- CI +HC *-down- NAS +HC *-down- V +HC *-down- I +HC *-down- P + +CI -right->> NAS +NAS -right->> V +V -right->> I +I -right->> P + +rectangle "Scanning" as scanning <<$aService>><> #Application +rectangle "Customer admnistration" as customerAdministration <<$aService>><> #Application +rectangle "Claims admnistration" as claimsAdministration <<$aService>><> #Application +rectangle Printing <<$aService>><> #Application +rectangle Payment <<$aService>><> #Application + +scanning -up-> CI +customerAdministration -up-> CI +claimsAdministration -up-> NAS +claimsAdministration -up-> V +claimsAdministration -up-> I +Payment -up-> P + +Printing -up-> V +Printing -up-> P + +rectangle "Document\nManagement\nSystem" as DMS <<$aComponent>> #Application +rectangle "General\nCRM\nSystem" as CRM <<$aComponent>> #Application +rectangle "Home & Away\nPolicy\nAdministration" as HAPA <<$aComponent>> #Application +rectangle "Home & Away\nFinancial\nAdministration" as HFPA <<$aComponent>> #Application + +DMS .up.|> scanning +DMS .up.|> Printing +CRM .up.|> customerAdministration +HAPA .up.|> claimsAdministration +HFPA .up.|> Payment + +legend left +Example from the "Archisurance case study" (OpenGroup). +See +==== +<$bProcess> :business process +==== +<$aService> : application service +==== +<$aComponent> : application component +endlegend + + + +== Example 2 + + +skinparam roundcorner 25 +rectangle "Capture Information" as CI <<$archimate/business-process>> #Business + + + +== List possible sprites + +You can list all possible sprites for Archimate using the following diagram: + + +@startuml +listsprite +@enduml + + + + +== ArchiMate Macros + +=== Archimate Macros and Library + +A list of Archimate macros are defined https://github.com/ebbypeter/Archimate-PlantUML[Archimate-PlantUML] here which simplifies the creation of ArchiMate diagrams, and Archimate is natively on the link::stdlib[Standard Library] of PlantUML. + +=== Archimate elements +Using the macros, creation of ArchiMate elements are done using the following format: +`+Category_ElementName(nameOfTheElement, "description")+` + +For example: +* To define a __Stakeholder__ element, which is part of Motivation category, the syntax will be `+Motivation_Stakeholder(StakeholderElement, "Stakeholder Description")+`: + +@startuml +!include +Motivation_Stakeholder(StakeholderElement, "Stakeholder Description") +@enduml + + + +* To define a __Business Service__ element, `+Business_Service(BService, "Business Service")+`: + +@startuml +!include +Business_Service(BService, "Business Service") +@enduml + + +=== Archimate relationships +The ArchiMate relationships are defined with the following pattern: +`+Rel_RelationType(fromElement, toElement, "description")+` +and to define the direction/orientation of the two elements: +`+Rel_RelationType_Direction(fromElement, toElement, "description")+` + +The `+RelationTypes+` supported are: +* Access +* Aggregation +* Assignment +* Association +* Composition +* Flow +* Influence +* Realization +* Serving +* Specialization +* Triggering + +The `+Directions+` supported are: +* Up +* Down +* Left +* Right + +For example: +* To denote a composition relationship between the __Stakeholder__ and __Business Service__ defined above, the syntax will be +`+Rel_Composition(StakeholderElement, BService, "Description for the relationship")+` + +@startuml +!include +Motivation_Stakeholder(StakeholderElement, "Stakeholder Description") +Business_Service(BService, "Business Service") +Rel_Composition(StakeholderElement, BService, "Description for the relationship") +@enduml + +* Unordered List ItemTo orient the two elements in top - down position, the syntax will be +`+Rel_Composition_Down(StakeholderElement, BService, "Description for the relationship")+` + +@startuml +!include +Motivation_Stakeholder(StakeholderElement, "Stakeholder Description") +Business_Service(BService, "Business Service") +Rel_Composition_Down(StakeholderElement, BService, "Description for the relationship") +@enduml + + +=== Appendice: Examples of all Archimate RelationTypes + +@startuml +left to right direction +skinparam nodesep 4 +!include +Rel_Triggering(i15, j15, Triggering) +Rel_Specialization(i14, j14, Specialization) +Rel_Serving(i13, j13, Serving) +Rel_Realization(i12, j12, Realization) +Rel_Influence(i11, j11, Influence) +Rel_Flow(i10, j10, Flow) +Rel_Composition(i9, j9, Composition) +Rel_Association_dir(i8, j8, Association_dir) +Rel_Association(i7, j7, Association) +Rel_Assignment(i6, j6, Assignment) +Rel_Aggregation(i5, j5, Aggregation) +Rel_Access_w(i4, j4, Access_w) +Rel_Access_rw(i3, j3, Access_rw) +Rel_Access_r(i2, j2, Access_r) +Rel_Access(i1, j1, Access) +@enduml + + + +@startuml +title ArchiMate Relationships Overview +skinparam nodesep 5 + +!include +left to right direction + +rectangle Other { +() i14 +() j14 +} + + +rectangle Dynamic { +() i10 +() j10 +() i15 +() j15 +} + +rectangle Dependency { +() i13 +() j13 +() i4 +() j4 +() i11 +() j11 +() i7 +() j7 +} + +rectangle Structural { +() i9 +() j9 +() i5 +() j5 +() i6 +() j6 +() i12 +() j12 +} + +Rel_Triggering(i15, j15, Triggering) +Rel_Specialization(i14, j14, Specialization) +Rel_Serving(i13, j13, Serving) +Rel_Realization(i12, j12, Realization) +Rel_Influence(i11, j11, Influence) +Rel_Flow(i10, j10, Flow) +Rel_Composition(i9, j9, Composition) +Rel_Association_dir(i7, j7, \nAssociation_dir) +Rel_Association(i7, j7, Association) +Rel_Assignment(i6, j6, Assignment) +Rel_Aggregation(i5, j5, Aggregation) +Rel_Access_w(i4, j4, Access_w) +Rel_Access_rw(i4, j4, Access_rw) +Rel_Access_r(i4, j4, Access_r) +Rel_Access(i4, j4, Access) +@enduml + + +__[Adapted from https://github.com/plantuml-stdlib/Archimate-PlantUML/pull/25[Archimate PR#25]]__ + + diff --git a/plantuml-docs/docs_from_alphadoc/ascii-art.adoc b/plantuml-docs/docs_from_alphadoc/ascii-art.adoc new file mode 100644 index 00000000..572cdb38 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/ascii-art.adoc @@ -0,0 +1,333 @@ +== ASCII Art + +It is possible to generate link::sequence-diagram[Sequence Diagrams] using http://en.wikipedia.org/wiki/ASCII_art[ASCII art]. + +---- +@startuml +participant Bob +actor Alice + +Bob -> Alice : hello +Alice -> Bob : Is it ok? +@enduml +---- + +You have to use the `+-txt+` flag in the command line, or the `+format+` tag in the link::ant-task[Ant task] : + +---- + + + +---- + +Generated files use .atxt extension. (__"a" as ASCII art : to NOT overide any existing .txt files!__). +Here is the result: + +---- + ,-. + `-' + /|\ + ,---. | + |Bob| / \ + `-+-' Alice + | hello | + |-------------->| + | | + | Is it ok? | + |<- - - - - - - | + ,-+-. Alice + |Bob| ,-. + `---' `-' + /|\ + | + / \ +---- +You can control the maximum number of characters between participants by using `+skinparam maxAsciiMessageLength+`. This can be helpful if you need to limit the width of your ASCII Art. + +For example: +---- +@startuml +skinparam maxAsciiMessageLength 8 +participant Bob +actor Alice + +Bob -> Alice : hello +Alice -> Bob : Is it ok? +@enduml +---- + +Will look like: +---- + ,-. + `-' + /|\ + ,---. | + |Bob| / \ + `-+-' Alice + |hello | + |------>| + | | + Is it ok? + |<------| + ,-+-. Alice + |Bob| ,-. + `---' `-' + /|\ + | + / \ +---- + + +== Unicode + +The default `+txt+` format uses only plain ASCII characters. It is possible to use few extended Unicode characters to have a slightly better result. You should use the `+-utxt+` flag in the command line, or the `+utxt+` format in the link::ant-task[Ant task]. + +---- + โ”Œโ”€โ” + โ•‘"โ”‚ + โ””โ”ฌโ”˜ + โ”Œโ”ผโ” + โ”Œโ”€โ”€โ”€โ” โ”‚ + โ”‚Bobโ”‚ โ”Œโ”ดโ” + โ””โ”€โ”ฌโ”€โ”˜ Alice + โ”‚ hello โ”‚ + โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚ + โ”‚ โ”‚ + โ”‚ Is it ok? โ”‚ + โ”‚<โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”‚ + โ”Œโ”€โ”ดโ”€โ” Alice + โ”‚Bobโ”‚ โ”Œโ”€โ” + โ””โ”€โ”€โ”€โ”˜ โ•‘"โ”‚ + โ””โ”ฌโ”˜ + โ”Œโ”ผโ” + โ”‚ + โ”Œโ”ดโ” +---- + +They are two drawbacks of using utxt: + +* The result is UTF-8 encoded, and sometimes this is an issue (mail gateway, editors...) +* The used font must have the used extended characters (like Courier, Courier New...) + + +== Complex Diagram + +You can even try complex example if you wish. + +---- +@startuml +'hide footbox + +participant "Bob on\nseveral lines" as Bob +actor Alice + +Bob -> Alice : hello +note right of Alice + this is a note +end note + +Alice -> Bob : Is it ok\nwith a message that is\non several lines? + +note right + This other note + should work + on several lines +end note + +== This is a separation == + +Bob -> Last : Yes it works! +Last -> Last : working in progress +note left : this is\nanother note + +Last --> Last : working in progress + +Last --> Bob : done + +opt dummy comment + Bob -> Last : Error\nOn\nSeveral\nLine + Last --> Bob : None +else + Last --> Bob : None + Last -> Bob : None +else other + Last -> Bob : None + note over Alice, Last + This is a long note + over Alice and Last + end note + Last -> Bob : None + Last -> Bob : None +end +@enduml +---- + + + +== Result + +---- + ,-. + `-' + ,-------------. /|\ + |Bob on | | ,----. + |several lines| / \ |Last| + `------+------' Alice `-+--' + | hello | | + |---------------------->| | + | | | + | | ,--------------!. + | | |this is a note|_\ + | | `----------------' + |Is it ok | ,----------------!. + |with a message that is | |This other note |_\ + |on several lines? | |should work | + |<----------------------| |on several lines | + | | `------------------' + | | | + | ======================== | +====================================== This is a separation ======================================= + | ======================== | + | | | + | Yes it works! | + |-------------------------------------->| + | | | + | ,------------!. |----. + | |this is |_\| | working in progress + | |another note ||<---' + | `--------------'| + | | |- - . + | | | | working in progress + | | |< - ' + | | | + | done | | + |<- - - - - - - - - - - - - - - - - - - | + | | | + ______________________________________________________________________ + ! OPT / dummy comment | | ! + !_____/ | | | ! + ! | | | ! + ! | Error | | ! + ! | On | | ! + ! | Several | | ! + ! | Line | | ! + ! |-------------------------------------->| ! + ! | | | ! + ! | None | | ! + ! |<- - - - - - - - - - - - - - - - - - - | ! + !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! + ! | | | ! + ! | None | | ! + ! |<- - - - - - - - - - - - - - - - - - - | ! + ! | | | ! + ! | None | | ! + ! |<--------------------------------------| ! + !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! + ! [other] | | | ! + ! | None | | ! + ! |<--------------------------------------| ! + ! | | | ! + ! | ,-------------------!. ! + ! | |This is a long note|_\ ! + ! | |over Alice and Last | ! + ! | `---------------------' ! + ! | None | | ! + ! |<--------------------------------------| ! + ! | | | ! + ! | None | | ! + ! |<--------------------------------------| ! + !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! + ,------+------. Alice ,-+--. + |Bob on | ,-. |Last| + |several lines| `-' `----' + `-------------' /|\ + | + / \ +---- + + + +== Same example using Unicode + +---- + โ”Œโ”€โ” + โ•‘"โ”‚ + โ””โ”ฌโ”˜ + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”ผโ” + โ”‚Bob on โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ” + โ”‚several linesโ”‚ โ”Œโ”ดโ” โ”‚Lastโ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ Alice โ””โ”€โ”ฌโ”€โ”€โ”˜ + โ”‚ hello โ”‚ โ”‚ + โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚ โ”‚ + โ”‚ โ”‚ โ”‚ + โ”‚ โ”‚ โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•— + โ”‚ โ”‚ โ•‘this is a note โ–‘โ•‘ + โ”‚ โ”‚ โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ• + โ”‚Is it ok โ”‚ โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•— + โ”‚with a message that is โ”‚ โ•‘This other note โ–‘โ•‘ + โ”‚on several lines? โ”‚ โ•‘should work โ•‘ + โ”‚<โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ โ•‘on several lines โ•‘ + โ”‚ โ”‚ โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ• + โ”‚ โ”‚ โ”‚ + โ”‚ โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•— โ”‚ +โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ This is a separation โ• โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• + โ”‚ โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• โ”‚ + โ”‚ โ”‚ โ”‚ + โ”‚ Yes it works! โ”‚ + โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚ + โ”‚ โ”‚ โ”‚ + โ”‚ โ•”โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•—โ”‚โ”€โ”€โ”€โ”€โ” + โ”‚ โ•‘this is โ–‘โ•‘โ”‚ โ”‚ working in progress + โ”‚ โ•‘another note โ•‘โ”‚<โ”€โ”€โ”€โ”˜ + โ”‚ โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”‚ + โ”‚ โ”‚ โ”‚โ”€ โ”€ โ” + โ”‚ โ”‚ โ”‚ | working in progress + โ”‚ โ”‚ โ”‚< โ”€ โ”˜ + โ”‚ โ”‚ โ”‚ + โ”‚ done โ”‚ โ”‚ + โ”‚<โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”‚ + โ”‚ โ”‚ โ”‚ + โ•”โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•— + โ•‘ OPT โ”‚ dummy comment โ”‚ โ”‚ โ•‘ + โ•Ÿโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ Error โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ On โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ Several โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ Line โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€>โ”‚ โ•‘ + โ•‘ โ”‚ โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ None โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚<โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”‚ โ•‘ + โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ + โ•‘ โ”‚ โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ None โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚<โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”‚ โ•‘ + โ•‘ โ”‚ โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ None โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚<โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ โ•‘ + โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฃ + โ•‘ [other] โ”‚ โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ None โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚<โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ โ•‘ + โ•‘ โ”‚ โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ โ•”โ•โ•โ•งโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•งโ•โ•โ•— โ•‘ + โ•‘ โ”‚ โ•‘This is a long note โ–‘โ•‘ โ•‘ + โ•‘ โ”‚ โ•‘over Alice and Last โ•‘ โ•‘ + โ•‘ โ”‚ โ•šโ•โ•โ•คโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•คโ•โ•โ• โ•‘ + โ•‘ โ”‚ None โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚<โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ โ•‘ + โ•‘ โ”‚ โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚ None โ”‚ โ”‚ โ•‘ + โ•‘ โ”‚<โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ โ•‘ + โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ชโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ” Alice โ”Œโ”€โ”ดโ”€โ”€โ” + โ”‚Bob on โ”‚ โ”Œโ”€โ” โ”‚Lastโ”‚ + โ”‚several linesโ”‚ โ•‘"โ”‚ โ””โ”€โ”€โ”€โ”€โ”˜ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”ฌโ”˜ + โ”Œโ”ผโ” + โ”‚ + โ”Œโ”ดโ” +---- + + diff --git a/plantuml-docs/docs_from_alphadoc/ascii-math.adoc b/plantuml-docs/docs_from_alphadoc/ascii-math.adoc new file mode 100644 index 00000000..320629a7 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/ascii-math.adoc @@ -0,0 +1,71 @@ +== Maths + +Within PlantUML, you can use http://asciimath.org[AsciiMath] notation: + +@startuml +:int_0^1f(x)dx; +:x^2+y_1+z_12^34; +note right +Try also +d/dxf(x)=lim_(h->0)(f(x+h)-f(x))/h +P(y|bb"x") or f(bb"x")+epsilon +end note +@enduml + + +or https://github.com/opencollab/jlatexmath[JLaTeXMath] notation: + +@startuml +:\int_0^1f(x)dx; +:x^2+y_1+z_{12}^{34}; +note right +Try also +\dfrac{d}{dx}f(x)=\lim\limits_{h \to 0}\dfrac{f(x+h)-f(x)}{h} +P(y|\mathbf{x}) \mbox{ or } f(\mathbf{x})+\epsilon +end note +@enduml + + +Here is another example: + +@startuml +Bob -> Alice : Can you solve: ax^2+bx+c=0 +Alice --> Bob: x = (-b+-sqrt(b^2-4ac))/(2a) +@enduml + + + +== Standalone diagram + +You can also use `+@startmath+`/`+@endmath+` to create standalone http://asciimath.org[AsciiMath] formula. + + + +@startmath +f(t)=(a_0)/2 + sum_(n=1)^ooa_ncos((npit)/L)+sum_(n=1)^oo b_n\ sin((npit)/L) +@endmath + + + +Or use `+@startlatex+`/`+@endlatex+` to create standalone https://github.com/opencollab/jlatexmath[JLaTeXMath] formula. + + +@startlatex +\sum_{i=0}^{n-1} (a_i + b_i^2) +@endlatex + + + +== How is this working? + +To draw those formulas, PlantUML uses two open source projects: + +* https://github.com/asciimath/asciimathml/tree/master/asciimath-based[AsciiMath] that converts AsciiMath notation to LaTeX expression; +* https://github.com/opencollab/jlatexmath[JLatexMath] that displays mathematical formulas written in LaTeX. JLaTeXMath is the best Java library to display LaTeX code. + +https://github.com/asciimath/asciimathml/blob/master/asciimath-based/ASCIIMathTeXImg.js[ASCIIMathTeXImg.js] is small enough to be integrated into PlantUML standard distribution. + + +Since https://github.com/opencollab/jlatexmath[JLatexMath] is bigger, you have to http://beta.plantuml.net/plantuml-jlatexmath.zip[download it] separately, then unzip the 4 jar files (__batik-all-1.7.jar__, __jlatexmath-minimal-1.0.3.jar__, __jlm\_cyrillic.jar__ and __jlm\_greek.jar__) in the same folder as PlantUML.jar. + + diff --git a/plantuml-docs/docs_from_alphadoc/board-diagram.adoc b/plantuml-docs/docs_from_alphadoc/board-diagram.adoc new file mode 100644 index 00000000..9f44b8b7 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/board-diagram.adoc @@ -0,0 +1,43 @@ +== Board diagram + +https://github.com/plantuml/plantuml/issues/423[Incubation of board diagram] + + +== Basic component + + +@startboard +A1 ++U1.1 +++S1 R1 +++S1 R2 ++U1.2 +A2 +@endboard + + + +@startboard +Activity 1 ++User Task 1a +++Story 1 Release 1 +++Story 2 Release 1 ++User Task 1b +++Story 3 Release 1 ++++Story 4 Release 1 +++++Story 5 Release 2 + +Activity 2 ++User Task 2 ++++Story 6 Release 1 ++++Story 7 Release 1 ++++Story 8 Release 2 +Activity 3 + ++User Task 3 +++++Story 9 Release 2 +++++Story 10 Release 3 +@endboard + + + diff --git a/plantuml-docs/docs_from_alphadoc/bpmn.adoc b/plantuml-docs/docs_from_alphadoc/bpmn.adoc new file mode 100644 index 00000000..3336a042 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/bpmn.adoc @@ -0,0 +1,124 @@ +== Business Process Model and Notation (BPMN) + +This is preliminary works to add https://en.wikipedia.org/wiki/Business_Process_Model_and_Notation[BPMN] support in PlantUML. + +Right now, some quick stuff have been done. + +The implementation is based on ideas developped in: +* http://wiki.plantuml.net/_media/site/kitzmann2009a.pdf[kitzmann2009a.pdf] +* https://www.researchgate.net/publication/221542866_A_Simple_Algorithm_for_Automatic_Layout_of_BPMN_Processes[A Simple Algorithm for Automatic Layout of BPMN Processes] + + +__[Ref. http://wiki.plantuml.net/site/bpmn[Wiki-BPMN]]__ + + +== Final examples + + +@startbpm +:login; +20:<+> +:show new message1; +30:<+> +resume 20 +:show new task2; +@endbpm + + + +__[Ref. https://forum.plantuml.net/5647[QA-5647]]__ + + +@startbpm +:login; +new branch +:show new message1; +else +:show new task2; +end branch +new branch +:Accept Task; +else +:nothing; +else +new branch +:read message; +else +:dummy; +end branch +end branch +:logout; +@endbpm + + +__[Ref. http://wiki.plantuml.net/site/bpmn[Wiki-bpmn]]__ + + +== Existing diagrams + +Please put here pointer existing diagrams that you'd like to have supported in PlantUML. + +https://www.tim-zoeller.de/Basics-1.png[Basic processes with User Task, Service Task, Exclusive Gateways, and Parallel Gateways] + +Start with simple examples! + +This http://www.bpmb.de/images/BPMN2_0_Poster_EN.pdf[PDF] gives a good overview of the BPMN2.0 syntax. +It basically boils down to boxes, circles and lines plus swimlanes. +So it is close to an activity diagram. + +All shapes can be "decorated" with symbols. +These add some more detail, but are not necessary to get an overview of the process. +This fact should be reflected in the syntax - it should first let you design the process and then add the details. + + +== Syntax +The proposed syntax is probably not very clear. + +Here we have to talk about it and propose a better one. + +There are rules for good diagrams which might make the syntax easier to create. +One of these rules is that when you split the process- (token-) flow, it will be merged back together with the same symbol. +[comment: This is not neccessarily true. It is allowed to merge the flows with a different gateway, again or without any gateway at all. Also, the flows don't need to be merged] + +There is also the feature of "closed" swim-lanes - swim-lanes where the content is not shown because the detailed process is not known or you want to focus on other parts of the diagram. +It should be reflected by the syntax that a swim-lane can be opened and closed with just a switch. + + + +== Example1 +image::bpm01.png[] +---- +@startbpm +XXXX +@endbpm +---- + + + +== Example2 +image::bpm02.png[] +---- +@startbpm +XXXX +@endbpm +---- + + + +== Example3 +image::bpm03.png[] +---- +@startbpm +XXXX +@endbpm +---- + + + +== Other theorical works + +The following https://github.com/MarvinLudwig/bpmn_layouter[BPMN Layouter project ] may be interesting. +link::jjc-mt.pdf[jjc-mt.pdf] + + + diff --git a/plantuml-docs/docs_from_alphadoc/class-diagram-issues.adoc b/plantuml-docs/docs_from_alphadoc/class-diagram-issues.adoc new file mode 100644 index 00000000..d09477b2 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/class-diagram-issues.adoc @@ -0,0 +1,182 @@ +== Class Diagram issues (class-diagram-issues) + +This page lists issues on link::class-diagram[Class Diagram]. + + +== Wanted features + +* https://forum.plantuml.net/13773/style-the-methods-section-of-a-class-diagram[QA-13773/style-the-methods-section-of-a-class-diagram] + +Adding, on inline style: +* fields +* methods + ++ on [beta-]style + +Proposal syntax: +---- +@startuml +class Demo1 #back:lightgreen|yellow;header:blue/red;methods:red\green;fields:pink +@enduml +---- + + +== Arrow head Groupinheritance bug + +* https://forum.plantuml.net/13532/groupinheritance-bug[QA-13532] + +@startuml +skinparam groupInheritance 3 + +class A1 + +A1 <|-- B1 + +A2 <|-- B2 +A2 <|-- C2 + +A3 <|-- B3 +A3 <|-- C3 +A3 <|-- D3 + +A4 <|-- B4 +A4 <|-- C4 +A4 <|-- D4 + +E4 --|> A4 #blue +E6 --|> A4 #blue +E5 --|> A4 #blue +@enduml + + +Same on element: + +@startuml +skinparam groupInheritance 3 + +card A1 + +A1 <|-- B1 + +A2 <|-- B2 +A2 <|-- C2 + +A3 <|-- B3 #blue +A3 <|-- C3 #blue +A3 <|-- D3 #blue + +A4 <|-- B4 #blue +A4 <|-- C4 #blue +A4 <|-- D4 #blue + +E4 --|> A4 +E6 --|> A4 +E5 --|> A4 +@enduml + + + +== Another similar groupInheritance issue + +* https://github.com/plantuml/plantuml/issues/729[GH-729] + + +@startuml +skinparam groupInheritance 2 + +Parent <|-- Child1 +Parent <|-- Child2 +Composed --* Parent #blue +Aggregated --o Parent #blue +Arrow --> Parent #blue +@enduml + + + +@startuml +skinparam groupInheritance 3 + +Parent <|-- Child1 +Parent <|-- Child2 +Composed --* Parent +Aggregated --o Parent +Arrow --> Parent +@enduml + + + +== Line thickness issue (from ~V1.2022.2) [fixed on 1.2022.6betaX] + + +@startuml +title Bracketed line thickness +class foo +class bar +bar1 : [thickness=1] +bar2 : [thickness=2] +bar3 : [thickness=4] +bar4 : [thickness=8] +bar5 : [thickness=16] + +foo --> bar : โˆ… +foo -[thickness=1]-> bar1 : [1] +foo -[thickness=2]-> bar2 : [2] +foo -[thickness=4]-> bar3 : [4] +foo -[thickness=8]-> bar4 : [8] +foo -[thickness=16]-> bar5 : [16] + +@enduml + + +__[Ref. https://forum.plantuml.net/4949[QA-4949]]__ + + +== Error on Change class color and style (inline style) [fixed on 1.2022.6betaX] + +โš โ€ผโ‰ +++Appeared from version v1.2022.2+++++ [fixed on 1.2022.6betaX] + +* Error on `+##[style]color+`: error on style + + +@startuml +abstract abstract +annotation annotation ##[bold]red +note bottom: Why not bold? +class class ##[dashed]green +note bottom: Why not dashed? +interface interface ##[dotted]blue +note bottom: Why not dotted? + +@enduml + + + + +* `+#[color|back:color];header:color;line:color;line.[bold|dashed|dotted];text:color+` + + +@startuml +abstract abstract +annotation annotation #line:red;line.bold;text:red +note bottom: Why not bold? +class class #line:green;line.dashed;text:green +note bottom: Why not dashed? +interface interface #line:blue;line.dotted;text:blue +note bottom: Why not dotted? +@enduml + + +First original example: + +@startuml +class bar #line:green;back:lightblue +class bar2 #lightblue;line:green + +class Foo1 #back:red;line:00FFFF +class FooDashed #line.dashed:blue +class FooDotted #line.dotted:blue +class FooBold #line.bold +@enduml + + + diff --git a/plantuml-docs/docs_from_alphadoc/class-diagram.adoc b/plantuml-docs/docs_from_alphadoc/class-diagram.adoc new file mode 100644 index 00000000..362999a1 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/class-diagram.adoc @@ -0,0 +1,1626 @@ +== Class Diagram + + + +== Declaring element + + +@startuml +abstract abstract +abstract class "abstract class" +annotation annotation +circle circle +() circle_short_form +class class +diamond diamond +<> diamond_short_form +entity entity +enum enum +exception exception +interface interface +metaclass metaclass +protocol protocol +stereotype stereotype +struct struct +@enduml + + +__[Ref. for `+protocol+` and `+struct+`: https://github.com/plantuml/plantuml/pull/1028[GH-1028], for `+exception+`: https://forum.plantuml.net/16258/adding-exception-keyword-for-class-diagram[QA-16258]]__ + + +== Relations between classes + +Relations between classes are defined using the following symbols : + +|=== +| Type | Symbol | Drawing + +| Extension +| `+<|--+` +| image::extends01.png[] + +| Composition +| `+*--+` +| image::sym03.png[] + +| Aggregation +| `+o--+` +| image::sym01.png[] + +|=== + +It is possible to replace `+--+` by `+..+` to have a dotted +line. + +Knowing those rules, it is possible to draw the following drawings: + + + +@startuml +Class01 <|-- Class02 +Class03 *-- Class04 +Class05 o-- Class06 +Class07 .. Class08 +Class09 -- Class10 +@enduml + + + +@startuml +Class11 <|.. Class12 +Class13 --> Class14 +Class15 ..> Class16 +Class17 ..|> Class18 +Class19 <--* Class20 +@enduml + + + +@startuml +Class21 #-- Class22 +Class23 x-- Class24 +Class25 }-- Class26 +Class27 +-- Class28 +Class29 ^-- Class30 +@enduml + + + + +== Label on relations + + +It is possible to add a label on the relation, using `+:+`, followed +by the text of the label. + +For cardinality, you can use double-quotes `+""+` on each side +of the relation. + + + +@startuml + +Class01 "1" *-- "many" Class02 : contains + +Class03 o-- Class04 : aggregation + +Class05 --> "1" Class06 + +@enduml + + +You can add an extra arrow pointing at one object showing +which object acts on the other object, using `+<+` or `+>+` +at the begin or at the end of the label. + + + +@startuml +class Car + +Driver - Car : drives > +Car *- Wheel : have 4 > +Car -- Person : < owns + +@enduml + + + +== Using non-letters in element names and relation labels + + +If you want to use link::unicode[non-letters] in the class (or enum...) display name, you can either : +* Use the `+as+` keyword in the class definition to assign an alias +* Put quotes `+""+` around the class name + + +@startuml +class "This is my class" as class1 +class class2 as "It works this way too" + +class2 *-- "foo/dummy" : use +@enduml + + +If an alias is assigned to an element, the rest of the file must refer to the element by the alias instead of the name. + +=== Starting names with `+$+` +Note that names starting with `+$+` cannot be hidden or removed later, because `+hide+` and `+remove+` command will consider the name a `+$tag+` instead of a component name. To later remove such elements they must have an alias or must be tagged. + +@startuml +class $C1 +class $C2 $C2 +class "$C2" as dollarC2 +remove $C1 +remove $C2 +remove dollarC2 +@enduml + +Also note that names starting with `+$+` are valid, but to assign an alias to such element the name must be put between quotes `+""+`. + + +== Adding methods + +To declare fields and methods, you can use the symbol +`+:+` followed by the field's or method's name. + +The system checks for parenthesis to choose between methods and fields. + + +@startuml +Object <|-- ArrayList + +Object : equals() +ArrayList : Object[] elementData +ArrayList : size() + +@enduml + + + +It is also possible to group between brackets +`+{}+` all fields and methods. + +Note that the syntax is highly flexible about type/name order. + + + +@startuml +class Dummy { + String data + void methods() +} + +class Flight { + flightNumber : Integer + departureTime : Date +} +@enduml + + +You can use `+{field}+` and `+{method}+` modifiers to +override default behaviour of the parser about fields and methods. + +@startuml +class Dummy { + {field} A field (despite parentheses) + {method} Some method +} + +@enduml + + + + +== Defining visibility + +When you define methods or fields, you can use characters to define the +visibility of the corresponding item: + +|=== +| Character | Icon for field | Icon for method | Visibility + +| `+-+` +| image::private-field.png[] +| image::private-method.png[] +| `+private+` + +| `+#+` +| image::protected-field.png[] +| image::protected-method.png[] +| `+protected+` + +| `+~+` +| image::package-private-field.png[] +| image::package-private-method.png[] +| `+package private+` + +| `+++` +| image::public-field.png[] +| image::public-method.png[] +| `+public+` + +|=== + + +@startuml + +class Dummy { + -field1 + #field2 + ~method1() + +method2() +} + +@enduml + + + +You can turn off this feature using the `+skinparam classAttributeIconSize 0+` command : + + + +@startuml +skinparam classAttributeIconSize 0 +class Dummy { + -field1 + #field2 + ~method1() + +method2() +} + +@enduml + + +Visibility indicators are optional and can be ommitted individualy without turning off the icons globally using `+skinparam classAttributeIconSize 0+`. + + +@startuml +class Dummy { + field1 + field2 + method1() + method2() +} + +@enduml + + +In such case if you'd like to use methods or fields that start with `+-+`, `+#+`, `+~+` or `+++` characters such as a destructor in some languages for `+Dummy+` class `+~Dummy()+`, escape the first character with a `+\+` character: + + + +@startuml +class Dummy { + field1 + \~Dummy() + method1() +} + +@enduml + + + +== Abstract and Static + + + +You can define static or abstract methods or fields using the `+{static}+` +or `+{abstract}+` modifier. + +These modifiers can be used at the start or at the end of the line. +You can also use `+{classifier}+` instead of `+{static}+`. + + +@startuml +class Dummy { + {static} String id + {abstract} void methods() +} +@enduml + + + + +== Advanced class body + + + +By default, methods and fields are automatically regrouped by PlantUML. +You can use separators to define your own way of ordering fields and methods. +The following separators are possible : `+--+` `+..+` `+==+` `+__+`. + +You can also use titles within the separators: + + + +@startuml +class Foo1 { + You can use + several lines + .. + as you want + and group + == + things together. + __ + You can have as many groups + as you want + -- + End of class +} + +class User { + .. Simple Getter .. + + getName() + + getAddress() + .. Some setter .. + + setName() + __ private data __ + int age + -- encrypted -- + String password +} + +@enduml + + + +== Notes and stereotypes + +Stereotypes are defined with the `+class+` keyword, `+<<+` and `+>>+`. + +You can also define notes using `+note left of+` , `+note right of+` , `+note top of+` , `+note bottom of+` +keywords. + +You can also define a note on the last defined class using `+note left+`, `+note right+`, +`+note top+`, `+note bottom+`. + +A note can be also define alone with the `+note+` +keywords, then linked to other objects using the `+..+` symbol. + + +@startuml +class Object << general >> +Object <|--- ArrayList + +note top of Object : In java, every class\nextends this one. + +note "This is a floating note" as N1 +note "This note is connected\nto several objects." as N2 +Object .. N2 +N2 .. ArrayList + +class Foo +note left: On last defined class + +@enduml + + + + +== More on notes + + +It is also possible to use few HTML tags (See link::creole[Creole expression]) like : + +* `++` +* `++` +* `++` +* `++`, `++`, `++` +* `++` or `++` +* `++` or `++` +* `++` to change font size +* `++` or `++`: the file must be accessible by the filesystem + + +You can also have a note on several lines. + +You can also define a note on the last defined class using `+note left+`, `+note right+`, +`+note top+`, `+note bottom+`. + +@startuml + +class Foo +note left: On last defined class + +note top of Object + In java, every class + extends + this one. +end note + +note as N1 + This note is also + on several + words lines + And this is hosted by +end note + +@enduml + + + +== Note on field (field, attribute, member) or method + + +It is possible to add a note on field (field, attribute, member) or on method. + +=== โš  Constraint +* This cannot be used with `+top+` or `+bottom+` __(only `+left+` and `+right+` are implemented)__ +* This cannot be used with namespaceSeparator `+::+` + + +=== Note on field or method + + +@startuml +class A { +{static} int counter ++void {abstract} start(int timeout) +} +note right of A::counter + This member is annotated +end note +note right of A::start + This method is now explained in a UML note +end note +@enduml + + + +=== Note on method with the same name + + +@startuml +class A { +{static} int counter ++void {abstract} start(int timeoutms) ++void {abstract} start(Duration timeout) +} +note left of A::counter + This member is annotated +end note +note right of A::"start(int timeoutms)" + This method with int +end note +note right of A::"start(Duration timeout)" + This method with Duration +end note +@enduml + + +__[Ref. https://forum.plantuml.net/3474[QA-3474] and https://forum.plantuml.net/5835[QA-5835]]__ + + +== Note on links + + +It is possible to add a note on a link, just after the link definition, using `+note on link+`. + +You can also use `+note left on link+`, `+note right on link+`, `+note top on link+`, +`+note bottom on link+` if you want to change the relative position of the note with the label. + + +@startuml + +class Dummy +Dummy --> Foo : A link +note on link #red: note that is red + +Dummy --> Foo2 : Another link +note right on link #blue +this is my note on right link +and in blue +end note + +@enduml + + + + +== Abstract class and interface + + +You can declare a class as abstract using `+abstract+` or `+abstract class+` keywords. + +The class will be printed in __italic__. + + +You can use the `+interface+`, `+annotation+` and `+enum+` keywords too. + + +@startuml + +abstract class AbstractList +abstract AbstractCollection +interface List +interface Collection + +List <|-- AbstractList +Collection <|-- AbstractCollection + +Collection <|- List +AbstractCollection <|- AbstractList +AbstractList <|-- ArrayList + +class ArrayList { + Object[] elementData + size() +} + +enum TimeUnit { + DAYS + HOURS + MINUTES +} + +annotation SuppressWarnings + +annotation Annotation { + annotation with members + String foo() + String bar() +} + + +@enduml + + +__[Ref. 'Annotation with members' https://github.com/plantuml/plantuml/issues/458[Issue#458]]__ + + +== Hide attributes, methods... + +You can parameterize the display of classes using the `+hide/show+` +command. + +The basic command is: `+hide empty members+`. This +command will hide attributes or methods if they are empty. + +Instead of `+empty members+`, you can use: +* `+empty fields+` or `+empty attributes+` for empty fields, +* `+empty methods+` for empty methods, +* `+fields+` or `+attributes+` which will hide fields, even if they are described, +* `+methods+` which will hide methods, even if they are described, +* `+members+` which will hide fields +++and+++ methods, even if they are described, +* `+circle+` for the circled character in front of class name, +* `+stereotype+` for the stereotype. + +You can also provide, just after the `+hide+` or `+show+` +keyword: +* `+class+` for all classes, +* `+interface+` for all interfaces, +* `+enum+` for all enums, +* `+<>+` for classes which are stereotyped with __foo1__, +* an existing class name. + +You can use several `+show/hide+` commands to define rules and +exceptions. + + +@startuml + +class Dummy1 { + +myMethods() +} + +class Dummy2 { + +hiddenMethod() +} + +class Dummy3 <> { +String name +} + +hide members +hide <> circle +show Dummy1 methods +show <> fields + +@enduml + + + + +== Hide classes + +You can also use the `+show/hide+` commands to hide classes. + +This may be useful if you define a large link::preprocessing[!included file], +and if you want to hide some classes after link::preprocessing[file inclusion]. + + +@startuml + +class Foo1 +class Foo2 + +Foo2 *-- Foo1 + +hide Foo2 + +@enduml + + + +== Remove classes + +You can also use the `+remove+` commands to remove classes. + +This may be useful if you define a large link::preprocessing[!included file], +and if you want to remove some classes after link::preprocessing[file inclusion]. + + +@startuml + +class Foo1 +class Foo2 + +Foo2 *-- Foo1 + +remove Foo2 + +@enduml + + + +== Hide, Remove or Restore tagged element or wildcard + +You can put `+$tags+` (using `+$+`) on elements, then remove, hide or restore components either individually or by tags. + +By default, all components are displayed: + +@startuml +class C1 $tag13 +enum E1 +interface I1 $tag13 +C1 -- I1 +@enduml + + +But you can: +* `+hide $tag13+` components: + +@startuml +class C1 $tag13 +enum E1 +interface I1 $tag13 +C1 -- I1 + +hide $tag13 +@enduml + + +* or `+remove $tag13+` components: + +@startuml +class C1 $tag13 +enum E1 +interface I1 $tag13 +C1 -- I1 + +remove $tag13 +@enduml + + +* or `+remove $tag13 and restore $tag1+` components: + +@startuml +class C1 $tag13 $tag1 +enum E1 +interface I1 $tag13 +C1 -- I1 + +remove $tag13 +restore $tag1 +@enduml + + +* or `+remove * and restore $tag1+` components: + +@startuml +class C1 $tag13 $tag1 +enum E1 +interface I1 $tag13 +C1 -- I1 + +remove * +restore $tag1 +@enduml + + + +== Hide or Remove unlinked class + +By default, all classes are displayed: + +@startuml +class C1 +class C2 +class C3 +C1 -- C2 +@enduml + + +But you can: +* `+hide @unlinked+` classes: + +@startuml +class C1 +class C2 +class C3 +C1 -- C2 + +hide @unlinked +@enduml + + +* or `+remove @unlinked+` classes: + +@startuml +class C1 +class C2 +class C3 +C1 -- C2 + +remove @unlinked +@enduml + + + +__[Adapted from https://forum.plantuml.net/11052[QA-11052]]__ + + +== Use generics + + +You can also use bracket `+<+` and `+>+` to define generics usage in a class. + + +@startuml + +class Foo { + int size() +} +Foo *- Element + +@enduml + + +It is possible to disable this drawing using `+skinparam genericDisplay old+` command. + + + +== Specific Spot + +Usually, a spotted character (C, I, E or A) is used for classes, +interface, enum and abstract classes. + +But you can define your own spot for a class when you define the stereotype, +adding a single character and a color, like in this example: + + +@startuml + +class System << (S,#FF7700) Singleton >> +class Date << (D,orchid) >> +@enduml + + + + +== Packages + +You can define a package using the +`+package+` keyword, and optionally declare a background color +for your package (Using a html color code or name). + +Note that package definitions can be nested. + + +@startuml + +package "Classic Collections" #DDDDDD { + Object <|-- ArrayList +} + +package net.sourceforge.plantuml { + Object <|-- Demo1 + Demo1 *- Demo2 +} + +@enduml + + + + +== Packages style + + + +There are different styles available for packages. + +You can specify them either by setting a default style with the command : `+skinparam packageStyle+`, +or by using a stereotype on the package: + + +@startuml +scale 750 width +package foo1 <> { + class Class1 +} + +package foo2 <> { + class Class2 +} + +package foo3 <> { + class Class3 +} + +package foo4 <> { + class Class4 +} + +package foo5 <> { + class Class5 +} + +package foo6 <> { + class Class6 +} + +@enduml + + + +You can also define links between packages, like in the following +example: + + +@startuml + +skinparam packageStyle rectangle + +package foo1.foo2 { +} + +package foo1.foo2.foo3 { + class Object +} + +foo1.foo2 +-- foo1.foo2.foo3 + +@enduml + + + + +== Namespaces + +In packages, the name of a class is the unique identifier of this class. +It means that you cannot have two classes with the very same name in +different packages. + +In that case, you should use http://en.wikipedia.org/wiki/Namespace_%28computer_science%29[namespaces] +instead of packages. + +You can refer to classes from other namespaces by fully qualify +them. Classes from the default namespace are qualified with a starting +dot. + +Note that you don't have to explicitly create namespace : a fully +qualified class is automatically put in the right namespace. + + +@startuml + +class BaseClass + +namespace net.dummy #DDDDDD { + .BaseClass <|-- Person + Meeting o-- Person + + .BaseClass <|- Meeting +} + +namespace net.foo { + net.dummy.Person <|- Person + .BaseClass <|-- Person + + net.dummy.Meeting o-- Person +} + +BaseClass <|-- net.unused.Person + +@enduml + + + + +== Automatic namespace creation + + + +You can define another separator (other than the dot) using +the command : `+set namespaceSeparator ???+`. + + +@startuml + +set namespaceSeparator :: +class X1::X2::foo { + some info +} + +@enduml + + +You can disable automatic namespace creation using the command +`+set namespaceSeparator none+`. + + +@startuml + +set namespaceSeparator none +class X1.X2.foo { + some info +} + +@enduml + + + +== Lollipop interface + + +You can also define lollipops interface on classes, using the following +syntax: +* `+bar ()- foo+` +* `+bar ()-- foo+` +* `+foo -() bar+` + + +@startuml +class foo +bar ()- foo +@enduml + + + + +== Changing arrows orientation + +By default, links between classes have two dashes `+--+` and are vertically oriented. +It is possible to use horizontal link by putting a single dash (or dot) like this: + + +@startuml +Room o- Student +Room *-- Chair +@enduml + + +You can also change directions by reversing the link: + + +@startuml +Student -o Room +Chair --* Room +@enduml + + +It is also possible to change arrow direction by adding `+left+`, `+right+`, `+up+` +or `+down+` keywords inside the arrow: + + +@startuml +foo -left-> dummyLeft +foo -right-> dummyRight +foo -up-> dummyUp +foo -down-> dummyDown +@enduml + + +You can shorten the arrow by using only the first character of the direction (for example, `+-d-+` instead of +`+-down-+`) +or the two first characters (`+-do-+`). + +Please note that you should not abuse this functionality : __Graphviz__ gives usually good results without tweaking. + +And with the link::use-case-diagram#d551e48d272b2b07[`+left to right direction+`] parameter: + +@startuml +left to right direction +foo -left-> dummyLeft +foo -right-> dummyRight +foo -up-> dummyUp +foo -down-> dummyDown +@enduml + + + +== Association classes + +You can define __association class__ after that a relation has been +defined between two classes, like in this example: + +@startuml +class Student { + Name +} +Student "0..*" - "1..*" Course +(Student, Course) .. Enrollment + +class Enrollment { + drop() + cancel() +} +@enduml + + +You can define it in another direction: + + +@startuml +class Student { + Name +} +Student "0..*" -- "1..*" Course +(Student, Course) . Enrollment + +class Enrollment { + drop() + cancel() +} +@enduml + + + + +== Association on same class + + +@startuml +class Station { + +name: string +} + +class StationCrossing { + +cost: TimeInterval +} + +<> diamond + +StationCrossing . diamond +diamond - "from 0..*" Station +diamond - "to 0..* " Station +@enduml + + +__[Ref. http://wiki.plantuml.net/site/incubation#associations[Incubation: Associations]]__ + + +== Skinparam + + + +You can use the link::skinparam[skinparam] +command to change colors and fonts for the drawing. + +You can use this command : +* In the diagram definition, like any other commands, +* In an link::preprocessing[included file], +* In a configuration file, provided in the link::command-line[command line] or the link::ant-task[ANT task]. + + +@startuml + +skinparam class { +BackgroundColor PaleGreen +ArrowColor SeaGreen +BorderColor SpringGreen +} +skinparam stereotypeCBackgroundColor YellowGreen + +Class01 "1" *-- "many" Class02 : contains + +Class03 o-- Class04 : aggregation + +@enduml + + + + +== Skinned Stereotypes + + +You can define specific color and fonts for stereotyped classes. + + +@startuml + +skinparam class { +BackgroundColor PaleGreen +ArrowColor SeaGreen +BorderColor SpringGreen +BackgroundColor<> Wheat +BorderColor<> Tomato +} +skinparam stereotypeCBackgroundColor YellowGreen +skinparam stereotypeCBackgroundColor<< Foo >> DimGray + +Class01 <> +Class03 <> +Class01 "1" *-- "many" Class02 : contains + +Class03 o-- Class04 : aggregation + +@enduml + + + + +== Color gradient + +You can declare individual colors for classes, notes etc using the # notation. + +You can use standard color names or RGB codes in various notations, see link::color[Colors]. + +You can also use color gradient for background colors, with the following syntax: +two colors names separated either by: +* `+|+`, +* `+/+`, +* `+\+`, or +* `+-+` +depending on the direction of the gradient. + +For example: + + +@startuml + +skinparam backgroundcolor AntiqueWhite/Gold +skinparam classBackgroundColor Wheat|CornflowerBlue + +class Foo #red-green +note left of Foo #blue\9932CC + this is my + note on this class +end note + +package example #GreenYellow/LightGoldenRodYellow { + class Dummy +} + +@enduml + + + +== Help on layout + + +Sometimes, the default layout is not perfect... + +You can use `+together+` keyword to group some classes together : +the layout engine will try to group them (as if they were in the same package). + +You can also use `+hidden+` links to force the layout. + +@startuml + +class Bar1 +class Bar2 +together { + class Together1 + class Together2 + class Together3 +} +Together1 - Together2 +Together2 - Together3 +Together2 -[hidden]--> Bar1 +Bar1 -[hidden]> Bar2 + + +@enduml + + + + + + +== Splitting large files + +Sometimes, you will get some very large image files. + +You can use the `+page (hpages)x(vpages)+` command to split the generated image into several files : + +`+hpages+` is a number that indicated the number of horizontal pages, +and `+vpages+` is a number that indicated the number of vertical pages. + +You can also use some specific skinparam settings to put borders on splitted pages (see example). + + +@startuml +' Split into 4 pages +page 2x2 +skinparam pageMargin 10 +skinparam pageExternalColor gray +skinparam pageBorderColor black + +class BaseClass + +namespace net.dummy #DDDDDD { + .BaseClass <|-- Person + Meeting o-- Person + + .BaseClass <|- Meeting + +} + +namespace net.foo { + net.dummy.Person <|- Person + .BaseClass <|-- Person + + net.dummy.Meeting o-- Person +} + +BaseClass <|-- net.unused.Person +@enduml + + + + + +== Extends and implements + +It is also possible to use `+extends+` and `+implements+` keywords. + +@startuml +class ArrayList implements List +class ArrayList extends AbstractList +@enduml + + + +== Bracketed relations (linking or arrow) style + +=== Line style +It's also possible to have explicitly `+bold+`, `+dashed+`, `+dotted+`, `+hidden+` or `+plain+` relation, links or arrows: + + +* without label + + +@startuml +title Bracketed line style without label +class foo +class bar +bar1 : [bold] +bar2 : [dashed] +bar3 : [dotted] +bar4 : [hidden] +bar5 : [plain] + +foo --> bar +foo -[bold]-> bar1 +foo -[dashed]-> bar2 +foo -[dotted]-> bar3 +foo -[hidden]-> bar4 +foo -[plain]-> bar5 +@enduml + + +* with label + + +@startuml +title Bracketed line style with label +class foo +class bar +bar1 : [bold] +bar2 : [dashed] +bar3 : [dotted] +bar4 : [hidden] +bar5 : [plain] + +foo --> bar : โˆ… +foo -[bold]-> bar1 : [bold] +foo -[dashed]-> bar2 : [dashed] +foo -[dotted]-> bar3 : [dotted] +foo -[hidden]-> bar4 : [hidden] +foo -[plain]-> bar5 : [plain] + +@enduml + + +__[Adapted from https://forum.plantuml.net/4181/how-change-width-line-in-a-relationship-between-two-classes?show=4232#a4232[QA-4181]]__ + +=== Line color + + +@startuml +title Bracketed line color +class foo +class bar +bar1 : [#red] +bar2 : [#green] +bar3 : [#blue] + +foo --> bar +foo -[#red]-> bar1 : [#red] +foo -[#green]-> bar2 : [#green] +foo -[#blue]-> bar3 : [#blue] +'foo -[#blue;#yellow;#green]-> bar4 +@enduml + + +=== Line thickness + + +@startuml +title Bracketed line thickness +class foo +class bar +bar1 : [thickness=1] +bar2 : [thickness=2] +bar3 : [thickness=4] +bar4 : [thickness=8] +bar5 : [thickness=16] + +foo --> bar : โˆ… +foo -[thickness=1]-> bar1 : [1] +foo -[thickness=2]-> bar2 : [2] +foo -[thickness=4]-> bar3 : [4] +foo -[thickness=8]-> bar4 : [8] +foo -[thickness=16]-> bar5 : [16] + +@enduml + + +__[Ref. https://forum.plantuml.net/4949[QA-4949]]__ + +=== Mix + +@startuml +title Bracketed line style mix +class foo +class bar +bar1 : [#red,thickness=1] +bar2 : [#red,dashed,thickness=2] +bar3 : [#green,dashed,thickness=4] +bar4 : [#blue,dotted,thickness=8] +bar5 : [#blue,plain,thickness=16] + +foo --> bar : โˆ… +foo -[#red,thickness=1]-> bar1 : [#red,1] +foo -[#red,dashed,thickness=2]-> bar2 : [#red,dashed,2] +foo -[#green,dashed,thickness=4]-> bar3 : [#green,dashed,4] +foo -[#blue,dotted,thickness=8]-> bar4 : [blue,dotted,8] +foo -[#blue,plain,thickness=16]-> bar5 : [blue,plain,16] +@enduml + + + +== Change relation (linking or arrow) color and style (inline style) + +You can change the link::color[color] or style of individual relation or arrows using the inline following notation: + +* `+#color;line.[bold|dashed|dotted];text:color+` + + +@startuml +class foo +foo --> bar : normal +foo --> bar1 #line:red;line.bold;text:red : red bold +foo --> bar2 #green;line.dashed;text:green : green dashed +foo --> bar3 #blue;line.dotted;text:blue : blue dotted +@enduml + + +__[See similar feature on link::deployment-diagram#0b2e57c3d4eafdda[deployment]]__ + + +== Change class color and style (inline style) + +You can change the link::color[color] or style of individual class using the two following notations: + +* `+#color ##[style]color+` + +With background color first (`+#color+`), then line style and line color (`+##[style]color+` ) + +@startuml +abstract abstract +annotation annotation #pink ##[bold]red +class class #palegreen ##[dashed]green +interface interface #aliceblue ##[dotted]blue +@enduml + + +__[Ref. https://forum.plantuml.net/1487[QA-1487]]__ + +* `+#[color|back:color];header:color;line:color;line.[bold|dashed|dotted];text:color+` + + +@startuml +abstract abstract +annotation annotation #pink;line:red;line.bold;text:red +class class #palegreen;line:green;line.dashed;text:green +interface interface #aliceblue;line:blue;line.dotted;text:blue +@enduml + + +First original example: + +@startuml +class bar #line:green;back:lightblue +class bar2 #lightblue;line:green + +class Foo1 #back:red;line:00FFFF +class FooDashed #line.dashed:blue +class FooDotted #line.dotted:blue +class FooBold #line.bold +class Demo1 #back:lightgreen|yellow;header:blue/red +@enduml + + +__[Ref. https://forum.plantuml.net/3770[QA-3770]]__ + + +== Arrows from/to class members + + +@startuml +class Foo { ++ field1 ++ field2 +} + +class Bar { ++ field3 ++ field4 +} + +Foo::field1 --> Bar::field3 : foo +Foo::field2 --> Bar::field4 : bar +@enduml + + +__[Ref. https://forum.plantuml.net/3636[QA-3636]]__ + + + +@startuml +left to right direction + +class User { + id : INTEGER + .. + other_id : INTEGER +} + +class Email { + id : INTEGER + .. + user_id : INTEGER + address : INTEGER +} + +User::id *-- Email::user_id +@enduml + + +__[Ref. https://forum.plantuml.net/5261[QA-5261]]__ + + +== Grouping inheritance arrow heads + +You can merge all arrow heads using the `+skinparam groupInheritance+`, with a threshold as parameter. + +=== GroupInheritance 1 (no grouping) + +@startuml +skinparam groupInheritance 1 + +A1 <|-- B1 + +A2 <|-- B2 +A2 <|-- C2 + +A3 <|-- B3 +A3 <|-- C3 +A3 <|-- D3 + +A4 <|-- B4 +A4 <|-- C4 +A4 <|-- D4 +A4 <|-- E4 +@enduml + + +=== GroupInheritance 2 (grouping from 2) + +@startuml +skinparam groupInheritance 2 + +A1 <|-- B1 + +A2 <|-- B2 +A2 <|-- C2 + +A3 <|-- B3 +A3 <|-- C3 +A3 <|-- D3 + +A4 <|-- B4 +A4 <|-- C4 +A4 <|-- D4 +A4 <|-- E4 +@enduml + + +=== GroupInheritance 3 (grouping only from 3) + +@startuml +skinparam groupInheritance 3 + +A1 <|-- B1 + +A2 <|-- B2 +A2 <|-- C2 + +A3 <|-- B3 +A3 <|-- C3 +A3 <|-- D3 + +A4 <|-- B4 +A4 <|-- C4 +A4 <|-- D4 +A4 <|-- E4 +@enduml + + +=== GroupInheritance 4 (grouping only from 4) + +@startuml +skinparam groupInheritance 4 + +A1 <|-- B1 + +A2 <|-- B2 +A2 <|-- C2 + +A3 <|-- B3 +A3 <|-- C3 +A3 <|-- D3 + +A4 <|-- B4 +A4 <|-- C4 +A4 <|-- D4 +A4 <|-- E4 +@enduml + + +__[Ref. https://forum.plantuml.net/3193/grouping-inheritance-arrow-ends[QA-3193], and Defect https://forum.plantuml.net/13532/groupinheritance-bug[QA-13532]]__ + + +== Display JSON Data on Class or Object diagram + +=== Simple example + +@startuml +class Class +object Object +json JSON { + "fruit":"Apple", + "size":"Large", + "color": ["Red", "Green"] +} +@enduml + + +__[Ref. https://forum.plantuml.net/15481/possible-link-elements-from-two-jsons-with-both-jsons-embeded?show=15567#c15567[QA-15481]]__ + +For another example, see on link::json#jinnkhaa7d65l0fkhfec[JSON page]. + + diff --git a/plantuml-docs/docs_from_alphadoc/code-groovy.adoc b/plantuml-docs/docs_from_alphadoc/code-groovy.adoc new file mode 100644 index 00000000..0ffa9f35 --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/code-groovy.adoc @@ -0,0 +1,20 @@ +== Groovy API Client Code + +Since calling Java from http://groovy.codehaus.org[Groovy] is pretty simple, the only thing to do is to copy http://sourceforge.net/projects/plantuml/files/plantuml.jar/download[PlantUML.jar] file to the http://groovy.codehaus.org/Running#Running-Addingthingstotheclasspath[classpath] (for example, `+../Groovy/Groovy-1.7.6/lib+` directory). + + +The following script print the current PlantUML version, and encode a URL: +---- +println net.sourceforge.plantuml.version.Version.version() println +net.sourceforge.plantuml.code.TranscoderUtil.getDefaultTranscoder().encode("Bob->Alice:hello") +---- + +If you want to generate an image from a description: +---- +s = new net.sourceforge.plantuml.SourceStringReader("@startuml\nBob->Alice:hello\n@enduml") +FileOutputStream file = new FileOutputStream("c:/testGroovy2.png") +s.generateImage(file); +file.close() +---- + + diff --git a/plantuml-docs/docs_from_alphadoc/code-javascript-asynchronous.adoc b/plantuml-docs/docs_from_alphadoc/code-javascript-asynchronous.adoc new file mode 100644 index 00000000..0622927d --- /dev/null +++ b/plantuml-docs/docs_from_alphadoc/code-javascript-asynchronous.adoc @@ -0,0 +1,104 @@ +== Javascript API Client Code + +To use PlantUML image generation, a text diagram description have to be : + +. Encoded in UTF-8 +. Compressed using http://en.wikipedia.org/wiki/DEFLATE[Deflate] algorithm +. Reencoded in ASCII using a transformation __close__ to http://en.wikipedia.org/wiki/Base64[base64] + +This is exactly what the following `+compress()+` function is doing. + +''' + +---- + + + + +
+