diff --git a/pom.xml b/pom.xml index 642323dd0..82bd6650b 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 1.2018.10-SNAPSHOT + 1.2018.11-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index 22aed027a..c17805a25 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -160,5 +160,7 @@ public interface ISkinParam extends ISkinSimple { public boolean responseMessageBelowArrow(); public boolean svgDimensionStyle(); + + public boolean fixCircleLabelOverlapping(); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/LineLocationImpl.java b/src/net/sourceforge/plantuml/LineLocationImpl.java index af4524b82..659c43a0d 100644 --- a/src/net/sourceforge/plantuml/LineLocationImpl.java +++ b/src/net/sourceforge/plantuml/LineLocationImpl.java @@ -82,8 +82,18 @@ public class LineLocationImpl implements LineLocation { return parent; } + private boolean isStandardLibrary() { + return desc.startsWith("<"); + } + public int compareTo(LineLocation other) { final LineLocationImpl other2 = (LineLocationImpl) other; + if (this.isStandardLibrary() && other2.isStandardLibrary() == false) { + return -1; + } + if (this.isStandardLibrary() == false && other2.isStandardLibrary()) { + return 1; + } return this.position - other2.position; } diff --git a/src/net/sourceforge/plantuml/Option.java b/src/net/sourceforge/plantuml/Option.java index 0968f8fad..4bb0e8d6a 100644 --- a/src/net/sourceforge/plantuml/Option.java +++ b/src/net/sourceforge/plantuml/Option.java @@ -281,6 +281,11 @@ public class Option { OptionPrint.printLicense(); } else if (s.equalsIgnoreCase("-checkversion")) { OptionPrint.checkVersion(); + } else if (s.startsWith("-DPLANTUML_LIMIT_SIZE=")) { + final String v = s.substring("-DPLANTUML_LIMIT_SIZE=".length()); + if (v.matches("\\d+")) { + System.setProperty("PLANTUML_LIMIT_SIZE", v); + } } else if (s.startsWith("-D")) { manageDefine(s.substring(2)); } else if (s.startsWith("-S")) { diff --git a/src/net/sourceforge/plantuml/OptionPrint.java b/src/net/sourceforge/plantuml/OptionPrint.java index bd3e6e2bb..8743905a1 100644 --- a/src/net/sourceforge/plantuml/OptionPrint.java +++ b/src/net/sourceforge/plantuml/OptionPrint.java @@ -159,7 +159,7 @@ public class OptionPrint { } public static void printLicense() throws InterruptedException { - for (String s : License.getCurrent().getText()) { + for (String s : License.getCurrent().getText(false)) { System.out.println(s); } exit(); diff --git a/src/net/sourceforge/plantuml/PSystemError.java b/src/net/sourceforge/plantuml/PSystemError.java index 407affa46..3282c952d 100644 --- a/src/net/sourceforge/plantuml/PSystemError.java +++ b/src/net/sourceforge/plantuml/PSystemError.java @@ -71,7 +71,6 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.txt.UGraphicTxt; -import net.sourceforge.plantuml.version.LicenseInfo; import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemError extends AbstractPSystem { @@ -145,11 +144,10 @@ public class PSystemError extends AbstractPSystem { } else { udrawable = result; } - if (LicenseInfo.retrieveQuick().isValid() == false) { - final int min = (int) (System.currentTimeMillis() / 60000L) % 60; - if (min == 0) { - udrawable = addMessage(udrawable); - } + final int min = (int) (System.currentTimeMillis() / 60000L) % 60; + if (min == 0 /* && LicenseInfo.retrieveQuick().isValid() == false*/ ) { + udrawable = addMessage(udrawable); + } imageBuilder.setUDrawable(udrawable); final ImageData imageData = imageBuilder.writeImageTOBEMOVED(fileFormat, seed(), os); diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index 2216ab0fa..0a38560eb 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -1006,4 +1006,12 @@ public class SkinParam implements ISkinParam { return true; } + public boolean fixCircleLabelOverlapping() { + final String value = getValue("fixcirclelabeloverlapping"); + if ("true".equalsIgnoreCase(value)) { + return true; + } + return false; + } + } diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index 854b1500b..b53838e59 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -299,4 +299,8 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.swimlaneWrapTitleWidth(); } + public boolean fixCircleLabelOverlapping() { + return skinParam.fixCircleLabelOverlapping(); + } + } diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java index bacf7df44..c279c3450 100644 --- a/src/net/sourceforge/plantuml/StringUtils.java +++ b/src/net/sourceforge/plantuml/StringUtils.java @@ -317,10 +317,6 @@ public class StringUtils { return stringsToDisplay.size(); } - private static boolean isSpaceOrTab(char c) { - return c == ' ' || c == '\t'; - } - public static boolean isDiagramCacheable(String uml) { uml = uml.toLowerCase(); if (uml.startsWith("@startuml\nversion\n")) { @@ -490,11 +486,11 @@ public class StringUtils { return arg.toString(); } int i = 0; - while (i < arg.length() && isSpaceOrTab(arg.charAt(i))) { + while (i < arg.length() && isSpaceOrTabOrNull(arg.charAt(i))) { i++; } int j = arg.length() - 1; - while (j >= i && isSpaceOrTab(arg.charAt(j))) { + while (j >= i && isSpaceOrTabOrNull(arg.charAt(j))) { j--; } if (i == 0 && j == arg.length() - 1) { @@ -503,5 +499,9 @@ public class StringUtils { return arg.subSequence(i, j + 1).toString(); } + private static boolean isSpaceOrTabOrNull(char c) { + return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\0'; + } + // http://docs.oracle.com/javase/tutorial/i18n/format/dateFormat.html } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java index 2b037a8e4..c5dc05029 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ActivityDiagram3.java @@ -57,6 +57,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockRecentred; +import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -389,10 +390,10 @@ public class ActivityDiagram3 extends UmlDiagram { return CommandExecutionResult.ok(); } - public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor, HtmlColor borderColor) { + public void startGroup(Display name, HtmlColor backColor, HtmlColor titleColor, HtmlColor borderColor, USymbol type) { manageSwimlaneStrategy(); final InstructionGroup instructionGroup = new InstructionGroup(current(), name, backColor, titleColor, - swinlanes.getCurrentSwimlane(), borderColor, nextLinkRenderer()); + swinlanes.getCurrentSwimlane(), borderColor, nextLinkRenderer(), type); current().add(instructionGroup); setCurrent(instructionGroup); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java index 951321f50..0a6e3ad30 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGroup.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.FtileWithNotes; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; @@ -56,13 +57,15 @@ public class InstructionGroup implements Instruction, InstructionCollection { private final HtmlColor borderColor; private final HtmlColor titleColor; private final LinkRendering linkRendering; + private final USymbol type; private final Display test; private PositionedNote note = null; public InstructionGroup(Instruction parent, Display test, HtmlColor backColor, HtmlColor titleColor, - Swimlane swimlane, HtmlColor borderColor, LinkRendering linkRendering) { + Swimlane swimlane, HtmlColor borderColor, LinkRendering linkRendering, USymbol type) { this.list = new InstructionList(swimlane); + this.type = type; this.linkRendering = linkRendering; this.parent = parent; this.test = test; @@ -80,7 +83,7 @@ public class InstructionGroup implements Instruction, InstructionCollection { if (note != null) { tmp = new FtileWithNotes(tmp, Collections.singleton(note), factory.skinParam()); } - return factory.createGroup(tmp, test, backColor, titleColor, null, borderColor); + return factory.createGroup(tmp, test, backColor, titleColor, null, borderColor, type); } public Instruction getParent() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java index f87604018..38cd1f0a9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandGroup3.java @@ -42,6 +42,7 @@ 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; +import net.sourceforge.plantuml.graphic.USymbol; public class CommandGroup3 extends SingleLineCommand2 { @@ -59,7 +60,7 @@ public class CommandGroup3 extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, RegexResult arg) { - diagram.startGroup(Display.getWithNewlines(arg.get("NAME", 0)), null, null, null); + diagram.startGroup(Display.getWithNewlines(arg.get("NAME", 0)), null, null, null, USymbol.FRAME); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java index 336a85674..6af839811 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; +import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -59,7 +60,7 @@ public class CommandPartition3 extends SingleLineCommand2 { static RegexConcat getRegexConcat() { return new RegexConcat(new RegexLeaf("^"), // - new RegexLeaf("partition"), // + new RegexLeaf("TYPE", "(partition|package|rectangle|card)"), // new RegexLeaf("[%s]+"), // new RegexOptional(// new RegexConcat( // @@ -73,6 +74,19 @@ public class CommandPartition3 extends SingleLineCommand2 { new RegexLeaf("[%s]*\\{?$")); } + private USymbol getUSymbol(String type) { + if ("card".equalsIgnoreCase(type)) { + return USymbol.CARD; + } + if ("package".equalsIgnoreCase(type)) { + return USymbol.PACKAGE; + } + if ("rectangle".equalsIgnoreCase(type)) { + return USymbol.RECTANGLE; + } + return USymbol.FRAME; + } + private static ColorParser color(String id) { return ColorParser.simpleColor(ColorType.BACK, id); } @@ -101,8 +115,10 @@ public class CommandPartition3 extends SingleLineCommand2 { borderColor = HtmlColorUtils.BLACK; } - diagram.startGroup(Display.getWithNewlines(partitionTitle), backColor, titleColor, borderColor); + diagram.startGroup(Display.getWithNewlines(partitionTitle), backColor, titleColor, borderColor, + getUSymbol(arg.get("TYPE", 0))); return CommandExecutionResult.ok(); } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java index 3e4f03b46..2755d3408 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.activitydiagram3.PositionedNote; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; public interface FtileFactory { @@ -89,6 +90,6 @@ public interface FtileFactory { public Ftile createParallel(Swimlane swimlane, List all, ForkStyle style, String label); public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor); + HtmlColor borderColor, USymbol type); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java index 806163998..5fe70715f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java @@ -55,6 +55,7 @@ import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.rose.Rose; @@ -167,8 +168,8 @@ public class FtileFactoryDelegator implements FtileFactory { } public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor) { - return factory.createGroup(list, name, backColor, titleColor, note, borderColor); + HtmlColor borderColor, USymbol type) { + return factory.createGroup(list, name, backColor, titleColor, note, borderColor, type); } public StringBounder getStringBounder() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java index 557fa3ea1..bb8e40202 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java @@ -44,6 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.skin.rose.Rose; public class FtileFactoryDelegatorCreateGroup extends FtileFactoryDelegator { @@ -56,9 +57,9 @@ public class FtileFactoryDelegatorCreateGroup extends FtileFactoryDelegator { @Override public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor) { + HtmlColor borderColor, USymbol type) { final HtmlColor arrowColor = rose.getHtmlColor(skinParam(), ColorParam.arrow); - Ftile result = new FtileGroup(list, name, null, arrowColor, backColor, titleColor, skinParam(), borderColor); + Ftile result = new FtileGroup(list, name, null, arrowColor, backColor, titleColor, skinParam(), borderColor, type); if (note != null) { result = new FtileWithNotes(result, Collections.singleton(note), skinParam()); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java index 682188bfa..2accc7c7d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java @@ -75,19 +75,19 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); - // .changeColor(fontColor(FontParam.ACTIVITY_DIAMOND)); - if (thens.size() > 1) { - if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */) - return FtileIfLongVertical.create(swimlane, borderColor, backColor, arrowColor, getFactory(), - conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile); - return FtileIfLongHorizontal.create(swimlane, borderColor, backColor, arrowColor, getFactory(), - conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile); - } + final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ARROW; final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null) .changeColor(fontColor(FontParam.ACTIVITY_DIAMOND)); + if (thens.size() > 1) { + if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */) + return FtileIfLongVertical.create(swimlane, borderColor, backColor, arrowColor, getFactory(), + conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile); + return FtileIfLongHorizontal.create(swimlane, borderColor, backColor, arrowColor, getFactory(), + conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile, fcTest); + } return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle, thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java index c566a342e..149106dd6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java @@ -77,10 +77,12 @@ public class FtileGroup extends AbstractFtile { private final HtmlColor borderColor; private final HtmlColor backColor; private final UStroke stroke; + private final USymbol type; public FtileGroup(Ftile inner, Display title, Display displayNote, HtmlColor arrowColor, HtmlColor backColor, - HtmlColor titleColor, ISkinParam skinParam, HtmlColor borderColor) { + HtmlColor titleColor, ISkinParam skinParam, HtmlColor borderColor, USymbol type) { super(inner.skinParam()); + this.type = type; this.backColor = backColor == null ? HtmlColorUtils.WHITE : backColor; this.inner = FtileUtils.addHorizontalMargin(inner, 10); this.borderColor = borderColor == null ? HtmlColorUtils.BLACK : borderColor; @@ -196,7 +198,7 @@ public class FtileGroup extends AbstractFtile { final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow( skinParam().shadowing()).withStroke(stroke); - USymbol.FRAME.asBig(name, inner.skinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null), + type.asBig(name, inner.skinParam().getHorizontalAlignment(AlignmentParam.packageTitleAlignment, null), TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext).drawU(ug); final Dimension2D dimHeaderNote = headerNote.calculateDimension(stringBounder); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java index 557ca5d14..b10718318 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java @@ -142,7 +142,8 @@ class FtileIfLongHorizontal extends AbstractFtile { static Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, List thens, Branch branch2, - FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) { + FontConfiguration fcArrow, LinkRendering topInlinkRendering, LinkRendering afterEndwhile, + FontConfiguration fcTest) { if (afterEndwhile == null) { throw new IllegalArgumentException(); } @@ -157,9 +158,9 @@ class FtileIfLongHorizontal extends AbstractFtile { List diamonds = new ArrayList(); List inlabelSizes = new ArrayList(); for (Branch branch : thens) { - final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT, + final TextBlock tb1 = branch.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam()); - final TextBlock tbTest = branch.getLabelTest().create(fc, HorizontalAlignment.LEFT, + final TextBlock tbTest = branch.getLabelTest().create(fcTest, HorizontalAlignment.LEFT, ftileFactory.skinParam()); final HtmlColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); @@ -169,7 +170,7 @@ class FtileIfLongHorizontal extends AbstractFtile { if (Display.isNull(branch.getInlabel())) { inlabelSizes.add(0.0); } else { - tbInlabel = branch.getInlabel().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + tbInlabel = branch.getInlabel().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam()); inlabelSizes.add(tbInlabel.calculateDimension(ftileFactory.getStringBounder()).getWidth()); diamond = diamond.withWest(tbInlabel); } @@ -177,7 +178,8 @@ class FtileIfLongHorizontal extends AbstractFtile { diamonds.add(diamond); } - final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + final TextBlock tb2 = branch2.getLabelPositive().create(fcArrow, HorizontalAlignment.LEFT, + ftileFactory.skinParam()); final int last = diamonds.size() - 1; diamonds.set(last, ((FtileDiamondInside2) diamonds.get(last)).withEast(tb2)); @@ -477,7 +479,6 @@ class FtileIfLongHorizontal extends AbstractFtile { return Collections.unmodifiableList(result); } - @Override public UTranslate getTranslateFor(Ftile child, StringBounder stringBounder) { if (child == tile2) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index 11ca9810a..4c2ed2574 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -63,6 +63,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOut import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; @@ -149,7 +150,7 @@ public class VCompactFactory implements FtileFactory { } public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, PositionedNote note, - HtmlColor borderColor) { + HtmlColor borderColor, USymbol type) { return list; } diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index b8021edc4..ebc0c6a10 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -47,8 +47,6 @@ import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2; import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2.Mode; import net.sourceforge.plantuml.classdiagram.command.CommandDiamondAssociation; import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; -import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificClass; -import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificStereotype; import net.sourceforge.plantuml.classdiagram.command.CommandImport; import net.sourceforge.plantuml.classdiagram.command.CommandLayoutNewLine; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; diff --git a/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java b/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java index 87884a3d6..68de00465 100644 --- a/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java +++ b/src/net/sourceforge/plantuml/code/ArobaseStringCompressor.java @@ -102,7 +102,7 @@ public class ArobaseStringCompressor implements StringCompressor { } private String clean(String s) { - s = s.replace("\0", ""); + // s = s.replace("\0", ""); s = StringUtils.trin(s); s = clean1(s); s = s.replaceAll("@enduml[^\\n\\r]*", ""); diff --git a/src/net/sourceforge/plantuml/code/ArobaseStringCompressor2.java b/src/net/sourceforge/plantuml/code/ArobaseStringCompressor2.java index 3433de76d..065581e61 100644 --- a/src/net/sourceforge/plantuml/code/ArobaseStringCompressor2.java +++ b/src/net/sourceforge/plantuml/code/ArobaseStringCompressor2.java @@ -50,9 +50,9 @@ public class ArobaseStringCompressor2 implements StringCompressor { } private String clean2(String s) { - s = s.replace("\0", ""); + // s = s.replace("\0", ""); s = StringUtils.trin(s); - s = s.replace("\r", "").replaceAll("\n+$", ""); + // s = s.replace("\r", "").replaceAll("\n+$", ""); if (s.startsWith("@start")) { return s; } diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java b/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java index e8944eadc..9bd23e211 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesLegend.java @@ -79,7 +79,7 @@ public class CommandMultilinesLegend extends CommandMultilines2 { if (alignment == null) { alignment = HorizontalAlignment.CENTER; } - diagram.setLegend(DisplayPositionned.single(strings, alignment, valignment)); + diagram.setLegend(DisplayPositionned.single(strings.replaceBackslashT(), alignment, valignment)); return CommandExecutionResult.ok(); } return CommandExecutionResult.error("No legend defined"); diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesTitle.java b/src/net/sourceforge/plantuml/command/CommandMultilinesTitle.java index 60eb4a4f1..b67d13193 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesTitle.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesTitle.java @@ -57,7 +57,7 @@ public class CommandMultilinesTitle extends CommandMultilines { lines = lines.removeEmptyColumns(); final Display strings = lines.toDisplay(); if (strings.size() > 0) { - diagram.setTitle(DisplayPositionned.single(strings, HorizontalAlignment.CENTER, VerticalAlignment.TOP)); + diagram.setTitle(DisplayPositionned.single(strings.replaceBackslashT(), HorizontalAlignment.CENTER, VerticalAlignment.TOP)); return CommandExecutionResult.ok(); } return CommandExecutionResult.error("No title defined"); diff --git a/src/net/sourceforge/plantuml/creole/AtomImg.java b/src/net/sourceforge/plantuml/creole/AtomImg.java index 3fe2aaadb..e8ae9ff55 100644 --- a/src/net/sourceforge/plantuml/creole/AtomImg.java +++ b/src/net/sourceforge/plantuml/creole/AtomImg.java @@ -51,6 +51,8 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.FileSystem; import net.sourceforge.plantuml.FileUtils; import net.sourceforge.plantuml.code.Base64Coder; +import net.sourceforge.plantuml.flashcode.FlashCodeFactory; +import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.ImgValign; import net.sourceforge.plantuml.graphic.StringBounder; @@ -70,6 +72,15 @@ public class AtomImg implements Atom { this.scale = scale; } + public static Atom createQrcode(String flash, double scale) { + final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); + BufferedImage im = utils.exportFlashcode(flash); + if (im == null) { + im = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB); + } + return new AtomImg(new UImage(im).scaleNearestNeighbor(scale).getImage(), 1); + } + public static Atom create(String src, final ImgValign valign, final int vspace, final double scale) { final UFont font = UFont.monospaced(14); final FontConfiguration fc = FontConfiguration.blackBlueTrue(font); diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java b/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java index 7bbc0b972..6e38da9d0 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleImg.java @@ -70,7 +70,7 @@ public class CommandCreoleImg implements Command { throw new IllegalStateException(); } String src = m.group(2); - final double scale = getScale(m.group(3)); + final double scale = getScale(m.group(3), 1); if (src.toLowerCase().startsWith("src=")) { src = src.substring(4); } @@ -79,16 +79,16 @@ public class CommandCreoleImg implements Command { return line.substring(m.group(1).length()); } - public static double getScale(String s) { + public static double getScale(String s, double def) { if (s == null) { - return 1; + return def; } final Pattern p = Pattern.compile("(?:scale=|\\*)([0-9.]+)"); final Matcher m = p.matcher(s); if (m.find()) { return Double.parseDouble(m.group(1)); } - return 1; + return def; } } diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java b/src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java new file mode 100644 index 000000000..908fdfbab --- /dev/null +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleQrcode.java @@ -0,0 +1,74 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, 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.creole; + +import net.sourceforge.plantuml.command.regex.Matcher2; +import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.graphic.Splitter; + +public class CommandCreoleQrcode implements Command { + + private final Pattern2 pattern; + + private CommandCreoleQrcode(String p) { + this.pattern = MyPattern.cmpile(p); + } + + public static Command create() { + return new CommandCreoleQrcode("^(?i)(" + Splitter.qrcodePattern + ")"); + } + + public int matchingSize(String line) { + final Matcher2 m = pattern.matcher(line); + if (m.find() == false) { + return 0; + } + return m.group(1).length(); + } + + public String executeAndGetRemaining(String line, StripeSimple stripe) { + final Matcher2 m = pattern.matcher(line); + if (m.find() == false) { + throw new IllegalStateException(); + } + final String src = m.group(2); + final double scale = CommandCreoleImg.getScale(m.group(3), 3); + stripe.addQrcode(src, scale); + return line.substring(m.group(1).length()); + } + +} diff --git a/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java b/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java index b26ed1c5a..6e0baee27 100644 --- a/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java +++ b/src/net/sourceforge/plantuml/creole/CommandCreoleSprite.java @@ -66,7 +66,7 @@ public class CommandCreoleSprite implements Command { throw new IllegalStateException(); } final String src = m.group(2); - final double scale = CommandCreoleImg.getScale(m.group(3)); + final double scale = CommandCreoleImg.getScale(m.group(3), 1); stripe.addSprite(src, scale); return line.substring(m.group(1).length()); } diff --git a/src/net/sourceforge/plantuml/creole/StripeSimple.java b/src/net/sourceforge/plantuml/creole/StripeSimple.java index 3e18e8147..61d4e4ee9 100644 --- a/src/net/sourceforge/plantuml/creole/StripeSimple.java +++ b/src/net/sourceforge/plantuml/creole/StripeSimple.java @@ -113,6 +113,7 @@ public class StripeSimple implements Stripe { this.commands.add(CommandCreoleExposantChange.create(FontPosition.EXPOSANT)); this.commands.add(CommandCreoleExposantChange.create(FontPosition.INDICE)); this.commands.add(CommandCreoleImg.create()); + this.commands.add(CommandCreoleQrcode.create()); this.commands.add(CommandCreoleOpenIcon.create()); final double scale = skinParam.getDpi() / 96.0; this.commands.add(CommandCreoleMath.create(scale)); @@ -168,6 +169,10 @@ public class StripeSimple implements Stripe { atoms.add(AtomImg.create(src, ImgValign.TOP, 0, scale)); } + public void addQrcode(String src, double scale) { + atoms.add(AtomImg.createQrcode(src, scale)); + } + public void addSpace(int size) { atoms.add(AtomSpace.create(size)); } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index 4e6e16965..f0cbebff6 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -83,6 +83,17 @@ public class Display implements Iterable { public final static Display NULL = new Display(null, null, true, CreoleMode.FULL); + public Display replaceBackslashT() { + final Display result = new Display(this, defaultCreoleMode); + for (int i = 0; i < result.display.size(); i++) { + final CharSequence s = display.get(i); + if (s.toString().contains("\\t")) { + result.display.set(i, s.toString().replace("\\t", "\t")); + } + } + return result; + } + public Display replace(String src, String dest) { final List newDisplay = new ArrayList(); for (CharSequence cs : display) { diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java index a0395125b..42d5d51d5 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java +++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java @@ -470,9 +470,9 @@ final class EntityImpl implements ILeaf, IGroup { if (getLeafType() == LeafType.CIRCLE) { return USymbol.INTERFACE; } - if (symbol != null && stereotype != null && stereotype.getSprite() != null) { - return symbol.withStereoAlignment(HorizontalAlignment.RIGHT); - } + // if (symbol != null && stereotype != null && stereotype.getSprite() != null) { + // return symbol.withStereoAlignment(HorizontalAlignment.RIGHT); + // } return symbol; } @@ -520,7 +520,7 @@ final class EntityImpl implements ILeaf, IGroup { } return isRemovedInternal(); } - + private boolean isRemovedInternal() { if (isGroup()) { if (entityFactory.isRemoved(this)) { @@ -544,8 +544,6 @@ final class EntityImpl implements ILeaf, IGroup { return entityFactory.isRemoved(this); } - - private int layer; public int getHectorLayer() { diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index c69ed06e7..1a750cdef 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -68,20 +68,20 @@ import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemDonors extends AbstractPSystem { - public static final String DONORS = "6wW70AmEU9ELAuNYZT_MZn6AGOgeeHNOWjgQuZoZA1P0SxnDhXdMoRgDdR45mND5SGKL8Az2C-THCiPX" - + "qGYJjjcQVk6-VTu2CLLilsL2UtyTQ4BoLZ2km4tbpF_b0XiJv0R8GZti1NIZZNlZcZIc_NyMPXz_WHRm" - + "DBfiMLGwq5cTNHLD233np1odb9A7OjnVaSBNZIs0buu7kTfO7U4RgRFlr0AQj6RJa9are5X6YaJpiT7Q" - + "SO3jOnWuqM5T7JOGEvGuw1kC0-eRCKh65JJ8ZE9cRAZcdIS4J3YXmavyKPAQeuLaHXawq65jWGAyFnC4" - + "n3uffoHdAsy32hR85ZKDahhmkZDTx1-MKe7yqd0ATB0Sj0Ae0F8Vw8O_PvkvnBcENL4pv5qPvx9no6kz" - + "Lx6_UQ2liwuCb9VDYvdnMdvKjnRIEUMwng-k1lcX8IjxUnXhlBA4yFnlBeNsnG8wFe2EjOQAyVV3-Sr2" - + "6eJ7bBgGWtFopdOJ0R7AKbZeNLnIBV3pBccnkbWUpLayH_lNXLOoi8Ch5fkXZsi5irldZ9AgeVvvoQkk" - + "urFacg1PtfVeHx9fIFp_BSqCqXsqteGFrwM8KgMlhAh5HHU1qw1_Gsu1kGFLq-JHTLg-9Bxt1-JUUv50" - + "53OJx9-wPjIdtBo4UM9Bfwfu01Zl4kr6X_CWCuYg0rq7bMTas5s_tQHdsBGnTcxqYdhJRWnT7zDfoitq" - + "tLpWCmo3icWE7DRUuYZWFfnG3gsMRwleDjVmRbkanZiPxAzXpWYapuXo76bBfazrb9dbiUHDNUBTt2x-" - + "F7JnJ-yMjT1vT_j7wljDVYMrr2F6esimz9PTrczjikXOG6prZ0Kk0tPgjnkJ0vNSGgSsd1KznGbOzxRE" - + "mN4jWukcTREIdQcT73Dh1nskINx8qO1HqPr83hwsEoFFU1G5zYVddLZrKD-757yNK2o62PvIeMmZfEWA" - + "czF9f76hPzmTl8zRcozKj_7DXIS4XH-RQDDoWzUd0FSK-a5J1v0wgrNoqiR42E1tVFq6FS-j3ZpAQ6cL" - + "SNQv8PRIf_S8y1ioyahsjhkX10q0"; + public static final String DONORS = "6-e702mEU9F9PHN1hXQZLurLW-3nVtlrrwZeRZDYIgOGkdS8eIVXBunYGbPF5d9zqTbiGjQCIJSsPpZF" + + "A8e5KEDPF_rXcvjTUFPkr2_5d-Bb2uKfAihW7jk4J2TYN0HFczUtrCbQaWS9fxkw5F0d590ld4unVmxG" + + "btJi7RlLOhTFYHKwl0ze0boDFjOibEWOhUzKgS55ft-TKrAJLZ6kIQJOQiSMsEI4XsnDicFoHCRVT-e9" + + "rBIMfY4zLq2npoaINIxxMXq6K3v10eSNYrYmmSoXv8FRGAlNHWnhimWQqgkeZGtc37b2m-205lRbYpB9" + + "yHQoiihGviNY3XJO_4q0aEcdh2OnMnuCAD0YMbGrMABpuwQxC0_3KlwSQ3WB5XOMb0BLOEG_w0QVtfOy" + + "nRdcNb5Bo5iIhxGnrBUKLtWsBVhQSqcWN5P7oNJn_b5rBQJIyXpdlSO6kMl8oDakMevNzX3U_imbONvA" + + "0VmmT6nCL18_NxQ1XJG8TqizaKVcnCbTYu3Pa5Asy5DCMSs_eqjCLXFBsy3YFkg_pZTb1Lh8IkGsz8PM" + + "88zspaWf3VNtjxoQEh-BM1Cmc_SbwfFPD2J-vswfPbGSeBKXlA7BWg8mIwfACO48N6RwD-GcG7gWUfay" + + "YfVbjyIrFo1ugvA1o6r6f7ygNgYx74AOZgLEbcW1J7OfPUF5weKU8ZenkemepqYRkwwJISsoHSV4RL87" + + "srM3COYZEasvqNsQ2zpTCA3cpVv1snkiOjpB2UVwlLjfMWKmbtktd2ojPp1Ghp2dXQNFY78Oqaxfxkee" + + "aUMnnQ4kiOVRoC935_vnJsDHrutxRzu_7J8VVdwbAQcN63vfqEmjGTPd-qII9n3s56z3E3BkW-CZoO6Q" + + "7F5YjfpX6DW2m6uihjtra9XRGrNM8pkjQGbJaw_kGYNuOJw1kU8MaImsbZiXphWjYkmJyqwCUjNxMPAd" + + "1HIDMGLFQQ6CEIGfmfO5PCXSbPvEcy3sJHiMv2ggC_6eGU5Z5QrQRF1W2d7_mbreQa3MMQcGIvia1l3h" + + "pw_5SzTraF5RBQqY3f3E9I642dUwxPKWarBf7_yiyzSFivDP4jBlTNue0SpBQhfNr955-XS0"; @Override final protected ImageData exportDiagramNow(OutputStream os, int num, FileFormatOption fileFormat, long seed) @@ -94,7 +94,7 @@ public class PSystemDonors extends AbstractPSystem { } private UDrawable getGraphicStrings() throws IOException { - final List cols = getCols(getDonors(), 4, 5); + final List cols = getCols(getDonors(), 6, 5); return new UDrawable() { public void drawU(UGraphic ug) { final TextBlockBackcolored header = GraphicStrings.createBlackOnWhite(Arrays diff --git a/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsZxing.java b/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsZxing.java index d108b85d4..9c0b4caae 100644 --- a/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsZxing.java +++ b/src/net/sourceforge/plantuml/flashcode/FlashCodeUtilsZxing.java @@ -50,7 +50,12 @@ import ext.plantuml.com.google.zxing.qrcode.decoder.ErrorCorrectionLevel; public class FlashCodeUtilsZxing implements FlashCodeUtils { + private static final boolean USE_FLASH = true; + public BufferedImage exportFlashcode(String s) { + if (USE_FLASH == false) { + return null; + } try { final QRCodeWriter writer = new QRCodeWriter(); final Hashtable hints = new Hashtable(); diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorGradient.java b/src/net/sourceforge/plantuml/graphic/HtmlColorGradient.java index 45ebe9892..fe682ae61 100644 --- a/src/net/sourceforge/plantuml/graphic/HtmlColorGradient.java +++ b/src/net/sourceforge/plantuml/graphic/HtmlColorGradient.java @@ -48,6 +48,12 @@ public class HtmlColorGradient implements HtmlColor { if (color1 == null || color2 == null) { throw new IllegalArgumentException(); } + if (color1 instanceof HtmlColorGradient) { + color1 = ((HtmlColorGradient) color1).color1; + } + if (color2 instanceof HtmlColorGradient) { + color2 = ((HtmlColorGradient) color2).color2; + } this.color1 = color1; this.color2 = color2; this.policy = policy; diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java index a335490c2..15da9a58a 100644 --- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java +++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java @@ -257,7 +257,9 @@ public class QuoteUtils { "Zl ernyvgl vf whfg qvssrerag guna lbhef", "Uvfgbel vf n avtugzner sebz juvpu V nz gelvat gb njnxr", "L'ra n dh'bag rffnlr, vyf bag rh qrf ceboyrzrf", - "Gb ree vf uhzna, ohg gb ernyyl sbhy guvatf hc erdhverf n pbzchgre."); + "Gb ree vf uhzna, ohg gb ernyyl sbhy guvatf hc erdhverf n pbzchgre.", + "Vs lbh oryvrir rirelguvat lbh ernq, lbh orggre abg ernq", + "Gurer vf ab ceboyrz fb onq lbh pna'g znxr vg jbefr"); private QuoteUtils() { } diff --git a/src/net/sourceforge/plantuml/graphic/Splitter.java b/src/net/sourceforge/plantuml/graphic/Splitter.java index 8eca8ab59..72161494b 100644 --- a/src/net/sourceforge/plantuml/graphic/Splitter.java +++ b/src/net/sourceforge/plantuml/graphic/Splitter.java @@ -57,6 +57,7 @@ public class Splitter { public static final String fontSizePattern2 = "\\"; static final String fontSup = "\\"; static final String fontSub = "\\"; + public static final String qrcodePattern = "\\{}]+)" + "(\\{scale=(?:[0-9.]+)\\})?" + "\\>"; static final String imgPattern = "\\]+[%q%g]?[%s]*|vspace\\s*=\\s*[%q%g]?\\d+[%q%g]?\\s*|valign[%s]*=[%s]*[%q%g]?(top|middle|bottom)[%q%g]?[%s]*)+\\>"; public static final String imgPatternNoSrcColon = "\\{}]+)" + "(\\{scale=(?:[0-9.]+)\\})?" + "\\>"; public static final String fontFamilyPattern = "\\]+)/?\\>"; @@ -97,6 +98,8 @@ public class Splitter { sb.append('|'); sb.append(endSupSub); sb.append('|'); + sb.append(qrcodePattern); + sb.append('|'); sb.append(imgPattern); sb.append('|'); sb.append(imgPatternNoSrcColon); diff --git a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java index c39b80708..0588f9e4b 100644 --- a/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java +++ b/src/net/sourceforge/plantuml/hector/CucaDiagramFileMakerHectorB1.java @@ -54,7 +54,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; -import net.sourceforge.plantuml.svek.DotDataImageBuilder; +import net.sourceforge.plantuml.svek.GeneralImageBuilder; import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; @@ -162,7 +162,7 @@ public class CucaDiagramFileMakerHectorB1 implements CucaDiagramFileMaker { } private IEntityImage computeImage(final ILeaf leaf) { - final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(), + final IEntityImage image = GeneralImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(), false, diagram, null, null, null, diagram.getLinks()); return image; } diff --git a/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java b/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java index 679dcb294..e3df59fb8 100644 --- a/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java +++ b/src/net/sourceforge/plantuml/hector2/graphic/Foo1.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.hector2.layering.Layer; -import net.sourceforge.plantuml.svek.DotDataImageBuilder; +import net.sourceforge.plantuml.svek.GeneralImageBuilder; import net.sourceforge.plantuml.svek.IEntityImage; public class Foo1 { @@ -59,7 +59,7 @@ public class Foo1 { } private static IEntityImage computeImage(final ILeaf leaf, CucaDiagram diagram) { - final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(), + final IEntityImage image = GeneralImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(), false, diagram, null, null, null, diagram.getLinks()); return image; } diff --git a/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java b/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java index 06e712678..92fedb0c9 100644 --- a/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java +++ b/src/net/sourceforge/plantuml/hector2/graphic/Foo2.java @@ -47,7 +47,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.hector2.MinMax; import net.sourceforge.plantuml.hector2.layering.Layer; import net.sourceforge.plantuml.hector2.mpos.Distribution; -import net.sourceforge.plantuml.svek.DotDataImageBuilder; +import net.sourceforge.plantuml.svek.GeneralImageBuilder; import net.sourceforge.plantuml.svek.IEntityImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -100,7 +100,7 @@ public class Foo2 extends AbstractTextBlock implements TextBlock { } private IEntityImage computeImage(final ILeaf leaf) { - final IEntityImage image = DotDataImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(), + final IEntityImage image = GeneralImageBuilder.createEntityImageBlock(leaf, diagram.getSkinParam(), false, diagram, null, null, null, diagram.getLinks()); return image; } diff --git a/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java b/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java index 7e2dbc547..703244528 100644 --- a/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java +++ b/src/net/sourceforge/plantuml/jdot/CucaDiagramFileMakerJDot.java @@ -99,7 +99,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Cluster; import net.sourceforge.plantuml.svek.CucaDiagramFileMaker; -import net.sourceforge.plantuml.svek.DotDataImageBuilder; +import net.sourceforge.plantuml.svek.GeneralImageBuilder; import net.sourceforge.plantuml.svek.DotStringFactory; import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.IEntityImage; @@ -594,7 +594,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker { // skinParam = new SkinParamSameClassWidth(dotData.getSkinParam(), width); } - return DotDataImageBuilder.createEntityImageBlock(ent, skinParam, diagram.isHideEmptyDescriptionForState(), + return GeneralImageBuilder.createEntityImageBlock(ent, skinParam, diagram.isHideEmptyDescriptionForState(), diagram, getBibliotekon(), null, diagram.getUmlDiagramType(), diagram.getLinks()); } return ent.getSvekImage(); diff --git a/src/net/sourceforge/plantuml/posimo/data.txt b/src/net/sourceforge/plantuml/posimo/data.txt new file mode 100644 index 000000000..2fe8aece5 --- /dev/null +++ b/src/net/sourceforge/plantuml/posimo/data.txt @@ -0,0 +1,38 @@ +@startuml +interface Positionable { + + Dimension2D getSize(); + + Point2D getPosition(); +} + +interface Clusterable { + +Cluster getParent(); +} + +Positionable <|-- Clusterable + +class Cluster + +Cluster *-- Cluster : subclusters +Clusterable <|.. Cluster +Cluster *-- Block +Clusterable <|.. Block + +Path *-- "2" Cluster +Path --> Label : has one +Positionable <|-- Label + +SimpleDrawer --> Cluster +SimpleDrawer *--> Path + +class GraphvizSolver { + + Dimension2D solve(Cluster root, Collection paths) +} +GraphvizSolver --> Cluster +GraphvizSolver *--> Path + + +'Clusterable --> Cluster : Parent + + + +@enduml diff --git a/src/net/sourceforge/plantuml/preproc/FileWithSuffix.java b/src/net/sourceforge/plantuml/preproc/FileWithSuffix.java index cd617bfa3..9f684bdfc 100644 --- a/src/net/sourceforge/plantuml/preproc/FileWithSuffix.java +++ b/src/net/sourceforge/plantuml/preproc/FileWithSuffix.java @@ -37,28 +37,108 @@ package net.sourceforge.plantuml.preproc; import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; import java.util.HashSet; import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import net.sourceforge.plantuml.FileSystem; +import net.sourceforge.plantuml.Log; public class FileWithSuffix { private final File file; private final String suffix; + private final String entry; + + public Reader getReader(String charset) throws IOException { + if (entry == null) { + if (charset == null) { + Log.info("Using default charset"); + return new FileReader(file); + } + Log.info("Using charset " + charset); + return new InputStreamReader(new FileInputStream(file), charset); + } + final InputStream is = getDataFromZip(file, entry); + if (is == null) { + return null; + } + if (charset == null) { + Log.info("Using default charset"); + return new InputStreamReader(is); + } + Log.info("Using charset " + charset); + return new InputStreamReader(is, charset); + } + + private InputStream getDataFromZip(File f, String name) throws IOException { + final ZipInputStream zis = new ZipInputStream(new FileInputStream(f)); + ZipEntry ze = zis.getNextEntry(); + + while (ze != null) { + final String fileName = ze.getName(); + if (ze.isDirectory()) { + } else if (fileName.equals(name)) { + return zis; + } + ze = zis.getNextEntry(); + } + zis.closeEntry(); + zis.close(); + return null; + } + + public boolean fileOk() { + if (file.exists() == false || file.isDirectory()) { + return false; + } + return true; + } public FileWithSuffix(File file, String suffix) { this.file = file; this.suffix = suffix; + this.entry = null; + } + + public FileWithSuffix(String fileName, String suffix) throws IOException { + final int idx = fileName.indexOf('~'); + this.suffix = suffix; + if (idx == -1) { + this.file = FileSystem.getInstance().getFile(fileName); + this.entry = null; + } else { + this.file = FileSystem.getInstance().getFile(fileName.substring(0, idx)); + this.entry = fileName.substring(idx + 1); + } } @Override public int hashCode() { - return file.hashCode() + (suffix == null ? 0 : suffix.hashCode() * 43); + return file.hashCode() + (suffix == null ? 0 : suffix.hashCode() * 43) + (entry == null ? 0 : entry.hashCode()); } @Override public boolean equals(Object arg) { final FileWithSuffix other = (FileWithSuffix) arg; - return this.file.equals(other.file) && equals(suffix, other.suffix); + return this.file.equals(other.file) && equals(suffix, other.suffix) && same(entry, other.entry); + } + + private static boolean same(String s1, String s2) { + if (s1 == null && s2 == null) { + return true; + } + if (s1 != null && s2 != null) { + return s1.equals(s2); + } + return false; } private static boolean equals(String s1, String s2) { @@ -80,4 +160,23 @@ public class FileWithSuffix { return result; } + public final File getFile() { + return file; + } + + public File getParentFile() { + return file.getParentFile(); + } + + public String getDescription() { + if (entry == null) { + return file.getAbsolutePath(); + } + return file.getAbsolutePath() + "~" + entry; + } + + public final String getSuffix() { + return suffix; + } + } diff --git a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java index bf542c716..188b861a6 100644 --- a/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java +++ b/src/net/sourceforge/plantuml/preproc/PreprocessorInclude.java @@ -37,11 +37,10 @@ package net.sourceforge.plantuml.preproc; import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.Reader; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -149,7 +148,7 @@ public class PreprocessorInclude extends ReadLineInstrumented implements ReadLin if (s == null) { return null; } - if (OptionFlags.ALLOW_INCLUDE) { + if (s.getPreprocessorError() == null && OptionFlags.ALLOW_INCLUDE) { assert included == null; final Matcher2 m1 = includePattern.matcher(s); if (m1.find()) { @@ -188,7 +187,7 @@ public class PreprocessorInclude extends ReadLineInstrumented implements ReadLin } try { final URL url = new URL(urlString); - included = new PreprocessorInclude(config, getReaderInclude(s, url, suf), defines, charset, null, + included = new PreprocessorInclude(config, getReaderInclude(url, s, suf), defines, charset, null, filesUsedCurrent, filesUsedGlobal, definitionsContainer); } catch (MalformedURLException e) { return s.withErrorPreprocessor("Cannot include url " + urlString); @@ -222,17 +221,17 @@ public class PreprocessorInclude extends ReadLineInstrumented implements ReadLin suf = fileName.substring(idx + 1); fileName = fileName.substring(0, idx); } - final File f = FileSystem.getInstance().getFile(withEnvironmentVariable(fileName)); - final FileWithSuffix f2 = new FileWithSuffix(f, suf); - if (f.exists() == false || f.isDirectory()) { - return s.withErrorPreprocessor("Cannot include " + f.getAbsolutePath()); + // final File f = FileSystem.getInstance().getFile(withEnvironmentVariable(fileName)); + final FileWithSuffix f2 = new FileWithSuffix(withEnvironmentVariable(fileName), suf); + if (f2.fileOk() == false) { + return s.withErrorPreprocessor("Cannot include " + f2.getFile().getAbsolutePath()); } else if (allowMany == false && filesUsedCurrent.contains(f2)) { // return CharSequence2Impl.errorPreprocessor("File already included " + f.getAbsolutePath(), lineLocation); return this.readLine(); } filesUsedCurrent.add(f2); filesUsedGlobal.add(f2); - included = new PreprocessorInclude(config, getReaderInclude(s, f, suf), defines, charset, f.getParentFile(), + included = new PreprocessorInclude(config, getReaderInclude(f2, s), defines, charset, f2.getParentFile(), filesUsedCurrent, filesUsedGlobal, definitionsContainer); return this.readLine(); } @@ -280,9 +279,9 @@ public class PreprocessorInclude extends ReadLineInstrumented implements ReadLin } final String description = "<" + filename + ">"; try { - if (StartDiagramExtractReader.containsStartDiagram(s, is, description)) { + if (StartDiagramExtractReader.containsStartDiagram(is, s, description)) { is = getStdlibInputStream(filename); - return new StartDiagramExtractReader(s, is, description); + return StartDiagramExtractReader.build(is, s, description); } is = getStdlibInputStream(filename); if (is == null) { @@ -290,32 +289,32 @@ public class PreprocessorInclude extends ReadLineInstrumented implements ReadLin } return ReadLineReader.create(new InputStreamReader(is), description); } catch (IOException e) { + e.printStackTrace(); return new ReadLineSimple(s, e.toString()); } } - private ReadLine getReaderInclude(CharSequence2 s, final File f, String suf) { + private ReadLine getReaderInclude(FileWithSuffix f2, CharSequence2 s) { try { - if (StartDiagramExtractReader.containsStartDiagram(s, f, charset)) { - return new StartDiagramExtractReader(s, f, suf, charset); + if (StartDiagramExtractReader.containsStartDiagram(f2, s, charset)) { + return StartDiagramExtractReader.build(f2, s, charset); } - if (charset == null) { - Log.info("Using default charset"); - return ReadLineReader.create(new FileReader(f), f.getAbsolutePath(), s.getLocation()); + final Reader reader = f2.getReader(charset); + if (reader == null) { + return new ReadLineSimple(s, "Cannot open " + f2.getDescription()); } - Log.info("Using charset " + charset); - return ReadLineReader.create(new InputStreamReader(new FileInputStream(f), charset), f.getAbsolutePath(), - s.getLocation()); + return ReadLineReader.create(reader, f2.getDescription(), s.getLocation()); } catch (IOException e) { + e.printStackTrace(); return new ReadLineSimple(s, e.toString()); } } - private ReadLine getReaderInclude(CharSequence2 s, final URL url, String suf) { + private ReadLine getReaderInclude(final URL url, CharSequence2 s, String suf) { try { - if (StartDiagramExtractReader.containsStartDiagram(s, url, charset)) { - return new StartDiagramExtractReader(s, url, suf, charset); + if (StartDiagramExtractReader.containsStartDiagram(url, s, charset)) { + return StartDiagramExtractReader.build(url, s, suf, charset); } final InputStream is = url.openStream(); if (charset == null) { @@ -325,6 +324,7 @@ public class PreprocessorInclude extends ReadLineInstrumented implements ReadLin Log.info("Using charset " + charset); return ReadLineReader.create(new InputStreamReader(is, charset), url.toString(), s.getLocation()); } catch (IOException e) { + e.printStackTrace(); return new ReadLineSimple(s, e.toString()); } diff --git a/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java b/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java index ceba7f49e..e3b08ca46 100644 --- a/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java +++ b/src/net/sourceforge/plantuml/preproc/StartDiagramExtractReader.java @@ -35,12 +35,10 @@ */ package net.sourceforge.plantuml.preproc; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.Reader; import java.net.URL; import net.sourceforge.plantuml.CharSequence2; @@ -52,16 +50,16 @@ public class StartDiagramExtractReader implements ReadLine { private final ReadLine raw; private boolean finished = false; - public StartDiagramExtractReader(CharSequence2 s, File f, String uid, String charset) { - this(getReadLine(s, f, charset), uid); + public static StartDiagramExtractReader build(FileWithSuffix f2, CharSequence2 s, String charset) { + return new StartDiagramExtractReader(getReadLine(f2, s, charset), f2.getSuffix()); } - public StartDiagramExtractReader(CharSequence2 s, URL url, String uid, String charset) { - this(getReadLine(s, url, charset), uid); + public static StartDiagramExtractReader build(URL url, CharSequence2 s, String uid, String charset) { + return new StartDiagramExtractReader(getReadLine(url, s, charset), uid); } - public StartDiagramExtractReader(CharSequence2 s, InputStream is, String desc) { - this(getReadLine(s, is, desc), null); + public static StartDiagramExtractReader build(InputStream is, CharSequence2 s, String desc) { + return new StartDiagramExtractReader(getReadLine(is, s, desc), null); } private StartDiagramExtractReader(ReadLine raw, String suf) { @@ -103,25 +101,23 @@ public class StartDiagramExtractReader implements ReadLine { return false; } - private static ReadLine getReadLine(CharSequence2 s, File f, String charset) { + private static ReadLine getReadLine(FileWithSuffix f2, CharSequence2 s, String charset) { try { - if (charset == null) { - Log.info("Using default charset"); - return new UncommentReadLine(ReadLineReader.create(new FileReader(f), f.getAbsolutePath())); + final Reader tmp1 = f2.getReader(charset); + if (tmp1 == null) { + return new ReadLineSimple(s, "Cannot open " + f2.getDescription()); } - Log.info("Using charset " + charset); - return new UncommentReadLine(ReadLineReader.create(new InputStreamReader(new FileInputStream(f), charset), - f.getAbsolutePath())); + return new UncommentReadLine(ReadLineReader.create(tmp1, f2.getDescription())); } catch (IOException e) { return new ReadLineSimple(s, e.toString()); } } - private static ReadLine getReadLine(CharSequence2 s, InputStream is, String description) { + private static ReadLine getReadLine(InputStream is, CharSequence2 s, String description) { return new UncommentReadLine(ReadLineReader.create(new InputStreamReader(is), description)); } - private static ReadLine getReadLine(CharSequence2 s, URL url, String charset) { + private static ReadLine getReadLine(URL url, CharSequence2 s, String charset) { try { if (charset == null) { Log.info("Using default charset"); @@ -136,18 +132,18 @@ public class StartDiagramExtractReader implements ReadLine { } } - static public boolean containsStartDiagram(CharSequence2 s, File f, String charset) throws IOException { - final ReadLine r = getReadLine(s, f, charset); + static public boolean containsStartDiagram(FileWithSuffix f2, CharSequence2 s, String charset) throws IOException { + final ReadLine r = getReadLine(f2, s, charset); return containsStartDiagram(r); } - static public boolean containsStartDiagram(CharSequence2 s, URL url, String charset) throws IOException { - final ReadLine r = getReadLine(s, url, charset); + static public boolean containsStartDiagram(URL url, CharSequence2 s, String charset) throws IOException { + final ReadLine r = getReadLine(url, s, charset); return containsStartDiagram(r); } - static public boolean containsStartDiagram(CharSequence2 s, InputStream is, String description) throws IOException { - final ReadLine r = getReadLine(s, is, description); + static public boolean containsStartDiagram(InputStream is, CharSequence2 s, String description) throws IOException { + final ReadLine r = getReadLine(is, s, description); return containsStartDiagram(r); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java index fd168d625..2f8569dd0 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java @@ -82,7 +82,7 @@ public class CommunicationExoTile implements TileWithUpdateStairs { arrowConfiguration = arrowConfiguration.reverse(); } final Component comp = skin.createComponent(ComponentType.ARROW, arrowConfiguration, skinParam, - message.getLabel()); + message.getLabelNumbered()); return comp; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java index 894feb659..8a0b0b859 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java @@ -40,6 +40,7 @@ import java.awt.geom.Point2D; import java.util.Iterator; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.Log; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.Event; @@ -101,10 +102,10 @@ public class CommunicationTileSelf implements TileWithUpdateStairs { if (message.isActivate()) { livingSpace1.addStepForLivebox(getEvent(), y + p2.getY()); - System.err.println("CommunicationTileSelf::updateStairs activate y=" + (y + p2.getY()) + " " + message); + Log.info("CommunicationTileSelf::updateStairs activate y=" + (y + p2.getY()) + " " + message); } else if (message.isDeactivate()) { livingSpace1.addStepForLivebox(getEvent(), y + p1.getY()); - System.err.println("CommunicationTileSelf::updateStairs deactivate y=" + (y + p1.getY()) + " " + message); + Log.info("CommunicationTileSelf::updateStairs deactivate y=" + (y + p1.getY()) + " " + message); } // livingSpace1.addStep(y + arrowY, level1); @@ -121,8 +122,7 @@ public class CommunicationTileSelf implements TileWithUpdateStairs { double x1 = getPoint1(stringBounder).getCurrentValue(); final int levelIgnore = livingSpace1.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_ACTIVATE); final int levelConsidere = livingSpace1.getLevelAt(this, EventsHistoryMode.CONSIDERE_FUTURE_DEACTIVATE); - System.err.println("CommunicationTileSelf::drawU levelIgnore=" + levelIgnore + " levelConsidere=" - + levelConsidere); + Log.info("CommunicationTileSelf::drawU levelIgnore=" + levelIgnore + " levelConsidere=" + levelConsidere); x1 += CommunicationTile.LIVE_DELTA_SIZE * levelIgnore; if (levelIgnore < levelConsidere) { x1 += CommunicationTile.LIVE_DELTA_SIZE; diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java index adb87791d..a377aac13 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java @@ -45,12 +45,11 @@ import net.sourceforge.plantuml.ugraphic.UGraphic; public class EmptyTile implements Tile { private final double height; + private final Tile position; - private final Real origin; - - public EmptyTile(double height, TileArguments tileArguments) { - this.origin = tileArguments.getOrigin(); + public EmptyTile(double height, Tile position) { this.height = height; + this.position = position; } public void drawU(UGraphic ug) { @@ -64,11 +63,11 @@ public class EmptyTile implements Tile { } public Real getMinX(StringBounder stringBounder) { - return origin; + return position.getMinX(stringBounder); } public Real getMaxX(StringBounder stringBounder) { - return origin; + return position.getMaxX(stringBounder); } public Event getEvent() { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java index 887f604a1..5bae2e15c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java @@ -135,6 +135,12 @@ public class EventsHistory { } private SymbolContext getActivateColor(Event event) { + if (event instanceof LifeEvent) { + final LifeEvent le = (LifeEvent) event; + if (le.isActivate()) { + return le.getSpecificColors(); + } + } for (Iterator it = events.iterator(); it.hasNext();) { final Event current = it.next(); if (event != current) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java index 86d8c94f9..c5a0b1d7f 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java @@ -139,10 +139,11 @@ public class TileBuilder { tiles.add(new DividerTile(divider, tileArguments)); } else if (ev instanceof GroupingStart) { final GroupingStart start = (GroupingStart) ev; - tiles.add(new EmptyTile(4, tileArguments)); - tiles.add(new GroupingTile(it, start, tileArguments.withBackColorGeneral(start.getBackColorElement(), - start.getBackColorGeneral()), tileArguments)); - tiles.add(new EmptyTile(4, tileArguments)); + final GroupingTile groupingTile = new GroupingTile(it, start, tileArguments.withBackColorGeneral( + start.getBackColorElement(), start.getBackColorGeneral()), tileArguments); + tiles.add(new EmptyTile(4, groupingTile)); + tiles.add(groupingTile); + tiles.add(new EmptyTile(4, groupingTile)); // tiles.add(TileUtils.withMargin(tile, 0, 0, 4, 4); } else if (ev instanceof GroupingLeaf && ((GroupingLeaf) ev).getType() == GroupingType.ELSE) { final GroupingLeaf anElse = (GroupingLeaf) ev; diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java index 5c25be471..fa01bce6d 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek.java @@ -75,12 +75,12 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { } } - private DotDataImageBuilder createDotDataImageBuilder(DotMode dotMode, StringBounder stringBounder) { + private GeneralImageBuilder createDotDataImageBuilder(DotMode dotMode, StringBounder stringBounder) { final DotData dotData = new DotData(diagram.getEntityFactory().getRootGroup(), getOrderedLinks(), diagram.getLeafsvalues(), diagram.getUmlDiagramType(), diagram.getSkinParam(), diagram, diagram, diagram.getColorMapper(), diagram.getEntityFactory(), diagram.isHideEmptyDescriptionForState(), dotMode, diagram.getNamespaceSeparator(), diagram.getPragma()); - return new DotDataImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(), + return new GeneralImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(), stringBounder); } @@ -94,7 +94,7 @@ public final class CucaDiagramFileMakerSvek implements CucaDiagramFileMaker { } // System.err.println("FOO11 type=" + os.getClass()); - DotDataImageBuilder svek2 = createDotDataImageBuilder(DotMode.NORMAL, + GeneralImageBuilder svek2 = createDotDataImageBuilder(DotMode.NORMAL, fileFormatOption.getDefaultStringBounder()); BaseFile basefile = null; if (fileFormatOption.isDebugSvek() && os instanceof NamedOutputStream) { diff --git a/src/net/sourceforge/plantuml/svek/DotDataImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java similarity index 99% rename from src/net/sourceforge/plantuml/svek/DotDataImageBuilder.java rename to src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java index 2929e2b2e..38cc28e43 100644 --- a/src/net/sourceforge/plantuml/svek/DotDataImageBuilder.java +++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java @@ -120,7 +120,7 @@ import net.sourceforge.plantuml.svek.image.EntityImageTips; import net.sourceforge.plantuml.svek.image.EntityImageUseCase; import net.sourceforge.plantuml.ugraphic.sprite.Sprite; -public final class DotDataImageBuilder { +public final class GeneralImageBuilder { private final DotData dotData; private final EntityFactory entityFactory; @@ -130,7 +130,7 @@ public final class DotDataImageBuilder { private final StringBounder stringBounder; - public DotDataImageBuilder(DotData dotData, EntityFactory entityFactory, UmlSource source, Pragma pragma, + public GeneralImageBuilder(DotData dotData, EntityFactory entityFactory, UmlSource source, Pragma pragma, StringBounder stringBounder) { this.dotData = dotData; this.entityFactory = entityFactory; diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java index 9995d185f..57d6ba1d5 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerActivity.java @@ -116,7 +116,7 @@ public final class GroupPngMakerActivity { skinParam, new InnerGroupHierarchy(), diagram.getColorMapper(), diagram.getEntityFactory(), false, DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma()); - final DotDataImageBuilder svek2 = new DotDataImageBuilder(dotData, diagram.getEntityFactory(), + final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(), stringBounder); if (group.getGroupType() == GroupType.INNER_ACTIVITY) { diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java index f215938de..119fb64ed 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java @@ -124,7 +124,7 @@ public final class GroupPngMakerState { diagram.isHideEmptyDescriptionForState(), DotMode.NORMAL, diagram.getNamespaceSeparator(), diagram.getPragma()); - final DotDataImageBuilder svek2 = new DotDataImageBuilder(dotData, diagram.getEntityFactory(), + final GeneralImageBuilder svek2 = new GeneralImageBuilder(dotData, diagram.getEntityFactory(), diagram.getSource(), diagram.getPragma(), stringBounder); if (group.getGroupType() == GroupType.CONCURRENT_STATE) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java index 256a31372..3100189d2 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java @@ -101,8 +101,8 @@ public class EntityImageDescription extends AbstractEntityImage { if (symbol == USymbol.FOLDER) { this.shapeType = ShapeType.FOLDER; } else if (symbol == USymbol.INTERFACE) { - this.shapeType = ShapeType.RECTANGLE; - // this.shapeType = ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE; + this.shapeType = skinParam.fixCircleLabelOverlapping() ? ShapeType.RECTANGLE_WITH_CIRCLE_INSIDE + : ShapeType.RECTANGLE; } else { this.shapeType = ShapeType.RECTANGLE; } diff --git a/src/net/sourceforge/plantuml/swing/LicenseWindow.java b/src/net/sourceforge/plantuml/swing/LicenseWindow.java index f00d44c3a..257a47bdd 100644 --- a/src/net/sourceforge/plantuml/swing/LicenseWindow.java +++ b/src/net/sourceforge/plantuml/swing/LicenseWindow.java @@ -71,7 +71,7 @@ class LicenseWindow extends JFrame { this.setTitle("Licence PlantUML (" + Version.versionString() + ")"); getContentPane().add(getNorthLabel(), BorderLayout.NORTH); - final List list = new ArrayList(License.getCurrent().getText()); + final List list = new ArrayList(License.getCurrent().getText(false)); getContentPane().add(getJComponent(list), BorderLayout.CENTER); getContentPane().add(getSouthLabel(), BorderLayout.SOUTH); diff --git a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java index eacb6679f..0eeb679ff 100644 --- a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java +++ b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java @@ -151,6 +151,7 @@ public class LanguageDescriptor { keyword.add("again"); keyword.add("kill"); keyword.add("order"); + keyword.add("allow_mixing"); preproc.add("!exit"); preproc.add("!include"); diff --git a/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteMonochrome.java b/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteMonochrome.java index e1bf77e9d..3d152bf2e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteMonochrome.java +++ b/src/net/sourceforge/plantuml/ugraphic/sprite/SpriteMonochrome.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorGradient; +import net.sourceforge.plantuml.graphic.HtmlColorSimple; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -181,7 +182,6 @@ public class SpriteMonochrome implements Sprite { } public UImage toUImage(ColorMapper colorMapper, HtmlColor backcolor, HtmlColor color) { - final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); if (backcolor == null) { backcolor = HtmlColorUtils.WHITE; @@ -189,6 +189,10 @@ public class SpriteMonochrome implements Sprite { if (color == null) { color = HtmlColorUtils.BLACK; } + // if (backcolor instanceof HtmlColorGradient) { + // return special(colorMapper, (HtmlColorGradient) backcolor, color); + // } + final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); final HtmlColorGradient gradient = new HtmlColorGradient(backcolor, color, '\0'); for (int col = 0; col < width; col++) { for (int line = 0; line < height; line++) { @@ -200,6 +204,21 @@ public class SpriteMonochrome implements Sprite { return new UImage(im); } + private UImage special(ColorMapper colorMapper, HtmlColorGradient backcolor, HtmlColor color) { + final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + for (int col = 0; col < width; col++) { + for (int line = 0; line < height; line++) { + final HtmlColor backColorLocal = new HtmlColorSimple(backcolor.getColor(colorMapper, 1.0 * line + / height), false); + final HtmlColorGradient gradient = new HtmlColorGradient(backColorLocal, color, '\0'); + final double coef = 1.0 * grey[line][col] / (grayLevel - 1); + final Color c = gradient.getColor(colorMapper, coef); + im.setRGB(col, line, c.getRGB()); + } + } + return new UImage(im); + } + public TextBlock asTextBlock(final HtmlColor color, final double scale) { return new AbstractTextBlock() { diff --git a/src/net/sourceforge/plantuml/version/License.java b/src/net/sourceforge/plantuml/version/License.java index 6d7a0e39b..03f51fea1 100644 --- a/src/net/sourceforge/plantuml/version/License.java +++ b/src/net/sourceforge/plantuml/version/License.java @@ -280,7 +280,7 @@ public enum License { text.add("textual description in PlantUML language). Those images are not covered by"); } - private List getHeaderStart(LicenseInfo licenseInfo) { + private List getHeaderStart(LicenseInfo licenseInfo, boolean withQrcode) { final List text = new ArrayList(); if (licenseInfo.isNone()) { text.add("========================================================================"); @@ -304,7 +304,12 @@ public enum License { text.add(" "); text.add("http://plantuml.com/patreon (only 1$ per month!)"); text.add("http://plantuml.com/paypal"); - text.add(" "); + if (withQrcode) { + text.add("\t\t\t\t\t\t"); + } else { + text.add(""); + text.add(" "); + } } return text; } @@ -451,9 +456,9 @@ public enum License { return Collections.unmodifiableList(h); } - public List getText() { - final LicenseInfo licenseInfo = LicenseInfo.retrieveSlow(); - final List text = getHeaderStart(licenseInfo); + public List getText(boolean withQrcode) { + final LicenseInfo licenseInfo = LicenseInfo.retrieveQuick(); + final List text = getHeaderStart(licenseInfo, withQrcode); if (this == License.GPL) { addGpl(licenseInfo, text); } else if (this == License.GPLV2) { diff --git a/src/net/sourceforge/plantuml/version/LicenseInfo.java b/src/net/sourceforge/plantuml/version/LicenseInfo.java index 1f842c496..ba4badfc4 100644 --- a/src/net/sourceforge/plantuml/version/LicenseInfo.java +++ b/src/net/sourceforge/plantuml/version/LicenseInfo.java @@ -48,6 +48,7 @@ import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; import net.sourceforge.plantuml.Log; +import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.SignatureUtils; import net.sourceforge.plantuml.dedication.Dedication; import net.sourceforge.plantuml.dedication.QBlock; @@ -110,6 +111,9 @@ public class LicenseInfo { public static synchronized LicenseInfo retrieveSlow() { cache = LicenseInfo.NONE; + if (OptionFlags.ALLOW_INCLUDE == false) { + return cache; + } final String key = prefs.get("license", ""); if (key.length() > 0) { cache = setIfValid(retrieve(key), cache); @@ -153,7 +157,7 @@ public class LicenseInfo { } public static LicenseInfo retrieve(final String key) { - if (key.matches("^[0-9a-z]+$")) { + if (key.length() > 99 && key.matches("^[0-9a-z]+$")) { try { final BigInteger lu = new BigInteger(key, 36); final QBlock qb2 = new QBlock(lu); diff --git a/src/net/sourceforge/plantuml/version/PSystemKeygen.java b/src/net/sourceforge/plantuml/version/PSystemKeygen.java index 2693ac8d5..929728cd2 100644 --- a/src/net/sourceforge/plantuml/version/PSystemKeygen.java +++ b/src/net/sourceforge/plantuml/version/PSystemKeygen.java @@ -90,13 +90,14 @@ public class PSystemKeygen extends AbstractPSystem { } private void drawInternal(UGraphic ug) throws IOException { + final LicenseInfo installed = LicenseInfo.retrieveSlow(); if (key.length() == 0) { - drawFlash(ug); + drawFlash(ug, installed); return; } final LicenseInfo info = LicenseInfo.retrieve(key); if (info.isNone()) { - drawFlash(ug); + drawFlash(ug, installed); return; } final List strings = header(); @@ -110,7 +111,6 @@ public class PSystemKeygen extends AbstractPSystem { strings.add("Error: Cannot store license key."); } - final LicenseInfo installed = LicenseInfo.retrieveSlow(); if (installed.isNone()) { strings.add("No license currently installed."); strings.add(" "); @@ -138,7 +138,7 @@ public class PSystemKeygen extends AbstractPSystem { return strings; } - public void drawFlash(UGraphic ug) throws IOException { + private void drawFlash(UGraphic ug, LicenseInfo info) throws IOException { final List strings = header(); strings.add("To get your Professional Edition License,"); strings.add("please send this flashcode to plantuml@gmail.com :"); @@ -150,12 +150,12 @@ public class PSystemKeygen extends AbstractPSystem { final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); final BufferedImage im = utils.exportFlashcode(Version.versionString() + "\n" + SignatureUtils.toHexString(Magic.signature())); - final UImage flash = new UImage(im).scaleNearestNeighbor(4); - ug.draw(flash); + if (im != null) { + final UImage flash = new UImage(im).scaleNearestNeighbor(4); + ug.draw(flash); + ug = ug.apply(new UTranslate(0, flash.getHeight())); + } - ug = ug.apply(new UTranslate(0, flash.getHeight())); - - final LicenseInfo info = LicenseInfo.retrieveSlow(); if (info.isNone() == false) { strings.clear(); strings.add("Installed license:"); diff --git a/src/net/sourceforge/plantuml/version/PSystemLicense.java b/src/net/sourceforge/plantuml/version/PSystemLicense.java index fb145ec80..689624509 100644 --- a/src/net/sourceforge/plantuml/version/PSystemLicense.java +++ b/src/net/sourceforge/plantuml/version/PSystemLicense.java @@ -53,7 +53,7 @@ public class PSystemLicense extends AbstractPSystem { private final List strings = new ArrayList(); PSystemLicense() throws IOException { - strings.addAll(License.getCurrent().getText()); + strings.addAll(License.getCurrent().getText(true)); } @Override diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 8bc63d19c..40468f8b9 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -43,7 +43,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1201809; + return 1201810; } public static int versionPatched() { @@ -88,7 +88,7 @@ public class Version { } public static long compileTime() { - return 1532710698423L; + return 1535216579971L; } public static String compileTimeString() { diff --git a/stdlib/devicons-abx.repx b/stdlib/devicons-abx.repx deleted file mode 100644 index 0b444fcc3..000000000 Binary files a/stdlib/devicons-abx.repx and /dev/null differ diff --git a/stdlib/devicons-dex.repx b/stdlib/devicons-dex.repx deleted file mode 100644 index 85a474b37..000000000 Binary files a/stdlib/devicons-dex.repx and /dev/null differ diff --git a/stdlib/font-awesome-abx.repx b/stdlib/font-awesome-abx.repx deleted file mode 100644 index f9657323a..000000000 Binary files a/stdlib/font-awesome-abx.repx and /dev/null differ diff --git a/stdlib/font-awesome-dex.repx b/stdlib/font-awesome-dex.repx deleted file mode 100644 index 5b6824a14..000000000 Binary files a/stdlib/font-awesome-dex.repx and /dev/null differ diff --git a/stdlib/home.repx b/stdlib/home.repx index 81206b6be..518c1fc3b 100644 --- a/stdlib/home.repx +++ b/stdlib/home.repx @@ -1,7 +1,6 @@ aws cloudinsight cloudogu -devicons -font-awesome +tupadr3 material office diff --git a/stdlib/tupadr3-abx.repx b/stdlib/tupadr3-abx.repx new file mode 100644 index 000000000..e9062e44c Binary files /dev/null and b/stdlib/tupadr3-abx.repx differ diff --git a/stdlib/tupadr3-dex.repx b/stdlib/tupadr3-dex.repx new file mode 100644 index 000000000..b0d404a9b Binary files /dev/null and b/stdlib/tupadr3-dex.repx differ