diff --git a/src/net/sourceforge/plantuml/EmbeddedDiagram.java b/src/net/sourceforge/plantuml/EmbeddedDiagram.java index 20695e284..b3494cb94 100644 --- a/src/net/sourceforge/plantuml/EmbeddedDiagram.java +++ b/src/net/sourceforge/plantuml/EmbeddedDiagram.java @@ -35,13 +35,13 @@ */ package net.sourceforge.plantuml; -import net.sourceforge.plantuml.awt.geom.Dimension2D; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; import java.util.List; +import net.sourceforge.plantuml.awt.geom.Dimension2D; import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.cucadiagram.Display; @@ -58,6 +58,95 @@ import net.sourceforge.plantuml.ugraphic.UImage; import net.sourceforge.plantuml.ugraphic.UImageSvg; import net.sourceforge.plantuml.ugraphic.UShape; +class EmbeddedDiagramDraw extends AbstractTextBlock implements Line, Atom { + private BufferedImage image; + private final ISkinSimple skinParam; + private final List as2; + + public List splitInTwo(StringBounder stringBounder, double width) { + return Arrays.asList((Atom) this); + } + + EmbeddedDiagramDraw(ISkinSimple skinParam, List as2) { + this.skinParam = skinParam; + this.as2 = as2; + } + + public double getStartingAltitude(StringBounder stringBounder) { + return 0; + } + + public Dimension2D calculateDimension(StringBounder stringBounder) { + try { + final BufferedImage im = getImage(); + return new Dimension2DDouble(im.getWidth(), im.getHeight()); + } catch (IOException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return new Dimension2DDouble(42, 42); + } + + public void drawU(UGraphic ug) { + try { + final boolean isSvg = ug.matchesProperty("SVG"); + if (isSvg) { + final String imageSvg = getImageSvg(); + final UImageSvg svg = new UImageSvg(imageSvg, 1); + ug.draw(svg); + return; + } + final BufferedImage im = getImage(); + final UShape image = new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); + ug.draw(image); + } catch (IOException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + + private String getImageSvg() throws IOException, InterruptedException { + final boolean sav = UseStyle.useBetaStyle(); + final Diagram system = getSystem(); + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + system.exportDiagram(os, 0, new FileFormatOption(FileFormat.SVG)); + os.close(); + UseStyle.setBetaStyle(sav); + return new String(os.toByteArray()); + } + + private BufferedImage getImage() throws IOException, InterruptedException { + if (image == null) { + final boolean sav = UseStyle.useBetaStyle(); + image = getImageSlow(); + UseStyle.setBetaStyle(sav); + } + return image; + } + + private BufferedImage getImageSlow() throws IOException, InterruptedException { + final Diagram system = getSystem(); + final ByteArrayOutputStream os = new ByteArrayOutputStream(); + system.exportDiagram(os, 0, new FileFormatOption(FileFormat.PNG)); + os.close(); + return SImageIO.read(os.toByteArray()); + } + + public HorizontalAlignment getHorizontalAlignment() { + return HorizontalAlignment.LEFT; + } + + private Diagram getSystem() throws IOException, InterruptedException { + final BlockUml blockUml = new BlockUml(skinParam.getThemeStyle(), as2, Defines.createEmpty(), skinParam, null, + null); + return blockUml.getDiagram(); + + } +} + public class EmbeddedDiagram implements CharSequence { public static String getEmbeddedType(CharSequence s) { @@ -116,95 +205,8 @@ public class EmbeddedDiagram implements CharSequence { return toString().subSequence(start, end); } - public Draw asDraw(ISkinSimple skinParam) { - return new Draw(skinParam); - } - - public class Draw extends AbstractTextBlock implements Line, Atom { - private BufferedImage image; - private final ISkinSimple skinParam; - - public List splitInTwo(StringBounder stringBounder, double width) { - return Arrays.asList((Atom) this); - } - - private Draw(ISkinSimple skinParam) { - this.skinParam = skinParam; - } - - public double getStartingAltitude(StringBounder stringBounder) { - return 0; - } - - public Dimension2D calculateDimension(StringBounder stringBounder) { - try { - final BufferedImage im = getImage(); - return new Dimension2DDouble(im.getWidth(), im.getHeight()); - } catch (IOException e) { - e.printStackTrace(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - return new Dimension2DDouble(42, 42); - } - - public void drawU(UGraphic ug) { - try { - final boolean isSvg = ug.matchesProperty("SVG"); - if (isSvg) { - final String imageSvg = getImageSvg(); - final UImageSvg svg = new UImageSvg(imageSvg, 1); - ug.draw(svg); - return; - } - final BufferedImage im = getImage(); - final UShape image = new UImage(new PixelImage(im, AffineTransformType.TYPE_BILINEAR)); - ug.draw(image); - } catch (IOException e) { - e.printStackTrace(); - } catch (InterruptedException e) { - e.printStackTrace(); - } - - } - - private String getImageSvg() throws IOException, InterruptedException { - final boolean sav = UseStyle.useBetaStyle(); - final Diagram system = getSystem(); - final ByteArrayOutputStream os = new ByteArrayOutputStream(); - system.exportDiagram(os, 0, new FileFormatOption(FileFormat.SVG)); - os.close(); - UseStyle.setBetaStyle(sav); - return new String(os.toByteArray()); - } - - private BufferedImage getImage() throws IOException, InterruptedException { - if (image == null) { - final boolean sav = UseStyle.useBetaStyle(); - image = getImageSlow(); - UseStyle.setBetaStyle(sav); - } - return image; - } - - private BufferedImage getImageSlow() throws IOException, InterruptedException { - final Diagram system = getSystem(); - final ByteArrayOutputStream os = new ByteArrayOutputStream(); - system.exportDiagram(os, 0, new FileFormatOption(FileFormat.PNG)); - os.close(); - return SImageIO.read(os.toByteArray()); - } - - public HorizontalAlignment getHorizontalAlignment() { - return HorizontalAlignment.LEFT; - } - - private Diagram getSystem() throws IOException, InterruptedException { - final BlockUml blockUml = new BlockUml(skinParam.getThemeStyle(), system.as2(), Defines.createEmpty(), - skinParam, null, null); - return blockUml.getDiagram(); - - } + public EmbeddedDiagramDraw asDraw(ISkinSimple skinParam) { + return new EmbeddedDiagramDraw(skinParam, system.as2()); } } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/UrlBuilder.java b/src/net/sourceforge/plantuml/UrlBuilder.java index 94330d38e..fba8d03df 100644 --- a/src/net/sourceforge/plantuml/UrlBuilder.java +++ b/src/net/sourceforge/plantuml/UrlBuilder.java @@ -41,10 +41,6 @@ import net.sourceforge.plantuml.command.regex.Pattern2; public class UrlBuilder { - public static enum ModeUrl { - STRICT, ANYWHERE - } - private static final String S_QUOTED = "\\[\\[[%s]*" + // "[%g]([^%g]+)[%g]" + // Quoted part "(?:[%s]*\\{([^{}]*)\\})?" + // Optional tooltip @@ -88,9 +84,9 @@ public class UrlBuilder { .cmpile(S_LINK_WITH_OPTIONAL_TOOLTIP_WITH_OPTIONAL_LABEL); private final String topurl; - private ModeUrl mode; + private UrlMode mode; - public UrlBuilder(String topurl, ModeUrl mode) { + public UrlBuilder(String topurl, UrlMode mode) { this.topurl = topurl; this.mode = mode; } @@ -127,9 +123,9 @@ public class UrlBuilder { } private boolean matchesOrFind(Matcher2 m) { - if (mode == ModeUrl.STRICT) { + if (mode == UrlMode.STRICT) { return m.matches(); - } else if (mode == ModeUrl.ANYWHERE) { + } else if (mode == UrlMode.ANYWHERE) { return m.find(); } else { throw new IllegalStateException(); diff --git a/src/net/sourceforge/plantuml/UrlMode.java b/src/net/sourceforge/plantuml/UrlMode.java new file mode 100644 index 000000000..2c16bd23a --- /dev/null +++ b/src/net/sourceforge/plantuml/UrlMode.java @@ -0,0 +1,40 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2023, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml; + +public enum UrlMode { + STRICT, ANYWHERE +} diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java index 40025f249..0f92352fc 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -177,7 +177,7 @@ public class CommandLinkActivity extends SingleLineCommand2 { link = link.getInv(); } if (arg.get("URL", 0) != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url urlLink = urlBuilder.getUrl(arg.get("URL", 0)); link.setUrl(urlLink); } diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java index 6b8f3d0e1..2bb065365 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java @@ -43,7 +43,7 @@ import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.command.BlocLines; @@ -226,7 +226,7 @@ public class CommandLinkLongActivity extends CommandMultilines2 } if (line0.get("URL", 0) != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url urlLink = urlBuilder.getUrl(line0.get("URL", 0)); link.setUrl(urlLink); } @@ -242,7 +242,7 @@ public class CommandLinkLongActivity extends CommandMultilines2 } public Url extractUrlString(final ActivityDiagram diagram, String string) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); return urlBuilder.getUrl(string); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java index 0cf38fc33..627337ff9 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandActivity3.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.activitydiagram3.ftile.BoxStyle; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -109,7 +109,7 @@ public class CommandActivity3 extends SingleLineCommand2 { if (arg.get("URL", 0) == null) { url = null; } else { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); url = urlBuilder.getUrl(arg.get("URL", 0)); } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java index ca3fc2dca..aa146b53d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/command/CommandIf2.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.activitydiagram3.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.activitydiagram3.ActivityDiagram3; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; @@ -94,7 +94,7 @@ public class CommandIf2 extends SingleLineCommand2 { if (arg.get("URL", 0) == null) { url = null; } else { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); url = urlBuilder.getUrl(arg.get("URL", 0)); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java index 5a9e25ec1..1eb4c6d73 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; @@ -168,7 +168,7 @@ public class CommandCreateClass extends SingleLineCommand2 { final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); entity.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index fd25bdc1d..4cca42eb4 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -271,7 +271,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2 final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); entity.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java index 88c2a7c6c..f9363997e 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandLinkClass.java @@ -42,7 +42,7 @@ import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UmlDiagramType; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.RegexConcat; @@ -217,7 +217,7 @@ final public class CommandLinkClass extends SingleLineCommand2 { return CommandExecutionResult.error(code + " does not exist"); } // final IEntity entity = diagram.getOrCreateLeaf(code, null); - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); entity.addUrl(url); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/command/CommandNamespace.java b/src/net/sourceforge/plantuml/command/CommandNamespace.java index d08ff1194..a090e5bd1 100644 --- a/src/net/sourceforge/plantuml/command/CommandNamespace.java +++ b/src/net/sourceforge/plantuml/command/CommandNamespace.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; @@ -103,7 +103,7 @@ public class CommandNamespace extends SingleLineCommand2 { final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); p.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/command/CommandNamespace2.java b/src/net/sourceforge/plantuml/command/CommandNamespace2.java index e1cb6eac3..4ee6028af 100644 --- a/src/net/sourceforge/plantuml/command/CommandNamespace2.java +++ b/src/net/sourceforge/plantuml/command/CommandNamespace2.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; @@ -103,7 +103,7 @@ public class CommandNamespace2 extends SingleLineCommand2 { final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); p.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java b/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java index 5ddb3031b..1fd7f945e 100644 --- a/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java +++ b/src/net/sourceforge/plantuml/command/CommandNamespaceEmpty.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.ClassDiagram; import net.sourceforge.plantuml.command.regex.IRegex; import net.sourceforge.plantuml.command.regex.RegexConcat; @@ -97,7 +97,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2 { final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); p.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/command/CommandPackage.java b/src/net/sourceforge/plantuml/command/CommandPackage.java index 7fb15f086..f64944b80 100644 --- a/src/net/sourceforge/plantuml/command/CommandPackage.java +++ b/src/net/sourceforge/plantuml/command/CommandPackage.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines; import net.sourceforge.plantuml.command.regex.IRegex; @@ -151,7 +151,7 @@ public class CommandPackage extends SingleLineCommand2 { final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); p.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java index e065bb833..ce2868ab7 100644 --- a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java +++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteActivity.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.activitydiagram.ActivityDiagram; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; @@ -111,7 +111,7 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma Url url = null; if (strings.size() > 0) { final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), - ModeUrl.STRICT); + UrlMode.STRICT); url = urlBuilder.getUrl(strings.get(0).toString()); } if (url != null) { diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java index d0c64f3d4..ec8770446 100644 --- a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java +++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines; import net.sourceforge.plantuml.command.BlocLines; @@ -195,7 +195,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma Url url = null; if (line0.get("URL", 0) != null) { final UrlBuilder urlBuilder = new UrlBuilder(system.getSkinParam().getValue("topurl"), - ModeUrl.STRICT); + UrlMode.STRICT); url = urlBuilder.getUrl(line0.get("URL", 0)); } diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java index 70b557db7..a7ade9117 100644 --- a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java +++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -141,7 +141,7 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand } Url url = null; if (arg.get("URL", 0) != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); url = urlBuilder.getUrl(arg.get("URL", 0)); } final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg, diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java index fb55ed7bd..07e02b9b8 100644 --- a/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java +++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.command.note; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; @@ -131,7 +131,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman Url url = null; if (line0.get("URL", 0) != null) { final UrlBuilder urlBuilder = new UrlBuilder(system.getSkinParam().getValue("topurl"), - ModeUrl.STRICT); + UrlMode.STRICT); url = urlBuilder.getUrl(line0.get("URL", 0)); } diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java index 651a2b595..9240d264f 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java @@ -40,7 +40,7 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -170,7 +170,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor // 0))); note.setNoteStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0))); if (line0.get("URL", 0) != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url urlLink = urlBuilder.getUrl(line0.get("URL", 0)); note.setUrl(urlLink); } diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java index 82a07f8bc..ac8997753 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -166,7 +166,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma note.setColors(colors); note.setNoteStyle(NoteStyle.getNoteStyle(arg.get("STYLE", 0))); if (arg.get("URL", 0) != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url urlLink = urlBuilder.getUrl(arg.get("URL", 0)); note.setUrl(urlLink); } diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java index 0d29aee09..051852c8a 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -141,7 +141,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0))); Url url = null; if (line0.get("URL", 0) != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); url = urlBuilder.getUrl(line0.get("URL", 0)); } diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java index 959544bbe..503de4750 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.BlocLines; import net.sourceforge.plantuml.command.Command; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -180,7 +180,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF // 0))); note.setNoteStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0))); if (line0.get("URL", 0) != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url urlLink = urlBuilder.getUrl(line0.get("URL", 0)); note.setUrl(urlLink); } diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java index 117f49198..8163598d3 100644 --- a/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java +++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleUrl.java @@ -37,7 +37,7 @@ package net.sourceforge.plantuml.creole.command; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; @@ -72,7 +72,7 @@ public class CommandCreoleUrl implements Command { if (m.find() == false) { throw new IllegalStateException(); } - final UrlBuilder urlBuilder = new UrlBuilder(stripe.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(stripe.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(m.group(1)); stripe.addUrl(url); return line.substring(m.group(1).length()); diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index 349241c27..905eaa4b5 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -56,7 +56,7 @@ import net.sourceforge.plantuml.SpriteContainer; import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; @@ -434,7 +434,7 @@ public class Display implements Iterable { } public boolean hasUrl() { - final UrlBuilder urlBuilder = new UrlBuilder(null, ModeUrl.ANYWHERE); + final UrlBuilder urlBuilder = new UrlBuilder(null, UrlMode.ANYWHERE); for (CharSequence s : this) if (urlBuilder.getUrl(s.toString()) != null) return true; diff --git a/src/net/sourceforge/plantuml/cucadiagram/Member.java b/src/net/sourceforge/plantuml/cucadiagram/Member.java index 2ca9d829e..abc0d7c37 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Member.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Member.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.Pattern2; @@ -103,7 +103,7 @@ public class Member implements CharSequence { if (urlString == null) { this.url = null; } else { - this.url = new UrlBuilder(null, ModeUrl.STRICT).getUrl(urlString); + this.url = new UrlBuilder(null, UrlMode.STRICT).getUrl(urlString); } } else { this.url = null; diff --git a/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java b/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java index 58f6ad6f1..ad27b0f7d 100644 --- a/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java +++ b/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.command.GenericRegexProducer; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; @@ -127,7 +127,7 @@ public class CommandCreateDomain extends SingleLineCommand2 diagram.getSkinParam().getIHtmlColorSet())); } if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); entity.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index 7a98bcab8..b2f894e30 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram; import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -258,7 +258,7 @@ public class CommandCreateElementFull extends SingleLineCommand2 getMe(GanttDiagram diagram, RegexResult arg, String suffix) { final String urlString = arg.get("COMPLEMENT" + suffix, 0); - final UrlBuilder urlBuilder = new UrlBuilder("", ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder("", UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); return Failable.ok(url); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java index e32b44d32..49d6a5d70 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java @@ -44,7 +44,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.api.ThemeStyle; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.command.CommandExecutionResult; @@ -279,7 +279,7 @@ public class CommandArrow extends SingleLineCommand2 { msg.setMulticast(getMulticasts(diagram, arg)); final String url = arg.get("URL", 0); if (url != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url urlLink = urlBuilder.getUrl(url); msg.setUrl(urlLink); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java index 6c6a6af96..ed0688de3 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java @@ -39,7 +39,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -138,7 +138,7 @@ abstract class CommandExoArrowAny extends SingleLineCommand2 { final MessageExo msg = new MessageExo(diagram.getSkinParam().getCurrentStyleBuilder(), p, messageExoType, labels, config, diagram.getNextMessageNumber(), isShortArrow(arg)); if (arg.get("URL", 0) != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url urlLink = urlBuilder.getUrl(arg.get("URL", 0)); msg.setUrl(urlLink); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java index 472ae3529..dd5f06b06 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java @@ -41,7 +41,7 @@ import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -129,7 +129,7 @@ public abstract class CommandParticipant extends SingleLineCommand2 0) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); u = urlBuilder.getUrl(strings.get(0).toString()); } if (u != null) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandUrl.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandUrl.java index e1d963e0d..638bf59f5 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandUrl.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandUrl.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.sequencediagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -73,7 +73,7 @@ public class CommandUrl extends SingleLineCommand2 { final String code = arg.get("CODE", 0); final String urlString = arg.get("URL", 0); final Participant p = diagram.getOrCreateParticipant(code); - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); p.setUrl(url); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackage2.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackage2.java index 6a96dac5e..6195b6397 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackage2.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackage2.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.statediagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -129,7 +129,7 @@ public class CommandCreatePackage2 extends SingleLineCommand2 { final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); p.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java index 7dcd678cc..ea6c78360 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.statediagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -127,7 +127,7 @@ public class CommandCreatePackageState extends SingleLineCommand2 final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); p.addUrl(url); } diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java index 5c18bfb09..a9c20a965 100644 --- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java +++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java @@ -38,7 +38,7 @@ package net.sourceforge.plantuml.statediagram.command; import net.sourceforge.plantuml.LineLocation; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.command.regex.IRegex; @@ -127,7 +127,7 @@ public class CommandCreateState extends SingleLineCommand2 { } final String urlString = arg.get("URL", 0); if (urlString != null) { - final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT); final Url url = urlBuilder.getUrl(urlString); ent.addUrl(url); } diff --git a/test/net/sourceforge/plantuml/UrlBuilderTest.java b/test/net/sourceforge/plantuml/UrlBuilderTest.java index d8b4cff41..bcf3a2bbd 100644 --- a/test/net/sourceforge/plantuml/UrlBuilderTest.java +++ b/test/net/sourceforge/plantuml/UrlBuilderTest.java @@ -4,97 +4,97 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.UrlMode; class UrlBuilderTest { @Test public void testGetUrl10() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo", "http://foo", "http://foo", b.getUrl("[[http://foo]]")); } @Test public void testGetUrl11() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo", "tooltip", "text", b.getUrl("[[http://foo{tooltip} text]]")); } @Test public void testGetUrl12() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo", "tooltip", "text", b.getUrl("[[http://foo {tooltip} text]]")); } @Test public void testGetUrl13() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo", "tooltip", "http://foo", b.getUrl("[[http://foo {tooltip}]]")); } @Test public void testGetUrl15() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo", "http://foo", "text", b.getUrl("[[http://foo text]]")); } @Test public void testGetUrl18() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo", "http://foo", "http://foo", b.getUrl("[[ http://foo ]]")); } @Test public void testGetUrl20() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo test", "http://foo test", "http://foo test", b.getUrl("[[\"http://foo test\"]]")); } @Test public void testGetUrl30() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.ANYWHERE); + final UrlBuilder b = new UrlBuilder(null, UrlMode.ANYWHERE); assertUrl("http://foo test", "http://foo test", "http://foo test", b.getUrl("start [[\"http://foo test\"]] end")); } @Test public void testGetUrl40() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://google.com", "a nice toolip", "", b.getUrl("[[http://google.com{a nice toolip} ]]")); } @Test public void testGetUrl41() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://google.com", "a nice toolip", "", b.getUrl("[[http://google.com {a nice toolip} ]]")); } @Test public void testGetUrl42() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://google.com", "http://google.com", "", b.getUrl("[[http://google.com ]]")); } @Test public void testGetUrl50() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://google.com", "http://google.com", "", b.getUrl("[[http://google.com ]]")); } @Test public void testGetUrl60() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo?dummy={123}&action=edit", "http://foo?dummy={123}&action=edit", "http://foo?dummy={123}&action=edit", b.getUrl("[[http://foo?dummy={123}&action=edit]]")); } @Test public void testGetUrl70() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://www.plantuml.com", "Json: {\"firstName\":\"Bob\", \"lastName\":\"Smith\"}", "http://www.plantuml.com", b.getUrl("[[http://www.plantuml.com{Json: {\"firstName\":\"Bob\", \"lastName\":\"Smith\"}}]]")); @@ -102,45 +102,45 @@ class UrlBuilderTest { @Test public void testGetUrl80() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo?dummy=", "123}z{", "http://foo?dummy=", b.getUrl("[[http://foo?dummy={123}z{}]]")); } @Test public void testGetUrl90() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("", "tooltip", "some text", b.getUrl("[[{tooltip} some text]]")); } @Test public void testGetUrl100() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.ANYWHERE); + final UrlBuilder b = new UrlBuilder(null, UrlMode.ANYWHERE); assertUrl("www.google.com", "www.google.com", "POST /session/csrStart", b.getUrl("fromor [[www.google.com POST /session/csrStart]] end")); } @Test public void testGetUrl110() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("blaha(xyz,12)", " tooltip ", "blaha(xyz,12)", b.getUrl("[[ blaha(xyz,12){ tooltip } ]]")); } @Test public void testGetUrl120() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("", "Json: {\"firstName\":\"Bob\", \"lastName\":\"Smith\"}", "", b.getUrl("[[{Json: {\"firstName\":\"Bob\", \"lastName\":\"Smith\"}}]]")); } @Test public void testGetUrl130() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo?dummy=", "123}{", "http://foo?dummy=", b.getUrl("[[http://foo?dummy={123}{}]]")); } @Test public void testGetUrl140() { - final UrlBuilder b = new UrlBuilder(null, ModeUrl.STRICT); + final UrlBuilder b = new UrlBuilder(null, UrlMode.STRICT); assertUrl("http://foo?dummy={123}", "", "http://foo?dummy={123}", b.getUrl("[[\"http://foo?dummy={123}\"{}]]")); }