diff --git a/pom.xml b/pom.xml index 5017a2e2f..4c4d0fc89 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 1.2020.14-SNAPSHOT + 1.2020.15-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/ComponentStyle.java b/src/net/sourceforge/plantuml/ComponentStyle.java index 3ce5ca7a3..c8f67ed6a 100644 --- a/src/net/sourceforge/plantuml/ComponentStyle.java +++ b/src/net/sourceforge/plantuml/ComponentStyle.java @@ -41,7 +41,7 @@ public enum ComponentStyle { UML1, UML2, RECTANGLE; - public USymbol toSymbol() { + public USymbol toUSymbol() { switch (this) { case UML1: return USymbol.COMPONENT1; diff --git a/src/net/sourceforge/plantuml/EmbeddedDiagram.java b/src/net/sourceforge/plantuml/EmbeddedDiagram.java index 632ff8842..4a4c41d97 100644 --- a/src/net/sourceforge/plantuml/EmbeddedDiagram.java +++ b/src/net/sourceforge/plantuml/EmbeddedDiagram.java @@ -140,7 +140,9 @@ public class EmbeddedDiagram implements CharSequence { private BufferedImage getImage() throws IOException, InterruptedException { if (image == null) { + final boolean sav = SkinParam.USE_STYLES(); image = getImageSlow(); + SkinParam.setBetaStyle(sav); } return image; } diff --git a/src/net/sourceforge/plantuml/FileUtils.java b/src/net/sourceforge/plantuml/FileUtils.java index a8c4a7f33..4a0ae55c1 100644 --- a/src/net/sourceforge/plantuml/FileUtils.java +++ b/src/net/sourceforge/plantuml/FileUtils.java @@ -38,6 +38,8 @@ package net.sourceforge.plantuml; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; @@ -56,6 +58,25 @@ public class FileUtils { counter = new AtomicInteger(0); } + static public File createTempFileLegacy(String prefix, String suffix) throws IOException { + if (suffix.startsWith(".") == false) { + throw new IllegalArgumentException(); + } + if (prefix == null) { + throw new IllegalArgumentException(); + } + final File f; + if (counter == null) { + f = File.createTempFile(prefix, suffix); + } else { + final String name = prefix + counter.addAndGet(1) + suffix; + f = new File(name); + } + Log.info("Creating temporary file: " + f); + f.deleteOnExit(); + return f; + } + static public SFile createTempFile(String prefix, String suffix) throws IOException { if (suffix.startsWith(".") == false) { throw new IllegalArgumentException(); @@ -106,6 +127,12 @@ public class FileUtils { copyInternal(fis, fos); } + static public void copyToStream(File src, OutputStream os) throws IOException { + final InputStream fis = new BufferedInputStream(new FileInputStream(src)); + final OutputStream fos = new BufferedOutputStream(os); + copyInternal(fis, fos); + } + static public void copyToStream(InputStream is, OutputStream os) throws IOException { final InputStream fis = new BufferedInputStream(is); final OutputStream fos = new BufferedOutputStream(os); diff --git a/src/net/sourceforge/plantuml/FontParam.java b/src/net/sourceforge/plantuml/FontParam.java index 1842eb5d1..683c88c27 100644 --- a/src/net/sourceforge/plantuml/FontParam.java +++ b/src/net/sourceforge/plantuml/FontParam.java @@ -181,7 +181,7 @@ public enum FontParam { return new FontConfiguration(skinParam, this, null); } - public StyleSignature getStyleDefinition() { + public StyleSignature getStyleDefinition(SName diagramType) { if (this == FOOTER) { return StyleSignature.of(SName.root, SName.footer); } @@ -191,8 +191,15 @@ public enum FontParam { if (this == TITLE) { return StyleSignature.of(SName.root, SName.title); } - System.err.println("Warning " + this); - return null; + if (this == CLASS_ATTRIBUTE) { + return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_); + } + if (this == RECTANGLE || this == NODE) { + return StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.component); + } + return StyleSignature.of(SName.root, SName.element, diagramType, SName.component); +// System.err.println("Warning " + this); +// throw new UnsupportedOperationException(); } } diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index d7f451fe8..2322e5660 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -96,7 +96,7 @@ public interface ISkinParam extends ISkinSimple { public boolean shadowing2(Stereotype stereotype, SkinParameter skinParameter); - public PackageStyle getPackageStyle(); + public PackageStyle packageStyle(); public ComponentStyle componentStyle(); @@ -156,7 +156,7 @@ public interface ISkinParam extends ISkinSimple { public UmlDiagramType getUmlDiagramType(); - public HColor getHoverPathColor(); + public HColor hoverPathColor(); public TikzFontDistortion getTikzFontDistortion(); @@ -176,7 +176,7 @@ public interface ISkinParam extends ISkinSimple { public boolean isUseVizJs(); - public Padder getSequenceDiagramPadder(); + public Padder sequenceDiagramPadder(); public StyleBuilder getCurrentStyleBuilder(); @@ -188,6 +188,6 @@ public interface ISkinParam extends ISkinSimple { public void setDefaultSkin(String newSkin); - public ActorStyle getActorStyle(); + public ActorStyle actorStyle(); } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index a758a5a13..d773d2657 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -780,15 +780,6 @@ public class SkinParam implements ISkinParam { return true; } - public PackageStyle getPackageStyle() { - final String value = getValue("packageStyle"); - final PackageStyle p = PackageStyle.fromString(value); - if (p == null) { - return PackageStyle.FOLDER; - } - return p; - } - private final Map sprites = new HashMap(); public Collection getAllSpriteNames() { @@ -807,16 +798,27 @@ public class SkinParam implements ISkinParam { return result; } + public PackageStyle packageStyle() { + final String value = getValue("packageStyle"); + final PackageStyle p = PackageStyle.fromString(value); + if (p == null) { + return PackageStyle.FOLDER; + } + return p; + } + public ComponentStyle componentStyle() { if (strictUmlStyle()) { return ComponentStyle.UML2; } final String value = getValue("componentstyle"); + if ("uml1".equalsIgnoreCase(value)) + return ComponentStyle.UML1; if ("uml2".equalsIgnoreCase(value)) return ComponentStyle.UML2; if ("rectangle".equalsIgnoreCase(value)) return ComponentStyle.RECTANGLE; - return ComponentStyle.UML1; + return ComponentStyle.UML2; } public boolean stereotypePositionTop() { @@ -1144,7 +1146,7 @@ public class SkinParam implements ISkinParam { return type; } - public HColor getHoverPathColor() { + public HColor hoverPathColor() { final String value = getValue("pathhovercolor"); if (value == null) { return null; @@ -1219,7 +1221,7 @@ public class SkinParam implements ISkinParam { return useVizJs; } - public Padder getSequenceDiagramPadder() { + public Padder sequenceDiagramPadder() { final double padding = getAsDouble("SequenceMessagePadding"); final double margin = getAsDouble("SequenceMessageMargin"); final String borderColor = getValue("SequenceMessageBorderColor"); @@ -1234,7 +1236,7 @@ public class SkinParam implements ISkinParam { .withBorderColor(border).withRoundCorner(roundCorner); } - public ActorStyle getActorStyle() { + public ActorStyle actorStyle() { final String value = getValue("actorstyle"); if ("awesome".equalsIgnoreCase(value)) { return ActorStyle.AWESOME; diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index 1778bace1..dfcb44339 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -124,8 +124,8 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.shadowing2(stereotype, skinParameter); } - public PackageStyle getPackageStyle() { - return skinParam.getPackageStyle(); + public PackageStyle packageStyle() { + return skinParam.packageStyle(); } public Sprite getSprite(String name) { @@ -276,8 +276,8 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.getUmlDiagramType(); } - public HColor getHoverPathColor() { - return skinParam.getHoverPathColor(); + public HColor hoverPathColor() { + return skinParam.hoverPathColor(); } public double getPadding(PaddingParam param) { @@ -336,8 +336,8 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.getStereotypeAlignment(); } - public Padder getSequenceDiagramPadder() { - return skinParam.getSequenceDiagramPadder(); + public Padder sequenceDiagramPadder() { + return skinParam.sequenceDiagramPadder(); } public StyleBuilder getCurrentStyleBuilder() { @@ -360,8 +360,8 @@ public class SkinParamDelegator implements ISkinParam { skinParam.setDefaultSkin(newFileName); } - public ActorStyle getActorStyle() { - return skinParam.getActorStyle(); + public ActorStyle actorStyle() { + return skinParam.actorStyle(); } } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index 97b9ce93b..21060c589 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -39,9 +39,12 @@ import java.awt.Color; import java.awt.geom.AffineTransform; import java.awt.geom.Dimension2D; import java.awt.image.BufferedImage; +import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; +import java.io.File; import java.io.FileNotFoundException; +import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; @@ -77,8 +80,8 @@ import net.sourceforge.plantuml.svek.EmptySvgException; import net.sourceforge.plantuml.svek.GraphvizCrash; import net.sourceforge.plantuml.svek.TextBlockBackcolored; import net.sourceforge.plantuml.ugraphic.AffineTransformType; -import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.ImageBuilder; +import net.sourceforge.plantuml.ugraphic.PixelImage; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -183,7 +186,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption, long seed) throws IOException { - final HColor hover = getSkinParam().getHoverPathColor(); + final HColor hover = getSkinParam().hoverPathColor(); if (fileFormatOption.getSvgLinkTarget() == null || fileFormatOption.getSvgLinkTarget().equals("_top")) { fileFormatOption = fileFormatOption.withSvgLinkTarget(getSkinParam().getSvgLinkTarget()); } @@ -337,9 +340,9 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot private Dimension2D lastInfo; private ImageData exportDiagramInternalPdf(OutputStream os, int index) throws IOException { - final SFile svg = FileUtils.createTempFile("pdf", ".svf"); - final SFile pdfFile = FileUtils.createTempFile("pdf", ".pdf"); - final OutputStream fos = svg.createBufferedOutputStream(); + final File svg = FileUtils.createTempFileLegacy("pdf", ".svf"); + final File pdfFile = FileUtils.createTempFileLegacy("pdf", ".pdf"); + final OutputStream fos = new BufferedOutputStream(new FileOutputStream(svg));; final ImageData result = exportDiagram(fos, index, new FileFormatOption(FileFormat.SVG)); fos.close(); PdfConverter.convert(svg, pdfFile); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/LaneDivider.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/LaneDivider.java index 22c54732f..2485d8658 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/LaneDivider.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/LaneDivider.java @@ -74,7 +74,7 @@ public class LaneDivider extends AbstractTextBlock { } public StyleSignature getDefaultStyleDefinition() { - return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.swimlane); + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.swimlane); } private Style getStyle() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java index 7ba1227cf..aa3389b87 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java @@ -118,7 +118,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable } public StyleSignature getDefaultStyleDefinition() { - return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.swimlane); + return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.swimlane); } public Swimlanes(ISkinParam skinParam, Pragma pragma) { diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java index e173ddae7..b3afadc16 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateElementFull2.java @@ -178,7 +178,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2 if (symbol == null) { type = LeafType.DESCRIPTION; - usymbol = diagram.getSkinParam().getActorStyle().getUSymbol(); + usymbol = diagram.getSkinParam().actorStyle().toUSymbol(); } else if (symbol.equalsIgnoreCase("port")) { type = LeafType.PORT; usymbol = null; @@ -190,7 +190,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2 usymbol = null; } else { type = LeafType.DESCRIPTION; - usymbol = USymbol.getFromString(symbol, diagram.getSkinParam()); + usymbol = USymbol.fromString(symbol, diagram.getSkinParam()); if (usymbol == null) { throw new IllegalStateException(); } diff --git a/src/net/sourceforge/plantuml/command/CommandFooter.java b/src/net/sourceforge/plantuml/command/CommandFooter.java index 5ab32c201..aa20585d1 100644 --- a/src/net/sourceforge/plantuml/command/CommandFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandFooter.java @@ -72,7 +72,7 @@ public class CommandFooter extends SingleLineCommand2 { final String align = arg.get("POSITION", 0); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); if (SkinParam.USE_STYLES() && align == null) { - ha = FontParam.FOOTER.getStyleDefinition() + ha = FontParam.FOOTER.getStyleDefinition(null) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } diff --git a/src/net/sourceforge/plantuml/command/CommandHeader.java b/src/net/sourceforge/plantuml/command/CommandHeader.java index b86791772..64ed2fe62 100644 --- a/src/net/sourceforge/plantuml/command/CommandHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandHeader.java @@ -74,7 +74,7 @@ public class CommandHeader extends SingleLineCommand2 { final String align = arg.get("POSITION", 0); HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); if (SkinParam.USE_STYLES() && align == null) { - ha = FontParam.HEADER.getStyleDefinition() + ha = FontParam.HEADER.getStyleDefinition(null) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java index 34d3429b6..66179a5aa 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesFooter.java @@ -66,7 +66,7 @@ public class CommandMultilinesFooter extends CommandMultilines { if (strings.size() > 0) { HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.CENTER); if (SkinParam.USE_STYLES() && align == null) { - ha = FontParam.FOOTER.getStyleDefinition() + ha = FontParam.FOOTER.getStyleDefinition(null) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java index be75bb43f..c2da2fe95 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesHeader.java @@ -66,7 +66,7 @@ public class CommandMultilinesHeader extends CommandMultilines { if (strings.size() > 0) { HorizontalAlignment ha = HorizontalAlignment.fromString(align, HorizontalAlignment.RIGHT); if (SkinParam.USE_STYLES() && align == null) { - ha = FontParam.HEADER.getStyleDefinition() + ha = FontParam.HEADER.getStyleDefinition(null) .getMergedStyle(((UmlDiagram) diagram).getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } diff --git a/src/net/sourceforge/plantuml/command/CommandPackage.java b/src/net/sourceforge/plantuml/command/CommandPackage.java index 78f267e81..eb44c20b4 100644 --- a/src/net/sourceforge/plantuml/command/CommandPackage.java +++ b/src/net/sourceforge/plantuml/command/CommandPackage.java @@ -136,7 +136,8 @@ public class CommandPackage extends SingleLineCommand2 { // p.setThisIsTogether(); // } else if (stereotype != null) { - final USymbol usymbol = USymbol.getFromString(stereotype, diagram.getSkinParam().getActorStyle()); + final USymbol usymbol = USymbol.fromString(stereotype, diagram.getSkinParam().actorStyle(), + diagram.getSkinParam().componentStyle(), diagram.getSkinParam().packageStyle()); if (usymbol == null) { p.setStereotype(new Stereotype(stereotype)); } else { diff --git a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java index 6d52f7cfd..4fb89d33d 100644 --- a/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java +++ b/src/net/sourceforge/plantuml/command/UmlDiagramFactory.java @@ -219,12 +219,9 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory { addTitleCommands(cmds); addCommonCommands2(cmds); addCommonHides(cmds); - cmds.add(new CommandStyleMultilinesCSS()); - cmds.add(new CommandStyleImport()); } final protected void addCommonCommands2(List cmds) { - // cmds.add(new CommandListSprite()); cmds.add(new CommandNope()); cmds.add(new CommandPragma()); @@ -245,6 +242,10 @@ public abstract class UmlDiagramFactory extends PSystemAbstractFactory { cmds.add(factorySpriteCommand.createMultiLine(false)); cmds.add(factorySpriteCommand.createSingleLine()); cmds.add(new CommandSpriteFile()); + + cmds.add(new CommandStyleMultilinesCSS()); + cmds.add(new CommandStyleImport()); + } final protected void addCommonHides(List cmds) { diff --git a/src/net/sourceforge/plantuml/creole/Sea.java b/src/net/sourceforge/plantuml/creole/Sea.java index d00a7128e..3bb2b0838 100644 --- a/src/net/sourceforge/plantuml/creole/Sea.java +++ b/src/net/sourceforge/plantuml/creole/Sea.java @@ -50,6 +50,9 @@ public class Sea { private final StringBounder stringBounder; public Sea(StringBounder stringBounder) { + if (stringBounder == null) { + throw new IllegalArgumentException(); + } this.stringBounder = stringBounder; } diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java b/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java index fec9b01ce..dfa77c68b 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodierImpl.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.skin.VisibilityModifier; +import net.sourceforge.plantuml.style.SName; public class BodierImpl implements Bodier { @@ -83,19 +84,10 @@ public class BodierImpl implements Bodier { } public void addFieldOrMethod(String s) { -// if (leaf == null) { -// throw new IllegalArgumentException(); -// } // Empty cache methodsToDisplay = null; fieldsToDisplay = null; rawBody.add(s); -// if (leaf instanceof ILeaf) { -// if (this.leaf != null && this.leaf != leaf) { -// throw new IllegalArgumentException(); -// } -// this.leaf = (ILeaf) leaf; -// } } private boolean isBodyEnhanced() { @@ -203,7 +195,8 @@ public class BodierImpl implements Bodier { final boolean showFields, Stereotype stereotype) { if (type.isLikeClass() && isBodyEnhanced()) { if (showMethods || showFields) { - return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf); + return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf, + SName.classDiagram); } return null; } @@ -211,7 +204,7 @@ public class BodierImpl implements Bodier { throw new IllegalStateException(); } final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), fontParam, skinParam, - stereotype, leaf); + stereotype, leaf, SName.classDiagram); if (type == LeafType.OBJECT) { if (showFields == false) { return new TextBlockLineBefore(TextBlockUtils.empty(0, 0)); @@ -222,7 +215,7 @@ public class BodierImpl implements Bodier { throw new UnsupportedOperationException(); } final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), fontParam, skinParam, - stereotype, leaf); + stereotype, leaf, SName.classDiagram); if (showFields && showMethods == false) { return fields.asBlockMemberImpl(); } else if (showMethods && showFields == false) { diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java index fc7e02700..265e7838c 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java +++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced.java @@ -59,6 +59,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockVertical2; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -79,9 +80,11 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo private final ILeaf entity; private final boolean inEllipse; private final double minClassWidth; + private final SName diagramType; public BodyEnhanced(List rawBody, FontParam fontParam, ISkinParam skinParam, boolean manageModifier, - Stereotype stereotype, ILeaf entity) { + Stereotype stereotype, ILeaf entity, SName diagramType) { + this.diagramType = diagramType; this.rawBody = new ArrayList(rawBody); this.stereotype = stereotype; this.fontParam = fontParam; @@ -98,13 +101,16 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo } public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align, - Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity) { - this(display, fontParam, skinParam, align, stereotype, manageHorizontalLine, manageHorizontalLine, entity, 0); + Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity, + SName diagramType) { + this(display, fontParam, skinParam, align, stereotype, manageHorizontalLine, manageHorizontalLine, entity, 0, + diagramType); } public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align, Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity, - double minClassWidth) { + double minClassWidth, SName diagramType) { + this.diagramType = diagramType; this.minClassWidth = minClassWidth; this.entity = entity; this.stereotype = stereotype; @@ -163,17 +169,15 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo } else { final String s = s2.toString(); if (manageHorizontalLine && isBlockSeparator(s)) { - blocks.add(decorate(stringBounder, - new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity), - separator, title)); + blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, + stereotype, entity, diagramType), separator, title)); separator = s.charAt(0); title = getTitle(s, skinParam); members = new ArrayList(); } else if (Parser.isTreeStart(s)) { if (members.size() > 0) { - blocks.add(decorate(stringBounder, - new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity), - separator, title)); + blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align, + stereotype, entity, diagramType), separator, title)); } members = new ArrayList(); final List allTree = buildAllTree(s, it); @@ -193,7 +197,8 @@ public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPo members.add(new Member("", false, false)); } blocks.add(decorate(stringBounder, - new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity), separator, title)); + new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity, diagramType), + separator, title)); if (blocks.size() == 1) { this.area = blocks.get(0); diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index 4ecda3a2d..e5487b5b9 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -41,6 +41,8 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.EmbeddedDiagram; @@ -313,6 +315,23 @@ public class Display implements Iterable { return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); } + public Display underlinedName() { + final Pattern p = Pattern.compile("^([^:]+?)(\\s*:.+)$"); + final List result = new ArrayList(); + for (CharSequence line : displayData) { + if (result.size() == 0) { + final Matcher m = p.matcher(line); + if (m.matches()) + result.add("" + m.group(1) + "" + m.group(2)); + else + result.add("" + line); + } else { + result.add("" + line); + } + } + return new Display(result, this.naturalHorizontalAlignment, this.isNull, this.defaultCreoleMode); + } + public Display withCreoleMode(CreoleMode mode) { if (isNull) { throw new IllegalArgumentException(); diff --git a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java index 2163e633a..3318b6548 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java +++ b/src/net/sourceforge/plantuml/cucadiagram/MethodsOrFieldsArea.java @@ -81,30 +81,26 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW private final FontParam fontParam; private final ISkinParam skinParam; -// private final HColor color; -// private final HColor hyperlinkColor; -// private final boolean useUnderlineForHyperlink; private final Rose rose = new Rose(); private final List members = new ArrayList(); private final HorizontalAlignment align; private final Stereotype stereotype; private final ILeaf leaf; + private final SName diagramType; public MethodsOrFieldsArea(List members, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype, - ILeaf leaf) { - this(members, fontParam, skinParam, HorizontalAlignment.LEFT, stereotype, leaf); + ILeaf leaf, SName diagramType) { + this(members, fontParam, skinParam, HorizontalAlignment.LEFT, stereotype, leaf, diagramType); } public MethodsOrFieldsArea(List members, FontParam fontParam, ISkinParam skinParam, - HorizontalAlignment align, Stereotype stereotype, ILeaf leaf) { + HorizontalAlignment align, Stereotype stereotype, ILeaf leaf, SName diagramType) { + this.diagramType = diagramType; this.leaf = leaf; this.stereotype = stereotype; this.align = align; this.skinParam = skinParam; this.fontParam = fontParam; -// this.color = rose.getFontColor(skinParam, fontParam); -// this.hyperlinkColor = skinParam.getHyperlinkColor(); -// this.useUnderlineForHyperlink = skinParam.useUnderlineForHyperlink(); this.members.addAll(members); } @@ -165,7 +161,9 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW } FontConfiguration config; if (SkinParam.USE_STYLES()) { - final Style style = StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.component) +// final Style style = StyleSignature.of(SName.root, SName.element, SName.componentDiagram, SName.component) +// .getMergedStyle(skinParam.getCurrentStyleBuilder()); + final Style style = fontParam.getStyleDefinition(diagramType) .getMergedStyle(skinParam.getCurrentStyleBuilder()); config = new FontConfiguration(style, skinParam, stereotype, fontParam); } else { diff --git a/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java b/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java index a33e11690..3d5a2f65f 100644 --- a/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java +++ b/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java @@ -145,7 +145,7 @@ public class CommandCreateDomain extends SingleLineCommand2 type = "biddable"; } } - USymbol usymbol = USymbol.getFromString(type, diagram.getSkinParam()); + USymbol usymbol = USymbol.fromString(type, diagram.getSkinParam()); entity.setUSymbol(usymbol); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java index 398575523..a640d3f30 100644 --- a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java +++ b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagram.java @@ -75,14 +75,14 @@ public class DescriptionDiagram extends AbstractEntityDiagram { if (type == null) { String codeString = code.getName(); if (codeString.startsWith("[") && codeString.endsWith("]")) { - final USymbol sym = getSkinParam().componentStyle().toSymbol() ; + final USymbol sym = getSkinParam().componentStyle().toUSymbol() ; final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, sym); } if (codeString.startsWith(":") && codeString.endsWith(":")) { final Ident idNewLong = ident.eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); return getOrCreateLeafDefault(idNewLong, idNewLong.toCode(this), LeafType.DESCRIPTION, - getSkinParam().getActorStyle().getUSymbol()); + getSkinParam().actorStyle().toUSymbol()); } if (codeString.startsWith("()")) { codeString = StringUtils.trin(codeString.substring(2)); @@ -103,7 +103,7 @@ public class DescriptionDiagram extends AbstractEntityDiagram { for (ILeaf leaf : getLeafsvalues()) { final LeafType type = leaf.getLeafType(); final USymbol usymbol = leaf.getUSymbol(); - if (type == LeafType.USECASE || usymbol == getSkinParam().getActorStyle().getUSymbol()) { + if (type == LeafType.USECASE || usymbol == getSkinParam().actorStyle().toUSymbol()) { return true; } } @@ -114,7 +114,7 @@ public class DescriptionDiagram extends AbstractEntityDiagram { public void makeDiagramReady() { super.makeDiagramReady(); final LeafType defaultType = isUsecase() ? LeafType.DESCRIPTION : LeafType.DESCRIPTION; - final USymbol defaultSymbol = isUsecase() ? getSkinParam().getActorStyle().getUSymbol() : USymbol.INTERFACE; + final USymbol defaultSymbol = isUsecase() ? getSkinParam().actorStyle().toUSymbol() : USymbol.INTERFACE; for (ILeaf leaf : getLeafsvalues()) { if (leaf.getLeafType() == LeafType.STILL_UNKNOWN) { leaf.muteToType(defaultType, defaultSymbol); diff --git a/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java b/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java index 6bd46d42b..2a657fb32 100644 --- a/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java +++ b/src/net/sourceforge/plantuml/descdiagram/EntityImageRequirement.java @@ -56,6 +56,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; @@ -78,7 +79,7 @@ public class EntityImageRequirement extends AbstractEntityImage { final Stereotype stereotype = entity.getStereotype(); final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.REQUIREMENT, skinParam, - HorizontalAlignment.CENTER, stereotype, true, false, entity); + HorizontalAlignment.CENTER, stereotype, true, false, entity, SName.componentDiagram); if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) { this.desc = tmp; diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index 9942cec43..9d7faa9e5 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -178,7 +178,7 @@ public class CommandCreateElementFull extends SingleLineCommand2 { @@ -133,7 +135,8 @@ public class CommandCreateElementMultilines extends CommandMultilines2 { return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.USECASE, USymbol.USECASE, pure); } else if (codeChar == ':') { return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION, - diagram.getSkinParam().getActorStyle().getUSymbol(), pure); + diagram.getSkinParam().actorStyle().toUSymbol(), pure); } else if (codeChar == '[') { - final USymbol sym = diagram.getSkinParam().componentStyle().toSymbol(); + final USymbol sym = diagram.getSkinParam().componentStyle().toUSymbol(); return getOrCreateLeaf1972(diagram, ident3, code3, LeafType.DESCRIPTION, sym, pure); } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java index 9bc7ad00c..a3330432a 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java @@ -160,7 +160,8 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2 badHosts = new ConcurrentHashMap(); + // Added by Alain Corbiere public byte[] getBytes() { - if (isUrlOk()) - try { + if (isUrlOk() == false) { + return null; + } + final String host = internal.getHost(); + final Long bad = badHosts.get(host); + if (bad != null) { + final long duration = System.currentTimeMillis() - bad; + if (duration < 1000L * 60) { + // System.err.println("BAD HOST!" + host); + return null; + } + // System.err.println("cleaning " + host); + badHosts.remove(host); + } + final Future result = exe.submit(new Callable() { + public byte[] call() throws IOException { InputStream input = null; try { final URLConnection connection = internal.openConnection(); @@ -184,9 +209,18 @@ public class SURL { input.close(); } } - } catch (Exception e) { - e.printStackTrace(); } + }); + + try { + byte data[] = result.get(SecurityUtils.getSecurityProfile().getTimeout(), TimeUnit.MILLISECONDS); + if (data != null) { + return data; + } + } catch (Exception e) { + System.err.println("issue " + host + " " + e); + } + badHosts.put(host, System.currentTimeMillis()); return null; } diff --git a/src/net/sourceforge/plantuml/security/SecurityProfile.java b/src/net/sourceforge/plantuml/security/SecurityProfile.java index ebb0ddda2..bf2ee6683 100644 --- a/src/net/sourceforge/plantuml/security/SecurityProfile.java +++ b/src/net/sourceforge/plantuml/security/SecurityProfile.java @@ -136,4 +136,24 @@ public enum SecurityProfile { } return "This is completely safe: no access on local files or on distant URL."; } + + /** + * Retrieve the timeout for URL. + */ + public long getTimeout() { + switch (this) { + case SANDBOX: + return 1000L; + case ALLOWLIST: + return 1000L * 60 * 5; + case INTERNET: + return 1000L * 10; + case LEGACY: + return 1000L * 60; + case UNSECURE: + return 1000L * 60 * 5; + } + throw new AssertionError(); + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java index d51c4408a..eca770315 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramFileMakerPuma2.java @@ -327,7 +327,7 @@ public class SequenceDiagramFileMakerPuma2 implements FileMaker { final DisplaySection display = diagram.getFooterOrHeaderTeoz(fontParam).withPage(page + 1, pages.size()); Style style = null; if (SkinParam.USE_STYLES()) { - final StyleSignature def = fontParam.getStyleDefinition(); + final StyleSignature def = fontParam.getStyleDefinition(null); style = def.getMergedStyle(skinParam.getCurrentStyleBuilder()); } return new PngTitler(titleColor, display, fontSize, fontFamily, hyperlinkColor, diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java index 3d8d0972e..354a82892 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java @@ -270,7 +270,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { Style style = null; final ISkinParam skinParam = diagram.getSkinParam(); if (SkinParam.USE_STYLES()) { - final StyleSignature def = param.getStyleDefinition(); + final StyleSignature def = param.getStyleDefinition(null); style = def.getMergedStyle(skinParam.getCurrentStyleBuilder()); } final PngTitler pngTitler = new PngTitler(titleColor, display, fontSize, fontFamily, hyperlinkColor, @@ -296,7 +296,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { HorizontalAlignment titleAlignment = HorizontalAlignment.CENTER; if (SkinParam.USE_STYLES()) { - final StyleSignature def = FontParam.TITLE.getStyleDefinition(); + final StyleSignature def = FontParam.TITLE.getStyleDefinition(null); titleAlignment = def.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder()) .getHorizontalAlignment(); } diff --git a/src/net/sourceforge/plantuml/skin/ActorStyle.java b/src/net/sourceforge/plantuml/skin/ActorStyle.java index 3981ea859..61a303fd3 100644 --- a/src/net/sourceforge/plantuml/skin/ActorStyle.java +++ b/src/net/sourceforge/plantuml/skin/ActorStyle.java @@ -43,7 +43,7 @@ public enum ActorStyle { STICKMAN, AWESOME; - public USymbol getUSymbol() { + public USymbol toUSymbol() { if (this == STICKMAN) { return USymbol.ACTOR_STICKMAN; } else if (this == AWESOME) { diff --git a/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java index d2fbecc11..03c658c5b 100644 --- a/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/AbstractComponentRoseArrow.java @@ -78,7 +78,7 @@ public abstract class AbstractComponentRoseArrow extends AbstractTextualComponen @Override final protected TextBlock getTextBlock() { final Padder padder = getISkinSimple() instanceof ISkinParam ? ((ISkinParam) getISkinSimple()) - .getSequenceDiagramPadder() : Padder.NONE; + .sequenceDiagramPadder() : Padder.NONE; return padder.apply(super.getTextBlock()); } diff --git a/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/net/sourceforge/plantuml/skin/rose/Rose.java index 37d35337d..58974a7fe 100644 --- a/src/net/sourceforge/plantuml/skin/rose/Rose.java +++ b/src/net/sourceforge/plantuml/skin/rose/Rose.java @@ -143,13 +143,13 @@ public class Rose { getStroke(param, LineParam.sequenceLifeLineBorder, 1.5), param.getIHtmlColorSet()); } if (type == ComponentType.ACTOR_HEAD) { - return new ComponentRoseActor(param.getActorStyle(), styles == null ? null : styles[0], + return new ComponentRoseActor(param.actorStyle(), styles == null ? null : styles[0], styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder), getUFont2(param, FontParam.ACTOR), stringsToDisplay, true, param, newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); } if (type == ComponentType.ACTOR_TAIL) { - return new ComponentRoseActor(param.getActorStyle(), styles == null ? null : styles[0], + return new ComponentRoseActor(param.actorStyle(), styles == null ? null : styles[0], styles == null ? null : styles[1], getSymbolContext(stereotype, param, ColorParam.actorBorder), getUFont2(param, FontParam.ACTOR), stringsToDisplay, false, param, newFontForStereotype, getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java index fd11613f0..dbfa24a83 100644 --- a/src/net/sourceforge/plantuml/svek/Cluster.java +++ b/src/net/sourceforge/plantuml/svek/Cluster.java @@ -354,7 +354,7 @@ public class Cluster implements Moveable { } PackageStyle packageStyle = group.getPackageStyle(); if (packageStyle == null) { - packageStyle = skinParam2.getPackageStyle(); + packageStyle = skinParam2.packageStyle(); } if (border != null) { final HColor tmp = skinParam2.getHtmlColor(border, group.getStereotype(), false); @@ -512,7 +512,7 @@ public class Cluster implements Moveable { attribute = new TextBlockEmpty(); } else { attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, skinParam, group.getStereotype(), - null); + null, SName.stateDiagram); } return attribute; } @@ -836,12 +836,12 @@ public class Cluster implements Moveable { printCluster1(sb, lines, stringBounder); final Node added = printCluster2(sb, lines, stringBounder, dotMode, graphvizVersion, type); - if (entityPositionsExceptNormal.size() > 0 && added == null) { + if (entityPositionsExceptNormal.size() > 0) { if (hasPort()) { sb.append(empty() + " [shape=rect,width=.01,height=.01,label="); sb.append(label); sb.append("];"); - } else { + } else if (added == null) { sb.append(empty() + " [shape=point,width=.01,label=\"\"];"); } SvekUtils.println(sb); @@ -874,7 +874,11 @@ public class Cluster implements Moveable { } private String empty() { - return "empty" + color; + // return "empty" + color; + // We use the same node with one for thereALinkFromOrToGroup2 as an empty + // because we cannot put a new node in the nested inside of the cluster + // if thereALinkFromOrToGroup2 is enabled. + return getSpecialPointId(group); } public boolean isLabel() { diff --git a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java index b3979ff7f..86148af5f 100644 --- a/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java +++ b/src/net/sourceforge/plantuml/svek/GeneralImageBuilder.java @@ -631,7 +631,7 @@ public final class GeneralImageBuilder { attribute = new TextBlockEmpty(); } else { attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, dotData.getSkinParam(), - g.getStereotype(), null); + g.getStereotype(), null, SName.stateDiagram); } final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder); final double attributeHeight = dimAttribute.getHeight(); diff --git a/src/net/sourceforge/plantuml/svek/PackageStyle.java b/src/net/sourceforge/plantuml/svek/PackageStyle.java index 9aaa9ca77..927ca90eb 100644 --- a/src/net/sourceforge/plantuml/svek/PackageStyle.java +++ b/src/net/sourceforge/plantuml/svek/PackageStyle.java @@ -85,7 +85,7 @@ public enum PackageStyle { return USymbol.RECTANGLE; } if (this == FOLDER) { - return USymbol.FOLDER; + return USymbol.PACKAGE; } return null; } diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java index 05ba7d5be..1c0f3bb5c 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClass.java @@ -45,6 +45,7 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineConfigurable; import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.creole.Stencil; @@ -57,6 +58,10 @@ import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.color.ColorType; +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.AbstractEntityImage; import net.sourceforge.plantuml.svek.Margins; import net.sourceforge.plantuml.svek.Ports; @@ -133,6 +138,14 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi } } + private Style getStyle() { + return getDefaultStyleDefinition().getMergedStyle(getSkinParam().getCurrentStyleBuilder()); + } + + private StyleSignature getDefaultStyleDefinition() { + return StyleSignature.of(SName.root, SName.element, SName.classDiagram, SName.class_); + } + private void drawInternal(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimTotal = calculateDimension(stringBounder); @@ -147,26 +160,38 @@ public class EntityImageClass extends AbstractEntityImage implements Stencil, Wi } HColor classBorder = lineConfig.getColors(getSkinParam()).getColor(ColorType.LINE); + HColor headerBackcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.HEADER); + if (classBorder == null) { - classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder); + if (SkinParam.USE_STYLES()) + classBorder = getStyle().value(PName.LineColor).asColor(getSkinParam().getIHtmlColorSet()); + else + classBorder = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBorder); } - ug = ug.apply(classBorder); HColor backcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.BACK); if (backcolor == null) { - if (leafType == LeafType.ENUM) { - backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.enumBackground, - ColorParam.classBackground); - } else { - backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBackground); + if (SkinParam.USE_STYLES()) + backcolor = getStyle().value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet()); + else { + if (leafType == LeafType.ENUM) { + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.enumBackground, + ColorParam.classBackground); + } else { + backcolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), ColorParam.classBackground); + } } } + + ug = ug.apply(classBorder); ug = ug.apply(backcolor.bg()); final UStroke stroke = getStroke(); - HColor headerBackcolor = getEntity().getColors(getSkinParam()).getColor(ColorType.HEADER); if (headerBackcolor == null) { - headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), false); + if (SkinParam.USE_STYLES()) + headerBackcolor = getStyle().value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet()); + else + headerBackcolor = getSkinParam().getHtmlColor(ColorParam.classHeaderBackground, getStereo(), false); } UGraphic ugHeader = ug; if (roundCorner == 0 && headerBackcolor != null && backcolor.equals(headerBackcolor) == false) { diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader.java b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader.java index 137e59285..6f38c8a1d 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageClassHeader.java @@ -41,6 +41,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.SkinParam; import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityPortion; @@ -58,6 +59,8 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.SName; +import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.HeaderLayout; import net.sourceforge.plantuml.svek.ShapeType; @@ -78,7 +81,15 @@ public class EntityImageClassHeader extends AbstractEntityImage { final Stereotype stereotype = entity.getStereotype(); final boolean displayGenericWithOldFashion = skinParam.displayGenericWithOldFashion(); final String generic = displayGenericWithOldFashion ? null : entity.getGeneric(); - FontConfiguration fontConfigurationName = new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype); + FontConfiguration fontConfigurationName; + + if (SkinParam.USE_STYLES()) { + final Style style = FontParam.CLASS.getStyleDefinition(SName.classDiagram) + .getMergedStyle(skinParam.getCurrentStyleBuilder()); + fontConfigurationName = new FontConfiguration(style, skinParam, stereotype, FontParam.CLASS); + } else { + fontConfigurationName = new FontConfiguration(getSkinParam(), FontParam.CLASS, stereotype); + } if (italic) { fontConfigurationName = fontConfigurationName.italic(); } @@ -105,10 +116,9 @@ public class EntityImageClassHeader extends AbstractEntityImage { || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { stereo = null; } else { - stereo = TextBlockUtils.withMargin( - Display.create(stereotype.getLabels(skinParam.guillemet())).create( - new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), - HorizontalAlignment.CENTER, skinParam), 1, 0); + stereo = TextBlockUtils.withMargin(Display.create(stereotype.getLabels(skinParam.guillemet())).create( + new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), + HorizontalAlignment.CENTER, skinParam), 1, 0); } TextBlock genericBlock; @@ -119,8 +129,7 @@ public class EntityImageClassHeader extends AbstractEntityImage { new FontConfiguration(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype), HorizontalAlignment.CENTER, skinParam); genericBlock = TextBlockUtils.withMargin(genericBlock, 1, 1); - final HColor classBackground = SkinParamUtils - .getColor(getSkinParam(), stereotype, ColorParam.background); + final HColor classBackground = SkinParamUtils.getColor(getSkinParam(), stereotype, ColorParam.background); final HColor classBorder = SkinParamUtils.getFontColor(getSkinParam(), FontParam.CLASS_STEREOTYPE, stereotype); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java index 721edb737..113fde69b 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java @@ -123,7 +123,7 @@ public class EntityImageDescription extends AbstractEntityImage { } else { desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), getSkinParam(), HorizontalAlignment.LEFT, stereotype, symbol.manageHorizontalLine(), false, entity, - skinParam.minClassWidth()); + skinParam.minClassWidth(), SName.componentDiagram); } this.url = entity.getUrl99(); @@ -180,7 +180,7 @@ public class EntityImageDescription extends AbstractEntityImage { } name = new BodyEnhanced(codeDisplay, symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER, - stereotype, symbol.manageHorizontalLine(), false, entity); + stereotype, symbol.manageHorizontalLine(), false, entity, SName.componentDiagram); if (hideText) { asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), @@ -191,7 +191,7 @@ public class EntityImageDescription extends AbstractEntityImage { } private USymbol getUSymbol(ILeaf entity) { - final USymbol result = entity.getUSymbol() == null ? getSkinParam().componentStyle().toSymbol() + final USymbol result = entity.getUSymbol() == null ? getSkinParam().componentStyle().toUSymbol() : entity.getUSymbol(); if (result == null) { throw new IllegalArgumentException(); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java index c17496198..f50009396 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageEmptyPackage.java @@ -121,7 +121,7 @@ public class EntityImageEmptyPackage extends AbstractEntityImage { final double roundCorner = 0; final UStroke stroke = GeneralImageBuilder.getForcedStroke(getEntity().getStereotype(), getSkinParam()); - final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().getPackageStyle(), null, desc, + final ClusterDecoration decoration = new ClusterDecoration(getSkinParam().packageStyle(), null, desc, stereoBlock, 0, 0, widthTotal, heightTotal, stroke); final double shadowing = getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0; diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java index 8377080e7..a985d407a 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java @@ -56,6 +56,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UEllipse; @@ -76,14 +77,14 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage { super(entity, skinParam); final Stereotype stereotype = entity.getStereotype(); - final USymbol symbol = entity.getUSymbol() == null ? skinParam.componentStyle().toSymbol() + final USymbol symbol = entity.getUSymbol() == null ? skinParam.componentStyle().toUSymbol() : entity.getUSymbol(); if (symbol == null) { throw new IllegalArgumentException(); } this.desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam, HorizontalAlignment.CENTER, - stereotype, symbol.manageHorizontalLine(), false, entity); + stereotype, symbol.manageHorizontalLine(), false, entity, SName.componentDiagram); this.url = entity.getUrl99(); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java index 522f17574..1496cec9c 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageObject.java @@ -88,9 +88,9 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { this.lineConfig = entity; final Stereotype stereotype = entity.getStereotype(); this.roundCorner = skinParam.getRoundCorner(CornerParam.DEFAULT, null); - this.name = TextBlockUtils.withMargin( - entity.getDisplay().create(new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype), - HorizontalAlignment.CENTER, skinParam), 2, 2); + final FontConfiguration fc = new FontConfiguration(getSkinParam(), FontParam.OBJECT, stereotype); + final TextBlock tmp = getUnderlinedName(entity).create(fc, HorizontalAlignment.CENTER, skinParam); + this.name = TextBlockUtils.withMargin(tmp, 2, 2); if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { this.stereo = null; @@ -100,7 +100,6 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { HorizontalAlignment.CENTER, skinParam); } - // final boolean showMethods = portionShower.showPortion(EntityPortion.METHOD, entity); final boolean showFields = portionShower.showPortion(EntityPortion.FIELD, entity); if (entity.getBodier().getFieldsToDisplay().size() == 0) { @@ -113,6 +112,13 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { } + private Display getUnderlinedName(ILeaf entity) { + if (getSkinParam().strictUmlStyle()) { + return entity.getDisplay().underlinedName(); + } + return entity.getDisplay(); + } + private int marginEmptyFieldsOrMethod = 13; public Dimension2D calculateDimension(StringBounder stringBounder) { @@ -194,8 +200,8 @@ public class EntityImageObject extends AbstractEntityImage implements Stencil { private Dimension2D getNameAndSteretypeDimension(StringBounder stringBounder) { final Dimension2D nameDim = name.calculateDimension(stringBounder); - final Dimension2D stereoDim = stereo == null ? new Dimension2DDouble(0, 0) : stereo - .calculateDimension(stringBounder); + final Dimension2D stereoDim = stereo == null ? new Dimension2DDouble(0, 0) + : stereo.calculateDimension(stringBounder); final Dimension2D nameAndStereo = new Dimension2DDouble(Math.max(nameDim.getWidth(), stereoDim.getWidth()), nameDim.getHeight() + stereoDim.getHeight()); return nameAndStereo; diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java index ecea657e0..55d60b354 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java @@ -53,6 +53,7 @@ import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -86,14 +87,15 @@ public class EntityImageState2 extends AbstractEntityImage { // backcolor = HtmlColorUtils.BLUE; final HColor forecolor = SkinParamUtils.getColor(getSkinParam(), getStereo(), symbol.getColorParamBorder()); - final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)).withShadow( - getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0); + final SymbolContext ctx = new SymbolContext(backcolor, forecolor).withStroke(new UStroke(1.5)) + .withShadow(getSkinParam().shadowing(getEntity().getStereotype()) ? 3 : 0); this.url = entity.getUrl99(); TextBlock stereo = TextBlockUtils.empty(0, 0); final TextBlock desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam, - HorizontalAlignment.CENTER, stereotype, symbol.manageHorizontalLine(), false, entity); + HorizontalAlignment.CENTER, stereotype, symbol.manageHorizontalLine(), false, entity, + SName.stateDiagram); asSmall = symbol.asSmall(null, desc, stereo, ctx, skinParam.getStereotypeAlignment()); diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java index 5830db4d6..4e8c40b47 100644 --- a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java +++ b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java @@ -58,6 +58,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; @@ -80,7 +81,7 @@ public class EntityImageUseCase extends AbstractEntityImage { final Stereotype stereotype = entity.getStereotype(); final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.USECASE, skinParam, - HorizontalAlignment.CENTER, stereotype, true, false, entity); + HorizontalAlignment.CENTER, stereotype, true, false, entity, SName.componentDiagram); if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { diff --git a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java index 86092430e..7701df0d4 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java +++ b/src/net/sourceforge/plantuml/timingdiagram/PlayerBinary.java @@ -36,6 +36,8 @@ package net.sourceforge.plantuml.timingdiagram; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; +import java.util.ArrayList; +import java.util.List; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; @@ -59,6 +61,7 @@ import net.sourceforge.plantuml.ugraphic.color.HColorUtils; public class PlayerBinary extends Player { + private final List constraints = new ArrayList(); private final SortedMap values = new TreeMap(); private Boolean initialState; @@ -67,8 +70,12 @@ public class PlayerBinary extends Player { this.suggestedHeight = 30; } + private double getHeightForConstraints(StringBounder stringBounder) { + return TimeConstraint.getHeightForConstraints(stringBounder, constraints); + } + public double getFullHeight(StringBounder stringBounder) { - return suggestedHeight; + return getHeightForConstraints(stringBounder) + suggestedHeight; } public void drawFrameTitle(UGraphic ug) { @@ -80,7 +87,8 @@ public class PlayerBinary extends Player { public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { final double x = ruler.getPosInPixel(tick); - return new IntricatedPoint(new Point2D.Double(x, getYpos(false)), new Point2D.Double(x, getYpos(true))); + return new IntricatedPoint(new Point2D.Double(x, getYpos(stringBounder, false)), + new Point2D.Double(x, getYpos(stringBounder, true))); } public void addNote(TimeTick now, Display note, Position position) { @@ -105,13 +113,21 @@ public class PlayerBinary extends Player { } public void createConstraint(TimeTick tick1, TimeTick tick2, String message) { - throw new UnsupportedOperationException(); + this.constraints.add(new TimeConstraint(tick1, tick2, message, skinParam)); } private final double ymargin = 8; - private double getYpos(boolean state) { - return state ? ymargin : getFullHeight(null) - ymargin; + private double getYpos(StringBounder stringBounder, boolean state) { + return state ? getYhigh(stringBounder) : getYlow(stringBounder); + } + + private double getYlow(StringBounder stringBounder) { + return getFullHeight(stringBounder) - ymargin; + } + + private double getYhigh(StringBounder stringBounder) { + return ymargin + getHeightForConstraints(stringBounder); } public TextBlock getPart1(double fullAvailableWidth, double specialVSpace) { @@ -138,18 +154,30 @@ public class PlayerBinary extends Player { ug = getContext().apply(ug); double lastx = 0; boolean lastValue = initialState == null ? false : initialState; + final StringBounder stringBounder = ug.getStringBounder(); + final ULine vline = ULine.vline(getYlow(stringBounder) - getYhigh(stringBounder)); for (Map.Entry ent : values.entrySet()) { final double x = ruler.getPosInPixel(ent.getKey()); - ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(ULine.hline(x - lastx)); + ug.apply(new UTranslate(lastx, getYpos(stringBounder, lastValue))).draw(ULine.hline(x - lastx)); if (lastValue != ent.getValue()) { - ug.apply(new UTranslate(x, ymargin)).draw(ULine.vline(getFullHeight(null) - 2 * ymargin)); + ug.apply(new UTranslate(x, getYhigh(stringBounder))).draw(vline); } lastx = x; lastValue = ent.getValue(); } - ug.apply(new UTranslate(lastx, getYpos(lastValue))).draw(ULine.hline(ruler.getWidth() - lastx)); + ug.apply(new UTranslate(lastx, getYpos(stringBounder, lastValue))) + .draw(ULine.hline(ruler.getWidth() - lastx)); + + drawConstraints(ug.apply(UTranslate.dy(getHeightForConstraints(ug.getStringBounder())))); + } }; } + private void drawConstraints(final UGraphic ug) { + for (TimeConstraint constraint : constraints) { + constraint.drawU(ug, ruler); + } + } + } diff --git a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverShadowedG2d.java b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverShadowedG2d.java index e4bf700e3..1f7cae19d 100644 --- a/src/net/sourceforge/plantuml/ugraphic/g2d/DriverShadowedG2d.java +++ b/src/net/sourceforge/plantuml/ugraphic/g2d/DriverShadowedG2d.java @@ -178,9 +178,15 @@ public class DriverShadowedG2d { g2d.scale(1 / dpiFactor, 1 / dpiFactor); final Shape sav = g2d.getClip(); - Area full = new Area(new Rectangle2D.Double(0, 0, bounds.getMaxX() + deltaShadow * 2 + 6, - bounds.getMaxY() + deltaShadow * 2 + 6)); - full.subtract(new Area(shape)); + final Area full = new Area( + new Rectangle2D.Double(0, 0, (bounds.getMaxX() + deltaShadow * 2 + 6) * dpiFactor, + (bounds.getMaxY() + deltaShadow * 2 + 6) * dpiFactor)); + if (dpiFactor == 1) { + full.subtract(new Area(shape)); + } else { + full.subtract( + new Area(shape).createTransformedArea(AffineTransform.getScaleInstance(dpiFactor, dpiFactor))); + } g2d.setClip(full); g2d.drawImage(destination, (int) (bounds.getMinX() * dpiFactor), (int) (bounds.getMinY() * dpiFactor), diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 2277a6c13..a47816eab 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -44,7 +44,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1202013; + return 1202014; } public static int versionPatched() { @@ -93,7 +93,7 @@ public class Version { } public static long compileTime() { - return 1592051198896L; + return 1592662474056L; } public static String compileTimeString() {