From 8ae721e3d2b1ff0f5e3092592543bf56b3c36e7b Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Tue, 1 Feb 2022 21:21:45 +0100 Subject: [PATCH] Version 1.2022.1 --- skin/plantuml.skin | 108 ++++- skin/plantuml2.skin | 452 ++++++++++++++++++ .../sourceforge/plantuml/SkinParamColors.java | 2 +- .../sourceforge/plantuml/TitledDiagram.java | 10 +- .../command/CommandPartition3.java | 47 +- .../ftile/vcompact/VCompactFactory.java | 22 +- .../vcompact/cond/ConditionalBuilder.java | 18 +- .../ftile/vertical/FtileBlackBlock.java | 23 +- .../ftile/vertical/FtileDiamondWIP.java | 4 +- .../sourceforge/plantuml/bpm/BpmElement.java | 22 +- .../plantuml/cucadiagram/LinkDecor.java | 4 +- .../cucadiagram/MethodsOrFieldsArea.java | 26 +- .../plantuml/elk/CucaDiagramFileMakerElk.java | 6 +- .../plantuml/graphic/CircledCharacter.java | 29 +- .../sourceforge/plantuml/graphic/USymbol.java | 2 + .../plantuml/graphic/USymbolActor.java | 6 + .../plantuml/graphic/USymbolArtifact.java | 18 +- .../plantuml/graphic/USymbolBoundary.java | 7 + .../plantuml/graphic/USymbolCard.java | 18 +- .../plantuml/graphic/USymbolCloud.java | 18 +- .../plantuml/graphic/USymbolCollections.java | 18 +- .../plantuml/graphic/USymbolComponent1.java | 15 +- .../plantuml/graphic/USymbolComponent2.java | 17 +- .../plantuml/graphic/USymbolControl.java | 7 + .../plantuml/graphic/USymbolDatabase.java | 21 +- .../plantuml/graphic/USymbolEntityDomain.java | 7 + .../plantuml/graphic/USymbolFile.java | 17 +- .../plantuml/graphic/USymbolFolder.java | 18 +- .../plantuml/graphic/USymbolFrame.java | 27 +- .../plantuml/graphic/USymbolHexagon.java | 22 +- .../plantuml/graphic/USymbolInterface.java | 7 + .../plantuml/graphic/USymbolLabel.java | 7 + .../plantuml/graphic/USymbolNode.java | 25 +- .../plantuml/graphic/USymbolPerson.java | 19 +- .../plantuml/graphic/USymbolQueue.java | 21 +- .../plantuml/graphic/USymbolRectangle.java | 16 +- .../plantuml/graphic/USymbolStack.java | 17 +- .../plantuml/graphic/USymbolStorage.java | 17 +- .../plantuml/graphic/USymbolTogether.java | 7 + .../plantuml/sequencediagram/Grouping.java | 5 +- .../sequencediagram/command/CommandSkin.java | 2 + .../plantuml/skin/VisibilityModifier.java | 148 +++--- .../skin/rose/ComponentRoseGroupingElse.java | 17 +- .../command/CommandCreateState.java | 2 +- .../plantuml/style/FromSkinparamToStyle.java | 4 + src/net/sourceforge/plantuml/style/SName.java | 16 + src/net/sourceforge/plantuml/style/Style.java | 27 +- .../plantuml/style/StyleBuilder.java | 30 +- .../plantuml/style/StyleLoader.java | 61 ++- .../plantuml/style/StyleSignature.java | 39 +- .../plantuml/style/ValueColor.java | 5 + .../sourceforge/plantuml/style/ValueImpl.java | 4 + .../sourceforge/plantuml/svek/Cluster.java | 365 +++++++------- .../svek/extremity/ExtremityDiamond.java | 21 +- .../extremity/ExtremityFactoryDiamond.java | 9 +- .../plantuml/svek/image/EntityImageClass.java | 11 +- .../svek/image/EntityImageClassHeader.java | 86 +++- .../svek/image/EntityImageDescription.java | 92 ++-- .../svek/image/EntityImageEmptyPackage.java | 3 +- .../svek/image/EntityImageSynchroBar.java | 4 +- .../sourceforge/plantuml/svg/SvgGraphics.java | 54 ++- .../svg/DriverCenteredCharacterSvg.java | 12 +- .../ugraphic/svg/DriverDotPathSvg.java | 4 +- .../ugraphic/svg/DriverEllipseSvg.java | 18 +- .../plantuml/ugraphic/svg/DriverLineSvg.java | 6 +- .../plantuml/ugraphic/svg/DriverPathSvg.java | 26 +- .../ugraphic/svg/DriverPolygonSvg.java | 25 +- .../ugraphic/svg/DriverRectangleSvg.java | 43 +- .../plantuml/ugraphic/svg/DriverTextSvg.java | 8 +- .../plantuml/ugraphic/svg/UGraphicSvg.java | 14 +- .../sourceforge/plantuml/version/Version.java | 6 +- test/nonreg/simple/A0002_TestResult.java | 10 +- 72 files changed, 1610 insertions(+), 714 deletions(-) create mode 100644 skin/plantuml2.skin diff --git a/skin/plantuml.skin b/skin/plantuml.skin index 6fbb6a95d..dc649f211 100644 --- a/skin/plantuml.skin +++ b/skin/plantuml.skin @@ -69,8 +69,67 @@ element { } } +artifact { + Shadowing 4.0 +} +node { + Shadowing 2.0 +} +person { + Shadowing 2.0 +} +queue { + Shadowing 2.0 +} +rectangle { + Shadowing 3.0 +} +stack { + Shadowing 3.0 +} +storage { + Shadowing 3.0 +} +boundary { + Shadowing 4.0 +} +card { + Shadowing 3.0 +} +cloud { + Shadowing 3.0 +} +collections { + Shadowing 3.0 +} +component { + Shadowing 4.0 +} +database { + Shadowing 3.0 +} +file { + Shadowing 3.0 +} +frame { + Shadowing 3.0 +} +folder { + Shadowing 3.0 +} group { - BackGroundColor white + package { + LineThickness 1.5 + LineColor black + } + folder { + LineThickness 1.5 + LineColor black + } +} + +group { + BackGroundColor transparent } sequenceDiagram { @@ -98,6 +157,50 @@ sequenceDiagram { classDiagram { } +visibilityIcon { + public { + LineColor #038048 + BackgroundColor #84BE84 + } + private { + LineColor #C82930 + BackgroundColor #F24D5C + } + protected { + LineColor #B38D22 + BackgroundColor #FFFF44 + } + package { + LineColor #1963A0 + BackgroundColor #4177AF + } + IEMandatory { + LineColor black + BackgroundColor black + } +} + +spot { + spotAnnotation { + BackgroundColor #E3664A + } + spotAbstractClass { + BackgroundColor #A9DCDF + } + spotClass { + BackgroundColor #ADD1B2 + } + spotInterface { + BackgroundColor #B4A7E5 + } + spotEnum { + BackgroundColor #EB937F + } + spotEntity { + BackgroundColor #ADD1B2 + } +} + stateDiagram { state { @@ -266,7 +369,8 @@ activityDiagram { } activityBar { - BackgroundColor black + Shadowing 3.0 + BackgroundColor black } circle { diff --git a/skin/plantuml2.skin b/skin/plantuml2.skin new file mode 100644 index 000000000..890b5fce5 --- /dev/null +++ b/skin/plantuml2.skin @@ -0,0 +1,452 @@ +root { + FontName SansSerif + HyperLinkColor blue + FontColor black + FontSize 14 + FontStyle plain + HorizontalAlignment left + RoundCorner 0 + DiagonalCorner 0 + LineThickness 1.0 + LineColor #181818 + BackGroundColor #f8f8f8 + Shadowing 0.0 +} + +document { + BackGroundColor White + header { + HorizontalAlignment right + FontSize 10 + FontColor #888888 + BackGroundColor none + LineColor none + } + title { + HorizontalAlignment center + FontSize 14 + FontStyle bold + Padding 5 + Margin 5 + LineColor none + BackGroundColor none + } + footer { + HorizontalAlignment center + FontSize 10 + FontColor #888888 + BackGroundColor none + LineColor none + } + legend { + LineColor black + BackGroundColor #DDDDDD + FontSize 14 + RoundCorner 15 + Padding 6 + Margin 8 + } + caption { + HorizontalAlignment center + FontSize 14 + Padding 0 + Margin 1 + LineColor none + BackGroundColor none + } +} + +stereotype { + FontStyle italic +} + + + +element { + Shadowing 0.0 + title { + FontStyle bold + } +} + +group { + package { + LineThickness 1.5 + LineColor black + } + folder { + LineThickness 1.5 + LineColor black + } +} + +group { + BackGroundColor transparent +} + +sequenceDiagram { + group { + LineColor black + LineThickness 2.0 + FontSize 11 + FontStyle bold + } + + groupHeader { + BackGroundColor #EEEEEE + LineColor black + FontSize 13 + FontStyle bold + } + + lifeLine { + BackGroundColor white + LineStyle 5 + } + +} + +classDiagram { +} + +visibilityIcon { + public { + LineColor #038048 + BackgroundColor #84BE84 + } + private { + LineColor #C82930 + BackgroundColor #F24D5C + } + protected { + LineColor #B38D22 + BackgroundColor #FFFF44 + } + package { + LineColor #1963A0 + BackgroundColor #4177AF + } + IEMandatory { + LineColor black + BackgroundColor black + } +} + +spot { + spotAnnotation { + BackgroundColor #E3664A + } + spotAbstractClass { + BackgroundColor #A9DCDF + } + spotClass { + BackgroundColor #ADD1B2 + } + spotInterface { + BackgroundColor #B4A7E5 + } + spotEnum { + BackgroundColor #EB937F + } + spotEntity { + BackgroundColor #ADD1B2 + } +} + + +stateDiagram { + state { + RoundCorner 25 + } + element { + title { + FontStyle plain + } + } +} + + +destroy { +} + +reference { + FontSize 12 + LineColor black + BackGroundColor while + LineThickness 2.0 + HorizontalAlignment center +} + +referenceHeader { + LineColor black + BackGroundColor #EEEEEE + FontColor black + FontSize 13 + FontStyle bold + LineThickness 2.0 +} + +box { + BackGroundColor #DDDDDD + + FontSize 13 + FontStyle bold +} + +separator { + LineColor black + LineThickness 2.0 + BackGroundColor #EEEEEE + + FontSize 13 + FontStyle bold +} + +delay { + FontSize 11 + FontStyle plain + HorizontalAlignment center +} + +participant { + LineThickness 1.5 + HorizontalAlignment center +} + +actor { + LineThickness 2.0 + HorizontalAlignment center +} + +boundary { + LineThickness 2.0 + HorizontalAlignment center +} + +control { + LineThickness 2.0 + HorizontalAlignment center +} + +entity { + LineThickness 2.0 + HorizontalAlignment center +} + +queue { + LineThickness 2.0 + HorizontalAlignment center +} + +database { + HorizontalAlignment center +} + +collections { + LineThickness 1.5 + HorizontalAlignment center +} + +swimlane { + BackGroundColor none + LineColor black + LineThickness 2 + FontSize 18 +} + +arrow { + FontSize 13 +} + +note { + FontSize 13 + BackGroundColor #ebebeb +} + +partition { +} + +circle { +} + +mindmapDiagram { +} + +mindmapDiagram { + node { + Padding 10 + Margin 10 + RoundCorner 25 + LineThickness 1.5 + } + arrow { + LineThickness 1.0 + } +} + + +wbsDiagram { + Padding 10 + Margin 15 + RoundCorner 0 + LineThickness 1.5 + FontSize 12 +} + +activityDiagram { + activity { + LineThickness 1.5 + Padding 10 + FontSize 12 + RoundCorner 25 + } + partition { + LineColor black + BackgroundColor none + } + diamond { + FontSize 11 + } + arrow { + FontSize 11 + } +} + +activityBar { + BackgroundColor black +} + +circle { + LineColor black +} + + +task { + FontSize 11 +} + +milestone { + FontSize 11 + BackGroundColor black + LineColor black +} + +ganttDiagram { + arrow { + LineThickness 1.5 + } + note { + FontSize 9 + } + separator { + FontSize 11 + FontStyle plain + BackGroundColor transparent + Margin 5 + Padding 5 + } + timeline { + BackgroundColor transparent + LineColor #C0C0C0 + } + closed { + BackGroundColor #E0E8E8 + FontColor #909898 + } + task { + RoundCorner 0 + Margin 2 2 2 2 + Padding 0 + } + undone { + BackGroundColor white + } + milestone { + Margin 2 + Padding 3 + } +} + + +usecase { + HorizontalAlignment center +} + +yamlDiagram,jsonDiagram { + BackGroundColor white + FontColor black + LineColor black + arrow { + LineThickness 1 + LineStyle 3;3 + } + node { + LineThickness 1.5 + RoundCorner 10 + separator { + LineThickness 1 + } + header { + FontStyle bold + } + highlight { + BackGroundColor #ccff02 + } + } +} + + +timingDiagram { + arrow { + LineThickness 1.5 + } + constraintArrow { + LineThickness 1.5 + } +} + +nwdiagDiagram { + network { + FontSize 12 + } + server { + FontSize 12 + } + group { + FontSize 12 + BackGroundColor #ddd + } + arrow { + FontSize 11 + } +} + + +@media (prefers-color-scheme:dark) { +element { + LineColor #e7e7e7 + BackGroundColor #070707 + FontColor white +} +spot { + spotAnnotation { + BackgroundColor #4A0000 + } + spotAbstractClass { + BackgroundColor #2A5D60 + } + spotClass { + BackgroundColor #2E5233 + } + spotInterface { + BackgroundColor #352866 + } + spotEnum { + BackgroundColor #852D19 + } + spotEntity { + BackgroundColor #2E5233 + } +} +} + diff --git a/src/net/sourceforge/plantuml/SkinParamColors.java b/src/net/sourceforge/plantuml/SkinParamColors.java index bd278ab6d..828e720ad 100644 --- a/src/net/sourceforge/plantuml/SkinParamColors.java +++ b/src/net/sourceforge/plantuml/SkinParamColors.java @@ -55,7 +55,7 @@ public class SkinParamColors extends SkinParamDelegator { @Override public String toString() { - return super.toString() + colors; + return "SkinParamColors::" + colors; } @Override diff --git a/src/net/sourceforge/plantuml/TitledDiagram.java b/src/net/sourceforge/plantuml/TitledDiagram.java index c4cbc90e6..fd974fcbc 100644 --- a/src/net/sourceforge/plantuml/TitledDiagram.java +++ b/src/net/sourceforge/plantuml/TitledDiagram.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml; import java.io.IOException; +import java.io.InputStream; import net.sourceforge.plantuml.anim.Animation; import net.sourceforge.plantuml.anim.AnimationDecoder; @@ -55,6 +56,7 @@ 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.StyleLoader; import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.color.HColor; @@ -118,7 +120,13 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram, } public CommandExecutionResult loadSkin(String newSkin) throws IOException { - getSkinParam().setDefaultSkin(newSkin + ".skin"); + final String filename = newSkin + ".skin"; + final InputStream is = StyleLoader.getInputStreamForStyle(filename); + if (is == null) + return CommandExecutionResult.error("Cannot find style " + newSkin); + is.close(); + + getSkinParam().setDefaultSkin(filename); return CommandExecutionResult.ok(); // final String res = "/skin/" + filename + ".skin"; // final InputStream internalIs = UmlDiagram.class.getResourceAsStream(res); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java index 03e1a628e..17195ca2e 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandPartition3.java @@ -118,6 +118,12 @@ public class CommandPartition3 extends SingleLineCommand2 { return ColorParser.simpleColor(ColorType.BACK, id); } + private StyleSignature getDefaultStyleDefinitionPartition(USymbol symbol) { + if (symbol == USymbol.RECTANGLE) + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.rectangle); + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition); + } + @Override protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { @@ -131,35 +137,38 @@ public class CommandPartition3 extends SingleLineCommand2 { final String stereo = arg.get("STEREO", 0); final Stereotype stereotype = stereo == null ? null : Stereotype.build(stereo); - final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), stereotype, - false); HColor backColor; - if (backColorInSkinparam == null) { - backColor = colors.getColor(ColorType.BACK); - } else { - backColor = backColorInSkinparam; - } - HColor titleColor = colors.getColor(ColorType.HEADER); - // Warning : titleColor unused in FTileGroupW - HColor borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false); - if (borderColor == null) { - borderColor = HColorUtils.BLACK; - } - double roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype); + HColor titleColor; + HColor borderColor; + double roundCorner; if (UseStyle.useBetaStyle()) { - final Style stylePartition = getDefaultStyleDefinitionPartition() + final Style stylePartition = getDefaultStyleDefinitionPartition(symbol).with(stereotype) .getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()); borderColor = stylePartition.value(PName.LineColor).asColor(diagram.getSkinParam().getThemeStyle(), diagram.getSkinParam().getIHtmlColorSet()); backColor = colors.getColor(ColorType.BACK); - if (backColor == null) { + if (backColor == null) backColor = stylePartition.value(PName.BackGroundColor).asColor(diagram.getSkinParam().getThemeStyle(), diagram.getSkinParam().getIHtmlColorSet()); - } + titleColor = HColorUtils.BLUE;// stylePartition.value(PName.FontColor).asColor(diagram.getSkinParam().getIHtmlColorSet()); roundCorner = stylePartition.value(PName.RoundCorner).asDouble(); + } else { + final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), + stereotype, false); + if (backColorInSkinparam == null) + backColor = colors.getColor(ColorType.BACK); + else + backColor = backColorInSkinparam; + + titleColor = colors.getColor(ColorType.HEADER); + + borderColor = diagram.getSkinParam().getHtmlColor(getColorParamBorder(symbol), stereotype, false); + if (borderColor == null) + borderColor = HColorUtils.BLACK; + roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype); } diagram.startGroup(Display.getWithNewlines(partitionTitle), backColor, titleColor, borderColor, symbol, @@ -168,8 +177,4 @@ public class CommandPartition3 extends SingleLineCommand2 { return CommandExecutionResult.ok(); } - final public StyleSignature getDefaultStyleDefinitionPartition() { - return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.partition); - } - } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index dd1081804..f1f328fff 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -94,15 +94,23 @@ public class VCompactFactory implements FtileFactory { this.stringBounder = stringBounder; } - final public StyleSignature getDefaultStyleDefinitionCircle() { + private StyleSignature getSignatureCircle() { return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle); } + private StyleSignature getSignatureCircleEnd() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.end); + } + + private StyleSignature getSignatureCircleStop() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.stop); + } + public Ftile start(Swimlane swimlane) { final HColor color; Style style = null; if (UseStyle.useBetaStyle()) { - style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); + style = getSignatureCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } else { color = rose.getHtmlColor(skinParam, ColorParam.activityStart); @@ -115,10 +123,8 @@ public class VCompactFactory implements FtileFactory { Style style = null; final HColor backgroundColor; if (UseStyle.useBetaStyle()) { - style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); + style = getSignatureCircleStop().getMergedStyle(skinParam.getCurrentStyleBuilder()); borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); - // backgroundColor = - // style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); backgroundColor = skinParam.getBackgroundColor(); } else { borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd); @@ -128,8 +134,6 @@ public class VCompactFactory implements FtileFactory { } public Ftile spot(Swimlane swimlane, String spot, HColor color) { - // final HtmlColor color = rose.getHtmlColor(skinParam, - // ColorParam.activityBackground); final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); return new FtileCircleSpot(skinParam(), swimlane, spot, font, color); } @@ -139,10 +143,8 @@ public class VCompactFactory implements FtileFactory { Style style = null; final HColor backgroundColor; if (UseStyle.useBetaStyle()) { - style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); + style = getSignatureCircleEnd().getMergedStyle(skinParam.getCurrentStyleBuilder()); borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); - // backgroundColor = - // style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet()); backgroundColor = skinParam.getBackgroundColor(); } else { borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java index 474d6bb6f..87448b96f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java @@ -108,19 +108,25 @@ public class ConditionalBuilder { Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, FontConfiguration fontTest, Url url) { if (UseStyle.useBetaStyle()) { + if (backColor == null) + throw new IllegalArgumentException(); + if (borderColor == null) + throw new IllegalArgumentException(); + if (arrowColor == null) + throw new IllegalArgumentException(); final Style styleArrow = getDefaultStyleDefinitionArrow() .getMergedStyle(skinParam.getCurrentStyleBuilder()); final Style styleDiamond = getDefaultStyleDefinitionDiamond() .getMergedStyle(skinParam.getCurrentStyleBuilder()); this.diamondLineBreak = styleDiamond.wrapWidth(); this.labelLineBreak = styleArrow.wrapWidth(); - this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getThemeStyle(), - skinParam.getIHtmlColorSet()); - this.backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), - skinParam.getIHtmlColorSet()); - this.arrowColor = Rainbow.fromColor( + this.borderColor = borderColor; /*styleDiamond.value(PName.LineColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet());*/ + this.backColor = backColor;/*styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet())*/; + this.arrowColor = arrowColor;/* Rainbow.fromColor( styleArrow.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()), - null); + null);*/ this.fontTest = styleDiamond.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); this.fontArrow = styleArrow.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); } else { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java index 36412d588..1ce3ab43b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java @@ -42,6 +42,7 @@ import java.util.Objects; import java.util.Set; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; @@ -49,6 +50,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -82,17 +87,27 @@ public class FtileBlackBlock extends AbstractFtile { @Override protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) { double supp = label.calculateDimension(stringBounder).getWidth(); - if (supp > 0) { + if (supp > 0) supp += labelMargin; - } + return new FtileGeometry(width + supp, height, width / 2, 0, height); } + private StyleSignature getDefaultStyleDefinitionBar() { + return StyleSignature.of(SName.root, SName.element, SName.activityBar); + } + public void drawU(UGraphic ug) { final URectangle rect = new URectangle(width, height).rounded(5).ignoreForCompressionOnX(); - if (skinParam().shadowing(null)) { - rect.setDeltaShadow(3); + if (UseStyle.useBetaStyle()) { + final Style style = getDefaultStyleDefinitionBar().getMergedStyle(skinParam().getCurrentStyleBuilder()); + final double shadowing = style.value(PName.Shadowing).asDouble(); + rect.setDeltaShadow(shadowing); + } else { + if (skinParam().shadowing(null)) + rect.setDeltaShadow(3); } + ug.apply(colorBar).apply(colorBar.bg()).draw(rect); final Dimension2D dimLabel = label.calculateDimension(ug.getStringBounder()); label.drawU(ug.apply(new UTranslate(width + labelMargin, -dimLabel.getHeight() / 2))); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondWIP.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondWIP.java index 8be6a526b..d8a1d977c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondWIP.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondWIP.java @@ -81,8 +81,8 @@ abstract class FtileDiamondWIP extends AbstractFtile implements Styleable { super(skinParam); if (UseStyle.useBetaStyle()) { Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()); - this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); - this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); + this.borderColor = borderColor; //style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); + this.backColor = backColor; //style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet()); this.shadowing = style.value(PName.Shadowing).asDouble(); } else { this.backColor = backColor; diff --git a/src/net/sourceforge/plantuml/bpm/BpmElement.java b/src/net/sourceforge/plantuml/bpm/BpmElement.java index 43569f27f..d54979478 100644 --- a/src/net/sourceforge/plantuml/bpm/BpmElement.java +++ b/src/net/sourceforge/plantuml/bpm/BpmElement.java @@ -40,7 +40,10 @@ import java.awt.geom.Rectangle2D; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamUtils; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; +import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; +import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileCircleStart; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamond; @@ -50,6 +53,10 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.MinMax; import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -111,7 +118,7 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz public Dimension2D calculateDimension(StringBounder stringBounder) { return raw.calculateDimension(stringBounder); } - + public MinMax getMinMax(StringBounder stringBounder) { return raw.getMinMax(stringBounder); } @@ -135,9 +142,20 @@ public class BpmElement extends AbstractConnectorPuzzle implements ConnectorPuzz } } + private StyleSignature getSignatureCircle() { + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.circle); + } + + private Style getStyle(ISkinParam skinParam) { + if (UseStyle.useBetaStyle()) + return getSignatureCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); + + return null; + } + public TextBlock toTextBlockInternal(ISkinParam skinParam) { if (type == BpmElementType.START) { - return new FtileCircleStart(skinParam, HColorUtils.BLACK, null, null); + return new FtileCircleStart(skinParam, HColorUtils.BLACK, null, getStyle(skinParam)); } if (type == BpmElementType.MERGE) { final HColor borderColor = SkinParamUtils.getColor(skinParam, null, ColorParam.activityBorder); diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java b/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java index 653d8af06..06fb65b39 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java @@ -139,9 +139,9 @@ public enum LinkDecor { case NOT_NAVIGABLE: return new ExtremityFactoryNotNavigable(); case AGREGATION: - return new ExtremityFactoryDiamond(false, backgroundColor); + return new ExtremityFactoryDiamond(false); case COMPOSITION: - return new ExtremityFactoryDiamond(true, backgroundColor); + return new ExtremityFactoryDiamond(true); case CIRCLE: return new ExtremityFactoryCircle(false, backgroundColor); case CIRCLE_FILL: diff --git a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index 33361e5e2..e7ab06ade 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.EmbeddedDiagram; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -55,9 +56,13 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockWithUrl; +import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.VisibilityModifier; 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.StyleSignature; import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.ugraphic.PlacementStrategy; @@ -68,6 +73,7 @@ import net.sourceforge.plantuml.ugraphic.PlacementStrategyY1Y2Right; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULayoutGroup; import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.utils.CharHidder; public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock, WithPorts { @@ -261,11 +267,23 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock, } }; } - final HColor back = modifier.getBackground() == null ? null - : rose.getHtmlColor(skinParam, modifier.getBackground()); - final HColor fore = rose.getHtmlColor(skinParam, modifier.getForeground()); + final HColor backColor; + final HColor borderColor; + if (UseStyle.useBetaStyle()) { + final Style style = modifier.getStyleSignature().getMergedStyle(skinParam.getCurrentStyleBuilder()); + borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()); + final boolean isField = modifier.isField(); + backColor = isField ? null + : style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), + skinParam.getIHtmlColorSet()); + } else { + borderColor = rose.getHtmlColor(skinParam, modifier.getForeground()); + backColor = modifier.getBackground() == null ? null + : rose.getHtmlColor(skinParam, modifier.getBackground()); + } - final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), fore, back, url != null); + final TextBlock uBlock = modifier.getUBlock(skinParam.classAttributeIconSize(), borderColor, backColor, + url != null); return TextBlockWithUrl.withUrl(uBlock, url); } diff --git a/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java b/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java index 1fecde7d1..e9c7c0893 100644 --- a/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java +++ b/src/net/sourceforge/plantuml/elk/CucaDiagramFileMakerElk.java @@ -261,7 +261,7 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker { final double shadowing; final UStroke stroke; if (UseStyle.useBetaStyle()) { - final Style style = Cluster.getDefaultStyleDefinition(umlDiagramType.getStyleName()) + final Style style = Cluster.getDefaultStyleDefinition(umlDiagramType.getStyleName(), group.getUSymbol()) .getMergedStyle(skinParam.getCurrentStyleBuilder()); shadowing = style.value(PName.Shadowing).asDouble(); stroke = Cluster.getStrokeInternal(group, skinParam, style); @@ -275,8 +275,8 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker { stroke = Cluster.getStrokeInternal(group, skinParam, null); } HColor backColor = getBackColor(umlDiagramType); - backColor = Cluster.getBackColor(backColor, skinParam, group.getStereotype(), - umlDiagramType.getStyleName()); + backColor = Cluster.getBackColor(backColor, skinParam, group.getStereotype(), umlDiagramType.getStyleName(), + group.getUSymbol()); final double roundCorner = group.getUSymbol() == null ? 0 : group.getUSymbol().getSkinParameter().getRoundCorner(skinParam, group.getStereotype()); diff --git a/src/net/sourceforge/plantuml/graphic/CircledCharacter.java b/src/net/sourceforge/plantuml/graphic/CircledCharacter.java index 9c21564a3..dbdf5b9b8 100644 --- a/src/net/sourceforge/plantuml/graphic/CircledCharacter.java +++ b/src/net/sourceforge/plantuml/graphic/CircledCharacter.java @@ -44,36 +44,35 @@ import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.color.HColor; +import net.sourceforge.plantuml.ugraphic.color.HColorAutomatic; public class CircledCharacter extends AbstractTextBlock implements TextBlock { private final String c; private final UFont font; - private final HColor innerCircle; - private final HColor circle; + private final HColor spotBackColor; + private final HColor spotBorder; private final HColor fontColor; private final double radius; - public CircledCharacter(char c, double radius, UFont font, HColor innerCircle, HColor circle, + public CircledCharacter(char c, double radius, UFont font, HColor spotBackColor, HColor spotBorder, HColor fontColor) { this.c = "" + c; this.radius = radius; this.font = font; - this.innerCircle = innerCircle; - this.circle = circle; - this.fontColor = fontColor; + this.spotBackColor = spotBackColor; + this.spotBorder = spotBorder; + if (fontColor instanceof HColorAutomatic) + this.fontColor = ((HColorAutomatic) fontColor).getAppropriateColor(spotBackColor); + else + this.fontColor = fontColor; } - // public void draw(ColorMapper colorMapper, Graphics2D g2d, int x, int y, double dpiFactor) { - // drawU(new UGraphicG2d(colorMapper, g2d, null, 1.0), x, y); - // } - public void drawU(UGraphic ug) { - if (circle != null) { - ug = ug.apply(circle); - } - // final HtmlColor back = ug.getParam().getBackcolor(); - ug = ug.apply(innerCircle.bg()); + if (spotBorder != null) + ug = ug.apply(spotBorder); + + ug = ug.apply(spotBackColor.bg()); ug.draw(new UEllipse(radius * 2, radius * 2)); ug = ug.apply(fontColor); ug = ug.apply(new UTranslate(radius, radius)); diff --git a/src/net/sourceforge/plantuml/graphic/USymbol.java b/src/net/sourceforge/plantuml/graphic/USymbol.java index 4111387b4..e87ee7918 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbol.java +++ b/src/net/sourceforge/plantuml/graphic/USymbol.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.skin.ActorStyle; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.PackageStyle; public abstract class USymbol { @@ -96,6 +97,7 @@ public abstract class USymbol { public final static USymbol TOGETHER = record("TOGETHER", SkinParameter.QUEUE, new USymbolTogether()); abstract public SkinParameter getSkinParameter(); + abstract public SName getSName(); // public USymbol withStereoAlignment(HorizontalAlignment alignment) { // return this; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolActor.java b/src/net/sourceforge/plantuml/graphic/USymbolActor.java index 320b08281..69ef2ea3a 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolActor.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolActor.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.graphic; import net.sourceforge.plantuml.skin.ActorStyle; +import net.sourceforge.plantuml.style.SName; class USymbolActor extends USymbolSimpleAbstract { @@ -50,6 +51,11 @@ class USymbolActor extends USymbolSimpleAbstract { public SkinParameter getSkinParameter() { return SkinParameter.ACTOR; } + + @Override + public SName getSName() { + return SName.actor; + } @Override protected TextBlock getDrawing(SymbolContext symbolContext) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java index 79da6d71c..4b386e0c4 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolArtifact.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.ULine; @@ -51,14 +52,18 @@ class USymbolArtifact extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.ARTIFACT; } + + @Override + public SName getSName() { + return SName.artifact; + } - private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, + + private void drawArtifact(UGraphic ug, double widthTotal, double heightTotal, double shadowing, double roundCorner) { final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); - if (shadowing) { - form.setDeltaShadow(4); - } + form.setDeltaShadow(shadowing); ug.draw(form); @@ -88,6 +93,7 @@ class USymbolArtifact extends USymbol { private Margin getMargin() { return new Margin(10, 10 + 10, 10 + 3, 10); } + @Override public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { @@ -97,7 +103,7 @@ class USymbolArtifact extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); @@ -121,7 +127,7 @@ class USymbolArtifact extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawArtifact(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereo = (width - dimStereo.getWidth()) / 2; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java b/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java index b28cf0ec6..9fd7531ca 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolBoundary.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.graphic; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.Boundary; class USymbolBoundary extends USymbolSimpleAbstract { @@ -43,6 +44,12 @@ class USymbolBoundary extends USymbolSimpleAbstract { public SkinParameter getSkinParameter() { return SkinParameter.BOUNDARY; } + + @Override + public SName getSName() { + return SName.boundary; + } + @Override protected TextBlock getDrawing(SymbolContext symbolContext) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCard.java b/src/net/sourceforge/plantuml/graphic/USymbolCard.java index d95865c0e..14adf11b6 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCard.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCard.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.ULine; @@ -51,17 +52,22 @@ class USymbolCard extends USymbol { public USymbolCard(SkinParameter skinParameter) { this.skinParameter = skinParameter; } + + @Override + public SName getSName() { + return SName.card; + } + @Override public SkinParameter getSkinParameter() { return skinParameter; } - private void drawCard(UGraphic ug, double width, double height, boolean shadowing, double top, double roundCorner) { + private void drawCard(UGraphic ug, double width, double height, double shadowing, double top, double roundCorner) { final URectangle shape = new URectangle(width, height).rounded(roundCorner); - if (shadowing) { - shape.setDeltaShadow(3.0); - } + shape.setDeltaShadow(shadowing); + ug.draw(shape); if (top != 0) { ug.apply(UTranslate.dy(top)).draw(ULine.hline(width)); @@ -81,7 +87,7 @@ class USymbolCard extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), 0, + drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), 0, symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); @@ -107,7 +113,7 @@ class USymbolCard extends USymbol { ug = symbolContext.apply(ug); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder()); - drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawCard(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), dimTitle.getHeight() + dimStereo.getHeight() + 4, symbolContext.getRoundCorner()); final double posStereo = (width - dimStereo.getWidth()) / 2; stereotype.drawU(ug.apply(new UTranslate(posStereo, 2))); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCloud.java b/src/net/sourceforge/plantuml/graphic/USymbolCloud.java index defb530e3..3a879d830 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCloud.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCloud.java @@ -42,6 +42,7 @@ import java.util.List; import java.util.Random; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.UPath; @@ -60,12 +61,17 @@ class USymbolCloud extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.CLOUD; } + + @Override + public SName getSName() { + return SName.cloud; + } - private void drawCloud(UGraphic ug, double width, double height, boolean shadowing) { + + private void drawCloud(UGraphic ug, double width, double height, double shadowing) { final UPath shape = getSpecificFrontierForCloud(width, height); - if (shadowing) { - shape.setDeltaShadow(3.0); - } + shape.setDeltaShadow(shadowing); + ug.apply(UTranslate.dy(0)).draw(shape); } @@ -226,7 +232,7 @@ class USymbolCloud extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1()))); @@ -249,7 +255,7 @@ class USymbolCloud extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawCloud(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereo = (width - dimStereo.getWidth()) / 2; stereotype.drawU(ug.apply(new UTranslate(posStereo, 13))); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolCollections.java b/src/net/sourceforge/plantuml/graphic/USymbolCollections.java index e4db4c59f..d7bd3ecc9 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolCollections.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolCollections.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -62,13 +63,18 @@ class USymbolCollections extends USymbol { public SkinParameter getSkinParameter() { return skinParameter; } + + @Override + public SName getSName() { + return SName.collections; + } - private void drawCollections(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) { + + private void drawCollections(UGraphic ug, double width, double height, double shadowing, double roundCorner) { final URectangle small = new URectangle(width - getDeltaCollection(), height - getDeltaCollection()) .rounded(roundCorner); - if (shadowing) { - small.setDeltaShadow(3.0); - } + small.setDeltaShadow(shadowing); + ug.apply(new UTranslate(getDeltaCollection(), getDeltaCollection())).draw(small); small.setDeltaShadow(0); ug.apply(UTranslate.dy(0)).draw(small); @@ -91,7 +97,7 @@ class USymbolCollections extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment); @@ -115,7 +121,7 @@ class USymbolCollections extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawCollections(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereoX; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java index 1b1efdde1..c47528520 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent1.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -50,14 +51,18 @@ class USymbolComponent1 extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.COMPONENT1; } + + @Override + public SName getSName() { + return SName.component; + } - private void drawComponent1(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, + + private void drawComponent1(UGraphic ug, double widthTotal, double heightTotal, double shadowing, double roundCorner) { final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); - if (shadowing) { - form.setDeltaShadow(4); - } + form.setDeltaShadow(shadowing); ug.draw(form); final UShape small = new URectangle(10, 5); @@ -82,7 +87,7 @@ class USymbolComponent1 extends USymbol { final Dimension2D dimTotal = calculateDimension(stringBounder); ug = UGraphicStencil.create(ug, dimTotal); ug = symbolContext.apply(ug); - drawComponent1(ug, dimTotal.getWidth(), dimTotal.getHeight(), symbolContext.isShadowing(), + drawComponent1(ug, dimTotal.getWidth(), dimTotal.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java index 3e2785caf..1540a0b1b 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolComponent2.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -50,14 +51,18 @@ class USymbolComponent2 extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.COMPONENT2; } + + @Override + public SName getSName() { + return SName.component; + } - private void drawComponent2(UGraphic ug, double widthTotal, double heightTotal, boolean shadowing, + + private void drawComponent2(UGraphic ug, double widthTotal, double heightTotal, double shadowing, double roundCorner) { final URectangle form = new URectangle(widthTotal, heightTotal).rounded(roundCorner); - if (shadowing) { - form.setDeltaShadow(4); - } + form.setDeltaShadow(shadowing); final UShape small = new URectangle(15, 10); final UShape tiny = new URectangle(4, 2); @@ -84,7 +89,7 @@ class USymbolComponent2 extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Margin margin = getMargin(); @@ -110,7 +115,7 @@ class USymbolComponent2 extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawComponent2(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereo = (width - dimStereo.getWidth()) / 2; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolControl.java b/src/net/sourceforge/plantuml/graphic/USymbolControl.java index 0bdaa45ac..69c9a5b92 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolControl.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolControl.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.graphic; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.Control; class USymbolControl extends USymbolSimpleAbstract { @@ -43,6 +44,12 @@ class USymbolControl extends USymbolSimpleAbstract { public SkinParameter getSkinParameter() { return SkinParameter.CONTROL; } + + @Override + public SName getSName() { + return SName.control; + } + @Override protected TextBlock getDrawing(final SymbolContext symbolContext) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java b/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java index 4b3c6f5da..648e2fc21 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolDatabase.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -53,12 +54,17 @@ class USymbolDatabase extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.DATABASE; } + + @Override + public SName getSName() { + return SName.database; + } - private void drawDatabase(UGraphic ug, double width, double height, boolean shadowing) { + + private void drawDatabase(UGraphic ug, double width, double height, double shadowing) { final UPath shape = new UPath(); - if (shadowing) { - shape.setDeltaShadow(3.0); - } + shape.setDeltaShadow(shadowing); + shape.moveTo(0, 10); shape.cubicTo(0, 0, width / 2, 0, width / 2, 0); shape.cubicTo(width / 2, 0, width, 0, width, 10); @@ -74,7 +80,8 @@ class USymbolDatabase extends USymbol { if (UseStyle.useBetaStyle()) { ug.apply(new UTranslate(width, height)).draw(new UEmpty(10, 10)); - // ug.apply(HColorUtils.BLACK).apply(new UTranslate(width, height)).draw(new URectangle(10, 10)); + // ug.apply(HColorUtils.BLACK).apply(new UTranslate(width, height)).draw(new + // URectangle(10, 10)); } } @@ -126,7 +133,7 @@ class USymbolDatabase extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); final UGraphic ug2 = new MyUGraphicDatabase(ug, dim.getWidth()); @@ -150,7 +157,7 @@ class USymbolDatabase extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawDatabase(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereo = (width - dimStereo.getWidth()) / 2; stereotype.drawU(ug.apply(new UTranslate(posStereo, 2 + 20))); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java b/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java index 52f34df5b..3d641f0e2 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolEntityDomain.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.graphic; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.EntityDomain; class USymbolEntityDomain extends USymbolSimpleAbstract { @@ -43,6 +44,12 @@ class USymbolEntityDomain extends USymbolSimpleAbstract { public SkinParameter getSkinParameter() { return SkinParameter.ENTITY; } + + @Override + public SName getSName() { + return SName.entity; + } + @Override protected TextBlock getDrawing(final SymbolContext symbolContext) { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFile.java b/src/net/sourceforge/plantuml/graphic/USymbolFile.java index 4fa32cbf7..cda6c024d 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFile.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFile.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; @@ -54,8 +55,14 @@ class USymbolFile extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.FILE; } + + @Override + public SName getSName() { + return SName.file; + } - private void drawFile(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) { + + private void drawFile(UGraphic ug, double width, double height, double shadowing, double roundCorner) { final int cornersize = 10; final Shadowable out; if (roundCorner == 0) { @@ -81,9 +88,7 @@ class USymbolFile extends USymbol { out = path; } - if (shadowing) { - out.setDeltaShadow(3.0); - } + out.setDeltaShadow(shadowing); ug.draw(out); final UPath path = new UPath(); @@ -111,7 +116,7 @@ class USymbolFile extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); @@ -135,7 +140,7 @@ class USymbolFile extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawFile(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereoX; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFolder.java b/src/net/sourceforge/plantuml/graphic/USymbolFolder.java index 50b6f06f2..af2aa2a07 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFolder.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFolder.java @@ -40,6 +40,7 @@ import java.awt.geom.Point2D; import java.util.Objects; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; @@ -74,8 +75,14 @@ public class USymbolFolder extends USymbol { public SkinParameter getSkinParameter() { return skinParameter; } + + @Override + public SName getSName() { + return SName.folder; + } - private void drawFolder(UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing, + + private void drawFolder(UGraphic ug, double width, double height, Dimension2D dimTitle, double shadowing, double roundCorner) { final double wtitle; @@ -116,9 +123,8 @@ public class USymbolFolder extends USymbol { path.closePath(); shape = path; } - if (shadowing) { - shape.setDeltaShadow(3.0); - } + shape.setDeltaShadow(shadowing); + ug.draw(shape); ug.apply(UTranslate.dy(htitle)).draw(ULine.hline(wtitle + marginTitleX3)); } @@ -148,7 +154,7 @@ public class USymbolFolder extends USymbol { ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); final Dimension2D dimName = getDimName(ug.getStringBounder()); - drawFolder(ug, dim.getWidth(), dim.getHeight(), dimName, symbolContext.isShadowing(), + drawFolder(ug, dim.getWidth(), dim.getHeight(), dimName, symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); @@ -182,7 +188,7 @@ public class USymbolFolder extends USymbol { final Dimension2D dim = calculateDimension(stringBounder); ug = symbolContext.apply(ug); final Dimension2D dimTitle = title.calculateDimension(stringBounder); - drawFolder(ug, dim.getWidth(), dim.getHeight(), dimTitle, symbolContext.isShadowing(), + drawFolder(ug, dim.getWidth(), dim.getHeight(), dimTitle, symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); title.drawU(ug.apply(new UTranslate(4, 2))); final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolFrame.java b/src/net/sourceforge/plantuml/graphic/USymbolFrame.java index 402fb8f7e..dbee931c9 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolFrame.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolFrame.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; @@ -53,13 +54,16 @@ class USymbolFrame extends USymbol { return SkinParameter.FRAME; } - private void drawFrame(UGraphic ug, double width, double height, Dimension2D dimTitle, boolean shadowing, + @Override + public SName getSName() { + return SName.frame; + } + + private void drawFrame(UGraphic ug, double width, double height, Dimension2D dimTitle, double shadowing, double roundCorner) { final Shadowable shape = new URectangle(width, height).rounded(roundCorner).ignoreForCompressionOnX() .ignoreForCompressionOnY(); - if (shadowing) { - shape.setDeltaShadow(3.0); - } + shape.setDeltaShadow(shadowing); ug.draw(shape); @@ -87,9 +91,9 @@ class USymbolFrame extends USymbol { } private double getYpos(Dimension2D dimTitle) { - if (dimTitle.getWidth() == 0) { + if (dimTitle.getWidth() == 0) return 12; - } + return dimTitle.getHeight() + 3; } @@ -106,8 +110,8 @@ class USymbolFrame extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawFrame(ug, dim.getWidth(), dim.getHeight(), new Dimension2DDouble(0, 0), symbolContext.isShadowing(), - symbolContext.getRoundCorner()); + drawFrame(ug, dim.getWidth(), dim.getHeight(), new Dimension2DDouble(0, 0), + symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1()))); @@ -133,16 +137,15 @@ class USymbolFrame extends USymbol { ug = symbolContext.apply(ug); final Dimension2D dimTitle = title.calculateDimension(stringBounder); final double widthFull = dim.getWidth(); - drawFrame(ug, widthFull, dim.getHeight(), dimTitle, symbolContext.isShadowing(), + drawFrame(ug, widthFull, dim.getHeight(), dimTitle, symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final double widthTitle = title.calculateDimension(stringBounder).getWidth(); // Temporary hack... - if (widthFull - widthTitle < 25) { + if (widthFull - widthTitle < 25) title.drawU(ug.apply(new UTranslate(3, 1))); - } else { + else ug.apply(new UTranslate(3, 1)).draw(new SpecialText(title)); - } final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder); final double posStereo = (width - dimStereo.getWidth()) / 2; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolHexagon.java b/src/net/sourceforge/plantuml/graphic/USymbolHexagon.java index 86cbab92a..7ef121c26 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolHexagon.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolHexagon.java @@ -38,8 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; -import net.sourceforge.plantuml.graphic.USymbol.Margin; -import net.sourceforge.plantuml.ugraphic.Shadowable; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPath; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -50,6 +49,12 @@ public class USymbolHexagon extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.HEXAGON; } + + @Override + public SName getSName() { + return SName.hexagon; + } + private final double marginY = 5; @@ -76,7 +81,7 @@ public class USymbolHexagon extends USymbol { }; } - private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner, + private void drawRect(UGraphic ug, double width, double height, double shadowing, double roundCorner, double diagonalCorner) { // final UShape shape = new URectangle(width, height); final UPath shape = new UPath(); @@ -89,17 +94,16 @@ public class USymbolHexagon extends USymbol { shape.lineTo(dx, height); shape.lineTo(0, height / 2); shape.closePath(); - if (shadowing) { - shape.setDeltaShadow(3.0); - } + + shape.setDeltaShadow(shadowing); + ug.draw(shape); } - + private Margin getMargin() { return new Margin(10, 10, 10, 10); } - @Override public TextBlock asBig(final TextBlock title, final HorizontalAlignment labelAlignment, final TextBlock stereotype, final double width, final double height, final SymbolContext symbolContext, @@ -108,7 +112,7 @@ public class USymbolHexagon extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner(), 0); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereoX; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolInterface.java b/src/net/sourceforge/plantuml/graphic/USymbolInterface.java index 62d409fff..12396465a 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolInterface.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolInterface.java @@ -35,6 +35,7 @@ */ package net.sourceforge.plantuml.graphic; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.CircleInterface2; public class USymbolInterface extends USymbolSimpleAbstract { @@ -44,6 +45,12 @@ public class USymbolInterface extends USymbolSimpleAbstract { return SkinParameter.INTERFACE; } + @Override + public SName getSName() { + return SName.interface_; + } + + @Override protected TextBlock getDrawing(SymbolContext symbolContext) { return new CircleInterface2(symbolContext.getBackColor(), symbolContext.getForeColor(), diff --git a/src/net/sourceforge/plantuml/graphic/USymbolLabel.java b/src/net/sourceforge/plantuml/graphic/USymbolLabel.java index 418255bf9..00ecd67e6 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolLabel.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolLabel.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -49,6 +50,12 @@ class USymbolLabel extends USymbol { public USymbolLabel(SkinParameter skinParameter) { this.skinParameter = skinParameter; } + + @Override + public SName getSName() { + return SName.label; + } + @Override public SkinParameter getSkinParameter() { diff --git a/src/net/sourceforge/plantuml/graphic/USymbolNode.java b/src/net/sourceforge/plantuml/graphic/USymbolNode.java index d3b8fc9f3..905aacfe4 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolNode.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolNode.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.UseStyle; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.UEmpty; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -56,6 +57,12 @@ class USymbolNode extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.NODE; } + + @Override + public SName getSName() { + return SName.node; + } + // public USymbolNode(HorizontalAlignment stereotypeAlignement) { // this.stereotypeAlignement = stereotypeAlignement; @@ -66,7 +73,7 @@ class USymbolNode extends USymbol { // return new USymbolNode(alignment); // } - private void drawNode(UGraphic ug, double width, double height, boolean shadowing) { + private void drawNode(UGraphic ug, double width, double height, double shadowing) { final UPolygon shape = new UPolygon(); shape.addPoint(0, 10); shape.addPoint(10, 0); @@ -75,14 +82,13 @@ class USymbolNode extends USymbol { shape.addPoint(width - 10, height); shape.addPoint(0, height); shape.addPoint(0, 10); - if (shadowing) { - shape.setDeltaShadow(2); - } + + shape.setDeltaShadow(shadowing); + ug.draw(shape); ug.apply(new UTranslate(width - 10, 10)).draw(new ULine(10, -10)); - - + ug.apply(UTranslate.dy(10)).draw(ULine.hline(width - 10)); ug.apply(new UTranslate(width - 10, 10)).draw(ULine.vline(height - 10)); if (UseStyle.useBetaStyle()) { @@ -135,7 +141,7 @@ class USymbolNode extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment); final UGraphic ug2 = new MyUGraphicNode(ug, dim.getWidth()); @@ -152,13 +158,14 @@ class USymbolNode extends USymbol { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawNode(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); ug = ug.apply(new UTranslate(-4, 11)); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolPerson.java b/src/net/sourceforge/plantuml/graphic/USymbolPerson.java index a834140e8..4a2821163 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolPerson.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolPerson.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; @@ -50,14 +51,20 @@ class USymbolPerson extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.PERSON; } + + @Override + public SName getSName() { + return SName.person; + } - private void drawHeadAndBody(UGraphic ug, boolean shadowing, Dimension2D dimBody, double headSize) { + + private void drawHeadAndBody(UGraphic ug, double shadowing, Dimension2D dimBody, double headSize) { final UEllipse head = new UEllipse(headSize, headSize); final URectangle body = new URectangle(dimBody).rounded(headSize); - if (shadowing) { - body.setDeltaShadow(3.0); - head.setDeltaShadow(1.0); - } + + body.setDeltaShadow(shadowing); + head.setDeltaShadow(shadowing); + final double posx = (dimBody.getWidth() - headSize) / 2; ug.apply(UTranslate.dx(posx)).draw(head); ug.apply(UTranslate.dy(headSize)).draw(body); @@ -83,7 +90,7 @@ class USymbolPerson extends USymbol { ug = UGraphicStencil.create(ug, dimFull); ug = symbolContext.apply(ug); final double headSize = headSize(dimBody); - drawHeadAndBody(ug, symbolContext.isShadowing(), dimBody, headSize); + drawHeadAndBody(ug, symbolContext.getDeltaShadow(), dimBody, headSize); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment); final Margin margin = getMargin(); tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1() + headSize))); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolQueue.java b/src/net/sourceforge/plantuml/graphic/USymbolQueue.java index 657833545..dc7a4c961 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolQueue.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolQueue.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.creole.Stencil; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UHorizontalLine; @@ -52,14 +53,19 @@ class USymbolQueue extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.QUEUE; } + + @Override + public SName getSName() { + return SName.queue; + } + private final double dx = 5; - private void drawQueue(UGraphic ug, double width, double height, boolean shadowing) { + private void drawQueue(UGraphic ug, double width, double height, double shadowing) { final UPath shape = new UPath(); - if (shadowing) { - shape.setDeltaShadow(3.0); - } + shape.setDeltaShadow(shadowing); + shape.moveTo(dx, 0); shape.lineTo(width - dx, 0); shape.cubicTo(width, 0, width, height / 2, width, height / 2); @@ -135,7 +141,7 @@ class USymbolQueue extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); final UGraphic ug2 = new MyUGraphicQueue(ug, dim.getWidth() - 2 * dx, dim.getWidth() - dx, @@ -153,13 +159,14 @@ class USymbolQueue extends USymbol { @Override public TextBlock asBig(final TextBlock title, HorizontalAlignment labelAlignment, final TextBlock stereotype, - final double width, final double height, final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { + final double width, final double height, final SymbolContext symbolContext, + final HorizontalAlignment stereoAlignment) { return new AbstractTextBlock() { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereo = (width - dimStereo.getWidth()) / 2; stereotype.drawU(ug.apply(new UTranslate(posStereo, 2))); diff --git a/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java b/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java index 814bf3196..0df7f8071 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.Shadowable; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; @@ -52,18 +53,21 @@ class USymbolRectangle extends USymbol { this.skinParameter = skinParameter; } + @Override + public SName getSName() { + return SName.rectangle; + } + @Override public SkinParameter getSkinParameter() { return skinParameter; } - private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner, + private void drawRect(UGraphic ug, double width, double height, double shadowing, double roundCorner, double diagonalCorner) { final URectangle rect = new URectangle(width, height); final Shadowable shape = diagonalCorner > 0 ? rect.diagonalCorner(diagonalCorner) : rect.rounded(roundCorner); - if (shadowing) { - shape.setDeltaShadow(3.0); - } + shape.setDeltaShadow(shadowing); ug.draw(shape); } @@ -80,7 +84,7 @@ class USymbolRectangle extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner(), symbolContext.getDiagonalCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment); @@ -103,7 +107,7 @@ class USymbolRectangle extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner(), 0); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereoX; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolStack.java b/src/net/sourceforge/plantuml/graphic/USymbolStack.java index 27737f4b3..5874db1a8 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolStack.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolStack.java @@ -39,6 +39,7 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.UPath; @@ -52,8 +53,14 @@ class USymbolStack extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.STACK; } + + @Override + public SName getSName() { + return SName.stack; + } - private void drawQueue(UGraphic ug, double width, double height, boolean shadowing, double roundCorner) { + + private void drawQueue(UGraphic ug, double width, double height, double shadowing, double roundCorner) { final double border = 15; final URectangle rect = new URectangle(width - 2 * border, height).rounded(roundCorner); @@ -79,9 +86,7 @@ class USymbolStack extends USymbol { path.arcTo(new Point2D.Double(width - border + roundCorner / 2, 0), roundCorner / 2, 0, 1); path.lineTo(width, 0); } - if (shadowing) { - path.setDeltaShadow(3.0); - } + path.setDeltaShadow(shadowing); ug.apply(new HColorNone().bg()).draw(path); } @@ -98,7 +103,7 @@ class USymbolStack extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); @@ -122,7 +127,7 @@ class USymbolStack extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(), + drawQueue(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow(), symbolContext.getRoundCorner()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereo = (width - dimStereo.getWidth()) / 2; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolStorage.java b/src/net/sourceforge/plantuml/graphic/USymbolStorage.java index 817a48f97..a63f7eebd 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolStorage.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolStorage.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphicStencil; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -50,11 +51,15 @@ class USymbolStorage extends USymbol { return SkinParameter.STORAGE; } - private void drawStorage(UGraphic ug, double width, double height, boolean shadowing) { + @Override + public SName getSName() { + return SName.storage; + } + + private void drawStorage(UGraphic ug, double width, double height, double shadowing) { final URectangle shape = new URectangle(width, height).rounded(70); - if (shadowing) { - shape.setDeltaShadow(3.0); - } + shape.setDeltaShadow(shadowing); + ug.draw(shape); } @@ -71,7 +76,7 @@ class USymbolStorage extends USymbol { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = UGraphicStencil.create(ug, dim); ug = symbolContext.apply(ug); - drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Margin margin = getMargin(); final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, HorizontalAlignment.CENTER); tb.drawU(ug.apply(new UTranslate(margin.getX1(), margin.getY1()))); @@ -94,7 +99,7 @@ class USymbolStorage extends USymbol { public void drawU(UGraphic ug) { final Dimension2D dim = calculateDimension(ug.getStringBounder()); ug = symbolContext.apply(ug); - drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing()); + drawStorage(ug, dim.getWidth(), dim.getHeight(), symbolContext.getDeltaShadow()); final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder()); final double posStereo = (width - dimStereo.getWidth()) / 2; diff --git a/src/net/sourceforge/plantuml/graphic/USymbolTogether.java b/src/net/sourceforge/plantuml/graphic/USymbolTogether.java index d7232d532..76bfed439 100644 --- a/src/net/sourceforge/plantuml/graphic/USymbolTogether.java +++ b/src/net/sourceforge/plantuml/graphic/USymbolTogether.java @@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic; import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.ugraphic.UGraphic; class USymbolTogether extends USymbol { @@ -46,6 +47,12 @@ class USymbolTogether extends USymbol { public SkinParameter getSkinParameter() { return SkinParameter.STORAGE; } + + @Override + public SName getSName() { + return SName.storage; + } + @Override public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, diff --git a/src/net/sourceforge/plantuml/sequencediagram/Grouping.java b/src/net/sourceforge/plantuml/sequencediagram/Grouping.java index 59ee4ee64..e4a0447e5 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Grouping.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Grouping.java @@ -65,9 +65,8 @@ public abstract class Grouping implements Event, WithStyle { public Style[] getUsedStyles() { return new Style[] { - style, - styleHeader == null ? styleHeader : styleHeader.eventuallyOverride(PName.BackGroundColor, - backColorElement) }; + style == null ? null : style.eventuallyOverride(PName.BackGroundColor, getBackColorGeneral()), + styleHeader == null ? null : styleHeader.eventuallyOverride(PName.BackGroundColor, backColorElement) }; } public Grouping(String title, String comment, GroupingType type, HColor backColorElement, diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandSkin.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandSkin.java index 9bf9f91ea..888fb7496 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandSkin.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandSkin.java @@ -39,6 +39,7 @@ import java.io.IOException; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.TitledDiagram; +import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -62,6 +63,7 @@ public class CommandSkin extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(TitledDiagram diagram, LineLocation location, RegexResult arg) { try { + UseStyle.setBetaStyle(true); return diagram.loadSkin(arg.get("SKIN", 0)); } catch (IOException e) { return CommandExecutionResult.error("Skin read error"); diff --git a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java index 901f34afe..264cc82e2 100644 --- a/src/net/sourceforge/plantuml/skin/VisibilityModifier.java +++ b/src/net/sourceforge/plantuml/skin/VisibilityModifier.java @@ -46,6 +46,8 @@ import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.UDrawable; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.ugraphic.UEllipse; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; @@ -105,9 +107,9 @@ public enum VisibilityModifier { } public void drawU(UGraphic ug) { - if (withInvisibleRectanble) { + if (withInvisibleRectanble) ug.apply(new HColorNone()).draw(new URectangle(size * 2, size)); - } + drawInternal(ug, size, foregroundColor, backgoundColor, 0, 0); } }; @@ -115,11 +117,11 @@ public enum VisibilityModifier { private void drawInternal(UGraphic ug, int size, final HColor foregroundColor, final HColor backgoundColor, double x, double y) { - if (backgoundColor == null) { + if (backgoundColor == null) ug = ug.apply(new HColorNone().bg()); - } else { + else ug = ug.apply(backgoundColor.bg()); - } + ug = ug.apply(foregroundColor); size = ensureEven(size); switch (this) { @@ -173,9 +175,8 @@ public enum VisibilityModifier { } static private int ensureEven(int n) { - if (n % 2 == 1) { + if (n % 2 == 1) n--; - } return n; } @@ -199,97 +200,96 @@ public enum VisibilityModifier { } public static boolean isVisibilityCharacter(CharSequence s) { - if (s.length() <= 2) { + if (s.length() <= 2) return false; - } + final char c = s.charAt(0); - if (s.charAt(1) == c) { + if (s.charAt(1) == c) return false; - } - if (c == '-') { + + if (c == '-') return true; - } - if (c == '#') { + + if (c == '#') return true; - } - if (c == '+') { + + if (c == '+') return true; - } - if (c == '~') { + + if (c == '~') return true; - } - if (c == '*') { + + if (c == '*') return true; - } + return false; } public static VisibilityModifier getByUnicode(char c) { - for (VisibilityModifier modifier : VisibilityModifier.values()) { - if (modifier.unicode == c) { + for (VisibilityModifier modifier : VisibilityModifier.values()) + if (modifier.unicode == c) return modifier; - } - } + return null; } public static String replaceVisibilityModifierByUnicodeChar(String s, boolean isField) { final VisibilityModifier modifier = getVisibilityModifier(s, isField); - if (modifier == null) { + if (modifier == null) return s; - } + return "" + modifier.unicode + s.substring(1); } public static VisibilityModifier getVisibilityModifier(CharSequence s, boolean isField) { - if (s.length() <= 2) { + if (s.length() <= 2) return null; - } + final char c = s.charAt(0); - if (s.charAt(1) == c) { + if (s.charAt(1) == c) return null; - } - if (isField) { + + if (isField) return getVisibilityModifierForField(c); - } + return getVisibilityModifierForMethod(c); } private static VisibilityModifier getVisibilityModifierForField(char c) { - if (c == '-') { + if (c == '-') return VisibilityModifier.PRIVATE_FIELD; - } - if (c == '#') { + + if (c == '#') return VisibilityModifier.PROTECTED_FIELD; - } - if (c == '+') { + + if (c == '+') return VisibilityModifier.PUBLIC_FIELD; - } - if (c == '~') { + + if (c == '~') return VisibilityModifier.PACKAGE_PRIVATE_FIELD; - } - if (c == '*') { + + if (c == '*') return VisibilityModifier.IE_MANDATORY; - } + return null; } private static VisibilityModifier getVisibilityModifierForMethod(char c) { - if (c == '-') { + if (c == '-') return VisibilityModifier.PRIVATE_METHOD; - } - if (c == '#') { + + if (c == '#') return VisibilityModifier.PROTECTED_METHOD; - } - if (c == '+') { + + if (c == '+') return VisibilityModifier.PUBLIC_METHOD; - } - if (c == '~') { + + if (c == '~') return VisibilityModifier.PACKAGE_PRIVATE_METHOD; - } - if (c == '*') { + + if (c == '*') return VisibilityModifier.IE_MANDATORY; - } + return null; } @@ -302,18 +302,44 @@ public enum VisibilityModifier { } public String getXmiVisibility() { - if (this == PUBLIC_FIELD || this == PUBLIC_METHOD) { + if (this == PUBLIC_FIELD || this == PUBLIC_METHOD) return "public"; - } - if (this == PRIVATE_FIELD || this == PRIVATE_METHOD) { + + if (this == PRIVATE_FIELD || this == PRIVATE_METHOD) return "private"; - } - if (this == PROTECTED_FIELD || this == PROTECTED_METHOD) { + + if (this == PROTECTED_FIELD || this == PROTECTED_METHOD) return "protected"; - } - if (this == PACKAGE_PRIVATE_FIELD || this == VisibilityModifier.PACKAGE_PRIVATE_METHOD) { + + if (this == PACKAGE_PRIVATE_FIELD || this == VisibilityModifier.PACKAGE_PRIVATE_METHOD) return "package"; - } + + throw new IllegalStateException(); + } + + public boolean isField() { + if (this == PUBLIC_FIELD || this == PRIVATE_FIELD || this == PROTECTED_FIELD || this == PACKAGE_PRIVATE_FIELD) + return true; + + return false; + } + + public StyleSignature getStyleSignature() { + if (this == IE_MANDATORY) + return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.IEMandatory); + + if (this == PUBLIC_FIELD || this == PUBLIC_METHOD) + return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.public_); + + if (this == PRIVATE_FIELD || this == PRIVATE_METHOD) + return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.private_); + + if (this == PROTECTED_FIELD || this == PROTECTED_METHOD) + return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.protected_); + + if (this == PACKAGE_PRIVATE_FIELD || this == VisibilityModifier.PACKAGE_PRIVATE_METHOD) + return StyleSignature.of(SName.root, SName.element, SName.visibilityIcon, SName.package_); + throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java index 7a34baa5f..391832dae 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java @@ -59,6 +59,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColorBackground; import net.sourceforge.plantuml.ugraphic.color.HColorNone; +import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class ComponentRoseGroupingElse extends AbstractTextualComponent { @@ -73,10 +74,11 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent { if (UseStyle.useBetaStyle()) { this.roundCorner = style.value(PName.RoundCorner).asInt(); - if (spriteContainer instanceof SkinParamBackcolored) { - style = style.eventuallyOverride(PName.BackGroundColor, - ((SkinParamBackcolored) spriteContainer).getBackgroundColor()); - } +// if (spriteContainer instanceof SkinParamBackcolored) { +// final HColor backgroundColor2 = ((SkinParamBackcolored) spriteContainer).getBackgroundColor(); +// System.err.println("toto2=" + backgroundColor2); +// style = style.eventuallyOverride(PName.BackGroundColor, backgroundColor2); +// } this.groupBorder = style.value(PName.LineColor).asColor(spriteContainer.getThemeStyle(), getIHtmlColorSet()); this.backgroundColor = style.value(PName.BackGroundColor).asColor(spriteContainer.getThemeStyle(), @@ -90,9 +92,12 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent { @Override protected void drawBackgroundInternalU(UGraphic ug, Area area) { - if (backgroundColor instanceof HColorBackground) { + if (backgroundColor instanceof HColorBackground) return; - } + + if (HColorUtils.isTransparent(backgroundColor)) + return; + final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = ug.apply(new HColorNone()).apply(backgroundColor.bg()); final double width = dimensionToUse.getWidth(); diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java index 011bba42c..17d3050dd 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java @@ -180,4 +180,4 @@ public class CommandCreateState extends SingleLineCommand2 { return null; } -} +} \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java b/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java index c2f612bfc..14d7790fe 100644 --- a/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java +++ b/src/net/sourceforge/plantuml/style/FromSkinparamToStyle.java @@ -71,6 +71,8 @@ public class FromSkinparamToStyle { addConFont("header", SName.header); addConFont("footer", SName.footer); + + addConvert("defaultFontSize", PName.FontSize, SName.element); addConvert("sequenceStereotypeFontSize", PName.FontSize, SName.stereotype); addConvert("sequenceStereotypeFontStyle", PName.FontStyle, SName.stereotype); @@ -114,6 +116,8 @@ public class FromSkinparamToStyle { addConvert("hyperlinkColor", PName.HyperLinkColor, SName.root); addConvert("activityStartColor", PName.LineColor, SName.circle); + addConvert("activityEndColor", PName.LineColor, SName.circle, SName.end); + addConvert("activityStopColor", PName.LineColor, SName.circle, SName.stop); addConvert("activityBarColor", PName.LineColor, SName.activityBar); addConvert("activityBorderColor", PName.LineColor, SName.activity); addConvert("activityBorderThickness", PName.LineThickness, SName.activity); diff --git a/src/net/sourceforge/plantuml/style/SName.java b/src/net/sourceforge/plantuml/style/SName.java index 64f18ce7b..dcf54d13c 100644 --- a/src/net/sourceforge/plantuml/style/SName.java +++ b/src/net/sourceforge/plantuml/style/SName.java @@ -68,6 +68,8 @@ public enum SName { document, // element, // entity, // + end, // + stop, // file, // folder, // footer, // @@ -121,6 +123,20 @@ public enum SName { undone, // unstarted, // usecase, // + + visibilityIcon, // + private_, // + protected_, // + public_, // + IEMandatory, // + spot, // + spotAnnotation, // + spotInterface, // + spotEnum, // + spotEntity, // + spotClass, // + spotAbstractClass, // + wbsDiagram, // yamlDiagram; // diff --git a/src/net/sourceforge/plantuml/style/Style.java b/src/net/sourceforge/plantuml/style/Style.java index d9ed42ca3..2561967a4 100644 --- a/src/net/sourceforge/plantuml/style/Style.java +++ b/src/net/sourceforge/plantuml/style/Style.java @@ -106,7 +106,18 @@ public class Style { final Value resultDark = map.get(PName.DARK_BackGroundColor); if (resultDark != null) return new ValueForDark(result, resultDark); - + } else if (name == PName.LineColor) { + final Value resultDark = map.get(PName.DARK_LineColor); + if (resultDark != null) + return new ValueForDark(result, resultDark); + } else if (name == PName.FontColor) { + final Value resultDark = map.get(PName.DARK_FontColor); + if (resultDark != null) + return new ValueForDark(result, resultDark); + } else if (name == PName.HyperLinkColor) { + final Value resultDark = map.get(PName.DARK_HyperLinkColor); + if (resultDark != null) + return new ValueForDark(result, resultDark); } return result; @@ -130,20 +141,6 @@ public class Style { return new Style(this.signature.mergeWith(other.getSignature()), both); } -// private Style mergeIfUnknownWith(Style other) { -// if (other == null) { -// return this; -// } -// final EnumMap both = new EnumMap(this.map); -// for (Entry ent : other.map.entrySet()) { -// final Value previous = this.map.get(ent.getKey()); -// if (previous == null) -// both.put(ent.getKey(), ent.getValue()); -// -// } -// return new Style(this.signature.mergeWith(other.getSignature()), both, this.scheme); -// } - public Style eventuallyOverride(PName param, HColor color) { if (color == null) return this; diff --git a/src/net/sourceforge/plantuml/style/StyleBuilder.java b/src/net/sourceforge/plantuml/style/StyleBuilder.java index 6a04d4eff..6dd357801 100644 --- a/src/net/sourceforge/plantuml/style/StyleBuilder.java +++ b/src/net/sourceforge/plantuml/style/StyleBuilder.java @@ -47,13 +47,13 @@ import net.sourceforge.plantuml.SkinParam; public class StyleBuilder implements AutomaticCounter { - private final Map styles = new LinkedHashMap(); + private final Map stylesMap = new LinkedHashMap(); private final Set printedForLog; private final SkinParam skinParam; private int counter; public void printMe() { - for (Entry ent : styles.entrySet()) + for (Entry ent : stylesMap.entrySet()) ent.getValue().printMe(); } @@ -77,7 +77,7 @@ public class StyleBuilder implements AutomaticCounter { name = name.toLowerCase(); final StyleSignature signature = new StyleSignature(name); - final Style result = styles.get(signature); + final Style result = stylesMap.get(signature); if (result == null) return new Style(signature, new EnumMap(PName.class)); @@ -85,26 +85,32 @@ public class StyleBuilder implements AutomaticCounter { } public StyleBuilder muteStyle(Style modifiedStyle) { - final Map copy = new LinkedHashMap(styles); + final Map copy = new LinkedHashMap(stylesMap); final StyleSignature signature = modifiedStyle.getSignature(); final Style orig = copy.get(signature); if (orig == null) { copy.put(signature, modifiedStyle); } else { - final Style newStyle = orig.mergeWith(modifiedStyle); - copy.put(signature, newStyle); + final Style tmp = orig.mergeWith(modifiedStyle); + copy.put(signature, tmp); } final StyleBuilder result = new StyleBuilder(skinParam, this.printedForLog); - result.styles.putAll(copy); + result.stylesMap.putAll(copy); result.counter = this.counter; return result; } - public void loadInternal(StyleSignature styleName, Style newStyle) { - if (styleName.isStarred()) + public void loadInternal(StyleSignature signature, Style newStyle) { + if (signature.isStarred()) throw new IllegalArgumentException(); - this.styles.put(styleName, newStyle); + final Style orig = this.stylesMap.get(signature); + if (orig == null) { + this.stylesMap.put(signature, newStyle); + } else { + final Style tmp = orig.mergeWith(newStyle); + this.stylesMap.put(signature, tmp); + } } public int getNextInt() { @@ -117,7 +123,7 @@ public class StyleBuilder implements AutomaticCounter { Log.info("Using style " + signature); Style result = null; - for (Entry ent : styles.entrySet()) { + for (Entry ent : stylesMap.entrySet()) { final StyleSignature key = ent.getKey(); if (key.matchAll(signature) == false) continue; @@ -137,7 +143,7 @@ public class StyleBuilder implements AutomaticCounter { Log.info("Using style " + signature); Style result = null; - for (Entry ent : styles.entrySet()) { + for (Entry ent : stylesMap.entrySet()) { final StyleSignature key = ent.getKey(); if (key.matchAll(signature) == false) continue; diff --git a/src/net/sourceforge/plantuml/style/StyleLoader.java b/src/net/sourceforge/plantuml/style/StyleLoader.java index eea406386..37f4ee68f 100644 --- a/src/net/sourceforge/plantuml/style/StyleLoader.java +++ b/src/net/sourceforge/plantuml/style/StyleLoader.java @@ -43,6 +43,7 @@ import java.util.Collections; import java.util.EnumMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import net.sourceforge.plantuml.FileSystem; import net.sourceforge.plantuml.LineLocationImpl; @@ -68,23 +69,7 @@ public class StyleLoader { public StyleBuilder loadSkin(String filename) throws IOException { this.styleBuilder = new StyleBuilder(skinParam); - InputStream internalIs = null; - SFile localFile = new SFile(filename); - Log.info("Trying to load style " + filename); - if (localFile.exists() == false) - localFile = FileSystem.getInstance().getFile(filename); - - if (localFile.exists()) { - Log.info("File found : " + localFile.getPrintablePath()); - internalIs = localFile.openFile(); - } else { - Log.info("File not found : " + localFile.getPrintablePath()); - final String res = "/skin/" + filename; - internalIs = StyleLoader.class.getResourceAsStream(res); - if (internalIs != null) { - Log.info("... but " + filename + " found inside the .jar"); - } - } + final InputStream internalIs = getInputStreamForStyle(filename); if (internalIs == null) { Log.error("No .skin file seems to be available"); throw new NoStyleAvailableException(); @@ -98,14 +83,35 @@ public class StyleLoader { return this.styleBuilder; } + public static InputStream getInputStreamForStyle(String filename) throws IOException { + InputStream internalIs = null; + SFile localFile = new SFile(filename); + Log.info("Trying to load style " + filename); + if (localFile.exists() == false) + localFile = FileSystem.getInstance().getFile(filename); + + if (localFile.exists()) { + Log.info("File found : " + localFile.getPrintablePath()); + internalIs = localFile.openFile(); + } else { + Log.info("File not found : " + localFile.getPrintablePath()); + final String res = "/skin/" + filename; + internalIs = StyleLoader.class.getResourceAsStream(res); + if (internalIs != null) + Log.info("... but " + filename + " found inside the .jar"); + + } + return internalIs; + } + private void loadSkinInternal(final BlocLines lines) { for (Style newStyle : getDeclaredStyles(lines, styleBuilder)) this.styleBuilder.loadInternal(newStyle.getSignature(), newStyle); } - private final static String KEYNAMES = "[\\w(), ]+?"; - private final static Pattern2 keyName = MyPattern.cmpile("^[.:]?(" + KEYNAMES + ")([%s]+\\*)?[%s]*\\{$"); + private final static String KEYNAMES = "[.\\w(), ]+?"; + private final static Pattern2 keyName = MyPattern.cmpile("^[:]?(" + KEYNAMES + ")([%s]+\\*)?[%s]*\\{$"); private final static Pattern2 propertyAndValue = MyPattern.cmpile("^([\\w]+):?[%s]+(.*?);?$"); private final static Pattern2 closeBracket = MyPattern.cmpile("^\\}$"); @@ -169,8 +175,13 @@ public class StyleLoader { if (context.size() > 0) { final Collection signatures = context.toSignatures(); for (StyleSignature signature : signatures) { - final Style style = new Style(signature, maps.get(maps.size() - 1)); - result.add(style); + Map tmp = maps.get(maps.size() - 1); + if (signature.isWithDot()) + tmp = addPriority(tmp); + if (tmp.size() > 0) { + final Style style = new Style(signature, tmp); + result.add(style); + } } context = context.pop(); maps.remove(maps.size() - 1); @@ -184,4 +195,12 @@ public class StyleLoader { } + private static Map addPriority(Map tmp) { + final Map result = new EnumMap<>(PName.class); + for (Entry ent : tmp.entrySet()) + result.put(ent.getKey(), ((ValueImpl) ent.getValue()).addPriority(1000)); + + return result; + } + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/style/StyleSignature.java b/src/net/sourceforge/plantuml/style/StyleSignature.java index 0c985bddb..173e7906a 100644 --- a/src/net/sourceforge/plantuml/style/StyleSignature.java +++ b/src/net/sourceforge/plantuml/style/StyleSignature.java @@ -49,23 +49,27 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype; public class StyleSignature { private final Set names = new LinkedHashSet<>(); + private final boolean withDot; public StyleSignature(String s) { if (s.contains("*") || s.contains("&") || s.contains("-")) throw new IllegalArgumentException(); + this.withDot = s.contains("."); this.names.add(clean(s)); } public static StyleSignature empty() { - return new StyleSignature(); + return new StyleSignature(false); } - private StyleSignature() { + private StyleSignature(boolean withDot) { + this.withDot = withDot; } - private StyleSignature(Collection copy) { + private StyleSignature(boolean withDot, Collection copy) { this.names.addAll(copy); + this.withDot = withDot; } public StyleSignature addClickable(Url url) { @@ -74,7 +78,7 @@ public class StyleSignature { final Set result = new LinkedHashSet<>(names); result.add(SName.clickable.name()); - return new StyleSignature(result); + return new StyleSignature(withDot, result); } @@ -87,7 +91,7 @@ public class StyleSignature { final Set result = new LinkedHashSet<>(names); result.add(clean(s)); - return new StyleSignature(result); + return new StyleSignature(withDot || s.contains("."), result); } public StyleSignature add(SName name) { @@ -97,7 +101,7 @@ public class StyleSignature { public StyleSignature addStar() { final Set result = new LinkedHashSet<>(names); result.add("*"); - return new StyleSignature(result); + return new StyleSignature(withDot, result); } public boolean isStarred() { @@ -124,7 +128,7 @@ public class StyleSignature { result.append(n); } - return result.toString(); + return result.toString() + " " + withDot; } public boolean matchAll(StyleSignature other) { @@ -151,7 +155,7 @@ public class StyleSignature { for (SName name : names) result.add(name.name().toLowerCase().replace("_", "")); - return new StyleSignature(result); + return new StyleSignature(false, result); } public StyleSignature forStereotypeItself(Stereotype stereotype) { @@ -161,7 +165,7 @@ public class StyleSignature { result.add(clean(name)); result.add(SName.stereotype.name().toLowerCase().replace("_", "")); - return new StyleSignature(result); + return new StyleSignature(false, result); } public StyleSignature with(Stereotype stereotype) { @@ -170,7 +174,7 @@ public class StyleSignature { for (String name : stereotype.getStyleNames()) result.add(clean(name)); - return new StyleSignature(result); + return new StyleSignature(true, result); } public StyleSignature with(Stereostyles stereostyles) { @@ -180,11 +184,11 @@ public class StyleSignature { for (String name : stereostyles.getStyleNames()) result.add(clean(name)); - return new StyleSignature(result); + return new StyleSignature(true, result); } private String clean(String name) { - return name.toLowerCase().replace("_", ""); + return name.toLowerCase().replace("_", "").replace(".", ""); } public StyleSignature mergeWith(List