mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
Import version 1.2021.1
This commit is contained in:
parent
55f005f9bb
commit
0dc13cccf2
2
pom.xml
2
pom.xml
@ -35,7 +35,7 @@
|
||||
|
||||
<groupId>net.sourceforge.plantuml</groupId>
|
||||
<artifactId>plantuml</artifactId>
|
||||
<version>1.2021.1-SNAPSHOT</version>
|
||||
<version>1.2021.2-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>PlantUML</name>
|
||||
|
@ -23,6 +23,7 @@ import java.util.StringTokenizer;
|
||||
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
|
||||
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();
|
||||
private Color decodeInternal(String value) {
|
||||
if (colors.getColorIfValid(value)!=null) {
|
||||
return new ColorMapperIdentity().toColor(colors.getColorIfValid(value));
|
||||
if (value!=null) {
|
||||
try {
|
||||
return new ColorMapperIdentity().toColor(colors.getColor(value, null));
|
||||
} catch (NoSuchColorException e) {
|
||||
return Color.WHITE;
|
||||
}
|
||||
}
|
||||
return Color.decode(value);
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.stats.StatsUtilsIncrement;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.version.License;
|
||||
import net.sourceforge.plantuml.version.Version;
|
||||
|
||||
@ -126,7 +127,11 @@ public abstract class AbstractPSystem implements Diagram {
|
||||
|
||||
public CommandExecutionResult executeCommand(Command cmd, BlocLines lines) {
|
||||
cmd = new ProtectedCommand(cmd);
|
||||
try {
|
||||
return cmd.execute(this, lines);
|
||||
} catch (NoSuchColorException e) {
|
||||
return CommandExecutionResult.badColor();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasUrl() {
|
||||
|
@ -142,6 +142,8 @@ public enum ColorParam {
|
||||
nodeBorder(HColorUtils.BLACK, ColorType.LINE),
|
||||
rectangleBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
|
||||
rectangleBorder(HColorUtils.BLACK, ColorType.LINE),
|
||||
hexagonBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
|
||||
hexagonBorder(HColorUtils.BLACK, ColorType.LINE),
|
||||
archimateBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
|
||||
archimateBorder(HColorUtils.BLACK, ColorType.LINE),
|
||||
cardBackground(HColorUtils.MY_YELLOW, true, ColorType.BACK),
|
||||
|
@ -36,7 +36,7 @@
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
public enum CornerParam {
|
||||
DEFAULT, diagramBorder, titleBorder, rectangle, archimate, component, card, agent;
|
||||
DEFAULT, diagramBorder, titleBorder, rectangle, hexagon, archimate, component, card, agent;
|
||||
|
||||
public String getRoundKey() {
|
||||
if (this == DEFAULT) {
|
||||
|
@ -83,6 +83,12 @@ public class EmbeddedDiagram implements CharSequence {
|
||||
if (s.equals("{{json")) {
|
||||
return "json";
|
||||
}
|
||||
if (s.equals("{{yaml")) {
|
||||
return "yaml";
|
||||
}
|
||||
if (s.equals("{{wire")) {
|
||||
return "wire";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -35,22 +35,27 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml;
|
||||
|
||||
|
||||
public class ErrorUml {
|
||||
|
||||
private final String error;
|
||||
private final ErrorUmlType type;
|
||||
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) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
this.score = score;
|
||||
this.error = error;
|
||||
this.type = type;
|
||||
this.lineLocation = lineLocation;
|
||||
}
|
||||
|
||||
public int score() {
|
||||
return score;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
final ErrorUml this2 = (ErrorUml) obj;
|
||||
|
@ -46,9 +46,8 @@ import java.io.IOException;
|
||||
|
||||
import net.sourceforge.plantuml.braille.BrailleCharFactory;
|
||||
import net.sourceforge.plantuml.braille.UGraphicBraille;
|
||||
import net.sourceforge.plantuml.graphic.FontStyle;
|
||||
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.security.SFile;
|
||||
import net.sourceforge.plantuml.svg.SvgGraphics;
|
||||
@ -116,12 +115,12 @@ public enum FileFormat {
|
||||
}
|
||||
|
||||
private StringBounder getSvgStringBounder(final SvgCharSizeHack charSizeHack) {
|
||||
return new StringBounder() {
|
||||
return new StringBounderRaw() {
|
||||
public String toString() {
|
||||
return "FileFormat::getSvgStringBounder";
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(UFont font, String text) {
|
||||
protected Dimension2D calculateDimensionInternal(UFont font, String text) {
|
||||
text = charSizeHack.transformStringForSizeHack(text);
|
||||
return getJavaDimension(font, text);
|
||||
}
|
||||
@ -130,13 +129,13 @@ public enum FileFormat {
|
||||
}
|
||||
|
||||
private StringBounder getNormalStringBounder() {
|
||||
return new StringBounder() {
|
||||
return new StringBounderRaw() {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FileFormat::getNormalStringBounder";
|
||||
}
|
||||
|
||||
public Dimension2D calculateDimension(UFont font, String text) {
|
||||
protected Dimension2D calculateDimensionInternal(UFont font, String text) {
|
||||
return getJavaDimension(font, text);
|
||||
}
|
||||
|
||||
@ -144,30 +143,20 @@ public enum FileFormat {
|
||||
}
|
||||
|
||||
static private Dimension2DDouble getJavaDimension(UFont font, String text) {
|
||||
double width = 0;
|
||||
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 Font javaFont = font.getFont();
|
||||
final FontMetrics fm = gg.getFontMetrics(javaFont);
|
||||
final Rectangle2D rect = fm.getStringBounds(styledString.getText(), gg);
|
||||
width += rect.getWidth();
|
||||
height = Math.max(height, rect.getHeight());
|
||||
}
|
||||
return new Dimension2DDouble(width, height);
|
||||
final Rectangle2D rect = fm.getStringBounds(text, gg);
|
||||
return new Dimension2DDouble(rect.getWidth(), rect.getHeight());
|
||||
}
|
||||
|
||||
private StringBounder getBrailleStringBounder() {
|
||||
return new StringBounder() {
|
||||
return new StringBounderRaw() {
|
||||
@Override
|
||||
public String toString() {
|
||||
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 double quanta = UGraphicBraille.QUANTA;
|
||||
final double height = 5 * quanta;
|
||||
@ -178,13 +167,13 @@ public enum FileFormat {
|
||||
}
|
||||
|
||||
private StringBounder getTikzStringBounder(final TikzFontDistortion tikzFontDistortion) {
|
||||
return new StringBounder() {
|
||||
return new StringBounderRaw() {
|
||||
@Override
|
||||
public String toString() {
|
||||
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 w2 = getJavaDimension(font.goTikz(0), text);
|
||||
final Dimension2DDouble w3 = getJavaDimension(font.goTikz(1), text);
|
||||
|
@ -44,7 +44,7 @@ public class 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() {
|
||||
reset();
|
||||
@ -55,24 +55,27 @@ public class FileSystem {
|
||||
}
|
||||
|
||||
public void setCurrentDir(SFile dir) {
|
||||
// if (dir == null) {
|
||||
// throw new IllegalArgumentException();
|
||||
// }
|
||||
if (dir != null) {
|
||||
if (dir == null) {
|
||||
this.currentDir.set(null);
|
||||
} else {
|
||||
Log.info("Setting current dir: " + dir.getAbsolutePath());
|
||||
this.currentDir.set(dir.getAbsolutePath());
|
||||
}
|
||||
this.currentDir.set(dir);
|
||||
}
|
||||
|
||||
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 {
|
||||
if (isAbsolute(nameOrPath)) {
|
||||
return new SFile(nameOrPath).getCanonicalFile();
|
||||
}
|
||||
final SFile dir = currentDir.get();
|
||||
final SFile dir = getCurrentDir();
|
||||
SFile filecurrent = null;
|
||||
if (dir != null) {
|
||||
filecurrent = dir.getAbsoluteFile().file(nameOrPath);
|
||||
|
@ -79,6 +79,8 @@ public enum FontParam {
|
||||
ENTITY(14, Font.PLAIN), //
|
||||
AGENT(14, Font.PLAIN), //
|
||||
RECTANGLE(14, Font.PLAIN), //
|
||||
LABEL(14, Font.PLAIN), //
|
||||
HEXAGON(14, Font.PLAIN), //
|
||||
ARCHIMATE(14, Font.PLAIN), //
|
||||
CARD(14, Font.PLAIN), //
|
||||
NODE(14, Font.PLAIN), //
|
||||
@ -113,6 +115,8 @@ public enum FontParam {
|
||||
ENTITY_STEREOTYPE(14, Font.ITALIC), //
|
||||
AGENT_STEREOTYPE(14, Font.ITALIC), //
|
||||
RECTANGLE_STEREOTYPE(14, Font.ITALIC), //
|
||||
LABEL_STEREOTYPE(14, Font.ITALIC), //
|
||||
HEXAGON_STEREOTYPE(14, Font.ITALIC), //
|
||||
ARCHIMATE_STEREOTYPE(14, Font.ITALIC), //
|
||||
CARD_STEREOTYPE(14, Font.ITALIC), //
|
||||
NODE_STEREOTYPE(14, Font.ITALIC), //
|
||||
|
@ -61,7 +61,7 @@ public class GeneratedImageImpl implements GeneratedImage {
|
||||
}
|
||||
|
||||
public File getPngFile() {
|
||||
return pngFile.internal;
|
||||
return pngFile.conv();
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
@ -55,6 +55,7 @@ import net.sourceforge.plantuml.svg.LengthAdjust;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public interface ISkinParam extends ISkinSimple {
|
||||
|
||||
@ -68,7 +69,7 @@ public interface ISkinParam extends ISkinSimple {
|
||||
|
||||
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);
|
||||
|
||||
|
@ -55,6 +55,7 @@ public enum LineParam {
|
||||
titleBorder,
|
||||
diagramBorder,
|
||||
rectangleBorder,
|
||||
hexagonBorder,
|
||||
archimateBorder,
|
||||
componentBorder,
|
||||
cardBorder,
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.core.DiagramDescription;
|
||||
import net.sourceforge.plantuml.core.ImageData;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class NewpagedDiagram extends AbstractPSystem {
|
||||
|
||||
@ -74,6 +75,7 @@ public class NewpagedDiagram extends AbstractPSystem {
|
||||
|
||||
public CommandExecutionResult executeCommand(Command cmd, BlocLines lines) {
|
||||
final int nb = diagrams.size();
|
||||
try {
|
||||
final CommandExecutionResult tmp = cmd.execute(diagrams.get(nb - 1), lines);
|
||||
if (tmp.getNewDiagram() instanceof NewpagedDiagram) {
|
||||
final NewpagedDiagram new1 = (NewpagedDiagram) tmp.getNewDiagram();
|
||||
@ -90,6 +92,9 @@ public class NewpagedDiagram extends AbstractPSystem {
|
||||
|
||||
}
|
||||
return tmp;
|
||||
} catch (NoSuchColorException e) {
|
||||
return CommandExecutionResult.badColor();
|
||||
}
|
||||
}
|
||||
|
||||
private int size() {
|
||||
|
@ -118,7 +118,7 @@ public class PSystemBuilder {
|
||||
// Dead code : should not append
|
||||
assert false;
|
||||
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());
|
||||
return PSystemErrorUtils.buildV2(umlSource, err, Collections.<String>emptyList(), source);
|
||||
}
|
||||
|
@ -85,6 +85,7 @@ import net.sourceforge.plantuml.ugraphic.color.ColorOrder;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class SkinParam implements ISkinParam {
|
||||
|
||||
@ -316,8 +317,8 @@ public class SkinParam implements ISkinParam {
|
||||
checkStereotype(stereotype);
|
||||
for (String s : stereotype.getMultipleLabels()) {
|
||||
final String value2 = getValue(param.name() + "color" + "<<" + s + ">>");
|
||||
if (value2 != null && getIHtmlColorSet().getColorIfValid(value2) != null) {
|
||||
return getIHtmlColorSet().getColorIfValid(value2);
|
||||
if (value2 != null && getIHtmlColorSet().getColorOrWhite(value2) != null) {
|
||||
return getIHtmlColorSet().getColorOrWhite(value2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -330,12 +331,12 @@ public class SkinParam implements ISkinParam {
|
||||
return HColorUtils.transparent();
|
||||
}
|
||||
if (param == ColorParam.background) {
|
||||
return getIHtmlColorSet().getColorIfValid(value);
|
||||
return getIHtmlColorSet().getColorOrWhite(value);
|
||||
}
|
||||
assert param != ColorParam.background;
|
||||
// final boolean acceptTransparent = param == ColorParam.background
|
||||
// || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground;
|
||||
return getIHtmlColorSet().getColorIfValid(value, getBackgroundColor(false));
|
||||
return getIHtmlColorSet().getColorOrWhite(value, getBackgroundColor(false));
|
||||
}
|
||||
|
||||
public char getCircledCharacter(Stereotype stereotype) {
|
||||
@ -349,11 +350,11 @@ public class SkinParam implements ISkinParam {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Colors getColors(ColorParam param, Stereotype stereotype) {
|
||||
public Colors getColors(ColorParam param, Stereotype stereotype) throws NoSuchColorException {
|
||||
if (stereotype != null) {
|
||||
checkStereotype(stereotype);
|
||||
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());
|
||||
}
|
||||
}
|
||||
@ -430,16 +431,19 @@ public class SkinParam implements ISkinParam {
|
||||
value = getFirstValueNonNullWithSuffix("fontcolor" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR),
|
||||
param);
|
||||
}
|
||||
if (value == null || getIHtmlColorSet().getColorIfValid(value) == null) {
|
||||
if (value == null) {
|
||||
value = getFirstValueNonNullWithSuffix("fontcolor", param);
|
||||
}
|
||||
if (value == null || getIHtmlColorSet().getColorIfValid(value) == null) {
|
||||
if (value == null) {
|
||||
value = getValue("defaultfontcolor");
|
||||
}
|
||||
if (value == null || getIHtmlColorSet().getColorIfValid(value) == null) {
|
||||
if (value == null) {
|
||||
value = param[0].getDefaultColor();
|
||||
}
|
||||
return getIHtmlColorSet().getColorIfValid(value);
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return getIHtmlColorSet().getColorOrWhite(value);
|
||||
}
|
||||
|
||||
private String getFirstValueNonNullWithSuffix(String suffix, FontParam... param) {
|
||||
@ -1130,8 +1134,9 @@ public class SkinParam implements ISkinParam {
|
||||
margin = Integer.parseInt(marginString);
|
||||
}
|
||||
|
||||
return new SplitParam(getIHtmlColorSet().getColorIfValid(border), getIHtmlColorSet().getColorIfValid(external),
|
||||
margin);
|
||||
final HColor borderColor = border == null ? null : getIHtmlColorSet().getColorOrWhite(border);
|
||||
final HColor externalColor = external == null ? null : getIHtmlColorSet().getColorOrWhite(external);
|
||||
return new SplitParam(borderColor, externalColor, margin);
|
||||
}
|
||||
|
||||
public int swimlaneWidth() {
|
||||
@ -1154,7 +1159,7 @@ public class SkinParam implements ISkinParam {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return getIHtmlColorSet().getColorIfValid(value, null);
|
||||
return getIHtmlColorSet().getColorOrWhite(value, null);
|
||||
}
|
||||
|
||||
public double getPadding() {
|
||||
@ -1232,8 +1237,8 @@ public class SkinParam implements ISkinParam {
|
||||
if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) {
|
||||
return Padder.NONE;
|
||||
}
|
||||
final HColor border = getIHtmlColorSet().getColorIfValid(borderColor);
|
||||
final HColor background = getIHtmlColorSet().getColorIfValid(backgroundColor);
|
||||
final HColor border = borderColor == null ? null : getIHtmlColorSet().getColorOrWhite(borderColor);
|
||||
final HColor background = backgroundColor == null ? null : getIHtmlColorSet().getColorOrWhite(backgroundColor);
|
||||
final double roundCorner = getRoundCorner(CornerParam.DEFAULT, null);
|
||||
return Padder.NONE.withMargin(margin).withPadding(padding).withBackgroundColor(background)
|
||||
.withBorderColor(border).withRoundCorner(roundCorner);
|
||||
|
@ -59,6 +59,7 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class SkinParamDelegator implements ISkinParam {
|
||||
|
||||
@ -245,7 +246,7 @@ public class SkinParamDelegator implements ISkinParam {
|
||||
return skinParam.getMonospacedFamily();
|
||||
}
|
||||
|
||||
public Colors getColors(ColorParam param, Stereotype stereotype) {
|
||||
public Colors getColors(ColorParam param, Stereotype stereotype) throws NoSuchColorException {
|
||||
return skinParam.getColors(param, stereotype);
|
||||
}
|
||||
|
||||
|
@ -182,11 +182,8 @@ public abstract class UmlDiagram extends TitledDiagram implements Diagram, Annot
|
||||
} catch (UnparsableGraphvizException e) {
|
||||
e.printStackTrace();
|
||||
exportDiagramError(os, e.getCause(), fileFormatOption, seed, e.getGraphvizVersion());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
exportDiagramError(os, e, fileFormatOption, seed, null);
|
||||
} catch (Error e) {
|
||||
e.printStackTrace();
|
||||
} catch (Throwable e) {
|
||||
//e.printStackTrace();
|
||||
exportDiagramError(os, e, fileFormatOption, seed, null);
|
||||
}
|
||||
return ImageDataSimple.error();
|
||||
|
@ -67,6 +67,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
|
||||
@ -121,7 +122,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
}
|
||||
|
||||
@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);
|
||||
if (entity1 == null) {
|
||||
return CommandExecutionResult.error("No such activity");
|
||||
@ -130,8 +131,9 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
entity1.setStereotype(new Stereotype(arg.get("STEREOTYPE", 0)));
|
||||
}
|
||||
if (arg.get("BACKCOLOR", 0) != null) {
|
||||
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
|
||||
.getColorIfValid(arg.get("BACKCOLOR", 0)));
|
||||
String s = arg.get("BACKCOLOR", 0);
|
||||
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
|
||||
}
|
||||
|
||||
final IEntity entity2 = getEntity(diagram, arg, false);
|
||||
@ -139,8 +141,9 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
return CommandExecutionResult.error("No such activity");
|
||||
}
|
||||
if (arg.get("BACKCOLOR2", 0) != null) {
|
||||
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
|
||||
.getColorIfValid(arg.get("BACKCOLOR2", 0)));
|
||||
String s = arg.get("BACKCOLOR2", 0);
|
||||
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
|
||||
}
|
||||
if (arg.get("STEREOTYPE2", 0) != null) {
|
||||
entity2.setStereotype(new Stereotype(arg.get("STEREOTYPE2", 0)));
|
||||
@ -163,7 +166,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
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("*")) {
|
||||
link.setConstraint(false);
|
||||
}
|
||||
@ -215,8 +219,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
}
|
||||
final Ident ident = diagram.buildLeafIdent(idShort);
|
||||
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||
final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, ident) : getTypeIfExisting(diagram,
|
||||
code);
|
||||
final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, ident)
|
||||
: getTypeIfExisting(diagram, code);
|
||||
IEntity result;
|
||||
if (diagram.V1972()) {
|
||||
result = diagram.getLeafVerySmart(ident);
|
||||
@ -252,8 +256,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
|
||||
}
|
||||
final Ident quotedIdent = diagram.buildLeafIdent(quotedString);
|
||||
final Code quotedCode = diagram.V1972() ? quotedIdent : diagram.buildCode(quotedString);
|
||||
final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, quotedIdent) : getTypeIfExisting(
|
||||
diagram, quotedCode);
|
||||
final LeafType type = diagram.V1972() ? getTypeIfExistingSmart(diagram, quotedIdent)
|
||||
: getTypeIfExisting(diagram, quotedCode);
|
||||
final IEntity result = diagram.getOrCreate(quotedIdent, quotedCode, Display.getWithNewlines(quoted.get(0)),
|
||||
type);
|
||||
if (partition != null) {
|
||||
|
@ -70,6 +70,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram> {
|
||||
|
||||
@ -114,7 +115,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) {
|
||||
protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) throws NoSuchColorException {
|
||||
lines = lines.trim();
|
||||
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);
|
||||
if (stringColor != null) {
|
||||
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
|
||||
.getColorIfValid(stringColor));
|
||||
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(stringColor));
|
||||
}
|
||||
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()
|
||||
.getString());
|
||||
final List<String> lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()),
|
||||
lines.getLast().getString());
|
||||
if (StringUtils.isNotEmpty(lineLast.get(0))) {
|
||||
if (sb.length() > 0 && sb.toString().endsWith(BackSlash.BS_BS_N) == false) {
|
||||
sb.append(BackSlash.BS_BS_N);
|
||||
@ -197,8 +198,9 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
||||
entity2.setStereotype(new Stereotype(lineLast.get(2)));
|
||||
}
|
||||
if (lineLast.get(4) != null) {
|
||||
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
|
||||
.getColorIfValid(lineLast.get(4)));
|
||||
String s = lineLast.get(4);
|
||||
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
|
||||
}
|
||||
|
||||
final String arrowBody1 = CommandLinkClass.notNull(line0.get("ARROW_BODY1", 0));
|
||||
@ -215,7 +217,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
|
||||
if (arrow.contains(".")) {
|
||||
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 + ">");
|
||||
if (direction == Direction.LEFT || direction == Direction.UP) {
|
||||
link = link.getInv();
|
||||
|
@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
|
||||
|
||||
@ -84,7 +85,7 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
|
||||
}
|
||||
|
||||
@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 Ident ident = diagram.buildLeafIdent(idShort);
|
||||
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||
|
@ -55,6 +55,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -101,7 +102,8 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException {
|
||||
|
||||
final Url url;
|
||||
if (arg.get("URL", 0) == null) {
|
||||
@ -119,7 +121,8 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
colors = colors.applyStereotype(stereotype, diagram.getSkinParam(), ColorParam.activityBackground);
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -48,6 +48,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
|
||||
@ -73,7 +74,7 @@ public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
|
||||
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) throws NoSuchColorException {
|
||||
lines = lines.removeEmptyColumns();
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -67,7 +68,7 @@ public class CommandArrow3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@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);
|
||||
if (colorString != null) {
|
||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
|
||||
@ -72,7 +73,7 @@ public class CommandArrowLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) {
|
||||
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) throws NoSuchColorException {
|
||||
lines = lines.removeEmptyColumns();
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
|
||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -85,7 +86,7 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@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 String styleString = arg.get("STYLE", 0);
|
||||
|
||||
@ -103,7 +104,7 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
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 Rainbow incomingColor = getRainbow(name + "_COLOR", diagram, arg);
|
||||
if (incomingColor == null)
|
||||
@ -114,7 +115,7 @@ public class CommandBackward3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
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);
|
||||
if (colorString == null) {
|
||||
return null;
|
||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandCircleSpot3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -61,8 +62,9 @@ public class CommandCircleSpot3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
String s = arg.get("COLOR", 0);
|
||||
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
diagram.addSpot(arg.get("SPOT", 0), color);
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexOptional;
|
||||
import net.sourceforge.plantuml.command.regex.RegexOr;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandElse3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -71,7 +72,7 @@ public class CommandElse3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@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) {
|
||||
// return CommandExecutionResult.error("No if for this endif");
|
||||
// }
|
||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -95,8 +96,9 @@ public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
final String s = arg.get("COLOR", 0);
|
||||
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
|
||||
String test = arg.get("TEST", 0);
|
||||
if (test.length() == 0) {
|
||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -78,8 +79,9 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
final String s = arg.get("COLOR", 0);
|
||||
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
|
||||
String test = arg.get("TEST", 0);
|
||||
if (test.length() == 0) {
|
||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -75,8 +76,9 @@ public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
final String s = arg.get("COLOR", 0);
|
||||
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
|
||||
String test = arg.get("TEST", 0);
|
||||
if (test.length() == 0) {
|
||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -62,8 +63,9 @@ public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
final String s = arg.get("COLOR", 0);
|
||||
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
if (color != null) {
|
||||
diagram.setColorNextArrow(Rainbow.fromColor(color, null));
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -75,7 +76,7 @@ public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@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 Display note = Display.getWithNewlines(arg.get("NOTE", 0));
|
||||
final NotePosition position = NotePosition.defaultLeft(arg.get("POSITION", 0));
|
||||
|
@ -50,6 +50,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
|
||||
@ -67,7 +68,7 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@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 RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
lines = lines.subExtract(1, 1);
|
||||
|
@ -59,6 +59,7 @@ import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -118,7 +119,7 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@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 b1 = arg.get("BACK1", 0);
|
||||
|
@ -52,6 +52,7 @@ import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -76,8 +77,9 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
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 BoxStyle boxStyle;
|
||||
final String styleString = arg.get("STYLE", 0);
|
||||
|
@ -48,6 +48,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
|
||||
import net.sourceforge.plantuml.graphic.Rainbow;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -100,7 +101,7 @@ public class CommandRepeatWhile3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@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 yes = Display.getWithNewlines(arg.getLazzy("WHEN", 0));
|
||||
final Display out = Display.getWithNewlines(arg.getLazzy("OUT", 0));
|
||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -64,8 +65,9 @@ public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
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 Display label = Display.getWithNewlines(arg.get("LABEL", 0));
|
||||
return diagram.swimlane(name, color, label);
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -72,8 +73,9 @@ public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
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 Display label = Display.getWithNewlines(arg.get("LABEL", 0));
|
||||
return diagram.swimlane(name, color, label);
|
||||
|
@ -46,6 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandSwitch extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -66,8 +67,9 @@ public class CommandSwitch extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
final String s = arg.get("COLOR", 0);
|
||||
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
|
||||
|
||||
String test = arg.get("TEST", 0);
|
||||
if (test.length() == 0) {
|
||||
|
@ -47,6 +47,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
|
||||
@ -72,8 +73,9 @@ public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) {
|
||||
final HColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0));
|
||||
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
|
||||
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);
|
||||
|
||||
return CommandExecutionResult.ok();
|
||||
|
@ -74,6 +74,7 @@ import net.sourceforge.plantuml.style.StyleBuilder;
|
||||
import net.sourceforge.plantuml.style.StyleSignature;
|
||||
import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
|
||||
public class VCompactFactory implements FtileFactory {
|
||||
|
||||
@ -111,16 +112,19 @@ public class VCompactFactory implements FtileFactory {
|
||||
}
|
||||
|
||||
public Ftile stop(Swimlane swimlane) {
|
||||
final HColor backColor = skinParam.getBackgroundColor(false);
|
||||
final HColor borderColor;
|
||||
Style style = null;
|
||||
final HColor backgroundColor;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
|
||||
// backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
|
||||
backgroundColor = skinParam.getBackgroundColor(false);
|
||||
} else {
|
||||
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) {
|
||||
@ -131,16 +135,19 @@ public class VCompactFactory implements FtileFactory {
|
||||
}
|
||||
|
||||
public Ftile end(Swimlane swimlane) {
|
||||
final HColor backColor = skinParam.getBackgroundColor(false);
|
||||
final HColor borderColor;
|
||||
Style style = null;
|
||||
final HColor backgroundColor;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
|
||||
borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
|
||||
// backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
|
||||
backgroundColor = skinParam.getBackgroundColor(false);
|
||||
} else {
|
||||
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) {
|
||||
|
@ -59,8 +59,8 @@ public class FtileCircleEnd extends AbstractFtile {
|
||||
|
||||
private static final int SIZE = 20;
|
||||
|
||||
private final HColor backColor;
|
||||
private final HColor borderColor;
|
||||
private final HColor backColor;
|
||||
private final Swimlane swimlane;
|
||||
private double shadowing;
|
||||
|
||||
@ -71,8 +71,8 @@ public class FtileCircleEnd extends AbstractFtile {
|
||||
|
||||
public FtileCircleEnd(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, Style style) {
|
||||
super(skinParam);
|
||||
this.backColor = backColor;
|
||||
this.borderColor = borderColor;
|
||||
this.backColor = backColor;
|
||||
this.swimlane = swimlane;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
@ -108,8 +108,8 @@ public class FtileCircleEnd extends AbstractFtile {
|
||||
circle.setDeltaShadow(shadowing);
|
||||
ug = ug.apply(borderColor);
|
||||
final double thickness = 2.5;
|
||||
ug.apply(backColor.bg()).apply(new UStroke(1.5))
|
||||
.apply(new UTranslate(xTheoricalPosition, yTheoricalPosition)).draw(circle);
|
||||
ug.apply(backColor.bg()).apply(new UStroke(1.5)).apply(new UTranslate(xTheoricalPosition, yTheoricalPosition))
|
||||
.draw(circle);
|
||||
|
||||
final double size2 = (SIZE - thickness) / Math.sqrt(2);
|
||||
final double delta = (SIZE - size2) / 2;
|
||||
|
@ -52,13 +52,14 @@ import net.sourceforge.plantuml.ugraphic.UEllipse;
|
||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||
import net.sourceforge.plantuml.ugraphic.UTranslate;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorMiddle;
|
||||
|
||||
public class FtileCircleStop extends AbstractFtile {
|
||||
|
||||
private static final int SIZE = 22;
|
||||
|
||||
private final HColor backColor;
|
||||
private final HColor borderColor;
|
||||
private final HColor backColor;
|
||||
private final Swimlane swimlane;
|
||||
private double shadowing;
|
||||
|
||||
@ -69,8 +70,8 @@ public class FtileCircleStop extends AbstractFtile {
|
||||
|
||||
public FtileCircleStop(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane, Style style) {
|
||||
super(skinParam);
|
||||
this.backColor = backColor;
|
||||
this.borderColor = borderColor;
|
||||
this.backColor = backColor;
|
||||
this.swimlane = swimlane;
|
||||
if (UseStyle.useBetaStyle()) {
|
||||
this.shadowing = style.value(PName.Shadowing).asDouble();
|
||||
@ -99,15 +100,16 @@ public class FtileCircleStop extends AbstractFtile {
|
||||
public void drawU(UGraphic ug) {
|
||||
final UEllipse circle = new UEllipse(SIZE, SIZE);
|
||||
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 UEllipse circleSmall = new UEllipse(SIZE - delta * 2, SIZE - delta * 2);
|
||||
// if (skinParam().shadowing(null)) {
|
||||
// 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
|
||||
|
@ -68,10 +68,10 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
|
||||
this.maxAsciiMessageLength = maxAsciiMessageLength;
|
||||
this.type = type;
|
||||
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) {
|
||||
return orig;
|
||||
}
|
||||
@ -79,7 +79,7 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
|
||||
for (int i = 0; i < orig.size(); i++) {
|
||||
CharSequence element = orig.get(i);
|
||||
if (i == 1) {
|
||||
element = removeTag(orig.get(0).toString()) + " " + element;
|
||||
element = removeTagAndManageBoldNumber(orig.get(0).toString(), fileFormat) + " " + element;
|
||||
}
|
||||
if (i != 0) {
|
||||
result = result.add(element);
|
||||
@ -88,7 +88,7 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
|
||||
return result;
|
||||
}
|
||||
|
||||
private String removeTag(String s) {
|
||||
private static String removeTagAndManageBoldNumber(String s, FileFormat fileFormat) {
|
||||
if (fileFormat == FileFormat.UTXT) {
|
||||
final Pattern pattern = Pattern.compile("\\<b\\>([0-9]+)\\</b\\>");
|
||||
final Matcher matcher = pattern.matcher(s);
|
||||
|
@ -60,7 +60,7 @@ public class ComponentTextSelfArrow extends AbstractComponentText implements Arr
|
||||
public ComponentTextSelfArrow(ComponentType type, ArrowConfiguration config, Display stringsToDisplay,
|
||||
FileFormat fileFormat) {
|
||||
this.type = type;
|
||||
this.stringsToDisplay = stringsToDisplay;
|
||||
this.stringsToDisplay = ComponentTextArrow.cleanAndManageBoldNumber(stringsToDisplay, fileFormat);
|
||||
this.fileFormat = fileFormat;
|
||||
this.config = config;
|
||||
}
|
||||
|
@ -38,12 +38,12 @@ package net.sourceforge.plantuml.asciiart;
|
||||
import java.awt.geom.Dimension2D;
|
||||
|
||||
import net.sourceforge.plantuml.Dimension2DDouble;
|
||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||
import net.sourceforge.plantuml.graphic.StringBounderRaw;
|
||||
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 length2 = text.length();
|
||||
final int length3 = Wcwidth.length(text);
|
||||
|
@ -92,9 +92,9 @@ public class UmlCharAreaImpl extends BasicCharAreaImpl implements UmlCharArea {
|
||||
x = 0;
|
||||
}
|
||||
for (CharSequence s : strings) {
|
||||
if (s instanceof MessageNumber) {
|
||||
s = StringUtils.toInternalBoldNumber((((MessageNumber) s).getNumberRaw()));
|
||||
}
|
||||
// if (s instanceof MessageNumber) {
|
||||
// s = StringUtils.toInternalBoldNumber((((MessageNumber) s).getNumberRaw()));
|
||||
// }
|
||||
this.drawStringLR(s.toString(), x, y + i);
|
||||
i++;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class BrailleDrawer implements UDrawable {
|
||||
}
|
||||
|
||||
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++) {
|
||||
ug.apply(UTranslate.dx(x * step + spotSize + 1)).draw(
|
||||
ULine.vline((grid.getMaxY() - grid.getMinY()) * step));
|
||||
|
@ -61,6 +61,7 @@ import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -123,7 +124,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
}
|
||||
|
||||
@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 String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0),
|
||||
"\"([:");
|
||||
@ -172,8 +173,9 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
entity.setCodeLine(location);
|
||||
|
||||
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) {
|
||||
colors = colors.add(ColorType.LINE, lineColor);
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.skin.VisibilityModifier;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagram> {
|
||||
|
||||
@ -142,7 +143,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) {
|
||||
protected CommandExecutionResult executeNow(ClassDiagram diagram, BlocLines lines) throws NoSuchColorException {
|
||||
lines = lines.trimSmart(1);
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
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 String visibilityString = arg.get("VISIBILITY", 0);
|
||||
@ -276,8 +277,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
}
|
||||
|
||||
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) {
|
||||
colors = colors.add(ColorType.LINE, lineColor);
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementFull;
|
||||
import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -151,7 +152,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
|
||||
}
|
||||
|
||||
@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) {
|
||||
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.setUSymbol(usymbol);
|
||||
if (stereotype != null) {
|
||||
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(), diagram
|
||||
.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam()
|
||||
.getIHtmlColorSet()));
|
||||
entity.setStereotype(new Stereotype(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||
diagram.getSkinParam().getIHtmlColorSet()));
|
||||
}
|
||||
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
|
||||
|
||||
@ -221,9 +222,10 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
|
||||
final Url url = urlBuilder.getUrl(urlString);
|
||||
entity.addUrl(url);
|
||||
}
|
||||
final String s = arg.get("COLOR", 0);
|
||||
|
||||
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
|
||||
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ import net.sourceforge.plantuml.descdiagram.command.Labels;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
|
||||
|
||||
@ -132,7 +133,7 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
|
||||
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 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 ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
|
||||
final IEntity cl1 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent1String))
|
||||
|
@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
|
||||
import net.sourceforge.plantuml.cucadiagram.IEntity;
|
||||
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -64,7 +65,7 @@ public class CommandStereotype extends SingleLineCommand2<ClassDiagram> {
|
||||
}
|
||||
|
||||
@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 Ident ident = diagram.buildLeafIdent(name);
|
||||
final Code code = diagram.V1972() ? ident : diagram.buildCode(name);
|
||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.LineLocation;
|
||||
import net.sourceforge.plantuml.StringLocated;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.security.SFile;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class BlocLines implements Iterable<StringLocated> {
|
||||
|
||||
@ -92,7 +93,7 @@ public class BlocLines implements Iterable<StringLocated> {
|
||||
this.lines = Collections.unmodifiableList(lines);
|
||||
}
|
||||
|
||||
public Display toDisplay() {
|
||||
public Display toDisplay() throws NoSuchColorException {
|
||||
return Display.createFoo(lines);
|
||||
}
|
||||
|
||||
|
@ -36,10 +36,11 @@
|
||||
package net.sourceforge.plantuml.command;
|
||||
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public interface Command<D extends Diagram> {
|
||||
|
||||
CommandExecutionResult execute(D diagram, BlocLines lines);
|
||||
CommandExecutionResult execute(D diagram, BlocLines lines) throws NoSuchColorException;
|
||||
|
||||
CommandControl isValid(BlocLines lines);
|
||||
|
||||
|
@ -45,15 +45,18 @@ public class CommandExecutionResult {
|
||||
private final String error;
|
||||
private final AbstractPSystem newDiagram;
|
||||
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.newDiagram = newDiagram;
|
||||
this.debugLines = debugLines;
|
||||
this.score = score;
|
||||
|
||||
}
|
||||
|
||||
public CommandExecutionResult withDiagram(AbstractPSystem newDiagram) {
|
||||
return new CommandExecutionResult(error, newDiagram, null);
|
||||
return new CommandExecutionResult(newDiagram, error, 0, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,19 +65,23 @@ public class CommandExecutionResult {
|
||||
}
|
||||
|
||||
public static CommandExecutionResult newDiagram(AbstractPSystem result) {
|
||||
return new CommandExecutionResult(null, result, null);
|
||||
return new CommandExecutionResult(result, null, 0, null);
|
||||
}
|
||||
|
||||
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) {
|
||||
return new CommandExecutionResult(error, null, null);
|
||||
return new CommandExecutionResult(null, error, 0, null);
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -106,6 +113,10 @@ public class CommandExecutionResult {
|
||||
return error;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public AbstractPSystem getNewDiagram() {
|
||||
return newDiagram;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
import net.sourceforge.plantuml.command.regex.Matcher2;
|
||||
import net.sourceforge.plantuml.command.regex.MyPattern;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
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()) {
|
||||
lines = lines.eventuallyMoveBracket();
|
||||
}
|
||||
try {
|
||||
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() {
|
||||
return false;
|
||||
|
@ -40,6 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandMultilinesCaption extends CommandMultilines<TitledDiagram> {
|
||||
|
||||
@ -52,7 +53,7 @@ public class CommandMultilinesCaption extends CommandMultilines<TitledDiagram> {
|
||||
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.removeEmptyColumns();
|
||||
final Display strings = lines.toDisplay();
|
||||
|
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.command.regex.Matcher2;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {
|
||||
|
||||
@ -54,7 +55,7 @@ public class CommandMultilinesFooter extends CommandMultilines<TitledDiagram> {
|
||||
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();
|
||||
final Matcher2 m = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
if (m.find() == false) {
|
||||
|
@ -42,6 +42,7 @@ import net.sourceforge.plantuml.UseStyle;
|
||||
import net.sourceforge.plantuml.command.regex.Matcher2;
|
||||
import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {
|
||||
|
||||
@ -54,7 +55,7 @@ public class CommandMultilinesHeader extends CommandMultilines<TitledDiagram> {
|
||||
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();
|
||||
final Matcher2 m = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
if (m.find() == false) {
|
||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandMultilinesLegend extends CommandMultilines2<TitledDiagram> {
|
||||
|
||||
@ -73,7 +74,7 @@ public class CommandMultilinesLegend extends CommandMultilines2<TitledDiagram> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeNow(TitledDiagram diagram, BlocLines lines) {
|
||||
protected CommandExecutionResult executeNow(TitledDiagram diagram, BlocLines lines) throws NoSuchColorException {
|
||||
lines = lines.trimSmart(1);
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
final String align = line0.get("ALIGN", 0);
|
||||
|
@ -40,6 +40,7 @@ import net.sourceforge.plantuml.cucadiagram.Display;
|
||||
import net.sourceforge.plantuml.cucadiagram.DisplayPositionned;
|
||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.graphic.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandMultilinesTitle extends CommandMultilines<TitledDiagram> {
|
||||
|
||||
@ -52,7 +53,7 @@ public class CommandMultilinesTitle extends CommandMultilines<TitledDiagram> {
|
||||
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.removeEmptyColumns();
|
||||
final Display strings = lines.toDisplay();
|
||||
|
@ -54,6 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -77,7 +78,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
||||
}
|
||||
|
||||
@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 Code code;
|
||||
final IGroup currentPackage;
|
||||
@ -109,7 +110,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
|
||||
final String color = arg.get("COLOR", 0);
|
||||
if (color != null) {
|
||||
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -85,7 +86,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
|
||||
}
|
||||
|
||||
@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 Ident ident = diagram.buildLeafIdent(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);
|
||||
if (color != null) {
|
||||
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
|
||||
}
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
|
||||
|
||||
@ -80,7 +81,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
|
||||
}
|
||||
|
||||
@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 Ident idNewLong = diagram.buildLeafIdent(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);
|
||||
if (color != null) {
|
||||
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
|
||||
}
|
||||
diagram.endGroup();
|
||||
return CommandExecutionResult.ok();
|
||||
|
@ -60,6 +60,7 @@ import net.sourceforge.plantuml.graphic.USymbol;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
@ -101,7 +102,7 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
}
|
||||
|
||||
@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 display;
|
||||
final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
|
||||
|
@ -51,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.IGroup;
|
||||
import net.sourceforge.plantuml.cucadiagram.Ident;
|
||||
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagram> {
|
||||
@ -81,7 +82,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
|
||||
}
|
||||
|
||||
@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 display;
|
||||
if (arg.get("CODE", 0) == null) {
|
||||
@ -105,7 +106,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
|
||||
final String color = arg.get("COLOR", 0);
|
||||
if (color != null) {
|
||||
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(color));
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
|
||||
}
|
||||
diagram.endGroup();
|
||||
return CommandExecutionResult.ok();
|
||||
|
@ -58,7 +58,7 @@ public abstract class PSystemAbstractFactory implements PSystemFactory {
|
||||
|
||||
final protected PSystemError buildEmptyError(UmlSource source, LineLocation lineLocation,
|
||||
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);
|
||||
result.setSource(source);
|
||||
return result;
|
||||
@ -66,7 +66,7 @@ public abstract class PSystemAbstractFactory implements PSystemFactory {
|
||||
|
||||
final protected PSystemError buildExecutionError(UmlSource source, String stringError, LineLocation lineLocation,
|
||||
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);
|
||||
result.setSource(source);
|
||||
return result;
|
||||
|
@ -89,7 +89,7 @@ public abstract class PSystemBasicFactory<P extends AbstractPSystem> extends PSy
|
||||
}
|
||||
system = executeLine(system, s.getString());
|
||||
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.buildV2(source, err, null, it.getTrace());
|
||||
}
|
||||
|
@ -120,15 +120,16 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
|
||||
private AbstractPSystem executeFewLines(AbstractPSystem sys, UmlSource source, final IteratorCounter2 it) {
|
||||
final Step step = getCandidate(it);
|
||||
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();
|
||||
return PSystemErrorUtils.buildV2(source, err, null, it.getTrace());
|
||||
}
|
||||
|
||||
final CommandExecutionResult result = sys.executeCommand(step.command, step.blocLines);
|
||||
if (result.isOk() == false) {
|
||||
final ErrorUml err = new ErrorUml(ErrorUmlType.EXECUTION_ERROR, result.getError(),
|
||||
((StringLocated) step.blocLines.getFirst()).getLocation());
|
||||
final LineLocation location = ((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());
|
||||
}
|
||||
if (result.getNewDiagram() != null) {
|
||||
|
@ -80,7 +80,7 @@ public abstract class PSystemSingleLineFactory extends PSystemAbstractFactory {
|
||||
}
|
||||
final AbstractPSystem sys = executeLine(s.getString());
|
||||
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.buildV2(source, err, null, it.getTrace());
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ import net.sourceforge.plantuml.command.regex.IRegex;
|
||||
import net.sourceforge.plantuml.command.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.core.Diagram;
|
||||
import net.sourceforge.plantuml.error.PSystemError;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
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("pattern="+pattern.getPattern());
|
||||
try {
|
||||
return executeArg(system, first.getLocation(), arg);
|
||||
} catch (NoSuchColorException e) {
|
||||
return CommandExecutionResult.badColor();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isForbidden(CharSequence line) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected abstract CommandExecutionResult executeArg(S system, LineLocation location, RegexResult arg);
|
||||
protected abstract CommandExecutionResult executeArg(S system, LineLocation location, RegexResult arg)
|
||||
throws NoSuchColorException;
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
|
||||
import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public final class CommandConstraintOnLinks extends SingleLineCommand2<CucaDiagram> {
|
||||
|
||||
@ -76,7 +77,7 @@ public final class CommandConstraintOnLinks extends SingleLineCommand2<CucaDiagr
|
||||
}
|
||||
|
||||
@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();
|
||||
if (links == null) {
|
||||
return CommandExecutionResult.error("Cannot put constraint on two last links");
|
||||
|
@ -55,6 +55,7 @@ import net.sourceforge.plantuml.cucadiagram.LeafType;
|
||||
import net.sourceforge.plantuml.cucadiagram.Stereotag;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public final class CommandFactoryNote implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
|
||||
|
||||
@ -98,7 +99,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final String display = arg.get("DISPLAY", 0);
|
||||
return executeInternal(system, arg, BlocLines.getWithNewlines(display));
|
||||
}
|
||||
@ -115,7 +116,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
|
||||
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);
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
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 Ident ident = diagram.buildLeafIdent(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);
|
||||
assert entity != null;
|
||||
final String s = arg.get("COLOR", 0);
|
||||
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));
|
||||
return CommandExecutionResult.ok();
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
public final class CommandFactoryNoteActivity implements SingleMultiFactoryCommand<ActivityDiagram> {
|
||||
@ -98,7 +99,7 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
|
||||
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);
|
||||
final RegexResult arg = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
lines = lines.subExtract(1, 1);
|
||||
@ -135,7 +136,7 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(final ActivityDiagram diagram, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final String tmp = UniqueSequence.getString("GN");
|
||||
final Ident ident = diagram.buildLeafIdent(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,
|
||||
diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
|
||||
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
|
||||
|
||||
IEntity activity = diagram.getLastEntityConsulted();
|
||||
if (activity == null) {
|
||||
@ -157,8 +159,8 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
|
||||
|
||||
final Link link;
|
||||
|
||||
final Position position = Position.valueOf(StringUtils.goUpperCase(arg.get("POSITION", 0))).withRankdir(
|
||||
diagram.getSkinParam().getRankdir());
|
||||
final Position position = Position.valueOf(StringUtils.goUpperCase(arg.get("POSITION", 0)))
|
||||
.withRankdir(diagram.getSkinParam().getRankdir());
|
||||
|
||||
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).goDashed();
|
||||
|
||||
|
@ -69,6 +69,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
import net.sourceforge.plantuml.utils.UniqueSequence;
|
||||
|
||||
public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
|
||||
@ -165,7 +166,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(final AbstractEntityDiagram system, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final String s = arg.get("NOTE", 0);
|
||||
return executeInternal(arg, system, null, BlocLines.getWithNewlines(s));
|
||||
}
|
||||
@ -184,7 +185,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
|
||||
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);
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
lines = lines.subExtract(1, 1);
|
||||
@ -203,7 +204,7 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
|
||||
}
|
||||
|
||||
private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url,
|
||||
BlocLines strings) {
|
||||
BlocLines strings) throws NoSuchColorException {
|
||||
|
||||
final String pos = line0.get("POSITION", 0);
|
||||
|
||||
|
@ -56,6 +56,7 @@ import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorType;
|
||||
import net.sourceforge.plantuml.graphic.color.Colors;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand<CucaDiagram> {
|
||||
|
||||
@ -101,7 +102,7 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
|
||||
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();
|
||||
lines = lines.subExtract(1, 1);
|
||||
lines = lines.removeEmptyColumns();
|
||||
@ -119,14 +120,14 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
|
||||
return new SingleLineCommand2<CucaDiagram>(getRegexConcatSingleLine()) {
|
||||
|
||||
@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));
|
||||
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();
|
||||
if (link == null) {
|
||||
return CommandExecutionResult.error("No link defined");
|
||||
|
@ -59,6 +59,7 @@ import net.sourceforge.plantuml.cucadiagram.Link;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
|
||||
import net.sourceforge.plantuml.cucadiagram.LinkType;
|
||||
import net.sourceforge.plantuml.graphic.color.ColorParser;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public final class CommandFactoryTipOnEntity implements SingleMultiFactoryCommand<AbstractEntityDiagram> {
|
||||
|
||||
@ -121,7 +122,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
|
||||
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);
|
||||
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
|
||||
lines = lines.subExtract(1, 1);
|
||||
@ -140,7 +141,7 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
|
||||
}
|
||||
|
||||
private CommandExecutionResult executeInternal(RegexResult line0, AbstractEntityDiagram diagram, Url url,
|
||||
BlocLines lines) {
|
||||
BlocLines lines) throws NoSuchColorException {
|
||||
|
||||
final String pos = line0.get("POSITION", 0);
|
||||
|
||||
|
@ -61,6 +61,7 @@ import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
|
||||
|
||||
@ -108,7 +109,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0));
|
||||
|
||||
return executeInternal(system, arg, strings);
|
||||
@ -126,7 +127,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
|
||||
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());
|
||||
lines = lines.subExtract(1, 1);
|
||||
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
|
||||
// .eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));
|
||||
// final Participant p2 = diagram.getOrCreateParticipant(StringUtils
|
||||
|
@ -63,6 +63,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public final class FactorySequenceNoteCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
|
||||
|
||||
@ -119,7 +120,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
|
||||
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());
|
||||
lines = lines.subExtract(1, 1);
|
||||
lines = lines.removeEmptyColumns();
|
||||
@ -133,14 +134,14 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(final SequenceDiagram diagram, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
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
|
||||
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0)));
|
||||
|
||||
|
@ -66,6 +66,7 @@ import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
|
||||
|
||||
@ -106,7 +107,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
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$";
|
||||
}
|
||||
|
||||
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());
|
||||
lines = lines.subExtract(1, 1);
|
||||
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();
|
||||
if (m instanceof AbstractMessage || m instanceof GroupingLeaf) {
|
||||
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 Display display = diagram.manageVariable(lines.toDisplay());
|
||||
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 String stereotypeString = line0.get("STEREO", 0);
|
||||
if (stereotypeString != null) {
|
||||
|
@ -62,6 +62,7 @@ import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.NoteStyle;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiFactoryCommand<SequenceDiagram> {
|
||||
|
||||
@ -123,7 +124,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
|
||||
@Override
|
||||
protected CommandExecutionResult executeArg(final SequenceDiagram system, LineLocation location,
|
||||
RegexResult arg) {
|
||||
RegexResult arg) throws NoSuchColorException {
|
||||
final BlocLines strings = BlocLines.getWithNewlines(arg.get("NOTE", 0));
|
||||
|
||||
return executeInternal(system, arg, strings);
|
||||
@ -141,7 +142,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
|
||||
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());
|
||||
lines = lines.subExtract(1, 1);
|
||||
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
|
||||
.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));
|
||||
final Participant p2 = diagram.getOrCreateParticipant(StringUtils
|
||||
|
@ -102,7 +102,7 @@ public class CommandLinkBlock extends SingleLineCommand2<CompositeDiagram> {
|
||||
|
||||
private LinkDecor getLinkDecor(String s) {
|
||||
if ("[]".equals(s)) {
|
||||
return LinkDecor.SQUARRE_toberemoved;
|
||||
return LinkDecor.SQUARE_toberemoved;
|
||||
}
|
||||
return LinkDecor.NONE;
|
||||
}
|
||||
|
@ -42,6 +42,8 @@ import net.sourceforge.plantuml.creole.legacy.StripeSimple;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
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 {
|
||||
|
||||
@ -70,7 +72,7 @@ public class CommandCreoleColorAndSizeChange implements Command {
|
||||
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);
|
||||
if (m.find() == false) {
|
||||
throw new IllegalStateException();
|
||||
@ -84,8 +86,10 @@ public class CommandCreoleColorAndSizeChange implements Command {
|
||||
if (m.group(2) != null) {
|
||||
fc2 = fc2.changeSize(Integer.parseInt(m.group(2)));
|
||||
}
|
||||
try {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -93,5 +97,8 @@ public class CommandCreoleColorAndSizeChange implements Command {
|
||||
stripe.analyzeAndAdd(m.group(4));
|
||||
stripe.setActualFontConfiguration(fc1);
|
||||
return line.substring(m.group(1).length());
|
||||
} catch (NoSuchColorException e) {
|
||||
throw new NoSuchColorRuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
import net.sourceforge.plantuml.graphic.Splitter;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
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 {
|
||||
|
||||
@ -69,18 +71,23 @@ public class CommandCreoleColorChange implements Command {
|
||||
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);
|
||||
if (m.find() == false) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
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);
|
||||
stripe.setActualFontConfiguration(fc2);
|
||||
stripe.analyzeAndAdd(m.group(3));
|
||||
stripe.setActualFontConfiguration(fc1);
|
||||
return line.substring(m.group(1).length());
|
||||
} catch (NoSuchColorException e) {
|
||||
throw new NoSuchColorRuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ public class CommandCreoleOpenIcon implements Command {
|
||||
final String colorName = Parser.getColor(m.group(3));
|
||||
HColor color = null;
|
||||
if (colorName != null) {
|
||||
color = colorSet.getColorIfValid(colorName);
|
||||
color = colorSet.getColorOrWhite(colorName);
|
||||
}
|
||||
stripe.addOpenIcon(src, scale, color);
|
||||
return line.substring(m.group(1).length());
|
||||
|
@ -76,7 +76,7 @@ public class CommandCreoleSprite implements Command {
|
||||
final String colorName = Parser.getColor(m.group(3));
|
||||
HColor color = null;
|
||||
if (colorName != null) {
|
||||
color = colorSet.getColorIfValid(colorName);
|
||||
color = colorSet.getColorOrWhite(colorName);
|
||||
}
|
||||
stripe.addSprite(src, scale, color);
|
||||
return line.substring(m.group(1).length());
|
||||
|
@ -40,6 +40,7 @@ import java.util.List;
|
||||
|
||||
import net.sourceforge.plantuml.EmbeddedDiagram;
|
||||
import net.sourceforge.plantuml.ISkinSimple;
|
||||
import net.sourceforge.plantuml.SpriteContainerEmpty;
|
||||
import net.sourceforge.plantuml.StringUtils;
|
||||
import net.sourceforge.plantuml.creole.CreoleContext;
|
||||
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.graphic.FontConfiguration;
|
||||
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 {
|
||||
|
||||
@ -144,4 +148,14 @@ public class CreoleParser implements SheetBuilder {
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,7 +106,8 @@ public class StripeTable implements Stripe {
|
||||
}
|
||||
final String[] color = line.substring(idx1, idx2).split(",");
|
||||
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;
|
||||
|
@ -40,6 +40,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.sourceforge.plantuml.EmbeddedDiagram;
|
||||
import net.sourceforge.plantuml.FontParam;
|
||||
@ -76,7 +78,6 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
||||
ILeaf entity, Style style) {
|
||||
super(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
new FontConfiguration(skinParam, fontParam, stereotype));
|
||||
|
||||
this.style = style;
|
||||
this.rawBody2 = Display.create(rawBody);
|
||||
this.stereotype = stereotype;
|
||||
@ -118,6 +119,7 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
||||
}
|
||||
|
||||
private static boolean isTreeOrTable(String s) {
|
||||
s = StringUtils.trinNoTrace(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) {
|
||||
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()) {
|
||||
final CharSequence s = it.next();
|
||||
if (isTreeOrTable(StringUtils.trinNoTrace(s))) {
|
||||
result.add(s);
|
||||
String s = it.next().toString();
|
||||
if (isTreeOrTable(s)) {
|
||||
result.add(purge(s, start));
|
||||
} else {
|
||||
it.previous();
|
||||
return result;
|
||||
@ -213,6 +221,13 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
||||
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) {
|
||||
final TextBlock area = getArea(stringBounder);
|
||||
if (area instanceof WithPorts) {
|
||||
|
@ -59,7 +59,6 @@ public class BodyEnhanced2 extends BodyEnhancedAbstract {
|
||||
BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple skinParam, HorizontalAlignment align,
|
||||
FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy) {
|
||||
super(align, titleConfig);
|
||||
|
||||
this.rawBody = rawBody;
|
||||
this.lineBreakStrategy = lineBreakStrategy;
|
||||
this.skinParam = skinParam;
|
||||
|
@ -64,6 +64,7 @@ import net.sourceforge.plantuml.creole.Parser;
|
||||
import net.sourceforge.plantuml.creole.Sheet;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock1;
|
||||
import net.sourceforge.plantuml.creole.SheetBlock2;
|
||||
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
|
||||
import net.sourceforge.plantuml.graphic.CircledCharacter;
|
||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||
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.UStroke;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class Display implements Iterable<CharSequence> {
|
||||
|
||||
@ -150,12 +152,14 @@ public class Display implements Iterable<CharSequence> {
|
||||
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>();
|
||||
for (StringLocated s : data) {
|
||||
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) {
|
||||
@ -166,6 +170,12 @@ public class Display implements Iterable<CharSequence> {
|
||||
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) {
|
||||
if (s == null) {
|
||||
// Thread.dumpStack();
|
||||
|
@ -206,7 +206,7 @@ public class GroupRoot implements IGroup {
|
||||
}
|
||||
|
||||
public SingleStrategy getSingleStrategy() {
|
||||
return SingleStrategy.SQUARRE;
|
||||
return SingleStrategy.SQUARE;
|
||||
}
|
||||
|
||||
public boolean isRemoved() {
|
||||
|
@ -54,7 +54,7 @@ import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryLineCrowfoot;
|
||||
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryNotNavigable;
|
||||
import net.sourceforge.plantuml.svek.extremity.ExtremityFactoryParenthesis;
|
||||
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.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),
|
||||
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 int margin;
|
||||
@ -147,7 +147,7 @@ public enum LinkDecor {
|
||||
case CIRCLE_FILL:
|
||||
return new ExtremityFactoryCircle(true, backgroundColor);
|
||||
case SQUARE:
|
||||
return new ExtremityFactorySquarre(backgroundColor);
|
||||
return new ExtremityFactorySquare(backgroundColor);
|
||||
case PARENTHESIS:
|
||||
return new ExtremityFactoryParenthesis();
|
||||
case CIRCLE_CONNECT:
|
||||
|
@ -64,6 +64,7 @@ import net.sourceforge.plantuml.ugraphic.UFont;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColor;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
|
||||
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
|
||||
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
|
||||
|
||||
public class Stereotype implements CharSequence {
|
||||
private final static RegexComposed circleChar = new RegexConcat( //
|
||||
@ -108,7 +109,7 @@ public class Stereotype implements CharSequence {
|
||||
private String spriteName;
|
||||
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);
|
||||
}
|
||||
|
||||
@ -129,7 +130,7 @@ public class Stereotype implements CharSequence {
|
||||
}
|
||||
|
||||
public Stereotype(String label, double radius, UFont circledFont, boolean automaticPackageStyle,
|
||||
HColorSet htmlColorSet) {
|
||||
HColorSet htmlColorSet) throws NoSuchColorException {
|
||||
if (label == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@ -153,7 +154,7 @@ public class Stereotype implements CharSequence {
|
||||
local = null;
|
||||
}
|
||||
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.spriteName = mCircleSprite.get("NAME", 0);
|
||||
this.character = '\0';
|
||||
@ -165,7 +166,7 @@ public class Stereotype implements CharSequence {
|
||||
local = null;
|
||||
}
|
||||
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.spriteName = null;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public abstract class WithLinkType {
|
||||
} else if (s.startsWith("thickness=")) {
|
||||
this.goThickness(Double.parseDouble(s.substring("thickness=".length())));
|
||||
} else {
|
||||
final HColor tmp = HColorSet.instance().getColorIfValid(s);
|
||||
final HColor tmp = HColorSet.instance().getColorOrWhite(s);
|
||||
setSpecificColor(tmp, i);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,6 @@
|
||||
package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.sourceforge.plantuml.ISkinParam;
|
||||
import net.sourceforge.plantuml.windowsdot.WindowsDotArchive;
|
||||
@ -54,11 +53,7 @@ class GraphvizWindowsLite extends AbstractGraphviz {
|
||||
protected File specificDotExe() {
|
||||
synchronized (GraphvizWindowsLite.class) {
|
||||
if (specificDotExe == null)
|
||||
try {
|
||||
specificDotExe = new WindowsDotArchive().getWindowsExeLite();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
specificDotExe = WindowsDotArchive.getInstance().getWindowsExeLite();
|
||||
|
||||
return specificDotExe;
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ package net.sourceforge.plantuml.cucadiagram.dot;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -57,11 +56,7 @@ class GraphvizWindowsOld extends AbstractGraphviz {
|
||||
specificDotExe = specificDotExeSlow();
|
||||
}
|
||||
if (specificDotExe == null)
|
||||
try {
|
||||
specificDotExe = new WindowsDotArchive().getWindowsExeLite();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
specificDotExe = WindowsDotArchive.getInstance().getWindowsExeLite();
|
||||
|
||||
return specificDotExe;
|
||||
}
|
||||
|
@ -606,7 +606,7 @@ final public class EntityImpl implements ILeaf, IGroup {
|
||||
}
|
||||
|
||||
public SingleStrategy getSingleStrategy() {
|
||||
return SingleStrategy.SQUARRE;
|
||||
return SingleStrategy.SQUARE;
|
||||
}
|
||||
|
||||
public boolean isHidden() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user