diff --git a/src/net/sourceforge/plantuml/creole/atom/AtomImg.java b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java index 3a0f1a2fe..028e9fb8b 100644 --- a/src/net/sourceforge/plantuml/creole/atom/AtomImg.java +++ b/src/net/sourceforge/plantuml/creole/atom/AtomImg.java @@ -67,7 +67,7 @@ import net.sourceforge.plantuml.ugraphic.UImage; public class AtomImg extends AbstractAtom implements Atom { - private static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,"; + public static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,"; private static final String DATA_IMAGE_SVG_BASE64 = "data:image/svg+xml;base64,"; private final BufferedImage image; private final double scale; diff --git a/src/net/sourceforge/plantuml/cucadiagram/StereotypeDecoration.java b/src/net/sourceforge/plantuml/cucadiagram/StereotypeDecoration.java index 76e7c4bac..44530cf38 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/StereotypeDecoration.java +++ b/src/net/sourceforge/plantuml/cucadiagram/StereotypeDecoration.java @@ -89,6 +89,8 @@ public class StereotypeDecoration { new RegexLeaf("\\>\\>") // ); + public static final String PREFIX = "%"; + final String label; final HColor htmlColor; final char character; @@ -101,13 +103,15 @@ public class StereotypeDecoration { } public List getStyleNames() { - final List result = new ArrayList<>(cutLabels(label, Guillemet.NONE)); + final List result = new ArrayList<>(); + for (String s : cutLabels(label, Guillemet.NONE)) + result.add(PREFIX + s); if (spriteName == null) return Collections.unmodifiableList(result); final int idx = spriteName.lastIndexOf('/'); if (idx != -1) - result.add(spriteName.substring(idx + 1)); + result.add(PREFIX + spriteName.substring(idx + 1)); return Collections.unmodifiableList(result); } diff --git a/src/net/sourceforge/plantuml/mindmap/Idea.java b/src/net/sourceforge/plantuml/mindmap/Idea.java index a56a38ac9..0a44a0d0c 100644 --- a/src/net/sourceforge/plantuml/mindmap/Idea.java +++ b/src/net/sourceforge/plantuml/mindmap/Idea.java @@ -64,22 +64,22 @@ class Idea { final String depth = SName.depth(level); if (level == 0) return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode) - .add(stereotype).add(depth); + .addS(stereotype).add(depth); if (shape == IdeaShape.NONE && children.size() == 0) return StyleSignatureBasic .of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode, SName.boxless) - .add(stereotype).add(depth); + .addS(stereotype).add(depth); if (shape == IdeaShape.NONE) return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.boxless) - .add(stereotype).add(depth); + .addS(stereotype).add(depth); if (children.size() == 0) return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode) - .add(stereotype).add(depth); + .addS(stereotype).add(depth); - return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node).add(stereotype) + return StyleSignatureBasic.of(SName.root, SName.element, SName.mindmapDiagram, SName.node).addS(stereotype) .add(depth); } @@ -100,7 +100,7 @@ class Idea { public Style getStyleArrow() { final String depth = SName.depth(level); final StyleSignatureBasic defaultStyleDefinitionArrow = StyleSignatureBasic - .of(SName.root, SName.element, SName.mindmapDiagram, SName.arrow).add(stereotype).add(depth); + .of(SName.root, SName.element, SName.mindmapDiagram, SName.arrow).addS(stereotype).add(depth); return defaultStyleDefinitionArrow.getMergedStyle(styleBuilder); } diff --git a/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java b/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java index 1c1a35271..d629c905b 100644 --- a/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java +++ b/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java @@ -43,6 +43,8 @@ import java.util.List; import java.util.Map; import java.util.StringTokenizer; +import net.sourceforge.plantuml.cucadiagram.StereotypeDecoration; + public class FromSkinparamToStyle { static class Data { @@ -220,9 +222,8 @@ public class FromSkinparamToStyle { addConvert("IconProtectedBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.protected_); addConvert("IconPublicColor", PName.LineColor, SName.visibilityIcon, SName.public_); addConvert("IconPublicBackgroundColor", PName.BackGroundColor, SName.visibilityIcon, SName.public_); - - addConvert("MinClassWidth", PName.MinimumWidth); + addConvert("MinClassWidth", PName.MinimumWidth); // addConvert("nodeStereotypeFontSize", PName.FontSize, SName.node, SName.stereotype); // addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype); @@ -356,7 +357,7 @@ public class FromSkinparamToStyle { if (stereo != null) { map = StyleLoader.addPriorityForStereotype(map); for (String s : stereo.split("\\&")) - sig = sig.add(s); + sig = sig.add(StereotypeDecoration.PREFIX + s); } final Style style = new Style(sig, map); diff --git a/src/net/sourceforge/plantuml/style/SName.java b/src/net/sourceforge/plantuml/style/SName.java index 9dc9c659c..52fd468b8 100644 --- a/src/net/sourceforge/plantuml/style/SName.java +++ b/src/net/sourceforge/plantuml/style/SName.java @@ -130,6 +130,7 @@ public enum SName { storage, // swimlane, // task, // + timegrid, // timeline, // timingDiagram, // title, // diff --git a/src/net/sourceforge/plantuml/style/StyleSignatureBasic.java b/src/net/sourceforge/plantuml/style/StyleSignatureBasic.java index de697cd15..580742924 100644 --- a/src/net/sourceforge/plantuml/style/StyleSignatureBasic.java +++ b/src/net/sourceforge/plantuml/style/StyleSignatureBasic.java @@ -45,6 +45,7 @@ import java.util.Set; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.cucadiagram.Stereostyles; import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.cucadiagram.StereotypeDecoration; public class StyleSignatureBasic implements StyleSignature { @@ -94,6 +95,18 @@ public class StyleSignatureBasic implements StyleSignature { return new StyleSignatureBasic(withDot || s.contains("."), result); } + public StyleSignatureBasic addS(String s) { + if (s == null) + return this; + + if (s.contains("&")) + throw new IllegalArgumentException(); + + final Set result = new LinkedHashSet<>(names); + result.add(StereotypeDecoration.PREFIX + clean(s)); + return new StyleSignatureBasic(withDot || s.contains("."), result); + } + public StyleSignatureBasic add(SName name) { return add(name.name().toLowerCase().replace("_", "")); } @@ -218,12 +231,15 @@ public class StyleSignatureBasic implements StyleSignature { return this; final List result = new ArrayList<>(names); for (String name : stereostyles.getStyleNames()) - result.add(clean(name)); + result.add(StereotypeDecoration.PREFIX + clean(name)); return new StyleSignatureBasic(true, result); } private String clean(String name) { + if (name.startsWith(".")) + name = StereotypeDecoration.PREFIX + name; + return name.toLowerCase().replace("_", "").replace(".", ""); } diff --git a/src/net/sourceforge/plantuml/tim/TContext.java b/src/net/sourceforge/plantuml/tim/TContext.java index 5d7a55c28..fa3919457 100644 --- a/src/net/sourceforge/plantuml/tim/TContext.java +++ b/src/net/sourceforge/plantuml/tim/TContext.java @@ -266,9 +266,9 @@ public class TContext { try { while ((s = it.peek()) != null) { final TValue result = executeOneLineSafe(memory, s, ftype, modeSpecial); - if (result != null) { + if (result != null) return result; - } + it.next(); } return null; @@ -428,9 +428,9 @@ public class TContext { // https://en.wikipedia.org/wiki/String-searching_algorithm // https://www.quora.com/What-is-the-most-efficient-algorithm-to-replace-all-occurrences-of-a-pattern-P-in-a-string-with-a-pattern-P // https://en.wikipedia.org/wiki/Trie - if (memory.isEmpty() && functionsSet.size() == 0) { + if (memory.isEmpty() && functionsSet.size() == 0) return str; - } + final StringBuilder result = new StringBuilder(); for (int i = 0; i < str.length(); i++) { final char c = str.charAt(i); diff --git a/src/net/sourceforge/plantuml/tim/expression/ShuntingYard.java b/src/net/sourceforge/plantuml/tim/expression/ShuntingYard.java index f28892627..84b3a1562 100644 --- a/src/net/sourceforge/plantuml/tim/expression/ShuntingYard.java +++ b/src/net/sourceforge/plantuml/tim/expression/ShuntingYard.java @@ -94,6 +94,9 @@ public class ShuntingYard { } else if (token.getTokenType() == TokenType.OPEN_PAREN_MATH) { operatorStack.addFirst(token); } else if (token.getTokenType() == TokenType.CLOSE_PAREN_FUNC) { + while (operatorStack.peekFirst() != null + && operatorStack.peekFirst().getTokenType() != TokenType.OPEN_PAREN_FUNC) + ouputQueue.add(operatorStack.removeFirst()); final Token first = operatorStack.removeFirst(); ouputQueue.add(first); } else if (token.getTokenType() == TokenType.CLOSE_PAREN_MATH) { diff --git a/src/net/sourceforge/plantuml/tim/stdlib/Substr.java b/src/net/sourceforge/plantuml/tim/stdlib/Substr.java index 1e4c556dc..6ddcf86de 100644 --- a/src/net/sourceforge/plantuml/tim/stdlib/Substr.java +++ b/src/net/sourceforge/plantuml/tim/stdlib/Substr.java @@ -60,15 +60,15 @@ public class Substr extends SimpleReturnFunction { Map named) throws EaterException, EaterExceptionLocated { final String full = values.get(0).toString(); final int pos = values.get(1).toInt(); - if (pos >= full.length()) { + if (pos >= full.length()) return TValue.fromString(""); - } + String result = full.substring(pos); if (values.size() == 3) { final int len = values.get(2).toInt(); - if (len < result.length()) { + if (len < result.length()) result = result.substring(0, len); - } + } return TValue.fromString(result); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java index 8580afba4..19c4b8ab1 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerAnalog.java @@ -170,7 +170,7 @@ public class PlayerAnalog extends Player { @Override public void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) { - this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config)); + this.constraints.add(new TimeConstraint(1, tick1, tick2, message, skinParam, config)); } private double getYpos(StringBounder stringBounder, double value) { diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java index 520979813..351e2a5cb 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java @@ -128,7 +128,7 @@ public class PlayerBinary extends Player { @Override public void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) { - this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config)); + this.constraints.add(new TimeConstraint(2.5, tick1, tick2, message, skinParam, config)); } private final double ymargin = 8; diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java index e42f6ef0e..98928b762 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerRobustConcise.java @@ -83,6 +83,12 @@ public final class PlayerRobustConcise extends Player { this.suggestedHeight = 0; } + @Override + public final void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) { + final double margin = type == TimingStyle.ROBUST ? 2.5 : 1; + this.constraints.add(new TimeConstraint(margin, tick1, tick2, message, skinParam, config)); + } + @Override protected StyleSignature getStyleSignature() { if (type == TimingStyle.CONCISE) @@ -205,11 +211,6 @@ public final class PlayerRobustConcise extends Player { return point.translated(translation); } - @Override - public final void createConstraint(TimeTick tick1, TimeTick tick2, String message, ArrowConfiguration config) { - this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam, config)); - } - public final void addNote(TimeTick now, Display note, Position position) { final StyleSignatureBasic signature = StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java index f11a6c197..7c25942e3 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimeConstraint.java @@ -52,7 +52,6 @@ import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignatureBasic; -import net.sourceforge.plantuml.timingdiagram.graphic.TimeArrow; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -68,9 +67,11 @@ public class TimeConstraint { private final ISkinParam skinParam; private final StyleBuilder styleBuilder; private final ArrowConfiguration config; + private final double marginx; - public TimeConstraint(TimeTick tick1, TimeTick tick2, String label, ISkinParam skinParam, + public TimeConstraint(double marginx, TimeTick tick1, TimeTick tick2, String label, ISkinParam skinParam, ArrowConfiguration config) { + this.marginx = marginx; this.tick1 = Objects.requireNonNull(tick1); this.tick2 = Objects.requireNonNull(tick2); this.label = Display.getWithNewlines(label); @@ -106,8 +107,8 @@ public class TimeConstraint { public void drawU(UGraphic ug, TimingRuler ruler) { final HColor arrowColor = getArrowColor(); ug = ug.apply(arrowColor).apply(arrowColor.bg()); - final double x1 = ruler.getPosInPixel(tick1); - final double x2 = ruler.getPosInPixel(tick2); + final double x1 = ruler.getPosInPixel(tick1) + marginx; + final double x2 = ruler.getPosInPixel(tick2) - marginx; ug = ug.apply(UTranslate.dx(x1)); final double len = x2 - x1; ug.apply(getUStroke()).draw(ULine.hline(len)); diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java index 533ae7f47..cf58efe18 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java @@ -177,11 +177,12 @@ public class TimingRuler { } - private FontConfiguration getFontConfiguration() { - return FontConfiguration.create(skinParam, getStyle()); + private Style getStyleTimegrid() { + return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.timegrid) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); } - private Style getStyle() { + private Style getStyleTimeline() { return StyleSignatureBasic.of(SName.root, SName.element, SName.timingDiagram, SName.timeline) .getMergedStyle(skinParam.getCurrentStyleBuilder()); } @@ -192,18 +193,19 @@ public class TimingRuler { private TextBlock getTimeTextBlock(String string) { final Display display = Display.getWithNewlines(string); - return display.create(getFontConfiguration(), HorizontalAlignment.LEFT, skinParam); + final FontConfiguration fontConfiguration = FontConfiguration.create(skinParam, getStyleTimeline()); + return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam); } public void drawTimeAxis(UGraphic ug, TimeAxisStategy timeAxisStategy, Map codes) { if (timeAxisStategy == TimeAxisStategy.HIDDEN) return; - final Style style = StyleSignatureBasic.of(SName.root, SName.timingDiagram, SName.timeline) - .getMergedStyle(skinParam.getCurrentStyleBuilder()); + final Style styleTimeline = getStyleTimeline(); + final Style styleTimegrid = getStyleTimegrid(); - final HColor color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); - final UStroke stroke = style.getStroke(); + final HColor color = styleTimeline.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + final UStroke stroke = styleTimeline.getStroke(); ug = ug.apply(stroke).apply(color); @@ -291,7 +293,7 @@ public class TimingRuler { } public void drawVlines(UGraphic ug, double height) { - ug = applyForVLines(ug, getStyle(), skinParam); + ug = applyForVLines(ug, getStyleTimegrid(), skinParam); final ULine line = ULine.vline(height); final int nb = getNbTick(); for (int i = 0; i <= nb; i++) diff --git a/src/net/sourceforge/plantuml/wbs/WElement.java b/src/net/sourceforge/plantuml/wbs/WElement.java index 6a0804f5c..fdb7d3826 100644 --- a/src/net/sourceforge/plantuml/wbs/WElement.java +++ b/src/net/sourceforge/plantuml/wbs/WElement.java @@ -70,22 +70,22 @@ final public class WElement { final String depth = SName.depth(level); if (level == 0) return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.rootNode) - .add(stereotype).add(depth); + .addS(stereotype).add(depth); if (shape == IdeaShape.NONE && isLeaf()) return StyleSignatureBasic .of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.leafNode, SName.boxless) - .add(stereotype).add(depth); + .addS(stereotype).add(depth); if (isLeaf()) return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.leafNode) - .add(stereotype).add(depth); + .addS(stereotype).add(depth); if (shape == IdeaShape.NONE) return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.boxless) - .add(stereotype).add(depth); + .addS(stereotype).add(depth); - return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node).add(stereotype).add(depth); + return StyleSignatureBasic.of(SName.root, SName.element, SName.wbsDiagram, SName.node).addS(stereotype).add(depth); } public ISkinParam withBackColor(ISkinParam skinParam) { diff --git a/stdlib/awslib-abx.repx b/stdlib/awslib-abx.repx index 82d90d80d..5761d1159 100644 Binary files a/stdlib/awslib-abx.repx and b/stdlib/awslib-abx.repx differ diff --git a/stdlib/awslib10-abx.repx b/stdlib/awslib10-abx.repx new file mode 100644 index 000000000..27a29fceb Binary files /dev/null and b/stdlib/awslib10-abx.repx differ diff --git a/stdlib/awslib10-dex.repx b/stdlib/awslib10-dex.repx new file mode 100644 index 000000000..4e21d173b Binary files /dev/null and b/stdlib/awslib10-dex.repx differ diff --git a/stdlib/awslib14-abx.repx b/stdlib/awslib14-abx.repx new file mode 100644 index 000000000..f27de6a87 Binary files /dev/null and b/stdlib/awslib14-abx.repx differ diff --git a/stdlib/awslib14-dex.repx b/stdlib/awslib14-dex.repx new file mode 100644 index 000000000..273d458af Binary files /dev/null and b/stdlib/awslib14-dex.repx differ