From eea48055d326423a6f29120a3d36fbe0c04216b1 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Sun, 7 Mar 2021 13:23:24 +0100 Subject: [PATCH] Import version 1.2021.2 --- pom.xml | 5 +-- skin/plantuml.skin | 3 ++ .../plantuml/cucadiagram/Link.java | 10 +++++ .../plantuml/cucadiagram/LinkType.java | 44 +++++++++---------- .../command/CommandLinkElement.java | 10 ++++- .../plantuml/eggs/PSystemWelcome.java | 4 +- .../plantuml/graphic/QuoteUtils.java | 13 +++--- .../plantuml/graphic/SkinParameter.java | 25 ++++++----- .../plantuml/graphic/UGraphicDelegator.java | 9 ++-- .../plantuml/jsondiagram/SmetanaForJson.java | 15 +++++-- .../plantuml/jsondiagram/TextBlockJson.java | 33 ++++++++++---- .../plantuml/mindmap/FingerImpl.java | 15 +++++-- src/net/sourceforge/plantuml/style/SName.java | 2 + .../plantuml/svek/GeneralImageBuilder.java | 27 ++++++------ src/net/sourceforge/plantuml/svek/Line.java | 20 +++++++-- .../sourceforge/plantuml/svek/SvekResult.java | 28 ++++++++---- .../svek/image/EntityImageDescription.java | 29 ++++++------ .../plantuml/svek/image/EntityImageNote.java | 5 ++- .../plantuml/svek/image/EntityImageState.java | 3 +- .../svek/image/EntityImageUseCase.java | 17 ++++--- .../sourceforge/plantuml/svg/SvgGraphics.java | 37 +++++++++------- .../ugraphic/AbstractCommonUGraphic.java | 6 +-- .../plantuml/ugraphic/UGraphic.java | 4 +- .../plantuml/ugraphic/UGraphicNo.java | 5 +-- .../plantuml/ugraphic/UGroupType.java | 41 +++++++++++++++++ .../plantuml/ugraphic/svg/UGraphicSvg.java | 10 ++--- .../sourceforge/plantuml/version/Version.java | 6 +-- .../plantuml/wbs/CommandWBSOrgmode.java | 6 ++- src/net/sourceforge/plantuml/wbs/ITFLeaf.java | 10 ++--- .../plantuml/wbs/WBSTextBlock.java | 16 ++----- .../sourceforge/plantuml/wbs/WElement.java | 9 ++++ 31 files changed, 289 insertions(+), 178 deletions(-) create mode 100644 src/net/sourceforge/plantuml/ugraphic/UGroupType.java diff --git a/pom.xml b/pom.xml index d85939c05..6aab2d9ff 100644 --- a/pom.xml +++ b/pom.xml @@ -30,13 +30,12 @@ Script Author: Julien Eluard --> - + 4.0.0 net.sourceforge.plantuml plantuml - 1.2021.1-SNAPSHOT + 1.2021.3-SNAPSHOT jar PlantUML diff --git a/skin/plantuml.skin b/skin/plantuml.skin index 20452bd5d..da3569d17 100644 --- a/skin/plantuml.skin +++ b/skin/plantuml.skin @@ -311,6 +311,9 @@ jsonDiagram { LineThickness 1 LineColor #A80036 } + highlight { + BackGroundColor #ccff02 + } } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Link.java b/src/net/sourceforge/plantuml/cucadiagram/Link.java index b7d3c91fd..892f7ba7f 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Link.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Link.java @@ -98,6 +98,7 @@ public class Link extends WithLinkType implements Hideable, Removeable { private String sametail; private VisibilityModifier visibilityModifier; private final StyleBuilder styleBuilder; + private Stereotype stereotype; private Url url; @@ -197,6 +198,7 @@ public class Link extends WithLinkType implements Hideable, Removeable { result.port2 = this.port1; result.url = this.url; result.linkConstraint = this.linkConstraint; + result.stereotype = stereotype; return result; } @@ -595,4 +597,12 @@ public class Link extends WithLinkType implements Hideable, Removeable { this.codeLine = location; } + public void setStereotype(Stereotype stereotype) { + this.stereotype = stereotype; + } + + public final Stereotype getStereotype() { + return stereotype; + } + } diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkType.java b/src/net/sourceforge/plantuml/cucadiagram/LinkType.java index 711dbb1fa..1b30a42ed 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkType.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkType.java @@ -42,7 +42,7 @@ public class LinkType { private final LinkHat hat1; private final LinkDecor decor1; - private final LinkStyle style; + private final LinkStyle linkStyle; private final LinkDecor decor2; private final LinkHat hat2; private final LinkMiddleDecor middleDecor; @@ -77,11 +77,11 @@ public class LinkType { } public LinkType withoutDecors1() { - return new LinkType(hat1, LinkDecor.NONE, style, middleDecor, decor2, hat2); + return new LinkType(hat1, LinkDecor.NONE, linkStyle, middleDecor, decor2, hat2); } public LinkType withoutDecors2() { - return new LinkType(hat1, decor1, style, middleDecor, LinkDecor.NONE, hat2); + return new LinkType(hat1, decor1, linkStyle, middleDecor, LinkDecor.NONE, hat2); } // public boolean contains(LinkDecor decors) { @@ -90,7 +90,7 @@ public class LinkType { @Override public String toString() { - return decor1 + "-" + style + "-" + decor2; + return decor1 + "-" + linkStyle + "-" + decor2; } @Override @@ -101,7 +101,7 @@ public class LinkType { @Override public boolean equals(Object obj) { final LinkType other = (LinkType) obj; - return this.decor1 == other.decor1 && this.decor2 == other.decor2 && this.style == other.style; + return this.decor1 == other.decor1 && this.decor2 == other.decor2 && this.linkStyle == other.linkStyle; } private LinkType(LinkHat hat1, LinkDecor decor1, LinkStyle style, LinkMiddleDecor middleDecor, LinkDecor decor2, @@ -110,7 +110,7 @@ public class LinkType { throw new IllegalArgumentException(); } this.decor1 = decor1; - this.style = style; + this.linkStyle = style; this.decor2 = decor2; this.middleDecor = middleDecor; this.hat1 = hat1; @@ -118,7 +118,7 @@ public class LinkType { } public boolean isInvisible() { - return style.isInvisible(); + return linkStyle.isInvisible(); } public LinkType goDashed() { @@ -130,7 +130,7 @@ public class LinkType { } public LinkType goThickness(double thickness) { - return new LinkType(hat1, decor1, style.goThickness(thickness), middleDecor, decor2, hat2); + return new LinkType(hat1, decor1, linkStyle.goThickness(thickness), middleDecor, decor2, hat2); } public LinkType goBold() { @@ -138,23 +138,23 @@ public class LinkType { } public LinkType getInversed() { - return new LinkType(hat2, decor2, style, middleDecor.getInversed(), decor1, hat1); + return new LinkType(hat2, decor2, linkStyle, middleDecor.getInversed(), decor1, hat1); } public LinkType withMiddleCircle() { - return new LinkType(hat1, decor1, style, LinkMiddleDecor.CIRCLE, decor2, hat2); + return new LinkType(hat1, decor1, linkStyle, LinkMiddleDecor.CIRCLE, decor2, hat2); } public LinkType withMiddleCircleCircled() { - return new LinkType(hat1, decor1, style, LinkMiddleDecor.CIRCLE_CIRCLED, decor2, hat2); + return new LinkType(hat1, decor1, linkStyle, LinkMiddleDecor.CIRCLE_CIRCLED, decor2, hat2); } public LinkType withMiddleCircleCircled1() { - return new LinkType(hat1, decor1, style, LinkMiddleDecor.CIRCLE_CIRCLED1, decor2, hat2); + return new LinkType(hat1, decor1, linkStyle, LinkMiddleDecor.CIRCLE_CIRCLED1, decor2, hat2); } public LinkType withMiddleCircleCircled2() { - return new LinkType(hat1, decor1, style, LinkMiddleDecor.CIRCLE_CIRCLED2, decor2, hat2); + return new LinkType(hat1, decor1, linkStyle, LinkMiddleDecor.CIRCLE_CIRCLED2, decor2, hat2); } public LinkType getInvisible() { @@ -198,7 +198,7 @@ public class LinkType { } public final LinkStyle getStyle() { - return style; + return linkStyle; } public final LinkDecor getDecor2() { @@ -228,21 +228,21 @@ public class LinkType { } public LinkType getPart1() { - return new LinkType(hat1, decor1, style, middleDecor, LinkDecor.NONE, LinkHat.NONE); + return new LinkType(hat1, decor1, linkStyle, middleDecor, LinkDecor.NONE, LinkHat.NONE); } public LinkType getPart2() { - return new LinkType(LinkHat.NONE, LinkDecor.NONE, style, middleDecor, decor2, hat2); + return new LinkType(LinkHat.NONE, LinkDecor.NONE, linkStyle, middleDecor, decor2, hat2); } public UStroke getStroke3(UStroke defaultThickness) { - if (style.isThicknessOverrided()) { - return style.getStroke3(); + if (linkStyle.isThicknessOverrided()) { + return linkStyle.getStroke3(); } if (defaultThickness == null) { - return style.getStroke3(); + return linkStyle.getStroke3(); } - return style.goThickness(defaultThickness.getThickness()).getStroke3(); + return linkStyle.goThickness(defaultThickness.getThickness()).getStroke3(); } public LinkMiddleDecor getMiddleDecor() { @@ -258,11 +258,11 @@ public class LinkType { } public LinkType withLollipopInterfaceEye2() { - return new LinkType(hat1, LinkDecor.NONE, style, middleDecor, decor2, hat2); + return new LinkType(hat1, LinkDecor.NONE, linkStyle, middleDecor, decor2, hat2); } public LinkType withLollipopInterfaceEye1() { - return new LinkType(hat1, decor1, style, middleDecor, LinkDecor.NONE, hat2); + return new LinkType(hat1, decor1, linkStyle, middleDecor, LinkDecor.NONE, hat2); } } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java index e6e522b49..20f48ff06 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandLinkElement.java @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -227,7 +228,8 @@ public class CommandLinkElement extends SingleLineCommand2 { } @Override - protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { + protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) + throws NoSuchColorException { final String ent1String = arg.get("ENT1", 0); final String ent2String = arg.get("ENT2", 0); final Ident ident1 = diagram.buildFullyQualified(ent1String); @@ -269,7 +271,11 @@ public class CommandLinkElement extends SingleLineCommand2 { link.applyStyle(arg.getLazzy("ARROW_STYLE", 0)); if (arg.get("STEREOTYPE", 0) != null) { final Stereotype stereotype = new Stereotype(arg.get("STEREOTYPE", 0)); - link.setColors(link.getColors().applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.arrow)); + if (UseStyle.useBetaStyle()) { + link.setStereotype(stereotype); + } else { + link.setColors(link.getColors().applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.arrow)); + } } diagram.addLink(link); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java b/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java index ec8cf2097..4a3d0c2aa 100644 --- a/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java +++ b/src/net/sourceforge/plantuml/eggs/PSystemWelcome.java @@ -73,8 +73,8 @@ public class PSystemWelcome extends AbstractPSystem { strings.add(" "); strings.add("You will find more information about PlantUML syntax on https://plantuml.com"); strings.add(" "); - strings.add("(If you use this software, you accept its license.)"); - strings.add("(details by typing \"\"license\"\" keyword)"); + strings.add("(If you use this software, you accept its license)"); + strings.add("(Details by typing \"\"license\"\" keyword)"); strings.add(" "); if (position == GraphicPosition.BACKGROUND_CORNER_BOTTOM_RIGHT) { strings.add(" "); diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java index 73371b4a9..6b4194bdd 100644 --- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java +++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java @@ -214,8 +214,8 @@ public class QuoteUtils { "Gur zber vg snvyf, gur zber yvxryl vg vf gung vg jvyy jbex", "V ubcr V qvqa'g gnxr hc gbb zhpu bs lbhe gvzr", "Lbh'er tbaan arrq n ovttre obng", "Dhnaq ibhf rgrf rzorgrf, rzoebhvyyrm gbhg", "Gurer nva'g ab phevat jung'f jebat jvgu gung guvat", - "Vs lbh cevpx hf, qb jr abg oyrrq?", "V qvq lbhe wbo bapr - V jnf tbbq ng vg.", - "Vyf cbheenvrag snver har fryrpgvba nh fgnaqneq...", "Gung'f ab jnl gb gerng n sevraq.", + "V qvq lbhe wbo bapr - V jnf tbbq ng vg.", "Vyf cbheenvrag snver har fryrpgvba nh fgnaqneq...", + "Gung'f ab jnl gb gerng n sevraq.", "Ubjrire ornhgvshy gur fgengrtl, lbh fubhyq bppnfvbanyyl ybbx ng gur erfhygf", "Qba'g svk vg vs vg'f abg oebxra", "Fhqqrayl V'z gnxvat fhttrfgvbaf sebz fbzr fgebat-nez zna jvgu na VD bs zvahf 50.", @@ -288,9 +288,12 @@ public class QuoteUtils { "Gunax lbh, lbh'ir znqr lbhe cbvag pyrne gung lbh oryvrir vg vf n qrongnoyr cbvag", "Gur obng vf fnsre jura va cbeg, ohg gung vf abg jung obngf jrer ohvyg sbe.", "Vg'f abg gernfba. Vg'f nygreangvir yblnygl", - "Gur zna jub zbirf n zbhagnva ortvaf ol pneelvat njnl fznyy fgbarf" - - ); + "Gur zna jub zbirf n zbhagnva ortvaf ol pneelvat njnl fznyy fgbarf", + "Gbhpuqbja pbasvezrq, jr ner fnsr ba Znef", "Yrg'f fcyvg hc, jr pna qb zber qnzntr gung jnl", + "Gebyy gur erfcnja, Wrerzl", "Bhoyvr dhr g'nf nhphar punapr. Fhe ha znyragraqh pn crhg znepure.", + "Obl, gur fhcrevagraqrag'f tbaan or cvffrq!", "BX, jub oebhtug gur qbt?", "Rg yn, p'rfg yr qenzr...", + "V'z shmml ba gur jubyr tbbq/onq guvat. Jung qb lbh zrna, 'onq'?", + "Lbh'er evtug. Ab uhzna orvat jbhyq fgnpx obbxf yvxr guvf."); private QuoteUtils() { } diff --git a/src/net/sourceforge/plantuml/graphic/SkinParameter.java b/src/net/sourceforge/plantuml/graphic/SkinParameter.java index e7ec28b85..239063952 100644 --- a/src/net/sourceforge/plantuml/graphic/SkinParameter.java +++ b/src/net/sourceforge/plantuml/graphic/SkinParameter.java @@ -56,7 +56,7 @@ public class SkinParameter { public static final SkinParameter COMPONENT1 = new SkinParameter(SName.component, "COMPONENT1", ColorParam.componentBackground, ColorParam.componentBorder, FontParam.COMPONENT, - FontParam.COMPONENT_STEREOTYPE, LineParam.componentBorder, CornerParam.component); + FontParam.COMPONENT_STEREOTYPE, CornerParam.component, LineParam.componentBorder); public static final SkinParameter NODE = new SkinParameter(SName.node, "NODE", ColorParam.nodeBackground, ColorParam.nodeBorder, FontParam.NODE, FontParam.NODE_STEREOTYPE); @@ -78,11 +78,11 @@ public class SkinParameter { public static final SkinParameter COMPONENT2 = new SkinParameter(SName.component, "COMPONENT2", ColorParam.componentBackground, ColorParam.componentBorder, FontParam.COMPONENT, - FontParam.COMPONENT_STEREOTYPE, LineParam.componentBorder, CornerParam.component); + FontParam.COMPONENT_STEREOTYPE, CornerParam.component, LineParam.componentBorder); public static final SkinParameter AGENT = new SkinParameter(SName.agent, "AGENT", ColorParam.agentBackground, - ColorParam.agentBorder, FontParam.AGENT, FontParam.AGENT_STEREOTYPE, LineParam.agentBorder, - CornerParam.agent); + ColorParam.agentBorder, FontParam.AGENT, FontParam.AGENT_STEREOTYPE, CornerParam.agent, + LineParam.agentBorder); public static final SkinParameter FOLDER = new SkinParameter(SName.folder, "FOLDER", ColorParam.folderBackground, ColorParam.folderBorder, FontParam.FOLDER, FontParam.FOLDER_STEREOTYPE); @@ -91,25 +91,26 @@ public class SkinParameter { ColorParam.fileBorder, FontParam.FILE, FontParam.FILE_STEREOTYPE); public static final SkinParameter PACKAGE = new SkinParameter(SName.package_, "PACKAGE", - ColorParam.packageBackground, ColorParam.packageBorder, FontParam.PACKAGE, FontParam.PACKAGE_STEREOTYPE); + ColorParam.packageBackground, ColorParam.packageBorder, FontParam.PACKAGE, FontParam.PACKAGE_STEREOTYPE, + CornerParam.DEFAULT, LineParam.packageBorder); public static final SkinParameter CARD = new SkinParameter(SName.card, "CARD", ColorParam.cardBackground, - ColorParam.cardBorder, FontParam.CARD, FontParam.CARD_STEREOTYPE, LineParam.cardBorder, CornerParam.card); + ColorParam.cardBorder, FontParam.CARD, FontParam.CARD_STEREOTYPE, CornerParam.card, LineParam.cardBorder); public static final SkinParameter RECTANGLE = new SkinParameter(SName.rectangle, "RECTANGLE", ColorParam.rectangleBackground, ColorParam.rectangleBorder, FontParam.RECTANGLE, - FontParam.RECTANGLE_STEREOTYPE, LineParam.rectangleBorder, CornerParam.rectangle); + FontParam.RECTANGLE_STEREOTYPE, CornerParam.rectangle, LineParam.rectangleBorder); public static final SkinParameter LABEL = new SkinParameter(SName.label, "LABEL", ColorParam.rectangleBackground, ColorParam.rectangleBorder, FontParam.LABEL, FontParam.LABEL_STEREOTYPE); public static final SkinParameter HEXAGON = new SkinParameter(SName.rectangle, "HEXAGON", ColorParam.hexagonBackground, ColorParam.hexagonBorder, FontParam.HEXAGON, FontParam.HEXAGON_STEREOTYPE, - LineParam.hexagonBorder, CornerParam.hexagon); + CornerParam.hexagon, LineParam.hexagonBorder); public static final SkinParameter ARCHIMATE = new SkinParameter(SName.archimate, "ARCHIMATE", ColorParam.archimateBackground, ColorParam.archimateBorder, FontParam.ARCHIMATE, - FontParam.ARCHIMATE_STEREOTYPE, LineParam.archimateBorder, CornerParam.archimate); + FontParam.ARCHIMATE_STEREOTYPE, CornerParam.archimate, LineParam.archimateBorder); public static final SkinParameter COLLECTIONS = new SkinParameter(SName.collections, "COLLECTIONS", ColorParam.collectionsBackground, ColorParam.collectionsBorder, FontParam.RECTANGLE, @@ -158,7 +159,7 @@ public class SkinParameter { } private SkinParameter(SName styleName, String name, ColorParam colorParamBack, ColorParam colorParamBorder, - FontParam fontParam, FontParam fontParamStereotype, LineParam lineParam, CornerParam roundParam) { + FontParam fontParam, FontParam fontParamStereotype, CornerParam roundParam, LineParam lineParam) { this.name = name; this.styleName = styleName; this.colorParamBack = colorParamBack; @@ -171,8 +172,8 @@ public class SkinParameter { private SkinParameter(SName styleName, String name, ColorParam colorParamBack, ColorParam colorParamBorder, FontParam fontParam, FontParam fontParamStereotype) { - this(styleName, name, colorParamBack, colorParamBorder, fontParam, fontParamStereotype, null, - CornerParam.DEFAULT); + this(styleName, name, colorParamBack, colorParamBorder, fontParam, fontParamStereotype, CornerParam.DEFAULT, + null); } public String getUpperCaseName() { diff --git a/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java b/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java index 0d221063b..2c17666b2 100644 --- a/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java +++ b/src/net/sourceforge/plantuml/graphic/UGraphicDelegator.java @@ -37,6 +37,7 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.UParam; import net.sourceforge.plantuml.ugraphic.UShape; import net.sourceforge.plantuml.ugraphic.color.ColorMapper; @@ -82,12 +83,8 @@ public abstract class UGraphicDelegator implements UGraphic { ug.closeUrl(); } - public void startGroup(String groupId) { - ug.startGroup(groupId); - } - - public void startGroupWithClass(String groupClasses) { - ug.startGroupWithClass(groupClasses); + public void startGroup(UGroupType type, String ident) { + ug.startGroup(type, ident); } public void closeGroup() { diff --git a/src/net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java b/src/net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java index 48222c6f0..16fe75412 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java +++ b/src/net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java @@ -113,14 +113,23 @@ public class SmetanaForJson { return getStyle(name).applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet()); } + private SName getDiagramType() { + return skinParam.getUmlDiagramType() == UmlDiagramType.YAML ? SName.yamlDiagram : SName.jsonDiagram; + } + private Style getStyle(SName name) { - return StyleSignature.of(SName.root, SName.element, - skinParam.getUmlDiagramType() == UmlDiagramType.YAML ? SName.yamlDiagram : SName.jsonDiagram, name) + return StyleSignature.of(SName.root, SName.element, getDiagramType(), name) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + } + + private Style getStyleNodeHighlight() { + return StyleSignature.of(SName.root, SName.element, getDiagramType(), SName.node, SName.highlight) .getMergedStyle(skinParam.getCurrentStyleBuilder()); } private ST_Agnode_s manageOneNode(JsonValue current, List highlighted) { - final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted, getStyle(SName.node)); + final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted, getStyle(SName.node), + getStyleNodeHighlight()); final ST_Agnode_s node1 = createNode(block.calculateDimension(stringBounder), block.size(), current.isArray(), (int) block.getWidthColA(stringBounder), (int) block.getWidthColB(stringBounder)); nodes.add(new InternalNode(block, node1)); diff --git a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java index bab6b506d..7ae180dbb 100644 --- a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java +++ b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java @@ -71,6 +71,7 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol private final List lines = new ArrayList(); private final Style style; + private final Style styleHightlight; private final ISkinParam skinParam; private double totalWidth; private final JsonValue root; @@ -100,7 +101,13 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol } - public TextBlockJson(ISkinParam skinParam, JsonValue root, List highlighted, Style style) { + private HColor getToto() { + return styleHightlight.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); + } + + public TextBlockJson(ISkinParam skinParam, JsonValue root, List allHighlighteds, Style style, + Style styleHightlight) { + this.styleHightlight = styleHightlight; this.skinParam = skinParam; this.style = style; this.root = root; @@ -109,20 +116,29 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol final String key = member.getName(); final String value = getShortString(member.getValue()); - final TextBlock block1 = getTextBlock(key); - final TextBlock block2 = getTextBlock(value); - this.lines.add(new Line(block1, block2, isHighlighted(key, highlighted))); + final boolean highlighted = isHighlighted(key, allHighlighteds); + final TextBlock block1 = getTextBlock(getRightStyle(highlighted), key); + final TextBlock block2 = getTextBlock(getRightStyle(highlighted), value); + this.lines.add(new Line(block1, block2, highlighted)); } if (root instanceof JsonArray) { int i = 0; for (JsonValue value : (JsonArray) root) { - final TextBlock block2 = getTextBlock(getShortString(value)); - this.lines.add(new Line(block2, isHighlighted("" + i, highlighted))); + final boolean highlighted = isHighlighted("" + i, allHighlighteds); + final TextBlock block2 = getTextBlock(getRightStyle(highlighted), getShortString(value)); + this.lines.add(new Line(block2, highlighted)); i++; } } } + private Style getRightStyle(boolean highlighted) { + if (highlighted) { + return styleHightlight; + } + return style; + } + private boolean isHighlighted(String key, List highlighted) { for (String tmp : highlighted) { if (tmp.trim().equals("\"" + key + "\"")) { @@ -266,8 +282,7 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol final double heightOfRow = line.getHeightOfRow(stringBounder); if (line.highlighted) { final URectangle back = new URectangle(trueWidth - 2, heightOfRow).rounded(4); - final HColor yellow = skinParam.getIHtmlColorSet().getColorOrWhite("#ccff02"); - ugline.apply(yellow).apply(yellow.bg()).apply(new UTranslate(1.5, 0)).draw(back); + ugline.apply(getToto()).apply(getToto().bg()).apply(new UTranslate(1.5, 0)).draw(back); } if (y > 0) @@ -296,7 +311,7 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol return height; } - private TextBlock getTextBlock(String key) { + private TextBlock getTextBlock(Style style, String key) { final Display display = Display.getWithNewlines(key); final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getIHtmlColorSet()); final LineBreakStrategy wrap = style.wrapWidth(); diff --git a/src/net/sourceforge/plantuml/mindmap/FingerImpl.java b/src/net/sourceforge/plantuml/mindmap/FingerImpl.java index 6fcc72a6e..eb7027b27 100644 --- a/src/net/sourceforge/plantuml/mindmap/FingerImpl.java +++ b/src/net/sourceforge/plantuml/mindmap/FingerImpl.java @@ -44,8 +44,8 @@ import net.sourceforge.plantuml.Direction; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; +import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; @@ -88,6 +88,15 @@ public class FingerImpl implements Finger, UDrawable { return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.rootNode) .add(stereotype).add(depth); } + if (shape == IdeaShape.NONE && nail.size() == 0) { + return StyleSignature + .of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode, SName.boxless) + .add(stereotype).add(depth); + } + if (shape == IdeaShape.NONE) { + return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.boxless) + .add(stereotype).add(depth); + } if (nail.size() == 0) { return StyleSignature.of(SName.root, SName.element, SName.mindmapDiagram, SName.node, SName.leafNode) .add(stereotype).add(depth); @@ -234,8 +243,8 @@ public class FingerImpl implements Finger, UDrawable { assert shape == IdeaShape.NONE; final Style styleNode = getDefaultStyleDefinitionNode().getMergedStyle(styleBuilder); - final TextBlock text = label.create(styleNode.getFontConfiguration(skinParam.getIHtmlColorSet()), - HorizontalAlignment.LEFT, skinParam); + final TextBlock text = label.create0(styleNode.getFontConfiguration(skinParam.getIHtmlColorSet()), + styleNode.getHorizontalAlignment(), skinParam, styleNode.wrapWidth(), CreoleMode.FULL, null, null); if (direction == Direction.RIGHT) { return TextBlockUtils.withMargin(text, 3, 0, 1, 1); } diff --git a/src/net/sourceforge/plantuml/style/SName.java b/src/net/sourceforge/plantuml/style/SName.java index 52d8b683e..2627a138e 100644 --- a/src/net/sourceforge/plantuml/style/SName.java +++ b/src/net/sourceforge/plantuml/style/SName.java @@ -46,6 +46,7 @@ public enum SName { artifact, // boundary, // box, // + boxless, // caption, // card, // circle, // @@ -72,6 +73,7 @@ public enum SName { ganttDiagram, // group, // groupHeader, // + highlight, // header, // interface_, // jsonDiagram, // diff --git a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java index a8d9851a1..e78265631 100644 --- a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java +++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java @@ -202,7 +202,7 @@ public final class GeneralImageBuilder { } if (leaf.getLeafType() == LeafType.CIRCLE) { return new EntityImageDescription(leaf, skinParam, portionShower, links, umlDiagramType.getStyleName(), - null, bibliotekon); + bibliotekon); } if (leaf.getLeafType() == LeafType.DESCRIPTION) { @@ -211,11 +211,8 @@ public final class GeneralImageBuilder { } else if (OptionFlags.USE_INTERFACE_EYE2 && leaf.getUSymbol() instanceof USymbolInterface) { return new EntityImageLollipopInterfaceEye2(leaf, skinParam, portionShower); } else { - final UStroke forced = leaf.getUSymbol() == USymbol.PACKAGE - ? getForcedStroke(leaf.getStereotype(), skinParam) - : null; return new EntityImageDescription(leaf, skinParam, portionShower, links, umlDiagramType.getStyleName(), - forced, bibliotekon); + bibliotekon); } } if (leaf.getLeafType() == LeafType.USECASE) { @@ -247,12 +244,10 @@ public final class GeneralImageBuilder { } if (leaf.getLeafType() == LeafType.EMPTY_PACKAGE) { if (leaf.getUSymbol() != null) { - // final HtmlColor black = HtmlColorUtils.BLACK; final HColor black = SkinParamUtils.getColor(skinParam, leaf.getStereotype(), leaf.getUSymbol().getColorParamBorder()); return new EntityImageDescription(leaf, new SkinParamForecolored(skinParam, black), portionShower, - links, umlDiagramType.getStyleName(), getForcedStroke(leaf.getStereotype(), skinParam), - bibliotekon); + links, umlDiagramType.getStyleName(), bibliotekon); } return new EntityImageEmptyPackage(leaf, skinParam, portionShower, umlDiagramType.getStyleName()); } @@ -324,8 +319,12 @@ public final class GeneralImageBuilder { this.mergeIntricated = mergeIntricated; } - final public StyleSignature getDefaultStyleDefinitionArrow() { - return StyleSignature.of(SName.root, SName.element, styleName, SName.arrow); + final public StyleSignature getDefaultStyleDefinitionArrow(Stereotype stereotype) { + StyleSignature result = StyleSignature.of(SName.root, SName.element, styleName, SName.arrow); + if (stereotype != null) { + result = result.with(stereotype); + } + return result; } private boolean isOpalisable(IEntity entity) { @@ -418,8 +417,8 @@ public final class GeneralImageBuilder { final ISkinParam skinParam = dotData.getSkinParam(); final FontConfiguration labelFont; if (UseStyle.useBetaStyle()) { - final Style style = getDefaultStyleDefinitionArrow() - .getMergedStyle(skinParam.getCurrentStyleBuilder()); + final Style style = getDefaultStyleDefinitionArrow(link.getStereotype()) + .getMergedStyle(link.getStyleBuilder()); labelFont = style.getFontConfiguration(skinParam.getIHtmlColorSet()); } else { labelFont = new FontConfiguration(skinParam, FontParam.ARROW, null); @@ -544,8 +543,8 @@ public final class GeneralImageBuilder { throw new IllegalStateException(); } final IEntityImage image = printEntityInternal(dotStringFactory, ent); - final SvekNode node = dotStringFactory.getBibliotekon().createNode(ent, image, dotStringFactory.getColorSequence(), - stringBounder); + final SvekNode node = dotStringFactory.getBibliotekon().createNode(ent, image, + dotStringFactory.getColorSequence(), stringBounder); dotStringFactory.addNode(node); } diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java index ef7b23cd8..f8b71b141 100644 --- a/src/net/sourceforge/plantuml/svek/Line.java +++ b/src/net/sourceforge/plantuml/svek/Line.java @@ -65,6 +65,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkMiddleDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.NoteLinkStrategy; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.descdiagram.command.StringWithArrow; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -84,12 +85,14 @@ import net.sourceforge.plantuml.posimo.Positionable; import net.sourceforge.plantuml.posimo.PositionableUtils; import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.svek.extremity.Extremity; import net.sourceforge.plantuml.svek.extremity.ExtremityFactory; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryExtends; import net.sourceforge.plantuml.svek.extremity.ExtremityOther; import net.sourceforge.plantuml.svek.image.EntityImageNoteLink; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -619,12 +622,13 @@ public class Line implements Moveable, Hideable, GuideLine { } - public void drawU(UGraphic ug, HColor color, Set ids) { + public void drawU(UGraphic ug, UStroke suggestedStroke, HColor color, Set ids) { if (opale) { return; } ug.draw(link.commentForSvg()); - ug.startGroupWithClass("link " + link.getEntity1().getCode() + " " + link.getEntity2().getCode() + " selected"); + ug.startGroup(UGroupType.CLASS, + "link " + link.getEntity1().getCode() + " " + link.getEntity2().getCode() + " selected"); double x = 0; double y = 0; final Url url = link.getUrl(); @@ -659,7 +663,9 @@ public class Line implements Moveable, Hideable, GuideLine { ug = ug.apply(new HColorNone().bg()).apply(color); final LinkType linkType = link.getType(); - UStroke stroke = linkType.getStroke3(defaultThickness); + UStroke stroke = suggestedStroke == null || linkType.getStyle().isNormal() == false + ? linkType.getStroke3(defaultThickness) + : suggestedStroke; if (link.getColors() != null && link.getColors().getSpecificLineStroke() != null) { stroke = link.getColors().getSpecificLineStroke(); } @@ -1021,4 +1027,12 @@ public class Line implements Moveable, Hideable, GuideLine { return null; } + public StyleBuilder getCurrentStyleBuilder() { + return link.getStyleBuilder(); + } + + public Stereotype getStereotype() { + return link.getStereotype(); + } + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/svek/SvekResult.java b/src/net/sourceforge/plantuml/svek/SvekResult.java index 2819a0bb5..13de93c54 100644 --- a/src/net/sourceforge/plantuml/svek/SvekResult.java +++ b/src/net/sourceforge/plantuml/svek/SvekResult.java @@ -43,6 +43,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; @@ -51,6 +52,7 @@ import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -79,12 +81,8 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage } HColor color = rose.getHtmlColor(dotData.getSkinParam(), null, getArrowColorParam()); - if (UseStyle.useBetaStyle()) { - final Style style = getDefaultStyleDefinition() - .getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder()); - color = style.value(PName.LineColor).asColor(dotData.getSkinParam().getIHtmlColorSet()); - } color = HColorUtils.noGradient(color); + UStroke stroke = null; for (SvekNode node : dotStringFactory.getBibliotekon().allNodes()) { final double minX = node.getMinX(); @@ -102,7 +100,16 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage for (Line line : dotStringFactory.getBibliotekon().allLines()) { final UGraphic ug2 = line.isHidden() ? ug.apply(UHidden.HIDDEN) : ug; - line.drawU(ug2, color, ids); + + if (UseStyle.useBetaStyle()) { + final StyleBuilder currentStyleBuilder = line.getCurrentStyleBuilder(); + final Style style = getDefaultStyleDefinition(line.getStereotype()).getMergedStyle(currentStyleBuilder); + color = style.value(PName.LineColor).asColor(dotData.getSkinParam().getIHtmlColorSet()); + stroke = style.getStroke(); + color = HColorUtils.noGradient(color); + } + + line.drawU(ug2, stroke, color, ids); } } @@ -122,8 +129,13 @@ public final class SvekResult extends AbstractTextBlock implements IEntityImage throw new IllegalStateException(); } - private StyleSignature getDefaultStyleDefinition() { - return StyleSignature.of(SName.root, SName.element, dotData.getUmlDiagramType().getStyleName(), SName.arrow); + private StyleSignature getDefaultStyleDefinition(Stereotype stereotype) { + StyleSignature result = StyleSignature.of(SName.root, SName.element, dotData.getUmlDiagramType().getStyleName(), + SName.arrow); + if (stereotype != null) { + result = result.with(stereotype); + } + return result; } // Duplicate SvekResult / GeneralImageBuilder diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java index 6b15ebf03..0218bca42 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java @@ -72,12 +72,13 @@ import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Bibliotekon; import net.sourceforge.plantuml.svek.Margins; -import net.sourceforge.plantuml.svek.SvekNode; import net.sourceforge.plantuml.svek.ShapeType; +import net.sourceforge.plantuml.svek.SvekNode; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UComment; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; +import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.color.HColor; @@ -103,9 +104,9 @@ public class EntityImageDescription extends AbstractEntityImage { private final Bibliotekon bibliotekon; private final SymbolContext ctx; - public EntityImageDescription(ILeaf entity, ISkinParam skinParam, PortionShower portionShower, - Collection links, SName styleName, UStroke forceStroke, Bibliotekon bibliotekon) { - super(entity, entity.getColors(skinParam).mute(skinParam)); + public EntityImageDescription(ILeaf entity, ISkinParam skinParam2, PortionShower portionShower, + Collection links, SName styleName, Bibliotekon bibliotekon) { + super(entity, entity.getColors(skinParam2).mute(skinParam2)); this.useRankSame = getSkinParam().useRankSame(); this.bibliotekon = bibliotekon; this.fixCircleLabelOverlapping = getSkinParam().fixCircleLabelOverlapping(); @@ -127,7 +128,7 @@ public class EntityImageDescription extends AbstractEntityImage { this.url = entity.getUrl99(); - final Colors colors = entity.getColors(skinParam); + final Colors colors = entity.getColors(getSkinParam()); HColor backcolor = colors.getColor(ColorType.BACK); final HColor forecolor; final double roundCorner; @@ -145,9 +146,9 @@ public class EntityImageDescription extends AbstractEntityImage { style = tmp.with(stereotype).getMergedStyle(getSkinParam().getCurrentStyleBuilder()); final Style styleStereo = tmp.withStereotype(stereotype) .getMergedStyle(getSkinParam().getCurrentStyleBuilder()); - forecolor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); + forecolor = style.value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); if (backcolor == null) { - backcolor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); + backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet()); } roundCorner = style.value(PName.RoundCorner).asDouble(); diagonalCorner = style.value(PName.DiagonalCorner).asDouble(); @@ -164,11 +165,7 @@ public class EntityImageDescription extends AbstractEntityImage { roundCorner = symbol.getSkinParameter().getRoundCorner(getSkinParam(), stereotype); diagonalCorner = symbol.getSkinParameter().getDiagonalCorner(getSkinParam(), stereotype); deltaShadow = getSkinParam().shadowing2(getEntity().getStereotype(), symbol.getSkinParameter()) ? 3 : 0; - if (forceStroke == null) { - stroke = colors.muteStroke(symbol.getSkinParameter().getStroke(getSkinParam(), stereotype)); - } else { - stroke = forceStroke; - } + stroke = colors.muteStroke(symbol.getSkinParameter().getStroke(getSkinParam(), stereotype)); fcTitle = new FontConfiguration(getSkinParam(), symbol.getFontParam(), stereotype); fcStereo = new FontConfiguration(getSkinParam(), symbol.getFontParamStereotype(), stereotype); defaultAlign = HorizontalAlignment.LEFT; @@ -200,14 +197,14 @@ public class EntityImageDescription extends AbstractEntityImage { HorizontalAlignment.CENTER, getSkinParam()); } - name = BodyFactory.create2(skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), codeDisplay, + name = BodyFactory.create2(getSkinParam().getDefaultTextAlignment(HorizontalAlignment.CENTER), codeDisplay, symbol.getFontParam(), getSkinParam(), stereotype, entity, style); if (hideText) { asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), - ctx, skinParam.getStereotypeAlignment()); + ctx, getSkinParam().getStereotypeAlignment()); } else { - asSmall = symbol.asSmall(name, desc, stereo, ctx, skinParam.getStereotypeAlignment()); + asSmall = symbol.asSmall(name, desc, stereo, ctx, getSkinParam().getStereotypeAlignment()); } } @@ -294,7 +291,7 @@ public class EntityImageDescription extends AbstractEntityImage { final public void drawU(UGraphic ug) { ug.draw(new UComment("entity " + getEntity().getCodeGetName())); - ug.startGroupWithClass("elem " + getEntity().getCode() + " selected"); + ug.startGroup(UGroupType.CLASS, "elem " + getEntity().getCode() + " selected"); if (url != null) { ug.startUrl(url); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java index 1a7f61190..34f555521 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageNote.java @@ -72,10 +72,11 @@ import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.Line; -import net.sourceforge.plantuml.svek.SvekNode; import net.sourceforge.plantuml.svek.ShapeType; +import net.sourceforge.plantuml.svek.SvekNode; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; +import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -202,7 +203,7 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil { final public void drawU(UGraphic ug) { final Url url = getEntity().getUrl99(); - ug.startGroupWithClass("elem " + getEntity().getCode() + " selected"); + ug.startGroup(UGroupType.CLASS, "elem " + getEntity().getCode() + " selected"); if (url != null) { ug.startUrl(url); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java index 81122a100..8672656fe 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState.java @@ -58,6 +58,7 @@ import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -116,7 +117,7 @@ public class EntityImageState extends AbstractEntityImage { } final public void drawU(UGraphic ug) { - ug.startGroup(getEntity().getIdent().toString(".")); + ug.startGroup(UGroupType.ID, getEntity().getIdent().toString(".")); if (url != null) { ug.startUrl(url); } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java index 4887d3ab0..f777390b9 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java @@ -61,6 +61,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; @@ -71,6 +72,7 @@ import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.TextBlockInEllipse; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UStroke; @@ -83,8 +85,8 @@ public class EntityImageUseCase extends AbstractEntityImage { final private Url url; - public EntityImageUseCase(ILeaf entity, ISkinParam skinParam, PortionShower portionShower) { - super(entity, skinParam); + public EntityImageUseCase(ILeaf entity, ISkinParam skinParam2, PortionShower portionShower) { + super(entity, entity.getColors(skinParam2).mute(skinParam2)); final Stereotype stereotype = entity.getStereotype(); final HorizontalAlignment align; @@ -94,8 +96,8 @@ public class EntityImageUseCase extends AbstractEntityImage { } else { align = HorizontalAlignment.CENTER; } - final TextBlock tmp = BodyFactory.create2(skinParam.getDefaultTextAlignment(align), entity.getDisplay(), - FontParam.USECASE, skinParam, stereotype, entity, getStyle()); + final TextBlock tmp = BodyFactory.create2(getSkinParam().getDefaultTextAlignment(align), entity.getDisplay(), + FontParam.USECASE, getSkinParam(), stereotype, entity, getStyle()); if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { @@ -107,7 +109,7 @@ public class EntityImageUseCase extends AbstractEntityImage { } else { stereo = Display.getWithNewlines(stereotype.getLabel(getSkinParam().guillemet())).create( new FontConfiguration(getSkinParam(), FontParam.USECASE_STEREOTYPE, stereotype), - HorizontalAlignment.CENTER, skinParam); + HorizontalAlignment.CENTER, getSkinParam()); } this.desc = TextBlockUtils.mergeTB(stereo, tmp, HorizontalAlignment.CENTER); } @@ -121,10 +123,11 @@ public class EntityImageUseCase extends AbstractEntityImage { return style.getStroke(); } UStroke stroke = getSkinParam().getThickness(LineParam.usecaseBorder, getStereo()); - if (stroke == null) { stroke = new UStroke(1.5); } + final Colors colors = getEntity().getColors(getSkinParam()); + stroke = colors.muteStroke(stroke); return stroke; } @@ -150,7 +153,7 @@ public class EntityImageUseCase extends AbstractEntityImage { ug = ug.apply(backcolor.bg()); final UGraphic ug2 = new MyUGraphicEllipse(ug, 0, 0, ellipse.getUEllipse()); - ug2.startGroupWithClass("elem " + getEntity().getCode() + " selected"); + ug2.startGroup(UGroupType.CLASS, "elem " + getEntity().getCode() + " selected"); ellipse.drawU(ug2); ug2.closeGroup(); diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java index ecbaabe8f..7bb03b709 100644 --- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java +++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java @@ -72,6 +72,7 @@ import net.sourceforge.plantuml.code.Base64Coder; import net.sourceforge.plantuml.security.ImageIO; import net.sourceforge.plantuml.security.SecurityUtils; import net.sourceforge.plantuml.tikz.TikzGraphics; +import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.UImageSvg; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.USegment; @@ -122,6 +123,8 @@ public class SvgGraphics { private final boolean svgDimensionStyle; private final LengthAdjust lengthAdjust; + private final boolean INTERACTIVE = false; + final protected void ensureVisible(double x, double y) { if (x > maxX) { maxX = (int) (x + 1); @@ -161,14 +164,15 @@ public class SvgGraphics { defs.appendChild(getPathHover(hover)); } - final Element styles = getStylesForInteractiveMode(); - if (styles != null) { - defs.appendChild(styles); - } - - final Element script = getScriptForInteractiveMode(); - if (script != null) { - defs.appendChild(script); + if (INTERACTIVE) { + final Element styles = getStylesForInteractiveMode(); + if (styles != null) { + defs.appendChild(styles); + } + final Element script = getScriptForInteractiveMode(); + if (script != null) { + defs.appendChild(script); + } } } catch (ParserConfigurationException e) { e.printStackTrace(); @@ -971,15 +975,14 @@ public class SvgGraphics { } } - public void startGroup(String groupId) { - pendingAction.add(0, (Element) document.createElement("g")); - pendingAction.get(0).setAttribute("id", groupId); - } - - public void startGroupWithClass(String groupClasses) { - - pendingAction.add(0, (Element) document.createElement("g")); - pendingAction.get(0).setAttribute("class", groupClasses); + public void startGroup(UGroupType type, String ident) { + if (type == UGroupType.ID) { + pendingAction.add(0, (Element) document.createElement("g")); + pendingAction.get(0).setAttribute("id", ident); + } else if (INTERACTIVE && type == UGroupType.CLASS) { + pendingAction.add(0, (Element) document.createElement("g")); + pendingAction.get(0).setAttribute("class", ident); + } } public void closeGroup() { diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java b/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java index 5a8c62885..a58c9db7e 100644 --- a/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java +++ b/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java @@ -170,12 +170,8 @@ public abstract class AbstractCommonUGraphic implements UGraphic { public void closeUrl() { } - public void startGroup(String groupId) { + public void startGroup(UGroupType type, String ident) { } - - public void startGroupWithClass(String groupClasses) { - } - public void closeGroup() { } diff --git a/src/net/sourceforge/plantuml/ugraphic/UGraphic.java b/src/net/sourceforge/plantuml/ugraphic/UGraphic.java index cfa93c627..f9ef88c97 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UGraphic.java +++ b/src/net/sourceforge/plantuml/ugraphic/UGraphic.java @@ -55,9 +55,7 @@ public interface UGraphic { public void closeUrl(); - public void startGroup(String id); - - public void startGroupWithClass(String groupClasses); + public void startGroup(UGroupType type, String ident); public void closeGroup(); diff --git a/src/net/sourceforge/plantuml/ugraphic/UGraphicNo.java b/src/net/sourceforge/plantuml/ugraphic/UGraphicNo.java index 2d79891d8..ac25737fe 100644 --- a/src/net/sourceforge/plantuml/ugraphic/UGraphicNo.java +++ b/src/net/sourceforge/plantuml/ugraphic/UGraphicNo.java @@ -42,10 +42,7 @@ public abstract class UGraphicNo { final public void startUrl(Url url) { } - final public void startGroup(String groupId) { - } - - final public void startGroupWithClass(String groupClasses) { + public void startGroup(UGroupType type, String ident) { } final public void closeUrl() { diff --git a/src/net/sourceforge/plantuml/ugraphic/UGroupType.java b/src/net/sourceforge/plantuml/ugraphic/UGroupType.java new file mode 100644 index 000000000..fad708b5e --- /dev/null +++ b/src/net/sourceforge/plantuml/ugraphic/UGroupType.java @@ -0,0 +1,41 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2020, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.ugraphic; + +public enum UGroupType { + ID, CLASS + +} diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java index fb2838d19..f856b4e99 100644 --- a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java +++ b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java @@ -56,6 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UCenteredCharacter; import net.sourceforge.plantuml.ugraphic.UComment; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic2; +import net.sourceforge.plantuml.ugraphic.UGroupType; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImageSvg; import net.sourceforge.plantuml.ugraphic.ULine; @@ -176,15 +177,10 @@ public class UGraphicSvg extends AbstractUGraphic implements ClipCo } @Override - public void startGroup(String groupId) { - getGraphicObject().startGroup(groupId); + public void startGroup(UGroupType type, String ident) { + getGraphicObject().startGroup(type, ident); } - @Override - public void startGroupWithClass(String groupClasses) { - getGraphicObject().startGroupWithClass(groupClasses); - } - @Override public void closeGroup() { diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 3d8667921..d9a67439b 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -44,7 +44,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1202101; + return 1202102; } public static int versionPatched() { @@ -80,7 +80,7 @@ public class Version { } public static int beta() { - final int beta = 11; + final int beta = 0; return beta; } @@ -93,7 +93,7 @@ public class Version { } public static long compileTime() { - return 1612252508814L; + return 1615115427842L; } public static String compileTimeString() { diff --git a/src/net/sourceforge/plantuml/wbs/CommandWBSOrgmode.java b/src/net/sourceforge/plantuml/wbs/CommandWBSOrgmode.java index b58d64113..77f2282c1 100644 --- a/src/net/sourceforge/plantuml/wbs/CommandWBSOrgmode.java +++ b/src/net/sourceforge/plantuml/wbs/CommandWBSOrgmode.java @@ -58,13 +58,15 @@ public class CommandWBSOrgmode extends SingleLineCommand2 { return RegexConcat.build(CommandWBSOrgmode.class.getName(), RegexLeaf.start(), // new RegexLeaf("TYPE", "([*]+)"), // new RegexOptional(new RegexLeaf("BACKCOLOR", "\\[(#\\w+)\\]")), // + new RegexLeaf("SHAPE", "(_)?"), // new RegexLeaf("DIRECTION", "([<>])?"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("LABEL", "([^%s].*)"), RegexLeaf.end()); } @Override - protected CommandExecutionResult executeArg(WBSDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { + protected CommandExecutionResult executeArg(WBSDiagram diagram, LineLocation location, RegexResult arg) + throws NoSuchColorException { final String type = arg.get("TYPE", 0); final String label = arg.get("LABEL", 0); final String stringColor = arg.get("BACKCOLOR", 0); @@ -74,7 +76,7 @@ public class CommandWBSOrgmode extends SingleLineCommand2 { } final String direction = arg.get("DIRECTION", 0); final Direction dir = "<".equals(direction) ? Direction.LEFT : Direction.RIGHT; - return diagram.addIdea(backColor, type.length() - 1, label, dir, IdeaShape.BOX); + return diagram.addIdea(backColor, type.length() - 1, label, dir, IdeaShape.fromDesc(arg.get("SHAPE", 0))); } } diff --git a/src/net/sourceforge/plantuml/wbs/ITFLeaf.java b/src/net/sourceforge/plantuml/wbs/ITFLeaf.java index 751396726..ba2d04e09 100644 --- a/src/net/sourceforge/plantuml/wbs/ITFLeaf.java +++ b/src/net/sourceforge/plantuml/wbs/ITFLeaf.java @@ -38,19 +38,16 @@ package net.sourceforge.plantuml.wbs; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; +import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.mindmap.IdeaShape; import net.sourceforge.plantuml.style.Style; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; class ITFLeaf extends AbstractTextBlock implements ITF { @@ -61,9 +58,8 @@ class ITFLeaf extends AbstractTextBlock implements ITF { if (shape == IdeaShape.BOX) { this.box = FtileBox.createWbs(style, skinParam, label); } else { - final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); - final TextBlock text = label.create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT, - skinParam); + final TextBlock text = label.create0(style.getFontConfiguration(skinParam.getIHtmlColorSet()), + style.getHorizontalAlignment(), skinParam, style.wrapWidth(), CreoleMode.FULL, null, null); this.box = TextBlockUtils.withMargin(text, 0, 3, 1, 1); } } diff --git a/src/net/sourceforge/plantuml/wbs/WBSTextBlock.java b/src/net/sourceforge/plantuml/wbs/WBSTextBlock.java index d2ea82d2d..09e876828 100644 --- a/src/net/sourceforge/plantuml/wbs/WBSTextBlock.java +++ b/src/net/sourceforge/plantuml/wbs/WBSTextBlock.java @@ -38,22 +38,17 @@ package net.sourceforge.plantuml.wbs; import java.awt.geom.Point2D; import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.AbstractTextBlock; -import net.sourceforge.plantuml.graphic.FontConfiguration; -import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.mindmap.IdeaShape; import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleSignature; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -95,16 +90,13 @@ abstract class WBSTextBlock extends AbstractTextBlock { } final protected TextBlock buildMain(WElement idea) { - Display label = idea.getLabel(); - final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); - + final Display label = idea.getLabel(); + final Style style = idea.getStyle(); if (idea.getShape() == IdeaShape.BOX) { - final FtileBox box = FtileBox.createWbs(idea.getStyle(), idea.withBackColor(skinParam), label); + final FtileBox box = FtileBox.createWbs(style, idea.withBackColor(skinParam), label); return box; } - - final TextBlock text = label.create(FontConfiguration.blackBlueTrue(font), HorizontalAlignment.LEFT, skinParam); - return TextBlockUtils.withMargin(text, 0, 3, 1, 1); + throw new UnsupportedOperationException(); } } diff --git a/src/net/sourceforge/plantuml/wbs/WElement.java b/src/net/sourceforge/plantuml/wbs/WElement.java index 71589fe2e..d908a7ae1 100644 --- a/src/net/sourceforge/plantuml/wbs/WElement.java +++ b/src/net/sourceforge/plantuml/wbs/WElement.java @@ -71,10 +71,19 @@ final class WElement { return StyleSignature.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.rootNode) .add(stereotype).add(depth); } + if (shape == IdeaShape.NONE && isLeaf()) { + return StyleSignature + .of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.leafNode, SName.boxless) + .add(stereotype).add(depth); + } if (isLeaf()) { return StyleSignature.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.leafNode) .add(stereotype).add(depth); } + if (shape == IdeaShape.NONE) { + return StyleSignature.of(SName.root, SName.element, SName.wbsDiagram, SName.node, SName.boxless) + .add(stereotype).add(depth); + } return StyleSignature.of(SName.root, SName.element, SName.wbsDiagram, SName.node).add(stereotype).add(depth); }