1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

Import version 1.2021.15

This commit is contained in:
Arnaud Roques 2021-11-30 19:33:37 +01:00
parent 64510e5c88
commit 2494e6a435
29 changed files with 274 additions and 259 deletions

View File

@ -83,7 +83,6 @@ import net.sourceforge.plantuml.version.Version;
public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annotated, WithSprite {
private boolean rotation;
private boolean hideUnlinkedData;
private int minwidth = Integer.MAX_VALUE;
@ -120,15 +119,7 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
}
throw new IllegalArgumentException();
}
public final boolean isHideUnlinkedData() {
return hideUnlinkedData;
}
public final void setHideUnlinkedData(boolean hideUnlinkedData) {
this.hideUnlinkedData = hideUnlinkedData;
}
@Override
final protected ImageData exportDiagramNow(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException {

View File

@ -253,7 +253,6 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
final protected void addCommonHides(List<Command> cmds) {
cmds.add(new CommandHideEmptyDescription());
cmds.add(new CommandHideUnlinked());
cmds.add(new CommandHideShowByVisibility());
cmds.add(new CommandHideShowByGender());
}

View File

@ -39,6 +39,8 @@ import net.sourceforge.plantuml.creole.legacy.StripeSimple;
public interface Command {
public String startingChars();
public int matchingSize(String line);
public String executeAndGetRemaining(String line, StripeSimple stripe);

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -48,8 +47,12 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
public class CommandCreoleColorAndSizeChange implements Command {
@Override
public String startingChars() {
return "<";
}
private final Pattern2 mypattern;
private final ThemeStyle themeStyle;
public static final String fontPattern = "\\<font(?:[%s]+size[%s]*=[%s]*[%g]?(\\d+)[%g]?|[%s]+color[%s]*=[%s]*[%g]?(#[0-9a-fA-F]{6}|\\w+)[%g]?)+[%s]*\\>";
@ -57,45 +60,40 @@ public class CommandCreoleColorAndSizeChange implements Command {
private static final Pattern2 patternEol = MyPattern.cmpile("^(" + fontPattern + "(.*))$");
public static Command create(ThemeStyle themeStyle) {
return new CommandCreoleColorAndSizeChange(themeStyle, pattern);
public static Command create() {
return new CommandCreoleColorAndSizeChange(pattern);
}
public static Command createEol(ThemeStyle themeStyle) {
return new CommandCreoleColorAndSizeChange(themeStyle, patternEol);
public static Command createEol() {
return new CommandCreoleColorAndSizeChange(patternEol);
}
private CommandCreoleColorAndSizeChange(ThemeStyle themeStyle, Pattern2 pattern) {
private CommandCreoleColorAndSizeChange(Pattern2 pattern) {
this.mypattern = pattern;
this.themeStyle = themeStyle;
}
public int matchingSize(String line) {
final Matcher2 m = mypattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
return 0;
}
return m.group(1).length();
}
public String executeAndGetRemaining(String line, StripeSimple stripe) throws NoSuchColorRuntimeException {
final Matcher2 m = mypattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
throw new IllegalStateException();
}
// for (int i = 1; i <= m.groupCount(); i++) {
// System.err.println("i=" + i + " " + m.group(i));
// }
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
FontConfiguration fc2 = fc1;
if (m.group(2) != null) {
if (m.group(2) != null)
fc2 = fc2.changeSize(Integer.parseInt(m.group(2)));
}
try {
if (m.group(3) != null) {
final String s = m.group(3);
final HColor color = HColorSet.instance().getColor(themeStyle, s);
final HColor color = HColorSet.instance().getColor(stripe.getSkinParam().getThemeStyle(), s);
fc2 = fc2.changeColor(color);
}
@ -107,4 +105,5 @@ public class CommandCreoleColorAndSizeChange implements Command {
throw new NoSuchColorRuntimeException();
}
}
}

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -49,44 +48,46 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
public class CommandCreoleColorChange implements Command {
@Override
public String startingChars() {
return "<";
}
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
private static final Pattern2 patternEol = MyPattern.cmpile("^(" + Splitter.fontColorPattern2 + "(.*)$)");
private final Pattern2 mypattern;
private final ThemeStyle themeStyle;
public static Command create(ThemeStyle themeStyle) {
return new CommandCreoleColorChange(themeStyle, pattern);
public static Command create() {
return new CommandCreoleColorChange(pattern);
}
public static Command createEol(ThemeStyle themeStyle) {
return new CommandCreoleColorChange(themeStyle, patternEol);
public static Command createEol() {
return new CommandCreoleColorChange(patternEol);
}
private CommandCreoleColorChange(ThemeStyle themeStyle, Pattern2 pattern) {
private CommandCreoleColorChange(Pattern2 pattern) {
this.mypattern = pattern;
this.themeStyle = themeStyle;
}
public int matchingSize(String line) {
final Matcher2 m = mypattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
return 0;
}
return m.group(2).length();
}
public String executeAndGetRemaining(String line, StripeSimple stripe) throws NoSuchColorRuntimeException {
final Matcher2 m = mypattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
throw new IllegalStateException();
}
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
final String s = m.group(2);
try {
final HColor color = HColorSet.instance().getColor(themeStyle, s);
final HColor color = HColorSet.instance().getColor(stripe.getSkinParam().getThemeStyle(), s);
final FontConfiguration fc2 = fc1.changeColor(color);
stripe.setActualFontConfiguration(fc2);
} catch (NoSuchColorException e) {

View File

@ -43,6 +43,11 @@ import net.sourceforge.plantuml.graphic.FontPosition;
public class CommandCreoleExposantChange extends CommandCreoleCache implements Command {
private final FontPosition position;
@Override
public String startingChars() {
return "<";
}
private CommandCreoleExposantChange(String p, FontPosition position) {
super(p);

View File

@ -44,6 +44,11 @@ import net.sourceforge.plantuml.graphic.Splitter;
public class CommandCreoleFontFamilyChange implements Command {
@Override
public String startingChars() {
return "<";
}
private static final Pattern2 pattern = MyPattern
.cmpile("^(" + Splitter.fontFamilyPattern + "(.*?)\\</font\\>)");

View File

@ -45,6 +45,11 @@ import net.sourceforge.plantuml.graphic.Splitter;
public class CommandCreoleImg implements Command {
@Override
public String startingChars() {
return "<";
}
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.imgPatternNoSrcColon + ")");
private CommandCreoleImg() {

View File

@ -44,6 +44,11 @@ import net.sourceforge.plantuml.math.ScientificEquationSafe;
public class CommandCreoleLatex implements Command {
@Override
public String startingChars() {
return "<";
}
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.latexPattern + ")");
private CommandCreoleLatex() {

View File

@ -44,6 +44,11 @@ import net.sourceforge.plantuml.math.ScientificEquationSafe;
public class CommandCreoleMath implements Command {
@Override
public String startingChars() {
return "<";
}
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.mathPattern + ")");
private CommandCreoleMath() {

View File

@ -43,16 +43,19 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
public class CommandCreoleMonospaced implements Command {
private final Pattern2 pattern;
private final String monospacedFamily;
public static Command create(String monospacedFamily) {
return new CommandCreoleMonospaced("^(\"\"(.*?)\"\")", monospacedFamily);
@Override
public String startingChars() {
return "\"";
}
private CommandCreoleMonospaced(String p, String monospacedFamily) {
private final Pattern2 pattern;
public static Command create() {
return new CommandCreoleMonospaced("^(\"\"(.*?)\"\")");
}
private CommandCreoleMonospaced(String p) {
this.pattern = MyPattern.cmpile(p);
this.monospacedFamily = monospacedFamily;
}
public int matchingSize(String line) {
@ -65,11 +68,11 @@ public class CommandCreoleMonospaced implements Command {
public String executeAndGetRemaining(String line, StripeSimple stripe) {
final Matcher2 m = pattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
throw new IllegalStateException();
}
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
final FontConfiguration fc2 = fc1.changeFamily(monospacedFamily);
final FontConfiguration fc2 = fc1.changeFamily(stripe.getSkinParam().getMonospacedFamily());
stripe.setActualFontConfiguration(fc2);
stripe.analyzeAndAdd(m.group(2));
stripe.setActualFontConfiguration(fc1);

View File

@ -35,7 +35,7 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -43,43 +43,43 @@ import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
import net.sourceforge.plantuml.graphic.Splitter;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public class CommandCreoleOpenIcon implements Command {
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.openiconPattern + ")");
private final HColorSet colorSet;
private final ThemeStyle themeStyle;
private CommandCreoleOpenIcon(ThemeStyle themeStyle, HColorSet colorSet) {
this.colorSet = colorSet;
this.themeStyle = themeStyle;
@Override
public String startingChars() {
return "<";
}
public static Command create(ThemeStyle themeStyle, HColorSet colorSet) {
return new CommandCreoleOpenIcon(themeStyle, colorSet);
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.openiconPattern + ")");
private CommandCreoleOpenIcon() {
}
public static Command create() {
return new CommandCreoleOpenIcon();
}
public int matchingSize(String line) {
final Matcher2 m = pattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
return 0;
}
return m.group(1).length();
}
public String executeAndGetRemaining(String line, StripeSimple stripe) {
final Matcher2 m = pattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
throw new IllegalStateException();
}
final String src = m.group(2);
final double scale = Parser.getScale(m.group(3), 1);
final String colorName = Parser.getColor(m.group(3));
HColor color = null;
if (colorName != null) {
color = colorSet.getColorOrWhite(themeStyle, colorName);
final ISkinSimple skinParam = stripe.getSkinParam();
color = skinParam.getIHtmlColorSet().getColorOrWhite(skinParam.getThemeStyle(), colorName);
}
stripe.addOpenIcon(src, scale, color);
return line.substring(m.group(1).length());

View File

@ -44,6 +44,11 @@ import net.sourceforge.plantuml.graphic.Splitter;
public class CommandCreoleQrcode implements Command {
@Override
public String startingChars() {
return "<";
}
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.qrcodePattern + ")");
private CommandCreoleQrcode() {

View File

@ -44,6 +44,11 @@ import net.sourceforge.plantuml.graphic.Splitter;
public class CommandCreoleSizeChange implements Command {
@Override
public String startingChars() {
return "<";
}
private final Pattern2 mypattern;
private static final Pattern2 pattern = MyPattern

View File

@ -41,6 +41,11 @@ import net.sourceforge.plantuml.command.regex.Pattern2;
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
public class CommandCreoleSpace implements Command {
@Override
public String startingChars() {
return "<";
}
private static final Pattern2 pattern = MyPattern.cmpile("^(\\<space:(\\d+)/?\\>)");

View File

@ -35,7 +35,7 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -43,43 +43,43 @@ import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
import net.sourceforge.plantuml.graphic.Splitter;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public class CommandCreoleSprite implements Command {
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.spritePattern2 + ")");
private final HColorSet colorSet;
private final ThemeStyle themeStyle;
private CommandCreoleSprite(ThemeStyle themeStyle, HColorSet colorSet) {
this.colorSet = colorSet;
this.themeStyle = themeStyle;
@Override
public String startingChars() {
return "<";
}
public static Command create(ThemeStyle themeStyle, HColorSet colorSet) {
return new CommandCreoleSprite(themeStyle, colorSet);
private static final Pattern2 pattern = MyPattern.cmpile("^(" + Splitter.spritePattern2 + ")");
private CommandCreoleSprite() {
}
public static Command create() {
return new CommandCreoleSprite();
}
public int matchingSize(String line) {
final Matcher2 m = pattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
return 0;
}
return m.group(1).length();
}
public String executeAndGetRemaining(String line, StripeSimple stripe) {
final Matcher2 m = pattern.matcher(line);
if (m.find() == false) {
if (m.find() == false)
throw new IllegalStateException();
}
final String src = m.group(2);
final double scale = Parser.getScale(m.group(3), 1);
final String colorName = Parser.getColor(m.group(3));
HColor color = null;
if (colorName != null) {
color = colorSet.getColorOrWhite(themeStyle, colorName);
final ISkinSimple skinParam = stripe.getSkinParam();
color = skinParam.getIHtmlColorSet().getColorOrWhite(skinParam.getThemeStyle(), colorName);
}
stripe.addSprite(src, scale, color);
return line.substring(m.group(1).length());

View File

@ -44,6 +44,11 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
public class CommandCreoleStyle extends CommandCreoleCache implements Command {
@Override
public String startingChars() {
return "</*_~-";
}
private final FontStyle style;
private final boolean tryExtendedColor;

View File

@ -1,83 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, 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.creole.command;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.creole.legacy.StripeSimple;
import net.sourceforge.plantuml.graphic.FontStyle;
public class CommandCreoleStyle2 extends CommandCreoleCache implements Command {
public static Command createCreole(FontStyle style) {
return new CommandCreoleStyle2("^(" + style.getCreoleSyntax() + "(.+?)" + style.getCreoleSyntax() + ")", style);
}
public static Command createLegacy(FontStyle style) {
return new CommandCreoleStyle2(
"^((" + style.getActivationPattern() + ")(.+?)" + style.getDeactivationPattern() + ")", style);
}
public static Command createLegacyEol(FontStyle style) {
return new CommandCreoleStyle2("^((" + style.getActivationPattern() + ")(.+))$", style);
}
private CommandCreoleStyle2(String p, FontStyle style) {
super(p);
}
public String executeAndGetRemaining(final String line, StripeSimple stripe) {
final Matcher2 m = mypattern.matcher(line);
if (m.find() == false) {
throw new IllegalStateException();
}
final int groupCount = m.groupCount();
final String part1 = m.group(groupCount);
final String part2 = line.substring(m.group(1).length());
return StringUtils.BOLD_START + part1 + StringUtils.BOLD_END + part2;
}
public int matchingSize(String line) {
final Matcher2 m = mypattern.matcher(line);
if (m.find() == false) {
return 0;
}
return m.group(1).length();
}
}

View File

@ -45,6 +45,11 @@ import net.sourceforge.plantuml.graphic.SvgAttributes;
public class CommandCreoleSvgAttributeChange implements Command {
@Override
public String startingChars() {
return "<";
}
public static final String fontPattern = Splitter.svgAttributePattern;
private static final Pattern2 pattern = MyPattern.cmpile("^(" + fontPattern + "(.*?)\\</text\\>)");

View File

@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
@ -46,16 +45,18 @@ import net.sourceforge.plantuml.creole.legacy.StripeSimple;
public class CommandCreoleUrl implements Command {
private static final Pattern2 pattern = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")");
private final ISkinSimple skinParam;
public static Command create(ISkinSimple skinParam) {
return new CommandCreoleUrl(skinParam);
@Override
public String startingChars() {
return "[";
}
private CommandCreoleUrl(ISkinSimple skinParam) {
this.skinParam = skinParam;
private static final Pattern2 pattern = MyPattern.cmpile("^(" + UrlBuilder.getRegexp() + ")");
public static Command create() {
return new CommandCreoleUrl();
}
private CommandCreoleUrl() {
}
public int matchingSize(String line) {
@ -71,7 +72,7 @@ public class CommandCreoleUrl implements Command {
if (m.find() == false) {
throw new IllegalStateException();
}
final UrlBuilder urlBuilder = new UrlBuilder(skinParam.getValue("topurl"), ModeUrl.STRICT);
final UrlBuilder urlBuilder = new UrlBuilder(stripe.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
final Url url = urlBuilder.getUrl(m.group(1));
stripe.addUrl(url);
return line.substring(m.group(1).length());

View File

@ -37,7 +37,9 @@ package net.sourceforge.plantuml.creole.legacy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.BackSlash;
@ -70,7 +72,6 @@ import net.sourceforge.plantuml.creole.command.CommandCreoleSizeChange;
import net.sourceforge.plantuml.creole.command.CommandCreoleSpace;
import net.sourceforge.plantuml.creole.command.CommandCreoleSprite;
import net.sourceforge.plantuml.creole.command.CommandCreoleStyle;
import net.sourceforge.plantuml.creole.command.CommandCreoleStyle2;
import net.sourceforge.plantuml.creole.command.CommandCreoleSvgAttributeChange;
import net.sourceforge.plantuml.creole.command.CommandCreoleUrl;
import net.sourceforge.plantuml.graphic.FontConfiguration;
@ -90,7 +91,10 @@ public class StripeSimple implements Stripe {
final private Atom header;
final private List<Atom> atoms = new ArrayList<>();
final private List<Command> commands = new ArrayList<>();
// final private List<Command> commands = new ArrayList<>();
final private Map<Character, List<Command>> commands = new HashMap<>();
private HorizontalAlignment align = HorizontalAlignment.LEFT;
public void setCellAlignment(HorizontalAlignment align) {
@ -115,64 +119,55 @@ public class StripeSimple implements Stripe {
return header;
}
public final static boolean TSPAN = false;
public StripeSimple(FontConfiguration fontConfiguration, StripeStyle style, CreoleContext context,
ISkinSimple skinParam, CreoleMode modeSimpleLine) {
this.fontConfiguration = fontConfiguration;
this.style = style;
this.skinParam = skinParam;
// class Splitter
if (TSPAN) {
this.commands.add(CommandCreoleStyle2.createCreole(FontStyle.BOLD));
this.commands.add(CommandCreoleStyle2.createLegacy(FontStyle.BOLD));
this.commands.add(CommandCreoleStyle2.createLegacyEol(FontStyle.BOLD));
} else {
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.BOLD));
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.BOLD));
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.BOLD));
}
addCommand(CommandCreoleStyle.createCreole(FontStyle.BOLD));
addCommand(CommandCreoleStyle.createLegacy(FontStyle.BOLD));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.BOLD));
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.ITALIC));
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.ITALIC));
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.ITALIC));
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.PLAIN));
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.PLAIN));
addCommand(CommandCreoleStyle.createCreole(FontStyle.ITALIC));
addCommand(CommandCreoleStyle.createLegacy(FontStyle.ITALIC));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.ITALIC));
addCommand(CommandCreoleStyle.createLegacy(FontStyle.PLAIN));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.PLAIN));
if (modeSimpleLine == CreoleMode.FULL) {
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.UNDERLINE));
addCommand(CommandCreoleStyle.createCreole(FontStyle.UNDERLINE));
}
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.UNDERLINE));
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.UNDERLINE));
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.STRIKE));
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.STRIKE));
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.STRIKE));
this.commands.add(CommandCreoleStyle.createCreole(FontStyle.WAVE));
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.WAVE));
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.WAVE));
this.commands.add(CommandCreoleStyle.createLegacy(FontStyle.BACKCOLOR));
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.BACKCOLOR));
this.commands.add(CommandCreoleSizeChange.create());
this.commands.add(CommandCreoleSizeChange.createEol());
this.commands.add(CommandCreoleColorChange.create(skinParam.getThemeStyle()));
this.commands.add(CommandCreoleColorChange.createEol(skinParam.getThemeStyle()));
this.commands.add(CommandCreoleColorAndSizeChange.create(skinParam.getThemeStyle()));
this.commands.add(CommandCreoleColorAndSizeChange.createEol(skinParam.getThemeStyle()));
this.commands.add(CommandCreoleExposantChange.create(FontPosition.EXPOSANT));
this.commands.add(CommandCreoleExposantChange.create(FontPosition.INDICE));
this.commands.add(CommandCreoleImg.create());
this.commands.add(CommandCreoleQrcode.create());
this.commands.add(CommandCreoleOpenIcon.create(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()));
this.commands.add(CommandCreoleMath.create());
this.commands.add(CommandCreoleLatex.create());
this.commands.add(CommandCreoleSprite.create(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()));
this.commands.add(CommandCreoleSpace.create());
this.commands.add(CommandCreoleFontFamilyChange.create());
this.commands.add(CommandCreoleFontFamilyChange.createEol());
this.commands.add(CommandCreoleMonospaced.create(skinParam.getMonospacedFamily()));
this.commands.add(CommandCreoleUrl.create(skinParam));
addCommand(CommandCreoleStyle.createLegacy(FontStyle.UNDERLINE));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.UNDERLINE));
addCommand(CommandCreoleStyle.createCreole(FontStyle.STRIKE));
addCommand(CommandCreoleStyle.createLegacy(FontStyle.STRIKE));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.STRIKE));
addCommand(CommandCreoleStyle.createCreole(FontStyle.WAVE));
addCommand(CommandCreoleStyle.createLegacy(FontStyle.WAVE));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.WAVE));
addCommand(CommandCreoleStyle.createLegacy(FontStyle.BACKCOLOR));
addCommand(CommandCreoleStyle.createLegacyEol(FontStyle.BACKCOLOR));
addCommand(CommandCreoleSizeChange.create());
addCommand(CommandCreoleSizeChange.createEol());
addCommand(CommandCreoleColorChange.create());
addCommand(CommandCreoleColorChange.createEol());
addCommand(CommandCreoleColorAndSizeChange.create());
addCommand(CommandCreoleColorAndSizeChange.createEol());
addCommand(CommandCreoleExposantChange.create(FontPosition.EXPOSANT));
addCommand(CommandCreoleExposantChange.create(FontPosition.INDICE));
addCommand(CommandCreoleImg.create());
addCommand(CommandCreoleQrcode.create());
addCommand(CommandCreoleOpenIcon.create());
addCommand(CommandCreoleMath.create());
addCommand(CommandCreoleLatex.create());
addCommand(CommandCreoleSprite.create());
addCommand(CommandCreoleSpace.create());
addCommand(CommandCreoleFontFamilyChange.create());
addCommand(CommandCreoleFontFamilyChange.createEol());
addCommand(CommandCreoleMonospaced.create());
addCommand(CommandCreoleUrl.create());
if (SecurityUtils.allowSvgText()) {
this.commands.add(CommandCreoleSvgAttributeChange.create());
addCommand(CommandCreoleSvgAttributeChange.create());
}
this.header = style.getHeader(fontConfiguration, context);
@ -182,6 +177,19 @@ public class StripeSimple implements Stripe {
}
}
private void addCommand(Command cmd) {
final String starters = cmd.startingChars();
for (int i = 0; i < starters.length(); i++) {
final char ch = starters.charAt(i);
List<Command> localList = commands.get(ch);
if (localList == null) {
localList = new ArrayList<Command>();
commands.put(ch, localList);
}
localList.add(cmd);
}
}
public List<Atom> getAtoms() {
if (atoms.size() == 0) {
atoms.add(AtomTextUtils.createLegacy(" ", fontConfiguration));
@ -285,13 +293,19 @@ public class StripeSimple implements Stripe {
}
private Command searchCommand(String line) {
for (Command cmd : commands) {
final int i = cmd.matchingSize(line);
if (i != 0) {
return cmd;
final List<Command> localList = commands.get(line.charAt(0));
if (localList != null)
for (Command cmd : localList) {
final int i = cmd.matchingSize(line);
if (i != 0) {
return cmd;
}
}
}
return null;
}
public ISkinSimple getSkinParam() {
return skinParam;
}
}

View File

@ -108,11 +108,6 @@ public class MindMap implements UDrawable {
CommandExecutionResult addIdeaInternal(String stereotype, HColor backColor, int level, Display label,
IdeaShape shape, Direction direction) {
if (level == 0 && this.right.hasRoot())
return CommandExecutionResult.error(
"I don't know how to draw multi-root diagram. You should suggest an image so that the PlantUML team implements it :-)");
try {
if (this.left.hasRoot() == false && this.right.hasRoot() == false)
level = 0;
@ -132,4 +127,8 @@ public class MindMap implements UDrawable {
}
}
boolean isFull(int level) {
return level == 0 && this.right.hasRoot();
}
}

View File

@ -39,7 +39,10 @@ import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram;
@ -54,11 +57,12 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class MindMapDiagram extends UmlDiagram {
private final MindMap mindmap;
private final List<MindMap> mindmaps = new ArrayList<>();
private Direction defaultDirection = Direction.RIGHT;
@ -72,7 +76,7 @@ public class MindMapDiagram extends UmlDiagram {
public MindMapDiagram(UmlSource source) {
super(source, UmlDiagramType.MINDMAP);
this.mindmap = new MindMap(getSkinParam());
this.mindmaps.add(new MindMap(getSkinParam()));
}
@Override
@ -86,7 +90,11 @@ public class MindMapDiagram extends UmlDiagram {
return new TextBlockBackcolored() {
public void drawU(UGraphic ug) {
mindmap.drawU(ug);
for (MindMap mindmap : mindmaps) {
mindmap.drawU(ug);
final Dimension2D dim = mindmap.calculateDimension(ug.getStringBounder());
ug = ug.apply(UTranslate.dy(dim.getHeight()));
}
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
@ -94,7 +102,14 @@ public class MindMapDiagram extends UmlDiagram {
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return mindmap.calculateDimension(stringBounder);
double width = 0;
double height = 0;
for (MindMap mindmap : mindmaps) {
final Dimension2D dim = mindmap.calculateDimension(stringBounder);
height += dim.getHeight();
width = Math.max(width, dim.getWidth());
}
return new Dimension2DDouble(width, height);
}
public MinMax getMinMax(StringBounder stringBounder) {
@ -111,18 +126,28 @@ public class MindMapDiagram extends UmlDiagram {
return addIdea(backColor, level, label, shape, defaultDirection);
}
private MindMap last() {
return mindmaps.get(mindmaps.size() - 1);
}
public CommandExecutionResult addIdea(HColor backColor, int level, Display label, IdeaShape shape,
Direction direction) {
String stereotype = label.getEndingStereotype();
if (stereotype != null) {
label = label.removeEndingStereotype();
}
return mindmap.addIdeaInternal(stereotype, backColor, level, label, shape, direction);
if (last().isFull(level))
this.mindmaps.add(new MindMap(getSkinParam()));
return last().addIdeaInternal(stereotype, backColor, level, label, shape, direction);
}
public CommandExecutionResult addIdea(String stereotype, HColor backColor, int level, Display label,
IdeaShape shape) {
return mindmap.addIdeaInternal(stereotype, backColor, level, label, shape, defaultDirection);
if (last().isFull(level))
this.mindmaps.add(new MindMap(getSkinParam()));
return last().addIdeaInternal(stereotype, backColor, level, label, shape, defaultDirection);
}
private String first;

View File

@ -228,7 +228,7 @@ public class PicoWebServer implements Runnable {
}
}
if (system.getTitleDisplay() != null && system.getTitleDisplay().size() == 1) {
final String encode = URLEncoder.encode(system.getTitleDisplay().toString(), "UTF-8");
final String encode = URLEncoder.encode(system.getTitleDisplay().asList().get(0).toString(), "UTF-8");
if (encode.length() < 256)
write(out, "X-PlantUML-Diagram-Title: " + encode);
}

View File

@ -140,10 +140,10 @@ public class SURL {
/**
* Create a secure URL from a String.
* <p>
* The url must be http or https.
* Return null in case of error or if <code>url</code> is null
* The url must be http or https. Return null in case of error or if
* <code>url</code> is null
*
* @param url plain url starting by http:// or https//
* @param url plain url starting by http:// or https//
* @return the secure URL or null
*/
public static SURL create(String url) {
@ -165,7 +165,7 @@ public class SURL {
* It takes into account credentials.
*
* @param url
* @return the secure URL
* @return the secure URL
* @throws MalformedURLException if <code>url</code> is null
*/
public static SURL create(URL url) throws MalformedURLException {
@ -252,7 +252,7 @@ public class SURL {
for (String allow : getAllowList())
if (full.startsWith(cleanPath(allow)))
return true;
return false;
}

View File

@ -73,6 +73,16 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class SequenceDiagram extends UmlDiagram {
private boolean hideUnlinkedData;
public final boolean isHideUnlinkedData() {
return hideUnlinkedData;
}
public final void setHideUnlinkedData(boolean hideUnlinkedData) {
this.hideUnlinkedData = hideUnlinkedData;
}
private final List<Participant> participantsList = new ArrayList<>();

View File

@ -66,6 +66,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandFootbox;
import net.sourceforge.plantuml.sequencediagram.command.CommandFootboxOld;
import net.sourceforge.plantuml.sequencediagram.command.CommandGrouping;
import net.sourceforge.plantuml.sequencediagram.command.CommandHSpace;
import net.sourceforge.plantuml.sequencediagram.command.CommandHideUnlinked;
import net.sourceforge.plantuml.sequencediagram.command.CommandIgnoreNewpage;
import net.sourceforge.plantuml.sequencediagram.command.CommandLinkAnchor;
import net.sourceforge.plantuml.sequencediagram.command.CommandNewpage;
@ -91,6 +92,7 @@ public class SequenceDiagramFactory extends PSystemCommandFactory {
final List<Command> cmds = new ArrayList<>();
addCommonCommands1(cmds);
cmds.add(new CommandHideUnlinked());
cmds.add(new CommandActivate());
cmds.add(new CommandDeactivateShort());

View File

@ -33,16 +33,18 @@
*
*
*/
package net.sourceforge.plantuml.command;
package net.sourceforge.plantuml.sequencediagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
public class CommandHideUnlinked extends SingleLineCommand2<UmlDiagram> {
public class CommandHideUnlinked extends SingleLineCommand2<SequenceDiagram> {
public CommandHideUnlinked() {
super(getRegexConcat());
@ -52,12 +54,12 @@ public class CommandHideUnlinked extends SingleLineCommand2<UmlDiagram> {
return RegexConcat.build(CommandHideUnlinked.class.getName(), RegexLeaf.start(), //
new RegexLeaf("HIDE", "(hide|show)"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("unlinked"), //
new RegexLeaf("@?unlinked"), //
RegexLeaf.end()); //
}
@Override
protected CommandExecutionResult executeArg(UmlDiagram diagram, LineLocation location, RegexResult arg) {
protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
diagram.setHideUnlinkedData(arg.get("HIDE", 0).equalsIgnoreCase("hide"));
return CommandExecutionResult.ok();
}

View File

@ -44,7 +44,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000;
public static int version() {
return 1202114;
return 1202115;
}
public static int versionPatched() {
@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 9;
final int beta = 0;
return beta;
}
@ -93,7 +93,7 @@ public class Version {
}
public static long compileTime() {
return 1636735610350L;
return 1638290734924L;
}
public static String compileTimeString() {