diff --git a/build.xml b/build.xml index 2158d69fd..ea86da8b5 100644 --- a/build.xml +++ b/build.xml @@ -60,7 +60,7 @@ - + diff --git a/pom.xml b/pom.xml index f4cb76d2b..520b20135 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ net.sourceforge.plantuml plantuml - 8042-SNAPSHOT + 8043-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/BlockUml.java b/src/net/sourceforge/plantuml/BlockUml.java index 2ef4b8d04..d11cddf05 100644 --- a/src/net/sourceforge/plantuml/BlockUml.java +++ b/src/net/sourceforge/plantuml/BlockUml.java @@ -38,9 +38,8 @@ import java.util.Arrays; import java.util.List; import net.sourceforge.plantuml.command.regex.Matcher2; -import net.sourceforge.plantuml.command.regex.MyPattern; -import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.core.Diagram; +import net.sourceforge.plantuml.utils.StartUtils; public class BlockUml { @@ -48,8 +47,6 @@ public class BlockUml { private final int startLine; private Diagram system; - private static final Pattern2 patternFilename = MyPattern.cmpile("^@start[^%s{}%g]+[%s{][%s%g]*([^%g]*?)[%s}%g]*$"); - BlockUml(String... strings) { this(convert(strings), 0); } @@ -81,7 +78,7 @@ public class BlockUml { public BlockUml(List strings, int startLine) { this.startLine = startLine; final CharSequence2 s0 = strings.get(0).trin(); - if (s0.startsWith("@start") == false) { + if (StartUtils.startsWithSymbolAnd("start", s0) == false) { throw new IllegalArgumentException(); } this.data = new ArrayList(strings); @@ -91,7 +88,7 @@ public class BlockUml { if (OptionFlags.getInstance().isWord()) { return null; } - final Matcher2 m = patternFilename.matcher(StringUtils.trin(data.get(0).toString())); + final Matcher2 m = StartUtils.patternFilename.matcher(StringUtils.trin(data.get(0).toString())); final boolean ok = m.find(); if (ok == false) { return null; diff --git a/src/net/sourceforge/plantuml/ColorParam.java b/src/net/sourceforge/plantuml/ColorParam.java index b35e83a73..5cb8401c1 100644 --- a/src/net/sourceforge/plantuml/ColorParam.java +++ b/src/net/sourceforge/plantuml/ColorParam.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19510 $ + * Revision $Revision: 19978 $ * */ package net.sourceforge.plantuml; @@ -132,6 +132,8 @@ public enum ColorParam { storageBorder(HtmlColorUtils.BLACK, ColorType.LINE), boundaryBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), boundaryBorder(HtmlColorUtils.MY_RED, ColorType.LINE), + collectionsBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), + collectionsBorder(HtmlColorUtils.MY_RED, ColorType.LINE), controlBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), controlBorder(HtmlColorUtils.MY_RED, ColorType.LINE), entityBackground(HtmlColorUtils.MY_YELLOW, ColorType.BACK), diff --git a/src/net/sourceforge/plantuml/FileSystem.java b/src/net/sourceforge/plantuml/FileSystem.java index 74f77e5e1..30455fe6e 100644 --- a/src/net/sourceforge/plantuml/FileSystem.java +++ b/src/net/sourceforge/plantuml/FileSystem.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19896 $ * */ package net.sourceforge.plantuml; @@ -39,7 +39,6 @@ import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; - public class FileSystem { private final static FileSystem singleton = new FileSystem(); @@ -92,10 +91,11 @@ public class FileSystem { private List getPath(String prop) { final List result = new ArrayList(); - final String paths = System.getProperty(prop); + String paths = System.getProperty(prop); if (paths == null) { return result; } + paths = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(paths); final StringTokenizer st = new StringTokenizer(paths, System.getProperty("path.separator")); while (st.hasMoreTokens()) { final File f = new File(st.nextToken()); diff --git a/src/net/sourceforge/plantuml/LineParam.java b/src/net/sourceforge/plantuml/LineParam.java index b813953d3..1ae2ed262 100644 --- a/src/net/sourceforge/plantuml/LineParam.java +++ b/src/net/sourceforge/plantuml/LineParam.java @@ -42,10 +42,12 @@ public enum LineParam { // sequenceReferenceBorder(0.1), sequenceLifeLineBorder, sequenceParticipantBorder, noteBorder, sequenceGroupBorder, sequenceReferenceBorder, + sequenceArrow, classBorder, objectBorder, partitionBorder, packageBorder, - swimlaneBorder; + swimlaneBorder, + activityBorder; // sequenceBoxBorder(0.1); } diff --git a/src/net/sourceforge/plantuml/SourceStringReader.java b/src/net/sourceforge/plantuml/SourceStringReader.java index ae8dd1e96..d958cc7f4 100644 --- a/src/net/sourceforge/plantuml/SourceStringReader.java +++ b/src/net/sourceforge/plantuml/SourceStringReader.java @@ -68,11 +68,20 @@ public class SourceStringReader { this(defines, source, "UTF-8", config); } + public SourceStringReader(String source, File newCurrentDir) { + this(new Defines(), source, "UTF-8", Collections. emptyList(), newCurrentDir); + } + public SourceStringReader(Defines defines, String source, String charset, List config) { + this(defines, source, charset, config, null); + } + + public SourceStringReader(Defines defines, String source, String charset, List config, File newCurrentDir) { // WARNING GLOBAL LOCK HERE synchronized (SourceStringReader.class) { try { - final BlockUmlBuilder builder = new BlockUmlBuilder(config, charset, defines, new StringReader(source)); + final BlockUmlBuilder builder = new BlockUmlBuilder(config, charset, defines, new StringReader(source), + newCurrentDir, null); this.blocks = builder.getBlockUmls(); } catch (IOException e) { Log.error("error " + e); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java index f1cae5ba1..ff59b3108 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java @@ -35,6 +35,7 @@ package net.sourceforge.plantuml.activitydiagram3; import java.util.Collection; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; @@ -118,8 +119,8 @@ public class Branch { return ftile; } - public boolean shadowing() { - return ftile.shadowing(); + public ISkinParam skinParam() { + return ftile.skinParam(); } public final HtmlColor getColor() { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java index 1f578ea24..4c4cf37d9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionGoto.java @@ -48,7 +48,7 @@ public class InstructionGoto extends MonoSwimable implements Instruction { } public Ftile createFtile(FtileFactory factory) { - return new FtileGoto(factory.shadowing(), getSwimlaneIn(), name); + return new FtileGoto(factory.skinParam(), getSwimlaneIn(), name); } public void add(Instruction other) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java index 69da503a6..1b761e4a0 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionLabel.java @@ -48,7 +48,7 @@ public class InstructionLabel extends MonoSwimable implements Instruction { } public Ftile createFtile(FtileFactory factory) { - return new FtileLabel(factory.shadowing(), getSwimlaneIn(), name); + return new FtileLabel(factory.skinParam(), getSwimlaneIn(), name); } public void add(Instruction other) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java index 8b0a16742..6d56951d6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java @@ -78,7 +78,7 @@ public class InstructionList extends WithNote implements Instruction, Instructio public Ftile createFtile(FtileFactory factory) { if (all.size() == 0) { - return new FtileEmpty(factory.shadowing(), defaultSwimlane); + return new FtileEmpty(factory.skinParam(), defaultSwimlane); } Ftile result = eventuallyAddNote(factory, null, getSwimlaneIn()); for (Instruction ins : all) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java index 7eba1fec6..53e032c1b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractFtile.java @@ -36,21 +36,34 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import java.util.Collection; import java.util.Collections; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.LineParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public abstract class AbstractFtile extends AbstractTextBlock implements Ftile { private final boolean shadowing; + private final ISkinParam skinParam; - public AbstractFtile(boolean shadowing) { + private AbstractFtile(boolean shadowing) { this.shadowing = shadowing; + this.skinParam = null; } - final public boolean shadowing() { - return shadowing; + public AbstractFtile(ISkinParam skinParam) { + this.shadowing = skinParam.shadowing(); + this.skinParam = skinParam; + } + + final public ISkinParam skinParam() { + if (skinParam == null) { + throw new IllegalStateException(); + } + return skinParam; } public LinkRendering getInLinkRendering() { @@ -69,4 +82,12 @@ public abstract class AbstractFtile extends AbstractTextBlock implements Ftile { throw new UnsupportedOperationException(); } + public final UStroke getThickness() { + UStroke thickness = skinParam.getThickness(LineParam.activityBorder, null); + if (thickness == null) { + thickness = new UStroke(1.5); + } + return thickness; + } + } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java index 681405656..9d45be4d8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Ftile.java @@ -35,14 +35,18 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import java.util.Collection; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public interface Ftile extends Swimable, TextBlock { - public boolean shadowing(); + public UStroke getThickness(); + + public ISkinParam skinParam(); public LinkRendering getInLinkRendering(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java index 0ad00e6b6..a94d602d2 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileAssemblySimple.java @@ -39,10 +39,12 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class FtileAssemblySimple extends AbstractTextBlock implements Ftile { @@ -132,8 +134,12 @@ public class FtileAssemblySimple extends AbstractTextBlock implements Ftile { return Collections.unmodifiableSet(result); } - public boolean shadowing() { - return tile1.shadowing() || tile2.shadowing(); + public ISkinParam skinParam() { + return tile1.skinParam(); + } + + public UStroke getThickness() { + return tile1.getThickness(); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java index b6bb91e7c..2ea4096fb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileEmpty.java @@ -37,6 +37,7 @@ import java.util.Collections; import java.util.HashSet; import java.util.Set; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -47,12 +48,12 @@ public class FtileEmpty extends AbstractFtile { private final Swimlane swimlaneIn; private final Swimlane swimlaneOut; - public FtileEmpty(boolean shadowing, double width, double height) { - this(shadowing, width, height, null, null); + public FtileEmpty(ISkinParam skinParam, double width, double height) { + this(skinParam, width, height, null, null); } - public FtileEmpty(boolean shadowing, double width, double height, Swimlane swimlaneIn, Swimlane swimlaneOut) { - super(shadowing); + public FtileEmpty(ISkinParam skinParam, double width, double height, Swimlane swimlaneIn, Swimlane swimlaneOut) { + super(skinParam); this.width = width; this.height = height; this.swimlaneIn = swimlaneIn; @@ -60,12 +61,12 @@ public class FtileEmpty extends AbstractFtile { } - public FtileEmpty(boolean shadowing) { - this(shadowing, 0, 0, null, null); + public FtileEmpty(ISkinParam skinParam) { + this(skinParam, 0, 0, null, null); } - public FtileEmpty(boolean shadowing, Swimlane swimlane) { - this(shadowing, 0, 0, swimlane, swimlane); + public FtileEmpty(ISkinParam skinParam, Swimlane swimlane) { + this(skinParam, 0, 0, swimlane, swimlane); } @Override diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java index eefe5449e..949e19330 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactory.java @@ -35,7 +35,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile; import java.util.List; -import net.sourceforge.plantuml.ISkinSimple; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; @@ -46,11 +46,11 @@ import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; -public interface FtileFactory extends ISkinSimple { +public interface FtileFactory { public StringBounder getStringBounder(); - public boolean shadowing(); + public ISkinParam skinParam(); public Ftile start(Swimlane swimlane); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java index 98e09db05..57ebe027b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileFactoryDelegator.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; @@ -54,24 +53,23 @@ import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; public class FtileFactoryDelegator implements FtileFactory { private final FtileFactory factory; - private final ISkinParam skinParam; + private final Rose rose = new Rose(); protected final Rainbow getInLinkRenderingColor(Ftile tile) { Rainbow color; final LinkRendering linkRendering = tile.getInLinkRendering(); if (linkRendering == null) { - color = HtmlColorAndStyle.build(getSkinParam()); + color = HtmlColorAndStyle.build(skinParam()); } else { color = linkRendering.getRainbow(); } if (color.size() == 0) { - color = HtmlColorAndStyle.build(getSkinParam()); + color = HtmlColorAndStyle.build(skinParam()); } return color; } @@ -80,9 +78,8 @@ public class FtileFactoryDelegator implements FtileFactory { if (Display.isNull(display)) { return null; } - final ISkinParam skinParam = getSkinParam(); - final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.ACTIVITY_ARROW, null); - return display.create(fontConfiguration, HorizontalAlignment.LEFT, this, CreoleMode.SIMPLE_LINE); + final FontConfiguration fontConfiguration = new FontConfiguration(skinParam(), FontParam.ACTIVITY_ARROW, null); + return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam(), CreoleMode.SIMPLE_LINE); } protected Display getInLinkRenderingDisplay(Ftile tile) { @@ -93,9 +90,8 @@ public class FtileFactoryDelegator implements FtileFactory { return linkRendering.getDisplay(); } - public FtileFactoryDelegator(FtileFactory factory, ISkinParam skinParam) { + public FtileFactoryDelegator(FtileFactory factory) { this.factory = factory; - this.skinParam = skinParam; } public Ftile start(Swimlane swimlane) { @@ -172,48 +168,15 @@ public class FtileFactoryDelegator implements FtileFactory { return factory.getStringBounder(); } - protected final ISkinParam getSkinParam() { - return skinParam; - } - protected final Rose getRose() { return rose; } - public boolean shadowing() { - return skinParam.shadowing(); + public final ISkinParam skinParam() { + return factory.skinParam(); } protected FtileFactory getFactory() { return factory; } - - public Sprite getSprite(String name) { - return skinParam.getSprite(name); - } - - public String getValue(String key) { - return skinParam.getValue(key); - } - - public double getPadding() { - return skinParam.getPadding(); - } - - public boolean useGuillemet() { - return skinParam.useGuillemet(); - } - - public String getMonospacedFamily() { - return skinParam.getMonospacedFamily(); - } - - public int getTabSize() { - return skinParam.getTabSize(); - } - - public IHtmlColorSet getIHtmlColorSet() { - return skinParam.getIHtmlColorSet(); - } - } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java index 89dce32c7..c878fa6b6 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileGoto.java @@ -33,14 +33,15 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.graphic.StringBounder; public class FtileGoto extends FtileEmpty { private final String name; - public FtileGoto(boolean shadowing, Swimlane swimlane, String name) { - super(shadowing, swimlane); + public FtileGoto(ISkinParam skinParam, Swimlane swimlane, String name) { + super(skinParam, swimlane); this.name = name; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java index 8259e7813..1449b2f7a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileHeightFixed.java @@ -47,7 +47,7 @@ public class FtileHeightFixed extends AbstractFtile { private final double fixedHeight; public FtileHeightFixed(Ftile tile, double fixedHeight) { - super(tile.shadowing()); + super(tile.skinParam()); this.tile = tile; this.fixedHeight = fixedHeight; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java index 5adeb11f3..6840041be 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileKilled.java @@ -43,7 +43,7 @@ public class FtileKilled extends AbstractFtile { private final Ftile tile; public FtileKilled(Ftile tileToKill) { - super(tileToKill.shadowing()); + super(tileToKill.skinParam()); this.tile = tileToKill; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java index e6597d25c..f0f9ba44d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileLabel.java @@ -33,12 +33,14 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile; +import net.sourceforge.plantuml.ISkinParam; + public class FtileLabel extends FtileEmpty { private final String name; - public FtileLabel(boolean shadowing, Swimlane swimlane, String name) { - super(shadowing, swimlane); + public FtileLabel(ISkinParam skinParam, Swimlane swimlane, String name) { + super(skinParam, swimlane); this.name = name; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java index 5e5871c8e..b4cb2276e 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMarged.java @@ -47,7 +47,7 @@ public class FtileMarged extends AbstractFtile { private final double margin2; public FtileMarged(Ftile tile, double margin1, double margin2) { - super(tile.shadowing()); + super(tile.skinParam()); this.tile = tile; this.margin1 = margin1; this.margin2 = margin2; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedRight.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedRight.java index 68a806a2f..da1f92c0c 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedRight.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileMargedRight.java @@ -45,7 +45,7 @@ public class FtileMargedRight extends AbstractFtile { private final double maxX; public FtileMargedRight(Ftile tile, double maxX) { - super(tile.shadowing()); + super(tile.skinParam()); this.tile = tile; this.maxX = maxX; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java index 15cc3d60a..a6a898618 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/FtileUtils.java @@ -78,11 +78,11 @@ public class FtileUtils { // return new FtileMarged(ftile, margin); // } - private static Ftile neverNull(Ftile ftile) { - if (ftile == null) { - return new FtileEmpty(false); - } - return ftile; - } + // private static Ftile neverNull(Ftile ftile, ISkinParam skinParam) { + // if (ftile == null) { + // return new FtileEmpty(skinParam); + // } + // return ftile; + // } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java index 6012a8846..f1b21446b 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/Swimlanes.java @@ -109,15 +109,15 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock { private FtileFactory getFtileFactory() { FtileFactory factory = new VCompactFactory(skinParam, TextBlockUtils.getDummyStringBounder()); - factory = new FtileFactoryDelegatorAddUrl(factory, skinParam); - factory = new FtileFactoryDelegatorAssembly(factory, skinParam); - factory = new FtileFactoryDelegatorIf(factory, skinParam, pragma); - factory = new FtileFactoryDelegatorWhile(factory, skinParam); - factory = new FtileFactoryDelegatorRepeat(factory, skinParam); - factory = new FtileFactoryDelegatorCreateFork(factory, skinParam); - factory = new FtileFactoryDelegatorCreateSplit(factory, skinParam); - factory = new FtileFactoryDelegatorAddNote(factory, skinParam); - factory = new FtileFactoryDelegatorCreateGroup(factory, skinParam); + factory = new FtileFactoryDelegatorAddUrl(factory); + factory = new FtileFactoryDelegatorAssembly(factory); + factory = new FtileFactoryDelegatorIf(factory, pragma); + factory = new FtileFactoryDelegatorWhile(factory); + factory = new FtileFactoryDelegatorRepeat(factory); + factory = new FtileFactoryDelegatorCreateFork(factory); + factory = new FtileFactoryDelegatorCreateSplit(factory); + factory = new FtileFactoryDelegatorAddNote(factory); + factory = new FtileFactoryDelegatorCreateGroup(factory); return factory; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java index f350979bb..b63665983 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/WormMutation.java @@ -179,10 +179,16 @@ public class WormMutation { public UChange getGlobalTranslate(int size) { final MinMax result = new MinMax(); - for (UTranslate tr : translations) { - result.append(tr.getDx()); + if (translations.get(0).getDy() == 0) { + for (UTranslate tr : translations) { + result.append(tr.getDx()); + } + return new UTranslate(-result.getExtreme() * (size - 1) / 2.0, 0); } - return new UTranslate(-result.getExtreme() * (size - 1) / 2.0, 0); + for (UTranslate tr : translations) { + result.append(tr.getDy()); + } + return new UTranslate(0, -result.getExtreme() * (size - 1) / 2.0); } public Worm mute(Worm original) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java index c66fa8e18..3f51dc885 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddNote.java @@ -33,7 +33,6 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; @@ -44,8 +43,8 @@ import net.sourceforge.plantuml.sequencediagram.NoteType; public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator { - public FtileFactoryDelegatorAddNote(FtileFactory factory, ISkinParam skinParam) { - super(factory, skinParam); + public FtileFactoryDelegatorAddNote(FtileFactory factory) { + super(factory); } @Override @@ -54,8 +53,8 @@ public class FtileFactoryDelegatorAddNote extends FtileFactoryDelegator { throw new IllegalArgumentException(); } if (ftile == null) { - return new FtileNoteAlone(getSkinParam().shadowing(), note, getSkinParam(), type == NoteType.NOTE, swimlane); + return new FtileNoteAlone(skinParam().shadowing(), note, skinParam(), type == NoteType.NOTE, swimlane); } - return new FtileWithNoteOpale(ftile, note, notePosition, type, getSkinParam(), true); + return new FtileWithNoteOpale(ftile, note, notePosition, type, skinParam(), true); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java index b86fca0f8..b27623832 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAddUrl.java @@ -33,7 +33,6 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; @@ -43,8 +42,8 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileBox; public class FtileFactoryDelegatorAddUrl extends FtileFactoryDelegator { - public FtileFactoryDelegatorAddUrl(FtileFactory factory, ISkinParam skinParam) { - super(factory, skinParam); + public FtileFactoryDelegatorAddUrl(FtileFactory factory) { + super(factory); } @Override diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java index 44867dc1b..ebbbc67f9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorAssembly.java @@ -35,7 +35,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; import java.awt.geom.Point2D; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; @@ -50,8 +49,8 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class FtileFactoryDelegatorAssembly extends FtileFactoryDelegator { - public FtileFactoryDelegatorAssembly(FtileFactory factory, ISkinParam skinParam) { - super(factory, skinParam); + public FtileFactoryDelegatorAssembly(FtileFactory factory) { + super(factory); } @Override diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java index 763efaa66..725407c65 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateFork.java @@ -39,7 +39,6 @@ import java.util.ArrayList; import java.util.List; import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; @@ -70,14 +69,14 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator { private final Rose rose = new Rose(); - public FtileFactoryDelegatorCreateFork(FtileFactory factory, ISkinParam skinParam) { - super(factory, skinParam); + public FtileFactoryDelegatorCreateFork(FtileFactory factory) { + super(factory); } @Override public Ftile createFork(Swimlane swimlane, List all) { - final HtmlColor colorBar = rose.getHtmlColor(getSkinParam(), ColorParam.activityBar); - final Rainbow arrowColor = HtmlColorAndStyle.build(getSkinParam()); + final HtmlColor colorBar = rose.getHtmlColor(skinParam(), ColorParam.activityBar); + final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final Dimension2D dimSuper = super.createFork(swimlane, all).calculateDimension(getStringBounder()); final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar; @@ -91,7 +90,7 @@ public class FtileFactoryDelegatorCreateFork extends FtileFactoryDelegator { final List conns = new ArrayList(); - final Ftile black = new FtileBlackBlock(shadowing(), colorBar, list.get(0).getSwimlaneIn()); + final Ftile black = new FtileBlackBlock(skinParam(), colorBar, list.get(0).getSwimlaneIn()); double x = 0; for (Ftile tmp : list) { final Dimension2D dim = tmp.calculateDimension(getStringBounder()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java index 06efa1e20..87efcbde2 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateGroup.java @@ -34,7 +34,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; import net.sourceforge.plantuml.ColorParam; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; @@ -46,15 +45,15 @@ public class FtileFactoryDelegatorCreateGroup extends FtileFactoryDelegator { private final Rose rose = new Rose(); - public FtileFactoryDelegatorCreateGroup(FtileFactory factory, ISkinParam skinParam) { - super(factory, skinParam); + public FtileFactoryDelegatorCreateGroup(FtileFactory factory) { + super(factory); } @Override public Ftile createGroup(Ftile list, Display name, HtmlColor backColor, HtmlColor titleColor, Display headerNote, HtmlColor borderColor) { - final HtmlColor arrowColor = rose.getHtmlColor(getSkinParam(), ColorParam.activityArrow); - return new FtileGroup(list, name, headerNote, arrowColor, backColor, titleColor, getSkinParam(), borderColor); + final HtmlColor arrowColor = rose.getHtmlColor(skinParam(), ColorParam.activityArrow); + return new FtileGroup(list, name, headerNote, arrowColor, backColor, titleColor, skinParam(), borderColor); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java index 016d551ec..263352368 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorCreateSplit.java @@ -39,7 +39,6 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.OptionFlags; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractConnection; @@ -73,8 +72,8 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator { private final Rose rose = new Rose(); - public FtileFactoryDelegatorCreateSplit(FtileFactory factory, ISkinParam skinParam) { - super(factory, skinParam); + public FtileFactoryDelegatorCreateSplit(FtileFactory factory) { + super(factory); } static private boolean isSimpleSwimlanes(List all) { @@ -121,7 +120,7 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator { // // } else if (isSeveralSwimlanes(all)) { // // return severalSwimlanes(all); // } - final Rainbow arrowColor = HtmlColorAndStyle.build(getSkinParam()); + final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final Dimension2D dimSuper = super.createSplit(all).calculateDimension(getStringBounder()); final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar; @@ -208,7 +207,7 @@ public class FtileFactoryDelegatorCreateSplit extends FtileFactoryDelegator { } private Ftile simpleSwimlanes(List all) { - final Rainbow arrowColor = HtmlColorAndStyle.build(getSkinParam()); + final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final Dimension2D dimSuper = new FtileSplit1(all).calculateDimension(getStringBounder()); final double height1 = dimSuper.getHeight() + 2 * spaceArroundBlackBar; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java index 553641854..868c87d3f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorIf.java @@ -37,7 +37,6 @@ import java.util.List; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.Pragma; import net.sourceforge.plantuml.activitydiagram3.Branch; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; @@ -56,8 +55,8 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { private final Pragma pragma; - public FtileFactoryDelegatorIf(FtileFactory factory, ISkinParam skinParam, Pragma pragma) { - super(factory, skinParam); + public FtileFactoryDelegatorIf(FtileFactory factory, Pragma pragma) { + super(factory); this.pragma = pragma; } @@ -65,15 +64,15 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { public Ftile createIf(Swimlane swimlane, List thens, Branch elseBranch, LinkRendering afterEndwhile, LinkRendering topInlinkRendering) { - final ConditionStyle conditionStyle = getSkinParam().getConditionStyle(); + final ConditionStyle conditionStyle = skinParam().getConditionStyle(); final Branch branch0 = thens.get(0); - final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder); - final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(getSkinParam(), + final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityBorder); + final HtmlColor backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityBackground) : branch0.getColor(); - final Rainbow arrowColor = HtmlColorAndStyle.build(getSkinParam()); + final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); - final FontConfiguration fcArrow = new FontConfiguration(getSkinParam(), FontParam.ACTIVITY_ARROW, null); + final FontConfiguration fcArrow = new FontConfiguration(skinParam(), FontParam.ACTIVITY_ARROW, null); // .changeColor(fontColor(FontParam.ACTIVITY_DIAMOND)); if (thens.size() > 1) { if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */) @@ -84,15 +83,15 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator { } final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW; - final FontConfiguration fcTest = new FontConfiguration(getSkinParam(), testParam, null) + final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null) .changeColor(fontColor(FontParam.ACTIVITY_DIAMOND)); return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle, - thens.get(0), elseBranch, getSkinParam(), getStringBounder(), fcArrow, fcTest); + thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest); } private HtmlColor fontColor(FontParam param) { - return getSkinParam().getFontHtmlColor(null, param); + return skinParam().getFontHtmlColor(null, param); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java index 675fae1da..fae05e786 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorRepeat.java @@ -35,7 +35,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; @@ -50,29 +49,28 @@ import net.sourceforge.plantuml.svek.ConditionStyle; public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator { - public FtileFactoryDelegatorRepeat(FtileFactory factory, ISkinParam skinParam) { - super(factory, skinParam); + public FtileFactoryDelegatorRepeat(FtileFactory factory) { + super(factory); } @Override public Ftile repeat(Swimlane swimlane, Swimlane swimlaneOut, Ftile repeat, Display test, Display yes, Display out, HtmlColor color, LinkRendering backRepeatLinkRendering) { - final ConditionStyle conditionStyle = getSkinParam().getConditionStyle(); + final ConditionStyle conditionStyle = skinParam().getConditionStyle(); - final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder); - final HtmlColor backColor = color == null ? getRose().getHtmlColor(getSkinParam(), - ColorParam.activityBackground) : color; - final Rainbow arrowColor = HtmlColorAndStyle.build(getSkinParam()); + final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityBorder); + final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityBackground) + : color; + final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final LinkRendering endRepeatLinkRendering = repeat.getOutLinkRendering(); - final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering - .getRainbow(); + final Rainbow endRepeatLinkColor = endRepeatLinkRendering == null ? null : endRepeatLinkRendering.getRainbow(); final FontParam fontParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW; - final FontConfiguration fc = new FontConfiguration(getSkinParam(), fontParam, null); + final FontConfiguration fc = new FontConfiguration(skinParam(), fontParam, null); return FtileRepeat.create(backRepeatLinkRendering, swimlane, swimlaneOut, repeat, test, yes, out, borderColor, - backColor, arrowColor, endRepeatLinkColor, conditionStyle, this, fc); + backColor, arrowColor, endRepeatLinkColor, conditionStyle, this.skinParam(), fc); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java index 97155c3ce..9a42a0ea3 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java @@ -35,7 +35,6 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; -import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; @@ -50,28 +49,28 @@ import net.sourceforge.plantuml.svek.ConditionStyle; public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { - public FtileFactoryDelegatorWhile(FtileFactory factory, ISkinParam skinParam) { - super(factory, skinParam); + public FtileFactoryDelegatorWhile(FtileFactory factory) { + super(factory); } @Override public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, LinkRendering afterEndwhile, HtmlColor color) { - final HtmlColor borderColor = getRose().getHtmlColor(getSkinParam(), ColorParam.activityBorder); - final HtmlColor backColor = color == null ? getRose().getHtmlColor(getSkinParam(), + final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityBorder); + final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityBackground) : color; - final Rainbow arrowColor = HtmlColorAndStyle.build(getSkinParam()); + final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); - final ConditionStyle conditionStyle = getSkinParam().getConditionStyle(); + final ConditionStyle conditionStyle = skinParam().getConditionStyle(); final FontParam testParam = conditionStyle == ConditionStyle.INSIDE ? FontParam.ACTIVITY_DIAMOND : FontParam.ACTIVITY_ARROW; - final FontConfiguration fcTest = new FontConfiguration(getSkinParam(), testParam, null); + final FontConfiguration fcTest = new FontConfiguration(skinParam(), testParam, null); final LinkRendering endInlinkRendering = whileBlock.getOutLinkRendering(); final Rainbow endInlinkColor = endInlinkRendering == null || endInlinkRendering.getRainbow().size() == 0 ? arrowColor : endInlinkRendering.getRainbow(); - final FontConfiguration fontArrow = new FontConfiguration(getSkinParam(), FontParam.ACTIVITY_ARROW, null); + final FontConfiguration fontArrow = new FontConfiguration(skinParam(), FontParam.ACTIVITY_ARROW, null); return FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out, endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java index 623d49501..21a0337cb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileForkInner.java @@ -54,7 +54,7 @@ class FtileForkInner extends AbstractFtile { private final List forks = new ArrayList(); public FtileForkInner(List forks) { - super(forks.get(0).shadowing()); + super(forks.get(0).skinParam()); for (Ftile ftile : forks) { this.forks.add(ftile); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java index feebcdbae..0909edbc9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileGroup.java @@ -79,7 +79,7 @@ public class FtileGroup extends AbstractFtile { public FtileGroup(Ftile inner, Display title, Display displayNote, HtmlColor arrowColor, HtmlColor backColor, HtmlColor titleColor, ISkinParam skinParam, HtmlColor borderColor) { - super(inner.shadowing()); + super(inner.skinParam()); this.backColor = backColor == null ? HtmlColorUtils.WHITE : backColor; this.inner = FtileUtils.addHorizontalMargin(inner, 10); this.arrowColor = arrowColor; @@ -185,7 +185,7 @@ public class FtileGroup extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimTotal = calculateDimension(stringBounder); - final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow(shadowing()) + final SymbolContext symbolContext = new SymbolContext(backColor, borderColor).withShadow(skinParam().shadowing()) .withStroke(stroke); USymbol.FRAME.asBig(name, TextBlockUtils.empty(0, 0), dimTotal.getWidth(), dimTotal.getHeight(), symbolContext) .drawU(ug); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java index 18b68a49a..3fc377355 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfAndStop.java @@ -83,7 +83,7 @@ class FtileIfAndStop extends AbstractFtile { private final Rainbow arrowColor; private FtileIfAndStop(Ftile diamond1, Ftile tile1, Rainbow arrowColor, Ftile stopFtile) { - super(tile1.shadowing()); + super(tile1.skinParam()); this.diamond1 = diamond1; this.tile1 = tile1; this.stop2 = stopFtile; @@ -130,14 +130,14 @@ class FtileIfAndStop extends AbstractFtile { final Sheet sheet = new CreoleParser(fcTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) .createSheet(labelTest); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding()); - final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5)); + final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tileNonStop.getThickness()); final Ftile diamond1; if (conditionStyle == ConditionStyle.INSIDE) { - diamond1 = new FtileDiamondInside(tileNonStop.shadowing(), backColor, borderColor, swimlane, tbTest); + diamond1 = new FtileDiamondInside(tileNonStop.skinParam(), backColor, borderColor, swimlane, tbTest); // .withWest(tb1).withEast(tb2); } else if (conditionStyle == ConditionStyle.DIAMOND) { - diamond1 = new FtileDiamond(tileNonStop.shadowing(), backColor, borderColor, swimlane).withNorth(tbTest); + diamond1 = new FtileDiamond(tileNonStop.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest); // .withWest(tb1).withEast(tb2).withNorth(tbTest); } else { throw new IllegalStateException(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java index aa80d355c..c469a7b0f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongHorizontal.java @@ -81,7 +81,7 @@ class FtileIfLongHorizontal extends AbstractFtile { private final Rainbow arrowColor; private FtileIfLongHorizontal(List diamonds, List tiles, Ftile tile2, Rainbow arrowColor) { - super(tiles.get(0).shadowing() || tile2.shadowing()); + super(tiles.get(0).skinParam()); if (diamonds.size() != tiles.size()) { throw new IllegalArgumentException(); } @@ -148,15 +148,15 @@ class FtileIfLongHorizontal extends AbstractFtile { List diamonds = new ArrayList(); for (Branch branch : thens) { - final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory); - final TextBlock tbTest = branch.getLabelTest().create(fc, HorizontalAlignment.LEFT, ftileFactory); - FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.shadowing(), backColor, borderColor, swimlane, + final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + final TextBlock tbTest = branch.getLabelTest().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + FtileDiamondInside2 diamond = new FtileDiamondInside2(branch.skinParam(), backColor, borderColor, swimlane, tbTest); diamond = diamond.withNorth(tb1); diamonds.add(diamond); } - final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory); + final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); final int last = diamonds.size() - 1; diamonds.set(last, ((FtileDiamondInside2) diamonds.get(last)).withEast(tb2)); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java index 4d4dd410b..3b636d9cb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileIfLongVertical.java @@ -84,7 +84,7 @@ class FtileIfLongVertical extends AbstractFtile { private FtileIfLongVertical(List diamonds, List tiles, Ftile tile2, Rainbow arrowColor, Ftile lastDiamond) { - super(tiles.get(0).shadowing() || tile2.shadowing()); + super(tiles.get(0).skinParam()); if (diamonds.size() != tiles.size()) { throw new IllegalArgumentException(); } @@ -149,21 +149,21 @@ class FtileIfLongVertical extends AbstractFtile { List diamonds = new ArrayList(); for (Branch branch : thens) { - final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory); - final TextBlock tbTest = branch.getLabelTest().create(fc, HorizontalAlignment.LEFT, ftileFactory); - FtileDiamondInside3 diamond = new FtileDiamondInside3(branch.shadowing(), backColor, borderColor, swimlane, + final TextBlock tb1 = branch.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + final TextBlock tbTest = branch.getLabelTest().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + FtileDiamondInside3 diamond = new FtileDiamondInside3(branch.skinParam(), backColor, borderColor, swimlane, tbTest); diamond = diamond.withEast(tb1); diamonds.add(diamond); } - final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory); + final TextBlock tb2 = branch2.getLabelPositive().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); final int last = diamonds.size() - 1; diamonds.set(last, ((FtileDiamondInside3) diamonds.get(last)).withSouth(tb2)); // diamonds = alignDiamonds(diamonds, ftileFactory.getStringBounder()); - final Ftile lastDiamond = new FtileDiamond(tiles.get(0).shadowing(), backColor, borderColor, swimlane); + final Ftile lastDiamond = new FtileDiamond(tiles.get(0).skinParam(), backColor, borderColor, swimlane); final FtileIfLongVertical result = new FtileIfLongVertical(diamonds, tiles, tile2, arrowColor, lastDiamond); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java index 8ffe38301..2ccc6d41e 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileNoteAlone.java @@ -82,7 +82,7 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil { } public FtileNoteAlone(boolean shadow, Display note, ISkinParam skinParam, boolean withOutPoint, Swimlane swimlane) { - super(shadow); + super(skinParam); this.swimlane = swimlane; this.withOutPoint = withOutPoint; final Rose rose = new Rose(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java index 8a2fbffc7..3a192bd79 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileRepeat.java @@ -78,7 +78,7 @@ class FtileRepeat extends AbstractFtile { private final TextBlock tbTest; private FtileRepeat(Ftile repeat, Ftile diamond1, Ftile diamond2, TextBlock tbTest) { - super(repeat.shadowing()); + super(repeat.skinParam()); this.repeat = repeat; this.diamond1 = diamond1; this.diamond2 = diamond2; @@ -108,20 +108,20 @@ class FtileRepeat extends AbstractFtile { final TextBlock yesTb = yes.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); final TextBlock outTb = out.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); - final Ftile diamond1 = new FtileDiamond(repeat.shadowing(), backColor, borderColor, swimlane); + final Ftile diamond1 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, swimlane); final FtileRepeat result; if (conditionStyle == ConditionStyle.INSIDE) { - final Ftile diamond2 = new FtileDiamondInside(repeat.shadowing(), backColor, borderColor, swimlaneOut, + final Ftile diamond2 = new FtileDiamondInside(repeat.skinParam(), backColor, borderColor, swimlaneOut, tbTest).withEast(yesTb).withSouth(outTb); // final Ftile diamond2 = new FtileDiamondInside(repeat.shadowing(), backColor, borderColor, swimlane, // tbTest).withEast(yesTb).withSouth(outTb); result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0)); } else if (conditionStyle == ConditionStyle.DIAMOND) { - final Ftile diamond2 = new FtileDiamond(repeat.shadowing(), backColor, borderColor, swimlane) + final Ftile diamond2 = new FtileDiamond(repeat.skinParam(), backColor, borderColor, swimlane) .withEast(tbTest); result = new FtileRepeat(repeat, diamond1, diamond2, tbTest); } else if (conditionStyle == ConditionStyle.FOO1) { - final Ftile diamond2 = new FtileDiamondFoo1(repeat.shadowing(), backColor, borderColor, swimlane, tbTest); + final Ftile diamond2 = new FtileDiamondFoo1(repeat.skinParam(), backColor, borderColor, swimlane, tbTest); result = new FtileRepeat(repeat, diamond1, diamond2, TextBlockUtils.empty(0, 0)); } else { throw new IllegalStateException(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java index b43c7962c..9b6e22d1d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileSplit1.java @@ -54,7 +54,7 @@ class FtileSplit1 extends AbstractFtile { private final List forks = new ArrayList(); public FtileSplit1(List forks) { - super(forks.get(0).shadowing()); + super(forks.get(0).skinParam()); for (Ftile ftile : forks) { this.forks.add(ftile); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index 77d3eba60..4d9cab883 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -95,7 +95,7 @@ class FtileWhile extends AbstractFtile { } private FtileWhile(Ftile whileBlock, Ftile diamond1, TextBlock supplementarySouthText) { - super(whileBlock.shadowing()); + super(whileBlock.skinParam()); this.whileBlock = whileBlock; this.diamond1 = diamond1; this.supplementarySouthText = supplementarySouthText; @@ -115,23 +115,23 @@ class FtileWhile extends AbstractFtile { LinkRendering afterEndwhile, FontConfiguration fontArrow, FtileFactory ftileFactory, ConditionStyle conditionStyle, FontConfiguration fcTest) { - final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory); - final TextBlock testTb = test.create(fcTest, HorizontalAlignment.LEFT, ftileFactory); - final TextBlock out = out2.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory); + final TextBlock yesTb = yes.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + final TextBlock testTb = test.create(fcTest, HorizontalAlignment.LEFT, ftileFactory.skinParam()); + final TextBlock out = out2.create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam()); final Ftile diamond1; final TextBlock supplementarySouthText; if (conditionStyle == ConditionStyle.INSIDE) { supplementarySouthText = TextBlockUtils.empty(0, 0); - diamond1 = new FtileDiamondInside(whileBlock.shadowing(), backColor, borderColor, swimlane, testTb) + diamond1 = new FtileDiamondInside(whileBlock.skinParam(), backColor, borderColor, swimlane, testTb) .withNorth(yesTb).withWest(out); } else if (conditionStyle == ConditionStyle.FOO1) { supplementarySouthText = TextBlockUtils.empty(0, 0); - diamond1 = new FtileDiamondFoo1(whileBlock.shadowing(), backColor, borderColor, swimlane, testTb) + diamond1 = new FtileDiamondFoo1(whileBlock.skinParam(), backColor, borderColor, swimlane, testTb) .withNorth(yesTb).withWest(out); } else if (conditionStyle == ConditionStyle.DIAMOND) { - supplementarySouthText = createLabel1(test, yes, ftileFactory, fontArrow); - diamond1 = new FtileDiamond(whileBlock.shadowing(), backColor, borderColor, swimlane).withWest(out) + supplementarySouthText = createLabel1(test, yes, ftileFactory.skinParam(), fontArrow); + diamond1 = new FtileDiamond(whileBlock.skinParam(), backColor, borderColor, swimlane).withWest(out) .withSouth(supplementarySouthText); } else { throw new IllegalStateException(); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java index aed46ade3..1af585e1f 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWithNoteOpale.java @@ -89,7 +89,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil { public FtileWithNoteOpale(Ftile tile, Display note, NotePosition notePosition, NoteType type, ISkinParam skinParam, boolean withLink) { - super(tile.shadowing()); + super(tile.skinParam()); this.tile = tile; this.notePosition = notePosition; if (type == NoteType.FLOATING_NOTE) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java index e788d6779..1812b0994 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/VCompactFactory.java @@ -55,14 +55,12 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateIn; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDecorateOut; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.IHtmlColorSet; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UFont; -import net.sourceforge.plantuml.ugraphic.sprite.Sprite; public class VCompactFactory implements FtileFactory { @@ -81,17 +79,17 @@ public class VCompactFactory implements FtileFactory { public Ftile start(Swimlane swimlane) { final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityStart); - return new FtileCircleStart(shadowing(), color, swimlane); + return new FtileCircleStart(skinParam(), color, swimlane); } public Ftile stop(Swimlane swimlane) { final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); - return new FtileCircleStop(shadowing(), color, swimlane); + return new FtileCircleStop(skinParam(), color, swimlane); } public Ftile end(Swimlane swimlane) { final HtmlColor color = rose.getHtmlColor(skinParam, ColorParam.activityEnd); - return new FtileCircleEnd(shadowing(), color, swimlane); + return new FtileCircleEnd(skinParam(), color, swimlane); } public Ftile activity(Display label, Swimlane swimlane, BoxStyle style, Colors colors) { @@ -99,7 +97,7 @@ public class VCompactFactory implements FtileFactory { // final HtmlColor backColor = color == null ? rose.getHtmlColor(skinParam, ColorParam.activityBackground) : // color; final UFont font = skinParam.getFont(null, false, FontParam.ACTIVITY); - return new FtileBox(shadowing(), label, font, swimlane, style, colors.mute(skinParam)); + return new FtileBox(colors.mute(skinParam), label, font, swimlane, style); } public Ftile addNote(Ftile ftile, Display note, NotePosition notePosition, NoteType type, Swimlane swimlane) { @@ -161,36 +159,8 @@ public class VCompactFactory implements FtileFactory { return new FtileDecorateOut(ftile, linkRendering); } - public boolean shadowing() { - return skinParam.shadowing(); - } - - public Sprite getSprite(String name) { - return skinParam.getSprite(name); - } - - public String getValue(String key) { - return skinParam.getValue(key); - } - - public double getPadding() { - return skinParam.getPadding(); - } - - public boolean useGuillemet() { - return skinParam.useGuillemet(); - } - - public String getMonospacedFamily() { - return skinParam.getMonospacedFamily(); - } - - public int getTabSize() { - return skinParam.getTabSize(); - } - - public IHtmlColorSet getIHtmlColorSet() { - return skinParam.getIHtmlColorSet(); + public ISkinParam skinParam() { + return skinParam; } } 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 1a14a076a..a970ba740 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java @@ -59,7 +59,6 @@ import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.svek.ConditionStyle; -import net.sourceforge.plantuml.ugraphic.UStroke; public class ConditionalBuilder { @@ -79,10 +78,9 @@ public class ConditionalBuilder { private final Ftile tile1; private final Ftile tile2; - public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, - Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, - Branch branch2, ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, - FontConfiguration fontTest) { + public ConditionalBuilder(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2, + ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fontArrow, FontConfiguration fontTest) { this.swimlane = swimlane; this.borderColor = borderColor; this.backColor = backColor; @@ -101,10 +99,9 @@ public class ConditionalBuilder { } - static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, - Rainbow arrowColor, FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, - Branch branch2, ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, - FontConfiguration fcTest) { + static public Ftile create(Swimlane swimlane, HtmlColor borderColor, HtmlColor backColor, Rainbow arrowColor, + FtileFactory ftileFactory, ConditionStyle conditionStyle, Branch branch1, Branch branch2, + ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) { final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor, ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder, fcArrow, fcTest); return builder.createWithLinks(); @@ -159,14 +156,14 @@ public class ConditionalBuilder { final Sheet sheet = new CreoleParser(fontTest, HorizontalAlignment.LEFT, skinParam, CreoleMode.FULL) .createSheet(labelTest); final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, 0, skinParam.getPadding()); - final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), new UStroke(1.5)); + final TextBlock tbTest = new SheetBlock2(sheetBlock1, Diamond.asStencil(sheetBlock1), tile1.getThickness()); final Ftile diamond1; if (conditionStyle == ConditionStyle.INSIDE) { - diamond1 = new FtileDiamondInside(tile1.shadowing(), backColor, borderColor, swimlane, tbTest) + diamond1 = new FtileDiamondInside(tile1.skinParam(), backColor, borderColor, swimlane, tbTest) .withWestAndEast(tb1, tb2); } else if (conditionStyle == ConditionStyle.DIAMOND) { - diamond1 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withNorth(tbTest) + diamond1 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withNorth(tbTest) .withWestAndEast(tb1, tb2); } else { throw new IllegalStateException(); @@ -175,13 +172,13 @@ public class ConditionalBuilder { } private TextBlock getLabelBranch2() { - final TextBlock tb2 = branch2.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory, + final TextBlock tb2 = branch2.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE); return tb2; } private TextBlock getLabelBranch1() { - final TextBlock tb1 = branch1.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory, + final TextBlock tb1 = branch1.getLabelPositive().create(fontArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE); return tb1; } @@ -191,16 +188,16 @@ public class ConditionalBuilder { if (hasTwoBranches()) { final Display out1 = branch1.getFtile().getOutLinkRendering().getDisplay(); final TextBlock tbout1 = out1 == null ? null : out1.create(fontArrow, HorizontalAlignment.LEFT, - ftileFactory, CreoleMode.SIMPLE_LINE); + ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE); final Display out2 = branch2.getFtile().getOutLinkRendering().getDisplay(); final TextBlock tbout2 = out2 == null ? null : out2.create(fontArrow, HorizontalAlignment.LEFT, - ftileFactory, CreoleMode.SIMPLE_LINE); - diamond2 = new FtileDiamond(tile1.shadowing(), backColor, borderColor, swimlane).withWest(tbout1).withEast( + ftileFactory.skinParam(), CreoleMode.SIMPLE_LINE); + diamond2 = new FtileDiamond(tile1.skinParam(), backColor, borderColor, swimlane).withWest(tbout1).withEast( tbout2); } else { // diamond2 = new FtileEmpty(tile1.shadowing(), Diamond.diamondHalfSize * 2, Diamond.diamondHalfSize * 2, // swimlane, swimlane); - diamond2 = new FtileEmpty(tile1.shadowing(), 0, Diamond.diamondHalfSize / 2, swimlane, swimlane); + diamond2 = new FtileEmpty(tile1.skinParam(), 0, Diamond.diamondHalfSize / 2, swimlane, swimlane); } return diamond2; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileDimensionMemoize.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileDimensionMemoize.java index d13795fae..8f864dca9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileDimensionMemoize.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileDimensionMemoize.java @@ -33,14 +33,15 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.graphic.StringBounder; public abstract class FtileDimensionMemoize extends AbstractFtile { - public FtileDimensionMemoize(boolean shadowing) { - super(shadowing); + public FtileDimensionMemoize(ISkinParam skinParam) { + super(skinParam); } private FtileGeometry calculateDimensionInternal; diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfNude.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfNude.java index c9152d99e..f4ae077ca 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfNude.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/FtileIfNude.java @@ -53,7 +53,7 @@ public class FtileIfNude extends FtileDimensionMemoize { private final Swimlane in; FtileIfNude(Ftile tile1, Ftile tile2, Swimlane in) { - super(tile1.shadowing() || tile2.shadowing()); + super(tile1.skinParam()); this.tile1 = tile1; this.tile2 = tile2; this.in = in; @@ -147,10 +147,10 @@ public class FtileIfNude extends FtileDimensionMemoize { return (dim1.getWidth() - dim1.getLeft()) + dim2.getLeft(); } -// protected double getLeft(StringBounder stringBounder) { -// final double left1 = tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft(); -// final double left2 = tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft(); -// return (left1 + left2) / 2; -// } + // protected double getLeft(StringBounder stringBounder) { + // final double left1 = tile1.calculateDimension(stringBounder).translate(getTranslate1(stringBounder)).getLeft(); + // final double left2 = tile2.calculateDimension(stringBounder).translate(getTranslate2(stringBounder)).getLeft(); + // return (left1 + left2) / 2; + // } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java index 6d8ec838d..69db8ce02 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBlackBlock.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vertical; import java.util.Collections; import java.util.Set; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; @@ -53,8 +54,8 @@ public class FtileBlackBlock extends AbstractFtile { private final HtmlColor colorBar; private final Swimlane swimlane; - public FtileBlackBlock(boolean shadowing, HtmlColor colorBar, Swimlane swimlane) { - super(shadowing); + public FtileBlackBlock(ISkinParam skinParam, HtmlColor colorBar, Swimlane swimlane) { + super(skinParam); this.colorBar = colorBar; this.swimlane = swimlane; } @@ -70,7 +71,7 @@ public class FtileBlackBlock extends AbstractFtile { public void drawU(UGraphic ug) { final URectangle rect = new URectangle(width, height, 5, 5); - if (shadowing()) { + if (skinParam().shadowing()) { rect.setDeltaShadow(3); } ug.apply(new UChangeColor(colorBar)).apply(new UChangeBackColor(colorBar)).draw(rect); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java index 2e64613a5..8d5a36614 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileBox.java @@ -111,9 +111,8 @@ public class FtileBox extends AbstractFtile { } - public FtileBox(boolean shadowing, Display label, UFont font, Swimlane swimlane, BoxStyle style, - ISkinParam skinParam) { - super(shadowing); + public FtileBox(ISkinParam skinParam, Display label, UFont font, Swimlane swimlane, BoxStyle style) { + super(skinParam); this.style = style; this.skinParam = skinParam; this.swimlane = swimlane; @@ -136,12 +135,12 @@ public class FtileBox extends AbstractFtile { final Dimension2D dimTotal = calculateDimension(ug.getStringBounder()); final double widthTotal = dimTotal.getWidth(); final double heightTotal = dimTotal.getHeight(); - final UDrawable rect = style.getUDrawable(widthTotal, heightTotal, shadowing()); + final UDrawable rect = style.getUDrawable(widthTotal, heightTotal, skinParam().shadowing()); final HtmlColor borderColor = SkinParamUtils.getColor(skinParam, ColorParam.activityBorder, null); final HtmlColor backColor = SkinParamUtils.getColor(skinParam, ColorParam.activityBackground, null); - ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(new UStroke(1.5)); + ug = ug.apply(new UChangeColor(borderColor)).apply(new UChangeBackColor(backColor)).apply(getThickness()); rect.drawU(ug); tb.drawU(ug.apply(new UTranslate(MARGIN, MARGIN))); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java index ca3c4ec3e..b015cd8e2 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleEnd.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vertical; import java.util.Collections; import java.util.Set; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; @@ -57,8 +58,8 @@ public class FtileCircleEnd extends AbstractFtile { private final HtmlColor backColor; private final Swimlane swimlane; - public FtileCircleEnd(boolean shadowing, HtmlColor backColor, Swimlane swimlane) { - super(shadowing); + public FtileCircleEnd(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { + super(skinParam); this.backColor = backColor; this.swimlane = swimlane; } @@ -85,7 +86,7 @@ public class FtileCircleEnd extends AbstractFtile { yTheoricalPosition = Math.round(yTheoricalPosition); final UEllipse circle = new UEllipse(SIZE, SIZE); - if (shadowing()) { + if (skinParam().shadowing()) { circle.setDeltaShadow(3); } ug = ug.apply(new UChangeColor(backColor)); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java index 7bd4b3a4a..67f2f1364 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStart.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vertical; import java.util.Collections; import java.util.Set; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; @@ -53,8 +54,8 @@ public class FtileCircleStart extends AbstractFtile { private final HtmlColor backColor; private final Swimlane swimlane; - public FtileCircleStart(boolean shadowing, HtmlColor backColor, Swimlane swimlane) { - super(shadowing); + public FtileCircleStart(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { + super(skinParam); this.backColor = backColor; this.swimlane = swimlane; } @@ -76,7 +77,7 @@ public class FtileCircleStart extends AbstractFtile { public void drawU(UGraphic ug) { final UEllipse circle = new UEllipse(SIZE, SIZE); - if (shadowing()) { + if (skinParam().shadowing()) { circle.setDeltaShadow(3); } ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backColor)).draw(circle); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java index af72111bc..49f45ee7a 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileCircleStop.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vertical; import java.util.Collections; import java.util.Set; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; @@ -54,8 +55,8 @@ public class FtileCircleStop extends AbstractFtile { private final HtmlColor backColor; private final Swimlane swimlane; - public FtileCircleStop(boolean shadowing, HtmlColor backColor, Swimlane swimlane) { - super(shadowing); + public FtileCircleStop(ISkinParam skinParam, HtmlColor backColor, Swimlane swimlane) { + super(skinParam); this.backColor = backColor; this.swimlane = swimlane; } @@ -82,7 +83,7 @@ public class FtileCircleStop extends AbstractFtile { yTheoricalPosition = Math.round(yTheoricalPosition); final UEllipse circle = new UEllipse(SIZE, SIZE); - if (shadowing()) { + if (skinParam().shadowing()) { circle.setDeltaShadow(3); } ug.apply(new UChangeColor(backColor)).apply(new UChangeBackColor(null)) @@ -90,7 +91,7 @@ public class FtileCircleStop extends AbstractFtile { final double delta = 4; final UEllipse circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2); - if (shadowing()) { + if (skinParam().shadowing()) { circleSmall.setDeltaShadow(3); } ug.apply(new UChangeColor(null)).apply(new UChangeBackColor(backColor)) diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java index 773ffea4a..77bb11de0 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDecorate.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vertical; import java.util.Collection; import java.util.Set; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -44,6 +45,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public abstract class FtileDecorate extends AbstractTextBlock implements Ftile { @@ -66,7 +68,7 @@ public abstract class FtileDecorate extends AbstractTextBlock implements Ftile { public LinkRendering getInLinkRendering() { return ftile.getInLinkRendering(); } - + public void drawU(UGraphic ug) { ftile.drawU(ug); } @@ -95,10 +97,14 @@ public abstract class FtileDecorate extends AbstractTextBlock implements Ftile { return ftile.getSwimlaneOut(); } - public boolean shadowing() { - return ftile.shadowing(); + public ISkinParam skinParam() { + return ftile.skinParam(); } - + + public UStroke getThickness() { + return ftile.getThickness(); + } + protected final Ftile getFtileDelegated() { return ftile; } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java index aa0bc1c22..458908fe4 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamond.java @@ -38,6 +38,7 @@ import java.util.Collections; import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -50,7 +51,6 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class FtileDiamond extends AbstractFtile { @@ -63,36 +63,36 @@ public class FtileDiamond extends AbstractFtile { private final TextBlock west1; private final TextBlock east1; - public FtileDiamond(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane) { - this(shadowing, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), + public FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane) { + this(skinParam, backColor, borderColor, swimlane, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); } public FtileDiamond withNorth(TextBlock north) { - return new FtileDiamond(shadowing(), backColor, borderColor, swimlane, north, south, east1, west1); + return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1); } public FtileDiamond withWest(TextBlock west1) { if (west1 == null) { return this; } - return new FtileDiamond(shadowing(), backColor, borderColor, swimlane, north, south, east1, west1); + return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1); } public FtileDiamond withEast(TextBlock east1) { if (east1 == null) { return this; } - return new FtileDiamond(shadowing(), backColor, borderColor, swimlane, north, south, east1, west1); + return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1); } public FtileDiamond withSouth(TextBlock south) { - return new FtileDiamond(shadowing(), backColor, borderColor, swimlane, north, south, east1, west1); + return new FtileDiamond(skinParam(), backColor, borderColor, swimlane, north, south, east1, west1); } - private FtileDiamond(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamond(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock north, TextBlock south, TextBlock east1, TextBlock west1) { - super(shadowing); + super(skinParam); this.backColor = backColor; this.swimlane = swimlane; this.borderColor = borderColor; @@ -119,8 +119,8 @@ public class FtileDiamond extends AbstractFtile { public void drawU(UGraphic ug) { - ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor)) - .draw(Diamond.asPolygon(shadowing())); + ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)) + .draw(Diamond.asPolygon(skinParam().shadowing())); final Dimension2D dimNorth = north.calculateDimension(ug.getStringBounder()); north.drawU(ug.apply(new UTranslate(Diamond.diamondHalfSize * 1.5, -dimNorth.getHeight() - Diamond.diamondHalfSize))); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java index 041154d06..4c131a3a0 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondFoo1.java @@ -38,6 +38,7 @@ import java.util.Collections; import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; @@ -49,7 +50,6 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class FtileDiamondFoo1 extends AbstractFtile { @@ -62,27 +62,27 @@ public class FtileDiamondFoo1 extends AbstractFtile { private final TextBlock east; private final TextBlock north; - public FtileDiamondFoo1(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondFoo1(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock label) { - this(shadowing, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), + this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); } public FtileDiamondFoo1 withNorth(TextBlock north) { - return new FtileDiamondFoo1(shadowing(), backColor, borderColor, swimlane, label, north, west, east); + return new FtileDiamondFoo1(skinParam(), backColor, borderColor, swimlane, label, north, west, east); } public FtileDiamondFoo1 withWest(TextBlock west) { - return new FtileDiamondFoo1(shadowing(), backColor, borderColor, swimlane, label, north, west, east); + return new FtileDiamondFoo1(skinParam(), backColor, borderColor, swimlane, label, north, west, east); } public FtileDiamondFoo1 withEast(TextBlock east) { - return new FtileDiamondFoo1(shadowing(), backColor, borderColor, swimlane, label, north, west, east); + return new FtileDiamondFoo1(skinParam(), backColor, borderColor, swimlane, label, north, west, east); } - private FtileDiamondFoo1(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondFoo1(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock west, TextBlock east) { - super(shadowing); + super(skinParam); this.backColor = backColor; this.swimlane = swimlane; this.borderColor = borderColor; @@ -111,8 +111,8 @@ public class FtileDiamondFoo1 extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionInternal(stringBounder); - ug = ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor)); - ug.draw(Diamond.asPolygonFoo1(shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); + ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); + ug.draw(Diamond.asPolygonFoo1(skinParam().shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java index 8bd249877..88b222196 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside.java @@ -38,6 +38,7 @@ import java.util.Collections; import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; @@ -50,7 +51,6 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class FtileDiamondInside extends AbstractFtile { @@ -64,22 +64,22 @@ public class FtileDiamondInside extends AbstractFtile { private final TextBlock north; private final TextBlock south; - public FtileDiamondInside(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock label) { - this(shadowing, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), + this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); } public FtileDiamondInside withNorth(TextBlock north) { - return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public FtileDiamondInside withWest(TextBlock west) { - return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public FtileDiamondInside withEast(TextBlock east) { - return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public Ftile withWestAndEast(TextBlock tb1, TextBlock tb2) { @@ -87,12 +87,12 @@ public class FtileDiamondInside extends AbstractFtile { } public FtileDiamondInside withSouth(TextBlock south) { - return new FtileDiamondInside(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } - private FtileDiamondInside(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { - super(shadowing); + super(skinParam); this.backColor = backColor; this.swimlane = swimlane; this.borderColor = borderColor; @@ -122,8 +122,8 @@ public class FtileDiamondInside extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); - ug = ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor)); - ug.draw(Diamond.asPolygon(shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); + ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); + ug.draw(Diamond.asPolygon(skinParam().shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java index 83cc0dac7..4360ae9c8 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside2.java @@ -38,6 +38,7 @@ import java.util.Collections; import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; @@ -49,7 +50,6 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; public class FtileDiamondInside2 extends AbstractFtile { @@ -63,31 +63,31 @@ public class FtileDiamondInside2 extends AbstractFtile { private final TextBlock north; private final TextBlock south; - public FtileDiamondInside2(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock label) { - this(shadowing, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), + this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); } public FtileDiamondInside2 withNorth(TextBlock north) { - return new FtileDiamondInside2(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public FtileDiamondInside2 withWest(TextBlock west) { - return new FtileDiamondInside2(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public FtileDiamondInside2 withEast(TextBlock east) { - return new FtileDiamondInside2(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public FtileDiamondInside2 withSouth(TextBlock south) { - return new FtileDiamondInside2(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside2(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } - private FtileDiamondInside2(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside2(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { - super(shadowing); + super(skinParam); this.backColor = backColor; this.swimlane = swimlane; this.borderColor = borderColor; @@ -117,8 +117,8 @@ public class FtileDiamondInside2 extends AbstractFtile { final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); - ug = ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor)); - ug.draw(Diamond.asPolygon(shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); + ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); + ug.draw(Diamond.asPolygon(skinParam().shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java index cfefed1a8..887858a61 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vertical/FtileDiamondInside3.java @@ -38,6 +38,7 @@ import java.util.Collections; import java.util.Set; import net.sourceforge.plantuml.Dimension2DDouble; +import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile; import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry; @@ -50,7 +51,6 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.utils.MathUtils; @@ -65,31 +65,31 @@ public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassi private final TextBlock north; private final TextBlock south; - public FtileDiamondInside3(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + public FtileDiamondInside3(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock label) { - this(shadowing, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), + this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0)); } public FtileDiamondInside3 withNorth(TextBlock north) { - return new FtileDiamondInside3(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public FtileDiamondInside3 withWest(TextBlock west) { - return new FtileDiamondInside3(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public FtileDiamondInside3 withEast(TextBlock east) { - return new FtileDiamondInside3(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } public FtileDiamondInside3 withSouth(TextBlock south) { - return new FtileDiamondInside3(shadowing(), backColor, borderColor, swimlane, label, north, south, west, east); + return new FtileDiamondInside3(skinParam(), backColor, borderColor, swimlane, label, north, south, west, east); } - private FtileDiamondInside3(boolean shadowing, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, + private FtileDiamondInside3(ISkinParam skinParam, HtmlColor backColor, HtmlColor borderColor, Swimlane swimlane, TextBlock label, TextBlock north, TextBlock south, TextBlock west, TextBlock east) { - super(shadowing); + super(skinParam); this.backColor = backColor; this.swimlane = swimlane; this.borderColor = borderColor; @@ -119,8 +119,8 @@ public class FtileDiamondInside3 extends AbstractFtile implements FtileOverpassi final StringBounder stringBounder = ug.getStringBounder(); final Dimension2D dimLabel = label.calculateDimension(stringBounder); final Dimension2D dimTotal = calculateDimensionAlone(stringBounder); - ug = ug.apply(new UChangeColor(borderColor)).apply(new UStroke(1.5)).apply(new UChangeBackColor(backColor)); - ug.draw(Diamond.asPolygon(shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); + ug = ug.apply(new UChangeColor(borderColor)).apply(getThickness()).apply(new UChangeBackColor(backColor)); + ug.draw(Diamond.asPolygon(skinParam().shadowing(), dimTotal.getWidth(), dimTotal.getHeight())); north.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); south.drawU(ug.apply(new UTranslate(4 + dimTotal.getWidth() / 2, dimTotal.getHeight()))); diff --git a/src/net/sourceforge/plantuml/code/AsciiEncoder.java b/src/net/sourceforge/plantuml/code/AsciiEncoder.java index 61c6cc3da..af31f632e 100644 --- a/src/net/sourceforge/plantuml/code/AsciiEncoder.java +++ b/src/net/sourceforge/plantuml/code/AsciiEncoder.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19934 $ * */ package net.sourceforge.plantuml.code; @@ -46,6 +46,9 @@ public class AsciiEncoder implements URLEncoder { } public String encode(byte data[]) { + if (data == null) { + return ""; + } final StringBuilder resu = new StringBuilder((data.length * 4 + 2) / 3); for (int i = 0; i < data.length; i += 3) { append3bytes(resu, data[i] & 0xFF, i + 1 < data.length ? data[i + 1] & 0xFF : 0, diff --git a/src/net/sourceforge/plantuml/code/CompressionZlib.java b/src/net/sourceforge/plantuml/code/CompressionZlib.java index 651f45e3a..183fe7196 100644 --- a/src/net/sourceforge/plantuml/code/CompressionZlib.java +++ b/src/net/sourceforge/plantuml/code/CompressionZlib.java @@ -41,7 +41,13 @@ import java.util.zip.Inflater; public class CompressionZlib implements Compression { public byte[] compress(byte[] in) { + if (in.length == 0) { + return null; + } int len = in.length * 2; + if (len < 100) { + len = 100; + } byte[] result = null; while (result == null) { result = tryCompress(in, len); diff --git a/src/net/sourceforge/plantuml/core/DiagramType.java b/src/net/sourceforge/plantuml/core/DiagramType.java index 22c546eda..e23af1c08 100644 --- a/src/net/sourceforge/plantuml/core/DiagramType.java +++ b/src/net/sourceforge/plantuml/core/DiagramType.java @@ -33,45 +33,47 @@ */ package net.sourceforge.plantuml.core; +import net.sourceforge.plantuml.utils.StartUtils; + public enum DiagramType { UML, DITAA, DOT, PROJECT, JCCKIT, SALT, TURING, FLOW, CREOLE, JUNGLE, CUTE, UNKNOWN; static public DiagramType getTypeFromArobaseStart(String s) { s = s.toLowerCase(); -// if (s.startsWith("@startuml2")) { -// return UML2; -// } - if (s.startsWith("@startuml")) { + // if (s.startsWith("@startuml2")) { + // return UML2; + // } + if (StartUtils.startsWithSymbolAnd("startuml", s)) { return UML; } - if (s.startsWith("@startdot")) { + if (StartUtils.startsWithSymbolAnd("startdot", s)) { return DOT; } - if (s.startsWith("@startjcckit")) { + if (StartUtils.startsWithSymbolAnd("startjcckit", s)) { return JCCKIT; } - if (s.startsWith("@startditaa")) { + if (StartUtils.startsWithSymbolAnd("startditaa", s)) { return DITAA; } - if (s.startsWith("@startproject")) { + if (StartUtils.startsWithSymbolAnd("startproject", s)) { return PROJECT; } - if (s.startsWith("@startsalt")) { + if (StartUtils.startsWithSymbolAnd("startsalt", s)) { return SALT; } - if (s.startsWith("@startturing")) { + if (StartUtils.startsWithSymbolAnd("startturing", s)) { return TURING; } - if (s.startsWith("@startflow")) { + if (StartUtils.startsWithSymbolAnd("startflow", s)) { return FLOW; } - if (s.startsWith("@startcreole")) { + if (StartUtils.startsWithSymbolAnd("startcreole", s)) { return CREOLE; } - if (s.startsWith("@starttree")) { + if (StartUtils.startsWithSymbolAnd("starttree", s)) { return JUNGLE; } - if (s.startsWith("@startcute")) { + if (StartUtils.startsWithSymbolAnd("startcute", s)) { return CUTE; } return UNKNOWN; diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java b/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java index 933ec05d0..d36059f37 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java +++ b/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.cucadiagram; import net.sourceforge.plantuml.OptionFlags; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.svek.extremity.ExtremityFactory; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryArrow; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryArrowAndCircle; @@ -79,7 +80,7 @@ public enum LinkDecor { return arrowSize; } - public ExtremityFactory getExtremityFactory() { + public ExtremityFactory getExtremityFactory(HtmlColor backgroundColor) { if (this == LinkDecor.PLUS) { return new ExtremityFactoryPlus(); } else if (this == LinkDecor.ARROW_TRIANGLE) { @@ -91,9 +92,9 @@ public enum LinkDecor { } else if (this == LinkDecor.ARROW_AND_CIRCLE) { return new ExtremityFactoryArrowAndCircle(); } else if (this == LinkDecor.AGREGATION) { - return new ExtremityFactoryDiamond(false); + return new ExtremityFactoryDiamond(false, backgroundColor); } else if (this == LinkDecor.COMPOSITION) { - return new ExtremityFactoryDiamond(true); + return new ExtremityFactoryDiamond(true, backgroundColor); } else if (this == LinkDecor.CIRCLE) { return new ExtremityFactoryCircle(); } else if (this == LinkDecor.SQUARRE) { diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java index 8ad2fe615..2e0b8460e 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19398 $ + * Revision $Revision: 19931 $ * */ package net.sourceforge.plantuml.cucadiagram.dot; @@ -44,9 +44,12 @@ import java.util.regex.Pattern; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.vizjs.GraphvizJs; +import net.sourceforge.plantuml.vizjs.VizJsEngine; public class GraphvizUtils { + // private static final String VIZJS = "vizjs"; private static int DOT_VERSION_LIMIT = 226; private static boolean isWindows() { @@ -64,6 +67,9 @@ public class GraphvizUtils { } public static Graphviz create(ISkinParam skinParam, String dotString, String... type) { + if (VizJsEngine.isOk()) { + return new GraphvizJs(dotString); + } final AbstractGraphviz result; if (isWindows()) { result = new GraphvizWindows(skinParam, dotString, type); @@ -157,7 +163,24 @@ public class GraphvizUtils { red = ""; bold = ""; } + final List result = new ArrayList(); + if (VizJsEngine.isOk()) { + result.add("VizJs library is used!"); + try { + final String err = getTestCreateSimpleFile(); + if (err == null) { + result.add(bold + "Installation seems OK. File generation OK"); + } else { + result.add(red + err); + } + } catch (Exception e) { + result.add(red + e.toString()); + e.printStackTrace(); + } + return Collections.unmodifiableList(result); + } + final String ent = GraphvizUtils.getenvGraphvizDot(); if (ent == null) { result.add("The environment variable GRAPHVIZ_DOT has not been set"); diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersion.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersion.java index 937c9bb72..02c569fdd 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersion.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersion.java @@ -38,6 +38,10 @@ public interface GraphvizVersion { public boolean useProtectionWhenThereALinkFromOrToGroup(); + public boolean modeSafe(); + + public boolean isVizjs(); + // COMMON, V2_34_0 } diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersionFinder.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersionFinder.java index 3e4084dce..90b9560b3 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersionFinder.java +++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizVersionFinder.java @@ -42,7 +42,7 @@ import net.sourceforge.plantuml.StringUtils; public class GraphvizVersionFinder { final private File dotExe; - final private static GraphvizVersion DEFAULT = new GraphvizVersion() { + final public static GraphvizVersion DEFAULT = new GraphvizVersion() { public boolean useShield() { return true; } @@ -50,6 +50,14 @@ public class GraphvizVersionFinder { public boolean useProtectionWhenThereALinkFromOrToGroup() { return true; } + + public boolean modeSafe() { + return false; + } + + public boolean isVizjs() { + return false; + } }; public GraphvizVersionFinder(File dotExe) { @@ -76,6 +84,14 @@ public class GraphvizVersionFinder { return true; } + public boolean modeSafe() { + return false; + } + + public boolean isVizjs() { + return false; + } + }; } diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index 3f5aedbf3..fe07280bc 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemDonors extends AbstractPSystem { - public static final String DONORS = "UDfTKyjosp0ClEChUDQa7w7OhLlPJZ9Msixa1bk8H9icL99oAtrRR_snGcvbKkP96Bns5wlSPFyVENYXG4xbDh3LU81NokBZCsmuXiv3FhNY7bOkfgY7alReWqQhdhYnaDkAdLenXO76p_TtgPZAqS86aqKsm59FWJQGnz5yWRAB47fOwMp-B4CneUmyb87QXgnQCBV2Rpdj8G_hyrqhErYmqLRjkFC4HNUNpuuiHAQWrR1DKECv3MLLRkWNsahaN3HQfjReUc6wkz6sDJobwCC0pqPVf66f3oT1Vije2n_zRRHDG6HqWULmri7rQeCDLmZ5AFfRWp8-gSl8n7F9E_KYayKWTO9FS1N_mDDfnifMi_3QgMMGaRPd5_G0dsEwOjZgGqD6FQ8sVSh032aOx--X5OJsGu677nrvjUps3kMq9jB_niT0XqQj7NgCa6eInoO7_3aQJKhKcYywzStLELyZVusmIxmyhfZnF4ftcxYCJwDGZ-pGecaVr1i5vDR3JlYYgzHQZvU6JuRTAF_spszZhXw8_Z29LyLTcvkx74xYZoPevenyOfXHg1USlBFJC_YvqQf4hEI_SZMfxsHhSWzgcxz-AVFe-umjh2XLvIzt3mXu"; + public static final String DONORS = "UDfTayzosZ0Gnk_x53fxaeTmS4fh8Cb0cixajjWRB11QLv99pRFrrXVhcjP8HYVlQFzyt-hdt6J_3pbueK1EvJQmrLZ1AsNny16M74Fd8HzBSGjp5w-eXmrjqGUDLZrnOo6tDJirPmfd6Zu_FYHZJ4SBIqm6sG257WDj88-j-GIRBaheOQwpwR4CvQYoyx09r3ParOov5N_5E8SyB8utfUnWnaPRjURE4vJTpNssPp4o1gs6LQ8QZsaeet93lz3MiivPewNh3bqlJjTNstO7JwdwS8PdeqzIKEZg8CglDzh2ex-sjec8Z4vGd8ywk5ujiU4QeHoM_jwWj4_oCZBnkUGSUbcJnI1veazqbV_4qs7YojQJy5AffP6HicSNz1c-nkkQOQMhXenwG6twr84vfsAylvLM4jhx4gkV7NbLT5k7yhGcsd_ZVQ2gKGk77gEa7GcnoGD-3g19YbhmIQVSNCZv7lrhX7N2yZ1YudClrMr26H-6HJsmGukclLFl591R3slnYwvM2psyD7mnx8Rrh_xyDkR2GEJ39AmANSihNGx7vGyGD5D7FW5cMDGBZkoizKH-RhJQ8DRoNxaTgHzaT-Jkr2f__RR98_SPMvZJv7zAzs0huUUetiH38KJ_1SHA3uG0"; public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final GraphicStrings result = getGraphicStrings(); diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java index b52e5a9d3..23caf2291 100644 --- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java +++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java @@ -183,6 +183,7 @@ public class QuoteUtils { "You know that thing you just did? Don't do that" // Well I never, was there ever, A cat so clever, as magical Mr Mistoffelees // Do you like your morning tea weak or strong ? + // It took me a long time to understand that if you want to do this job well you have to stay detached. ); private QuoteUtils() { diff --git a/src/net/sourceforge/plantuml/real/RealLine.java b/src/net/sourceforge/plantuml/real/RealLine.java index 361411c6f..3561a2d24 100644 --- a/src/net/sourceforge/plantuml/real/RealLine.java +++ b/src/net/sourceforge/plantuml/real/RealLine.java @@ -115,6 +115,9 @@ class RealLine { } private void printCounter(Map counter) { + for (PositiveForce f : forces) { + System.err.println("force=" + f); + } for (Map.Entry ent : counter.entrySet()) { System.err.println("count=" + ent.getValue() + " for " + ent.getKey()); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/ParticipantType.java b/src/net/sourceforge/plantuml/sequencediagram/ParticipantType.java index 12e61a6e6..69da78ec0 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/ParticipantType.java +++ b/src/net/sourceforge/plantuml/sequencediagram/ParticipantType.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19978 $ * */ package net.sourceforge.plantuml.sequencediagram; @@ -41,7 +41,8 @@ public enum ParticipantType { BOUNDARY(ColorParam.boundaryBackground), // CONTROL(ColorParam.controlBackground), // ENTITY(ColorParam.entityBackground), // - DATABASE(ColorParam.databaseBackground); + DATABASE(ColorParam.databaseBackground), // + COLLECTIONS(ColorParam.collectionsBackground); private final ColorParam background; diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java index 7fc278255..6e6113641 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java @@ -62,8 +62,8 @@ public abstract class CommandParticipant extends SingleLineCommand2 all = notes.asList(); for (int i = 0; i < all.size() - 1; i++) { for (int j = i + 1; j < all.size(); j++) { - final Real point1 = getX2(stringBounder, all.get(i)); - final Real point2 = getX(stringBounder, all.get(j)); - point2.ensureBiggerThan(point1); + final double center1 = getXcenter(stringBounder, all.get(i)).getCurrentValue(); + final double center2 = getXcenter(stringBounder, all.get(j)).getCurrentValue(); + if (center2 > center1) { + final Real point1b = getX2(stringBounder, all.get(i)); + final Real point2 = getX(stringBounder, all.get(j)); + point2.ensureBiggerThan(point1b); + } else { + final Real point1 = getX(stringBounder, all.get(i)); + final Real point2b = getX2(stringBounder, all.get(j)); + point1.ensureBiggerThan(point2b); + } } } } diff --git a/src/net/sourceforge/plantuml/skin/AbstractComponent.java b/src/net/sourceforge/plantuml/skin/AbstractComponent.java index 550ba48ac..15fa8cca6 100644 --- a/src/net/sourceforge/plantuml/skin/AbstractComponent.java +++ b/src/net/sourceforge/plantuml/skin/AbstractComponent.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19945 $ * */ package net.sourceforge.plantuml.skin; @@ -45,22 +45,22 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public abstract class AbstractComponent implements Component { - final protected void stroke(Graphics2D g2d, float dash, float thickness) { - final float[] style = { dash, dash }; - g2d.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, style, 0)); - } - - final protected UGraphic stroke(UGraphic ug, double dashVisible, double dashSpace, double thickness) { - return ug.apply(new UStroke(dashVisible, dashSpace, thickness)); - } - - final protected void stroke(Graphics2D g2d, float dash) { - stroke(g2d, dash, 1); - } - - final protected UGraphic stroke(UGraphic ug, double dashVisible, double dashSpace) { - return stroke(ug, dashVisible, dashSpace, 1); - } +// final protected void stroke(Graphics2D g2d, float dash, float thickness) { +// final float[] style = { dash, dash }; +// g2d.setStroke(new BasicStroke(thickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, style, 0)); +// } +// +// final protected UGraphic stroke(UGraphic ug, double dashVisible, double dashSpace, double thickness) { +// return ug.apply(new UStroke(dashVisible, dashSpace, thickness)); +// } +// +// final protected void stroke(Graphics2D g2d, float dash) { +// stroke(g2d, dash, 1); +// } +// +// final protected UGraphic stroke(UGraphic ug, double dashVisible, double dashSpace) { +// return stroke(ug, dashVisible, dashSpace, 1); +// } abstract protected void drawInternalU(UGraphic ug, Area area); diff --git a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java index b6c702f9c..d71facc8c 100644 --- a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java +++ b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19885 $ + * Revision $Revision: 19971 $ * */ package net.sourceforge.plantuml.skin; @@ -93,7 +93,7 @@ public abstract class AbstractTextualComponent extends AbstractComponent { return textBlock; } - final protected double getPureTextWidth(StringBounder stringBounder) { + protected double getPureTextWidth(StringBounder stringBounder) { final TextBlock textBlock = getTextBlock(); final Dimension2D size = textBlock.calculateDimension(stringBounder); return size.getWidth(); diff --git a/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java b/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java index e3c06fe05..039dd36c4 100644 --- a/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java +++ b/src/net/sourceforge/plantuml/skin/ArrowConfiguration.java @@ -34,6 +34,8 @@ package net.sourceforge.plantuml.skin; import net.sourceforge.plantuml.graphic.HtmlColor; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UStroke; public class ArrowConfiguration { @@ -48,12 +50,14 @@ public class ArrowConfiguration { private final HtmlColor color; private final boolean isSelf; + private final double thickness; private ArrowConfiguration(ArrowBody body, ArrowDressing dressing1, ArrowDressing dressing2, - ArrowDecoration decoration1, ArrowDecoration decoration2, HtmlColor color, boolean isSelf) { + ArrowDecoration decoration1, ArrowDecoration decoration2, HtmlColor color, boolean isSelf, double thickness) { if (body == null || dressing1 == null || dressing2 == null) { throw new IllegalArgumentException(); } + this.thickness = thickness; this.body = body; this.dressing1 = dressing1; this.dressing2 = dressing2; @@ -75,19 +79,19 @@ public class ArrowConfiguration { public static ArrowConfiguration withDirectionNormal() { return new ArrowConfiguration(ArrowBody.NORMAL, ArrowDressing.create(), ArrowDressing.create().withHead( - ArrowHead.NORMAL), ArrowDecoration.NONE, ArrowDecoration.NONE, null, false); + ArrowHead.NORMAL), ArrowDecoration.NONE, ArrowDecoration.NONE, null, false, 1); } public static ArrowConfiguration withDirectionBoth() { return new ArrowConfiguration(ArrowBody.NORMAL, ArrowDressing.create().withHead(ArrowHead.NORMAL), ArrowDressing.create().withHead(ArrowHead.NORMAL), ArrowDecoration.NONE, ArrowDecoration.NONE, null, - false); + false, 1); } public static ArrowConfiguration withDirectionSelf() { return new ArrowConfiguration(ArrowBody.NORMAL, ArrowDressing.create().withHead(ArrowHead.NORMAL), ArrowDressing.create().withHead(ArrowHead.NORMAL), ArrowDecoration.NONE, ArrowDecoration.NONE, null, - true); + true, 1); } public static ArrowConfiguration withDirectionReverse() { @@ -95,21 +99,22 @@ public class ArrowConfiguration { } public ArrowConfiguration reverse() { - return new ArrowConfiguration(body, dressing2, dressing1, decoration2, decoration1, color, isSelf); + return new ArrowConfiguration(body, dressing2, dressing1, decoration2, decoration1, color, isSelf, thickness); } public ArrowConfiguration self() { - return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, true); + return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, true, thickness); } public ArrowConfiguration withBody(ArrowBody type) { - return new ArrowConfiguration(type, dressing1, dressing2, decoration1, decoration2, color, isSelf); + return new ArrowConfiguration(type, dressing1, dressing2, decoration1, decoration2, color, isSelf, thickness); } public ArrowConfiguration withHead(ArrowHead head) { final ArrowDressing newDressing1 = addHead(dressing1, head); final ArrowDressing newDressing2 = addHead(dressing2, head); - return new ArrowConfiguration(body, newDressing1, newDressing2, decoration1, decoration2, color, isSelf); + return new ArrowConfiguration(body, newDressing1, newDressing2, decoration1, decoration2, color, isSelf, + thickness); } private static ArrowDressing addHead(ArrowDressing dressing, ArrowHead head) { @@ -121,33 +126,33 @@ public class ArrowConfiguration { public ArrowConfiguration withHead1(ArrowHead head) { return new ArrowConfiguration(body, dressing1.withHead(head), dressing2, decoration1, decoration2, color, - isSelf); + isSelf, thickness); } public ArrowConfiguration withHead2(ArrowHead head) { return new ArrowConfiguration(body, dressing1, dressing2.withHead(head), decoration1, decoration2, color, - isSelf); + isSelf, thickness); } public ArrowConfiguration withPart(ArrowPart part) { if (dressing2.getHead() != ArrowHead.NONE) { return new ArrowConfiguration(body, dressing1, dressing2.withPart(part), decoration1, decoration2, color, - isSelf); + isSelf, thickness); } return new ArrowConfiguration(body, dressing1.withPart(part), dressing2, decoration1, decoration2, color, - isSelf); + isSelf, thickness); } public ArrowConfiguration withDecoration1(ArrowDecoration decoration1) { - return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf); + return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf, thickness); } public ArrowConfiguration withDecoration2(ArrowDecoration decoration2) { - return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf); + return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf, thickness); } public ArrowConfiguration withColor(HtmlColor color) { - return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf); + return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf, thickness); } public final ArrowDecoration getDecoration1() { @@ -213,4 +218,23 @@ public class ArrowConfiguration { return dressing2; } + public static UGraphic stroke(UGraphic ug, double dashVisible, double dashSpace, double thickness) { + return ug.apply(new UStroke(dashVisible, dashSpace, thickness)); + } + + public UGraphic applyStroke(UGraphic ug) { + if (isDotted()) { + return ug.apply(new UStroke(2, 2, thickness)); + } + return ug.apply(new UStroke(thickness)); + } + + public UGraphic applyThicknessOnly(UGraphic ug) { + return ug.apply(new UStroke(thickness)); + } + + public ArrowConfiguration withThickness(double thickness) { + return new ArrowConfiguration(body, dressing1, dressing2, decoration1, decoration2, color, isSelf, thickness); + } + } diff --git a/src/net/sourceforge/plantuml/skin/ComponentType.java b/src/net/sourceforge/plantuml/skin/ComponentType.java index 1a62cd713..ec5b3cde9 100644 --- a/src/net/sourceforge/plantuml/skin/ComponentType.java +++ b/src/net/sourceforge/plantuml/skin/ComponentType.java @@ -43,6 +43,7 @@ public enum ComponentType { CONTROL_HEAD, CONTROL_TAIL, ENTITY_HEAD, ENTITY_TAIL, DATABASE_HEAD, DATABASE_TAIL, + COLLECTIONS_HEAD, COLLECTIONS_TAIL, // ALIVE_BOX_CLOSE_CLOSE, ALIVE_BOX_CLOSE_OPEN, ALIVE_BOX_OPEN_CLOSE, ALIVE_BOX_OPEN_OPEN, diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java index b56b8600a..22c7b59f9 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19873 $ + * Revision $Revision: 19949 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -56,7 +56,8 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class ComponentBlueModernArrow extends AbstractComponentBlueModernArrow { - public ComponentBlueModernArrow(HtmlColor foregroundColor, boolean useUnderlineForHyperlink, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, + public ComponentBlueModernArrow(HtmlColor foregroundColor, boolean useUnderlineForHyperlink, + FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) { super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer); } @@ -76,7 +77,7 @@ public class ComponentBlueModernArrow extends AbstractComponentBlueModernArrow { final int x2 = (int) dimensionToUse.getWidth(); if (getArrowConfiguration().isDotted()) { - ug = stroke(ug, 5, 2); + ug = ArrowConfiguration.stroke(ug, 5, 2, 1); } else { ug = ug.apply(new UStroke(2)); } @@ -91,21 +92,21 @@ public class ComponentBlueModernArrow extends AbstractComponentBlueModernArrow { ug = ug.apply(new UStroke(1.5)); if (direction == 1) { if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) { - ug.apply(new UTranslate(x2 - getArrowDeltaX2(), textHeight - getArrowDeltaY2())).draw(new ULine(getArrowDeltaX2(), - getArrowDeltaY2())); + ug.apply(new UTranslate(x2 - getArrowDeltaX2(), textHeight - getArrowDeltaY2())).draw( + new ULine(getArrowDeltaX2(), getArrowDeltaY2())); } if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) { - ug.apply(new UTranslate(x2 - getArrowDeltaX2(), textHeight + getArrowDeltaY2())).draw(new ULine(getArrowDeltaX2(), - -getArrowDeltaY2())); + ug.apply(new UTranslate(x2 - getArrowDeltaX2(), textHeight + getArrowDeltaY2())).draw( + new ULine(getArrowDeltaX2(), -getArrowDeltaY2())); } } else { if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) { - ug.apply(new UTranslate(getArrowDeltaX2(), textHeight - getArrowDeltaY2())).draw(new ULine(-getArrowDeltaX2(), - getArrowDeltaY2())); + ug.apply(new UTranslate(getArrowDeltaX2(), textHeight - getArrowDeltaY2())).draw( + new ULine(-getArrowDeltaX2(), getArrowDeltaY2())); } if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) { - ug.apply(new UTranslate(getArrowDeltaX2(), textHeight + getArrowDeltaY2())).draw(new ULine(-getArrowDeltaX2(), - -getArrowDeltaY2())); + ug.apply(new UTranslate(getArrowDeltaX2(), textHeight + getArrowDeltaY2())).draw( + new ULine(-getArrowDeltaX2(), -getArrowDeltaY2())); } } ug = ug.apply(new UStroke()); diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDelayLine.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDelayLine.java index c9e4f85bd..bc8eef8f3 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDelayLine.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernDelayLine.java @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.ugraphic.UAntiAliasing; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; @@ -58,7 +59,7 @@ public class ComponentBlueModernDelayLine extends AbstractComponent { protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); ug = ug.apply(new UChangeColor(color)); - ug = stroke(ug, 1, 4); + ug = ArrowConfiguration.stroke(ug, 1, 4, 1); final int x = (int) (dimensionToUse.getWidth() / 2); ug.apply(new UChangeBackColor(color)).apply(UAntiAliasing.ANTI_ALIASING_OFF).apply(new UTranslate(x + 1, 0)).draw(new ULine(0, dimensionToUse.getHeight())); } diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernNewpage.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernNewpage.java index cce1dcd64..eb104faa3 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernNewpage.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernNewpage.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19946 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; @@ -54,7 +55,7 @@ public class ComponentBlueModernNewpage extends AbstractComponent { @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = stroke(ug, 10, 2); + ug = ArrowConfiguration.stroke(ug, 10, 2, 1); ug.apply(new UChangeColor(foregroundColor)).draw(new ULine(dimensionToUse.getWidth(), 0)); } diff --git a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java index 0bc290e21..618ab6064 100644 --- a/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java +++ b/src/net/sourceforge/plantuml/skin/bluemodern/ComponentBlueModernSelfArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19873 $ + * Revision $Revision: 19949 $ * */ package net.sourceforge.plantuml.skin.bluemodern; @@ -56,7 +56,8 @@ public class ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr private final double arrowWidth = 45; - public ComponentBlueModernSelfArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) { + public ComponentBlueModernSelfArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, + ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer) { super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer); } @@ -72,7 +73,7 @@ public class ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr final double x2 = arrowWidth - 3; if (getArrowConfiguration().isDotted()) { - ug = stroke(ug, 5, 2); + ug = ArrowConfiguration.stroke(ug, 5, 2, 1); } else { ug = ug.apply(new UStroke(2)); } @@ -90,10 +91,14 @@ public class ComponentBlueModernSelfArrow extends AbstractComponentBlueModernArr if (getArrowConfiguration().isAsync()) { if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) { - ug.apply(new UStroke(1.5)).apply(new UTranslate(getArrowDeltaX2(), textHeight - getArrowDeltaY2() + delta)).draw(new ULine(-getArrowDeltaX2(), getArrowDeltaY2())); + ug.apply(new UStroke(1.5)) + .apply(new UTranslate(getArrowDeltaX2(), textHeight - getArrowDeltaY2() + delta)) + .draw(new ULine(-getArrowDeltaX2(), getArrowDeltaY2())); } if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) { - ug.apply(new UStroke(1.5)).apply(new UTranslate(getArrowDeltaX2(), textHeight + getArrowDeltaY2() + delta)).draw(new ULine(-getArrowDeltaX2(), -getArrowDeltaY2())); + ug.apply(new UStroke(1.5)) + .apply(new UTranslate(getArrowDeltaX2(), textHeight + getArrowDeltaY2() + delta)) + .draw(new ULine(-getArrowDeltaX2(), -getArrowDeltaY2())); } } else { final UPolygon polygon = getPolygon(textHeight, delta); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java index a97cd7631..f17700bed 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java @@ -63,9 +63,11 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { private final HorizontalAlignment messagePosition; private final boolean niceArrow; - public ComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer, + public ComponentRoseArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, + ArrowConfiguration arrowConfiguration, HorizontalAlignment messagePosition, ISkinSimple spriteContainer, HorizontalAlignment textHorizontalAlignment, double maxMessageSize, boolean niceArrow) { - super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, textHorizontalAlignment, maxMessageSize); + super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, textHorizontalAlignment, + maxMessageSize); this.messagePosition = messagePosition; this.niceArrow = niceArrow; } @@ -129,13 +131,7 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { len -= 2 * spaceCrossX; } - if (getArrowConfiguration().isDotted()) { - ug = stroke(ug, 2, 2); - } - ug.apply(new UTranslate(start, textHeight)).draw(new ULine(len, 0)); - if (getArrowConfiguration().isDotted()) { - ug = ug.apply(new UStroke()); - } + getArrowConfiguration().applyStroke(ug).apply(new UTranslate(start, textHeight)).draw(new ULine(len, 0)); final ArrowDirection direction2 = getDirection2(); final double textPos; @@ -169,10 +165,10 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { if (dressing.getHead() == ArrowHead.ASYNC) { if (dressing.getPart() != ArrowPart.BOTTOM_PART) { - ug.apply(new UTranslate(x - 1, textHeight)).draw(new ULine(getArrowDeltaX(), -getArrowDeltaY())); + getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, textHeight)).draw(new ULine(getArrowDeltaX(), -getArrowDeltaY())); } if (dressing.getPart() != ArrowPart.TOP_PART) { - ug.apply(new UTranslate(x - 1, textHeight)).draw(new ULine(getArrowDeltaX(), getArrowDeltaY())); + getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x - 1, textHeight)).draw(new ULine(getArrowDeltaX(), getArrowDeltaY())); } } else if (dressing.getHead() == ArrowHead.CROSSX) { ug = ug.apply(new UStroke(2)); @@ -202,10 +198,10 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow { if (dressing.getHead() == ArrowHead.ASYNC) { if (dressing.getPart() != ArrowPart.BOTTOM_PART) { - ug.apply(new UTranslate(x, textHeight)).draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY())); + getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, textHeight)).draw(new ULine(-getArrowDeltaX(), -getArrowDeltaY())); } if (dressing.getPart() != ArrowPart.TOP_PART) { - ug.apply(new UTranslate(x, textHeight)).draw(new ULine(-getArrowDeltaX(), getArrowDeltaY())); + getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x, textHeight)).draw(new ULine(-getArrowDeltaX(), getArrowDeltaY())); } } else if (dressing.getHead() == ArrowHead.CROSSX) { ug = ug.apply(new UStroke(2)); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java index f4a66ed0c..c02f51a21 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseDelayLine.java @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.ugraphic.UAntiAliasing; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -56,7 +57,7 @@ public class ComponentRoseDelayLine extends AbstractComponent { @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = stroke(ug, 1, 4).apply(new UChangeColor(color)); + ug = ArrowConfiguration.stroke(ug, 1, 4, 1).apply(new UChangeColor(color)); final int x = (int) (dimensionToUse.getWidth() / 2); ug.apply(UAntiAliasing.ANTI_ALIASING_OFF).apply(new UTranslate(x, 0)).draw(new ULine(0, dimensionToUse.getHeight())); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java index e6286eb0f..ac26096fd 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingElse.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19946 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -42,6 +42,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -76,7 +77,7 @@ public class ComponentRoseGroupingElse extends AbstractTextualComponent { @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = stroke(ug, 2, 2).apply(new UChangeColor(groupBorder)); + ug = ArrowConfiguration.stroke(ug, 2, 2, 1).apply(new UChangeColor(groupBorder)); ug.apply(new UTranslate(0, 1)).draw(new ULine(dimensionToUse.getWidth(), 0)); ug = ug.apply(new UStroke()); getTextBlock().drawU(ug.apply(new UTranslate(getMarginX1(), getMarginY()))); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java index d84a16535..5e71e3a82 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseLine.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19945 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; @@ -64,7 +65,7 @@ public class ComponentRoseLine extends AbstractComponent { if (continueLine) { ug = ug.apply(new UStroke()); } else { - ug = stroke(ug, 5, 5, stroke.getThickness()); + ug = ArrowConfiguration.stroke(ug, 5, 5, stroke.getThickness()); } final int x = (int) (dimensionToUse.getWidth() / 2); ug.apply(new UTranslate(x, 0)).draw(new ULine(0, dimensionToUse.getHeight())); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java index 8135228a5..2ec2e75f0 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseNewpage.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19946 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -39,6 +39,7 @@ import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.skin.AbstractComponent; import net.sourceforge.plantuml.skin.Area; +import net.sourceforge.plantuml.skin.ArrowConfiguration; import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.ULine; @@ -54,7 +55,7 @@ public class ComponentRoseNewpage extends AbstractComponent { @Override protected void drawInternalU(UGraphic ug, Area area) { final Dimension2D dimensionToUse = area.getDimensionToUse(); - ug = stroke(ug, 2, 2).apply(new UChangeColor(foregroundColor)); + ug = ArrowConfiguration.stroke(ug, 2, 2, 1).apply(new UChangeColor(foregroundColor)); ug.draw(new ULine(dimensionToUse.getWidth(), 0)); } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java index 57600f52f..21ce03a20 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseParticipant.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19109 $ + * Revision $Revision: 19978 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -58,12 +58,16 @@ public class ComponentRoseParticipant extends AbstractTextualComponent { private final double deltaShadow; private final double roundCorner; private final UStroke stroke; + private final double minWidth; + private final boolean collections; public ComponentRoseParticipant(SymbolContext biColor, FontConfiguration font, Display stringsToDisplay, - ISkinSimple spriteContainer, double roundCorner, UFont fontForStereotype, - HtmlColor htmlColorForStereotype) { + ISkinSimple spriteContainer, double roundCorner, UFont fontForStereotype, HtmlColor htmlColorForStereotype, + double minWidth, boolean collections) { super(stringsToDisplay, font, HorizontalAlignment.CENTER, 7, 7, 7, spriteContainer, 0, false, fontForStereotype, htmlColorForStereotype); + this.minWidth = minWidth; + this.collections = collections; this.back = biColor.getBackColor(); this.roundCorner = roundCorner; this.deltaShadow = biColor.getDeltaShadow(); @@ -79,19 +83,40 @@ public class ComponentRoseParticipant extends AbstractTextualComponent { final URectangle rect = new URectangle(getTextWidth(stringBounder), getTextHeight(stringBounder), roundCorner, roundCorner); rect.setDeltaShadow(deltaShadow); + if (collections) { + ug.apply(new UTranslate(getDeltaCollection(), 0)).draw(rect); + ug = ug.apply(new UTranslate(0, getDeltaCollection())); + } ug.draw(rect); ug = ug.apply(new UStroke()); final TextBlock textBlock = getTextBlock(); - textBlock.drawU(ug.apply(new UTranslate(getMarginX1(), getMarginY()))); + textBlock.drawU(ug.apply(new UTranslate(getMarginX1() + suppWidth(stringBounder) / 2, getMarginY()))); + } + + private double getDeltaCollection() { + if (collections) { + return 4; + } + return 0; } @Override public double getPreferredHeight(StringBounder stringBounder) { - return getTextHeight(stringBounder) + deltaShadow + 1; + return getTextHeight(stringBounder) + deltaShadow + 1 + getDeltaCollection(); } @Override public double getPreferredWidth(StringBounder stringBounder) { - return getTextWidth(stringBounder) + deltaShadow; + return getTextWidth(stringBounder) + deltaShadow + getDeltaCollection(); } + + @Override + protected double getPureTextWidth(StringBounder stringBounder) { + return Math.max(super.getPureTextWidth(stringBounder), minWidth); + } + + private final double suppWidth(StringBounder stringBounder) { + return getPureTextWidth(stringBounder) - super.getPureTextWidth(stringBounder); + } + } diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java index c14968a35..3bb23380d 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19873 $ + * Revision $Revision: 19972 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -62,8 +62,7 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { private final boolean niceArrow; public ComponentRoseSelfArrow(HtmlColor foregroundColor, FontConfiguration font, Display stringsToDisplay, - ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, double maxMessageSize, - boolean niceArrow) { + ArrowConfiguration arrowConfiguration, ISkinSimple spriteContainer, double maxMessageSize, boolean niceArrow) { super(foregroundColor, font, stringsToDisplay, arrowConfiguration, spriteContainer, HorizontalAlignment.LEFT, maxMessageSize); this.niceArrow = niceArrow; @@ -80,9 +79,7 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { ug = ug.apply(new UChangeColor(getForegroundColor())); final double xRight = arrowWidth - 3; - if (getArrowConfiguration().isDotted()) { - ug = stroke(ug, 2, 2); - } + final UGraphic ug2 = getArrowConfiguration().applyStroke(ug); double x1 = area.getDeltaX1() < 0 ? area.getDeltaX1() : 0; double x2 = area.getDeltaX1() > 0 ? -area.getDeltaX1() : 0 + 1; @@ -90,7 +87,7 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { final double textAndArrowHeight = textHeight + getArrowOnlyHeight(stringBounder); final UEllipse circle = new UEllipse(ComponentRoseArrow.diamCircle, ComponentRoseArrow.diamCircle); if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE) { - ug.apply(new UStroke(ComponentRoseArrow.thinCircle)) + ug2.apply(new UStroke(ComponentRoseArrow.thinCircle)) .apply(new UChangeColor(getForegroundColor())) .apply(new UTranslate(x1 + 1 - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle, textHeight - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle / 2)) @@ -98,7 +95,7 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { x1 += ComponentRoseArrow.diamCircle / 2; } if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE) { - ug.apply(new UStroke(ComponentRoseArrow.thinCircle)) + ug2.apply(new UStroke(ComponentRoseArrow.thinCircle)) .apply(new UChangeColor(getForegroundColor())) .apply(new UTranslate(x2 - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle, textAndArrowHeight - ComponentRoseArrow.diamCircle / 2 - ComponentRoseArrow.thinCircle / 2)) @@ -111,20 +108,18 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow { } final double arrowHeight = textAndArrowHeight - textHeight; - ug.apply(new UTranslate(x1, textHeight)).draw(new ULine(xRight - x1, 0)); - ug.apply(new UTranslate(xRight, textHeight)).draw(new ULine(0, arrowHeight)); - ug.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(xRight - x2, 0)); - - if (getArrowConfiguration().isDotted()) { - ug = ug.apply(new UStroke()); - } + ug2.apply(new UTranslate(x1, textHeight)).draw(new ULine(xRight - x1, 0)); + ug2.apply(new UTranslate(xRight, textHeight)).draw(new ULine(0, arrowHeight)); + ug2.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(xRight - x2, 0)); if (getArrowConfiguration().isAsync()) { if (getArrowConfiguration().getPart() != ArrowPart.BOTTOM_PART) { - ug.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(getArrowDeltaX(), -getArrowDeltaY())); + getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x2, textAndArrowHeight)) + .draw(new ULine(getArrowDeltaX(), -getArrowDeltaY())); } if (getArrowConfiguration().getPart() != ArrowPart.TOP_PART) { - ug.apply(new UTranslate(x2, textAndArrowHeight)).draw(new ULine(getArrowDeltaX(), getArrowDeltaY())); + getArrowConfiguration().applyThicknessOnly(ug).apply(new UTranslate(x2, textAndArrowHeight)) + .draw(new ULine(getArrowDeltaX(), getArrowDeltaY())); } } else if (hasFinalCrossX) { ug = ug.apply(new UStroke(2)); diff --git a/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/net/sourceforge/plantuml/skin/rose/Rose.java index ee66c7e22..cfde4fdfc 100644 --- a/src/net/sourceforge/plantuml/skin/rose/Rose.java +++ b/src/net/sourceforge/plantuml/skin/rose/Rose.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19510 $ + * Revision $Revision: 19978 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -110,12 +110,22 @@ public class Rose implements Skin { if (type == ComponentType.PARTICIPANT_HEAD) { return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner(), newFontForStereotype, - getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false); } if (type == ComponentType.PARTICIPANT_TAIL) { return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner(), newFontForStereotype, - getFontColor(param, FontParam.SEQUENCE_STEREOTYPE)); + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), false); + } + if (type == ComponentType.COLLECTIONS_HEAD) { + return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, + FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner(), newFontForStereotype, + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true); + } + if (type == ComponentType.COLLECTIONS_TAIL) { + return new ComponentRoseParticipant(getSymbolContext(param, ColorParam.participantBorder), getUFont2(param, + FontParam.PARTICIPANT), stringsToDisplay, param, param.getRoundCorner(), newFontForStereotype, + getFontColor(param, FontParam.SEQUENCE_STEREOTYPE), param.minClassWidth(), true); } if (type == ComponentType.PARTICIPANT_LINE) { final HtmlColor borderColor = getHtmlColor(param, ColorParam.sequenceLifeLineBorder); diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java index d1f25a834..c6498f5b2 100644 --- a/src/net/sourceforge/plantuml/svek/Cluster.java +++ b/src/net/sourceforge/plantuml/svek/Cluster.java @@ -693,6 +693,10 @@ public class Cluster implements Moveable { protection0 = false; protection1 = false; } +// if (graphvizVersion.modeSafe()) { +// protection0 = false; +// protection1 = false; +// } if (protection0) { subgraphCluster(sb, "p0"); } diff --git a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java index cabb05389..64566391b 100644 --- a/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java +++ b/src/net/sourceforge/plantuml/svek/CucaDiagramFileMakerSvek2.java @@ -178,8 +178,7 @@ public final class CucaDiagramFileMakerSvek2 { final FontConfiguration labelFont = new FontConfiguration(skinParam, FontParam.GENERIC_ARROW, null); final Line line = new Line(shapeUid1, shapeUid2, link, colorSequence, ltail, lhead, skinParam, - stringBounder, labelFont, getBibliotekon(), dotStringFactory.getGraphvizVersion(), - dotData.getPragma()); + stringBounder, labelFont, getBibliotekon(), dotData.getPragma()); getBibliotekon().addLine(line); diff --git a/src/net/sourceforge/plantuml/svek/DotStringFactory.java b/src/net/sourceforge/plantuml/svek/DotStringFactory.java index 665cc2798..dfa695b46 100644 --- a/src/net/sourceforge/plantuml/svek/DotStringFactory.java +++ b/src/net/sourceforge/plantuml/svek/DotStringFactory.java @@ -61,6 +61,8 @@ import net.sourceforge.plantuml.cucadiagram.dot.ProcessState; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.posimo.Moveable; +import net.sourceforge.plantuml.vizjs.GraphvizJs; +import net.sourceforge.plantuml.vizjs.GraphvizJsRuntimeException; public class DotStringFactory implements Moveable { @@ -202,14 +204,14 @@ public class DotStringFactory implements Moveable { root.printCluster1(sb, bibliotekon.allLines()); for (Line line : bibliotekon.lines0()) { - line.appendLine(sb); + line.appendLine(getGraphvizVersion(), sb); } root.fillRankMin(rankMin); root.printCluster2(sb, bibliotekon.allLines(), stringBounder, dotMode, getGraphvizVersion(), umlDiagramType); printMinRanking(sb); for (Line line : bibliotekon.lines1()) { - line.appendLine(sb); + line.appendLine(getGraphvizVersion(), sb); } SvekUtils.println(sb); sb.append("}"); @@ -268,26 +270,51 @@ public class DotStringFactory implements Moveable { return 35; } + private GraphvizVersion graphvizVersion; + public GraphvizVersion getGraphvizVersion() { + if (graphvizVersion == null) { + graphvizVersion = getGraphvizVersionInternal(); + } + return graphvizVersion; + } + + private GraphvizVersion getGraphvizVersionInternal() { final Graphviz graphviz = GraphvizUtils.create(skinParam, "foo;", "svg"); + if (graphviz instanceof GraphvizJs) { + return GraphvizJs.getGraphvizVersion(false); + } final File f = graphviz.getDotExe(); return GraphvizVersions.getInstance().getVersion(f); } - public String getSvg(BaseFile basefile, String[] dotStrings) throws IOException { - final String dotString = createDotString(dotStrings); + public String getSvg(BaseFile basefile, String[] dotOptions) throws IOException { + String dotString = createDotString(dotOptions); if (basefile != null) { final File f = basefile.getTraceFile("svek.dot"); SvekUtils.traceString(f, dotString); } - final Graphviz graphviz = GraphvizUtils.create(skinParam, dotString, "svg"); - final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - final ProcessState state = graphviz.createFile3(baos); - baos.close(); - if (state.differs(ProcessState.TERMINATED_OK())) { - throw new IllegalStateException("Timeout4 " + state, state.getCause()); + Graphviz graphviz = GraphvizUtils.create(skinParam, dotString, "svg"); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + final ProcessState state = graphviz.createFile3(baos); + baos.close(); + if (state.differs(ProcessState.TERMINATED_OK())) { + throw new IllegalStateException("Timeout4 " + state, state.getCause()); + } + } catch (GraphvizJsRuntimeException e) { + System.err.println("GraphvizJsRuntimeException"); + graphvizVersion = GraphvizJs.getGraphvizVersion(true); + dotString = createDotString(dotOptions); + graphviz = GraphvizUtils.create(skinParam, dotString, "svg"); + baos = new ByteArrayOutputStream(); + final ProcessState state = graphviz.createFile3(baos); + baos.close(); + if (state.differs(ProcessState.TERMINATED_OK())) { + throw new IllegalStateException("Timeout4 " + state, state.getCause()); + } } final byte[] result = baos.toByteArray(); final String s = new String(result, "UTF-8"); @@ -302,6 +329,9 @@ public class DotStringFactory implements Moveable { public boolean illegalDotExe() { final Graphviz graphviz = GraphvizUtils.create(skinParam, "svg"); + if (graphviz instanceof GraphvizJs) { + return false; + } final File dotExe = graphviz.getDotExe(); return dotExe == null || dotExe.isFile() == false || dotExe.canRead() == false; } diff --git a/src/net/sourceforge/plantuml/svek/Line.java b/src/net/sourceforge/plantuml/svek/Line.java index ced84724d..2c146bc99 100644 --- a/src/net/sourceforge/plantuml/svek/Line.java +++ b/src/net/sourceforge/plantuml/svek/Line.java @@ -119,20 +119,9 @@ public class Line implements Moveable, Hideable { private boolean opale; private Cluster projectionCluster; - private final GraphvizVersion graphvizVersion; private final Pragma pragma; - - // private GraphvizVersion getGraphvizVersion() { - // if (pragma.isDefine("graphviz")==false) { - // return GraphvizVersion.COMMON; - // } - // final String value = pragma.getValue("graphviz"); - // if ("2.34".equals(value)) { - // return GraphvizVersion.V2_34_0; - // } - // return GraphvizVersion.COMMON; - // } + private final HtmlColor backgroundColor; @Override public String toString() { @@ -205,7 +194,7 @@ public class Line implements Moveable, Hideable { public Line(String startUid, String endUid, Link link, ColorSequence colorSequence, Cluster ltail, Cluster lhead, ISkinParam skinParam, StringBounder stringBounder, FontConfiguration labelFont, Bibliotekon bibliotekon, - GraphvizVersion graphvizVersion, Pragma pragma) { + Pragma pragma) { if (startUid == null || endUid == null || link == null) { throw new IllegalArgumentException(); } @@ -213,7 +202,7 @@ public class Line implements Moveable, Hideable { skinParam = link.getColors().mute(skinParam); labelFont = labelFont.mute(link.getColors()); } - this.graphvizVersion = graphvizVersion; + this.backgroundColor = skinParam.getBackgroundColor(); this.pragma = pragma; this.bibliotekon = bibliotekon; this.stringBounder = stringBounder; @@ -308,7 +297,7 @@ public class Line implements Moveable, Hideable { return link.getLinkArrow(); } - public void appendLine(StringBuilder sb) { + public void appendLine(GraphvizVersion graphvizVersion, StringBuilder sb) { // Log.println("inverted=" + isInverted()); // if (isInverted()) { // sb.append(endUid); @@ -332,14 +321,20 @@ public class Line implements Moveable, Hideable { // length = 2; // } if (pragma.horizontalLineBetweenDifferentPackageAllowed() || link.isInvis() || length != 1) { + // if (graphvizVersion.isJs() == false) { sb.append("minlen=" + (length - 1)); sb.append(","); + // } } sb.append("color=\"" + StringUtils.getAsHtml(lineColor) + "\""); if (labelText != null) { sb.append(","); - sb.append("label=<"); - appendTable(sb, labelText.calculateDimension(stringBounder), noteLabelColor); + if (graphvizVersion.modeSafe()) { + sb.append("xlabel=<"); + } else { + sb.append("label=<"); + } + appendTable(sb, labelText.calculateDimension(stringBounder), noteLabelColor, graphvizVersion); sb.append(">"); // sb.append(",labelfloat=true"); } @@ -347,14 +342,14 @@ public class Line implements Moveable, Hideable { if (startTailText != null) { sb.append(","); sb.append("taillabel=<"); - appendTable(sb, startTailText.calculateDimension(stringBounder), startTailColor); + appendTable(sb, startTailText.calculateDimension(stringBounder), startTailColor, graphvizVersion); sb.append(">"); // sb.append(",labelangle=0"); } if (endHeadText != null) { sb.append(","); sb.append("headlabel=<"); - appendTable(sb, endHeadText.calculateDimension(stringBounder), endHeadColor); + appendTable(sb, endHeadText.calculateDimension(stringBounder), endHeadColor, graphvizVersion); sb.append(">"); // sb.append(",labelangle=0"); } @@ -380,13 +375,14 @@ public class Line implements Moveable, Hideable { // if (graphvizVersion == GraphvizVersion.V2_34_0) { // return null; // } - if (pragma.horizontalLineBetweenDifferentPackageAllowed() == false && link.getLength() == 1) { + if (pragma.horizontalLineBetweenDifferentPackageAllowed() == false && link.getLength() == 1 + /* && graphvizVersion.isJs() == false */) { return "{rank=same; " + getStartUid() + "; " + getEndUid() + "}"; } return null; } - public static void appendTable(StringBuilder sb, Dimension2D dim, int col) { + public static void appendTable(StringBuilder sb, Dimension2D dim, int col, GraphvizVersion graphvizVersion) { final int w = (int) dim.getWidth(); final int h = (int) dim.getHeight(); appendTable(sb, w, h, col); @@ -423,7 +419,7 @@ public class Line implements Moveable, Hideable { private UDrawable getExtremity(LinkDecor decor, PointListIterator pointListIterator, Point2D center, double angle, Cluster cluster) { - final ExtremityFactory extremityFactory = decor.getExtremityFactory(); + final ExtremityFactory extremityFactory = decor.getExtremityFactory(backgroundColor); if (cluster != null) { if (extremityFactory != null) { diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java index 52fe57a05..b1dd329e9 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityDiamond.java @@ -35,6 +35,7 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UGraphic; @@ -45,15 +46,16 @@ class ExtremityDiamond extends Extremity { private UPolygon polygon = new UPolygon(); private final boolean fill; private final Point2D contact; - + private final HtmlColor backgroundColor; + @Override public Point2D somePoint() { return contact; } - - public ExtremityDiamond(Point2D p1, double angle, boolean fill) { + public ExtremityDiamond(Point2D p1, double angle, boolean fill, HtmlColor backgroundColor) { this.fill = fill; + this.backgroundColor = backgroundColor; this.contact = new Point2D.Double(p1.getX(), p1.getY()); angle = manageround(angle); polygon.addPoint(0, 0); @@ -71,7 +73,7 @@ class ExtremityDiamond extends Extremity { if (fill) { ug = ug.apply(new UChangeBackColor(ug.getParam().getColor())); } else { - ug = ug.apply(new UChangeBackColor(HtmlColorUtils.WHITE)); + ug = ug.apply(new UChangeBackColor(backgroundColor)); } ug.draw(polygon); } diff --git a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java index 497909f52..e131bf028 100644 --- a/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java +++ b/src/net/sourceforge/plantuml/svek/extremity/ExtremityFactoryDiamond.java @@ -35,25 +35,28 @@ package net.sourceforge.plantuml.svek.extremity; import java.awt.geom.Point2D; +import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.UDrawable; import net.sourceforge.plantuml.svek.AbstractExtremityFactory; public class ExtremityFactoryDiamond extends AbstractExtremityFactory implements ExtremityFactory { private final boolean fill; + private final HtmlColor backgroundColor; @Override public UDrawable createUDrawable(Point2D p0, double angle) { - return new ExtremityDiamond(p0, angle - Math.PI / 2, fill); + return new ExtremityDiamond(p0, angle - Math.PI / 2, fill, backgroundColor); } - public ExtremityFactoryDiamond(boolean fill) { + public ExtremityFactoryDiamond(boolean fill, HtmlColor backgroundColor) { this.fill = fill; + this.backgroundColor = backgroundColor; } public UDrawable createUDrawable(Point2D p0, Point2D p1, Point2D p2) { final double ortho = atan2(p0, p2); - return new ExtremityDiamond(p1, ortho, fill); + return new ExtremityDiamond(p1, ortho, fill, backgroundColor); } } diff --git a/src/net/sourceforge/plantuml/utils/StartUtils.java b/src/net/sourceforge/plantuml/utils/StartUtils.java index b9afdeaf0..115757360 100644 --- a/src/net/sourceforge/plantuml/utils/StartUtils.java +++ b/src/net/sourceforge/plantuml/utils/StartUtils.java @@ -38,19 +38,23 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; +import net.sourceforge.plantuml.core.DiagramType; public class StartUtils { - public static final String PAUSE_PATTERN = "(?i)((?:\\W|\\<[^<>]*\\>)*)@unpause"; - public static final String START_PATTERN = "(?i)((?:[^\\w~]|\\<[^<>]*\\>)*)@start"; + public static final Pattern2 patternFilename = MyPattern + .cmpile("^[@\\\\]start[^%s{}%g]+[%s{][%s%g]*([^%g]*?)[%s}%g]*$"); - public static boolean isArobaseStartDiagram(CharSequence s) { - return StringUtils.trinNoTrace(s).startsWith("@start"); - } + public static final String PAUSE_PATTERN = "(?i)((?:\\W|\\<[^<>]*\\>)*)[@\\\\]unpause"; + public static final String START_PATTERN = "(?i)((?:[^\\w~]|\\<[^<>]*\\>)*)[@\\\\]start"; public static String beforeStartUml(final CharSequence2 result) { boolean inside = false; for (int i = 0; i < result.length(); i++) { + final CharSequence2 tmp = result.subSequence(i, result.length()); + if (startsWithSymbolAnd("start", tmp)) { + return result.subSequence(0, i).toString(); + } final String single = result.subSequence(i, i + 1).toString(); if (inside) { if (single.equals(">")) { @@ -58,9 +62,6 @@ public class StartUtils { } continue; } - if (result.subSequence(i, result.length()).startsWith("@start")) { - return result.subSequence(0, i).toString(); - } if (single.equals("<")) { inside = true; } else if (single.matches("[\\w~]")) { @@ -75,19 +76,35 @@ public class StartUtils { // return null; } + public static boolean isArobaseStartDiagram(CharSequence s) { + final String s2 = StringUtils.trinNoTrace(s); + return DiagramType.getTypeFromArobaseStart(s2) != DiagramType.UNKNOWN; + } + + public static boolean startsWithSymbolAnd(String value, final CharSequence2 tmp) { + return tmp.startsWith("@" + value) || tmp.startsWith("\\" + value); + } + + public static boolean startsWithSymbolAnd(String value, final String tmp) { + return tmp.startsWith("@" + value) || tmp.startsWith("\\" + value); + } + public static boolean isArobaseEndDiagram(CharSequence s) { - return StringUtils.trinNoTrace(s).startsWith("@end"); + final String s2 = StringUtils.trinNoTrace(s); + return startsWithSymbolAnd("end", s2); } public static boolean isArobasePauseDiagram(CharSequence s) { - return StringUtils.trinNoTrace(s).startsWith("@pause"); + final String s2 = StringUtils.trinNoTrace(s); + return startsWithSymbolAnd("pause", s2); } public static boolean isArobaseUnpauseDiagram(CharSequence s) { - return StringUtils.trinNoTrace(s).startsWith("@unpause"); + final String s2 = StringUtils.trinNoTrace(s); + return startsWithSymbolAnd("unpause", s2); } - private static final Pattern2 append = MyPattern.cmpile("^\\W*@append"); + private static final Pattern2 append = MyPattern.cmpile("^\\W*[@\\\\]append"); public static CharSequence2 getPossibleAppend(CharSequence2 s) { final Matcher2 m = append.matcher(s); diff --git a/src/net/sourceforge/plantuml/version/PSystemVersion.java b/src/net/sourceforge/plantuml/version/PSystemVersion.java index f93d12eaf..fbcf29d94 100644 --- a/src/net/sourceforge/plantuml/version/PSystemVersion.java +++ b/src/net/sourceforge/plantuml/version/PSystemVersion.java @@ -169,6 +169,7 @@ public class PSystemVersion extends AbstractPSystem { strings.add("Original idea: Arnaud Roques"); strings.add("Word Macro: Alain Bertucat & Matthieu Sabatier"); strings.add("Word Add-in: Adriaan van den Brand"); + strings.add("J2V8 & viz.js integration: Andreas Studer"); strings.add("Eclipse Plugin: Claude Durif & Anne Pecoil"); strings.add("Servlet & XWiki: Maxime Sinclair"); strings.add("Site design: Raphael Cotisson"); diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 69b199b12..6df7a02f0 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 19888 $ + * Revision $Revision: 19980 $ * */ package net.sourceforge.plantuml.version; @@ -39,7 +39,7 @@ import java.util.Date; public class Version { public static int version() { - return 8042; + return 8043; } public static String versionString() { @@ -62,8 +62,16 @@ public class Version { return beta; } + private static String int2shortString(int v) { + return Integer.toString(v % 36, 36); + } + + public static String turningId() { + return int2shortString(version()) + int2shortString(beta()); + } + public static long compileTime() { - return 1464713301187L; + return 1466340806152L; } public static String compileTimeString() { diff --git a/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java b/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java new file mode 100644 index 000000000..aba6c78de --- /dev/null +++ b/src/net/sourceforge/plantuml/vizjs/GraphvizJs.java @@ -0,0 +1,138 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 19398 $ + * + */ +package net.sourceforge.plantuml.vizjs; + +import java.io.File; +import java.io.OutputStream; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ThreadFactory; + +import net.sourceforge.plantuml.cucadiagram.dot.Graphviz; +import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; +import net.sourceforge.plantuml.cucadiagram.dot.ProcessState; + +public class GraphvizJs implements Graphviz { + + private final static ExecutorService executorService = Executors + .newSingleThreadScheduledExecutor(new ThreadFactory() { + public Thread newThread(Runnable runnable) { + return new JsThread(runnable); + } + }); + + static class JsThread extends Thread { + + private final Runnable runnable; + private VizJsEngine engine; + + public JsThread(Runnable runnable) { + this.runnable = runnable; + } + + @Override + public void run() { + if (engine == null) { + try { + this.engine = new VizJsEngine(); + } catch (Exception e) { + e.printStackTrace(); + } + } + runnable.run(); + } + + } + + private final String dotString; + + public GraphvizJs(String dotString) { + this.dotString = dotString; + } + + public ProcessState createFile3(OutputStream os) { + try { + final String svg = submitJob().get(); + os.write(svg.getBytes()); + return ProcessState.TERMINATED_OK(); + } catch (Exception e) { + throw new GraphvizJsRuntimeException(e); + } + } + + private Future submitJob() { + return executorService.submit(new Callable() { + public String call() throws Exception { + final JsThread th = (JsThread) Thread.currentThread(); + final VizJsEngine engine = th.engine; + return engine.execute(dotString); + } + }); + } + + public File getDotExe() { + return null; + } + + public String dotVersion() { + return "VizJs"; + } + + public boolean illegalDotExe() { + return false; + } + + public static GraphvizVersion getGraphvizVersion(final boolean modeSafe) { + return new GraphvizVersion() { + public boolean useShield() { + return true; + } + + public boolean useProtectionWhenThereALinkFromOrToGroup() { + return true; + } + + public boolean modeSafe() { + return modeSafe; + } + + public boolean isVizjs() { + return true; + } + }; + } + +} diff --git a/src/net/sourceforge/plantuml/vizjs/GraphvizJsRuntimeException.java b/src/net/sourceforge/plantuml/vizjs/GraphvizJsRuntimeException.java new file mode 100644 index 000000000..0d7d275fc --- /dev/null +++ b/src/net/sourceforge/plantuml/vizjs/GraphvizJsRuntimeException.java @@ -0,0 +1,42 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 19398 $ + * + */ +package net.sourceforge.plantuml.vizjs; + +public class GraphvizJsRuntimeException extends RuntimeException { + + public GraphvizJsRuntimeException(Exception e) { + // TODO Auto-generated constructor stub + } + +} diff --git a/src/net/sourceforge/plantuml/vizjs/VizJsEngine.java b/src/net/sourceforge/plantuml/vizjs/VizJsEngine.java new file mode 100644 index 000000000..8ac33d45d --- /dev/null +++ b/src/net/sourceforge/plantuml/vizjs/VizJsEngine.java @@ -0,0 +1,67 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 19398 $ + * + */ +package net.sourceforge.plantuml.vizjs; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +public class VizJsEngine { + + public static boolean isOk() { + try { + final Class classVizJS = Class.forName("ch.braincell.viz.VizJS"); + return true; + } catch (Exception e) { + return false; + } + } + + private final Object viz; + private final Method mExecute; + + public VizJsEngine() throws ClassNotFoundException, NoSuchMethodException, SecurityException, + IllegalAccessException, IllegalArgumentException, InvocationTargetException { + final Class classVizJS = Class.forName("ch.braincell.viz.VizJS"); + final Method mCreate = classVizJS.getMethod("create"); + mExecute = classVizJS.getMethod("execute", String.class); + this.viz = mCreate.invoke(null); + System.err.println("Creating one engine"); + } + + public String execute(String dot) throws IllegalAccessException, IllegalArgumentException, + InvocationTargetException { + return (String) mExecute.invoke(viz, dot); + } + +}