1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-25 22:37:33 +00:00
This commit is contained in:
Arnaud Roques 2022-03-13 13:22:51 +01:00
parent 7f7cf2621f
commit 4be0ee3198
46 changed files with 253 additions and 207 deletions

View File

@ -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,78 +58,18 @@ import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.UShape;
public class EmbeddedDiagram implements CharSequence {
public static String getEmbeddedType(CharSequence s) {
if (s == null) {
return null;
}
s = StringUtils.trin(s.toString());
if (s.equals("{{")) {
return "uml";
}
if (s.equals("{{uml")) {
return "uml";
}
if (s.equals("{{wbs")) {
return "wbs";
}
if (s.equals("{{mindmap")) {
return "mindmap";
}
if (s.equals("{{gantt")) {
return "gantt";
}
if (s.equals("{{json")) {
return "json";
}
if (s.equals("{{yaml")) {
return "yaml";
}
if (s.equals("{{wire")) {
return "wire";
}
if (s.equals("{{creole")) {
return "creole";
}
if (s.equals("{{board")) {
return "board";
}
return null;
}
private final Display system;
public EmbeddedDiagram(Display system) {
this.system = system;
}
public int length() {
return toString().length();
}
public char charAt(int index) {
return toString().charAt(index);
}
public CharSequence subSequence(int start, int end) {
return toString().subSequence(start, end);
}
public Draw asDraw(ISkinSimple skinParam) {
return new Draw(skinParam);
}
public class Draw extends AbstractTextBlock implements Line, Atom {
class EmbeddedDiagramDraw extends AbstractTextBlock implements Line, Atom {
private BufferedImage image;
private final ISkinSimple skinParam;
private final List<StringLocated> as2;
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
return Arrays.asList((Atom) this);
}
private Draw(ISkinSimple skinParam) {
EmbeddedDiagramDraw(ISkinSimple skinParam, List<StringLocated> as2) {
this.skinParam = skinParam;
this.as2 = as2;
}
public double getStartingAltitude(StringBounder stringBounder) {
@ -200,11 +140,73 @@ public class EmbeddedDiagram implements CharSequence {
}
private Diagram getSystem() throws IOException, InterruptedException {
final BlockUml blockUml = new BlockUml(skinParam.getThemeStyle(), system.as2(), Defines.createEmpty(),
skinParam, null, null);
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) {
if (s == null) {
return null;
}
s = StringUtils.trin(s.toString());
if (s.equals("{{")) {
return "uml";
}
if (s.equals("{{uml")) {
return "uml";
}
if (s.equals("{{wbs")) {
return "wbs";
}
if (s.equals("{{mindmap")) {
return "mindmap";
}
if (s.equals("{{gantt")) {
return "gantt";
}
if (s.equals("{{json")) {
return "json";
}
if (s.equals("{{yaml")) {
return "yaml";
}
if (s.equals("{{wire")) {
return "wire";
}
if (s.equals("{{creole")) {
return "creole";
}
if (s.equals("{{board")) {
return "board";
}
return null;
}
private final Display system;
public EmbeddedDiagram(Display system) {
this.system = system;
}
public int length() {
return toString().length();
}
public char charAt(int index) {
return toString().charAt(index);
}
public CharSequence subSequence(int start, int end) {
return toString().subSequence(start, end);
}
public EmbeddedDiagramDraw asDraw(ISkinSimple skinParam) {
return new EmbeddedDiagramDraw(skinParam, system.as2());
}
}

View File

@ -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();

View File

@ -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
}

View File

@ -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<ActivityDiagram> {
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);
}

View File

@ -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<ActivityDiagram>
}
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<ActivityDiagram>
}
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);
}

View File

@ -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<ActivityDiagram3> {
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));
}

View File

@ -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<ActivityDiagram3> {
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));
}

View File

@ -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<ClassDiagram> {
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);
}

View File

@ -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<ClassDiagra
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);
result.addUrl(url);
}

View File

@ -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.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -220,7 +220,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
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);
}

View File

@ -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<AbstractClassOrOb
labels.getSecondLabel(), diagram.getLabeldistance(), diagram.getLabelangle(),
diagram.getSkinParam().getCurrentStyleBuilder());
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 url = urlBuilder.getUrl(arg.get("URL", 0));
link.setUrl(url);
}

View File

@ -38,7 +38,7 @@ package net.sourceforge.plantuml.classdiagram.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.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -87,7 +87,7 @@ public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {
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();

View File

@ -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<ClassDiagram> {
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);
}

View File

@ -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<ClassDiagram> {
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);
}

View File

@ -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<ClassDiagram> {
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);
}

View File

@ -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<AbstractEntityDiagram> {
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);
}

View File

@ -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) {

View File

@ -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));
}

View File

@ -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,

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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));
}

View File

@ -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);
}

View File

@ -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());

View File

@ -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<CharSequence> {
}
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;

View File

@ -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;

View File

@ -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<DescriptionDiagram>
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);
}

View File

@ -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<DescriptionDiag
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);
}

View File

@ -41,7 +41,7 @@ import net.sourceforge.plantuml.FontParam;
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.CommandExecutionResult;
@ -179,7 +179,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
final String urlString = line0.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);
result.addUrl(url);
}

View File

@ -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.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -182,7 +182,7 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
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);
}

View File

@ -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.CommandExecutionResult;
@ -170,7 +170,7 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
}
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);
}

View File

@ -276,7 +276,7 @@ public class EpsGraphics {
public void epsPath(double x, double y, UPath path) {
checkCloseDone();
if (fillcolor != null) {
if (mustApplyFillColor()) {
appendColor(fillcolor);
append("newpath", true);
for (USegment seg : path) {
@ -329,6 +329,14 @@ public class EpsGraphics {
}
private boolean mustApplyFillColor() {
if (fillcolor == null)
return false;
if (fillcolor.getAlpha() == 0)
return false;
return true;
}
public void epsPolygon(HColorGradient gr, ColorMapper mapper, double... points) {
assert points.length % 2 == 0;
setFillColor(mapper.toColor(gr.getColor1()));
@ -340,7 +348,7 @@ public class EpsGraphics {
checkCloseDone();
double lastX = 0;
double lastY = 0;
if (fillcolor != null) {
if (mustApplyFillColor()) {
appendColor(fillcolor);
append("newpath", true);
for (int i = 0; i < points.length; i += 2) {
@ -381,7 +389,7 @@ public class EpsGraphics {
checkCloseDone();
ensureVisible(x, y);
ensureVisible(x + width, y + height);
if (fillcolor != null) {
if (mustApplyFillColor()) {
appendColor(fillcolor);
epsRectangleInternal(x, y, width, height, rx, ry, true);
append("closepath eofill", true);
@ -541,7 +549,7 @@ public class EpsGraphics {
append("gsave", true);
append("1 " + formatSimple4(scale) + " scale", true);
}
if (fillcolor != null) {
if (mustApplyFillColor()) {
appendColor(fillcolor);
append("newpath", true);
append(format(x) + " " + format(y / scale) + " " + format(xRadius) + " 0 360 arc", true);

View File

@ -39,7 +39,7 @@ import java.util.EnumSet;
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.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -124,7 +124,7 @@ class HtmlCommandFactory {
}
if (MyPattern.mtches(s, Splitter.linkPattern)) {
final UrlBuilder urlBuilder = new UrlBuilder(null, ModeUrl.STRICT);
final UrlBuilder urlBuilder = new UrlBuilder(null, UrlMode.STRICT);
final Url url = urlBuilder.getUrl(s);
url.setMember(true);
return new TextLink(url);

View File

@ -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.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -96,7 +96,7 @@ public class CommandCreateEntityObject extends SingleLineCommand2<AbstractClassO
}
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);
}

View File

@ -37,7 +37,7 @@ package net.sourceforge.plantuml.project.lang;
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.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
@ -54,7 +54,7 @@ public class ComplementUrl implements Something {
public Failable<Url> 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);
}

View File

@ -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<SequenceDiagram> {
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);
}

View File

@ -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<SequenceDiagram> {
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);
}

View File

@ -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<SequenceDiag
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);
participant.setUrl(url);
}

View File

@ -39,7 +39,7 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
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.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines2;
@ -117,7 +117,7 @@ public class CommandParticipantMultilines extends CommandMultilines2<SequenceDia
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);
participant.setUrl(url);
}

View File

@ -41,7 +41,7 @@ import java.util.List;
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.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines;
@ -84,7 +84,7 @@ public class CommandReferenceMultilinesOverSeveral extends CommandMultilines<Seq
Url u = null;
if (strings.size() > 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) {

View File

@ -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<SequenceDiagram> {
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();

View File

@ -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<StateDiagram> {
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);
}

View File

@ -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<StateDiagram>
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);
}

View File

@ -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<StateDiagram> {
}
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);
}

View File

@ -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", "<img:HelloWorld.png{scale=2}>",
b.getUrl("[[http://google.com{a nice toolip} <img:HelloWorld.png{scale=2}>]]"));
}
@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", "<img:HelloWorld.png{scale=2}>",
b.getUrl("[[http://google.com {a nice toolip} <img:HelloWorld.png{scale=2}>]]"));
}
@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", "<img:HelloWorld.png{scale=2}>",
b.getUrl("[[http://google.com <img:HelloWorld.png{scale=2}>]]"));
}
@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", "<img:HelloWorld.png{scale=2}>",
b.getUrl("[[http://google.com <img:HelloWorld.png{scale=2}>]]"));
}
@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}\"{}]]"));
}