From c4397fac972b9bd38779947e88fdd8ef39e56a2d Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Sun, 22 Sep 2019 19:20:16 +0200 Subject: [PATCH] version 1.2019.11 --- pom.xml | 2 +- skin/plantuml.skin | 8 + skin/strictuml.skin | 6 + src/net/sourceforge/plantuml/SkinParam.java | 25 ++- .../plantuml/SourceStringReader.java | 4 + .../command/CommandLinkLongActivity.java | 1 + .../command/CommandActivityLong3.java | 1 + .../command/CommandArrowLong3.java | 1 + .../command/CommandNoteLong3.java | 2 + .../command/CommandCreateClassMultilines.java | 1 + .../plantuml/command/CommandFooter.java | 11 +- .../plantuml/command/CommandHeader.java | 9 +- .../command/CommandMultilinesFooter.java | 8 +- .../command/CommandMultilinesHeader.java | 8 +- .../plantuml/command/UmlDiagramFactory.java | 2 +- .../FactorySequenceNoteOnArrowCommand.java | 4 +- .../plantuml/creole/AbstractAtom.java | 3 +- .../sourceforge/plantuml/creole/AtomImg.java | 4 +- .../plantuml/creole/AtomSprite.java | 5 - .../sourceforge/plantuml/creole/AtomText.java | 19 +-- .../sourceforge/plantuml/creole/AtomTree.java | 6 - .../plantuml/creole/CommandCreoleUrl.java | 8 - .../plantuml/creole/CreoleHorizontalLine.java | 5 - .../plantuml/creole/StripeSimple.java | 16 +- .../plantuml/creole/StripeTree.java | 22 ++- .../plantuml/cucadiagram/dot/DotData.java | 4 + .../command/CommandLinkElement.java | 5 +- .../plantuml/donors/PSystemDonors.java | 34 ++-- .../plantuml/graphic/QuoteUtils.java | 3 +- .../plantuml/mindmap/CommandMindMapLeft.java | 3 +- .../mindmap/CommandMindMapLeftNumber.java | 3 +- .../mindmap/CommandMindMapOrgmode.java | 4 +- .../CommandMindMapOrgmodeMultiline.java | 86 ++++++++++ .../plantuml/mindmap/CommandMindMapPlus.java | 4 +- .../plantuml/mindmap/CommandMindMapRight.java | 5 +- .../mindmap/CommandMindMapRightNumber.java | 3 +- .../plantuml/mindmap/CommandMindMapRoot.java | 3 +- .../mindmap/CommandMindMapTabulation.java | 4 +- .../plantuml/mindmap/MindMapDiagram.java | 21 ++- .../mindmap/MindMapDiagramFactory.java | 1 + .../CommandCreateEntityObjectMultilines.java | 1 + .../sourceforge/plantuml/preproc/Defines.java | 12 +- .../sequencediagram/AbstractMessage.java | 13 +- .../plantuml/sequencediagram/Note.java | 21 +-- .../sequencediagram/NotePosition.java | 2 +- .../sequencediagram/graphic/Step1Message.java | 2 + .../teoz/CommunicationTileNoteBottom.java | 156 +++++++++++++++++ .../teoz/CommunicationTileNoteTop.java | 157 ++++++++++++++++++ .../sequencediagram/teoz/LiveBoxesDrawer.java | 17 +- .../sequencediagram/teoz/TileBuilder.java | 6 + .../sourceforge/plantuml/skin/rose/Rose.java | 19 ++- .../sprite/ListSpriteDiagramFactory.java | 1 + .../plantuml/style/CommandStyleImport.java | 13 +- .../plantuml/style/FromSkinparamToStyle.java | 20 ++- src/net/sourceforge/plantuml/style/Style.java | 12 ++ .../plantuml/svek/GeneralImageBuilder.java | 77 ++++++++- .../plantuml/svek/IEntityImageMoved.java | 97 +++++++++++ .../plantuml/svek/image/Opale.java | 9 - .../sourceforge/plantuml/svg/SvgGraphics.java | 14 +- .../plantuml/tim/expression/ShuntingYard.java | 11 +- .../timingdiagram/CommandNoteLong.java | 2 + .../sourceforge/plantuml/version/Version.java | 4 +- .../sourceforge/plantuml/wbs/WBSDiagram.java | 2 +- 63 files changed, 862 insertions(+), 170 deletions(-) create mode 100644 skin/strictuml.skin create mode 100644 src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java create mode 100644 src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java create mode 100644 src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java create mode 100644 src/net/sourceforge/plantuml/svek/IEntityImageMoved.java diff --git a/pom.xml b/pom.xml index 636c03dfd..c64e502ec 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 1.2019.11-SNAPSHOT + 1.2019.12-SNAPSHOT jar PlantUML diff --git a/skin/plantuml.skin b/skin/plantuml.skin index 4b2ba0869..18c83365f 100644 --- a/skin/plantuml.skin +++ b/skin/plantuml.skin @@ -138,33 +138,41 @@ delay { participant { LineThickness 1.5 + HorizontalAlignment center } actor { LineThickness 2.0 + HorizontalAlignment center } boundary { LineThickness 2.0 + HorizontalAlignment center } control { LineThickness 2.0 + HorizontalAlignment center } entity { LineThickness 2.0 + HorizontalAlignment center } queue { LineThickness 2.0 + HorizontalAlignment center } database { + HorizontalAlignment center } collections { LineThickness 1.5 + HorizontalAlignment center } swimlane { diff --git a/skin/strictuml.skin b/skin/strictuml.skin new file mode 100644 index 000000000..86a6d4226 --- /dev/null +++ b/skin/strictuml.skin @@ -0,0 +1,6 @@ +root { + Shadowing 0.0 +} +element { + Shadowing 0.0 +} diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index 860c53b42..a1469c6ca 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml; import java.awt.Font; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -47,6 +48,8 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; @@ -96,10 +99,10 @@ public class SkinParam implements ISkinParam { if (type == UmlDiagramType.WBS) { USE_STYLE2.set(true); } -// if (type == UmlDiagramType.SEQUENCE) { -// // skin = "debug.skin"; -// USE_STYLE2.set(true); -// } + if (type == UmlDiagramType.SEQUENCE) { + // skin = "debug.skin"; + //USE_STYLE2.set(true); + } // if (type == UmlDiagramType.ACTIVITY) { // // skin = "debug.skin"; // USE_STYLE2.set(true); @@ -182,6 +185,20 @@ public class SkinParam implements ISkinParam { } } } + if ("style".equalsIgnoreCase(key) && "strictuml".equalsIgnoreCase(value)) { + if (USE_STYLES()) { + final InputStream internalIs = StyleLoader.class.getResourceAsStream("/skin/strictuml.skin"); + final StyleBuilder styleBuilder = this.getCurrentStyleBuilder(); + try { + final BlocLines lines = BlocLines.load(internalIs, null); + for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder)) { + this.muteStyle(modifiedStyle); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } } public static SkinParam create(UmlDiagramType type) { diff --git a/src/net/sourceforge/plantuml/SourceStringReader.java b/src/net/sourceforge/plantuml/SourceStringReader.java index a4c4d1cb6..145f99225 100644 --- a/src/net/sourceforge/plantuml/SourceStringReader.java +++ b/src/net/sourceforge/plantuml/SourceStringReader.java @@ -70,6 +70,10 @@ public class SourceStringReader { this(defines, source, "UTF-8", config); } + public SourceStringReader(Defines defines, String source) { + this(defines, source, "UTF-8", Collections. emptyList()); + } + public SourceStringReader(String source, File newCurrentDir) { this(Defines.createEmpty(), source, "UTF-8", Collections. emptyList(), newCurrentDir); } diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java index 3c3fec1c9..6d11bb5e5 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java @@ -112,6 +112,7 @@ public class CommandLinkLongActivity extends CommandMultilines2 RegexLeaf.end()); } + @Override protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) { lines = lines.trim(false); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java index 67b7288f0..76c8312a2 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivityLong3.java @@ -72,6 +72,7 @@ public class CommandActivityLong3 extends CommandMultilines2 { RegexLeaf.end()); } + @Override protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { lines = lines.removeEmptyColumns(); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java index 4cedf4c5a..d41d3690d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandArrowLong3.java @@ -71,6 +71,7 @@ public class CommandArrowLong3 extends CommandMultilines2 { RegexLeaf.end()); } + @Override protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { lines = lines.removeEmptyColumns(); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java index 7ec7f946c..967eba88c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandNoteLong3.java @@ -61,10 +61,12 @@ public class CommandNoteLong3 extends CommandMultilines2 { return ColorParser.simpleColor(ColorType.BACK); } + @Override public String getPatternEnd() { return "(?i)^end[%s]?note$"; } + @Override protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) { // final List in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1)); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index a49f90cda..8a45e1877 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -140,6 +140,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2 { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) { final String align = arg.get("POSITION", 0); - HorizontalAlignment defaultAlign = HorizontalAlignment.CENTER; - if (SkinParam.USE_STYLES()) { - defaultAlign = FontParam.FOOTER.getStyleDefinition() + HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); + if (SkinParam.USE_STYLES() && align == null) { + ha = FontParam.FOOTER.getStyleDefinition() .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } - diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), - HorizontalAlignment.fromString(align, defaultAlign)); + diagram.getFooter().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha); + + return CommandExecutionResult.ok(); } } diff --git a/src/net/sourceforge/plantuml/command/CommandHeader.java b/src/net/sourceforge/plantuml/command/CommandHeader.java index da2232dc8..43c1c951e 100644 --- a/src/net/sourceforge/plantuml/command/CommandHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandHeader.java @@ -73,14 +73,13 @@ public class CommandHeader extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) { final String align = arg.get("POSITION", 0); - HorizontalAlignment defaultAlign = HorizontalAlignment.RIGHT; - if (SkinParam.USE_STYLES()) { - defaultAlign = FontParam.HEADER.getStyleDefinition() + HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); + if (SkinParam.USE_STYLES() && align == null) { + ha = FontParam.HEADER.getStyleDefinition() .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } - diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), - HorizontalAlignment.fromString(align, defaultAlign)); + diagram.getHeader().putDisplay(Display.getWithNewlines(arg.get("LABEL", 0)), ha); return CommandExecutionResult.ok(); } } diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java index 2fedf5bc2..06e0c0863 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java @@ -65,13 +65,13 @@ public class CommandMultilinesFooter extends CommandMultilines { lines = lines.subExtract(1, 1); final Display strings = lines.toDisplay(); if (strings.size() > 0) { - HorizontalAlignment defaultAlign = HorizontalAlignment.CENTER; - if (SkinParam.USE_STYLES()) { - defaultAlign = FontParam.FOOTER.getStyleDefinition() + HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); + if (SkinParam.USE_STYLES() && align == null) { + ha = FontParam.FOOTER.getStyleDefinition() .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } - diagram.getFooter().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign)); + diagram.getFooter().putDisplay(strings, ha); return CommandExecutionResult.ok(); } return CommandExecutionResult.error("Empty footer"); diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java index 5b11944c1..8a196e9eb 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java @@ -65,13 +65,13 @@ public class CommandMultilinesHeader extends CommandMultilines { lines = lines.subExtract(1, 1); final Display strings = lines.toDisplay(); if (strings.size() > 0) { - HorizontalAlignment defaultAlign = HorizontalAlignment.RIGHT; - if (SkinParam.USE_STYLES()) { - defaultAlign = FontParam.HEADER.getStyleDefinition() + HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); + if (SkinParam.USE_STYLES() && align == null) { + ha = FontParam.HEADER.getStyleDefinition() .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } - diagram.getHeader().putDisplay(strings, HorizontalAlignment.fromString(align, defaultAlign)); + diagram.getHeader().putDisplay(strings, ha); return CommandExecutionResult.ok(); } return CommandExecutionResult.error("Empty header"); diff --git a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java index 2a1690da7..b3de396e1 100644 --- a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java +++ b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java @@ -225,7 +225,7 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory { } final protected void addCommonCommands2(List cmds) { - cmds.add(new CommandListSprite()); + // cmds.add(new CommandListSprite()); cmds.add(new CommandNope()); cmds.add(new CommandPragma()); diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java index 054b37b47..7cc83ce40 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java @@ -76,7 +76,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("POSITION", "(right|left)"), // + new RegexLeaf("POSITION", "(right|left|bottom|top)"), // RegexLeaf.spaceZeroOrMore(), // ColorParser.exp1(), // RegexLeaf.spaceZeroOrMore(), // @@ -90,7 +90,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // RegexLeaf.spaceOneOrMore(), // - new RegexLeaf("POSITION", "(right|left)"), // + new RegexLeaf("POSITION", "(right|left|bottom|top)"), // RegexLeaf.spaceZeroOrMore(), // ColorParser.exp1(), // RegexLeaf.spaceZeroOrMore(), // diff --git a/src/net/sourceforge/plantuml/creole/AbstractAtom.java b/src/net/sourceforge/plantuml/creole/AbstractAtom.java index b0cf83113..0abfe3f5c 100644 --- a/src/net/sourceforge/plantuml/creole/AbstractAtom.java +++ b/src/net/sourceforge/plantuml/creole/AbstractAtom.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.creole; +import java.util.Arrays; import java.util.List; import net.sourceforge.plantuml.graphic.StringBounder; @@ -42,7 +43,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; public abstract class AbstractAtom implements Atom { public List splitInTwo(StringBounder stringBounder, double width) { - throw new UnsupportedOperationException(getClass().toString()); + return Arrays.asList((Atom) this); } } diff --git a/src/net/sourceforge/plantuml/creole/AtomImg.java b/src/net/sourceforge/plantuml/creole/AtomImg.java index 1109c6184..29a164dec 100644 --- a/src/net/sourceforge/plantuml/creole/AtomImg.java +++ b/src/net/sourceforge/plantuml/creole/AtomImg.java @@ -45,6 +45,8 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; +import java.util.Arrays; +import java.util.List; import javax.imageio.ImageIO; @@ -69,7 +71,7 @@ public class AtomImg extends AbstractAtom implements Atom { private final BufferedImage image; private final double scale; private final Url url; - + private AtomImg(BufferedImage image, double scale, Url url) { this.image = image; this.scale = scale; diff --git a/src/net/sourceforge/plantuml/creole/AtomSprite.java b/src/net/sourceforge/plantuml/creole/AtomSprite.java index 0ebaab39c..7aa15b1a0 100644 --- a/src/net/sourceforge/plantuml/creole/AtomSprite.java +++ b/src/net/sourceforge/plantuml/creole/AtomSprite.java @@ -53,11 +53,6 @@ public class AtomSprite extends AbstractAtom implements Atom { private final Url url; private final HtmlColor color; - @Override - public List splitInTwo(StringBounder stringBounder, double width) { - return Arrays.asList((Atom) this); - } - public AtomSprite(HtmlColor newColor, double scale, FontConfiguration fontConfiguration, Sprite sprite, Url url) { this.scale = scale; this.sprite = sprite; diff --git a/src/net/sourceforge/plantuml/creole/AtomText.java b/src/net/sourceforge/plantuml/creole/AtomText.java index e3b085d30..e9c346d7c 100644 --- a/src/net/sourceforge/plantuml/creole/AtomText.java +++ b/src/net/sourceforge/plantuml/creole/AtomText.java @@ -90,6 +90,12 @@ public class AtomText extends AbstractAtom implements Atom { public static Atom create(String text, FontConfiguration fontConfiguration) { return new AtomText(text, fontConfiguration, null, ZERO, ZERO); } + +// public static AtomText createHeading(String text, FontConfiguration fontConfiguration, int order) { +// fontConfiguration = FOO(fontConfiguration, order); +// return new AtomText(text, fontConfiguration, null, ZERO, ZERO); +// } + public static Atom createUrl(Url url, FontConfiguration fontConfiguration, ISkinSimple skinSimple) { fontConfiguration = fontConfiguration.hyperlink(); @@ -149,19 +155,6 @@ public class AtomText extends AbstractAtom implements Atom { return new AtomHorizontalTexts(result); } - public static AtomText createHeading(String text, FontConfiguration fontConfiguration, int order) { - if (order == 0) { - fontConfiguration = fontConfiguration.bigger(4).bold(); - } else if (order == 1) { - fontConfiguration = fontConfiguration.bigger(2).bold(); - } else if (order == 2) { - fontConfiguration = fontConfiguration.bigger(1).bold(); - } else { - fontConfiguration = fontConfiguration.italic(); - } - return new AtomText(text, fontConfiguration, null, ZERO, ZERO); - } - public static Atom createListNumber(final FontConfiguration fontConfiguration, final int order, int localNumber) { final DelayedDouble left = new DelayedDouble() { public double getDouble(StringBounder stringBounder) { diff --git a/src/net/sourceforge/plantuml/creole/AtomTree.java b/src/net/sourceforge/plantuml/creole/AtomTree.java index b0b924398..17c5fbf82 100644 --- a/src/net/sourceforge/plantuml/creole/AtomTree.java +++ b/src/net/sourceforge/plantuml/creole/AtomTree.java @@ -57,12 +57,6 @@ public class AtomTree extends AbstractAtom implements Atom { private final Map levels = new HashMap(); private final double margin = 2; - @Override - public List splitInTwo(StringBounder stringBounder, double width) { - return Arrays.asList((Atom) this); - } - - public AtomTree(HtmlColor lineColor) { this.lineColor = lineColor; } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java b/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java index 973304f88..6d2d3bde8 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleUrl.java @@ -74,14 +74,6 @@ public class CommandCreoleUrl implements Command { final UrlBuilder urlBuilder = new UrlBuilder(skinParam.getValue("topurl"), ModeUrl.STRICT); final Url url = urlBuilder.getUrl(m.group(1)); stripe.addUrl(url); - -// final int size = Integer.parseInt(m.group(2)); -// final FontConfiguration fc1 = stripe.getActualFontConfiguration(); -// final FontConfiguration fc2 = fc1.changeSize(size); -// // final FontConfiguration fc2 = new AddStyle(style, null).apply(fc1); -// stripe.setActualFontConfiguration(fc2); - // stripe.analyzeAndAdd("AZERTY"); -// stripe.setActualFontConfiguration(fc1); return line.substring(m.group(1).length()); } } diff --git a/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java b/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java index 307cf97d5..a5a5b0801 100644 --- a/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java +++ b/src/net/sourceforge/plantuml/creole/CreoleHorizontalLine.java @@ -59,11 +59,6 @@ public class CreoleHorizontalLine extends AbstractAtom implements Atom { private final char style; private final ISkinSimple skinParam; - @Override - public List splitInTwo(StringBounder stringBounder, double width) { - return Arrays.asList((Atom) this); - } - public static CreoleHorizontalLine create(FontConfiguration fontConfiguration, String line, char style, ISkinSimple skinParam) { return new CreoleHorizontalLine(fontConfiguration, line, style, skinParam); diff --git a/src/net/sourceforge/plantuml/creole/StripeSimple.java b/src/net/sourceforge/plantuml/creole/StripeSimple.java index 15a26ab6a..00f0fb43e 100644 --- a/src/net/sourceforge/plantuml/creole/StripeSimple.java +++ b/src/net/sourceforge/plantuml/creole/StripeSimple.java @@ -164,7 +164,8 @@ public class StripeSimple implements Stripe { } line = CharHidder.hide(line); if (style.getType() == StripeStyleType.HEADING) { - atoms.add(AtomText.createHeading(line, fontConfiguration, style.getOrder())); + fontConfiguration = fontConfigurationForHeading(fontConfiguration, style.getOrder()); + modifyStripe(line); } else if (style.getType() == StripeStyleType.HORIZONTAL_LINE) { atoms.add(CreoleHorizontalLine.create(fontConfiguration, line, style.getStyle(), skinParam)); } else { @@ -172,6 +173,19 @@ public class StripeSimple implements Stripe { } } + private static FontConfiguration fontConfigurationForHeading(FontConfiguration fontConfiguration, int order) { + if (order == 0) { + fontConfiguration = fontConfiguration.bigger(4).bold(); + } else if (order == 1) { + fontConfiguration = fontConfiguration.bigger(2).bold(); + } else if (order == 2) { + fontConfiguration = fontConfiguration.bigger(1).bold(); + } else { + fontConfiguration = fontConfiguration.italic(); + } + return fontConfiguration; + } + public void addImage(String src, double scale) { atoms.add(AtomImg.create(src, ImgValign.TOP, 0, scale, null)); } diff --git a/src/net/sourceforge/plantuml/creole/StripeTree.java b/src/net/sourceforge/plantuml/creole/StripeTree.java index c2ed7de74..c95572082 100644 --- a/src/net/sourceforge/plantuml/creole/StripeTree.java +++ b/src/net/sourceforge/plantuml/creole/StripeTree.java @@ -60,7 +60,7 @@ public class StripeTree implements Stripe { public List getAtoms() { return Collections. singletonList(marged); } - + public Atom getHeader() { return null; } @@ -70,13 +70,29 @@ public class StripeTree implements Stripe { for (String s : lines) { final StripeSimple cell = new StripeSimple(fontConfiguration, stripeStyle, new CreoleContext(), skinParam, CreoleMode.FULL); - // EMTEC final String text = s.replaceFirst("^\\s*\\|_", ""); - final int level = (s.length() - text.length()) / 2; + final int level = computeLevel(s); cell.analyzeAndAdd(text); this.tree.addCell(StripeTable.asAtom(Collections.singletonList(cell), 0), level); } } + private int computeLevel(String s) { + int result = 1; + while (s.length() > 0) { + if (s.startsWith(" ")) { + result++; + s = s.substring(2); + continue; + } else if (s.startsWith("\t")) { + result++; + s = s.substring(1); + continue; + } + return result; + } + return result; + } + } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java b/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java index a3a901637..bf68ed540 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/DotData.java @@ -148,6 +148,10 @@ final public class DotData implements PortionShower { return entityFactory.getRootGroup(); } + public boolean isDegeneratedWithFewEntities(int nb) { + return entityFactory.getGroupsvalues().size() == 0 && getLinks().size() == 0 && getLeafs().size() == nb; + } + public final boolean isHideEmptyDescriptionForState() { return isHideEmptyDescriptionForState; } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java index 999eeb377..bfcfc1a76 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java @@ -364,8 +364,9 @@ public class CommandLinkElement extends SingleLineCommand2 { queue = getQueue(arg); } - Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(arg.get("LABEL_LINK", 0)), queue.length(), - diagram.getSkinParam().getCurrentStyleBuilder()); + final Labels labels = new Labels(arg); + Link link = new Link(cl1, cl2, linkType, Display.getWithNewlines(labels.labelLink), queue.length(), diagram + .getSkinParam().getCurrentStyleBuilder()); if (dir == Direction.LEFT || dir == Direction.UP) { link = link.getInv(); } diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index 9b0c412e3..6a85fff67 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -71,23 +71,23 @@ public class PSystemDonors extends AbstractPSystem { private static final int COLS = 6; private static final int FREE_LINES = 6; - public static final String DONORS = "6ty902mFR3fSuLzO9ciEU-UTVLaMenKn_Poll0GDwsu450sG0Q8aQloSnDhywO_J0H90rz3HOsxVwN6_" - + "aVuYkjAzRveHRVcs-MeT28Jb1yTZxQt2wPrlgWmfGKmLss-PqDxVVbneGbeh65VWfd92vl-cq-9uA8HP" - + "cgrmFXgXChPaZuwvpzsFeYvKNLo2gc-56jEfn35S5JQ6wpFKDHonwDhLyQWe6HGZh28bKJUE8C4TDngr" - + "KJd19r8B_r4BQDAQJKFIAQ1OHefOyxRC-UC0zJTXu4GGKpeS8CAXf2DuWJ54VI618AeODMgZw8pDLCzv" - + "ueE955JOWN_af7fl8TkZ31q8OhAXGC9F40HWpzLGuhEvsO3IBRp5l0QRTMfPoMZtDrDIQguqF00wOY9e" - + "1Ln1o9kW2tuVRUOIPngxei0RdiHubTi7kSZs0DXU3EZRMHC3vGizEVEKPKPrQo6TKwvp_EfiaEyQChEt" - + "cr75E8k9cD_cKXY-k03xcw2NMaF5-9lpp48sXCUKkf2Tv_Bbt8b0M6KfMUGgbgIc_hIBAMrTpFUcBEBT" - + "-tLgADimWbTJv80-gfNsXiuNYgk6-kSXZxgEJ-5hqXRYNQBlJiojuk_jRWapJbVGzIPyg6w0A3Lwucgk" - + "M5GHk8FesP27WDo1wilaLdbPFYIkvmDIRqiu49aDOYDnpRRYa8j5c0TMTgMA0S0MBj6kt_gTf5zvTK8V" - + "WfLHP8IxVhj9zx1vDioDNYj0Gur1UKDdonSPgxaW3ZDCownPFT1-n564otYGl7hUCxkk0bYJUMzRR8sd" - + "Cx2kOSumITCH-JZIbcGSwYWzYxFDcxh4gxcTx3nqEpXFRz49Piuswo5J8FUeUMcfMunxrs38crDPnQxb" - + "ehq4-kfcFL32Cpu5t6wS3Ada4eAeuKn7I4n09BNEApPOulekgdevEPwQbZ1hjzL1eDhv4Ni3GLMm4suW" - + "plfUusT4YMBdxVDUcNLNtuUKM1TG8GO48wbGjX5ILCBcL3AizrRFyUZWjL_QT46_ZM-MB0aKtW4HQhv1" - + "qYdC8q_mHirPefHJgv8lUqoCWEzn-GtsnAuES_oEbbOUPv0RWfGxfO3abs15Isst9bXlqVksRNjRDlxy" - + "tskod5Cprx7o0Bg0k02rUH4xKHVrF2d_TT0ddUCMCWD6dHpxoXjJhmSO28fcsUvLUp-ZVhcKbzjLEtsK" - + "zKEb_qCgGJ2M5oox6AMeZ3ObM6rxgniLYttxZR2NG-FycwYoAJ-uobIhPqHIiSkTEC_ZjOrK8efAESo0" - + "jXE2mDblV9P2uoMZZIjWjSC5HJwVPfV3evcMs12Kbf7rm2_T0000"; + public static final String DONORS = "6uq902mFw6aNBnoRoJQNUtErFonYo206_-9C-IFeunriW0n1BL5IhOvS7xq622gWQ-ZeCRVlzBZVI7yH" + + "NUdUDys8jcnDSPvH50k27c-JQuPjxkqnSsBnGt1dZe133yW3iacsZHfPkfVj92sddof3IY7pywS6s9OA" + + "ihYRQXukK7S6TknnUzX_ePwbHp_sKxhZEw0nZHBhiAEQb5SFVAsgP8B2sM_7DwrYLapW42cEjd043jcO" + + "YNnrMiUu85NxZte3BJPcM2foJoYssYMf-UVP-hQ1xXCOJ2AmYG4RC7Eew32UO2vGRyGGM4MYYUpiZCQ6" + + "QsvveeC95zInXd-KHKsFLEOSZau4Dg-40Ww_XXE0hIYlmcVxDWCAHNgBkYN9EZMUX9N6XoKfhXyqt006" + + "R2ne7QY2a3T19_nfCVjJatjT3GLUzEpClTaPo4Ms0y3nPaRVPDsPAF_t3yuqiMsfbaXrBlrvhlTn3iZT" + + "Kgj6_37QM6LBtDQJ5nLQUN81_4FGIxsZOdxETMCX6UAvT7iYpdFgojSe0cR5OMJXJx4bDUxIBazZVLcU" + + "eIp1Z_RhL2EPq89N8bu6_QfMA0zqlb2oBArSFlHeMBqCV4t8JBmjkcV7NCh_lrAymupI5RJVnPogQo1A" + + "dh5pLUjigWXC8texv2QGAr3jhbknU_-G_vmFIBqbaO78RCvnlrIig3LT334RrdIwn0nWyfHe9mAxaqGY" + + "faReNR2oZ4mhnQw7g-VqYJ5nxVJ2uxwfCOWFTBBo9EpfHR1cXY79chaDxGUSWt06NvnNN_VXFLO1hBjv" + + "Zxr9pHzd85tfXP4aRKQKszRzgR1c1QLdKPPyM96_U_4p5mzT2bvdikW8Cwysno5ZeNZPf9N-PFJ3aY5l" + + "dygo_aeLUGFkbug5G9XdV0nuF3XPKCKb15RJMGuJ6u1mweDNx3SlSJEekgNav18snAp3LkU1IkU7UGT6" + + "bN7WcOCTtRt4pz0IHSx7vxso-cbbhIfsBA1uLWYMKaVPQweeqkTKCcICGSzXQ-3jDmjT42xrsXkc1Gfl" + + "W-Y-V0EjKyYq4kC7JPybqeLyHRxaiJ02_iwltsGlEDP1nhyPtOV7cUUA8AKgEi0vSRRKQbjQ1-ij-lpv" + + "ifoy1t_-xpLjvrI8vtoM0Bg0WlQlfS2SQDRLF7liJwEF3kmsiW9Y7PpqbLUcNWWm40oQPQcNrcb6uSuO" + + "Ncwg1dt6yQ52No4L9uZZ3SikbYcA6bFEykLanQYys9VU22SvU5x_55M6KbnbkPeOeLNi_2ZEqtWVjHjk" + + "TUa24j0T5mJAVlExtIntZJvVW7qO7b3avoDvwB25QK4Lfx4yDJ15OtrlnjjJPwP-4m00"; /* * Special thanks to our sponsors and donors: diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java index caf40f4ac..ecf33d871 100644 --- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java +++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java @@ -325,7 +325,8 @@ public class QuoteUtils { "Fvapr gurer'f ab pbapyhfvba gb gur cnenqbk gurbel, gurer'f ab jnl gb cebir gurer'f ab cnenqbk.", "Gnxr zr guebhtu gur qnexarff gb gur oernx bs gur qnl", "Vg znxrf gur gehgu rira zber vapbzcerurafvoyr orpnhfr rirelguvat vf arj", - "V qba'g xabj ubj ohg V fhqqrayl ybfr pbageby", "Gurer ner zbzragf jura V guvax V'z tbvat penml"); + "V qba'g xabj ubj ohg V fhqqrayl ybfr pbageby", "Gurer ner zbzragf jura V guvax V'z tbvat penml", + "Jbhyq gung vg jrer fb fvzcyr", "Pnyy gung n xavsr? Guvf vf n xavsr."); private QuoteUtils() { } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeft.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeft.java index f819d69a8..c50ee64b6 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeft.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeft.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapLeft extends SingleLineCommand2 { @@ -62,7 +63,7 @@ public class CommandMindMapLeft extends SingleLineCommand2 { protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.LEFT); + return diagram.addIdea(null, type.length() - 1, Display.getWithNewlines(label), IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.LEFT); } } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeftNumber.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeftNumber.java index f3ebf1f9a..7483a6c29 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeftNumber.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapLeftNumber.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapLeftNumber extends SingleLineCommand2 { @@ -61,7 +62,7 @@ public class CommandMindMapLeftNumber extends SingleLineCommand2 @Override protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, Integer.parseInt(arg.get("TYPE", 0)), label, + return diagram.addIdea(null, Integer.parseInt(arg.get("TYPE", 0)), Display.getWithNewlines(label), IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.LEFT); } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java index 883971d69..0b10a0527 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOptional; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; public class CommandMindMapOrgmode extends SingleLineCommand2 { @@ -69,7 +70,8 @@ public class CommandMindMapOrgmode extends SingleLineCommand2 { if (stringColor != null) { backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(stringColor); } - return diagram.addIdea(backColor, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0))); + return diagram.addIdea(backColor, type.length() - 1, Display.getWithNewlines(label), + IdeaShape.fromDesc(arg.get("SHAPE", 0))); } } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java new file mode 100644 index 000000000..b0df57678 --- /dev/null +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java @@ -0,0 +1,86 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://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.mindmap; + +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.CommandMultilines2; +import net.sourceforge.plantuml.command.MultilinesStrategy; +import net.sourceforge.plantuml.command.regex.IRegex; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOptional; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.graphic.HtmlColor; + +public class CommandMindMapOrgmodeMultiline extends CommandMultilines2 { + + public CommandMindMapOrgmodeMultiline() { + super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE); + } + + static IRegex getRegexConcat() { + return RegexConcat.build(CommandMindMapOrgmodeMultiline.class.getName(), RegexLeaf.start(), // + new RegexLeaf("TYPE", "([*]+)"), // + new RegexOptional(new RegexLeaf("BACKCOLOR", "\\[(#\\w+)\\]")), // + new RegexLeaf("SHAPE", "(_)?"), // + new RegexLeaf(":"), // + new RegexLeaf("DATA", "(.*)"), // + RegexLeaf.end()); + } + + @Override + public String getPatternEnd() { + return "^(.*);$"; + } + + @Override + protected CommandExecutionResult executeNow(MindMapDiagram diagram, BlocLines lines) { + final RegexResult line0 = getStartingPattern().matcher(lines.getFirst499().getTrimmed().getString()); + final String type = line0.get("TYPE", 0); + final String stringColor = line0.get("BACKCOLOR", 0); + HtmlColor backColor = null; + if (stringColor != null) { + backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(stringColor); + } + lines = lines.removeStartingAndEnding2(line0.get("DATA", 0)); + + return diagram.addIdea(backColor, type.length() - 1, lines.toDisplay(), + IdeaShape.fromDesc(line0.get("SHAPE", 0))); + } + +} diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java index 0f3ab4a74..df5275f89 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapPlus.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapPlus extends SingleLineCommand2 { @@ -63,7 +64,8 @@ public class CommandMindMapPlus extends SingleLineCommand2 { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); final Direction direction = type.contains("-") ? Direction.LEFT : Direction.RIGHT; - return diagram.addIdea(null, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), direction); + return diagram.addIdea(null, type.length() - 1, Display.getWithNewlines(label), + IdeaShape.fromDesc(arg.get("SHAPE", 0)), direction); } } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapRight.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapRight.java index bee990044..6c1cd743b 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapRight.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapRight.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapRight extends SingleLineCommand2 { @@ -62,8 +63,8 @@ public class CommandMindMapRight extends SingleLineCommand2 { protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); - return diagram - .addIdea(null, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.RIGHT); + return diagram.addIdea(null, type.length() - 1, Display.getWithNewlines(label), + IdeaShape.fromDesc(arg.get("SHAPE", 0)), Direction.RIGHT); } } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapRightNumber.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapRightNumber.java index a8df4db90..33505ff10 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapRightNumber.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapRightNumber.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapRightNumber extends SingleLineCommand2 { @@ -61,7 +62,7 @@ public class CommandMindMapRightNumber extends SingleLineCommand2 { @@ -59,7 +60,7 @@ public class CommandMindMapRoot extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, 0, label, IdeaShape.BOX, null); + return diagram.addIdea(null, 0, Display.getWithNewlines(label), IdeaShape.BOX, null); } } diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapTabulation.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapTabulation.java index 1fa6a5ef2..75562509d 100644 --- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapTabulation.java +++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapTabulation.java @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; public class CommandMindMapTabulation extends SingleLineCommand2 { @@ -61,7 +62,8 @@ public class CommandMindMapTabulation extends SingleLineCommand2 protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); - return diagram.addIdea(null, type.length() - 1, label, IdeaShape.fromDesc(arg.get("SHAPE", 0))); + return diagram.addIdea(null, type.length() - 1, Display.getWithNewlines(label), + IdeaShape.fromDesc(arg.get("SHAPE", 0))); } } diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java index e7859dc14..ed6df8804 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagram.java @@ -175,16 +175,16 @@ public class MindMapDiagram extends UmlDiagram { } } - public CommandExecutionResult addIdea(HtmlColor backColor, int level, String label, IdeaShape shape) { + public CommandExecutionResult addIdea(HtmlColor backColor, int level, Display label, IdeaShape shape) { return addIdea(backColor, level, label, shape, defaultDirection); } - public CommandExecutionResult addIdea(HtmlColor backColor, int level, String label, IdeaShape shape, + public CommandExecutionResult addIdea(HtmlColor backColor, int level, Display label, IdeaShape shape, Direction direction) { - final Matcher2 m = WBSDiagram.patternStereotype.matcher(label); + final Matcher2 m = WBSDiagram.patternStereotype.matcher(label.get(0)); String stereotype = null; if (m.matches()) { - label = m.group(1); + label = Display.getWithNewlines(m.group(1)); stereotype = m.group(2); } if (level == 0) { @@ -207,8 +207,8 @@ public class MindMapDiagram extends UmlDiagram { private Idea last; private Finger finger; - private void initRoot(StyleBuilder styleBuilder, String label, IdeaShape shape, String stereotype) { - root = new Idea(styleBuilder, Display.getWithNewlines(label), shape, stereotype); + private void initRoot(StyleBuilder styleBuilder, Display label, IdeaShape shape, String stereotype) { + root = new Idea(styleBuilder, label, shape, stereotype); last = root; } @@ -220,21 +220,20 @@ public class MindMapDiagram extends UmlDiagram { return result; } - private CommandExecutionResult add(StyleBuilder styleBuilder, HtmlColor backColor, int level, String label, + private CommandExecutionResult add(StyleBuilder styleBuilder, HtmlColor backColor, int level, Display label, IdeaShape shape, String stereotype) { if (last == null) { return CommandExecutionResult.error("Check your indentation ?"); } if (level == last.getLevel() + 1) { - final Idea newIdea = last.createIdea(styleBuilder, backColor, level, Display.getWithNewlines(label), - shape, stereotype); + final Idea newIdea = last.createIdea(styleBuilder, backColor, level, label, shape, stereotype); last = newIdea; return CommandExecutionResult.ok(); } if (level <= last.getLevel()) { final int diff = last.getLevel() - level + 1; - final Idea newIdea = getParentOfLast(diff).createIdea(styleBuilder, backColor, level, - Display.getWithNewlines(label), shape, stereotype); + final Idea newIdea = getParentOfLast(diff).createIdea(styleBuilder, backColor, level, label, shape, + stereotype); last = newIdea; return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java b/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java index e99ac6483..90ccea6bd 100644 --- a/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java +++ b/src/net/sourceforge/plantuml/mindmap/MindMapDiagramFactory.java @@ -55,6 +55,7 @@ public class MindMapDiagramFactory extends UmlDiagramFactory { addCommonCommands1(cmds); cmds.add(new CommandMindMapTabulation()); cmds.add(new CommandMindMapOrgmode()); + cmds.add(new CommandMindMapOrgmodeMultiline()); cmds.add(new CommandMindMapRoot()); cmds.add(new CommandMindMapPlus()); cmds.add(new CommandMindMapDirection()); diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java index cbab983c0..7bc69b746 100644 --- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java +++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObjectMultilines.java @@ -83,6 +83,7 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2 init) { + final Defines result = createEmpty(); + for (Map.Entry ent : init.entrySet()) { + result.environment.put(ent.getKey(), ent.getValue()); + } + return result; + } + public String getEnvironmentValue(String key) { return this.environment.get(key); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java b/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java index 4a9f5dfe4..748a5f545 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java +++ b/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java @@ -44,6 +44,7 @@ import java.util.Set; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.skin.ArrowConfiguration; +import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; @@ -53,12 +54,15 @@ import net.sourceforge.plantuml.style.WithStyle; public abstract class AbstractMessage implements EventWithDeactivate, WithStyle { public Style[] getUsedStyles() { - return new Style[] { getDefaultStyleDefinition().getMergedStyle(styleBuilder) }; + Style style = getDefaultStyleDefinition().getMergedStyle(styleBuilder); + if (style != null && arrowConfiguration.getColor() != null) { + style = style.eventuallyOverride(PName.LineColor, arrowConfiguration.getColor()); + } + return new Style[] { style }; } public StyleSignature getDefaultStyleDefinition() { - return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, - SName.arrow); + return StyleSignature.of(SName.root, SName.element, SName.sequenceDiagram, SName.arrow); } private final Display label; @@ -181,7 +185,8 @@ public abstract class AbstractMessage implements EventWithDeactivate, WithStyle } public final void setNote(Note note) { - if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT) { + if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT + && note.getPosition() != NotePosition.BOTTOM && note.getPosition() != NotePosition.TOP) { throw new IllegalArgumentException(); } note = note.withPosition(overideNotePosition(note.getPosition())); diff --git a/src/net/sourceforge/plantuml/sequencediagram/Note.java b/src/net/sourceforge/plantuml/sequencediagram/Note.java index 0b29e01b4..87f4cd6f4 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Note.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Note.java @@ -49,14 +49,21 @@ import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.WithStyle; -public class Note extends AbstractEvent implements Event, SpecificBackcolorable, WithStyle { +final public class Note extends AbstractEvent implements Event, SpecificBackcolorable, WithStyle { private final Participant p; private final Participant p2; private final Display strings; - private final NotePosition position; + private/* final */NotePosition position; + + public void temporaryProtectedUntilTeozIsStandard() { + if (position == NotePosition.BOTTOM || position == NotePosition.TOP) { + position = NotePosition.LEFT; + } + } + private final StyleBuilder styleBuilder; private NoteStyle noteStyle = NoteStyle.NORMAL; private Colors colors = Colors.empty(); @@ -186,14 +193,4 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable, return parallel; } -// public Style[] applyStyle2(Style[] usedStyles) { -// if (usedStyles.length != 1) { -// throw new IllegalArgumentException(); -// } -// Style tmp = usedStyles[0]; -// if (tmp != null) { -// tmp = tmp.eventuallyOverride(colors); -// } -// return new Style[] { tmp }; -// } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/NotePosition.java b/src/net/sourceforge/plantuml/sequencediagram/NotePosition.java index 7ffaf4b4c..9b9dcfc92 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/NotePosition.java +++ b/src/net/sourceforge/plantuml/sequencediagram/NotePosition.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.sequencediagram; import net.sourceforge.plantuml.StringUtils; public enum NotePosition { - LEFT, RIGHT, OVER, OVER_SEVERAL; + LEFT, RIGHT, OVER, OVER_SEVERAL, BOTTOM, TOP; public static NotePosition defaultLeft(String s) { if (s == null) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java index bc34be0a6..0f59f7faf 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/Step1Message.java @@ -177,6 +177,7 @@ class Step1Message extends Step1Abstract { for (int i = 0; i < getNotes().size(); i++) { final Component note = getNotes().get(i); final Note noteOnMessage = getMessage().getNoteOnMessages().get(i); + noteOnMessage.temporaryProtectedUntilTeozIsStandard(); noteBoxes.add(createNoteBox(getStringBounder(), messageSelfArrow, note, noteOnMessage)); } return new ArrowAndNoteBox(getStringBounder(), messageSelfArrow, noteBoxes); @@ -185,6 +186,7 @@ class Step1Message extends Step1Abstract { for (int i = 0; i < getNotes().size(); i++) { final Component note = getNotes().get(i); final Note noteOnMessage = getMessage().getNoteOnMessages().get(i); + noteOnMessage.temporaryProtectedUntilTeozIsStandard(); noteBoxes.add(createNoteBox(getStringBounder(), messageArrow, note, noteOnMessage)); } return new ArrowAndNoteBox(getStringBounder(), messageArrow, noteBoxes); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java new file mode 100644 index 000000000..564e87193 --- /dev/null +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java @@ -0,0 +1,156 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://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.sequencediagram.teoz; + +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.real.Real; +import net.sourceforge.plantuml.sequencediagram.AbstractMessage; +import net.sourceforge.plantuml.sequencediagram.Event; +import net.sourceforge.plantuml.sequencediagram.Note; +import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.Component; +import net.sourceforge.plantuml.skin.ComponentType; +import net.sourceforge.plantuml.skin.Context2D; +import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.UTranslate; + +public class CommunicationTileNoteBottom extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY { + + private final TileWithUpdateStairs tile; + private final AbstractMessage message; + private final Rose skin; + private final ISkinParam skinParam; + private final Note noteOnMessage; + + public Event getEvent() { + return message; + } + + @Override + public double getYPoint(StringBounder stringBounder) { + return tile.getYPoint(stringBounder); + } + + public CommunicationTileNoteBottom(TileWithUpdateStairs tile, AbstractMessage message, Rose skin, + ISkinParam skinParam, Note noteOnMessage) { + this.tile = tile; + this.message = message; + this.skin = skin; + this.skinParam = skinParam; + this.noteOnMessage = noteOnMessage; + } + + public void updateStairs(StringBounder stringBounder, double y) { + tile.updateStairs(stringBounder, y); + } + + private Component getComponent(StringBounder stringBounder) { + final Component comp = skin.createComponent(noteOnMessage.getUsedStyles(), ComponentType.NOTE, null, + noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings()); + return comp; + } + + private Real getNotePosition(StringBounder stringBounder) { + final Real minX = tile.getMinX(stringBounder); + return minX; + } + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + final Area area = new Area(dim.getWidth(), dim.getHeight()); + tile.drawU(ug); + + final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder).getCurrentValue()) / 2; + + final double xNote = getNotePosition(stringBounder).getCurrentValue(); + final double yNote = tile.getPreferredHeight(stringBounder); + + comp.drawU(ug.apply(new UTranslate(xNote, yNote + spacey)), area, (Context2D) ug); + + drawLine(ug, middleMsg, tile.getYPoint(stringBounder), xNote + dim.getWidth() / 2, yNote + spacey + + Rose.paddingY); + + } + + private final double spacey = 10; + + private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2) { + final HtmlColor color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); + + final double dx = x2 - x1; + final double dy = y2 - y1; + + ug.apply(new UTranslate(x1, y1)).apply(new UChangeColor(color)).apply(new UStroke(2, 2, 1)) + .draw(new ULine(dx, dy)); + + } + + public double getPreferredHeight(StringBounder stringBounder) { + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + return tile.getPreferredHeight(stringBounder) + dim.getHeight() + spacey; + } + + public void addConstraints(StringBounder stringBounder) { + tile.addConstraints(stringBounder); + } + + public Real getMinX(StringBounder stringBounder) { + return tile.getMinX(stringBounder); + } + + public Real getMaxX(StringBounder stringBounder) { + return tile.getMaxX(stringBounder); + } + + public void callbackY(double y) { + if (tile instanceof TileWithCallbackY) { + ((TileWithCallbackY) tile).callbackY(y); + } + } + +} diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java new file mode 100644 index 000000000..fe55a2e7a --- /dev/null +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java @@ -0,0 +1,157 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://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.sequencediagram.teoz; + +import java.awt.geom.Dimension2D; + +import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.real.Real; +import net.sourceforge.plantuml.sequencediagram.AbstractMessage; +import net.sourceforge.plantuml.sequencediagram.Event; +import net.sourceforge.plantuml.sequencediagram.Note; +import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.Component; +import net.sourceforge.plantuml.skin.ComponentType; +import net.sourceforge.plantuml.skin.Context2D; +import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.ugraphic.UChangeColor; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.ULine; +import net.sourceforge.plantuml.ugraphic.UStroke; +import net.sourceforge.plantuml.ugraphic.UTranslate; + +public class CommunicationTileNoteTop extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY { + + private final TileWithUpdateStairs tile; + private final AbstractMessage message; + private final Rose skin; + private final ISkinParam skinParam; + private final Note noteOnMessage; + + public Event getEvent() { + return message; + } + + @Override + public double getYPoint(StringBounder stringBounder) { + return tile.getYPoint(stringBounder); + } + + public CommunicationTileNoteTop(TileWithUpdateStairs tile, AbstractMessage message, Rose skin, + ISkinParam skinParam, Note noteOnMessage) { + this.tile = tile; + this.message = message; + this.skin = skin; + this.skinParam = skinParam; + this.noteOnMessage = noteOnMessage; + } + + public void updateStairs(StringBounder stringBounder, double y) { + tile.updateStairs(stringBounder, y); + } + + private Component getComponent(StringBounder stringBounder) { + final Component comp = skin.createComponent(noteOnMessage.getUsedStyles(), ComponentType.NOTE, null, + noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings()); + return comp; + } + + private Real getNotePosition(StringBounder stringBounder) { + final Real minX = tile.getMinX(stringBounder); + return minX; + } + + public void drawU(UGraphic ug) { + final StringBounder stringBounder = ug.getStringBounder(); + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + final Area area = new Area(dim.getWidth(), dim.getHeight()); + + tile.drawU(ug.apply(new UTranslate(0, dim.getHeight() + spacey))); + + final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder) + .getCurrentValue()) / 2; + + final double xNote = getNotePosition(stringBounder).getCurrentValue(); + + comp.drawU(ug.apply(new UTranslate(xNote, 0)), area, (Context2D) ug); + + drawLine(ug, middleMsg, tile.getYPoint(stringBounder) + dim.getHeight() + spacey, xNote + dim.getWidth() / 2, + dim.getHeight() - 2 * Rose.paddingY); + + } + + private final double spacey = 10; + + private void drawLine(UGraphic ug, double x1, double y1, double x2, double y2) { + final HtmlColor color = new Rose().getHtmlColor(skinParam, ColorParam.arrow); + + final double dx = x2 - x1; + final double dy = y2 - y1; + + ug.apply(new UTranslate(x1, y1)).apply(new UChangeColor(color)).apply(new UStroke(2, 2, 1)) + .draw(new ULine(dx, dy)); + + } + + public double getPreferredHeight(StringBounder stringBounder) { + final Component comp = getComponent(stringBounder); + final Dimension2D dim = comp.getPreferredDimension(stringBounder); + return tile.getPreferredHeight(stringBounder) + dim.getHeight() + spacey; + } + + public void addConstraints(StringBounder stringBounder) { + tile.addConstraints(stringBounder); + } + + public Real getMinX(StringBounder stringBounder) { + return tile.getMinX(stringBounder); + } + + public Real getMaxX(StringBounder stringBounder) { + return tile.getMaxX(stringBounder); + } + + public void callbackY(double y) { + if (tile instanceof TileWithCallbackY) { + ((TileWithCallbackY) tile).callbackY(y); + } + } + +} diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java index 2d7106420..8f6866133 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java @@ -58,7 +58,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class LiveBoxesDrawer { private double y1; - private SymbolContext color; + private SymbolContext symbolContext; private final Component cross; private final Context2D context; @@ -86,9 +86,9 @@ public class LiveBoxesDrawer { return compForWidth.getPreferredWidth(stringBounder); } - public void addStart(double y1, SymbolContext color) { + public void addStart(double y1, SymbolContext symbolContext) { this.y1 = y1; - this.color = color; + this.symbolContext = symbolContext; } public void doDrawing(UGraphic ug, StairsPosition yposition) { @@ -121,10 +121,13 @@ public class LiveBoxesDrawer { private void drawInternal(UGraphic ug, StairsPosition yposition, double ya, double yb, ComponentType type) { final double width = getWidth(ug.getStringBounder()); final Area area = new Area(width, yb - ya); - final ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, color == null ? null : color.getBackColor()); - final Component comp = skin.createComponent( - new Style[] { type.getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()) }, - type, null, skinParam2, null); + ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, symbolContext == null ? null + : symbolContext.getBackColor()); + Style style = type.getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); + if (style != null) { + style = style.eventuallyOverride(symbolContext); + } + final Component comp = skin.createComponent(new Style[] { style }, type, null, skinParam2, null); comp.drawU(ug.apply(new UTranslate(-width / 2, ya)), area, context); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java index f2266b85d..4c703a64b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java @@ -107,6 +107,12 @@ public class TileBuilder { } else if (notePosition == NotePosition.RIGHT) { result = new CommunicationTileNoteRight((TileWithUpdateStairs) result, msg, skin, skinParam, reverse ? livingSpace1 : livingSpace2, noteOnMessage); + } else if (notePosition == NotePosition.BOTTOM) { + result = new CommunicationTileNoteBottom((TileWithUpdateStairs) result, msg, skin, skinParam, + noteOnMessage); + } else if (notePosition == NotePosition.TOP) { + result = new CommunicationTileNoteTop((TileWithUpdateStairs) result, msg, skin, skinParam, + noteOnMessage); } } tiles.add(result); diff --git a/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/net/sourceforge/plantuml/skin/rose/Rose.java index 55d712b6b..c56eb9bca 100644 --- a/src/net/sourceforge/plantuml/skin/rose/Rose.java +++ b/src/net/sourceforge/plantuml/skin/rose/Rose.java @@ -66,7 +66,7 @@ import net.sourceforge.plantuml.ugraphic.UStroke; public class Rose { final private double paddingX = 5; - final private double paddingY = 5; + final public static double paddingY = 5; public HtmlColor getFontColor(ISkinParam skin, FontParam fontParam) { return skin.getFontHtmlColor(null, fontParam); @@ -321,7 +321,22 @@ public class Rose { final String value = textStyle.value(PName.HorizontalAlignment).asString(); messageHorizontalAlignment = textStyle.getHorizontalAlignment(); textHorizontalAlignment = textStyle.getHorizontalAlignment(); - if ("direction".equalsIgnoreCase(value)) { + if ("first".equalsIgnoreCase(value)) { + final boolean isReverseDefine = config.isReverseDefine(); + if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { + if (isReverseDefine) { + messageHorizontalAlignment = HorizontalAlignment.LEFT; + } else { + messageHorizontalAlignment = HorizontalAlignment.RIGHT; + } + } else { + if (isReverseDefine) { + messageHorizontalAlignment = HorizontalAlignment.RIGHT; + } else { + messageHorizontalAlignment = HorizontalAlignment.LEFT; + } + } + } else if ("direction".equalsIgnoreCase(value)) { if (arrowDirection == ArrowDirection.LEFT_TO_RIGHT_NORMAL) { messageHorizontalAlignment = HorizontalAlignment.LEFT; } else if (arrowDirection == ArrowDirection.RIGHT_TO_LEFT_REVERSE) { diff --git a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java index f09144cc0..1f58ba03b 100644 --- a/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sprite/ListSpriteDiagramFactory.java @@ -56,6 +56,7 @@ public class ListSpriteDiagramFactory extends UmlDiagramFactory { final List cmds = new ArrayList(); addCommonCommands1(cmds); addCommonCommands2(cmds); + cmds.add(new CommandListSprite()); return cmds; } diff --git a/src/net/sourceforge/plantuml/style/CommandStyleImport.java b/src/net/sourceforge/plantuml/style/CommandStyleImport.java index e5a7f95e9..a42be13a6 100644 --- a/src/net/sourceforge/plantuml/style/CommandStyleImport.java +++ b/src/net/sourceforge/plantuml/style/CommandStyleImport.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml.style; import java.io.File; import java.io.IOException; +import java.io.InputStream; import net.sourceforge.plantuml.FileSystem; import net.sourceforge.plantuml.LineLocation; @@ -75,10 +76,18 @@ public class CommandStyleImport extends SingleLineCommand2 { final String path = arg.get("PATH", 0); try { final File f = FileSystem.getInstance().getFile(path); - if (f.exists() == false) { + BlocLines lines = null; + if (f.exists()) { + lines = BlocLines.load(f, location); + } else { + final InputStream internalIs = StyleLoader.class.getResourceAsStream("/skin/" + path); + if (internalIs != null) { + lines = BlocLines.load(internalIs, location); + } + } + if (lines == null) { return CommandExecutionResult.error("File does not exist: " + path); } - final BlocLines lines = BlocLines.load(f, location); final StyleBuilder styleBuilder = diagram.getSkinParam().getCurrentStyleBuilder(); for (Style modifiedStyle : StyleLoader.getDeclaredStyles(lines, styleBuilder)) { diagram.getSkinParam().muteStyle(modifiedStyle); diff --git a/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java b/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java index aee13cac2..bd3a852b8 100644 --- a/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java +++ b/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java @@ -89,25 +89,35 @@ public class FromSkinparamToStyle { addConvert("entityBorderThickness", PName.LineThickness, SName.entity); addConFont("entity", SName.entity); addConFont("footer", SName.footer); + + addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype); + addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype); + addConvert("sequenceStereotypeFontColor", PName.FontColor, SName.stereotype); + addConvert("sequenceStereotypeFontName", PName.FontName, SName.stereotype); addConvert("SequenceReferenceBorderColor", PName.LineColor, SName.reference); addConvert("SequenceReferenceBorderColor", PName.LineColor, SName.referenceHeader); addConvert("SequenceReferenceBackgroundColor", PName.BackGroundColor, SName.reference); addConvert("sequenceReferenceHeaderBackgroundColor", PName.BackGroundColor, SName.referenceHeader); addConFont("sequenceReference", SName.reference); addConFont("sequenceReference", SName.referenceHeader); + addConvert("sequenceGroupBorderThickness", PName.LineThickness, SName.group); addConvert("SequenceGroupBorderColor", PName.LineColor, SName.group); addConvert("SequenceGroupBorderColor", PName.LineColor, SName.groupHeader); addConvert("SequenceGroupBackgroundColor", PName.BackGroundColor, SName.groupHeader); + addConFont("SequenceGroup", SName.group); addConFont("SequenceGroupHeader", SName.groupHeader); addConvert("SequenceBoxBorderColor", PName.LineColor, SName.box); addConvert("SequenceBoxBackgroundColor", PName.BackGroundColor, SName.box); addConvert("SequenceLifeLineBorderColor", PName.LineColor, SName.lifeLine); + addConvert("SequenceLifeLineBackgroundColor", PName.BackGroundColor, SName.lifeLine); addConvert("sequenceDividerBackgroundColor", PName.BackGroundColor, SName.separator); addConvert("sequenceDividerBorderColor", PName.LineColor, SName.separator); addConFont("sequenceDivider", SName.separator); addConvert("sequenceDividerBorderThickness", PName.LineThickness, SName.separator); addConvert("SequenceMessageAlignment", PName.HorizontalAlignment, SName.arrow); + addConFont("note", SName.note); + addConvert("noteBorderThickness", PName.LineThickness, SName.note); addConvert("noteBackgroundColor", PName.BackGroundColor, SName.note); addConvert("packageBackgroundColor", PName.BackGroundColor, SName.group); addConvert("packageBorderColor", PName.LineColor, SName.group); @@ -125,7 +135,12 @@ public class FromSkinparamToStyle { addConvert("activityDiamondBorderColor", PName.LineColor, SName.diamond); addConFont("activityDiamond", SName.diamond); addConvert("arrowColor", PName.LineColor, SName.arrow); + addConFont("arrow", SName.arrow); + addConvert("arrowThickness", PName.LineThickness, SName.arrow); + addConvert("arrowColor", PName.LineColor, SName.arrow); + addConvert("arrowStyle", PName.LineStyle, SName.arrow); + addConvert("defaulttextalignment", PName.HorizontalAlignment, SName.root); addConvert("defaultFontName", PName.FontName, SName.root); addConFont("SwimlaneTitle", SName.swimlane); @@ -150,7 +165,10 @@ public class FromSkinparamToStyle { private final List