1
0
mirror of https://github.com/octoleo/plantuml.git synced 2025-04-02 00:01:52 +00:00

Import version 1.2021.1

This commit is contained in:
Arnaud Roques 2021-02-02 11:12:15 +01:00
parent 55f005f9bb
commit 0dc13cccf2
238 changed files with 1499 additions and 834 deletions

View File

@ -35,7 +35,7 @@
<groupId>net.sourceforge.plantuml</groupId> <groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml</artifactId> <artifactId>plantuml</artifactId>
<version>1.2021.1-SNAPSHOT</version> <version>1.2021.2-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>PlantUML</name> <name>PlantUML</name>

View File

@ -23,6 +23,7 @@ import java.util.StringTokenizer;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity; import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
/** /**
@ -302,8 +303,12 @@ public class ConfigParameters {
static private HColorSet colors = HColorSet.instance(); static private HColorSet colors = HColorSet.instance();
private Color decodeInternal(String value) { private Color decodeInternal(String value) {
if (colors.getColorIfValid(value)!=null) { if (value!=null) {
return new ColorMapperIdentity().toColor(colors.getColorIfValid(value)); try {
return new ColorMapperIdentity().toColor(colors.getColor(value, null));
} catch (NoSuchColorException e) {
return Color.WHITE;
}
} }
return Color.decode(value); return Color.decode(value);
} }

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.stats.StatsUtilsIncrement; import net.sourceforge.plantuml.stats.StatsUtilsIncrement;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.version.License; import net.sourceforge.plantuml.version.License;
import net.sourceforge.plantuml.version.Version; import net.sourceforge.plantuml.version.Version;
@ -126,7 +127,11 @@ public abstract class AbstractPSystem implements Diagram {
public CommandExecutionResult executeCommand(Command cmd, BlocLines lines) { public CommandExecutionResult executeCommand(Command cmd, BlocLines lines) {
cmd = new ProtectedCommand(cmd); cmd = new ProtectedCommand(cmd);
try {
return cmd.execute(this, lines); return cmd.execute(this, lines);
} catch (NoSuchColorException e) {
return CommandExecutionResult.badColor();
}
} }
public boolean hasUrl() { public boolean hasUrl() {

View File

@ -142,6 +142,8 @@ public enum ColorParam {
nodeBorder(HColorUtils.BLACK, ColorType.LINE), nodeBorder(HColorUtils.BLACK, ColorType.LINE),
rectangleBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), rectangleBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
rectangleBorder(HColorUtils.BLACK, ColorType.LINE), rectangleBorder(HColorUtils.BLACK, ColorType.LINE),
hexagonBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
hexagonBorder(HColorUtils.BLACK, ColorType.LINE),
archimateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), archimateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
archimateBorder(HColorUtils.BLACK, ColorType.LINE), archimateBorder(HColorUtils.BLACK, ColorType.LINE),
cardBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK), cardBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),

View File

@ -36,7 +36,7 @@
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
public enum CornerParam { public enum CornerParam {
DEFAULT, diagramBorder, titleBorder, rectangle, archimate, component, card, agent; DEFAULT, diagramBorder, titleBorder, rectangle, hexagon, archimate, component, card, agent;
public String getRoundKey() { public String getRoundKey() {
if (this == DEFAULT) { if (this == DEFAULT) {

View File

@ -83,6 +83,12 @@ public class EmbeddedDiagram implements CharSequence {
if (s.equals("{{json")) { if (s.equals("{{json")) {
return "json"; return "json";
} }
if (s.equals("{{yaml")) {
return "yaml";
}
if (s.equals("{{wire")) {
return "wire";
}
return null; return null;
} }

View File

@ -35,22 +35,27 @@
*/ */
package net.sourceforge.plantuml; package net.sourceforge.plantuml;
public class ErrorUml { public class ErrorUml {
private final String error; private final String error;
private final ErrorUmlType type; private final ErrorUmlType type;
private final LineLocation lineLocation; private final LineLocation lineLocation;
private final int score;
public ErrorUml(ErrorUmlType type, String error, LineLocation lineLocation) { public ErrorUml(ErrorUmlType type, String error, int score, LineLocation lineLocation) {
if (error == null || type == null) { if (error == null || type == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
this.score = score;
this.error = error; this.error = error;
this.type = type; this.type = type;
this.lineLocation = lineLocation; this.lineLocation = lineLocation;
} }
public int score() {
return score;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
final ErrorUml this2 = (ErrorUml) obj; final ErrorUml this2 = (ErrorUml) obj;

View File

@ -46,9 +46,8 @@ import java.io.IOException;
import net.sourceforge.plantuml.braille.BrailleCharFactory; import net.sourceforge.plantuml.braille.BrailleCharFactory;
import net.sourceforge.plantuml.braille.UGraphicBraille; import net.sourceforge.plantuml.braille.UGraphicBraille;
import net.sourceforge.plantuml.graphic.FontStyle;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.StyledString; import net.sourceforge.plantuml.graphic.StringBounderRaw;
import net.sourceforge.plantuml.png.MetadataTag; import net.sourceforge.plantuml.png.MetadataTag;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.svg.SvgGraphics; import net.sourceforge.plantuml.svg.SvgGraphics;
@ -116,12 +115,12 @@ public enum FileFormat {
} }
private StringBounder getSvgStringBounder(final SvgCharSizeHack charSizeHack) { private StringBounder getSvgStringBounder(final SvgCharSizeHack charSizeHack) {
return new StringBounder() { return new StringBounderRaw() {
public String toString() { public String toString() {
return "FileFormat::getSvgStringBounder"; return "FileFormat::getSvgStringBounder";
} }
public Dimension2D calculateDimension(UFont font, String text) { protected Dimension2D calculateDimensionInternal(UFont font, String text) {
text = charSizeHack.transformStringForSizeHack(text); text = charSizeHack.transformStringForSizeHack(text);
return getJavaDimension(font, text); return getJavaDimension(font, text);
} }
@ -130,13 +129,13 @@ public enum FileFormat {
} }
private StringBounder getNormalStringBounder() { private StringBounder getNormalStringBounder() {
return new StringBounder() { return new StringBounderRaw() {
@Override @Override
public String toString() { public String toString() {
return "FileFormat::getNormalStringBounder"; return "FileFormat::getNormalStringBounder";
} }
public Dimension2D calculateDimension(UFont font, String text) { protected Dimension2D calculateDimensionInternal(UFont font, String text) {
return getJavaDimension(font, text); return getJavaDimension(font, text);
} }
@ -144,30 +143,20 @@ public enum FileFormat {
} }
static private Dimension2DDouble getJavaDimension(UFont font, String text) { static private Dimension2DDouble getJavaDimension(UFont font, String text) {
double width = 0; final Font javaFont = font.getFont();
double height = 0;
for (StyledString styledString : StyledString.build(text)) {
final Font javaFont;
if (styledString.getStyle() == FontStyle.BOLD)
javaFont = font.bold().getFont();
else
javaFont = font.getFont();
final FontMetrics fm = gg.getFontMetrics(javaFont); final FontMetrics fm = gg.getFontMetrics(javaFont);
final Rectangle2D rect = fm.getStringBounds(styledString.getText(), gg); final Rectangle2D rect = fm.getStringBounds(text, gg);
width += rect.getWidth(); return new Dimension2DDouble(rect.getWidth(), rect.getHeight());
height = Math.max(height, rect.getHeight());
}
return new Dimension2DDouble(width, height);
} }
private StringBounder getBrailleStringBounder() { private StringBounder getBrailleStringBounder() {
return new StringBounder() { return new StringBounderRaw() {
@Override @Override
public String toString() { public String toString() {
return "FileFormat::getBrailleStringBounder"; return "FileFormat::getBrailleStringBounder";
} }
public Dimension2D calculateDimension(UFont font, String text) { protected Dimension2D calculateDimensionInternal(UFont font, String text) {
final int nb = BrailleCharFactory.build(text).size(); final int nb = BrailleCharFactory.build(text).size();
final double quanta = UGraphicBraille.QUANTA; final double quanta = UGraphicBraille.QUANTA;
final double height = 5 * quanta; final double height = 5 * quanta;
@ -178,13 +167,13 @@ public enum FileFormat {
} }
private StringBounder getTikzStringBounder(final TikzFontDistortion tikzFontDistortion) { private StringBounder getTikzStringBounder(final TikzFontDistortion tikzFontDistortion) {
return new StringBounder() { return new StringBounderRaw() {
@Override @Override
public String toString() { public String toString() {
return "FileFormat::getTikzStringBounder"; return "FileFormat::getTikzStringBounder";
} }
public Dimension2D calculateDimension(UFont font, String text) { protected Dimension2D calculateDimensionInternal(UFont font, String text) {
final Dimension2DDouble w1 = getJavaDimension(font.goTikz(-1), text); final Dimension2DDouble w1 = getJavaDimension(font.goTikz(-1), text);
final Dimension2DDouble w2 = getJavaDimension(font.goTikz(0), text); final Dimension2DDouble w2 = getJavaDimension(font.goTikz(0), text);
final Dimension2DDouble w3 = getJavaDimension(font.goTikz(1), text); final Dimension2DDouble w3 = getJavaDimension(font.goTikz(1), text);

View File

@ -44,7 +44,7 @@ public class FileSystem {
private final static FileSystem singleton = new FileSystem(); private final static FileSystem singleton = new FileSystem();
private final ThreadLocal<SFile> currentDir = new ThreadLocal<SFile>(); private ThreadLocal<String> currentDir = new ThreadLocal<String>();
private FileSystem() { private FileSystem() {
reset(); reset();
@ -55,24 +55,27 @@ public class FileSystem {
} }
public void setCurrentDir(SFile dir) { public void setCurrentDir(SFile dir) {
// if (dir == null) { if (dir == null) {
// throw new IllegalArgumentException(); this.currentDir.set(null);
// } } else {
if (dir != null) {
Log.info("Setting current dir: " + dir.getAbsolutePath()); Log.info("Setting current dir: " + dir.getAbsolutePath());
this.currentDir.set(dir.getAbsolutePath());
} }
this.currentDir.set(dir);
} }
public SFile getCurrentDir() { public SFile getCurrentDir() {
return this.currentDir.get(); final String path = this.currentDir.get();
if (path != null) {
return new SFile(path);
}
return null;
} }
public SFile getFile(String nameOrPath) throws IOException { public SFile getFile(String nameOrPath) throws IOException {
if (isAbsolute(nameOrPath)) { if (isAbsolute(nameOrPath)) {
return new SFile(nameOrPath).getCanonicalFile(); return new SFile(nameOrPath).getCanonicalFile();
} }
final SFile dir = currentDir.get(); final SFile dir = getCurrentDir();
SFile filecurrent = null; SFile filecurrent = null;
if (dir != null) { if (dir != null) {
filecurrent = dir.getAbsoluteFile().file(nameOrPath); filecurrent = dir.getAbsoluteFile().file(nameOrPath);

View File

@ -79,6 +79,8 @@ public enum FontParam {
ENTITY(14, Font.PLAIN), // ENTITY(14, Font.PLAIN), //
AGENT(14, Font.PLAIN), // AGENT(14, Font.PLAIN), //
RECTANGLE(14, Font.PLAIN), // RECTANGLE(14, Font.PLAIN), //
LABEL(14, Font.PLAIN), //
HEXAGON(14, Font.PLAIN), //
ARCHIMATE(14, Font.PLAIN), // ARCHIMATE(14, Font.PLAIN), //
CARD(14, Font.PLAIN), // CARD(14, Font.PLAIN), //
NODE(14, Font.PLAIN), // NODE(14, Font.PLAIN), //
@ -113,6 +115,8 @@ public enum FontParam {
ENTITY_STEREOTYPE(14, Font.ITALIC), // ENTITY_STEREOTYPE(14, Font.ITALIC), //
AGENT_STEREOTYPE(14, Font.ITALIC), // AGENT_STEREOTYPE(14, Font.ITALIC), //
RECTANGLE_STEREOTYPE(14, Font.ITALIC), // RECTANGLE_STEREOTYPE(14, Font.ITALIC), //
LABEL_STEREOTYPE(14, Font.ITALIC), //
HEXAGON_STEREOTYPE(14, Font.ITALIC), //
ARCHIMATE_STEREOTYPE(14, Font.ITALIC), // ARCHIMATE_STEREOTYPE(14, Font.ITALIC), //
CARD_STEREOTYPE(14, Font.ITALIC), // CARD_STEREOTYPE(14, Font.ITALIC), //
NODE_STEREOTYPE(14, Font.ITALIC), // NODE_STEREOTYPE(14, Font.ITALIC), //

View File

@ -61,7 +61,7 @@ public class GeneratedImageImpl implements GeneratedImage {
} }
public File getPngFile() { public File getPngFile() {
return pngFile.internal; return pngFile.conv();
} }
public String getDescription() { public String getDescription() {

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.svg.LengthAdjust;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public interface ISkinParam extends ISkinSimple { public interface ISkinParam extends ISkinSimple {
@ -68,7 +69,7 @@ public interface ISkinParam extends ISkinSimple {
public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable); public HColor getHtmlColor(ColorParam param, Stereotype stereotype, boolean clickable);
public Colors getColors(ColorParam param, Stereotype stereotype); public Colors getColors(ColorParam param, Stereotype stereotype) throws NoSuchColorException;
public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param); public HColor getFontHtmlColor(Stereotype stereotype, FontParam... param);

View File

@ -55,6 +55,7 @@ public enum LineParam {
titleBorder, titleBorder,
diagramBorder, diagramBorder,
rectangleBorder, rectangleBorder,
hexagonBorder,
archimateBorder, archimateBorder,
componentBorder, componentBorder,
cardBorder, cardBorder,

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramDescription; import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.ImageData; import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class NewpagedDiagram extends AbstractPSystem { public class NewpagedDiagram extends AbstractPSystem {
@ -74,6 +75,7 @@ public class NewpagedDiagram extends AbstractPSystem {
public CommandExecutionResult executeCommand(Command cmd, BlocLines lines) { public CommandExecutionResult executeCommand(Command cmd, BlocLines lines) {
final int nb = diagrams.size(); final int nb = diagrams.size();
try {
final CommandExecutionResult tmp = cmd.execute(diagrams.get(nb - 1), lines); final CommandExecutionResult tmp = cmd.execute(diagrams.get(nb - 1), lines);
if (tmp.getNewDiagram() instanceof NewpagedDiagram) { if (tmp.getNewDiagram() instanceof NewpagedDiagram) {
final NewpagedDiagram new1 = (NewpagedDiagram) tmp.getNewDiagram(); final NewpagedDiagram new1 = (NewpagedDiagram) tmp.getNewDiagram();
@ -90,6 +92,9 @@ public class NewpagedDiagram extends AbstractPSystem {
} }
return tmp; return tmp;
} catch (NoSuchColorException e) {
return CommandExecutionResult.badColor();
}
} }
private int size() { private int size() {

View File

@ -118,7 +118,7 @@ public class PSystemBuilder {
// Dead code : should not append // Dead code : should not append
assert false; assert false;
Log.error("Preprocessor Error: " + s.getPreprocessorError()); Log.error("Preprocessor Error: " + s.getPreprocessorError());
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, s.getPreprocessorError(), /* cpt */ final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, s.getPreprocessorError(), 0,
s.getLocation()); s.getLocation());
return PSystemErrorUtils.buildV2(umlSource, err, Collections.<String>emptyList(), source); return PSystemErrorUtils.buildV2(umlSource, err, Collections.<String>emptyList(), source);
} }

View File

@ -85,6 +85,7 @@ import net.sourceforge.plantuml.ugraphic.color.ColorOrder;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class SkinParam implements ISkinParam { public class SkinParam implements ISkinParam {
@ -316,8 +317,8 @@ public class SkinParam implements ISkinParam {
checkStereotype(stereotype); checkStereotype(stereotype);
for (String s : stereotype.getMultipleLabels()) { for (String s : stereotype.getMultipleLabels()) {
final String value2 = getValue(param.name() + "color" + "<<" + s + ">>"); final String value2 = getValue(param.name() + "color" + "<<" + s + ">>");
if (value2 != null && getIHtmlColorSet().getColorIfValid(value2) != null) { if (value2 != null && getIHtmlColorSet().getColorOrWhite(value2) != null) {
return getIHtmlColorSet().getColorIfValid(value2); return getIHtmlColorSet().getColorOrWhite(value2);
} }
} }
} }
@ -330,12 +331,12 @@ public class SkinParam implements ISkinParam {
return HColorUtils.transparent(); return HColorUtils.transparent();
} }
if (param == ColorParam.background) { if (param == ColorParam.background) {
return getIHtmlColorSet().getColorIfValid(value); return getIHtmlColorSet().getColorOrWhite(value);
} }
assert param != ColorParam.background; assert param != ColorParam.background;
// final boolean acceptTransparent = param == ColorParam.background // final boolean acceptTransparent = param == ColorParam.background
// || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground; // || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground;
return getIHtmlColorSet().getColorIfValid(value, getBackgroundColor(false)); return getIHtmlColorSet().getColorOrWhite(value, getBackgroundColor(false));
} }
public char getCircledCharacter(Stereotype stereotype) { public char getCircledCharacter(Stereotype stereotype) {
@ -349,11 +350,11 @@ public class SkinParam implements ISkinParam {
return 0; return 0;
} }
public Colors getColors(ColorParam param, Stereotype stereotype) { public Colors getColors(ColorParam param, Stereotype stereotype) throws NoSuchColorException {
if (stereotype != null) { if (stereotype != null) {
checkStereotype(stereotype); checkStereotype(stereotype);
final String value2 = getValue(param.name() + "color" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR)); final String value2 = getValue(param.name() + "color" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null && getIHtmlColorSet().getColorIfValid(value2) != null) { if (value2 != null) {
return new Colors(value2, getIHtmlColorSet(), param.getColorType()); return new Colors(value2, getIHtmlColorSet(), param.getColorType());
} }
} }
@ -430,16 +431,19 @@ public class SkinParam implements ISkinParam {
value = getFirstValueNonNullWithSuffix("fontcolor" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR), value = getFirstValueNonNullWithSuffix("fontcolor" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR),
param); param);
} }
if (value == null || getIHtmlColorSet().getColorIfValid(value) == null) { if (value == null) {
value = getFirstValueNonNullWithSuffix("fontcolor", param); value = getFirstValueNonNullWithSuffix("fontcolor", param);
} }
if (value == null || getIHtmlColorSet().getColorIfValid(value) == null) { if (value == null) {
value = getValue("defaultfontcolor"); value = getValue("defaultfontcolor");
} }
if (value == null || getIHtmlColorSet().getColorIfValid(value) == null) { if (value == null) {
value = param[0].getDefaultColor(); value = param[0].getDefaultColor();
} }
return getIHtmlColorSet().getColorIfValid(value); if (value == null) {
return null;
}
return getIHtmlColorSet().getColorOrWhite(value);
} }
private String getFirstValueNonNullWithSuffix(String suffix, FontParam... param) { private String getFirstValueNonNullWithSuffix(String suffix, FontParam... param) {
@ -1130,8 +1134,9 @@ public class SkinParam implements ISkinParam {
margin = Integer.parseInt(marginString); margin = Integer.parseInt(marginString);
} }
return new SplitParam(getIHtmlColorSet().getColorIfValid(border), getIHtmlColorSet().getColorIfValid(external), final HColor borderColor = border == null ? null : getIHtmlColorSet().getColorOrWhite(border);
margin); final HColor externalColor = external == null ? null : getIHtmlColorSet().getColorOrWhite(external);
return new SplitParam(borderColor, externalColor, margin);
} }
public int swimlaneWidth() { public int swimlaneWidth() {
@ -1154,7 +1159,7 @@ public class SkinParam implements ISkinParam {
if (value == null) { if (value == null) {
return null; return null;
} }
return getIHtmlColorSet().getColorIfValid(value, null); return getIHtmlColorSet().getColorOrWhite(value, null);
} }
public double getPadding() { public double getPadding() {
@ -1232,8 +1237,8 @@ public class SkinParam implements ISkinParam {
if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) { if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) {
return Padder.NONE; return Padder.NONE;
} }
final HColor border = getIHtmlColorSet().getColorIfValid(borderColor); final HColor border = borderColor == null ? null : getIHtmlColorSet().getColorOrWhite(borderColor);
final HColor background = getIHtmlColorSet().getColorIfValid(backgroundColor); final HColor background = backgroundColor == null ? null : getIHtmlColorSet().getColorOrWhite(backgroundColor);
final double roundCorner = getRoundCorner(CornerParam.DEFAULT, null); final double roundCorner = getRoundCorner(CornerParam.DEFAULT, null);
return Padder.NONE.withMargin(margin).withPadding(padding).withBackgroundColor(background) return Padder.NONE.withMargin(margin).withPadding(padding).withBackgroundColor(background)
.withBorderColor(border).withRoundCorner(roundCorner); .withBorderColor(border).withRoundCorner(roundCorner);

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper; import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class SkinParamDelegator implements ISkinParam { public class SkinParamDelegator implements ISkinParam {
@ -245,7 +246,7 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getMonospacedFamily(); return skinParam.getMonospacedFamily();
} }
public Colors getColors(ColorParam param, Stereotype stereotype) { public Colors getColors(ColorParam param, Stereotype stereotype) throws NoSuchColorException {
return skinParam.getColors(param, stereotype); return skinParam.getColors(param, stereotype);
} }

View File

@ -182,11 +182,8 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
} catch (UnparsableGraphvizException e) { } catch (UnparsableGraphvizException e) {
e.printStackTrace(); e.printStackTrace();
exportDiagramError(os, e.getCause(), fileFormatOption, seed, e.getGraphvizVersion()); exportDiagramError(os, e.getCause(), fileFormatOption, seed, e.getGraphvizVersion());
} catch (Exception e) { } catch (Throwable e) {
e.printStackTrace(); //e.printStackTrace();
exportDiagramError(os, e, fileFormatOption, seed, null);
} catch (Error e) {
e.printStackTrace();
exportDiagramError(os, e, fileFormatOption, seed, null); exportDiagramError(os, e, fileFormatOption, seed, null);
} }
return ImageDataSimple.error(); return ImageDataSimple.error();

View File

@ -67,6 +67,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> { public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
@ -121,7 +122,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final IEntity entity1 = getEntity(diagram, arg, true); final IEntity entity1 = getEntity(diagram, arg, true);
if (entity1 == null) { if (entity1 == null) {
return CommandExecutionResult.error("No such activity"); return CommandExecutionResult.error("No such activity");
@ -130,8 +131,9 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
entity1.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0))); entity1.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0)));
} }
if (arg.get("BACKCOLOR", 0) != null) { if (arg.get("BACKCOLOR", 0) != null) {
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet() String s = arg.get("BACKCOLOR", 0);
.getColorIfValid(arg.get("BACKCOLOR", 0))); entity1.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
} }
final IEntity entity2 = getEntity(diagram, arg, false); final IEntity entity2 = getEntity(diagram, arg, false);
@ -139,8 +141,9 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
return CommandExecutionResult.error("No such activity"); return CommandExecutionResult.error("No such activity");
} }
if (arg.get("BACKCOLOR2", 0) != null) { if (arg.get("BACKCOLOR2", 0) != null) {
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet() String s = arg.get("BACKCOLOR2", 0);
.getColorIfValid(arg.get("BACKCOLOR2", 0))); entity2.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
} }
if (arg.get("STEREOTYPE2", 0) != null) { if (arg.get("STEREOTYPE2", 0) != null) {
entity2.setStereotype(new Stereotype(arg.get("STEREOTYPE2", 0))); entity2.setStereotype(new Stereotype(arg.get("STEREOTYPE2", 0)));
@ -163,7 +166,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
type = type.goDotted(); type = type.goDotted();
} }
Link link = new Link(entity1, entity2, type, linkLabel, lenght, diagram.getSkinParam().getCurrentStyleBuilder()); Link link = new Link(entity1, entity2, type, linkLabel, lenght,
diagram.getSkinParam().getCurrentStyleBuilder());
if (arrowDirection.contains("*")) { if (arrowDirection.contains("*")) {
link.setConstraint(false); link.setConstraint(false);
} }
@ -215,8 +219,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
} }
final Ident ident = diagram.buildLeafIdent(idShort); final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, ident) : getTypeIfExisting(diagram, final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, ident)
code); : getTypeIfExisting(diagram, code);
IEntity result; IEntity result;
if (diagram.V1972()) { if (diagram.V1972()) {
result = diagram.getLeafVerySmart(ident); result = diagram.getLeafVerySmart(ident);
@ -252,8 +256,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
} }
final Ident quotedIdent = diagram.buildLeafIdent(quotedString); final Ident quotedIdent = diagram.buildLeafIdent(quotedString);
final Code quotedCode = diagram.V1972() ? quotedIdent : diagram.buildCode(quotedString); final Code quotedCode = diagram.V1972() ? quotedIdent : diagram.buildCode(quotedString);
final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, quotedIdent) : getTypeIfExisting( final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, quotedIdent)
diagram, quotedCode); : getTypeIfExisting(diagram, quotedCode);
final IEntity result = diagram.getOrCreate(quotedIdent, quotedCode, Display.getWithNewlines(quoted.get(0)), final IEntity result = diagram.getOrCreate(quotedIdent, quotedCode, Display.getWithNewlines(quoted.get(0)),
type); type);
if (partition != null) { if (partition != null) {

View File

@ -70,6 +70,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram> { public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram> {
@ -114,7 +115,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
} }
@Override @Override
protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) { protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.trim(); lines = lines.trim();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
@ -128,8 +129,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
} }
final String stringColor = line0.get("BACKCOLOR", 0); final String stringColor = line0.get("BACKCOLOR", 0);
if (stringColor != null) { if (stringColor != null) {
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet() entity1.setSpecificColorTOBEREMOVED(ColorType.BACK,
.getColorIfValid(stringColor)); diagram.getSkinParam().getIHtmlColorSet().getColor(stringColor));
} }
final StringBuilder sb = new StringBuilder(); final StringBuilder sb = new StringBuilder();
@ -157,8 +158,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
} }
} }
final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()), lines.getLast() final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()),
.getString()); lines.getLast().getString());
if (StringUtils.isNotEmpty(lineLast.get(0))) { if (StringUtils.isNotEmpty(lineLast.get(0))) {
if (sb.length() > 0 && sb.toString().endsWith(BackSlash.BS_BS_N) == false) { if (sb.length() > 0 && sb.toString().endsWith(BackSlash.BS_BS_N) == false) {
sb.append(BackSlash.BS_BS_N); sb.append(BackSlash.BS_BS_N);
@ -197,8 +198,9 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
entity2.setStereotype(new Stereotype(lineLast.get(2))); entity2.setStereotype(new Stereotype(lineLast.get(2)));
} }
if (lineLast.get(4) != null) { if (lineLast.get(4) != null) {
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet() String s = lineLast.get(4);
.getColorIfValid(lineLast.get(4))); entity2.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
} }
final String arrowBody1 = CommandLinkClass.notNull(line0.get("ARROW_BODY1", 0)); final String arrowBody1 = CommandLinkClass.notNull(line0.get("ARROW_BODY1", 0));
@ -215,7 +217,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
if (arrow.contains(".")) { if (arrow.contains(".")) {
type = type.goDotted(); type = type.goDotted();
} }
Link link = new Link(entity1, entity2, type, linkLabel, lenght, diagram.getSkinParam().getCurrentStyleBuilder()); Link link = new Link(entity1, entity2, type, linkLabel, lenght,
diagram.getSkinParam().getCurrentStyleBuilder());
final Direction direction = StringUtils.getArrowDirection(arrowBody1 + arrowDirection + arrowBody2 + ">"); final Direction direction = StringUtils.getArrowDirection(arrowBody1 + arrowDirection + arrowBody2 + ">");
if (direction == Direction.LEFT || direction == Direction.UP) { if (direction == Direction.LEFT || direction == Direction.UP) {
link = link.getInv(); link = link.getInv();

View File

@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandPartition extends SingleLineCommand2<ActivityDiagram> { public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
@ -84,7 +85,7 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0)); final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
final Ident ident = diagram.buildLeafIdent(idShort); final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
@ -101,7 +102,8 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final Url url; final Url url;
if (arg.get("URL", 0) == null) { if (arg.get("URL", 0) == null) {
@ -119,7 +121,8 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground); colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground);
} }
final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0)); final BoxStyle style = BoxStyle.fromChar(arg.get("STYLE", 0).charAt(0));
diagram.addActivity(Display.getWithNewlines(arg.get("LABEL", 0)), style, url, colors, stereotype); final Display display = Display.getWithNewlines2(arg.get("LABEL", 0));
diagram.addActivity(display, style, url, colors, stereotype);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> { public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
@ -73,7 +74,7 @@ public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
@ -67,7 +68,7 @@ public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String colorString = arg.get("COLOR", 0); final String colorString = arg.get("COLOR", 0);
if (colorString != null) { if (colorString != null) {

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> { public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
@ -72,7 +73,7 @@ public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) { protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)); // final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
@ -85,7 +86,7 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final BoxStyle boxStyle; final BoxStyle boxStyle;
final String styleString = arg.get("STYLE", 0); final String styleString = arg.get("STYLE", 0);
@ -103,7 +104,7 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
return diagram.backward(label, boxStyle, in, out); return diagram.backward(label, boxStyle, in, out);
} }
static public LinkRendering getBackRendering(ActivityDiagram3 diagram, RegexResult arg, String name) { static public LinkRendering getBackRendering(ActivityDiagram3 diagram, RegexResult arg, String name) throws NoSuchColorException {
final LinkRendering in; final LinkRendering in;
final Rainbow incomingColor = getRainbow(name + "_COLOR", diagram, arg); final Rainbow incomingColor = getRainbow(name + "_COLOR", diagram, arg);
if (incomingColor == null) if (incomingColor == null)
@ -114,7 +115,7 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
return in.withDisplay(Display.getWithNewlines(label)); return in.withDisplay(Display.getWithNewlines(label));
} }
static private Rainbow getRainbow(String key, ActivityDiagram3 diagram, RegexResult arg) { static private Rainbow getRainbow(String key, ActivityDiagram3 diagram, RegexResult arg) throws NoSuchColorException {
final String colorString = arg.get(key, 0); final String colorString = arg.get(key, 0);
if (colorString == null) { if (colorString == null) {
return null; return null;

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCircleSpot3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandCircleSpot3 extends SingleLineCommand2<ActivityDiagram3> {
@ -61,8 +62,9 @@ public class CommandCircleSpot3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
diagram.addSpot(arg.get("SPOT", 0), color); diagram.addSpot(arg.get("SPOT", 0), color);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr; import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandElse3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandElse3 extends SingleLineCommand2<ActivityDiagram3> {
@ -71,7 +72,7 @@ public class CommandElse3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
// if (getSystem().getLastEntityConsulted() == null) { // if (getSystem().getLastEntityConsulted() == null) {
// return CommandExecutionResult.error("No if for this endif"); // return CommandExecutionResult.error("No if for this endif");
// } // }

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> { public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
@ -95,8 +96,9 @@ public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
String test = arg.get("TEST", 0); String test = arg.get("TEST", 0);
if (test.length() == 0) { if (test.length() == 0) {

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> { public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
@ -78,8 +79,9 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
String test = arg.get("TEST", 0); String test = arg.get("TEST", 0);
if (test.length() == 0) { if (test.length() == 0) {

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> { public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
@ -75,8 +76,9 @@ public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
String test = arg.get("TEST", 0); String test = arg.get("TEST", 0);
if (test.length() == 0) { if (test.length() == 0) {

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
@ -62,8 +63,9 @@ public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (color != null) { if (color != null) {
diagram.setColorNextArrow(Rainbow.fromColor(color, null)); diagram.setColorNextArrow(Rainbow.fromColor(color, null));
} }

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
@ -75,7 +76,7 @@ public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final Display note = Display.getWithNewlines(arg.get("NOTE", 0)); final Display note = Display.getWithNewlines(arg.get("NOTE", 0));
final NotePosition position = NotePosition.defaultLeft(arg.get("POSITION", 0)); final NotePosition position = NotePosition.defaultLeft(arg.get("POSITION", 0));

View File

@ -50,6 +50,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteType; import net.sourceforge.plantuml.sequencediagram.NoteType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> { public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
@ -67,7 +68,7 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) { protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) throws NoSuchColorException {
// final List<? extends CharSequence> in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1)); // final List<? extends CharSequence> in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1));
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
@ -118,7 +119,7 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String partitionTitle = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0)); final String partitionTitle = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
final String b1 = arg.get("BACK1", 0); final String b1 = arg.get("BACK1", 0);

View File

@ -52,6 +52,7 @@ import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
@ -76,8 +77,9 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
final BoxStyle boxStyle; final BoxStyle boxStyle;
final String styleString = arg.get("STYLE", 0); final String styleString = arg.get("STYLE", 0);

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.Rainbow;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
@ -100,7 +101,7 @@ public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final Display test = Display.getWithNewlines(arg.getLazzy("TEST", 0)); final Display test = Display.getWithNewlines(arg.getLazzy("TEST", 0));
final Display yes = Display.getWithNewlines(arg.getLazzy("WHEN", 0)); final Display yes = Display.getWithNewlines(arg.getLazzy("WHEN", 0));
final Display out = Display.getWithNewlines(arg.getLazzy("OUT", 0)); final Display out = Display.getWithNewlines(arg.getLazzy("OUT", 0));

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> { public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
@ -64,8 +65,9 @@ public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final String name = arg.get("SWIMLANE", 0); final String name = arg.get("SWIMLANE", 0);
final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
return diagram.swimlane(name, color, label); return diagram.swimlane(name, color, label);

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> { public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
@ -72,8 +73,9 @@ public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final String name = arg.get("SWIMLANE", 0); final String name = arg.get("SWIMLANE", 0);
final Display label = Display.getWithNewlines(arg.get("LABEL", 0)); final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
return diagram.swimlane(name, color, label); return diagram.swimlane(name, color, label);

View File

@ -46,6 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandSwitch extends SingleLineCommand2<ActivityDiagram3> { public class CommandSwitch extends SingleLineCommand2<ActivityDiagram3> {
@ -66,8 +67,9 @@ public class CommandSwitch extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
String test = arg.get("TEST", 0); String test = arg.get("TEST", 0);
if (test.length() == 0) { if (test.length() == 0) {

View File

@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> { public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
@ -72,8 +73,9 @@ public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)); final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
diagram.doWhile(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("YES", 0)), color); diagram.doWhile(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("YES", 0)), color);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -74,6 +74,7 @@ import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature; import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class VCompactFactory implements FtileFactory { public class VCompactFactory implements FtileFactory {
@ -111,16 +112,19 @@ public class VCompactFactory implements FtileFactory {
} }
public Ftile stop(Swimlane swimlane) { public Ftile stop(Swimlane swimlane) {
final HColor backColor = skinParam.getBackgroundColor(false);
final HColor borderColor; final HColor borderColor;
Style style = null; Style style = null;
final HColor backgroundColor;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
// backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor(false);
} else { } else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd); borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
backgroundColor = skinParam.getBackgroundColor(false);
} }
return new FtileCircleStop(skinParam(), backColor, borderColor, swimlane, style); return new FtileCircleStop(skinParam(), backgroundColor, borderColor, swimlane, style);
} }
public Ftile spot(Swimlane swimlane, String spot, HColor color) { public Ftile spot(Swimlane swimlane, String spot, HColor color) {
@ -131,16 +135,19 @@ public class VCompactFactory implements FtileFactory {
} }
public Ftile end(Swimlane swimlane) { public Ftile end(Swimlane swimlane) {
final HColor backColor = skinParam.getBackgroundColor(false);
final HColor borderColor; final HColor borderColor;
Style style = null; Style style = null;
final HColor backgroundColor;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder()); style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()); borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
// backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor(false);
} else { } else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd); borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
backgroundColor = skinParam.getBackgroundColor(false);
} }
return new FtileCircleEnd(skinParam(), backColor, borderColor, swimlane, style); return new FtileCircleEnd(skinParam(), backgroundColor, borderColor, swimlane, style);
} }
public Ftile activity(Display label, Swimlane swimlane, BoxStyle boxStyle, Colors colors, Stereotype stereotype) { public Ftile activity(Display label, Swimlane swimlane, BoxStyle boxStyle, Colors colors, Stereotype stereotype) {

View File

@ -59,8 +59,8 @@ public class FtileCircleEnd extends AbstractFtile {
private static final int SIZE = 20; private static final int SIZE = 20;
private final HColor backColor;
private final HColor borderColor; private final HColor borderColor;
private final HColor backColor;
private final Swimlane swimlane; private final Swimlane swimlane;
private double shadowing; private double shadowing;
@ -71,8 +71,8 @@ public class FtileCircleEnd extends AbstractFtile {
public FtileCircleEnd(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, Style style) { public FtileCircleEnd(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, Style style) {
super(skinParam); super(skinParam);
this.backColor = backColor;
this.borderColor = borderColor; this.borderColor = borderColor;
this.backColor = backColor;
this.swimlane = swimlane; this.swimlane = swimlane;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
this.shadowing = style.value(PName.Shadowing).asDouble(); this.shadowing = style.value(PName.Shadowing).asDouble();
@ -108,8 +108,8 @@ public class FtileCircleEnd extends AbstractFtile {
circle.setDeltaShadow(shadowing); circle.setDeltaShadow(shadowing);
ug = ug.apply(borderColor); ug = ug.apply(borderColor);
final double thickness = 2.5; final double thickness = 2.5;
ug.apply(backColor.bg()).apply(new UStroke(1.5)) ug.apply(backColor.bg()).apply(new UStroke(1.5)).apply(new UTranslate(xTheoricalPosition, yTheoricalPosition))
.apply(new UTranslate(xTheoricalPosition, yTheoricalPosition)).draw(circle); .draw(circle);
final double size2 = (SIZE - thickness) / Math.sqrt(2); final double size2 = (SIZE - thickness) / Math.sqrt(2);
final double delta = (SIZE - size2) / 2; final double delta = (SIZE - size2) / 2;

View File

@ -52,13 +52,14 @@ import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorMiddle;
public class FtileCircleStop extends AbstractFtile { public class FtileCircleStop extends AbstractFtile {
private static final int SIZE = 22; private static final int SIZE = 22;
private final HColor backColor;
private final HColor borderColor; private final HColor borderColor;
private final HColor backColor;
private final Swimlane swimlane; private final Swimlane swimlane;
private double shadowing; private double shadowing;
@ -69,8 +70,8 @@ public class FtileCircleStop extends AbstractFtile {
public FtileCircleStop(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, Style style) { public FtileCircleStop(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, Style style) {
super(skinParam); super(skinParam);
this.backColor = backColor;
this.borderColor = borderColor; this.borderColor = borderColor;
this.backColor = backColor;
this.swimlane = swimlane; this.swimlane = swimlane;
if (UseStyle.useBetaStyle()) { if (UseStyle.useBetaStyle()) {
this.shadowing = style.value(PName.Shadowing).asDouble(); this.shadowing = style.value(PName.Shadowing).asDouble();
@ -99,15 +100,16 @@ public class FtileCircleStop extends AbstractFtile {
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
final UEllipse circle = new UEllipse(SIZE, SIZE); final UEllipse circle = new UEllipse(SIZE, SIZE);
circle.setDeltaShadow(shadowing); circle.setDeltaShadow(shadowing);
ug = ug.apply(borderColor);
ug.apply(backColor.bg()).draw(circle); ug.apply(borderColor).apply(backColor.bg()).draw(circle);
final double delta = 5; final double delta = 5;
final UEllipse circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2); final UEllipse circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2);
// if (skinParam().shadowing(null)) { // if (skinParam().shadowing(null)) {
// circleSmall.setDeltaShadow(3); // circleSmall.setDeltaShadow(3);
// } // }
ug.apply(borderColor.bg()).apply(new UTranslate(delta, delta)).draw(circleSmall); ug.apply(new HColorMiddle(borderColor, backColor)).apply(borderColor.bg()).apply(new UTranslate(delta, delta))
.draw(circleSmall);
} }
@Override @Override

View File

@ -68,10 +68,10 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
this.maxAsciiMessageLength = maxAsciiMessageLength; this.maxAsciiMessageLength = maxAsciiMessageLength;
this.type = type; this.type = type;
this.config = config; this.config = config;
this.stringsToDisplay = clean(stringsToDisplay); this.stringsToDisplay = cleanAndManageBoldNumber(stringsToDisplay, fileFormat);
} }
private Display clean(Display orig) { public static Display cleanAndManageBoldNumber(Display orig, FileFormat fileFormat) {
if (orig.size() == 0 || orig.get(0) instanceof MessageNumber == false) { if (orig.size() == 0 || orig.get(0) instanceof MessageNumber == false) {
return orig; return orig;
} }
@ -79,7 +79,7 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
for (int i = 0; i < orig.size(); i++) { for (int i = 0; i < orig.size(); i++) {
CharSequence element = orig.get(i); CharSequence element = orig.get(i);
if (i == 1) { if (i == 1) {
element = removeTag(orig.get(0).toString()) + " " + element; element = removeTagAndManageBoldNumber(orig.get(0).toString(), fileFormat) + " " + element;
} }
if (i != 0) { if (i != 0) {
result = result.add(element); result = result.add(element);
@ -88,7 +88,7 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
return result; return result;
} }
private String removeTag(String s) { private static String removeTagAndManageBoldNumber(String s, FileFormat fileFormat) {
if (fileFormat == FileFormat.UTXT) { if (fileFormat == FileFormat.UTXT) {
final Pattern pattern = Pattern.compile("\\<b\\>([0-9]+)\\</b\\>"); final Pattern pattern = Pattern.compile("\\<b\\>([0-9]+)\\</b\\>");
final Matcher matcher = pattern.matcher(s); final Matcher matcher = pattern.matcher(s);

View File

@ -60,7 +60,7 @@ public class ComponentTextSelfArrow extends AbstractComponentText implements Arr
public ComponentTextSelfArrow(ComponentType type, ArrowConfiguration config, Display stringsToDisplay, public ComponentTextSelfArrow(ComponentType type, ArrowConfiguration config, Display stringsToDisplay,
FileFormat fileFormat) { FileFormat fileFormat) {
this.type = type; this.type = type;
this.stringsToDisplay = stringsToDisplay; this.stringsToDisplay = ComponentTextArrow.cleanAndManageBoldNumber(stringsToDisplay, fileFormat);
this.fileFormat = fileFormat; this.fileFormat = fileFormat;
this.config = config; this.config = config;
} }

View File

@ -38,12 +38,12 @@ package net.sourceforge.plantuml.asciiart;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounderRaw;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
public class TextStringBounder implements StringBounder { public class TextStringBounder extends StringBounderRaw {
public Dimension2D calculateDimension(UFont font, String text) { protected Dimension2D calculateDimensionInternal(UFont font, String text) {
final int length1 = text.codePointCount(0, text.length()); final int length1 = text.codePointCount(0, text.length());
final int length2 = text.length(); final int length2 = text.length();
final int length3 = Wcwidth.length(text); final int length3 = Wcwidth.length(text);

View File

@ -92,9 +92,9 @@ public class UmlCharAreaImpl extends BasicCharAreaImpl implements UmlCharArea {
x = 0; x = 0;
} }
for (CharSequence s : strings) { for (CharSequence s : strings) {
if (s instanceof MessageNumber) { // if (s instanceof MessageNumber) {
s = StringUtils.toInternalBoldNumber((((MessageNumber) s).getNumberRaw())); // s = StringUtils.toInternalBoldNumber((((MessageNumber) s).getNumberRaw()));
} // }
this.drawStringLR(s.toString(), x, y + i); this.drawStringLR(s.toString(), x, y + i);
i++; i++;
} }

View File

@ -54,7 +54,7 @@ public class BrailleDrawer implements UDrawable {
} }
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
ug = ug.apply(HColorSet.instance().getColorIfValid("#F0F0F0")); ug = ug.apply(HColorSet.instance().getColorOrWhite("#F0F0F0"));
for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) { for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) {
ug.apply(UTranslate.dx(x * step + spotSize + 1)).draw( ug.apply(UTranslate.dx(x * step + spotSize + 1)).draw(
ULine.vline((grid.getMaxY() - grid.getMinY()) * step)); ULine.vline((grid.getMaxY() - grid.getMinY()) * step));

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> { public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
@ -123,7 +124,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0))); final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0)));
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0), final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0),
"\"([:"); "\"([:");
@ -172,8 +173,9 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
entity.setCodeLine(location); entity.setCodeLine(location);
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null) { if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor); colors = colors.add(ColorType.LINE, lineColor);
} }

View File

@ -68,6 +68,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagram> { public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagram> {
@ -142,7 +143,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
} }
@Override @Override
protected CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) { protected CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.trimSmart(1); lines = lines.trimSmart(1);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
final IEntity entity = executeArg0(diagram, line0); final IEntity entity = executeArg0(diagram, line0);
@ -220,7 +221,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
} }
} }
private IEntity executeArg0(ClassDiagram diagram, RegexResult arg) { private IEntity executeArg0(ClassDiagram diagram, RegexResult arg) throws NoSuchColorException {
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0))); final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0)));
final String visibilityString = arg.get("VISIBILITY", 0); final String visibilityString = arg.get("VISIBILITY", 0);
@ -276,8 +277,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
} }
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)); final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (lineColor != null) { if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor); colors = colors.add(ColorType.LINE, lineColor);
} }

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementFull;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram> { public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram> {
@ -151,7 +152,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
} }
@Override @Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
if (mode == Mode.NORMAL_KEYWORD && diagram.isAllowMixing() == false) { if (mode == Mode.NORMAL_KEYWORD && diagram.isAllowMixing() == false) {
return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements."); return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements.");
} }
@ -209,9 +210,9 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
entity.setDisplay(Display.getWithNewlines(display)); entity.setDisplay(Display.getWithNewlines(display));
entity.setUSymbol(usymbol); entity.setUSymbol(usymbol);
if (stereotype != null) { if (stereotype != null) {
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam() diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
.getIHtmlColorSet())); diagram.getSkinParam().getIHtmlColorSet()));
} }
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
@ -221,9 +222,10 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
final Url url = urlBuilder.getUrl(urlString); final Url url = urlBuilder.getUrl(urlString);
entity.addUrl(url); entity.addUrl(url);
} }
final String s = arg.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -62,6 +62,7 @@ import net.sourceforge.plantuml.descdiagram.command.Labels;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram; import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrObjectDiagram> { final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
@ -132,7 +133,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
@Override @Override
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location, protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) { RegexResult arg) throws NoSuchColorException {
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""); final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""); final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
@ -331,7 +332,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
} }
} }
private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg) { private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg) throws NoSuchColorException {
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\""); final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\""); final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final IEntity cl1 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent1String)) final IEntity cl1 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent1String))

View File

@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandStereotype extends SingleLineCommand2<ClassDiagram> { public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
@ -64,7 +65,7 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String name = arg.get("NAME", 0); final String name = arg.get("NAME", 0);
final Ident ident = diagram.buildLeafIdent(name); final Ident ident = diagram.buildLeafIdent(name);
final Code code = diagram.V1972() ? ident : diagram.buildCode(name); final Code code = diagram.V1972() ? ident : diagram.buildCode(name);

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated; import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class BlocLines implements Iterable<StringLocated> { public class BlocLines implements Iterable<StringLocated> {
@ -92,7 +93,7 @@ public class BlocLines implements Iterable<StringLocated> {
this.lines = Collections.unmodifiableList(lines); this.lines = Collections.unmodifiableList(lines);
} }
public Display toDisplay() { public Display toDisplay() throws NoSuchColorException {
return Display.createFoo(lines); return Display.createFoo(lines);
} }

View File

@ -36,10 +36,11 @@
package net.sourceforge.plantuml.command; package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public interface Command<D extends Diagram> { public interface Command<D extends Diagram> {
CommandExecutionResult execute(D diagram, BlocLines lines); CommandExecutionResult execute(D diagram, BlocLines lines) throws NoSuchColorException;
CommandControl isValid(BlocLines lines); CommandControl isValid(BlocLines lines);

View File

@ -45,15 +45,18 @@ public class CommandExecutionResult {
private final String error; private final String error;
private final AbstractPSystem newDiagram; private final AbstractPSystem newDiagram;
private final List<String> debugLines; private final List<String> debugLines;
private final int score;
private CommandExecutionResult(String error, AbstractPSystem newDiagram, List<String> debugLines) { private CommandExecutionResult(AbstractPSystem newDiagram, String error, int score, List<String> debugLines) {
this.error = error; this.error = error;
this.newDiagram = newDiagram; this.newDiagram = newDiagram;
this.debugLines = debugLines; this.debugLines = debugLines;
this.score = score;
} }
public CommandExecutionResult withDiagram(AbstractPSystem newDiagram) { public CommandExecutionResult withDiagram(AbstractPSystem newDiagram) {
return new CommandExecutionResult(error, newDiagram, null); return new CommandExecutionResult(newDiagram, error, 0, null);
} }
@Override @Override
@ -62,19 +65,23 @@ public class CommandExecutionResult {
} }
public static CommandExecutionResult newDiagram(AbstractPSystem result) { public static CommandExecutionResult newDiagram(AbstractPSystem result) {
return new CommandExecutionResult(null, result, null); return new CommandExecutionResult(result, null, 0, null);
} }
public static CommandExecutionResult ok() { public static CommandExecutionResult ok() {
return new CommandExecutionResult(null, null, null); return new CommandExecutionResult(null, null, 0, null);
}
public static CommandExecutionResult badColor() {
return new CommandExecutionResult(null, "No such color", 1, null);
} }
public static CommandExecutionResult error(String error) { public static CommandExecutionResult error(String error) {
return new CommandExecutionResult(error, null, null); return new CommandExecutionResult(null, error, 0, null);
} }
public static CommandExecutionResult error(String error, Throwable t) { public static CommandExecutionResult error(String error, Throwable t) {
return new CommandExecutionResult(error, null, getStackTrace(t)); return new CommandExecutionResult(null, error, 0, getStackTrace(t));
} }
public static List<String> getStackTrace(Throwable exception) { public static List<String> getStackTrace(Throwable exception) {
@ -106,6 +113,10 @@ public class CommandExecutionResult {
return error; return error;
} }
public int getScore() {
return score;
}
public AbstractPSystem getNewDiagram() { public AbstractPSystem getNewDiagram() {
return newDiagram; return newDiagram;
} }

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern; import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public abstract class CommandMultilines2<S extends Diagram> implements Command<S> { public abstract class CommandMultilines2<S extends Diagram> implements Command<S> {
@ -106,10 +107,14 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
if (syntaxWithFinalBracket()) { if (syntaxWithFinalBracket()) {
lines = lines.eventuallyMoveBracket(); lines = lines.eventuallyMoveBracket();
} }
try {
return executeNow(system, lines); return executeNow(system, lines);
} catch (NoSuchColorException e) {
return CommandExecutionResult.badColor();
}
} }
protected abstract CommandExecutionResult executeNow(S system, BlocLines lines); protected abstract CommandExecutionResult executeNow(S system, BlocLines lines) throws NoSuchColorException;
protected boolean isCommandForbidden() { protected boolean isCommandForbidden() {
return false; return false;

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesCaption extends CommandMultilines<TitledDiagram> { public class CommandMultilinesCaption extends CommandMultilines<TitledDiagram> {
@ -52,7 +53,7 @@ public class CommandMultilinesCaption extends CommandMultilines<TitledDiagram> {
return "(?i)^end[%s]?caption$"; return "(?i)^end[%s]?caption$";
} }
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) { public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
final Display strings = lines.toDisplay(); final Display strings = lines.toDisplay();

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> { public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {
@ -54,7 +55,7 @@ public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {
return "(?i)^end[%s]?footer$"; return "(?i)^end[%s]?footer$";
} }
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) { public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.trim(); lines = lines.trim();
final Matcher2 m = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final Matcher2 m = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
if (m.find() == false) { if (m.find() == false) {

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.command.regex.Matcher2; import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> { public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {
@ -54,7 +55,7 @@ public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {
return "(?i)^end[%s]?header$"; return "(?i)^end[%s]?header$";
} }
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) { public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.trim(); lines = lines.trim();
final Matcher2 m = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final Matcher2 m = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
if (m.find() == false) { if (m.find() == false) {

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesLegend extends CommandMultilines2<TitledDiagram> { public class CommandMultilinesLegend extends CommandMultilines2<TitledDiagram> {
@ -73,7 +74,7 @@ public class CommandMultilinesLegend extends CommandMultilines2<TitledDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeNow(TitledDiagram diagram, BlocLines lines) { protected CommandExecutionResult executeNow(TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.trimSmart(1); lines = lines.trimSmart(1);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
final String align = line0.get("ALIGN", 0); final String align = line0.get("ALIGN", 0);

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned; import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMultilinesTitle extends CommandMultilines<TitledDiagram> { public class CommandMultilinesTitle extends CommandMultilines<TitledDiagram> {
@ -52,7 +53,7 @@ public class CommandMultilinesTitle extends CommandMultilines<TitledDiagram> {
return "(?i)^end[%s]?title$"; return "(?i)^end[%s]?title$";
} }
public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) { public CommandExecutionResult execute(final TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
final Display strings = lines.toDisplay(); final Display strings = lines.toDisplay();

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandNamespace extends SingleLineCommand2<ClassDiagram> { public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
@ -77,7 +78,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String idShort = arg.get("NAME", 0); final String idShort = arg.get("NAME", 0);
final Code code; final Code code;
final IGroup currentPackage; final IGroup currentPackage;
@ -109,7 +110,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
final String color = arg.get("COLOR", 0); final String color = arg.get("COLOR", 0);
if (color != null) { if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK, p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); diagram.getSkinParam().getIHtmlColorSet().getColor(color));
} }
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> { public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
@ -85,7 +86,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String idShort = arg.get("NAME", 0); final String idShort = arg.get("NAME", 0);
final Ident ident = diagram.buildLeafIdent(idShort); final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
@ -109,7 +110,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
final String color = arg.get("COLOR", 0); final String color = arg.get("COLOR", 0);
if (color != null) { if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK, p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); diagram.getSkinParam().getIHtmlColorSet().getColor(color));
} }
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -54,6 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> { public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
@ -80,7 +81,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String idShort = arg.get("NAME", 0); final String idShort = arg.get("NAME", 0);
final Ident idNewLong = diagram.buildLeafIdent(idShort); final Ident idNewLong = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? idNewLong : diagram.buildCode(idShort); final Code code = diagram.V1972() ? idNewLong : diagram.buildCode(idShort);
@ -103,7 +104,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
final String color = arg.get("COLOR", 0); final String color = arg.get("COLOR", 0);
if (color != null) { if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK, p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); diagram.getSkinParam().getIHtmlColorSet().getColor(color));
} }
diagram.endGroup(); diagram.endGroup();
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -60,6 +60,7 @@ import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.utils.UniqueSequence; import net.sourceforge.plantuml.utils.UniqueSequence;
public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> { public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
@ -101,7 +102,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
} }
@Override @Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String idShort; final String idShort;
/* final */String display; /* final */String display;
final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0)); final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));

View File

@ -51,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.Ident; import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.utils.UniqueSequence; import net.sourceforge.plantuml.utils.UniqueSequence;
public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagram> { public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagram> {
@ -81,7 +82,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
} }
@Override @Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String idShort; final String idShort;
final String display; final String display;
if (arg.get("CODE", 0) == null) { if (arg.get("CODE", 0) == null) {
@ -105,7 +106,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
final String color = arg.get("COLOR", 0); final String color = arg.get("COLOR", 0);
if (color != null) { if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK, p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color)); diagram.getSkinParam().getIHtmlColorSet().getColor(color));
} }
diagram.endGroup(); diagram.endGroup();
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();

View File

@ -58,7 +58,7 @@ public abstract class PSystemAbstractFactory implements PSystemFactory {
final protected PSystemError buildEmptyError(UmlSource source, LineLocation lineLocation, final protected PSystemError buildEmptyError(UmlSource source, LineLocation lineLocation,
List<StringLocated> trace) { List<StringLocated> trace) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, EMPTY_DESCRIPTION, lineLocation); final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, EMPTY_DESCRIPTION, 0, lineLocation);
final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace); final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace);
result.setSource(source); result.setSource(source);
return result; return result;
@ -66,7 +66,7 @@ public abstract class PSystemAbstractFactory implements PSystemFactory {
final protected PSystemError buildExecutionError(UmlSource source, String stringError, LineLocation lineLocation, final protected PSystemError buildExecutionError(UmlSource source, String stringError, LineLocation lineLocation,
List<StringLocated> trace) { List<StringLocated> trace) {
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, stringError, lineLocation); final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, stringError, 0, lineLocation);
final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace); final PSystemError result = PSystemErrorUtils.buildV2(source, err, null, trace);
result.setSource(source); result.setSource(source);
return result; return result;

View File

@ -89,7 +89,7 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
} }
system = executeLine(system, s.getString()); system = executeLine(system, s.getString());
if (system == null) { if (system == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", s.getLocation()); final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation());
// return PSystemErrorUtils.buildV1(source, err, null); // return PSystemErrorUtils.buildV1(source, err, null);
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace()); return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
} }

View File

@ -120,15 +120,16 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
private AbstractPSystem executeFewLines(AbstractPSystem sys, UmlSource source, final IteratorCounter2 it) { private AbstractPSystem executeFewLines(AbstractPSystem sys, UmlSource source, final IteratorCounter2 it) {
final Step step = getCandidate(it); final Step step = getCandidate(it);
if (step == null) { if (step == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", it.peek().getLocation()); final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, it.peek().getLocation());
it.next(); it.next();
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace()); return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
} }
final CommandExecutionResult result = sys.executeCommand(step.command, step.blocLines); final CommandExecutionResult result = sys.executeCommand(step.command, step.blocLines);
if (result.isOk() == false) { if (result.isOk() == false) {
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(), final LineLocation location = ((StringLocated) step.blocLines.getFirst()).getLocation();
((StringLocated) step.blocLines.getFirst()).getLocation()); final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(), result.getScore(),
location);
sys = PSystemErrorUtils.buildV2(source, err, result.getDebugLines(), it.getTrace()); sys = PSystemErrorUtils.buildV2(source, err, result.getDebugLines(), it.getTrace());
} }
if (result.getNewDiagram() != null) { if (result.getNewDiagram() != null) {

View File

@ -80,7 +80,7 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
} }
final AbstractPSystem sys = executeLine(s.getString()); final AbstractPSystem sys = executeLine(s.getString());
if (sys == null) { if (sys == null) {
final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", s.getLocation()); final ErrorUml err = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, "Syntax Error?", 0, s.getLocation());
// return PSystemErrorUtils.buildV1(source, err, null); // return PSystemErrorUtils.buildV1(source, err, null);
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace()); return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
} }

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.core.Diagram; import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.error.PSystemError; import net.sourceforge.plantuml.error.PSystemError;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public abstract class SingleLineCommand2<S extends Diagram> implements Command<S> { public abstract class SingleLineCommand2<S extends Diagram> implements Command<S> {
@ -146,13 +147,18 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
} }
// System.err.println("lines="+lines); // System.err.println("lines="+lines);
// System.err.println("pattern="+pattern.getPattern()); // System.err.println("pattern="+pattern.getPattern());
try {
return executeArg(system, first.getLocation(), arg); return executeArg(system, first.getLocation(), arg);
} catch (NoSuchColorException e) {
return CommandExecutionResult.badColor();
}
} }
protected boolean isForbidden(CharSequence line) { protected boolean isForbidden(CharSequence line) {
return false; return false;
} }
protected abstract CommandExecutionResult executeArg(S system, LineLocation location, RegexResult arg); protected abstract CommandExecutionResult executeArg(S system, LineLocation location, RegexResult arg)
throws NoSuchColorException;
} }

View File

@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public final class CommandConstraintOnLinks extends SingleLineCommand2<CucaDiagram> { public final class CommandConstraintOnLinks extends SingleLineCommand2<CucaDiagram> {
@ -76,7 +77,7 @@ public final class CommandConstraintOnLinks extends SingleLineCommand2<CucaDiagr
} }
@Override @Override
protected CommandExecutionResult executeArg(CucaDiagram diagram, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(CucaDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final List<Link> links = diagram.getTwoLastLinks(); final List<Link> links = diagram.getTwoLastLinks();
if (links == null) { if (links == null) {
return CommandExecutionResult.error("Cannot put constraint on two last links"); return CommandExecutionResult.error("Cannot put constraint on two last links");

View File

@ -55,6 +55,7 @@ import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public final class CommandFactoryNote implements SingleMultiFactoryCommand<AbstractEntityDiagram> { public final class CommandFactoryNote implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
@ -98,7 +99,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
@Override @Override
protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location, protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location,
RegexResult arg) { RegexResult arg) throws NoSuchColorException {
final String display = arg.get("DISPLAY", 0); final String display = arg.get("DISPLAY", 0);
return executeInternal(system, arg, BlocLines.getWithNewlines(display)); return executeInternal(system, arg, BlocLines.getWithNewlines(display));
} }
@ -115,7 +116,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
return "(?i)^[%s]*end[%s]?note$"; return "(?i)^[%s]*end[%s]?note$";
} }
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) { protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) throws NoSuchColorException {
// StringUtils.trim(lines, false); // StringUtils.trim(lines, false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
@ -125,7 +126,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
}; };
} }
private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display) { private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display) throws NoSuchColorException {
final String idShort = arg.get("CODE", 0); final String idShort = arg.get("CODE", 0);
final Ident ident = diagram.buildLeafIdent(idShort); final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort); final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
@ -135,8 +136,9 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
} }
final IEntity entity = diagram.createLeaf(ident, code, display.toDisplay(), LeafType.NOTE, null); final IEntity entity = diagram.createLeaf(ident, code, display.toDisplay(), LeafType.NOTE, null);
assert entity != null; assert entity != null;
final String s = arg.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -62,6 +62,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.utils.UniqueSequence; import net.sourceforge.plantuml.utils.UniqueSequence;
public final class CommandFactoryNoteActivity implements SingleMultiFactoryCommand<ActivityDiagram> { public final class CommandFactoryNoteActivity implements SingleMultiFactoryCommand<ActivityDiagram> {
@ -98,7 +99,7 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
return "(?i)^[%s]*end[%s]?note$"; return "(?i)^[%s]*end[%s]?note$";
} }
public final CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) { public final CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) throws NoSuchColorException {
// StringUtils.trim(lines, true); // StringUtils.trim(lines, true);
final RegexResult arg = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult arg = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
@ -135,7 +136,7 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
@Override @Override
protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location, protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location,
RegexResult arg) { RegexResult arg) throws NoSuchColorException {
final String tmp = UniqueSequence.getString("GN"); final String tmp = UniqueSequence.getString("GN");
final Ident ident = diagram.buildLeafIdent(tmp); final Ident ident = diagram.buildLeafIdent(tmp);
final Code code = diagram.V1972() ? ident : diagram.buildCode(tmp); final Code code = diagram.V1972() ? ident : diagram.buildCode(tmp);
@ -145,10 +146,11 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
}; };
} }
private CommandExecutionResult executeInternal(ActivityDiagram diagram, RegexResult arg, IEntity note) { private CommandExecutionResult executeInternal(ActivityDiagram diagram, RegexResult arg, IEntity note) throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
note.setSpecificColorTOBEREMOVED(ColorType.BACK, note.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
IEntity activity = diagram.getLastEntityConsulted(); IEntity activity = diagram.getLastEntityConsulted();
if (activity == null) { if (activity == null) {
@ -157,8 +159,8 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
final Link link; final Link link;
final Position position = Position.valueOf(StringUtils.goUpperCase(arg.get("POSITION", 0))).withRankdir( final Position position = Position.valueOf(StringUtils.goUpperCase(arg.get("POSITION", 0)))
diagram.getSkinParam().getRankdir()); .withRankdir(diagram.getSkinParam().getRankdir());
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).goDashed(); final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).goDashed();

View File

@ -69,6 +69,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.utils.UniqueSequence; import net.sourceforge.plantuml.utils.UniqueSequence;
public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryCommand<AbstractEntityDiagram> { public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
@ -165,7 +166,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
@Override @Override
protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location, protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location,
RegexResult arg) { RegexResult arg) throws NoSuchColorException {
final String s = arg.get("NOTE", 0); final String s = arg.get("NOTE", 0);
return executeInternal(arg, system, null, BlocLines.getWithNewlines(s)); return executeInternal(arg, system, null, BlocLines.getWithNewlines(s));
} }
@ -184,7 +185,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
return "(?i)^[%s]*(end[%s]?note)$"; return "(?i)^[%s]*(end[%s]?note)$";
} }
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) { protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) throws NoSuchColorException {
// StringUtils.trim(lines, false); // StringUtils.trim(lines, false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
@ -203,7 +204,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
} }
private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url, private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url,
BlocLines strings) { BlocLines strings) throws NoSuchColorException {
final String pos = line0.get("POSITION", 0); final String pos = line0.get("POSITION", 0);

View File

@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand<CucaDiagram> { public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand<CucaDiagram> {
@ -101,7 +102,7 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
return "(?i)^end[%s]?note$"; return "(?i)^end[%s]?note$";
} }
protected CommandExecutionResult executeNow(final CucaDiagram system, BlocLines lines) { protected CommandExecutionResult executeNow(final CucaDiagram system, BlocLines lines) throws NoSuchColorException {
final String line0 = lines.getFirst().getTrimmed().getString(); final String line0 = lines.getFirst().getTrimmed().getString();
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
@ -119,14 +120,14 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
return new SingleLineCommand2<CucaDiagram>(getRegexConcatSingleLine()) { return new SingleLineCommand2<CucaDiagram>(getRegexConcatSingleLine()) {
@Override @Override
protected CommandExecutionResult executeArg(final CucaDiagram system, LineLocation location, RegexResult arg) { protected CommandExecutionResult executeArg(final CucaDiagram system, LineLocation location, RegexResult arg) throws NoSuchColorException {
final BlocLines note = BlocLines.getWithNewlines(arg.get("NOTE", 0)); final BlocLines note = BlocLines.getWithNewlines(arg.get("NOTE", 0));
return executeInternal(system, note, arg); return executeInternal(system, note, arg);
} }
}; };
} }
private CommandExecutionResult executeInternal(CucaDiagram diagram, BlocLines note, final RegexResult arg) { private CommandExecutionResult executeInternal(CucaDiagram diagram, BlocLines note, final RegexResult arg) throws NoSuchColorException {
final Link link = diagram.getLastLink(); final Link link = diagram.getLastLink();
if (link == null) { if (link == null) {
return CommandExecutionResult.error("No link defined"); return CommandExecutionResult.error("No link defined");

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType; import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public final class CommandFactoryTipOnEntity implements SingleMultiFactoryCommand<AbstractEntityDiagram> { public final class CommandFactoryTipOnEntity implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
@ -121,7 +122,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
return "(?i)^[%s]*(end[%s]?note)$"; return "(?i)^[%s]*(end[%s]?note)$";
} }
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) { protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) throws NoSuchColorException {
// StringUtils.trim(lines, false); // StringUtils.trim(lines, false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
@ -140,7 +141,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
} }
private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url, private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url,
BlocLines lines) { BlocLines lines) throws NoSuchColorException {
final String pos = line0.get("POSITION", 0); final String pos = line0.get("POSITION", 0);

View File

@ -61,6 +61,7 @@ import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.NoteStyle;
import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactoryCommand<SequenceDiagram> { public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
@ -108,7 +109,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
@Override @Override
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location, protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
RegexResult arg) { RegexResult arg) throws NoSuchColorException {
final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0)); final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0));
return executeInternal(system, arg, strings); return executeInternal(system, arg, strings);
@ -126,7 +127,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
return "(?i)^end[%s]?(note|hnote|rnote)$"; return "(?i)^end[%s]?(note|hnote|rnote)$";
} }
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) { protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
@ -136,7 +137,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
}; };
} }
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) { private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) throws NoSuchColorException {
// final Participant p1 = diagram.getOrCreateParticipant(StringUtils // final Participant p1 = diagram.getOrCreateParticipant(StringUtils
// .eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0))); // .eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));
// final Participant p2 = diagram.getOrCreateParticipant(StringUtils // final Participant p2 = diagram.getOrCreateParticipant(StringUtils

View File

@ -63,6 +63,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.NoteStyle;
import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public final class FactorySequenceNoteCommand implements SingleMultiFactoryCommand<SequenceDiagram> { public final class FactorySequenceNoteCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
@ -119,7 +120,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
return "(?i)^end[%s]?(note|hnote|rnote)$"; return "(?i)^end[%s]?(note|hnote|rnote)$";
} }
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) { protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
@ -133,14 +134,14 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
@Override @Override
protected CommandExecutionResult executeArg(final SequenceDiagram diagram, LineLocation location, protected CommandExecutionResult executeArg(final SequenceDiagram diagram, LineLocation location,
RegexResult arg) { RegexResult arg) throws NoSuchColorException {
return executeInternal(diagram, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0))); return executeInternal(diagram, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0)));
} }
}; };
} }
private CommandExecutionResult executeInternal(SequenceDiagram diagram, RegexResult arg, BlocLines strings) { private CommandExecutionResult executeInternal(SequenceDiagram diagram, RegexResult arg, BlocLines strings) throws NoSuchColorException {
final Participant p = diagram.getOrCreateParticipant(StringUtils final Participant p = diagram.getOrCreateParticipant(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0))); .eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0)));

View File

@ -66,6 +66,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.NoteStyle;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFactoryCommand<SequenceDiagram> { public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
@ -106,7 +107,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
@Override @Override
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location, protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
RegexResult arg) { RegexResult arg) throws NoSuchColorException {
return executeInternal(system, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0))); return executeInternal(system, arg, BlocLines.getWithNewlines(arg.get("NOTE", 0)));
} }
@ -122,7 +123,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
return "(?i)^[%s]*end[%s]?note$"; return "(?i)^[%s]*end[%s]?note$";
} }
protected CommandExecutionResult executeNow(final SequenceDiagram diagram, BlocLines lines) { protected CommandExecutionResult executeNow(final SequenceDiagram diagram, BlocLines lines) throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
@ -132,7 +133,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
}; };
} }
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) { private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) throws NoSuchColorException {
final EventWithDeactivate m = diagram.getLastEventWithDeactivate(); final EventWithDeactivate m = diagram.getLastEventWithDeactivate();
if (m instanceof AbstractMessage || m instanceof GroupingLeaf) { if (m instanceof AbstractMessage || m instanceof GroupingLeaf) {
final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0))); final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0)));
@ -145,7 +146,8 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0)); final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0));
final Display display = diagram.manageVariable(lines.toDisplay()); final Display display = diagram.manageVariable(lines.toDisplay());
final String backcolor0 = line0.get("COLOR", 0); final String backcolor0 = line0.get("COLOR", 0);
Colors colors = Colors.empty().add(ColorType.BACK, HColorSet.instance().getColorIfValid(backcolor0)); Colors colors = Colors.empty().add(ColorType.BACK,
backcolor0 == null ? null : HColorSet.instance().getColor(backcolor0));
final Note note = new Note(display, position, style, diagram.getSkinParam().getCurrentStyleBuilder()); final Note note = new Note(display, position, style, diagram.getSkinParam().getCurrentStyleBuilder());
final String stereotypeString = line0.get("STEREO", 0); final String stereotypeString = line0.get("STEREO", 0);
if (stereotypeString != null) { if (stereotypeString != null) {

View File

@ -62,6 +62,7 @@ import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.NoteStyle;
import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiFactoryCommand<SequenceDiagram> { public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
@ -123,7 +124,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
@Override @Override
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location, protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
RegexResult arg) { RegexResult arg) throws NoSuchColorException {
final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0)); final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0));
return executeInternal(system, arg, strings); return executeInternal(system, arg, strings);
@ -141,7 +142,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
return "(?i)^end[%s]?(note|hnote|rnote)$"; return "(?i)^end[%s]?(note|hnote|rnote)$";
} }
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) { protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1); lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns(); lines = lines.removeEmptyColumns();
@ -151,7 +152,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
}; };
} }
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) { private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) throws NoSuchColorException {
final Participant p1 = diagram.getOrCreateParticipant(StringUtils final Participant p1 = diagram.getOrCreateParticipant(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0))); .eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));
final Participant p2 = diagram.getOrCreateParticipant(StringUtils final Participant p2 = diagram.getOrCreateParticipant(StringUtils

View File

@ -102,7 +102,7 @@ public class CommandLinkBlock extends SingleLineCommand2<CompositeDiagram> {
private LinkDecor getLinkDecor(String s) { private LinkDecor getLinkDecor(String s) {
if ("[]".equals(s)) { if ("[]".equals(s)) {
return LinkDecor.SQUARRE_toberemoved; return LinkDecor.SQUARE_toberemoved;
} }
return LinkDecor.NONE; return LinkDecor.NONE;
} }

View File

@ -42,6 +42,8 @@ import net.sourceforge.plantuml.creole.legacy.StripeSimple;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
public class CommandCreoleColorAndSizeChange implements Command { public class CommandCreoleColorAndSizeChange implements Command {
@ -70,7 +72,7 @@ public class CommandCreoleColorAndSizeChange implements Command {
return m.group(1).length(); return m.group(1).length();
} }
public String executeAndGetRemaining(String line, StripeSimple stripe) { public String executeAndGetRemaining(String line, StripeSimple stripe) throws NoSuchColorRuntimeException {
final Matcher2 m = pattern.matcher(line); final Matcher2 m = pattern.matcher(line);
if (m.find() == false) { if (m.find() == false) {
throw new IllegalStateException(); throw new IllegalStateException();
@ -84,8 +86,10 @@ public class CommandCreoleColorAndSizeChange implements Command {
if (m.group(2) != null) { if (m.group(2) != null) {
fc2 = fc2.changeSize(Integer.parseInt(m.group(2))); fc2 = fc2.changeSize(Integer.parseInt(m.group(2)));
} }
try {
if (m.group(3) != null) { if (m.group(3) != null) {
final HColor color = HColorSet.instance().getColorIfValid(m.group(3)); final String s = m.group(3);
final HColor color = HColorSet.instance().getColor(s);
fc2 = fc2.changeColor(color); fc2 = fc2.changeColor(color);
} }
@ -93,5 +97,8 @@ public class CommandCreoleColorAndSizeChange implements Command {
stripe.analyzeAndAdd(m.group(4)); stripe.analyzeAndAdd(m.group(4));
stripe.setActualFontConfiguration(fc1); stripe.setActualFontConfiguration(fc1);
return line.substring(m.group(1).length()); return line.substring(m.group(1).length());
} catch (NoSuchColorException e) {
throw new NoSuchColorRuntimeException();
}
} }
} }

View File

@ -43,6 +43,8 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.Splitter; import net.sourceforge.plantuml.graphic.Splitter;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
public class CommandCreoleColorChange implements Command { public class CommandCreoleColorChange implements Command {
@ -69,18 +71,23 @@ public class CommandCreoleColorChange implements Command {
return m.group(2).length(); return m.group(2).length();
} }
public String executeAndGetRemaining(String line, StripeSimple stripe) { public String executeAndGetRemaining(String line, StripeSimple stripe) throws NoSuchColorRuntimeException {
final Matcher2 m = pattern.matcher(line); final Matcher2 m = pattern.matcher(line);
if (m.find() == false) { if (m.find() == false) {
throw new IllegalStateException(); throw new IllegalStateException();
} }
final FontConfiguration fc1 = stripe.getActualFontConfiguration(); final FontConfiguration fc1 = stripe.getActualFontConfiguration();
final HColor color = HColorSet.instance().getColorIfValid(m.group(2)); final String s = m.group(2);
try {
final HColor color = HColorSet.instance().getColor(s);
final FontConfiguration fc2 = fc1.changeColor(color); final FontConfiguration fc2 = fc1.changeColor(color);
stripe.setActualFontConfiguration(fc2); stripe.setActualFontConfiguration(fc2);
stripe.analyzeAndAdd(m.group(3)); stripe.analyzeAndAdd(m.group(3));
stripe.setActualFontConfiguration(fc1); stripe.setActualFontConfiguration(fc1);
return line.substring(m.group(1).length()); return line.substring(m.group(1).length());
} catch (NoSuchColorException e) {
throw new NoSuchColorRuntimeException();
}
} }
} }

View File

@ -76,7 +76,7 @@ public class CommandCreoleOpenIcon implements Command {
final String colorName = Parser.getColor(m.group(3)); final String colorName = Parser.getColor(m.group(3));
HColor color = null; HColor color = null;
if (colorName != null) { if (colorName != null) {
color = colorSet.getColorIfValid(colorName); color = colorSet.getColorOrWhite(colorName);
} }
stripe.addOpenIcon(src, scale, color); stripe.addOpenIcon(src, scale, color);
return line.substring(m.group(1).length()); return line.substring(m.group(1).length());

View File

@ -76,7 +76,7 @@ public class CommandCreoleSprite implements Command {
final String colorName = Parser.getColor(m.group(3)); final String colorName = Parser.getColor(m.group(3));
HColor color = null; HColor color = null;
if (colorName != null) { if (colorName != null) {
color = colorSet.getColorIfValid(colorName); color = colorSet.getColorOrWhite(colorName);
} }
stripe.addSprite(src, scale, color); stripe.addSprite(src, scale, color);
return line.substring(m.group(1).length()); return line.substring(m.group(1).length());

View File

@ -40,6 +40,7 @@ import java.util.List;
import net.sourceforge.plantuml.EmbeddedDiagram; import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.SpriteContainerEmpty;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.creole.CreoleContext; import net.sourceforge.plantuml.creole.CreoleContext;
import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleMode;
@ -52,6 +53,9 @@ import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
public class CreoleParser implements SheetBuilder { public class CreoleParser implements SheetBuilder {
@ -144,4 +148,14 @@ public class CreoleParser implements SheetBuilder {
} }
return sheet; return sheet;
} }
public static void checkColor(Display result) throws NoSuchColorException {
FontConfiguration fc = FontConfiguration.blackBlueTrue(UFont.byDefault(10));
try {
new CreoleParser(fc, HorizontalAlignment.LEFT, new SpriteContainerEmpty(), CreoleMode.FULL, fc)
.createSheet(result);
} catch (NoSuchColorRuntimeException e) {
throw new NoSuchColorException();
}
}
} }

View File

@ -106,7 +106,8 @@ public class StripeTable implements Stripe {
} }
final String[] color = line.substring(idx1, idx2).split(","); final String[] color = line.substring(idx1, idx2).split(",");
if (idx < color.length) { if (idx < color.length) {
return skinParam.getIHtmlColorSet().getColorIfValid(color[idx]); final String s = color[idx];
return s == null ? null : skinParam.getIHtmlColorSet().getColorOrWhite(s);
} }
} }
return null; return null;

View File

@ -40,6 +40,8 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.EmbeddedDiagram; import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
@ -76,7 +78,6 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
ILeaf entity, Style style) { ILeaf entity, Style style) {
super(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), super(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
new FontConfiguration(skinParam, fontParam, stereotype)); new FontConfiguration(skinParam, fontParam, stereotype));
this.style = style; this.style = style;
this.rawBody2 = Display.create(rawBody); this.rawBody2 = Display.create(rawBody);
this.stereotype = stereotype; this.stereotype = stereotype;
@ -118,6 +119,7 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
} }
private static boolean isTreeOrTable(String s) { private static boolean isTreeOrTable(String s) {
s = StringUtils.trinNoTrace(s);
return Parser.isTreeStart(s) || CreoleParser.isTableLine(s); return Parser.isTreeStart(s) || CreoleParser.isTableLine(s);
} }
@ -199,11 +201,17 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
private static List<CharSequence> buildTreeOrTable(String init, ListIterator<CharSequence> it) { private static List<CharSequence> buildTreeOrTable(String init, ListIterator<CharSequence> it) {
final List<CharSequence> result = new ArrayList<CharSequence>(); final List<CharSequence> result = new ArrayList<CharSequence>();
result.add(init); final Pattern p = Pattern.compile("^(\\s+)");
final Matcher m = p.matcher(init);
String start = "";
if (m.find()) {
start = m.group(1);
}
result.add(purge(init, start));
while (it.hasNext()) { while (it.hasNext()) {
final CharSequence s = it.next(); String s = it.next().toString();
if (isTreeOrTable(StringUtils.trinNoTrace(s))) { if (isTreeOrTable(s)) {
result.add(s); result.add(purge(s, start));
} else { } else {
it.previous(); it.previous();
return result; return result;
@ -213,6 +221,13 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
return result; return result;
} }
private static String purge(String s, String start) {
if (s.startsWith(start)) {
return s.substring(start.length());
}
return s;
}
public Ports getPorts(StringBounder stringBounder) { public Ports getPorts(StringBounder stringBounder) {
final TextBlock area = getArea(stringBounder); final TextBlock area = getArea(stringBounder);
if (area instanceof WithPorts) { if (area instanceof WithPorts) {

View File

@ -59,7 +59,6 @@ public class BodyEnhanced2 extends BodyEnhancedAbstract {
BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple skinParam, HorizontalAlignment align, BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple skinParam, HorizontalAlignment align,
FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy) { FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy) {
super(align, titleConfig); super(align, titleConfig);
this.rawBody = rawBody; this.rawBody = rawBody;
this.lineBreakStrategy = lineBreakStrategy; this.lineBreakStrategy = lineBreakStrategy;
this.skinParam = skinParam; this.skinParam = skinParam;

View File

@ -64,6 +64,7 @@ import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2; import net.sourceforge.plantuml.creole.SheetBlock2;
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
import net.sourceforge.plantuml.graphic.CircledCharacter; import net.sourceforge.plantuml.graphic.CircledCharacter;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -78,6 +79,7 @@ import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class Display implements Iterable<CharSequence> { public class Display implements Iterable<CharSequence> {
@ -150,12 +152,14 @@ public class Display implements Iterable<CharSequence> {
return create(Arrays.asList(s)); return create(Arrays.asList(s));
} }
public static Display createFoo(List<StringLocated> data) { public static Display createFoo(List<StringLocated> data) throws NoSuchColorException {
final List<CharSequence> tmp = new ArrayList<CharSequence>(); final List<CharSequence> tmp = new ArrayList<CharSequence>();
for (StringLocated s : data) { for (StringLocated s : data) {
tmp.add(s.getString()); tmp.add(s.getString());
} }
return create(tmp); final Display result = create(tmp);
CreoleParser.checkColor(result);
return result;
} }
public static Display create(Collection<? extends CharSequence> other) { public static Display create(Collection<? extends CharSequence> other) {
@ -166,6 +170,12 @@ public class Display implements Iterable<CharSequence> {
return getWithNewlines(s.getName()); return getWithNewlines(s.getName());
} }
public static Display getWithNewlines2(String s) throws NoSuchColorException {
final Display result = getWithNewlines(s);
CreoleParser.checkColor(result);
return result;
}
public static Display getWithNewlines(String s) { public static Display getWithNewlines(String s) {
if (s == null) { if (s == null) {
// Thread.dumpStack(); // Thread.dumpStack();

View File

@ -206,7 +206,7 @@ public class GroupRoot implements IGroup {
} }
public SingleStrategy getSingleStrategy() { public SingleStrategy getSingleStrategy() {
return SingleStrategy.SQUARRE; return SingleStrategy.SQUARE;
} }
public boolean isRemoved() { public boolean isRemoved() {

View File

@ -54,7 +54,7 @@ import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryLineCrowfoot;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryNotNavigable; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryNotNavigable;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryParenthesis; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryParenthesis;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryPlus; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryPlus;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactorySquarre; import net.sourceforge.plantuml.svek.extremity.ExtremityFactorySquare;
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryTriangle; import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryTriangle;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -73,7 +73,7 @@ public enum LinkDecor {
CIRCLE(0, false, 0.5), CIRCLE_FILL(0, false, 0.5), CIRCLE_CONNECT(0, false, 0.5), CIRCLE(0, false, 0.5), CIRCLE_FILL(0, false, 0.5), CIRCLE_CONNECT(0, false, 0.5),
PARENTHESIS(0, false, OptionFlags.USE_INTERFACE_EYE2 ? 0.5 : 1.0), SQUARE(0, false, 0.5), PARENTHESIS(0, false, OptionFlags.USE_INTERFACE_EYE2 ? 0.5 : 1.0), SQUARE(0, false, 0.5),
CIRCLE_CROSS(0, false, 0.5), PLUS(0, false, 1.5), HALF_ARROW(0, false, 1.5), SQUARRE_toberemoved(30, false, 0); CIRCLE_CROSS(0, false, 0.5), PLUS(0, false, 1.5), HALF_ARROW(0, false, 1.5), SQUARE_toberemoved(30, false, 0);
private final double arrowSize; private final double arrowSize;
private final int margin; private final int margin;
@ -147,7 +147,7 @@ public enum LinkDecor {
case CIRCLE_FILL: case CIRCLE_FILL:
return new ExtremityFactoryCircle(true, backgroundColor); return new ExtremityFactoryCircle(true, backgroundColor);
case SQUARE: case SQUARE:
return new ExtremityFactorySquarre(backgroundColor); return new ExtremityFactorySquare(backgroundColor);
case PARENTHESIS: case PARENTHESIS:
return new ExtremityFactoryParenthesis(); return new ExtremityFactoryParenthesis();
case CIRCLE_CONNECT: case CIRCLE_CONNECT:

View File

@ -64,6 +64,7 @@ import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet; import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils; import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class Stereotype implements CharSequence { public class Stereotype implements CharSequence {
private final static RegexComposed circleChar = new RegexConcat( // private final static RegexComposed circleChar = new RegexConcat( //
@ -108,7 +109,7 @@ public class Stereotype implements CharSequence {
private String spriteName; private String spriteName;
private double spriteScale; private double spriteScale;
public Stereotype(String label, double radius, UFont circledFont, HColorSet htmlColorSet) { public Stereotype(String label, double radius, UFont circledFont, HColorSet htmlColorSet) throws NoSuchColorException {
this(label, radius, circledFont, true, htmlColorSet); this(label, radius, circledFont, true, htmlColorSet);
} }
@ -129,7 +130,7 @@ public class Stereotype implements CharSequence {
} }
public Stereotype(String label, double radius, UFont circledFont, boolean automaticPackageStyle, public Stereotype(String label, double radius, UFont circledFont, boolean automaticPackageStyle,
HColorSet htmlColorSet) { HColorSet htmlColorSet) throws NoSuchColorException {
if (label == null) { if (label == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
@ -153,7 +154,7 @@ public class Stereotype implements CharSequence {
local = null; local = null;
} }
final String colName = mCircleSprite.get("COLOR", 0); final String colName = mCircleSprite.get("COLOR", 0);
final HColor col = htmlColorSet.getColorIfValid(colName); final HColor col = colName == null ? null : htmlColorSet.getColor(colName);
this.htmlColor = col == null ? HColorUtils.BLACK : col; this.htmlColor = col == null ? HColorUtils.BLACK : col;
this.spriteName = mCircleSprite.get("NAME", 0); this.spriteName = mCircleSprite.get("NAME", 0);
this.character = '\0'; this.character = '\0';
@ -165,7 +166,7 @@ public class Stereotype implements CharSequence {
local = null; local = null;
} }
final String colName = mCircleChar.get("COLOR", 0); final String colName = mCircleChar.get("COLOR", 0);
this.htmlColor = htmlColorSet.getColorIfValid(colName); this.htmlColor = colName == null ? null : htmlColorSet.getColor(colName);
this.character = mCircleChar.get("CHAR", 0).charAt(0); this.character = mCircleChar.get("CHAR", 0).charAt(0);
this.spriteName = null; this.spriteName = null;
} }

View File

@ -147,7 +147,7 @@ public abstract class WithLinkType {
} else if (s.startsWith("thickness=")) { } else if (s.startsWith("thickness=")) {
this.goThickness(Double.parseDouble(s.substring("thickness=".length()))); this.goThickness(Double.parseDouble(s.substring("thickness=".length())));
} else { } else {
final HColor tmp = HColorSet.instance().getColorIfValid(s); final HColor tmp = HColorSet.instance().getColorOrWhite(s);
setSpecificColor(tmp, i); setSpecificColor(tmp, i);
} }
} }

View File

@ -36,7 +36,6 @@
package net.sourceforge.plantuml.cucadiagram.dot; package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.File; import java.io.File;
import java.io.IOException;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.windowsdot.WindowsDotArchive; import net.sourceforge.plantuml.windowsdot.WindowsDotArchive;
@ -54,11 +53,7 @@ class GraphvizWindowsLite extends AbstractGraphviz {
protected File specificDotExe() { protected File specificDotExe() {
synchronized (GraphvizWindowsLite.class) { synchronized (GraphvizWindowsLite.class) {
if (specificDotExe == null) if (specificDotExe == null)
try { specificDotExe = WindowsDotArchive.getInstance().getWindowsExeLite();
specificDotExe = new WindowsDotArchive().getWindowsExeLite();
} catch (IOException e) {
e.printStackTrace();
}
return specificDotExe; return specificDotExe;
} }

View File

@ -37,7 +37,6 @@ package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -57,11 +56,7 @@ class GraphvizWindowsOld extends AbstractGraphviz {
specificDotExe = specificDotExeSlow(); specificDotExe = specificDotExeSlow();
} }
if (specificDotExe == null) if (specificDotExe == null)
try { specificDotExe = WindowsDotArchive.getInstance().getWindowsExeLite();
specificDotExe = new WindowsDotArchive().getWindowsExeLite();
} catch (IOException e) {
e.printStackTrace();
}
return specificDotExe; return specificDotExe;
} }

View File

@ -606,7 +606,7 @@ final public class EntityImpl implements ILeaf, IGroup {
} }
public SingleStrategy getSingleStrategy() { public SingleStrategy getSingleStrategy() {
return SingleStrategy.SQUARRE; return SingleStrategy.SQUARE;
} }
public boolean isHidden() { public boolean isHidden() {

Some files were not shown because too many files have changed in this diff Show More