1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-21 12:35:10 +00:00

Merge branch 'master' into cheneer

This commit is contained in:
Benjamin Davies 2024-03-16 16:59:49 +13:00
commit 60de4baff9
No known key found for this signature in database
GPG Key ID: 9FFDE0674336C460
581 changed files with 8737 additions and 3102 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
*.java text=auto

58
.github/labeler.yml vendored
View File

@ -1,37 +1,55 @@
'm:release':
- 'CHANGELOG.md'
- 'gradle.properties'
- changed-files:
- any-glob-to-any-file:
- 'CHANGELOG.md'
- 'gradle.properties'
'm:docs':
- '*.md'
- 'docs/**/*'
- changed-files:
- any-glob-to-any-file:
- '*.md'
- 'docs/**/*'
'm:workflow':
- .github/**
- changed-files:
- any-glob-to-any-file:
- .github/**
'm:gradle':
- 'gradle*'
- 'gradle/**'
- '**/settings.gradle.*'
- '**/build.gradle.*'
- 'sjpp.jar'
- changed-files:
- any-glob-to-any-file:
- 'gradle*'
- 'gradle/**'
- '**/settings.gradle.*'
- '**/build.gradle.*'
- 'sjpp.jar'
'm:source':
- 'skin/**/*'
- 'src/**/*'
- 'stdlib/**/*'
- 'svg/**/*'
- 'themes/**/*'
- 'manifest.txt'
- changed-files:
- any-glob-to-any-file:
- 'skin/**/*'
- 'src/**/*'
- 'stdlib/**/*'
- 'svg/**/*'
- 'themes/**/*'
- 'manifest.txt'
'm:test':
- 'test/**/*'
- changed-files:
- any-glob-to-any-file:
- 'test/**/*'
'm:license':
- '**/*license.txt'
- changed-files:
- any-glob-to-any-file:
- '**/*license.txt'
'm:docker':
- Dockerfile
- changed-files:
- any-glob-to-any-file:
- Dockerfile
'm:native':
- .github/workflows/native-image.yml
- changed-files:
- any-glob-to-any-file:
- .github/workflows/native-image.yml

View File

@ -12,7 +12,7 @@ jobs:
permissions:
issues: write
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({

View File

@ -99,7 +99,7 @@ jobs:
- name: Set up java
if: needs.workflow_config.outputs.do_test_linux == 'true'
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java_version }}
distribution: temurin
@ -115,7 +115,7 @@ jobs:
run: gradle test --no-daemon -i
- name: Upload test reports
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: needs.workflow_config.outputs.do_test_linux == 'true'
with:
# Using github.run_number here to reduce confusion when downloading & comparing from several builds
@ -132,7 +132,7 @@ jobs:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
@ -172,7 +172,7 @@ jobs:
run: |
echo "release_version=$(gradle properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_OUTPUT
- name: Cache libs
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: |
build/libs
@ -195,7 +195,7 @@ jobs:
uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
@ -221,14 +221,14 @@ jobs:
uses: actions/checkout@v4
- name: Set up java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Restore Libs cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: |
build/libs
@ -244,7 +244,7 @@ jobs:
enableCrossOsArchive: true
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
# Using github.run_number here to reduce confusion when downloading & comparing artifacts from several builds
name: ${{ github.run_number }}-artifacts

View File

@ -7,7 +7,7 @@ jobs:
if: github.event.label.name == 'p:backlog'
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- uses: actions/github-script@v7
with:
script: |
const welcomeMessage = `

View File

@ -9,4 +9,4 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
- uses: actions/labeler@v5

View File

@ -32,7 +32,7 @@ jobs:
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache/restore@v3
- uses: actions/cache/restore@v4
with:
path: |
build/libs
@ -57,7 +57,7 @@ jobs:
native-image -H:ConfigurationFileDirectories=native-image-config-dir --no-fallback --report-unsupported-elements-at-runtime -jar "build/libs/plantuml-${{ inputs.release-version }}.jar" -H:Path="build/libs" -H:Name="plantuml-${{ matrix.platform }}-${{ inputs.release-version }}"
- name: Cache native image
uses: actions/cache/save@v3
uses: actions/cache/save@v4
with:
path: "build/libs/plantuml-${{ matrix.platform }}-*"
key: "native-image-${{ matrix.platform }}-${{ github.run_id }}"

2
.gitignore vendored
View File

@ -8,7 +8,7 @@
out
#vscode files
/bin
**/bin/
# Ant result file
plantuml.jar

View File

@ -2,7 +2,7 @@
Thank you for your interest in contributing to PlantUML! This guide will help you build the PlantUML project.
PlantUML can be built using either [Gradle](#building-plantuml-with-gradle) or [Ant](#building-plantuml-with-ant-alternative-method). It's recommended to use Gradle as the primary build tool for this project. You will find instructions for both methods, starting with Gradle.
PlantUML can be built using either [Gradle](#-building-plantuml-with-gradle) or [Ant](#-building-plantuml-with-ant-alternative-method). It's recommended to use Gradle as the primary build tool for this project. You will find instructions for both methods, starting with Gradle.
## ☕ Java Compatibility and Development Notes

View File

@ -56,6 +56,7 @@ PlantUML is a component that allows you to create various UML diagrams through s
- [SDL (Specification and Description Language)](http://plantuml.com/activity-diagram-beta#sdl)
- [Ditaa diagram](http://plantuml.com/ditaa)
- [Gantt diagram](http://plantuml.com/gantt-diagram)
- [Chronology diagram](http://plantuml.com/chronology-diagram)
- [MindMap diagram](http://plantuml.com/mindmap-diagram)
- [WBS (Work Breakdown Structure)](http://plantuml.com/wbs-diagram)
- [Mathematical Notations (AsciiMath, JLaTeXMath)](http://plantuml.com/ascii-math)

View File

@ -31,8 +31,9 @@ dependencies {
compileOnly("org.apache.ant:ant:1.10.14")
testImplementation("io.github.glytching:junit-extensions:2.6.0")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.xmlunit:xmlunit-core:2.9.+")
if (JavaVersion.current().isJava8) {
testImplementation("org.mockito:mockito-core:4.+")
testImplementation("org.mockito:mockito-junit-jupiter:4.+")

View File

@ -0,0 +1,97 @@
# PlantUML packages and PlantUML on the _[most popular]_ GNU/Linux distributions
## PlantUML packages
### GitHub _(The main PlantUML package repository)_
[![GitHub Release](https://img.shields.io/github/v/release/plantuml/plantuml)](https://github.com/plantuml/plantuml/releases/latest)
### Chocolatey
[![Chocolatey Version](https://img.shields.io/chocolatey/v/plantuml)](https://community.chocolatey.org/packages/plantuml)
### Docker
[![Docker Image Version](https://img.shields.io/docker/v/plantuml/plantuml)](https://github.com/plantuml/plantuml/pkgs/container/plantuml)
### Homebrew
[![homebrew version](https://img.shields.io/homebrew/v/plantuml)](https://formulae.brew.sh/formula/plantuml)
### Maven
[![Maven Central Version](https://img.shields.io/maven-central/v/net.sourceforge.plantuml/plantuml)](https://mvnrepository.com/artifact/net.sourceforge.plantuml/plantuml)
### Scoop
[![Scoop Version](https://img.shields.io/scoop/v/plantuml?bucket=extras)](https://scoop.sh/#/apps?q=plantuml)
## PlantUML on the _[most popular]_ GNU/Linux distributions
### [Alpine Linux](https://www.alpinelinux.org)
| Type | Link |
| ------- | ---- |
| Distribution | ![Alpine Linux](https://img.shields.io/badge/Alpine_Linux-%230D597F.svg?style=for-the-badge&logo=alpine-linux&logoColor=white) |
| Last PlantUML version | |
| Link | https://pkgs.alpinelinux.org/packages?name=plantuml&branch=edge |
| Specificity | |
### [Archlinux](https://archlinux.org)
| Type | Link |
| ------- | ---- |
| Distribution | ![Arch](https://img.shields.io/badge/Arch%20Linux-1793D1?logo=arch-linux&logoColor=fff&style=for-the-badge) |
| Last PlantUML version | [![Arch Linux package](https://img.shields.io/archlinux/v/extra/any/plantuml)](https://archlinux.org/packages/extra/any/plantuml/) |
| Link | https://archlinux.org/packages/extra/any/plantuml/ |
| Specificity | |
### [Debian](https://www.debian.org)
| Type | Link |
| ------- | ---- |
| Distribution | ![Debian](https://img.shields.io/badge/Debian-D70A53?style=for-the-badge&logo=debian&logoColor=white) |
| Last PlantUML version | [![Debian package](https://img.shields.io/debian/v/plantuml)](https://salsa.debian.org/debian/plantuml) |
| Link | https://salsa.debian.org/debian/plantuml |
| Specificity | https://salsa.debian.org/debian/plantuml/-/tree/master/debian |
### [Fedora](https://fedoraproject.org)
| Type | Link |
| ------- | ---- |
| Distribution | ![Fedora](https://img.shields.io/badge/Fedora-294172?style=for-the-badge&logo=fedora&logoColor=white) |
| Last PlantUML version | [![Fedora package](https://img.shields.io/fedora/v/plantuml)](https://src.fedoraproject.org/rpms/plantuml) |
| Link | https://src.fedoraproject.org/rpms/plantuml |
| Specificity | |
### [Gentoo](https://www.gentoo.org/)
| Type | Link |
| ------- | ---- |
| Distribution | ![Gentoo](https://img.shields.io/badge/Gentoo-54487A?style=for-the-badge&logo=gentoo&logoColor=white) |
| Last PlantUML version | |
| Link | https://packages.gentoo.org/packages/media-gfx/plantuml |
| Specificity | |
### [openSUSE](https://www.opensuse.org)
| Type | Link |
| ------- | ---- |
| Distribution | ![openSUSE](https://img.shields.io/badge/openSUSE-%2364B345?style=for-the-badge&logo=openSUSE&logoColor=white) |
| Last PlantUML version | |
| Link | https://build.opensuse.org/search?search_text=plantuml |
| Specificity | https://build.opensuse.org/package/show/Java:packages/plantuml <br> https://build.opensuse.org/package/show/home:mnhauke/plantuml |
### [SUSE](https://www.suse.com)
| Type | Link |
| ------- | ---- |
| Distribution | ![Suse](https://img.shields.io/badge/SUSE-0C322C?style=for-the-badge&logo=SUSE&logoColor=white) |
| Last PlantUML version | |
| Link | https://packagehub.suse.com/packages/plantuml/ |
| Specificity | |
### [Ubuntu](https://ubuntu.com)
| Type | Link |
| ------- | ---- |
| Distribution | ![Ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white) |
| Last PlantUML version | [![Ubuntu Package Version](https://img.shields.io/ubuntu/v/plantuml)](https://packages.ubuntu.com/search?keywords=plantuml&searchon=names&suite=all&section=all) |
| Link | https://packages.ubuntu.com/search?keywords=plantuml&searchon=names&suite=all&section=all |
| Specificity | |
# Reference and acknowledgement
- https://en.wikipedia.org/wiki/List_of_software_package_management_systems
- https://en.wikipedia.org/wiki/List_of_Linux_distributions
- https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file
- https://shields.io

58
docs/SUPPORT.md Normal file
View File

@ -0,0 +1,58 @@
# 🌱 PlantUML Support
Thank you for using PlantUML! If you need assistance or have questions, please refer to the following resources:
## Where to Get Support
### GitHub Issues
- For reporting bugs or issues, open an [issue on GitHub](https://github.com/plantuml/plantuml/issues).
- When submitting an issue, provide clear steps to reproduce the problem and include your PlantUML version.
- Before creating a new issue, search the existing ones on [GitHub](https://github.com/plantuml/plantuml/issues) to see if your problem has already been addressed.
### Community Forum
- Visit our [Community Forum](https://forum.plantuml.net/) for discussions, FAQs, and community support.
- Check for existing threads to see if your question has already been answered.
### Discord
- Feel free to ask questions on our official [Discord](https://discord.com/invite/sXhzexAQGh) server.
## Asking Questions
If you have a question about using PlantUML:
- Search through the [official documentation](https://plantuml.com/) and available resources before asking.
- Feel free to ask questions on the GitHub issues or the Community Forum after performing initial research.
- Provide as much detail as possible when asking questions to receive effective assistance.
## Contributing
We welcome contributions to PlantUML! If you're interested in contributing:
### Reporting Bugs
- Ensure you're using the latest version and search for existing issues on GitHub or the Community Forum before reporting a bug.
- Submit a bug report on [GitHub](https://github.com/plantuml/plantuml/issues) with clear steps to reproduce and your environment details.
### Suggesting Enhancements
- Search existing enhancement suggestions on GitHub or the Community Forum before submitting a new one.
- Submit your enhancement suggestion with a clear title and detailed description on [GitHub](https://github.com/plantuml/plantuml/issues).
### Your First Code Contribution
- Review our [contributing guide](CONTRIBUTING.md) to get started with code contributions.
- If you're new to contributing, consider tackling issues labeled as 'good first issue' or 'help wanted'.
## Additional Resources
- For comprehensive documentation, refer to the [official PlantUML Javadoc](https://plantuml.github.io/plantuml/).
- Explore the [GitHub issues](https://github.com/plantuml/plantuml/issues/) for discussions and known problems.
## 🧑‍🤝‍🧑 Community Support
Feel free to engage with the PlantUML community on GitHub and the Community Forum.
Thank you for being a part of the PlantUML community!

View File

@ -1,4 +1,4 @@
# Warning, "version" should be the same in gradle.properties and Version.java
# Any idea anyone how to magically synchronize those :-) ?
version = 1.2023.13beta1
version = 1.2024.4beta6
org.gradle.workers.max = 3

View File

@ -25,9 +25,10 @@ java {
dependencies {
compileOnly("org.apache.ant:ant:1.10.14")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
testImplementation("org.xmlunit:xmlunit-core:2.9.+")
}
repositories {

View File

@ -25,8 +25,8 @@ java {
dependencies {
compileOnly("org.apache.ant:ant:1.10.14")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
}

View File

@ -25,9 +25,10 @@ java {
dependencies {
compileOnly("org.apache.ant:ant:1.10.14")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
testImplementation("org.xmlunit:xmlunit-core:2.9.+")
}
repositories {

View File

@ -25,9 +25,10 @@ java {
dependencies {
compileOnly("org.apache.ant:ant:1.10.14")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
testImplementation("org.xmlunit:xmlunit-core:2.9.+")
}
repositories {

View File

@ -25,9 +25,10 @@ java {
dependencies {
compileOnly("org.apache.ant:ant:1.10.14")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
testImplementation("org.xmlunit:xmlunit-core:2.9.+")
}
repositories {

View File

@ -25,9 +25,10 @@ java {
dependencies {
compileOnly("org.apache.ant:ant:1.10.14")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
testImplementation("org.assertj:assertj-core:3.25.3")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testImplementation("org.scilab.forge:jlatexmath:1.0.7")
testImplementation("org.xmlunit:xmlunit-core:2.9.+")
}
repositories {

View File

@ -367,9 +367,21 @@ ganttDiagram {
Margin 5
Padding 5
}
verticalSeparator {
LineThickness 2
LineStyle 2-2
LineColor black
}
timeline {
BackgroundColor transparent
LineColor #C0C0C0
FontSize 10
month {
FontSize 12
}
year {
FontSize 14
}
}
closed {
BackGroundColor #F1E5E5

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.BlockUml;
import net.sourceforge.plantuml.BlockUmlBuilder;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.klimt.color.ColorMapper;
@ -122,7 +123,7 @@ public class DirectDraw {
ug.apply(back).apply(back.bg()).draw(URectangle.build(frameWidth, frameHeight));
WasmLog.log("...drawing...");
system.exportDiagramGraphic(ug);
system.exportDiagramGraphic(ug, new FileFormatOption(FileFormat.PNG));
WasmLog.log("done!");

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.BlockUmlBuilder;
import net.sourceforge.plantuml.EmptyImageBuilder;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.ImageData;
@ -124,7 +125,7 @@ public class Raw {
ug.resetMax();
WasmLog.log("...drawing...");
system.exportDiagramGraphic(ug);
system.exportDiagramGraphic(ug, new FileFormatOption(FileFormat.PNG));
final int width = (int) (2 + ug.getMaxX());
final int height = (int) (2 + ug.getMaxY());
@ -208,7 +209,7 @@ public class Raw {
ug.resetMax();
WasmLog.log("...drawing...");
system.exportDiagramGraphic(ug);
system.exportDiagramGraphic(ug, new FileFormatOption(FileFormat.PNG));
final int width = (int) (2 + ug.getMaxX());
final int height = (int) (2 + ug.getMaxY());

View File

@ -12,9 +12,9 @@
* </ul>
* </p>
*
* @see gen
* @see "gen"
* @see gen.annotation
* @see gen.lib
* @see "gen.lib"
* @see gen.plugin.dot_layout
* @see smetana.core
* @see net.sourceforge.plantuml.sdot

View File

@ -0,0 +1,16 @@
/*
* Disclaimer 🚩
* This file was not part of the original package.
* It was included only on the PlantUML package
* to provide source citation and documentation.
*
*/
/**
* Internal copy of
* <a href="https://jcckit.sourceforge.net" target="_top">
* <code>JCCKit</code></a> <i>(code of Franz-Josef Elmer)</i>.
*
* @see net.sourceforge.plantuml.jcckit
*
*/
package jcckit;

15
src/jcckit/readme.md Normal file
View File

@ -0,0 +1,15 @@
> [!WARNING]
> **Disclaimer**:
> This file was not part of the original package.
> It was included only on the PlantUML package to provide source citation and documentation.
# Directory Documentation for `jcckit`
## Description
Internal copy of `JCCKit` _(code of Franz-Josef Elmer)_.
## Credit
- [JCCKit _(on Sourceforge)_](https://jcckit.sourceforge.net)
## See more information on
- [readme of `plantuml/jcckit`](../net/sourceforge/plantuml/jcckit/readme.md)

View File

@ -376,13 +376,13 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
// ::done
@Override
final public void exportDiagramGraphic(UGraphic ug) {
final public void exportDiagramGraphic(UGraphic ug, FileFormatOption fileFormatOption) {
final CucaDiagramFileMaker maker = new CucaDiagramFileMakerSmetana(this, ug.getStringBounder());
maker.createOneGraphic(ug);
}
@Override
final protected TextBlock getTextBlock() {
final protected TextBlock getTextMainBlock(FileFormatOption fileFormatOption) {
throw new UnsupportedOperationException();
}

View File

@ -114,14 +114,14 @@ public abstract class AbstractPSystem implements Diagram {
}
final public String getMetadata() {
if (source == null)
if (source == null)
return getVersion();
final String rawString = source.getRawString("\n");
final String plainString = source.getPlainString("\n");
if (rawString != null && rawString.equals(plainString))
if (rawString != null && rawString.equals(plainString))
return rawString + BackSlash.NEWLINE + getVersion();
return rawString + BackSlash.NEWLINE + plainString + BackSlash.NEWLINE + getVersion();
}
@ -130,9 +130,9 @@ public abstract class AbstractPSystem implements Diagram {
}
final public long seed() {
if (source == null)
if (source == null)
return 42;
return getSource().seed();
}
@ -159,9 +159,9 @@ public abstract class AbstractPSystem implements Diagram {
}
public DisplayPositionned getTitle() {
if (source == null)
if (source == null)
return DisplayPositioned.single(Display.empty(), HorizontalAlignment.CENTER, VerticalAlignment.TOP);
return DisplayPositioned.single(source.getTitle(), HorizontalAlignment.CENTER, VerticalAlignment.TOP);
}
@ -247,7 +247,7 @@ public abstract class AbstractPSystem implements Diagram {
}
@Override
public void exportDiagramGraphic(UGraphic ug) {
public void exportDiagramGraphic(UGraphic ug, FileFormatOption fileFormatOption) {
final UFont font = UFont.monospaced(14);
final FontConfiguration fc = FontConfiguration.blackBlueTrue(font);
final UText text = UText.build("Not implemented yet for " + getClass().getName(), fc);

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.abel.DisplayPositioned;
import net.sourceforge.plantuml.activitydiagram3.ftile.EntityImageLegend;
import net.sourceforge.plantuml.cucadiagram.DisplaySection;
import net.sourceforge.plantuml.klimt.Fashion;
import net.sourceforge.plantuml.klimt.LineBreakStrategy;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.creole.Display;
@ -167,7 +168,7 @@ public class AnnotatedBuilder {
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.title)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
final TextBlock block = style.createTextBlockBordered(title.getDisplay(), skinParam.getIHtmlColorSet(),
skinParam, Style.ID_TITLE);
skinParam, Style.ID_TITLE, LineBreakStrategy.NONE);
return block;
}
@ -179,7 +180,7 @@ public class AnnotatedBuilder {
final Style style = StyleSignatureBasic.of(SName.root, SName.document, SName.caption)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
return style.createTextBlockBordered(caption.getDisplay(), skinParam.getIHtmlColorSet(), skinParam,
Style.ID_CAPTION);
Style.ID_CAPTION, LineBreakStrategy.NONE);
}

View File

@ -143,7 +143,7 @@ public class BlockUml {
this.data = new ArrayList<>(strings);
} else {
final TimLoader timLoader = new TimLoader(mode.getImportedFiles(), defines, charset,
(DefinitionsContainer) mode);
(DefinitionsContainer) mode, strings.get(0));
this.included.addAll(timLoader.load(strings));
this.data = timLoader.getResultList();
this.debug = timLoader.getDebug();

View File

@ -119,6 +119,9 @@ public class EmbeddedDiagram extends AbstractTextBlock implements Line, Atom {
if (s.equals(EMBEDDED_START + "files"))
return "files";
if (s.equals(EMBEDDED_START + "chronology"))
return "chronology";
return null;
}

View File

@ -112,6 +112,9 @@ public class Option {
private FileFormatOption fileFormatOption = new FileFormatOption(FileFormat.PNG);
/**
* @deprecated Use {@link #setFileFormatOption(FileFormatOption)} instead
*/
@Deprecated
@ApiWarning(willBeRemoved = "in next major release")
final public void setFileFormat(FileFormat fileFormat) {
@ -440,9 +443,11 @@ public class Option {
} else if (s.equalsIgnoreCase("-preproc")) {
preprocessorOutput = OptionPreprocOutputMode.NORMAL;
setFileFormatOption(new FileFormatOption(FileFormat.PREPROC));
} else if (s.equalsIgnoreCase("-cypher")) {
preprocessorOutput = OptionPreprocOutputMode.CYPHER;
setFileFormatOption(new FileFormatOption(FileFormat.PREPROC));
} else if (s.equalsIgnoreCase("-checkmetadata")) {
checkMetadata = true;

View File

@ -85,83 +85,77 @@ public class OptionPrint {
System.out.println("\t?\tone and only one character but '" + SFile.separator + "'");
System.out.println("\t**\tmeans any characters (used to recurse through directories)");
System.out.println();
System.out.println("where options include:");
System.out.println(" -darkmode\t\tTo use dark mode for diagrams");
System.out.println(" -gui\t\tTo run the graphical user interface");
System.out.println(" -tpng\t\tTo generate images using PNG format (default)");
System.out.println(" -tsvg\t\tTo generate images using SVG format");
System.out.println(" -teps\t\tTo generate images using EPS format");
System.out.println(" -tpdf\t\tTo generate images using PDF format");
System.out.println(" -tvdx\t\tTo generate images using VDX format");
System.out.println(" -txmi\t\tTo generate XMI file for class diagram");
System.out.println(" -tscxml\t\tTo generate SCXML file for state diagram");
System.out.println(" -thtml\t\tTo generate HTML file for class diagram");
System.out.println(" -ttxt\t\tTo generate images with ASCII art");
System.out.println(" -tutxt\t\tTo generate images with ASCII art using Unicode characters");
System.out.println(" -tlatex\t\tTo generate images using LaTeX/Tikz format");
System.out.println(" -tlatex:nopreamble\tTo generate images using LaTeX/Tikz format without preamble");
System.out.println(" -o[utput] \"dir\"\tTo generate images in the specified directory");
System.out.println(" -DVAR1=value\tTo set a preprocessing variable as if '!define VAR1 value' were used");
System.out.println(" -Sparam1=value\tTo set a skin parameter as if 'skinparam param1 value' were used");
System.out.println(" -Ppragma1=value\tTo set pragma as if '!pragma pragma1 value' were used");
// System.out.println(" -config \"file\"\tTo read the provided config file
// before each diagram");
final char separator = SFile.separatorChar;
System.out.println(" -I" + separator + "path" + separator + "to" + separator
+ "file\tTo include file as if '!include file' were used");
System.out.println(
" -I" + separator + "path" + separator + "to" + separator + "*.puml\tTo include files with pattern");
System.out.println(" -theme xxx\t\tTo use a specific theme");
System.out.println(" -charset xxx\tTo use a specific charset (default is " + charset + ")");
System.out.println(" -e[x]clude pattern\tTo exclude files that match the provided pattern");
System.out.println(" -metadata\t\tTo retrieve PlantUML sources from PNG images");
System.out.println(" -nometadata\t\tTo NOT export metadata in PNG/SVG generated files");
System.out.println("where options include:");
System.out.println(" -author[s]\t\tTo print information about PlantUML authors");
System.out.println(" -checkmetadata\t\tSkip PNG files that don't need to be regenerated");
System.out.println(" -version\t\tTo display information about PlantUML and Java versions");
System.out.println(" -v[erbose]\t\tTo have log information");
System.out.println(" -quiet\t\tTo NOT print error message into the console");
System.out.println(" -debugsvek\t\tTo generate intermediate svek files");
System.out.println(" -h[elp]\t\tTo display this help message");
System.out.println(" -testdot\t\tTo test the installation of graphviz");
System.out.println(" -graphvizdot \"exe\"\tTo specify dot executable");
System.out.println(" -p[ipe]\t\tTo use stdin for PlantUML source and stdout for PNG/SVG/EPS generation");
System.out.println(
" -encodesprite 4|8|16[z] \"file\"\tTo encode a sprite at gray level (z for compression) from an image");
System.out.println(" -computeurl|-encodeurl\tTo compute the encoded URL of a PlantUML source file");
System.out.println(" -decodeurl\t\tTo retrieve the PlantUML source from an encoded URL");
System.out.println(" -syntax\t\tTo report any syntax error from standard input without generating images");
System.out.println(" -language\t\tTo print the list of PlantUML keywords");
// System.out.println(" -nosuggestengine\tTo disable the suggest engine when
// errors in diagrams");
System.out.println(" -checkonly\t\tTo check the syntax of files without generating images");
System.out.println(" -charset xxx\tTo use a specific charset (default is " + charset + ")");
System.out.println(" -computeurl|-encodeurl\tTo compute the encoded URL of a PlantUML source file");
// System.out.println(" -config \"file\"\tTo read the provided config file
System.out.println(" -cypher\t\tTo cypher texts of diagrams so that you can share them");
System.out.println(" -DVAR1=value\tTo set a preprocessing variable as if '!define VAR1 value' were used");
System.out.println(" -darkmode\t\tTo use dark mode for diagrams");
System.out.println(" -debugsvek\t\tTo generate intermediate svek files");
System.out.println(" -decodeurl\t\tTo retrieve the PlantUML source from an encoded URL");
System.out.println(" -disablestats\tTo disable statistics computation (default)");
System.out.println(" -duration\t\tTo print the duration of complete diagrams processing");
System.out.println(" -e[x]clude pattern\tTo exclude files that match the provided pattern");
System.out.println(" -enablestats\tTo enable statistics computation");
System.out.println(" -encodesprite 4|8|16[z] \"file\"\tTo encode a sprite at gray level (z for compression) from an image");
System.out.println(" -extractstdlib\tTo extract PlantUML Standard Library into stdlib folder");
System.out.println(" -failfast\t\tTo stop processing as soon as a syntax error in diagram occurs");
System.out.println(" -failfast2\t\tTo do a first syntax check before processing files, to fail even faster");
System.out.println(" -noerror\t\tTo skip images when error in diagrams");
System.out.println(" -duration\t\tTo print the duration of complete diagrams processing");
System.out.println(" -filedir xxx\tTo behave as if the PlantUML source is in this dir (only affects '-pipe' and PicoWeb 'POST /render')");
System.out.println(" -filename \"example.puml\"\tTo override %filename% variable");
System.out.println(" -graphvizdot \"exe\"\tTo specify dot executable");
System.out.println(" -gui\t\tTo run the graphical user interface");
System.out.println(" -h[elp]\t\tTo display this help message");
System.out.println(" -htmlstats\t\tTo output general statistics in file plantuml-stats.html");
System.out.println(" -I" + separator + "path" + separator + "to" + separator + "file\tTo include file as if '!include file' were used");
System.out.println(" -I" + separator + "path" + separator + "to" + separator + "*.puml\tTo include files with pattern");
System.out.println(" -language\t\tTo print the list of PlantUML keywords");
System.out.println(" -loopstats\t\tTo continuously print statistics about usage");
System.out.println(" -metadata\t\tTo retrieve PlantUML sources from PNG images");
System.out.println(" -nbthread N\t\tTo use (N) threads for processing");
System.out.println(" -nbthread auto\tTo use " + Option.defaultNbThreads() + " threads for processing");
System.out
.println(" -timeout N\t\tProcessing timeout in (N) seconds. Defaults to 15 minutes (900 seconds).");
System.out.println(" -author[s]\t\tTo print information about PlantUML authors");
System.out.println(" -noerror\t\tTo skip images when error in diagrams");
System.out.println(" -nometadata\t\tTo NOT export metadata in PNG/SVG generated files");
System.out.println(" -o[utput] \"dir\"\tTo generate images in the specified directory");
System.out.println(" -overwrite\t\tTo allow to overwrite read only files");
System.out.println(" -printfonts\t\tTo print fonts available on your system");
System.out.println(" -enablestats\tTo enable statistics computation");
System.out.println(" -disablestats\tTo disable statistics computation (default)");
System.out.println(" -htmlstats\t\tTo output general statistics in file plantuml-stats.html");
System.out.println(" -xmlstats\t\tTo output general statistics in file plantuml-stats.xml");
System.out.println(" -realtimestats\tTo generate statistics on the fly rather than at the end");
System.out.println(" -loopstats\t\tTo continuously print statistics about usage");
System.out.println(" -splash\t\tTo display a splash screen with some progress bar");
System.out.println(" -progress\t\tTo display a textual progress bar in console");
System.out.println(" -pipeimageindex N\tTo generate the Nth image with pipe option");
System.out.println(" -stdlib\t\tTo print standard library info");
System.out.println(" -extractstdlib\tTo extract PlantUML Standard Library into stdlib folder");
System.out.println(
" -filedir xxx\tTo behave as if the PlantUML source is in this dir (only affects '-pipe' and PicoWeb 'POST /render')");
System.out.println(" -filename \"example.puml\"\tTo override %filename% variable");
System.out.println(" -preproc\t\tTo output preprocessor text of diagrams");
System.out.println(" -cypher\t\tTo cypher texts of diagrams so that you can share them");
System.out.println(" -Ppragma1=value\tTo set pragma as if '!pragma pragma1 value' were used");
System.out.println(" -p[ipe]\t\tTo use stdin for PlantUML source and stdout for PNG/SVG/EPS generation");
System.out.println(" -picoweb\t\tTo start internal HTTP Server. See https://plantuml.com/picoweb");
System.out.println(" -pipeimageindex N\tTo generate the Nth image with pipe option");
System.out.println(" -preproc\t\tTo output preprocessor text of diagrams");
System.out.println(" -printfonts\t\tTo print fonts available on your system");
System.out.println(" -progress\t\tTo display a textual progress bar in console");
System.out.println(" -quiet\t\tTo NOT print error message into the console");
System.out.println(" -realtimestats\tTo generate statistics on the fly rather than at the end");
System.out.println(" -Sparam1=value\tTo set a skin parameter as if 'skinparam param1 value' were used");
System.out.println(" -splash\t\tTo display a splash screen with some progress bar");
System.out.println(" -stdlib\t\tTo print standard library info");
System.out.println(" -syntax\t\tTo report any syntax error from standard input without generating images");
System.out.println(" -testdot\t\tTo test the installation of graphviz");
System.out.println(" -theme xxx\t\tTo use a specific theme");
System.out.println(" -timeout N\t\tProcessing timeout in (N) seconds. Defaults to 15 minutes (900 seconds).");
System.out.println(" -teps\t\tTo generate images using EPS format");
System.out.println(" -testdot\t\tTo test the installation of graphviz");
System.out.println(" -theme xxx\t\tTo use a specific theme");
System.out.println(" -thtml\t\tTo generate HTML file for class diagram");
System.out.println(" -tlatex:nopreamble\tTo generate images using LaTeX/Tikz format without preamble");
System.out.println(" -tlatex\t\tTo generate images using LaTeX/Tikz format");
System.out.println(" -tpdf\t\tTo generate images using PDF format");
System.out.println(" -tpng\t\tTo generate images using PNG format (default)");
System.out.println(" -tscxml\t\tTo generate SCXML file for state diagram");
System.out.println(" -tsvg\t\tTo generate images using SVG format");
System.out.println(" -ttxt\t\tTo generate images with ASCII art");
System.out.println(" -tutxt\t\tTo generate images with ASCII art using Unicode characters");
System.out.println(" -tvdx\t\tTo generate images using VDX format");
System.out.println(" -txmi\t\tTo generate XMI file for class diagram");
System.out.println(" -v[erbose]\t\tTo have log information");
System.out.println(" -version\t\tTo display information about PlantUML and Java versions");
System.out.println(" -xmlstats\t\tTo output general statistics in file plantuml-stats.xml");
System.out.println();
System.out.println("If needed, you can setup the environment variable GRAPHVIZ_DOT.");
exit(0);

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.api.PSystemFactory;
import net.sourceforge.plantuml.board.BoardDiagramFactory;
import net.sourceforge.plantuml.bpm.BpmDiagramFactory;
import net.sourceforge.plantuml.cheneer.ChenEerDiagramFactory;
import net.sourceforge.plantuml.chronology.ChronologyDiagramFactory;
import net.sourceforge.plantuml.classdiagram.ClassDiagramFactory;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
@ -253,6 +254,7 @@ public class PSystemBuilder {
// ::done
factories.add(new GanttDiagramFactory());
factories.add(new ChronologyDiagramFactory());
factories.add(new FlowDiagramFactory());
// ::comment when __CORE__

View File

@ -66,14 +66,13 @@ public abstract class PlainDiagram extends AbstractPSystem {
}
@Override
public void exportDiagramGraphic(UGraphic ug) {
final FileFormatOption option = new FileFormatOption(FileFormat.PNG);
public void exportDiagramGraphic(UGraphic ug, FileFormatOption fileFormatOption) {
try {
final UDrawable rootDrawable = getRootDrawable(option);
final UDrawable rootDrawable = getRootDrawable(fileFormatOption);
rootDrawable.drawU(ug);
} catch (IOException e) {
e.printStackTrace();
super.exportDiagramGraphic(ug);
super.exportDiagramGraphic(ug, fileFormatOption);
}
}

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.klimt.shape.GraphicStrings;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.text.StringLocated;
import net.sourceforge.plantuml.utils.Log;
public class SourceStringReader {
@ -106,6 +107,9 @@ public class SourceStringReader {
}
}
/**
* @deprecated Use {@link #outputImage(OutputStream)} instead
*/
@Deprecated
public String generateImage(OutputStream os) throws IOException {
return outputImage(os).getDescription();
@ -116,6 +120,9 @@ public class SourceStringReader {
}
// ::comment when __CORE__
/**
* @deprecated Use {@link #outputImage(SFile)} instead
*/
@Deprecated
public String generateImage(SFile f) throws IOException {
return outputImage(f).getDescription();
@ -128,6 +135,9 @@ public class SourceStringReader {
}
// ::done
/**
* @deprecated Use {@link #outputImage(OutputStream, FileFormatOption)} instead
*/
@Deprecated
public String generateImage(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
return outputImage(os, fileFormatOption).getDescription();
@ -137,6 +147,9 @@ public class SourceStringReader {
return outputImage(os, 0, fileFormatOption);
}
/**
* @deprecated Use {@link #outputImage(OutputStream, int)} instead
*/
@Deprecated
public String generateImage(OutputStream os, int numImage) throws IOException {
return outputImage(os, numImage).getDescription();
@ -146,6 +159,9 @@ public class SourceStringReader {
return outputImage(os, numImage, new FileFormatOption(FileFormat.PNG));
}
/**
* @deprecated Use {@link #outputImage(OutputStream, int, FileFormatOption)} instead
*/
@Deprecated
public String generateImage(OutputStream os, int numImage, FileFormatOption fileFormatOption) throws IOException {
return outputImage(os, numImage, fileFormatOption).getDescription();
@ -157,6 +173,14 @@ public class SourceStringReader {
noValidStartFound(os, fileFormatOption);
return null;
}
if (fileFormatOption.getFileFormat() == FileFormat.PREPROC) {
final BlockUml first = blocks.get(0);
for (StringLocated s : first.getData()) {
os.write(s.getString().getBytes(UTF_8));
os.write("\n".getBytes(UTF_8));
}
return new DiagramDescription("PREPROC");
}
for (BlockUml b : blocks) {
final Diagram system = b.getDiagram();
final int nbInSystem = system.getNbImages();
@ -231,7 +255,8 @@ public class SourceStringReader {
}
public ImageData noValidStartFound(OutputStream os, FileFormatOption fileFormatOption) throws IOException {
final TextBlock error = GraphicStrings.createForError(Arrays.asList("No valid @start/@end found, please check the version"),
final TextBlock error = GraphicStrings.createForError(
Arrays.asList("No valid @start/@end found, please check the version"),
fileFormatOption.isUseRedForError());
return plainImageBuilder(error, fileFormatOption).write(os);

View File

@ -253,11 +253,11 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
}
protected abstract TextBlock getTextBlock();
protected abstract TextBlock getTextMainBlock(FileFormatOption fileFormatOption);
@Override
public void exportDiagramGraphic(UGraphic ug) {
final TextBlock textBlock = getTextBlock();
public void exportDiagramGraphic(UGraphic ug, FileFormatOption fileFormatOption) {
final TextBlock textBlock = getTextMainBlock(fileFormatOption);
textBlock.drawU(ug);
}

View File

@ -47,9 +47,9 @@ import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import ext.plantuml.com.ctreber.acearth.ACearth;
import ext.plantuml.com.ctreber.acearth.ConfigurationACearth;
import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
import zext.plantuml.com.ctreber.acearth.ACearth;
import zext.plantuml.com.ctreber.acearth.ConfigurationACearth;
import zext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.api.ImageDataSimple;

View File

@ -40,7 +40,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import ext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
import zext.plantuml.com.ctreber.acearth.plugins.markers.Marker;
import net.sourceforge.plantuml.command.PSystemBasicFactory;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.log.Logme;

View File

@ -3,6 +3,6 @@
* <a href="https://plantuml.com/xearth" target="_top">
* XEarth Image</a>.
*
* @see ext.plantuml.com.ctreber.acearth
* @see zext.plantuml.com.ctreber.acearth
*/
package net.sourceforge.plantuml.acearth;

View File

@ -3,7 +3,7 @@
## Description
This package provides classes used to generate [XEarth Image](https://plantuml.com/xearth).
The Java port of `XEarth` used in `PlantUML` is the [`AC.earth` of Christian Treber](../../../../ext/plantuml/com/ctreber/acearth/).
The Java port of `XEarth` used in `PlantUML` is the [`AC.earth` of Christian Treber](../../../../zext/plantuml/com/ctreber/acearth/).
## Link
- [XEarth Image _(on `PlantUML`)_](https://plantuml.com/xearth)
@ -13,7 +13,7 @@ The Java port of `XEarth` used in `PlantUML` is the [`AC.earth` of Christian Tre
- [`xearth` for Windows of Greg Hewgill](https://hewgill.com/xearth/)
## Credit
- [`AC.earth` of Christian Treber](../../../../ext/plantuml/com/ctreber/acearth/)
- [`AC.earth` of Christian Treber](../../../../zext/plantuml/com/ctreber/acearth/)
- [AC Earth _(on Web Archive)_](https://web.archive.org/web/20180428011447/http://www.acproductions.de/acearth)
## Misc.

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexPartialMatch;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -81,9 +82,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
new RegexLeaf("CODE", "([%pLN][%pLN_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([%pLN_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([%pLN_.]+))?"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
ColorParser.exp2(), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //
@ -105,9 +104,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
new RegexLeaf("BAR2", "(?:==+)[%s]*([%pLN_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED2", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([%pLN][%pLN_.]*))?"), //
new RegexLeaf("QUOTED_INVISIBLE2", "(\\w.*?)")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE2", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE2"), //
new RegexOptional( //
new RegexConcat( //
new RegexLeaf("in"), //

View File

@ -64,6 +64,7 @@ import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.text.BackSlash;
import net.sourceforge.plantuml.text.StringLocated;
import net.sourceforge.plantuml.url.Url;
@ -91,9 +92,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
new RegexLeaf("CODE", "([%pLN][%pLN_.]*)"), //
new RegexLeaf("BAR", "(?:==+)[%s]*([%pLN_.]+)[%s]*(?:==+)"), //
new RegexLeaf("QUOTED", "[%g]([^%g]+)[%g](?:[%s]+as[%s]+([%pLN_.]+))?"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
new RegexLeaf("BACKCOLOR", "(#\\w+)?"), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //

View File

@ -52,6 +52,7 @@ import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
@ -69,9 +70,7 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
new RegexOr(//
color().getRegex(), //
new RegexLeaf("LEGACYCOLORIGNORED", "(#[0-9a-fA-F]{6}|#?\\w+)?")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
new RegexLeaf("\\{?"), //
RegexLeaf.end());
}
@ -89,12 +88,10 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
final Entity p = diagram.getCurrentGroup();
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
if (colors.isEmpty() == false) {
if (colors.isEmpty() == false)
p.setColors(colors);
}
if (arg.get("STEREOTYPE", 0) != null) {
p.setStereotype(Stereotype.build(arg.get("STEREOTYPE", 0)));
}
p.setStereotype(Stereotype.build(arg.get("STEREOTYPE", 0)));
return CommandExecutionResult.ok();
}

View File

@ -40,7 +40,6 @@ import java.io.OutputStream;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle;
@ -109,11 +108,11 @@ public class ActivityDiagram3 extends UmlDiagram {
return swinlanes.nextLinkRenderer();
}
public CommandExecutionResult addActivity(Display activity, BoxStyle style, Url url, Colors colors,
public CommandExecutionResult addActivity(Display activity, BoxStyle boxStyle, Url url, Colors colors,
Stereotype stereotype) {
manageSwimlaneStrategy();
final InstructionSimple ins = new InstructionSimple(activity, nextLinkRenderer(),
swinlanes.getCurrentSwimlane(), style, url, colors, stereotype);
swinlanes.getCurrentSwimlane(), boxStyle, url, colors, stereotype);
final CommandExecutionResult added = current().add(ins);
if (added.isOk() == false)
return added;
@ -208,8 +207,7 @@ public class ActivityDiagram3 extends UmlDiagram {
}
@Override
protected TextBlock getTextBlock() {
final FileFormatOption fileFormatOption = new FileFormatOption(FileFormat.PNG);
protected TextBlock getTextMainBlock(FileFormatOption fileFormatOption) {
final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam());
return getTextBlock(stringBounder);
}
@ -318,10 +316,10 @@ public class ActivityDiagram3 extends UmlDiagram {
return CommandExecutionResult.error("Cannot find switch");
}
public void startIf(Display test, Display whenThen, HColor color, Url url) {
public void startIf(Display test, Display whenThen, HColor color, Url url, Stereotype stereotype) {
manageSwimlaneStrategy();
final InstructionIf instructionIf = new InstructionIf(swinlanes.getCurrentSwimlane(), current(), test,
LinkRendering.none().withDisplay(whenThen), nextLinkRenderer(), color, getSkinParam(), url);
LinkRendering.none().withDisplay(whenThen), nextLinkRenderer(), color, getSkinParam(), url, stereotype);
current().add(instructionIf);
setNextLinkRendererInternal(LinkRendering.none());
setCurrent(instructionIf);
@ -392,12 +390,13 @@ public class ActivityDiagram3 extends UmlDiagram {
manageSwimlaneStrategy();
if (current() instanceof InstructionRepeat) {
final InstructionRepeat instructionRepeat = (InstructionRepeat) current();
instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle, incoming1, incoming2, stereotype);
instructionRepeat.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle, incoming1, incoming2,
stereotype);
return CommandExecutionResult.ok();
}
if (current() instanceof InstructionWhile) {
final InstructionWhile instructionWhile = (InstructionWhile) current();
instructionWhile.setBackward(label, swinlanes.getCurrentSwimlane(), boxStyle, incoming1, incoming2);
instructionWhile.setBackward(label, boxStyle, incoming1, incoming2, stereotype);
return CommandExecutionResult.ok();
}
return CommandExecutionResult.error("Cannot find repeat");
@ -407,7 +406,7 @@ public class ActivityDiagram3 extends UmlDiagram {
public void doWhile(Display test, Display yes, HColor color) {
manageSwimlaneStrategy();
final InstructionWhile instructionWhile = new InstructionWhile(swinlanes.getCurrentSwimlane(), current(), test,
nextLinkRenderer(), yes, color, getSkinParam());
nextLinkRenderer(), yes, color, getSkinParam().getCurrentStyleBuilder());
current().add(instructionWhile);
setCurrent(instructionWhile);
}

View File

@ -57,6 +57,7 @@ import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.klimt.shape.TextBlockUtils;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
@ -95,12 +96,12 @@ public class Branch {
}
public Branch(StyleBuilder styleBuilder, Swimlane swimlane, LinkRendering labelPositive, Display labelTest,
HColor color, LinkRendering inlabel) {
HColor color, LinkRendering inlabel, Stereotype stereotype) {
this.inlabel = Objects.requireNonNull(inlabel);
this.labelTest = Objects.requireNonNull(labelTest);
this.labelPositive = Objects.requireNonNull(labelPositive);
final Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(styleBuilder);
final Style style = getDefaultStyleDefinitionDiamond().withTOBECHANGED(stereotype).getMergedStyle(styleBuilder);
this.color = color == null
? style.value(PName.BackGroundColor).asColor(styleBuilder.getSkinParam().getIHtmlColorSet())
: color;

View File

@ -47,7 +47,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileDecorateWelding;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNoteOpale;
import net.sourceforge.plantuml.activitydiagram3.gtile.Gtile;
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileIfAlone;
import net.sourceforge.plantuml.activitydiagram3.gtile.GtileIfHexagon;
@ -56,10 +55,11 @@ import net.sourceforge.plantuml.klimt.color.Colors;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.url.Url;
public class InstructionIf extends WithNote implements Instruction, InstructionCollection {
@ -75,8 +75,10 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
private Branch current;
private final LinkRendering topInlinkRendering;
private LinkRendering outColor = LinkRendering.none();
private final Stereotype stereotype;
private final Swimlane swimlane;
private final StyleBuilder currentStyleBuilder;
@Override
public boolean containsBreak() {
@ -91,14 +93,16 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
}
public InstructionIf(Swimlane swimlane, Instruction parent, Display labelTest, LinkRendering whenThen,
LinkRendering inlinkRendering, HColor color, ISkinParam skinParam, Url url) {
LinkRendering inlinkRendering, HColor color, ISkinParam skinParam, Url url, Stereotype stereotype) {
this.url = url;
this.stereotype = stereotype;
this.parent = parent;
this.skinParam = skinParam;
this.topInlinkRendering = Objects.requireNonNull(inlinkRendering);
this.swimlane = swimlane;
this.thens.add(new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, labelTest, color,
LinkRendering.none()));
this.currentStyleBuilder = skinParam.getCurrentStyleBuilder();
this.thens.add(new Branch(currentStyleBuilder, swimlane, whenThen, labelTest, color, LinkRendering.none(),
stereotype));
this.current = this.thens.get(0);
}
@ -137,12 +141,12 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
branch.updateFtile(factory);
if (elseBranch == null)
this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, LinkRendering.none(),
Display.NULL, null, LinkRendering.none());
this.elseBranch = new Branch(currentStyleBuilder, swimlane, LinkRendering.none(),
Display.NULL, null, LinkRendering.none(), stereotype);
elseBranch.updateFtile(factory);
Ftile result = factory.createIf(swimlane, thens, elseBranch, outColor, topInlinkRendering, url,
getPositionedNotes());
getPositionedNotes(), stereotype, currentStyleBuilder);
// if (getPositionedNotes().size() > 0)
// result = FtileWithNoteOpale.create(result, getPositionedNotes(), false, VerticalAlignment.CENTER);
@ -169,7 +173,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
this.current.setInlinkRendering(nextLinkRenderer);
this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenElse, Display.NULL, null,
LinkRendering.none());
LinkRendering.none(), stereotype);
this.current = elseBranch;
return true;
}
@ -180,7 +184,8 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
return false;
this.current.setSpecial(nextLinkRenderer);
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, test, color, inlabel);
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, whenThen, test, color, inlabel,
stereotype);
this.thens.add(current);
return true;
@ -190,7 +195,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC
endifCalled = true;
if (elseBranch == null)
this.elseBranch = new Branch(skinParam.getCurrentStyleBuilder(), swimlane, LinkRendering.none(),
Display.NULL, null, LinkRendering.none());
Display.NULL, null, LinkRendering.none(), stereotype);
this.elseBranch.setSpecial(nextLinkRenderer);
this.current.setInlinkRendering(nextLinkRenderer);

View File

@ -129,8 +129,13 @@ public class InstructionList extends WithNote implements Instruction, Instructio
@Override
public Ftile createFtile(FtileFactory factory) {
if (all.size() == 0)
return new FtileEmpty(factory.skinParam(), defaultSwimlane);
if (all.size() == 0) {
Ftile result = new FtileEmpty(factory.skinParam(), defaultSwimlane);
// Not a typo, in that case, we decide to decorate the entry link.
if (outlinkRendering != null)
result = factory.decorateIn(result, outlinkRendering);
return result;
}
final List<WeldingPoint> breaks = new ArrayList<>();
Ftile result = eventuallyAddNote(factory, null, getSwimlaneIn(), VerticalAlignment.CENTER);

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.StyleBuilder;
public class InstructionRepeat extends AbstractInstruction implements Instruction {
@ -87,6 +88,7 @@ public class InstructionRepeat extends AbstractInstruction implements Instructio
private LinkRendering endRepeatLinkRendering = LinkRendering.none();
private final Colors colors;
private final StyleBuilder currentStyleBuilder;
public boolean containsBreak() {
return repeatList.containsBreak();
@ -94,6 +96,7 @@ public class InstructionRepeat extends AbstractInstruction implements Instructio
public InstructionRepeat(Swimlanes swimlanes, Instruction parent, LinkRendering nextLinkRenderer, HColor color,
Display startLabel, BoxStyle boxStyleIn, Colors colors) {
this.currentStyleBuilder = swimlanes.getCurrentStyleBuilder();
this.swimlanes = swimlanes;
this.swimlane = swimlanes.getCurrentSwimlane();
this.repeatList = new InstructionList(this.swimlane);
@ -158,7 +161,7 @@ public class InstructionRepeat extends AbstractInstruction implements Instructio
if (this.testCalled == false && incoming1.isNone())
incoming1 = swimlanes.nextLinkRenderer();
final Ftile result = factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, decorateOut, test, yes, out,
colors, back, isLastOfTheParent(), incoming1, incoming2);
colors, back, isLastOfTheParent(), incoming1, incoming2, currentStyleBuilder);
if (killed)
return new FtileKilled(result);

View File

@ -62,7 +62,7 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
private final Display label;
private final Colors colors;
private final LinkRendering inlinkRendering;
private final BoxStyle style;
private final BoxStyle boxStyle;
private final Url url;
private final Stereotype stereotype;
@ -71,12 +71,12 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
return false;
}
public InstructionSimple(Display label, LinkRendering inlinkRendering, Swimlane swimlane, BoxStyle style, Url url,
Colors colors, Stereotype stereotype) {
public InstructionSimple(Display label, LinkRendering inlinkRendering, Swimlane swimlane, BoxStyle boxStyle,
Url url, Colors colors, Stereotype stereotype) {
super(swimlane);
this.stereotype = stereotype;
this.url = url;
this.style = style;
this.boxStyle = boxStyle;
this.label = label;
this.inlinkRendering = Objects.requireNonNull(inlinkRendering);
this.colors = Objects.requireNonNull(colors);
@ -85,7 +85,7 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
// ::comment when __CORE__
@Override
public Gtile createGtile(ISkinParam skinParam, StringBounder stringBounder) {
GtileBox result = GtileBox.create(stringBounder, colors.mute(skinParam), label, getSwimlaneIn(), style,
GtileBox result = GtileBox.create(stringBounder, colors.mute(skinParam), label, getSwimlaneIn(), boxStyle,
stereotype);
if (hasNotes()) {
final Collection<PositionedNote> notes = getPositionedNotes();
@ -103,7 +103,7 @@ public class InstructionSimple extends MonoSwimable implements Instruction {
@Override
public Ftile createFtile(FtileFactory factory) {
Ftile result = factory.activity(label, getSwimlaneIn(), style, colors, stereotype);
Ftile result = factory.activity(label, getSwimlaneIn(), boxStyle, colors, stereotype);
if (url != null) {
result = factory.addUrl(result, url);
}

View File

@ -58,7 +58,7 @@ import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.style.ISkinParam;
public class InstructionSwitch extends WithNote implements Instruction, InstructionCollection {
// ::remove folder when __HAXE__
// ::remove folder when __HAXE__
private final List<Branch> switches = new ArrayList<>();
private final ISkinParam skinParam;
@ -166,7 +166,7 @@ public class InstructionSwitch extends WithNote implements Instruction, Instruct
this.current.setSpecial(nextLinkRenderer);
this.current = new Branch(skinParam.getCurrentStyleBuilder(), swimlane,
LinkRendering.none().withDisplay(labelCase), labelCase, null,
LinkRendering.none().withDisplay(labelCase));
LinkRendering.none().withDisplay(labelCase), null);
this.switches.add(this.current);
return true;
}

View File

@ -55,7 +55,9 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.StyleBuilder;
public class InstructionWhile extends WithNote implements Instruction, InstructionCollection {
@ -72,30 +74,32 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
private LinkRendering outColor = LinkRendering.none();
private final Swimlane swimlane;
private final ISkinParam skinParam;
private Instruction specialOut;
private BoxStyle boxStyle;
private Swimlane swimlaneOut;
private Display backward = Display.NULL;
private Stereotype stereotype;
private LinkRendering incoming1 = LinkRendering.none();
private LinkRendering incoming2 = LinkRendering.none();
private boolean backwardCalled;
private final StyleBuilder currentStyleBuilder;
public void overwriteYes(Display yes) {
this.yes = yes;
}
public InstructionWhile(Swimlane swimlane, Instruction parent, Display test, LinkRendering nextLinkRenderer,
Display yes, HColor color, ISkinParam skinParam) {
Display yes, HColor color, StyleBuilder currentStyleBuilder) {
this.parent = parent;
this.test = Objects.requireNonNull(test);
this.nextLinkRenderer = Objects.requireNonNull(nextLinkRenderer);
this.yes = Objects.requireNonNull(yes);
this.swimlane = swimlane;
this.currentStyleBuilder = currentStyleBuilder;
this.color = color;
this.skinParam = skinParam;
}
@Override
@ -116,9 +120,10 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
@Override
public Ftile createFtile(FtileFactory factory) {
final Ftile back = Display.isNull(backward) ? null
: factory.activity(backward, swimlane, boxStyle, Colors.empty(), null);
: factory.activity(backward, swimlane, boxStyle, Colors.empty(), stereotype);
Ftile tmp = repeatList.createFtile(factory);
tmp = factory.createWhile(outColor, swimlane, tmp, test, yes, color, specialOut, back, incoming1, incoming2);
tmp = factory.createWhile(outColor, swimlane, tmp, test, yes, color, specialOut, back, incoming1, incoming2,
currentStyleBuilder);
if (getPositionedNotes().size() > 0)
tmp = FtileWithNoteOpale.create(tmp, getPositionedNotes(), false, VerticalAlignment.CENTER);
@ -191,14 +196,14 @@ public class InstructionWhile extends WithNote implements Instruction, Instructi
return repeatList.containsBreak();
}
public void setBackward(Display label, Swimlane swimlaneOut, BoxStyle boxStyle, LinkRendering incoming1,
LinkRendering incoming2) {
public void setBackward(Display label, BoxStyle boxStyle, LinkRendering incoming1, LinkRendering incoming2,
Stereotype stereotype) {
this.backward = label;
this.swimlaneOut = swimlaneOut;
this.boxStyle = boxStyle;
this.incoming1 = incoming1;
this.incoming2 = incoming2;
this.backwardCalled = true;
this.stereotype = stereotype;
}
public void incoming(LinkRendering incoming) {

View File

@ -52,6 +52,7 @@ import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.skin.ColorParam;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -61,7 +62,7 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
public static final String endingGroup() {
return "(" //
+ ";(?:[%s]*(\\<\\<\\w+\\>\\>))?" //
+ ";[%s]*(\\<\\<\\w+\\>\\>(?:[%s]*\\<\\<\\w+\\>\\>)*)?" //
+ "|" //
+ Matcher.quoteReplacement("\\\\") // that is simply \ character
+ "|" //
@ -77,7 +78,7 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
private static final String endingGroupShort() {
return "(" //
+ ";(?:[%s]*(\\<\\<\\w+\\>\\>))?" //
+ ";[%s]*(\\<\\<\\w+\\>\\>(?:[%s]*\\<\\<\\w+\\>\\>)*)?" //
+ "|" //
+ Matcher.quoteReplacement("\\\\") // that is simply \ character
+ "|" //
@ -104,9 +105,7 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
return RegexConcat.build(CommandActivity3.class.getName(), RegexLeaf.start(), //
UrlBuilder.OPTIONAL, //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf(":"), //
new RegexLeaf("LABEL", "(.*?)"), //
new RegexLeaf("STYLE", endingGroupShort()), //

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.utils.BlocLines;
public class CommandActivityLong3 extends CommandMultilines3<ActivityDiagram3> {
@ -84,10 +85,16 @@ public class CommandActivityLong3 extends CommandMultilines3<ActivityDiagram3> {
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
final RegexResult lineLast = getPatternEnd2().matcher(lines.getLast().getString());
final String end = lineLast.get("END", 0);
Stereotype stereotype = null;
String stereo = lineLast.get("END", 1);
if (stereo != null)
stereotype = Stereotype.build(stereo);
final BoxStyle style = BoxStyle.fromString(end);
lines = lines.removeStartingAndEnding(line0.get("DATA", 0), end.length());
return diagram.addActivity(lines.toDisplay(), style, null, colors, null);
return diagram.addActivity(lines.toDisplay(), style, null, colors, stereotype);
}
}

View File

@ -78,9 +78,8 @@ public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
diagram.setColorNextArrow(rainbow);
}
final String label = arg.get("LABEL", 0);
if (label != null && label.length() > 0) {
if (label != null && label.length() > 0)
diagram.setLabelNextArrow(Display.getWithNewlines(label));
}
return CommandExecutionResult.ok();
}

View File

@ -47,6 +47,8 @@ import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -63,7 +65,7 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
UrlBuilder.OPTIONAL, //
ColorParser.exp4(), //
new RegexLeaf("if"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("\\("), //
new RegexLeaf("TEST", "(.*?)"), //
new RegexLeaf("\\)"), //
@ -85,9 +87,8 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
String test = arg.get("TEST", 0);
if (test.length() == 0) {
if (test.length() == 0)
test = null;
}
final Url url;
if (arg.get("URL", 0) == null) {
@ -96,8 +97,9 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
url = urlBuilder.getUrl(arg.get("URL", 0));
}
final Stereotype stereotype = Stereotype.build(arg.get("STEREO", 0));
diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color, url);
diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color, url, stereotype);
return CommandExecutionResult.ok();
}

View File

@ -82,10 +82,10 @@ public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
String test = arg.get("TEST", 0);
if (test.length() == 0) {
if (test.length() == 0)
test = null;
}
diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color, null);
diagram.startIf(Display.getWithNewlines(test), Display.getWithNewlines(arg.get("WHEN", 0)), color, null, null);
return CommandExecutionResult.ok();
}

View File

@ -72,7 +72,7 @@ public class CommandIfLegacy1 extends SingleLineCommand2<ActivityDiagram3> {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
diagram.startIf(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("WHEN", 0)), null,
null);
null, null);
return CommandExecutionResult.ok();
}

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.utils.LineLocation;
@ -77,9 +78,7 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
new RegexConcat( //
RegexLeaf.spaceOneOrMore(), //
color("BACK2").getRegex())), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("\\{?"), //
RegexLeaf.end());
}

View File

@ -52,6 +52,7 @@ import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.skin.ColorParam;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
@ -62,7 +63,7 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
static IRegex getRegexConcat() {
return RegexConcat.build(CommandRepeat3.class.getName(), RegexLeaf.start(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
StereotypePattern.optional("STEREO"), //
ColorParser.exp4(), //
new RegexLeaf("repeat"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -160,11 +160,12 @@ public enum BoxStyle {
if (bs.style == style.charAt(0))
return bs;
style = style.replaceAll("\\W", "");
for (BoxStyle bs : BoxStyle.values())
if (style.equalsIgnoreCase(bs.stereotype))
return bs;
for (String s : style.split("\\s")) {
s = s.replaceAll("\\W", "");
for (BoxStyle bs : BoxStyle.values())
if (s.equalsIgnoreCase(bs.stereotype))
return bs;
}
}
return PLAIN;
}

View File

@ -49,7 +49,9 @@ public class EntityImageLegend {
final Style style = StyleSignatureBasic
.of(SName.root, SName.root, SName.document, skinParam.getUmlDiagramType().getStyleName(), SName.legend)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
return style.createTextBlockBordered(note, skinParam.getIHtmlColorSet(), skinParam, Style.ID_LEGEND);
return style.createTextBlockBordered(note, skinParam.getIHtmlColorSet(), skinParam, Style.ID_LEGEND,
style.wrapWidth());
}
}

View File

@ -52,6 +52,7 @@ import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.url.Url;
public interface FtileFactory {
@ -83,13 +84,15 @@ public interface FtileFactory {
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
Display test, Display yes, Display out, Colors colors, Ftile backward, boolean noOut,
LinkRendering incoming1, LinkRendering incoming2);
LinkRendering incoming1, LinkRendering incoming2, StyleBuilder currentStyleBuilder);
public Ftile createWhile(LinkRendering outColor, Swimlane swimlane, Ftile whileBlock, Display test, Display yes,
HColor color, Instruction specialOut, Ftile backward, LinkRendering incoming1, LinkRendering incoming2);
HColor color, Instruction specialOut, Ftile backward, LinkRendering incoming1, LinkRendering incoming2,
StyleBuilder currentStyleBuilder);
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering outColor,
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes);
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes, Stereotype stereotype,
StyleBuilder currentStyleBuilder);
public Ftile createSwitch(Swimlane swimlane, List<Branch> branches, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Display labelTest);

View File

@ -60,6 +60,7 @@ import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.url.Url;
@ -174,22 +175,25 @@ public class FtileFactoryDelegator implements FtileFactory {
@Override
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
Display test, Display yes, Display out, Colors colors, Ftile backward, boolean noOut,
LinkRendering incoming1, LinkRendering incoming2) {
LinkRendering incoming1, LinkRendering incoming2, StyleBuilder currentStyleBuilder) {
return factory.repeat(boxStyleIn, swimlane, swimlaneOut, startLabel, repeat, test, yes, out, colors, backward,
noOut, incoming1, incoming2);
noOut, incoming1, incoming2, currentStyleBuilder);
}
@Override
public Ftile createWhile(LinkRendering outColor, Swimlane swimlane, Ftile whileBlock, Display test, Display yes,
HColor color, Instruction specialOut, Ftile back, LinkRendering incoming1, LinkRendering incoming2) {
HColor color, Instruction specialOut, Ftile back, LinkRendering incoming1, LinkRendering incoming2,
StyleBuilder styleBuilder) {
return factory.createWhile(outColor, swimlane, whileBlock, test, yes, color, specialOut, back, incoming1,
incoming2);
incoming2, styleBuilder);
}
@Override
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes) {
return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url, notes);
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes, Stereotype stereotype,
StyleBuilder currentStyleBuilder) {
return factory.createIf(swimlane, thens, elseBranch, afterEndwhile, topInlinkRendering, url, notes, stereotype,
currentStyleBuilder);
}
@Override

View File

@ -82,6 +82,7 @@ import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.style.Styleable;
import net.sourceforge.plantuml.svek.UGraphicForSnake;
@ -127,9 +128,9 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
}
protected Style getStyle() {
if (style == null) {
if (style == null)
this.style = getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder());
}
return style;
}
@ -455,4 +456,8 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
return cachedMinMax;
}
public StyleBuilder getCurrentStyleBuilder() {
return skinParam.getCurrentStyleBuilder();
}
}

View File

@ -48,8 +48,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.skin.Pragma;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.ConditionEndStyle;
import net.sourceforge.plantuml.svek.ConditionStyle;
import net.sourceforge.plantuml.url.Url;
@ -65,15 +67,16 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
@Override
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes) {
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes, Stereotype stereotype,
StyleBuilder currentStyleBuilder) {
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
final ConditionEndStyle conditionEndStyle = skinParam().getConditionEndStyle();
final Branch branch0 = thens.get(0);
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(currentStyleBuilder);
final Style styleDiamond = getDefaultStyleDefinitionDiamond().withTOBECHANGED(stereotype)
.getMergedStyle(currentStyleBuilder);
final HColor backColor = branch0.getColor() == null
? styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet())
: branch0.getColor();

View File

@ -62,6 +62,7 @@ import net.sourceforge.plantuml.klimt.font.FontConfiguration;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.ConditionStyle;
public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
@ -73,13 +74,12 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
@Override
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel,
final Ftile repeat, Display test, Display yes, Display out, Colors colors, Ftile backward, boolean noOut,
LinkRendering incoming1, LinkRendering incoming2) {
LinkRendering incoming1, LinkRendering incoming2, StyleBuilder currentStyleBuilder) {
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(currentStyleBuilder);
final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle(currentStyleBuilder);
final HColor borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
final HColor diamondColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet());
final Rainbow arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());

View File

@ -58,6 +58,7 @@ import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.FontConfiguration;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.svek.ConditionStyle;
public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
@ -68,13 +69,13 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
@Override
public Ftile createWhile(LinkRendering outColor, Swimlane swimlane, Ftile whileBlock, Display test, Display yes,
HColor color, Instruction specialOut, Ftile backward, LinkRendering incoming1, LinkRendering incoming2) {
HColor color, Instruction specialOut, Ftile backward, LinkRendering incoming1, LinkRendering incoming2,
StyleBuilder currentStyleBuilder) {
final ConditionStyle conditionStyle = skinParam().getConditionStyle();
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(currentStyleBuilder);
final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle(currentStyleBuilder);
final HColor borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
final HColor backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet());
final Rainbow arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());

View File

@ -81,9 +81,9 @@ class FtileForkInner extends AbstractFtile {
public static Set<Swimlane> mergeSwimlanes(List<Ftile> tiles) {
final Set<Swimlane> result = new HashSet<>();
for (Ftile tile : tiles) {
for (Ftile tile : tiles)
result.addAll(tile.getSwimlanes());
}
return Collections.unmodifiableSet(result);
}
@ -105,9 +105,9 @@ class FtileForkInner extends AbstractFtile {
for (Ftile ftile : forks) {
final XDimension2D dim = ftile.calculateDimension(stringBounder);
width += dim.getWidth();
if (dim.getHeight() > height) {
if (dim.getHeight() > height)
height = dim.getHeight();
}
}
final XDimension2D dimTotal = new XDimension2D(width, height);
return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight());
@ -116,9 +116,9 @@ class FtileForkInner extends AbstractFtile {
public UTranslate getTranslateFor(Ftile searched, StringBounder stringBounder) {
double xpos = 0;
for (Ftile ftile : forks) {
if (ftile == searched) {
if (ftile == searched)
return UTranslate.dx(xpos);
}
final XDimension2D dim = ftile.calculateDimension(stringBounder);
xpos += dim.getWidth();
}

View File

@ -85,7 +85,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
Ftile result = middle;
final List<Connection> conns = new ArrayList<>();
final Swimlane swimlaneBlack = in;
final Style style = getStyleSignature().getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style style = getStyleSignatureArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
final Ftile black = new FtileBlackBlock(skinParam(), swimlaneBlack);
double x = 0;
for (Ftile tmp : list99) {

View File

@ -156,20 +156,21 @@ public class VCompactFactory implements FtileFactory {
@Override
public Ftile repeat(BoxStyle boxStyleIn, Swimlane swimlane, Swimlane swimlaneOut, Display startLabel, Ftile repeat,
Display test, Display yes, Display out, Colors colors, Ftile backward, boolean noOut,
LinkRendering incoming1, LinkRendering incoming2) {
LinkRendering incoming1, LinkRendering incoming2, StyleBuilder currentStyleBuilder) {
return repeat;
}
@Override
public Ftile createWhile(LinkRendering afterEndwhile, Swimlane swimlane, Ftile whileBlock, Display test,
Display yes, HColor color, Instruction specialOut, Ftile back, LinkRendering incoming1,
LinkRendering incoming2) {
LinkRendering incoming2, StyleBuilder styleBuilder) {
return whileBlock;
}
@Override
public Ftile createIf(Swimlane swimlane, List<Branch> thens, Branch elseBranch, LinkRendering afterEndwhile,
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes) {
LinkRendering topInlinkRendering, Url url, Collection<PositionedNote> notes, Stereotype stereotype,
StyleBuilder currentStyleBuilder) {
final List<Ftile> ftiles = new ArrayList<>();
for (Branch branch : thens)
ftiles.add(branch.getFtile());

View File

@ -73,11 +73,11 @@ public class BoardDiagram extends UmlDiagram {
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException {
return createImageBuilder(fileFormatOption).drawable(getTextBlock()).write(os);
return createImageBuilder(fileFormatOption).drawable(getTextMainBlock(fileFormatOption)).write(os);
}
@Override
protected TextBlock getTextBlock() {
protected TextBlock getTextMainBlock(FileFormatOption fileFormatOption) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {

View File

@ -194,7 +194,7 @@ public class BpmDiagram extends UmlDiagram {
}
@Override
protected TextBlock getTextBlock() {
protected TextBlock getTextMainBlock(FileFormatOption fileFormatOption) {
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,853 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.WithSprite;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColorSet;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.AbstractTextBlock;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.project.GanttStyle;
import net.sourceforge.plantuml.project.LabelPosition;
import net.sourceforge.plantuml.project.LabelStrategy;
import net.sourceforge.plantuml.project.LoadPlanable;
import net.sourceforge.plantuml.project.TimeHeaderParameters;
import net.sourceforge.plantuml.project.ToTaskDraw;
import net.sourceforge.plantuml.project.core.PrintScale;
import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.core.TaskCode;
import net.sourceforge.plantuml.project.core.TaskGroup;
import net.sourceforge.plantuml.project.draw.TaskDraw;
import net.sourceforge.plantuml.project.draw.TaskDrawDiamond;
import net.sourceforge.plantuml.project.draw.TimeHeader;
import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.real.RealOrigin;
import net.sourceforge.plantuml.real.RealUtils;
import net.sourceforge.plantuml.skin.UmlDiagramType;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic;
public class ChronologyDiagram extends TitledDiagram implements ToTaskDraw, WithSprite, GanttStyle {
private final Map<Task, TaskDraw> draws = new LinkedHashMap<Task, TaskDraw>();
private final Map<TaskCode, Task> tasks = new LinkedHashMap<TaskCode, Task>();
private final Map<String, Task> byShortName = new HashMap<String, Task>();
// private final List<GanttConstraint> constraints = new ArrayList<>();
private final HColorSet colorSet = HColorSet.instance();
//
// private final OpenClose openClose = new OpenClose();
//
// private final Map<String, Resource> resources = new LinkedHashMap<String, Resource>();
// private final Map<Day, HColor> colorDaysToday = new HashMap<Day, HColor>();
// private final Map<Day, HColor> colorDaysInternal = new HashMap<Day, HColor>();
// private final Map<DayOfWeek, HColor> colorDaysOfWeek = new HashMap<DayOfWeek, HColor>();
// private final Map<Day, String> nameDays = new HashMap<Day, String>();
private LabelStrategy labelStrategy = new LabelStrategy(LabelPosition.LEGACY, HorizontalAlignment.LEFT);
//
// // Let's follow ISO-8601 rules
// private WeekNumberStrategy weekNumberStrategy = new WeekNumberStrategy(DayOfWeek.MONDAY, 4);
//
// private PrintScale printScale = PrintScale.DAILY;
// private double factorScale = 1.0;
private Locale locale = Locale.ENGLISH;
//
// private Day today;
// private double totalHeightWithoutFooter;
private Day min;
private Day max;
private TimeScaleChronology timeScale;
//
// private Day printStart;
// private Day printEnd;
//
private final RealOrigin origin = RealUtils.createOrigin();
//
// private int defaultCompletion = 100;
//
// private Task it;
// private Resource they;
public CommandExecutionResult changeLanguage(String lang) {
this.locale = new Locale(lang);
return CommandExecutionResult.ok();
}
public DiagramDescription getDescription() {
return new DiagramDescription("(Chronology)");
}
// public void setWeekNumberStrategy(DayOfWeek firstDayOfWeek, int minimalDaysInFirstWeek) {
// this.weekNumberStrategy = new WeekNumberStrategy(firstDayOfWeek, minimalDaysInFirstWeek);
// }
public ChronologyDiagram(UmlSource source) {
super(source, UmlDiagramType.CHRONOLOGY, null);
}
// public final int getDpi(FileFormatOption fileFormatOption) {
// return 96;
// }
@Override
protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException {
return createImageBuilder(fileFormatOption).drawable(getTextMainBlock(fileFormatOption)).write(os);
}
// public void setPrintScale(PrintScale printScale) {
// this.printScale = printScale;
// }
//
// public void setFactorScale(double factorScale) {
// this.factorScale = factorScale;
// }
//
// private double getFactorScale() {
// return this.printScale.getDefaultScale() * this.factorScale;
// }
//
// private boolean isHidden(Task task) {
// if (printStart == null || task instanceof TaskSeparator)
// return false;
//
// if (task.getEnd().compareTo(min) < 0)
// return true;
//
// if (task.getStart().compareTo(max) > 0)
// return true;
//
// return false;
// }
//
// @Override
// public String checkFinalError() {
// try {
// initMinMax();
// } catch (ImpossibleSolvingException ex) {
// return ex.getMessage();
// }
// return null;
// }
@Override
protected TextBlock getTextMainBlock(FileFormatOption fileFormatOption) {
final StringBounder stringBounder = fileFormatOption.getDefaultStringBounder(getSkinParam());
initMinMax();
final TimeHeader timeHeader = new TimeHeaderChronology(stringBounder, thParam(), PrintScale.DAILY,
this.timeScale);
initTaskAndResourceDraws(timeHeader.getTimeScale(), timeHeader.getFullHeaderHeight(stringBounder),
stringBounder);
return new AbstractTextBlock() {
public XDimension2D calculateDimension(StringBounder stringBounder) {
return new XDimension2D(1000, 1000);
}
@Override
public void drawU(UGraphic ug) {
timeHeader.drawTimeHeader(ug, 200);
drawTasksRect(ug);
drawTasksTitle(ug, 0, 0);
}
};
}
//
// private double getTitlesColumnWidth(StringBounder stringBounder) {
// if (labelStrategy.titleInside())
// return 0;
//
// double width = 0;
// for (Task task : tasks.values()) {
// if (isHidden(task))
// continue;
//
// width = Math.max(width, draws.get(task).getTitleWidth(stringBounder));
// }
// return width;
// }
//
// public XDimension2D calculateDimension(StringBounder stringBounder) {
// return new XDimension2D(getTitlesColumnWidth(stringBounder) + getBarsColumnWidth(timeHeader),
// getTotalHeight(stringBounder, timeHeader));
// }
//
// private double getBarsColumnWidth(final TimeHeader timeHeader) {
// final double xmin = timeHeader.getTimeScale().getStartingPosition(min);
// final double xmax = timeHeader.getTimeScale().getEndingPosition(max);
// return xmax - xmin;
// }
//
// };
// }
//
// private TimeHeader getTimeHeader(StringBounder stringBounder) {
// if (openClose.getStartingDay() == null)
// return new TimeHeaderSimple(stringBounder, thParam(), printScale);
// else if (printScale == PrintScale.DAILY)
// return new TimeHeaderDaily(stringBounder, thParam(), nameDays, printStart, printEnd);
// else if (printScale == PrintScale.WEEKLY)
// return new TimeHeaderWeekly(stringBounder, thParam(), weekNumberStrategy, withCalendarDate);
// else if (printScale == PrintScale.MONTHLY)
// return new TimeHeaderMonthly(stringBounder, thParam());
// else if (printScale == PrintScale.QUARTERLY)
// return new TimeHeaderQuarterly(stringBounder, thParam());
// else if (printScale == PrintScale.YEARLY)
// return new TimeHeaderYearly(stringBounder, thParam());
// else
// throw new IllegalStateException();
//
// }
private TimeHeaderParameters thParam() {
return new TimeHeaderParameters(null, 1, min, max, getIHtmlColorSet(), locale, null, null, null, this);
}
// private Map<Day, HColor> colorDays() {
// colorDaysInternal.putAll(colorDaysToday);
// return Collections.unmodifiableMap(colorDaysInternal);
// }
@Override
public final Style getStyle(SName param) {
return StyleSignatureBasic.of(SName.root, SName.element, SName.ganttDiagram, param)
.getMergedStyle(getCurrentStyleBuilder());
}
@Override
public final Style getStyle(SName param1, SName param2) {
return StyleSignatureBasic.of(SName.root, SName.element, SName.ganttDiagram, param1, param2)
.getMergedStyle(getCurrentStyleBuilder());
}
// private double getTotalHeight(StringBounder stringBounder, TimeHeader timeHeader) {
// if (showFootbox)
// return totalHeightWithoutFooter + timeHeader.getTimeFooterHeight(stringBounder);
//
// return totalHeightWithoutFooter;
// }
private void drawTasksRect(UGraphic ug) {
for (Task task : tasks.values()) {
// if (isHidden(task))
// continue;
final TaskDraw draw = draws.get(task);
final UTranslate move = UTranslate.dy(draw.getY(ug.getStringBounder()).getCurrentValue());
draw.drawU(ug.apply(move));
}
}
// private void drawConstraints(final UGraphic ug, TimeScale timeScale) {
// for (GanttConstraint constraint : constraints) {
// if (printStart != null && constraint.isHidden(min, max))
// continue;
//
// constraint.getUDrawable(timeScale, this).drawU(ug);
// }
//
// }
//
// public StyleSignatureBasic getDefaultStyleDefinitionArrow() {
// return StyleSignatureBasic.of(SName.root, SName.element, SName.ganttDiagram, SName.arrow);
// }
private void drawTasksTitle(UGraphic ug, double colTitles, double colBars) {
for (Task task : tasks.values()) {
// if (isHidden(task))
// continue;
final TaskDraw draw = draws.get(task);
final UTranslate move = UTranslate.dy(draw.getY(ug.getStringBounder()).getCurrentValue());
draw.drawTitle(ug.apply(move), labelStrategy, colTitles, colBars);
}
}
// private void drawResources(UGraphic ug) {
// for (Resource res : resources.values()) {
// final ResourceDraw draw = res.getResourceDraw();
// final UTranslate move = UTranslate.dy(draw.getY());
// draw.drawU(ug.apply(move));
// }
// }
//
// public void closeDayOfWeek(DayOfWeek day, String task) {
// openClose.close(day);
// }
//
// public void openDayOfWeek(DayOfWeek day, String task) {
// if (task.length() == 0)
// openClose.open(day);
// else
// getOpenCloseForTask(task).open(day);
// }
//
// public void closeDayAsDate(Day day, String task) {
// if (task.length() == 0)
// openClose.close(day);
// else
// getOpenCloseForTask(task).close(day);
//
// }
//
// public void openDayAsDate(Day day, String task) {
// if (task.length() == 0)
// openClose.open(day);
// else
// getOpenCloseForTask(task).open(day);
//
// }
//
// private OpenClose getOpenCloseForTask(String task) {
// OpenClose except = openCloseForTask.get(task);
// if (except == null) {
// except = new OpenClose();
// openCloseForTask.put(task, except);
// }
// return except;
// }
//
// private final Map<String, OpenClose> openCloseForTask = new HashMap<>();
//
private void initTaskAndResourceDraws(TimeScale timeScale, double headerHeight, StringBounder stringBounder) {
Real y = origin;
y = y.addFixed(headerHeight);
for (Task task : tasks.values()) {
final TaskDraw draw;
final String disp = task.getCode().getSimpleDisplay();
draw = new TaskDrawDiamond(timeScale, y, disp, task.getStart(), task, this, task.getStyleBuilder());
final double height = draw.getFullHeightTask(stringBounder);
y = y.addAtLeast(height);
// if (task instanceof TaskSeparator) {
// final TaskSeparator taskSeparator = (TaskSeparator) task;
// draw = new TaskDrawSeparator(taskSeparator.getName(), timeScale, y, min, max, task.getStyleBuilder(),
// getSkinParam().getIHtmlColorSet());
// } else if (task instanceof TaskGroup) {
// final TaskGroup taskGroup = (TaskGroup) task;
// draw = new TaskDrawGroup(timeScale, y, taskGroup.getCode().getSimpleDisplay(), getStart(taskGroup),
// getEnd(taskGroup), task, this, task.getStyleBuilder());
// } else {
// final TaskImpl tmp = (TaskImpl) task;
// final String disp = hideResourceName ? tmp.getCode().getSimpleDisplay() : tmp.getPrettyDisplay();
// if (tmp.isDiamond()) {
// draw = new TaskDrawDiamond(timeScale, y, disp, getStart(tmp), task, this, task.getStyleBuilder());
// } else {
// final boolean oddStart = printStart != null && min.compareTo(getStart(tmp)) == 0;
// final boolean oddEnd = printStart != null && max.compareTo(getEnd(tmp)) == 0;
// draw = new TaskDrawRegular(timeScale, y, disp, getStart(tmp), getEnd(tmp), oddStart, oddEnd,
// getSkinParam(), task, this, getConstraints(task), task.getStyleBuilder());
// }
// draw.setColorsAndCompletion(tmp.getColors(), tmp.getCompletion(), tmp.getUrl(), tmp.getNote());
// }
// if (task.getRow() == null)
// y = y.addAtLeast(draw.getFullHeightTask(stringBounder));
//
draws.put(task, draw);
}
// origin.compileNow();
// magicPush(stringBounder);
// double yy = lastY(stringBounder);
// if (yy == 0) {
// yy = headerHeight;
// } else if (this.hideResourceFoobox == false)
// for (Resource res : resources.values()) {
// final ResourceDraw draw = buildResourceDraw(this, res, timeScale, yy, min, max);
// res.setTaskDraw(draw);
// yy += draw.getHeight(stringBounder);
// }
//
// this.totalHeightWithoutFooter = yy;
}
//
// private ResourceDraw buildResourceDraw(ChronologyDiagram gantt, Resource res, TimeScale timeScale, double y, Day min,
// Day max) {
// return new ResourceDrawBasic(gantt, res, timeScale, y, min, max);
// // return new ResourceDrawVersion2(gantt, res, timeScale, y, min, max);
// }
//
// private Collection<GanttConstraint> getConstraints(Task task) {
// final List<GanttConstraint> result = new ArrayList<>();
// for (GanttConstraint constraint : constraints) {
// if (constraint.isOn(task))
// result.add(constraint);
//
// }
// return Collections.unmodifiableCollection(result);
// }
//
// private double lastY(StringBounder stringBounder) {
// double result = 0;
// for (TaskDraw td : draws.values())
// result = Math.max(result, td.getY(stringBounder).getCurrentValue() + td.getHeightMax(stringBounder));
//
// return result;
// }
//
// private void magicPush(StringBounder stringBounder) {
// final List<TaskDraw> notes = new ArrayList<>();
// for (TaskDraw td : draws.values()) {
// final FingerPrint taskPrint = td.getFingerPrint(stringBounder);
// final FingerPrint fingerPrintNote = td.getFingerPrintNote(stringBounder);
//
// if (td.getTrueRow() == null)
// for (TaskDraw note : notes) {
// final FingerPrint otherNote = note.getFingerPrintNote(stringBounder);
// final double deltaY = otherNote.overlap(taskPrint);
// if (deltaY > 0) {
// final Real bottom = note.getY(stringBounder).addAtLeast(note.getHeightMax(stringBounder));
// td.getY(stringBounder).ensureBiggerThan(bottom);
// origin.compileNow();
// }
//
// }
//
// if (fingerPrintNote != null)
// notes.add(td);
//
// }
// }
//
// private Day getStart(final Task tmp) {
// if (printStart == null)
// return tmp.getStart();
//
// return Day.max(min, tmp.getStart());
// }
//
// private Day getEnd(final Task tmp) {
// if (printStart == null)
// return tmp.getEnd();
//
// return Day.min(max, tmp.getEnd());
// }
//
private void initMinMax() {
if (tasks.size() == 0) {
throw new IllegalStateException();
}
for (Task task : tasks.values()) {
if (this.min == null || this.max == null) {
this.min = task.getStart();
this.max = task.getEnd();
continue;
}
if (this.min.compareTo(task.getStart()) > 0)
this.min = task.getStart();
if (this.max.compareTo(task.getEnd()) < 0)
this.max = task.getEnd();
}
this.min = this.min.roundDayDown();
this.max = this.max.roundDayUp();
this.timeScale = new TimeScaleChronology(1000);
this.timeScale.setMin(this.min.getMillis());
this.timeScale.setMax(this.max.getMillis());
}
// public Day getThenDate() {
// Day result = getStartingDate();
// for (Day d : colorDays().keySet())
// if (d.compareTo(result) > 0)
// result = d;
//
// for (Day d : nameDays.keySet())
// if (d.compareTo(result) > 0)
// result = d;
//
// return result;
// }
//
// public Task getExistingTask(String id) {
// final Task result = byShortName.get(Objects.requireNonNull(id));
// if (result != null)
// return result;
//
// final TaskCode code = new TaskCode(id);
// return tasks.get(code);
// }
//
// public GanttConstraint forceTaskOrder(Task task1, Task task2) {
// final TaskInstant end1 = new TaskInstant(task1, TaskAttribute.END);
// task2.setStart(end1.getInstantPrecise());
// final GanttConstraint result = new GanttConstraint(this.getIHtmlColorSet(),
// getSkinParam().getCurrentStyleBuilder(), end1, new TaskInstant(task2, TaskAttribute.START));
// addContraint(result);
// return result;
// }
public Task getOrCreateTask(String codeOrShortName, String shortName, boolean linkedToPrevious) {
Objects.requireNonNull(codeOrShortName);
Task result = shortName == null ? null : byShortName.get(shortName);
if (result != null)
return result;
result = byShortName.get(codeOrShortName);
if (result != null)
return result;
final TaskCode code = new TaskCode(codeOrShortName);
result = tasks.get(code);
if (result == null) {
result = new TaskChronology(getSkinParam().getCurrentStyleBuilder(), code);
if (currentGroup != null)
currentGroup.addTask(result);
tasks.put(code, result);
if (byShortName != null)
byShortName.put(shortName, result);
}
return result;
}
// private Task getLastCreatedTask() {
// final List<Task> all = new ArrayList<>(tasks.values());
// for (int i = all.size() - 1; i >= 0; i--)
// if (all.get(i) instanceof TaskImpl)
// return all.get(i);
//
// return null;
// }
//
// public void addSeparator(String comment) {
// TaskSeparator separator = new TaskSeparator(getSkinParam().getCurrentStyleBuilder(), comment, tasks.size());
// tasks.put(separator.getCode(), separator);
// }
//
private TaskGroup currentGroup = null;
//
// public CommandExecutionResult addGroup(String name) {
// TaskGroup group = new TaskGroup(this.currentGroup, getSkinParam().getCurrentStyleBuilder(), name);
//
// if (this.currentGroup != null)
// this.currentGroup.addTask(group);
//
// this.currentGroup = group;
// tasks.put(group.getCode(), group);
// return CommandExecutionResult.ok();
// }
//
// public CommandExecutionResult endGroup() {
// if (this.currentGroup == null)
// return CommandExecutionResult.error("No group to be closed");
//
// this.currentGroup = this.currentGroup.getParent();
//
// return CommandExecutionResult.ok();
// }
//
// public void addContraint(GanttConstraint constraint) {
// constraints.add(constraint);
// }
//
// public HColorSet getIHtmlColorSet() {
// return colorSet;
// }
//
// public void setProjectStartingDate(Day start) {
// openClose.setStartingDay(start);
// this.min = start;
// }
//
// public Day getStartingDate() {
// if (openClose.getStartingDay() == null)
// return min;
//
// return openClose.getStartingDay();
// }
//
// public Day getEndingDate() {
// initMinMax();
// return max;
// }
//
// public int daysInWeek() {
// return openClose.daysInWeek();
// }
//
// public boolean isOpen(Day day) {
// return openClose.getLoadAt(day) > 0;
// }
//
// public boolean affectResource(Task result, String description) {
// final Pattern p = Pattern.compile("([^:]+)(:(\\d+))?");
// final Matcher m = p.matcher(description);
// if (m.find() == false)
// throw new IllegalArgumentException();
//
// final Resource resource = getResource(m.group(1));
// int percentage = 100;
// if (m.group(3) != null)
// percentage = Integer.parseInt(m.group(3));
//
// if (percentage == 0)
// return false;
//
// result.addResource(resource, percentage);
// return true;
// }
//
// public Resource getResource(String resourceName) {
// Resource resource = resources.get(resourceName);
// if (resource == null)
// resource = new Resource(resourceName);
//
// resources.put(resourceName, resource);
// return resource;
// }
//
// public int getLoadForResource(Resource res, Day i) {
// int result = 0;
// for (Task task : tasks.values()) {
// if (task instanceof TaskSeparator)
// continue;
//
// final TaskImpl task2 = (TaskImpl) task;
// result += task2.loadForResource(res, i);
// }
// return result;
// }
//
// public Moment getExistingMoment(String id) {
// Moment result = getExistingTask(id);
// if (result == null) {
// Day start = null;
// Day end = null;
// for (Map.Entry<Day, String> ent : nameDays.entrySet()) {
// if (ent.getValue().equalsIgnoreCase(id) == false)
// continue;
//
// start = min(start, ent.getKey());
// end = max(end, ent.getKey());
// }
// if (start != null)
// result = new MomentImpl(start, end);
//
// }
// return result;
// }
//
// private Day min(Day d1, Day d2) {
// if (d1 == null)
// return d2;
//
// if (d1.compareTo(d2) > 0)
// return d2;
//
// return d1;
// }
//
// private Day max(Day d1, Day d2) {
// if (d1 == null)
// return d2;
//
// if (d1.compareTo(d2) < 0)
// return d2;
//
// return d1;
// }
//
// public void colorDay(Day day, HColor color) {
// colorDaysInternal.put(day, color);
// }
//
// public void colorDay(DayOfWeek day, HColor color) {
// colorDaysOfWeek.put(day, color);
// }
//
// public void nameDay(Day day, String name) {
// nameDays.put(day, name);
// }
//
// public Day getToday() {
// if (today == null)
// this.today = Day.today();
//
// return today;
// }
//
// public void setTodayColors(CenterBorderColor colors) {
// if (today == null)
// this.today = Day.today();
//
// colorDaysToday.put(today, colors.getCenter());
// }
//
// public CommandExecutionResult setToday(Day date) {
// this.today = date;
// return CommandExecutionResult.ok();
// }
//
// public CommandExecutionResult deleteTask(Task task) {
// task.setColors(new CenterBorderColor(HColors.WHITE, HColors.BLACK));
// return CommandExecutionResult.ok();
// }
//
// public void setPrintInterval(Day start, Day end) {
// this.printStart = start;
// this.printEnd = end;
// }
//
// public TaskDraw getTaskDraw(Task task) {
// return draws.get(task);
// }
//
// public CommandExecutionResult addNote(Display note) {
// Task last = null;
// for (Task current : tasks.values())
// last = current;
// if (last == null)
// return CommandExecutionResult.error("No task defined");
//
// last.setNote(note);
// return CommandExecutionResult.ok();
// }
public LoadPlanable getDefaultPlan() {
throw new UnsupportedOperationException();
}
@Override
public TaskDraw getTaskDraw(Task task) {
// TODO Auto-generated method stub
return null;
}
@Override
public HColorSet getIHtmlColorSet() {
return colorSet;
}
// private boolean showFootbox = true;
//
// public void setShowFootbox(boolean footbox) {
// this.showFootbox = footbox;
//
// }
//
// @Override
// public ClockwiseTopRightBottomLeft getDefaultMargins() {
// return ClockwiseTopRightBottomLeft.none();
// }
//
// public void setLabelStrategy(LabelStrategy strategy) {
// this.labelStrategy = strategy;
// }
//
// private boolean withCalendarDate;
//
// public void setWithCalendarDate(boolean withCalendarDate) {
// this.withCalendarDate = withCalendarDate;
// }
//
// private boolean hideResourceName;
// private boolean hideResourceFoobox;
//
// public CommandExecutionResult hideResourceName() {
// this.hideResourceName = true;
// return CommandExecutionResult.ok();
// }
//
// public CommandExecutionResult hideResourceFootbox() {
// this.hideResourceFoobox = true;
// return CommandExecutionResult.ok();
// }
//
// private final Set<Day> verticalSeparatorBefore = new HashSet<>();
//
// public void addVerticalSeparatorBefore(Day day) {
// verticalSeparatorBefore.add(day);
// }
//
// public void setTaskDefaultCompletion(int defaultCompletion) {
// this.defaultCompletion = defaultCompletion;
// }
//
// public List<TaskDrawRegular> getAllTasksForResource(Resource res) {
// final List<TaskDrawRegular> result = new ArrayList<TaskDrawRegular>();
// for (Task task : tasks.values())
// if (task.isAssignedTo(res)) {
// final TaskDrawRegular draw = (TaskDrawRegular) draws.get(task);
// result.add(draw);
// }
//
// return Collections.unmodifiableList(result);
// }
//
// public void setIt(Task result) {
// this.it = result;
// }
//
// public Task getIt() {
// return it;
// }
//
// public final Resource getThey() {
// return they;
// }
//
// public final void setThey(Resource they) {
// this.they = they;
// }
}

View File

@ -0,0 +1,126 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommonCommands;
import net.sourceforge.plantuml.command.PSystemCommandFactory;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.project.command.NaturalCommand;
import net.sourceforge.plantuml.project.lang.SentenceAnd;
import net.sourceforge.plantuml.project.lang.SentenceAndAnd;
import net.sourceforge.plantuml.project.lang.SentenceSimple;
import net.sourceforge.plantuml.project.lang.Subject;
public class ChronologyDiagramFactory extends PSystemCommandFactory {
static private final List<Subject<ChronologyDiagram>> subjects() {
return Arrays.asList(SubjectTask.ME);
}
public ChronologyDiagramFactory() {
super(DiagramType.CHRONOLOGY);
}
@Override
protected void initCommandsList(List<Command> cmds) {
CommonCommands.addTitleCommands(cmds);
CommonCommands.addCommonCommands2(cmds);
// cmds.add(CommandStyleMultilinesCSS.ME);
// cmds.add(CommandStyleImport.ME);
//
// cmds.add(CommandNope.ME);
addLanguageCommands(cmds);
// cmds.add(new CommandGanttArrow());
// cmds.add(new CommandGanttArrow2());
// cmds.add(new CommandColorTask());
// cmds.add(new CommandSeparator());
// cmds.add(new CommandWeekNumberStrategy());
// cmds.add(new CommandGroupStart());
// cmds.add(new CommandGroupEnd());
//
// cmds.add(new CommandLanguage());
// cmds.add(new CommandPrintScale());
// cmds.add(new CommandPrintBetween());
// cmds.add(new CommandNoteBottom());
// cmds.add(new CommandFootbox());
// cmds.add(new CommandLabelOnColumn());
// cmds.add(new CommandHideResourceName());
// cmds.add(new CommandHideResourceFootbox());
// cmds.add(new CommandTaskCompleteDefault());
}
private void addLanguageCommands(List<Command> cmd) {
for (Subject<ChronologyDiagram> subject : subjects())
for (SentenceSimple<ChronologyDiagram> sentenceA : subject.getSentences()) {
cmd.add(NaturalCommand.create(sentenceA));
for (SentenceSimple<ChronologyDiagram> sentenceB : subject.getSentences()) {
final String signatureA = sentenceA.getSignature();
final String signatureB = sentenceB.getSignature();
if (signatureA.equals(signatureB) == false)
cmd.add(NaturalCommand.create(new SentenceAnd<ChronologyDiagram>(sentenceA, sentenceB)));
}
}
for (Subject<ChronologyDiagram> subject : subjects())
for (SentenceSimple<ChronologyDiagram> sentenceA : subject.getSentences())
for (SentenceSimple<ChronologyDiagram> sentenceB : subject.getSentences())
for (SentenceSimple<ChronologyDiagram> sentenceC : subject.getSentences()) {
final String signatureA = sentenceA.getSignature();
final String signatureB = sentenceB.getSignature();
final String signatureC = sentenceC.getSignature();
if (signatureA.equals(signatureB) == false && signatureA.equals(signatureC) == false
&& signatureC.equals(signatureB) == false)
cmd.add(NaturalCommand
.create(new SentenceAndAnd<ChronologyDiagram>(sentenceA, sentenceB, sentenceC)));
}
}
@Override
public ChronologyDiagram createEmptyDiagram(UmlSource source, Map<String, String> skinParam) {
return new ChronologyDiagram(source);
}
}

View File

@ -0,0 +1,54 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import net.sourceforge.plantuml.project.Failable;
import net.sourceforge.plantuml.project.lang.Something;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
public class ComplementAnything implements Something<ChronologyDiagram> {
public IRegex toRegex(String suffix) {
return new RegexLeaf("ANYTHING" + suffix, "(.*?)");
}
public Failable<String> getMe(ChronologyDiagram system, RegexResult arg, String suffix) {
final String value = arg.get("ANYTHING" + suffix, 0);
return Failable.ok(value);
}
}

View File

@ -0,0 +1,84 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import net.sourceforge.plantuml.project.Failable;
import net.sourceforge.plantuml.project.lang.Something;
import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexResult;
public class ComplementHour implements Something<ChronologyDiagram> {
// [Task1] starts at 2023-11-28 15:41:21, ends at 2023-11-28 19:40:00
static private final SimpleDateFormat inputFormat;
static private final SimpleDateFormat inputFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
static {
inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
inputFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
}
public IRegex toRegex(String suffix) {
return new RegexConcat( //
new RegexLeaf("TIME", "(\\d+-\\d+-\\d+ \\d+:\\d+:\\d+)"), //
new RegexOptional(new RegexLeaf("MS", "\\.(\\d+)")) //
); //
}
public Failable<Day> getMe(ChronologyDiagram system, RegexResult arg, String suffix) {
final String value = arg.get("TIME", 0);
System.err.println("value=" + value);
try {
final Date date = inputFormat.parse(value);
return Failable.ok(Day.create(date.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
throw new IllegalStateException();
}
}

View File

@ -0,0 +1,136 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.time.Month;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexResult;
public class HourPattern {
private final String id;
private final String yearKeyA;
private final String yearKeyB;
private final String yearKeyC;
private final String monthKeyA;
private final String monthKeyB;
private final String monthKeyC;
private final String dayKeyA;
private final String dayKeyB;
private final String dayKeyC;
public HourPattern(String id) {
this.id = id;
this.yearKeyA = "AYEAR" + id;
this.yearKeyB = "BYEAR" + id;
this.yearKeyC = "CYEAR" + id;
this.monthKeyA = "AMONTH" + id;
this.monthKeyB = "BMONTH" + id;
this.monthKeyC = "CMONTH" + id;
this.dayKeyA = "ADAY" + id;
this.dayKeyB = "BDAY" + id;
this.dayKeyC = "CDAY" + id;
}
public IRegex toRegex() {
return new RegexOr(toRegexA_DD_MONTH_YYYY(), toRegexB_YYYY_MM_DD(), toRegexC_MONTH_DD_YYYY());
}
public Day getDay(RegexResult arg) {
if (arg.get(dayKeyA, 0) != null)
return resultA(arg);
if (arg.get(dayKeyB, 0) != null)
return resultB(arg);
if (arg.get(dayKeyC, 0) != null)
return resultC(arg);
return null;
}
private IRegex toRegexA_DD_MONTH_YYYY() {
return new RegexConcat( //
new RegexLeaf(dayKeyA, "([\\d]{1,2})"), //
new RegexLeaf("[\\w, ]*?"), //
new RegexLeaf(monthKeyA, "(" + Month.getRegexString() + ")"), //
new RegexLeaf("[\\w, ]*?"), //
new RegexLeaf(yearKeyA, "([\\d]{1,4})"));
}
private Day resultA(RegexResult arg) {
final int day = Integer.parseInt(arg.get(dayKeyA, 0));
final String month = arg.get(monthKeyA, 0);
final int year = Integer.parseInt(arg.get(yearKeyA, 0));
return Day.create(year, month, day);
}
private IRegex toRegexB_YYYY_MM_DD() {
return new RegexConcat( //
new RegexLeaf(yearKeyB, "([\\d]{1,4})"), //
new RegexLeaf("\\D"), //
new RegexLeaf(monthKeyB, "([\\d]{1,2})"), //
new RegexLeaf("\\D"), //
new RegexLeaf(dayKeyB, "([\\d]{1,2})"));
}
private Day resultB(RegexResult arg) {
final int day = Integer.parseInt(arg.get(dayKeyB, 0));
final int month = Integer.parseInt(arg.get(monthKeyB, 0));
final int year = Integer.parseInt(arg.get(yearKeyB, 0));
return Day.create(year, month, day);
}
private IRegex toRegexC_MONTH_DD_YYYY() {
return new RegexConcat( //
new RegexLeaf(monthKeyC, "(" + Month.getRegexString() + ")"), //
new RegexLeaf("[\\w, ]*?"), //
new RegexLeaf(dayKeyC, "([\\d]{1,2})"), //
new RegexLeaf("[\\w, ]*?"), //
new RegexLeaf(yearKeyC, "([\\d]{1,4})"));
}
private Day resultC(RegexResult arg) {
final int day = Integer.parseInt(arg.get(dayKeyC, 0));
final String month = arg.get(monthKeyC, 0);
final int year = Integer.parseInt(arg.get(yearKeyC, 0));
return Day.create(year, month, day);
}
}

View File

@ -0,0 +1,60 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.lang.SentenceSimple;
import net.sourceforge.plantuml.project.lang.Verbs;
import net.sourceforge.plantuml.project.lang.Words;
import net.sourceforge.plantuml.project.time.Day;
public class SentenceHappensChronology extends SentenceSimple<ChronologyDiagram> {
public SentenceHappensChronology() {
super(SubjectTask.ME, Verbs.happens, Words.zeroOrMore(Words.THE, Words.ON, Words.AT), new ComplementHour());
}
@Override
public CommandExecutionResult execute(ChronologyDiagram project, Object subject, Object complement) {
final Task task = (Task) subject;
final Day start = (Day) complement;
task.setStart(start);
task.setEnd(start);
return CommandExecutionResult.ok();
}
}

View File

@ -0,0 +1,92 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import java.util.Arrays;
import java.util.Collection;
import net.sourceforge.plantuml.project.Failable;
import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.lang.SentenceSimple;
import net.sourceforge.plantuml.project.lang.Subject;
import net.sourceforge.plantuml.project.lang.Words;
import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
public class SubjectTask implements Subject<ChronologyDiagram> {
public static final Subject<ChronologyDiagram> ME = new SubjectTask();
private SubjectTask() {
}
public Failable<Task> getMe(ChronologyDiagram chronology, RegexResult arg) {
final Task result;
final String subject = arg.get("SUBJECT", 0);
final String shortName = arg.get("SHORTNAME", 0);
final String stereotype = arg.get("STEREOTYPE", 0);
result = chronology.getOrCreateTask(subject, shortName, false);
if (stereotype != null)
result.setStereotype(Stereotype.build(arg.get("STEREOTYPE", 0)));
return Failable.ok(result);
}
public Collection<? extends SentenceSimple<ChronologyDiagram>> getSentences() {
return Arrays.asList(new SentenceHappensChronology());
}
public IRegex toRegex() {
return new RegexOr( //
new RegexLeaf("SUBJECT", "\\[([^\\[\\]]+?)\\]"), //
StereotypePattern.optional("STEREOTYPE"), //
new RegexOptional(new RegexConcat(//
Words.exactly(Words.AS), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("SHORTNAME", "\\[([^\\[\\]]+?)\\]"))) //
);
}
}

View File

@ -0,0 +1,372 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.project.Load;
import net.sourceforge.plantuml.project.core.AbstractTask;
import net.sourceforge.plantuml.project.core.Resource;
import net.sourceforge.plantuml.project.core.Task;
import net.sourceforge.plantuml.project.core.TaskCode;
import net.sourceforge.plantuml.project.lang.CenterBorderColor;
import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.time.DayOfWeek;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.url.Url;
public class TaskChronology extends AbstractTask implements Task {
private Display note;
private Url url;
private CenterBorderColor[] colors;
private Day start;
private Day end;
public void setUrl(Url url) {
this.url = url;
}
public TaskChronology(StyleBuilder styleBuilder, TaskCode code) {
super(styleBuilder, code);
}
@Override
public void setStart(Day start) {
this.start = start;
}
@Override
public Day getStart() {
return this.start;
}
@Override
public void setEnd(Day end) {
this.end = end;
}
@Override
public Day getEnd() {
return this.end;
}
@Override
public Load getLoad() {
throw new UnsupportedOperationException();
}
@Override
public void setLoad(Load load) {
throw new UnsupportedOperationException();
}
@Override
public void addResource(Resource resource, int percentage) {
throw new UnsupportedOperationException();
}
@Override
public void setDiamond(boolean diamond) {
throw new UnsupportedOperationException();
}
@Override
public boolean isDiamond() {
return false;
}
@Override
public void setCompletion(int completion) {
throw new UnsupportedOperationException();
}
@Override
public void addPause(Day pause) {
throw new UnsupportedOperationException();
}
@Override
public void addPause(DayOfWeek pause) {
throw new UnsupportedOperationException();
}
@Override
public boolean isAssignedTo(Resource res) {
throw new UnsupportedOperationException();
}
// @Override
// public int getLoadAt(Day instant) {
// if (isPaused(instant))
// return 0;
//
// LoadPlanable result = defaultPlan;
// if (resources.size() > 0)
// result = PlanUtils.multiply(defaultPlan, getResourcePlan());
//
// return result.getLoadAt(instant);
// }
//
// private boolean isPaused(Day instant) {
// if (pausedDay.contains(instant))
// return true;
//
// if (pausedDayOfWeek(instant))
// return true;
//
// return false;
// }
//
// private boolean pausedDayOfWeek(Day instant) {
// for (DayOfWeek dayOfWeek : pausedDayOfWeek)
// if (instant.getDayOfWeek() == dayOfWeek)
// return true;
//
// return false;
// }
//
// public int loadForResource(Resource res, Day instant) {
// if (resources.keySet().contains(res) && instant.compareTo(getStart()) >= 0
// && instant.compareTo(getEnd()) <= 0) {
// if (isPaused(instant))
// return 0;
//
// if (res.isClosedAt(instant))
// return 0;
//
// return resources.get(res);
// }
// return 0;
// }
//
// @Override
// public void addPause(Day pause) {
// this.pausedDay.add(pause);
// }
//
// @Override
// public void addPause(DayOfWeek pause) {
// this.pausedDayOfWeek.add(pause);
// }
//
// private LoadPlanable getResourcePlan() {
// if (resources.size() == 0)
// throw new IllegalStateException();
//
// return new LoadPlanable() {
// public int getLoadAt(Day instant) {
// int result = 0;
// for (Map.Entry<Resource, Integer> ent : resources.entrySet()) {
// final Resource res = ent.getKey();
// if (res.isClosedAt(instant))
// continue;
//
// final int percentage = ent.getValue();
// result += percentage;
// }
// return result;
// }
//
// @Override
// public Day getLastDayIfAny() {
// return TaskChronology.this.getLastDayIfAny();
// }
// };
// }
//
// @Override
// public Day getLastDayIfAny() {
// Day result = null;
//
// for (Resource res : resources.keySet()) {
// if (res.getLastDayIfAny() == null)
// return null;
//
// if (result == null || result.compareTo(res.getLastDayIfAny()) < 0)
// result = res.getLastDayIfAny();
// }
//
// return result;
// }
//
// public String getPrettyDisplay() {
// if (resources.size() > 0) {
// final StringBuilder result = new StringBuilder(getCode().getSimpleDisplay());
// result.append(" ");
// for (Iterator<Map.Entry<Resource, Integer>> it = resources.entrySet().iterator(); it.hasNext();) {
// final Map.Entry<Resource, Integer> ent = it.next();
// result.append("{");
// result.append(ent.getKey().getName());
// final int percentage = ent.getValue();
// if (percentage != 100)
// result.append(":" + percentage + "%");
//
// result.append("}");
// if (it.hasNext())
// result.append(" ");
//
// }
// return result.toString();
// }
// return getCode().getSimpleDisplay();
// }
//
// @Override
// public String toString() {
// return getCode().toString();
// }
//
// public String debug() {
// return "" + getStart() + " ---> " + getEnd() + " [" + getLoad() + "]";
// }
//
// @Override
// public Day getStart() {
// Day result = (Day) solver.getData(TaskAttribute.START);
// if (diamond == false)
// while (getLoadAt(result) == 0)
// result = result.increment();
//
// return result;
// }
//
// @Override
// public Day getEnd() {
// return (Day) solver.getData(TaskAttribute.END);
// }
//
// @Override
// public Load getLoad() {
// return (Load) solver.getData(TaskAttribute.LOAD);
// }
//
// @Override
// public void setLoad(Load load) {
// solver.setData(TaskAttribute.LOAD, load);
// }
//
// @Override
// public void setStart(Day start) {
// solver.setData(TaskAttribute.START, start);
// }
//
// @Override
// public void setEnd(Day end) {
// solver.setData(TaskAttribute.END, end);
// }
@Override
public void setColors(CenterBorderColor... colors) {
this.colors = colors;
}
// @Override
// public void addResource(Resource resource, int percentage) {
// this.resources.put(resource, percentage);
// }
//
// @Override
// public void setDiamond(boolean diamond) {
// this.diamond = diamond;
// }
//
// @Override
// public boolean isDiamond() {
// return this.diamond;
// }
//
// @Override
// public void setCompletion(int completion) {
// this.completion = completion;
// }
//
// public final Url getUrl() {
// return url;
// }
//
// public final CenterBorderColor getColors() {
// if (colors == null)
// return null;
//
// if (colors.length == 1)
// return colors[0];
//
// return colors[0].unlinearTo(colors[1], completion);
// }
//
// public final int getCompletion() {
// return completion;
// }
//
// public final Collection<Day> getAllPaused() {
// final SortedSet<Day> result = new TreeSet<>(pausedDay);
// for (DayOfWeek dayOfWeek : pausedDayOfWeek)
// addAll(result, dayOfWeek);
//
// return Collections.unmodifiableCollection(result);
// }
//
// private void addAll(SortedSet<Day> result, DayOfWeek dayOfWeek) {
// final Day start = getStart();
// final Day end = getEnd();
// for (Day current = start; current.compareTo(end) <= 0; current = current.increment())
// if (current.getDayOfWeek() == dayOfWeek)
// result.add(current);
//
// }
@Override
public void setNote(Display note) {
this.note = note;
}
public Display getNote() {
return note;
}
// public LoadPlanable getDefaultPlan() {
// return defaultPlan;
// }
//
// @Override
// public boolean isAssignedTo(Resource res) {
// return resources.containsKey(res);
// }
}

View File

@ -0,0 +1,197 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.FontConfiguration;
import net.sourceforge.plantuml.klimt.font.StringBounder;
import net.sourceforge.plantuml.klimt.font.UFont;
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.klimt.shape.ULine;
import net.sourceforge.plantuml.klimt.sprite.SpriteContainerEmpty;
import net.sourceforge.plantuml.project.TimeHeaderParameters;
import net.sourceforge.plantuml.project.core.PrintScale;
import net.sourceforge.plantuml.project.draw.TimeHeader;
import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
public class TimeHeaderChronology extends TimeHeader {
private final PrintScale printScale;
@Override
public double getFullHeaderHeight(StringBounder stringBounder) {
return getTimeHeaderHeight(stringBounder) + getHeaderNameDayHeight();
}
@Override
public double getTimeHeaderHeight(StringBounder stringBounder) {
final double h = thParam.getStyle(SName.timeline, SName.day).value(PName.FontSize).asDouble();
return h + 6;
}
@Override
public double getTimeFooterHeight(StringBounder stringBounder) {
final double h = thParam.getStyle(SName.timeline, SName.day).value(PName.FontSize).asDouble();
return h + 6;
}
private double getHeaderNameDayHeight() {
return 0;
}
public TimeHeaderChronology(StringBounder stringBounder, TimeHeaderParameters thParam, PrintScale printScale,
TimeScaleChronology timeScale) {
super(thParam, timeScale);
this.printScale = printScale;
}
private void drawSmallVlinesDay(UGraphic ug, TimeScale timeScale, double totalHeightWithoutFooter) {
ug = ug.apply(getLineColor());
ug = ug.apply(UTranslate.dy(6));
final ULine vbar = ULine.vline(totalHeightWithoutFooter + 2);
for (Day i = getMin(); i.compareTo(getMax().increment()) < 0; i = i.increment(printScale)) {
final double x1 = timeScale.getStartingPosition(i);
ug.apply(UTranslate.dx(x1)).draw(vbar);
}
}
private void drawSimpleDayCounter(UGraphic ug, TimeScale timeScale) {
for (Day i = getMin(); i.compareTo(getMax().increment()) < 0; i = i.increment(printScale)) {
final UFont font = thParam.getStyle(SName.timeline, SName.day).getUFont();
final FontConfiguration fontConfiguration = getFontConfiguration(font, false, openFontColor());
final TextBlock num = Display.getWithNewlines(i.toStringShort(thParam.getLocale()))
.create(fontConfiguration, HorizontalAlignment.LEFT, new SpriteContainerEmpty());
final double x1 = timeScale.getStartingPosition(i);
final double x2;
if (printScale == PrintScale.WEEKLY)
x2 = timeScale.getEndingPosition(i.addDays(6));
else
x2 = timeScale.getEndingPosition(i);
final double width = num.calculateDimension(ug.getStringBounder()).getWidth();
final double delta = (x2 - x1) - width;
if (i.compareTo(getMax().increment()) < 0)
num.drawU(ug.apply(UTranslate.dx(x1 + delta / 2)));
}
}
@Override
public void drawTimeHeader(UGraphic ug, double totalHeightWithoutFooter) {
// drawTextsBackground(ug.apply(UTranslate.dy(-3)), totalHeightWithoutFooter +
// 6);
final double xmin = getTimeScale().getStartingPosition(getMin());
final double xmax = getTimeScale().getEndingPosition(getMax());
drawSmallVlinesDay(ug, getTimeScale(), totalHeightWithoutFooter);
// printVerticalSeparators(ug, totalHeightWithoutFooter);
drawSimpleDayCounter(ug, getTimeScale());
// ug = ug.apply(getLineColor());
// ug.draw(ULine.hline(xmax - xmin));
// ug.apply(UTranslate.dy(getFullHeaderHeight(ug.getStringBounder()) -
// 3)).draw(ULine.hline(xmax - xmin));
}
@Override
public void drawTimeFooter(UGraphic ug) {
final double xmin = getTimeScale().getStartingPosition(getMin());
final double xmax = getTimeScale().getEndingPosition(getMax());
ug = ug.apply(UTranslate.dy(3));
// drawSmallVlinesDay(ug, getTimeScale(),
// getTimeFooterHeight(ug.getStringBounder()) - 3);
drawSimpleDayCounter(ug, getTimeScale());
// ug.apply(getLineColor()).draw(ULine.hline(xmax - xmin));
}
// Duplicate in TimeHeaderDaily
class Pending {
final double x1;
double x2;
final HColor color;
Pending(HColor color, double x1, double x2) {
this.x1 = x1;
this.x2 = x2;
this.color = color;
}
public void draw(UGraphic ug, double height) {
drawRectangle(ug.apply(color.bg()), height, x1, x2);
}
}
protected final void drawTextsBackground(UGraphic ug, double totalHeightWithoutFooter) {
final double height = totalHeightWithoutFooter - getFullHeaderHeight(ug.getStringBounder());
Pending pending = null;
for (Day wink = getMin(); wink.compareTo(getMax()) <= 0; wink = wink.increment()) {
final double x1 = getTimeScale().getStartingPosition(wink);
final double x2 = getTimeScale().getEndingPosition(wink);
HColor back = thParam.getColor(wink);
// // Day of week should be stronger than period of time (back color).
// final HColor backDoW = colorDaysOfWeek.get(wink.getDayOfWeek());
// if (backDoW != null) {
// back = backDoW;
// }
// if (back == null && defaultPlan.getLoadAt(wink) == 0) {
// back = closedBackgroundColor();
// }
if (back == null) {
if (pending != null)
pending.draw(ug, height);
pending = null;
} else {
if (pending != null && pending.color.equals(back) == false) {
pending.draw(ug, height);
pending = null;
}
if (pending == null)
pending = new Pending(back, x1, x2);
else
pending.x2 = x2;
}
}
}
}

View File

@ -0,0 +1,81 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.chronology;
import net.sourceforge.plantuml.project.time.Day;
import net.sourceforge.plantuml.project.timescale.TimeScale;
public class TimeScaleChronology implements TimeScale {
private final double fullWidth;
private long min;
private long max;
public TimeScaleChronology(double fullWidth) {
this.fullWidth = fullWidth;
}
public double getStartingPosition(Day instant) {
final long wink = instant.getMillis();
if (wink < min)
throw new IllegalArgumentException();
if (wink > max)
throw new IllegalArgumentException();
return fullWidth * (wink - min) / (max - min);
}
public double getEndingPosition(Day instant) {
return getStartingPosition(instant);
}
public double getWidth(Day instant) {
throw new UnsupportedOperationException();
}
public boolean isBreaking(Day instant) {
throw new UnsupportedOperationException();
}
public final void setMin(long min) {
this.min = min;
}
public final void setMax(long max) {
this.max = max;
}
}

View File

@ -0,0 +1,9 @@
/**
* Provides classes used to manage
* <a href="https://plantuml.com/chronology-diagram" target="_top">
* Chronology Diagram</a>.
*
* @see net.sourceforge.plantuml.project
*
*/
package net.sourceforge.plantuml.chronology;

View File

@ -0,0 +1,10 @@
# Directory Documentation for `chronology`
## Description
This package provides classes used to manage [Chronology Diagram](https://plantuml.com/chronology-diagram).
## Link
- [Chronology Diagram](https://plantuml.com/chronology-diagram)
## Reference
- [Gantt Diagram](https://plantuml.com/gantt-diagram)

View File

@ -58,6 +58,7 @@ import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotag;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -101,9 +102,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //

View File

@ -65,6 +65,7 @@ import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.stereo.Stereotag;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.text.StringLocated;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
@ -115,9 +116,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
new RegexLeaf("GENERIC", "\\<(" + GenericRegexProducer.PATTERN + ")\\>"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //
@ -128,10 +127,16 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), //
new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(),
new RegexLeaf("EXTENDS",
"(extends)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
"(extends)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"),
new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(),
new RegexLeaf("\\<(" + GenericRegexProducer.PATTERN + ")\\>"))) //
)), //
new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(),
new RegexLeaf("IMPLEMENTS",
"(implements)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
"(implements)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"),
new RegexOptional(new RegexConcat(RegexLeaf.spaceZeroOrMore(),
new RegexLeaf("\\<(" + GenericRegexProducer.PATTERN + ")\\>"))) //
)), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{"), //
RegexLeaf.spaceZeroOrMore(), //

View File

@ -53,11 +53,11 @@ import net.sourceforge.plantuml.klimt.font.FontParam;
import net.sourceforge.plantuml.plasma.Quark;
import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexOr;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotag;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -88,21 +88,14 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
new RegexLeaf("CODE1", CommandCreateElementFull.CODE_WITH_QUOTE), //
new RegexConcat(//
new RegexLeaf("DISPLAY2", CommandCreateElementFull.DISPLAY), //
new RegexOptional( //
new RegexConcat( //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("STEREOTYPE2", "(\\<\\<.+\\>\\>)") //
)), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE2"), //
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE2", CommandCreateElementFull.CODE)) //
), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //
@ -118,21 +111,14 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
new RegexLeaf("CODE1", CommandCreateElementFull.CODE_WITH_QUOTE), //
new RegexConcat(//
new RegexLeaf("DISPLAY2", CommandCreateElementFull.DISPLAY), //
new RegexOptional( //
new RegexConcat( //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("STEREOTYPE2", "(\\<\\<.+\\>\\>)") //
)), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE2"), //
new RegexLeaf("as"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("CODE2", CommandCreateElementFull.CODE)) //
), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.+\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.utils.LineLocation;
public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
@ -60,7 +61,8 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
RegexLeaf.start(), //
new RegexLeaf("NAME", "([%pLN_.]+|[%g][^%g]+[%g])"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)"), RegexLeaf.end()); //
StereotypePattern.mandatory("STEREO"), //
RegexLeaf.end()); //
}
@Override

View File

@ -0,0 +1,71 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml.code;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
public class CompressionGZip implements Compression {
// ::remove file when __CORE__
public byte[] compress(byte[] in) {
throw new UnsupportedOperationException();
}
public ByteArray decompress(byte[] input) throws NoPlantumlCompressionException {
try {
try (final GZIPInputStream gzip = new GZIPInputStream(new ByteArrayInputStream(input))) {
final byte[] buffer = new byte[10_000];
try (final ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
int len;
while ((len = gzip.read(buffer)) > 0) {
baos.write(buffer, 0, len);
if (baos.size() > 200_000)
throw new NoPlantumlCompressionException("Gzip error");
}
return ByteArray.from(baos.toByteArray());
}
}
} catch (IOException e) {
throw new NoPlantumlCompressionException(e);
}
}
}

View File

@ -49,6 +49,8 @@ public class TranscoderSmart implements Transcoder {
new CompressionHuffman());
private final Transcoder zip = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(),
new CompressionZip());
private final Transcoder gzip = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(),
new CompressionGZip());
// ::done
public String decode(String code) throws NoPlantumlCompressionException {
@ -66,6 +68,9 @@ public class TranscoderSmart implements Transcoder {
if (code.startsWith("~h"))
return hexOnly.decode(code.substring(2));
if (code.startsWith("~g"))
return gzip.decode(code.substring(2));
// ::comment when __CORE__
if (code.startsWith("~zip~"))
return zip.decode(code.substring(5));

View File

@ -49,6 +49,8 @@ public class TranscoderSmartProtected implements Transcoder {
new CompressionNone());
private final Transcoder zip = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(),
new CompressionZip());
private final Transcoder gzip = TranscoderImpl.utf8(new AsciiEncoder(), new ArobaseStringCompressor(),
new CompressionGZip());
public String decode(String code) throws NoPlantumlCompressionException {
// Work in progress
@ -63,6 +65,9 @@ public class TranscoderSmartProtected implements Transcoder {
if (code.startsWith("~h"))
return hexOnly.decode(code.substring(2));
if (code.startsWith("~g"))
return gzip.decode(code.substring(2));
if (code.startsWith("~zip~"))
return zip.decode(code.substring(5));

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -68,9 +69,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
new RegexLeaf("namespace"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", NAMESPACE_REGEX), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
UrlBuilder.OPTIONAL, //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -72,9 +73,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", CommandNamespace.NAMESPACE_REGEX), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
UrlBuilder.OPTIONAL, //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -64,9 +65,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
new RegexLeaf("namespace"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("NAME", CommandNamespace.NAMESPACE_REGEX), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
UrlBuilder.OPTIONAL, //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.regex.RegexOptional;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotag;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -80,9 +81,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
)), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREOTYPE"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.stereo.Stereotag;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.utils.BlocLines;
import net.sourceforge.plantuml.utils.LineLocation;
@ -70,9 +71,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
new RegexLeaf("CODE", "([%pLN_.]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
ColorParser.exp1(), //
RegexLeaf.end() //
);
@ -91,9 +90,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
new RegexLeaf("CODE", "([%pLN_.]+)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
ColorParser.exp1(), //
RegexLeaf.end() //
);

View File

@ -63,6 +63,7 @@ import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.skin.ColorParam;
import net.sourceforge.plantuml.stereo.Stereotag;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -92,9 +93,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
new RegexLeaf("")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
@ -127,9 +126,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
new RegexLeaf("")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
@ -153,9 +150,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
new RegexLeaf("")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.skin.ColorParam;
import net.sourceforge.plantuml.stereo.Stereotag;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -89,9 +90,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
partialPattern, //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //
@ -112,9 +111,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
partialPattern, //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TAGS1", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO"), //
new RegexLeaf("TAGS2", Stereotag.pattern() + "?"), //
RegexLeaf.spaceZeroOrMore(), //
ColorParser.exp1(), //

View File

@ -57,6 +57,7 @@ import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.skin.ColorParam;
import net.sourceforge.plantuml.stereo.Stereotype;
import net.sourceforge.plantuml.stereo.StereotypePattern;
import net.sourceforge.plantuml.url.Url;
import net.sourceforge.plantuml.url.UrlBuilder;
import net.sourceforge.plantuml.url.UrlMode;
@ -70,13 +71,9 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
new RegexLeaf("VMERGE", "(/)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO1"), //
new RegexLeaf("ACROSS", "(accross|across)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO2"), //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //
@ -89,13 +86,9 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
new RegexLeaf("VMERGE", "(/)?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STYLE", "(note|hnote|rnote)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO1"), //
new RegexLeaf("ACROSS", "(accross|across)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), //
RegexLeaf.spaceZeroOrMore(), //
StereotypePattern.optional("STEREO2"), //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
UrlBuilder.OPTIONAL, //

Some files were not shown because too many files have changed in this diff Show More