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;
diff --git a/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java b/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java
index f8eae3b8d..c5cfbe161 100644
--- a/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java
+++ b/src/net/sourceforge/plantuml/command/PSystemBasicFactory.java
@@ -89,7 +89,7 @@ public abstract class PSystemBasicFactory 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());
}
diff --git a/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java b/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java
index 31826e56d..a17f75167 100644
--- a/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java
+++ b/src/net/sourceforge/plantuml/command/PSystemCommandFactory.java
@@ -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) {
diff --git a/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java b/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java
index 596e2db81..829efe809 100644
--- a/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java
+++ b/src/net/sourceforge/plantuml/command/PSystemSingleLineFactory.java
@@ -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());
}
diff --git a/src/net/sourceforge/plantuml/command/SingleLineCommand2.java b/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
index 0865d4ecb..2bc6c2eee 100644
--- a/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
+++ b/src/net/sourceforge/plantuml/command/SingleLineCommand2.java
@@ -41,12 +41,13 @@ 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 implements Command {
private final IRegex pattern;
private final boolean doTrim;
-
+
public SingleLineCommand2(IRegex pattern) {
this(true, pattern);
}
@@ -146,13 +147,18 @@ public abstract class SingleLineCommand2 implements Command {
@@ -76,7 +77,7 @@ public final class CommandConstraintOnLinks extends SingleLineCommand2 links = diagram.getTwoLastLinks();
if (links == null) {
return CommandExecutionResult.error("Cannot put constraint on two last links");
diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java
index 7b025b85f..c8b10044a 100644
--- a/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java
+++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryNote.java
@@ -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 {
@@ -70,7 +71,7 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand {
@@ -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();
diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java
index c2c98be65..81df04f70 100644
--- a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java
+++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnEntity.java
@@ -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 {
@@ -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);
diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java
index c7b4398a6..09984c290 100644
--- a/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java
+++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryNoteOnLink.java
@@ -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 {
@@ -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(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");
diff --git a/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java b/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java
index 3f0ba0b31..e90468c28 100644
--- a/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java
+++ b/src/net/sourceforge/plantuml/command/note/CommandFactoryTipOnEntity.java
@@ -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 {
@@ -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);
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java
index 692c400f9..181ec3c0e 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java
@@ -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 {
@@ -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
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
index e3f83aac5..4ca09b85a 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java
@@ -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 {
@@ -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)));
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
index 019a72eb1..7ec03e60c 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java
@@ -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 {
@@ -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) {
diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
index d7b0f3e46..6770d5732 100644
--- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
+++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java
@@ -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 {
@@ -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
diff --git a/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java b/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java
index 9d0d3bc7d..deccc7eb9 100644
--- a/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java
+++ b/src/net/sourceforge/plantuml/compositediagram/command/CommandLinkBlock.java
@@ -102,7 +102,7 @@ public class CommandLinkBlock extends SingleLineCommand2 {
private LinkDecor getLinkDecor(String s) {
if ("[]".equals(s)) {
- return LinkDecor.SQUARRE_toberemoved;
+ return LinkDecor.SQUARE_toberemoved;
}
return LinkDecor.NONE;
}
diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java
index 58ca24be8..b8a9ed7a0 100644
--- a/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java
+++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorAndSizeChange.java
@@ -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,14 +86,19 @@ public class CommandCreoleColorAndSizeChange implements Command {
if (m.group(2) != null) {
fc2 = fc2.changeSize(Integer.parseInt(m.group(2)));
}
- if (m.group(3) != null) {
- final HColor color = HColorSet.instance().getColorIfValid(m.group(3));
- fc2 = fc2.changeColor(color);
- }
+ try {
+ if (m.group(3) != null) {
+ final String s = m.group(3);
+ final HColor color = HColorSet.instance().getColor(s);
+ fc2 = fc2.changeColor(color);
+ }
- stripe.setActualFontConfiguration(fc2);
- stripe.analyzeAndAdd(m.group(4));
- stripe.setActualFontConfiguration(fc1);
- return line.substring(m.group(1).length());
+ stripe.setActualFontConfiguration(fc2);
+ stripe.analyzeAndAdd(m.group(4));
+ stripe.setActualFontConfiguration(fc1);
+ return line.substring(m.group(1).length());
+ } catch (NoSuchColorException e) {
+ throw new NoSuchColorRuntimeException();
+ }
}
}
diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java
index 001e54516..a299e6ffc 100644
--- a/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java
+++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleColorChange.java
@@ -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 FontConfiguration fc2 = fc1.changeColor(color);
- stripe.setActualFontConfiguration(fc2);
- stripe.analyzeAndAdd(m.group(3));
- stripe.setActualFontConfiguration(fc1);
- return line.substring(m.group(1).length());
+ 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();
+ }
}
}
diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java
index 15024218e..30977e83e 100644
--- a/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java
+++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleOpenIcon.java
@@ -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());
diff --git a/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java
index 9b95331e7..c349c9480 100644
--- a/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java
+++ b/src/net/sourceforge/plantuml/creole/command/CommandCreoleSprite.java
@@ -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());
diff --git a/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java b/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java
index 081770455..d8bbde7d9 100644
--- a/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java
+++ b/src/net/sourceforge/plantuml/creole/legacy/CreoleParser.java
@@ -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();
+ }
+ }
}
diff --git a/src/net/sourceforge/plantuml/creole/legacy/StripeTable.java b/src/net/sourceforge/plantuml/creole/legacy/StripeTable.java
index f62b442e1..b66e46e82 100644
--- a/src/net/sourceforge/plantuml/creole/legacy/StripeTable.java
+++ b/src/net/sourceforge/plantuml/creole/legacy/StripeTable.java
@@ -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;
diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced1.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced1.java
index f26b346b6..d7970bf2d 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced1.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced1.java
@@ -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 buildTreeOrTable(String init, ListIterator it) {
final List result = new ArrayList();
- 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) {
diff --git a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java
index 38e73facb..e0f72ddda 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/BodyEnhanced2.java
@@ -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;
diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java
index c73b0b0fe..a9facdeed 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Display.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java
@@ -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 {
@@ -150,12 +152,14 @@ public class Display implements Iterable {
return create(Arrays.asList(s));
}
- public static Display createFoo(List data) {
+ public static Display createFoo(List data) throws NoSuchColorException {
final List tmp = new ArrayList();
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 {
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();
diff --git a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
index 0725c6fc2..8195b9bfb 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/GroupRoot.java
@@ -206,7 +206,7 @@ public class GroupRoot implements IGroup {
}
public SingleStrategy getSingleStrategy() {
- return SingleStrategy.SQUARRE;
+ return SingleStrategy.SQUARE;
}
public boolean isRemoved() {
diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java b/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java
index 6e653821c..653d8af06 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/LinkDecor.java
@@ -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:
@@ -156,4 +156,4 @@ public enum LinkDecor {
return null;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java b/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java
index e3d7e888b..326eb8dfa 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/LinkMiddleDecor.java
@@ -70,4 +70,4 @@ public enum LinkMiddleDecor {
return this;
}
-}
+}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java b/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java
index 856ac185a..a46188d52 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/Stereotype.java
@@ -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;
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java b/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java
index baf299459..6367bedd5 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/WithLinkType.java
@@ -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);
}
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsLite.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsLite.java
index 7a12b1b6c..ab7c2eb52 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsLite.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsLite.java
@@ -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;
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsOld.java b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsOld.java
index b53c6f84f..cd538806a 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsOld.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizWindowsOld.java
@@ -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;
}
diff --git a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
index 70789e7f9..a7f53cea1 100644
--- a/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
+++ b/src/net/sourceforge/plantuml/cucadiagram/entity/EntityImpl.java
@@ -606,7 +606,7 @@ final public class EntityImpl implements ILeaf, IGroup {
}
public SingleStrategy getSingleStrategy() {
- return SingleStrategy.SQUARRE;
+ return SingleStrategy.SQUARE;
}
public boolean isHidden() {
diff --git a/src/net/sourceforge/plantuml/cute/VarArgs.java b/src/net/sourceforge/plantuml/cute/VarArgs.java
index 6a83b68e8..55222f1c6 100644
--- a/src/net/sourceforge/plantuml/cute/VarArgs.java
+++ b/src/net/sourceforge/plantuml/cute/VarArgs.java
@@ -94,7 +94,7 @@ public class VarArgs {
if (value == null) {
return HColorUtils.BLACK;
}
- final HColor result = HColorSet.instance().getColorIfValid(value);
+ final HColor result = HColorSet.instance().getColorOrWhite(value);
if (result == null) {
return HColorUtils.BLACK;
}
diff --git a/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java b/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java
index 3d5a2f65f..4312f5920 100644
--- a/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java
+++ b/src/net/sourceforge/plantuml/descdiagram/CommandCreateDomain.java
@@ -58,6 +58,7 @@ import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreateDomain extends SingleLineCommand2 {
public static final String DISPLAY_WITH_GENERIC = "[%g](.+?)(?:\\<(" + GenericRegexProducer.PATTERN + ")\\>)?[%g]";
@@ -83,7 +84,7 @@ public class CommandCreateDomain extends SingleLineCommand2
}
@Override
- protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
String type = arg.get("TYPE", 0);
String display = arg.getLazzy("DISPLAY", 0);
String codeString = arg.getLazzy("CODE", 0);
@@ -91,7 +92,8 @@ public class CommandCreateDomain extends SingleLineCommand2
codeString = display;
}
// final String genericOption = arg.getLazzy("DISPLAY", 1);
- // final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0);
+ // final String generic = genericOption != null ? genericOption :
+ // arg.get("GENERIC", 0);
final String stereotype = arg.get("STEREO", 0);
@@ -109,25 +111,27 @@ public class CommandCreateDomain extends SingleLineCommand2
IEntity entity;
if (group != null) {
final IGroup currentGroup = diagram.getCurrentGroup();
- diagram.gotoGroup(ident, code, d, type.equalsIgnoreCase("domain") ? GroupType.DOMAIN
- : GroupType.REQUIREMENT, currentGroup, NamespaceStrategy.SINGLE);
+ diagram.gotoGroup(ident, code, d,
+ type.equalsIgnoreCase("domain") ? GroupType.DOMAIN : GroupType.REQUIREMENT, currentGroup,
+ NamespaceStrategy.SINGLE);
entity = diagram.getCurrentGroup();
} else {
- entity = diagram.createLeaf(ident, code, d, type.equalsIgnoreCase("domain") ? LeafType.DOMAIN
- : LeafType.REQUIREMENT, null);
+ entity = diagram.createLeaf(ident, code, d,
+ type.equalsIgnoreCase("domain") ? LeafType.DOMAIN : LeafType.REQUIREMENT, null);
}
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()));
}
if (urlString != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
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));
if (type.equalsIgnoreCase("domain")) {
if (stereotype != null && stereotype.equalsIgnoreCase("<>")) {
type = "machine";
diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java
index 87ccc72cb..c003c348b 100644
--- a/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java
+++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java
@@ -57,6 +57,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;
public class CommandArchimate extends SingleLineCommand2 {
@@ -119,7 +120,7 @@ public class CommandArchimate extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String codeRaw = arg.getLazzy("CODE", 0);
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimateMultilines.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimateMultilines.java
index 06adaf7aa..15309f227 100644
--- a/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimateMultilines.java
+++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimateMultilines.java
@@ -58,6 +58,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;
public class CommandArchimateMultilines extends CommandMultilines2 {
@@ -98,7 +99,7 @@ public class CommandArchimateMultilines extends CommandMultilines2 {
- public static final String ALL_TYPES = "artifact|actor/|actor|folder|card|file|package|rectangle|label|node|frame|cloud|database|queue|stack|storage|agent|usecase/|usecase|component|boundary|control|entity|interface|circle|collections|port|portin|portout";
+ public static final String ALL_TYPES = "artifact|actor/|actor|folder|card|file|package|rectangle|hexagon|label|node|frame|cloud|database|queue|stack|storage|agent|usecase/|usecase|component|boundary|control|entity|interface|circle|collections|port|portin|portout";
public CommandCreateElementFull() {
super(getRegexConcat());
@@ -154,7 +155,7 @@ public class CommandCreateElementFull extends SingleLineCommand2 {
@@ -123,7 +124,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2 {
@@ -147,7 +148,7 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2 {
@@ -226,7 +227,7 @@ public class CommandLinkElement extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String ent1String = arg.get("ENT1", 0);
final String ent2String = arg.get("ENT2", 0);
final Ident ident1 = diagram.buildFullyQualified(ent1String);
diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java
index a3330432a..17e269478 100644
--- a/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java
+++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandPackageWithUSymbol.java
@@ -63,6 +63,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 CommandPackageWithUSymbol extends SingleLineCommand2 {
@@ -74,7 +75,7 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2 closeComparator(String center) {
- final HColorSimple centerColor = (HColorSimple) colors.getColorIfValid(center);
+ final HColorSimple centerColor = (HColorSimple) colors.getColorOrWhite(center);
return new Comparator() {
public int compare(String col1, String col2) {
- final double dist1 = centerColor.distance((HColorSimple) colors.getColorIfValid(col1));
- final double dist2 = centerColor.distance((HColorSimple) colors.getColorIfValid(col2));
+ final double dist1 = centerColor.distance((HColorSimple) colors.getColorOrWhite(col1));
+ final double dist2 = centerColor.distance((HColorSimple) colors.getColorOrWhite(col2));
return (int) Math.signum(dist1 - dist2);
}
};
@@ -255,7 +255,7 @@ public class PSystemColors extends AbstractPSystem implements UDrawable {
int j = 0;
for (String name : colors.names()) {
UGraphic tmp = getPositioned(ug, i, j);
- final HColorSimple color = (HColorSimple) colors.getColorIfValid(name);
+ final HColorSimple color = (HColorSimple) colors.getColorOrWhite(name);
applyColor(tmp, color).draw(new URectangle(rectangleWidth, rectangleHeight));
final TextBlock tt = getTextName(font, name, color);
final Dimension2D dimText = tt.calculateDimension(ug.getStringBounder());
diff --git a/src/net/sourceforge/plantuml/error/PSystemError.java b/src/net/sourceforge/plantuml/error/PSystemError.java
index c66aa0571..ff97309be 100644
--- a/src/net/sourceforge/plantuml/error/PSystemError.java
+++ b/src/net/sourceforge/plantuml/error/PSystemError.java
@@ -327,7 +327,7 @@ public abstract class PSystemError extends AbstractPSystem {
private TextBlockBackcolored getMessageDedication() {
final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
- final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorIfValid("#eae2c9");
+ final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorOrWhite("#eae2c9");
final BufferedImage qrcode = smaller(
utils.exportFlashcode("http://plantuml.com/dedication", Color.BLACK, backColor.getColor999()));
@@ -350,7 +350,7 @@ public abstract class PSystemError extends AbstractPSystem {
}
private TextBlockBackcolored getMessageAdopt() {
- final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorIfValid("#eff4d2");
+ final HColorSimple backColor = (HColorSimple) HColorSet.instance().getColorOrWhite("#eff4d2");
final Display disp = Display.create("Adopt-a-Word and put your message here!", " ",
"Details on [[http://plantuml.com/adopt]]", " ");
@@ -458,8 +458,9 @@ public abstract class PSystemError extends AbstractPSystem {
}
- public int size() {
- return trace.size();
+ public int score() {
+ final int result = trace.size() * 10 + singleError.score();
+ return result;
}
private BufferedImage smaller(BufferedImage im) {
diff --git a/src/net/sourceforge/plantuml/error/PSystemErrorPreprocessor.java b/src/net/sourceforge/plantuml/error/PSystemErrorPreprocessor.java
index bd2696ab1..991beb51b 100644
--- a/src/net/sourceforge/plantuml/error/PSystemErrorPreprocessor.java
+++ b/src/net/sourceforge/plantuml/error/PSystemErrorPreprocessor.java
@@ -48,12 +48,9 @@ public class PSystemErrorPreprocessor extends PSystemError {
final DiagramType type = DiagramType.getTypeFromArobaseStart(input.get(0).getString());
this.setSource(new UmlSource(input, type == DiagramType.UML));
this.trace = trace;
- this.singleError = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, getLastLine().getPreprocessorError(), getLastLine()
- .getLocation());
+ this.singleError = new ErrorUml(ErrorUmlType.SYNTAX_ERROR, getLastLine().getPreprocessorError(), 0,
+ getLastLine().getLocation());
}
-
-
-
}
diff --git a/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java b/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java
index be30cd4e9..0a8fea7c7 100644
--- a/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java
+++ b/src/net/sourceforge/plantuml/error/PSystemErrorUtils.java
@@ -82,7 +82,7 @@ public class PSystemErrorUtils {
private static PSystemErrorV2 mergeV2(List errorsV2) {
PSystemErrorV2 result = null;
for (PSystemErrorV2 err : errorsV2) {
- if (result == null || result.size() < err.size()) {
+ if (result == null || result.score() < err.score()) {
result = err;
}
}
diff --git a/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java b/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java
index 7eadc920b..a68eae270 100644
--- a/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java
+++ b/src/net/sourceforge/plantuml/graphic/ColorAndSizeChange.java
@@ -53,7 +53,8 @@ class ColorAndSizeChange implements FontChange {
ColorAndSizeChange(String s) {
final Matcher2 matcherColor = colorPattern.matcher(s);
if (matcherColor.find()) {
- color = HColorSet.instance().getColorIfValid(matcherColor.group(1));
+ final String s1 = matcherColor.group(1);
+ color = HColorSet.instance().getColorOrWhite(s1);
} else {
color = null;
}
diff --git a/src/net/sourceforge/plantuml/graphic/ColorChange.java b/src/net/sourceforge/plantuml/graphic/ColorChange.java
index eb7812a88..047dcc761 100644
--- a/src/net/sourceforge/plantuml/graphic/ColorChange.java
+++ b/src/net/sourceforge/plantuml/graphic/ColorChange.java
@@ -52,7 +52,8 @@ class ColorChange implements FontChange {
if (matcherColor.find() == false) {
throw new IllegalArgumentException();
}
- this.color = HColorSet.instance().getColorIfValid(matcherColor.group(1));
+ final String s1 = matcherColor.group(1);
+ this.color = HColorSet.instance().getColorOrWhite(s1);
}
HColor getColor() {
diff --git a/src/net/sourceforge/plantuml/graphic/FontStyle.java b/src/net/sourceforge/plantuml/graphic/FontStyle.java
index 7d36d25b1..ebf647793 100644
--- a/src/net/sourceforge/plantuml/graphic/FontStyle.java
+++ b/src/net/sourceforge/plantuml/graphic/FontStyle.java
@@ -127,10 +127,10 @@ public enum FontStyle {
return null;
}
final String color = m.group(1);
- if (HColorSet.instance().getColorIfValid(color) != null) {
- return HColorSet.instance().getColorIfValid(color);
+ if (color == null) {
+ return null;
}
- return null;
+ return HColorSet.instance().getColorOrWhite(color);
}
public String getDeactivationPattern() {
diff --git a/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java b/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java
index d69d254bd..f35ac0c33 100644
--- a/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java
+++ b/src/net/sourceforge/plantuml/graphic/HtmlColorAndStyle.java
@@ -44,6 +44,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.HColorSet;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class HtmlColorAndStyle {
@@ -85,7 +86,7 @@ public class HtmlColorAndStyle {
return StyleSignature.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
}
- public static HtmlColorAndStyle build(ISkinParam skinParam, String definition) {
+ public static HtmlColorAndStyle build(ISkinParam skinParam, String definition) throws NoSuchColorException {
HColor arrowColor;
HColor arrowHeadColor = null;
if (UseStyle.useBetaStyle()) {
@@ -103,7 +104,7 @@ public class HtmlColorAndStyle {
style = tmpStyle;
continue;
}
- final HColor tmpColor = set.getColorIfValid(s);
+ final HColor tmpColor = s == null ? null : set.getColor(s);
if (tmpColor != null) {
arrowColor = tmpColor;
}
diff --git a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
index b6892c002..73371b4a9 100644
--- a/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
+++ b/src/net/sourceforge/plantuml/graphic/QuoteUtils.java
@@ -278,7 +278,19 @@ public class QuoteUtils {
"Ab bar'f gnyxvat nobhg yrnivat gur fvatyr znexrg", "...rnfvrfg oht gb svk va uhzna uvfgbel",
"Arire nggevohgr gb znyvpr jung pna or rkcynvarq ol fghcvqvgl", "Guvf oht nssrpgf iveghnyyl abobql",
"Qba'g rire hfr gur jbeq fzneg jvgu zr", "Gur Ertrareba vf ernyyl xvpxvat va guvf zbeavat",
- "V'ir frra fbsgjner fb onq gung rira vgf ohtf unq ohtf");
+ "V'ir frra fbsgjner fb onq gung rira vgf ohtf unq ohtf", "Nera'g jr fhccbfrq gb ubyq nyy gur pneqf ?",
+ "Lbh'er abg yvxr, fbzrbar'f penml hapyr jub pna whfg pbqr jungrire",
+ "Gurer ner bayl 1300 Ulcbgurezvn qrnguf va gur HF cre lrne. Fgbc jrnevat pbngf!",
+ "Jryy, gurfr Trezna pne znahsnpgheref ner ernyyl gnxvat gurve fjrrg gvzr",
+ "Ibhf z'nirm ih, znvf ibhf ar z'nirm cnf ertneqr",
+ "Obevf whfg fraq hf na bira-ernql oht svk nobhg guvf bar!", "Crefba. Jbzna. Zna. Pnzren. GI. Oht.",
+ "Whfg svavfuvat hc gur frpbaq pbng abj, Ze. Ovqra", "Yn senzobvfr rfg cbapghryyr - Rg yr pvgeba, cerffr",
+ "Gunax lbh, lbh'ir znqr lbhe cbvag pyrne gung lbh oryvrir vg vf n qrongnoyr cbvag",
+ "Gur obng vf fnsre jura va cbeg, ohg gung vf abg jung obngf jrer ohvyg sbe.",
+ "Vg'f abg gernfba. Vg'f nygreangvir yblnygl",
+ "Gur zna jub zbirf n zbhagnva ortvaf ol pneelvat njnl fznyy fgbarf"
+
+ );
private QuoteUtils() {
}
diff --git a/src/net/sourceforge/plantuml/graphic/Rainbow.java b/src/net/sourceforge/plantuml/graphic/Rainbow.java
index 675125842..d622def5a 100644
--- a/src/net/sourceforge/plantuml/graphic/Rainbow.java
+++ b/src/net/sourceforge/plantuml/graphic/Rainbow.java
@@ -47,6 +47,7 @@ import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class Rainbow {
@@ -105,7 +106,7 @@ public class Rainbow {
return result;
}
- public static Rainbow build(ISkinParam skinParam, String colorString, int colorArrowSeparationSpace) {
+ public static Rainbow build(ISkinParam skinParam, String colorString, int colorArrowSeparationSpace) throws NoSuchColorException {
if (colorString == null) {
return Rainbow.none();
}
diff --git a/src/net/sourceforge/plantuml/graphic/SkinParameter.java b/src/net/sourceforge/plantuml/graphic/SkinParameter.java
index c63ec6c5b..e7ec28b85 100644
--- a/src/net/sourceforge/plantuml/graphic/SkinParameter.java
+++ b/src/net/sourceforge/plantuml/graphic/SkinParameter.java
@@ -46,7 +46,7 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
public class SkinParameter {
- public static final SkinParameter DATABASE = new SkinParameter(SName.databse, "DATABASE",
+ public static final SkinParameter DATABASE = new SkinParameter(SName.database, "DATABASE",
ColorParam.databaseBackground, ColorParam.databaseBorder, FontParam.DATABASE,
FontParam.DATABASE_STEREOTYPE);
@@ -100,11 +100,18 @@ public class SkinParameter {
ColorParam.rectangleBackground, ColorParam.rectangleBorder, FontParam.RECTANGLE,
FontParam.RECTANGLE_STEREOTYPE, LineParam.rectangleBorder, CornerParam.rectangle);
+ public static final SkinParameter LABEL = new SkinParameter(SName.label, "LABEL", ColorParam.rectangleBackground,
+ ColorParam.rectangleBorder, FontParam.LABEL, FontParam.LABEL_STEREOTYPE);
+
+ public static final SkinParameter HEXAGON = new SkinParameter(SName.rectangle, "HEXAGON",
+ ColorParam.hexagonBackground, ColorParam.hexagonBorder, FontParam.HEXAGON, FontParam.HEXAGON_STEREOTYPE,
+ LineParam.hexagonBorder, CornerParam.hexagon);
+
public static final SkinParameter ARCHIMATE = new SkinParameter(SName.archimate, "ARCHIMATE",
ColorParam.archimateBackground, ColorParam.archimateBorder, FontParam.ARCHIMATE,
FontParam.ARCHIMATE_STEREOTYPE, LineParam.archimateBorder, CornerParam.archimate);
- public static final SkinParameter COLLECTIONS = new SkinParameter(SName.collection, "COLLECTIONS",
+ public static final SkinParameter COLLECTIONS = new SkinParameter(SName.collections, "COLLECTIONS",
ColorParam.collectionsBackground, ColorParam.collectionsBorder, FontParam.RECTANGLE,
FontParam.RECTANGLE_STEREOTYPE);
@@ -140,7 +147,7 @@ public class SkinParameter {
private final LineParam lineParam;
private final CornerParam roundParam;
private final SName styleName;
-
+
@Override
public String toString() {
return name;
diff --git a/src/net/sourceforge/plantuml/graphic/StringBounderRaw.java b/src/net/sourceforge/plantuml/graphic/StringBounderRaw.java
new file mode 100644
index 000000000..83dad329c
--- /dev/null
+++ b/src/net/sourceforge/plantuml/graphic/StringBounderRaw.java
@@ -0,0 +1,64 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2020, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * If you like this project or if you find it useful, you can support us at:
+ *
+ * http://plantuml.com/patreon (only 1$ per month!)
+ * http://plantuml.com/paypal
+ *
+ * This file is part of PlantUML.
+ *
+ * PlantUML is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PlantUML distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ *
+ *
+ * Original Author: Arnaud Roques
+ *
+ *
+ */
+package net.sourceforge.plantuml.graphic;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.text.RichText;
+import net.sourceforge.plantuml.text.StyledString;
+import net.sourceforge.plantuml.ugraphic.UFont;
+
+public abstract class StringBounderRaw implements StringBounder {
+
+ public final Dimension2D calculateDimension(UFont font, String text) {
+ if (RichText.isRich(text)) {
+ double width = 0;
+ double height = 0;
+ for (StyledString s : StyledString.build(text)) {
+ final UFont newFont = s.getStyle().mutateFont(font);
+ final Dimension2D rect = calculateDimensionInternal(newFont, s.getText());
+ width += rect.getWidth();
+ height = Math.max(height, rect.getHeight());
+ }
+ return new Dimension2DDouble(width, height);
+ }
+ return calculateDimensionInternal(font, text);
+ }
+
+ protected abstract Dimension2D calculateDimensionInternal(UFont font, String text);
+
+}
diff --git a/src/net/sourceforge/plantuml/graphic/USymbol.java b/src/net/sourceforge/plantuml/graphic/USymbol.java
index b622b21f6..c26cdab78 100644
--- a/src/net/sourceforge/plantuml/graphic/USymbol.java
+++ b/src/net/sourceforge/plantuml/graphic/USymbol.java
@@ -65,14 +65,15 @@ public abstract class USymbol {
new USymbolFolder(SkinParameter.FOLDER, false));
public final static USymbol FILE = record("FILE", SkinParameter.FILE, new USymbolFile());
public final static USymbol RECTANGLE = record("RECTANGLE", SkinParameter.RECTANGLE,
- new USymbolRect(SkinParameter.RECTANGLE));
- public final static USymbol LABEL = record("LABEL", SkinParameter.RECTANGLE,
- new USymbolLabel(SkinParameter.RECTANGLE));
+ new USymbolRectangle(SkinParameter.RECTANGLE));
+ public final static USymbol HEXAGON = record("HEXAGON", SkinParameter.HEXAGON, new USymbolHexagon());
+ public final static USymbol LABEL = record("LABEL", SkinParameter.LABEL,
+ new USymbolLabel(SkinParameter.LABEL));
public final static USymbol ARCHIMATE = record("ARCHIMATE", SkinParameter.ARCHIMATE,
- new USymbolRect(SkinParameter.ARCHIMATE));
+ new USymbolRectangle(SkinParameter.ARCHIMATE));
public final static USymbol COLLECTIONS = record("COLLECTIONS", SkinParameter.COLLECTIONS,
- new USymbolCollections(SkinParameter.RECTANGLE));
- public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRect(SkinParameter.AGENT));
+ new USymbolCollections(SkinParameter.COLLECTIONS));
+ public final static USymbol AGENT = record("AGENT", SkinParameter.AGENT, new USymbolRectangle(SkinParameter.AGENT));
public final static USymbol ACTOR_STICKMAN = record("ACTOR_STICKMAN", SkinParameter.ACTOR,
new USymbolActor(ActorStyle.STICKMAN));
public final static USymbol ACTOR_STICKMAN_BUSINESS = record("ACTOR_STICKMAN_BUSINESS", SkinParameter.ACTOR,
@@ -198,6 +199,9 @@ public abstract class USymbol {
if (s.equalsIgnoreCase("entity")) {
return ENTITY_DOMAIN;
}
+ if (s.equalsIgnoreCase("circle")) {
+ return INTERFACE;
+ }
final USymbol result = all.get(StringUtils.goUpperCase(s.replaceAll("\\W", "")));
return result;
}
@@ -214,6 +218,8 @@ public abstract class USymbol {
usymbol = USymbol.PACKAGE;
} else if (symbol.equalsIgnoreCase("rectangle")) {
usymbol = USymbol.RECTANGLE;
+ } else if (symbol.equalsIgnoreCase("hexagon")) {
+ usymbol = USymbol.HEXAGON;
} else if (symbol.equalsIgnoreCase("label")) {
usymbol = USymbol.LABEL;
} else if (symbol.equalsIgnoreCase("collections")) {
diff --git a/src/net/sourceforge/plantuml/graphic/USymbolHexagon.java b/src/net/sourceforge/plantuml/graphic/USymbolHexagon.java
new file mode 100644
index 000000000..86cbab92a
--- /dev/null
+++ b/src/net/sourceforge/plantuml/graphic/USymbolHexagon.java
@@ -0,0 +1,142 @@
+/* ========================================================================
+ * PlantUML : a free UML diagram generator
+ * ========================================================================
+ *
+ * (C) Copyright 2009-2020, Arnaud Roques
+ *
+ * Project Info: http://plantuml.com
+ *
+ * If you like this project or if you find it useful, you can support us at:
+ *
+ * http://plantuml.com/patreon (only 1$ per month!)
+ * http://plantuml.com/paypal
+ *
+ * This file is part of PlantUML.
+ *
+ * PlantUML is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * PlantUML distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ *
+ *
+ * Original Author: Arnaud Roques
+ *
+ *
+ */
+package net.sourceforge.plantuml.graphic;
+
+import java.awt.geom.Dimension2D;
+
+import net.sourceforge.plantuml.Dimension2DDouble;
+import net.sourceforge.plantuml.graphic.USymbol.Margin;
+import net.sourceforge.plantuml.ugraphic.Shadowable;
+import net.sourceforge.plantuml.ugraphic.UGraphic;
+import net.sourceforge.plantuml.ugraphic.UPath;
+import net.sourceforge.plantuml.ugraphic.UTranslate;
+
+public class USymbolHexagon extends USymbol {
+
+ @Override
+ public SkinParameter getSkinParameter() {
+ return SkinParameter.HEXAGON;
+ }
+
+ private final double marginY = 5;
+
+ @Override
+ public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
+ final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {
+ return new AbstractTextBlock() {
+
+ public void drawU(UGraphic ug) {
+ final Dimension2D dim = calculateDimension(ug.getStringBounder());
+ // ug = UGraphicStencil.create(ug, dim);
+
+ final TextBlock tb = TextBlockUtils.mergeTB(stereotype, label, stereoAlignment);
+ final double deltaX = dim.getWidth() / 4;
+ tb.drawU(ug.apply(new UTranslate(deltaX, marginY)));
+ }
+
+ public Dimension2D calculateDimension(StringBounder stringBounder) {
+ final Dimension2D dimLabel = label.calculateDimension(stringBounder);
+ final Dimension2D dimStereo = stereotype.calculateDimension(stringBounder);
+ final Dimension2D full = Dimension2DDouble.mergeTB(dimStereo, dimLabel);
+ return new Dimension2DDouble(full.getWidth() * 2, full.getHeight() + 2 * marginY);
+ }
+ };
+ }
+
+ private void drawRect(UGraphic ug, double width, double height, boolean shadowing, double roundCorner,
+ double diagonalCorner) {
+// final UShape shape = new URectangle(width, height);
+ final UPath shape = new UPath();
+ final double dx = width / 8;
+ shape.moveTo(0, height / 2);
+ shape.lineTo(dx, 0);
+ shape.lineTo(width - dx, 0);
+ shape.lineTo(width, height / 2);
+ shape.lineTo(width - dx, height);
+ shape.lineTo(dx, height);
+ shape.lineTo(0, height / 2);
+ shape.closePath();
+ if (shadowing) {
+ shape.setDeltaShadow(3.0);
+ }
+ ug.draw(shape);
+ }
+
+ private Margin getMargin() {
+ return new Margin(10, 10, 10, 10);
+ }
+
+
+ @Override
+ public TextBlock asBig(final TextBlock title, final HorizontalAlignment labelAlignment, final TextBlock stereotype,
+ final double width, final double height, final SymbolContext symbolContext,
+ final HorizontalAlignment stereoAlignment) {
+ return new AbstractTextBlock() {
+ public void drawU(UGraphic ug) {
+ final Dimension2D dim = calculateDimension(ug.getStringBounder());
+ ug = symbolContext.apply(ug);
+ drawRect(ug, dim.getWidth(), dim.getHeight(), symbolContext.isShadowing(),
+ symbolContext.getRoundCorner(), 0);
+ final Dimension2D dimStereo = stereotype.calculateDimension(ug.getStringBounder());
+ final double posStereoX;
+ final double posStereoY;
+ if (stereoAlignment == HorizontalAlignment.RIGHT) {
+ posStereoX = width - dimStereo.getWidth() - getMargin().getX1() / 2;
+ posStereoY = getMargin().getY1() / 2;
+ } else {
+ posStereoX = (width - dimStereo.getWidth()) / 2;
+ posStereoY = 2;
+ }
+ stereotype.drawU(ug.apply(new UTranslate(posStereoX, posStereoY)));
+ final Dimension2D dimTitle = title.calculateDimension(ug.getStringBounder());
+ final double posTitle;
+ if (labelAlignment == HorizontalAlignment.LEFT) {
+ posTitle = 3;
+ } else if (labelAlignment == HorizontalAlignment.RIGHT) {
+ posTitle = width - dimTitle.getWidth() - 3;
+ } else {
+ posTitle = (width - dimTitle.getWidth()) / 2;
+ }
+ title.drawU(ug.apply(new UTranslate(posTitle, 2 + dimStereo.getHeight())));
+ }
+
+ public Dimension2D calculateDimension(StringBounder stringBounder) {
+ return new Dimension2DDouble(width, height);
+ }
+ };
+ }
+
+}
\ No newline at end of file
diff --git a/src/net/sourceforge/plantuml/graphic/USymbolRect.java b/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java
similarity index 98%
rename from src/net/sourceforge/plantuml/graphic/USymbolRect.java
rename to src/net/sourceforge/plantuml/graphic/USymbolRectangle.java
index 806bb3142..814bf3196 100644
--- a/src/net/sourceforge/plantuml/graphic/USymbolRect.java
+++ b/src/net/sourceforge/plantuml/graphic/USymbolRectangle.java
@@ -44,11 +44,11 @@ import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-class USymbolRect extends USymbol {
+class USymbolRectangle extends USymbol {
private final SkinParameter skinParameter;
- public USymbolRect(SkinParameter skinParameter) {
+ public USymbolRectangle(SkinParameter skinParameter) {
this.skinParameter = skinParameter;
}
diff --git a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java
index 37733a465..da5458240 100644
--- a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java
+++ b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java
@@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic.color;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class ColorParser {
@@ -56,7 +57,7 @@ public class ColorParser {
this.mainType = mainType;
}
- public Colors getColor(RegexResult arg, HColorSet set) {
+ public Colors getColor(RegexResult arg, HColorSet set) throws NoSuchColorException {
if (mainType == null) {
throw new IllegalStateException();
}
diff --git a/src/net/sourceforge/plantuml/graphic/color/Colors.java b/src/net/sourceforge/plantuml/graphic/color/Colors.java
index fb1ff4768..de8d5a23b 100644
--- a/src/net/sourceforge/plantuml/graphic/color/Colors.java
+++ b/src/net/sourceforge/plantuml/graphic/color/Colors.java
@@ -50,6 +50,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class Colors {
@@ -80,7 +81,7 @@ public class Colors {
private Colors() {
}
- public Colors(String data, HColorSet set, ColorType mainType) {
+ public Colors(String data, HColorSet set, ColorType mainType) throws NoSuchColorException {
data = StringUtils.goLowerCase(data);
for (final StringTokenizer st = new StringTokenizer(data, "#;"); st.hasMoreTokens();) {
@@ -88,7 +89,7 @@ public class Colors {
final int x = s.indexOf(':');
if (x == -1) {
if (s.contains(".") == false) {
- map.put(mainType, set.getColorIfValid(s));
+ map.put(mainType, set.getColor(s));
}
} else {
final String name = s.substring(0, x);
@@ -97,7 +98,7 @@ public class Colors {
this.shadowing = value.equalsIgnoreCase("true");
} else {
final ColorType key = ColorType.getType(name);
- final HColor color = set.getColorIfValid(value);
+ final HColor color = set.getColor(value);
map.put(key, color);
}
}
@@ -185,7 +186,7 @@ public class Colors {
return ug.apply(colors.lineStyle.getStroke3());
}
- public Colors applyStereotype(Stereotype stereotype, ISkinParam skinParam, ColorParam param) {
+ public Colors applyStereotype(Stereotype stereotype, ISkinParam skinParam, ColorParam param) throws NoSuchColorException {
if (stereotype == null) {
throw new IllegalArgumentException();
}
@@ -219,7 +220,7 @@ public class Colors {
}
public Colors applyStereotypeForNote(Stereotype stereotype, ISkinParam skinParam, FontParam fontParam,
- ColorParam... params) {
+ ColorParam... params) throws NoSuchColorException {
if (stereotype == null) {
throw new IllegalArgumentException();
}
diff --git a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java
index fa20bca87..bdb919d59 100644
--- a/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java
+++ b/src/net/sourceforge/plantuml/jsondiagram/JsonDiagram.java
@@ -75,7 +75,7 @@ public class JsonDiagram extends UmlDiagram {
private final List highlighted;
public JsonDiagram(UmlDiagramType type, JsonValue json, List highlighted) {
- super(UmlDiagramType.JSON);
+ super(type);
if (json != null && (json.isString() || json.isBoolean() || json.isNumber())) {
this.root = new JsonArray();
((JsonArray) this.root).add(json);
diff --git a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
index 4eba8ea81..b69d64027 100644
--- a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
+++ b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
@@ -244,7 +244,7 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
final double heightOfRow = line.getHeightOfRow(stringBounder);
if (line.highlighted) {
final URectangle back = new URectangle(trueWidth - 2, heightOfRow).rounded(4);
- final HColor yellow = skinParam.getIHtmlColorSet().getColorIfValid("#ccff02");
+ final HColor yellow = skinParam.getIHtmlColorSet().getColorOrWhite("#ccff02");
ugline.apply(yellow).apply(yellow.bg()).apply(new UTranslate(1.5, 0)).draw(back);
}
diff --git a/src/net/sourceforge/plantuml/logo/TinyJavaLogo.java b/src/net/sourceforge/plantuml/logo/TinyJavaLogo.java
index d68402f8d..4cd6fd8c0 100644
--- a/src/net/sourceforge/plantuml/logo/TinyJavaLogo.java
+++ b/src/net/sourceforge/plantuml/logo/TinyJavaLogo.java
@@ -54,7 +54,7 @@ public class TinyJavaLogo {
}
private void message(String messageText) {
- //turtleGraphicsPane.message(messageText);
+ // turtleGraphicsPane.message(messageText);
}
private void error(String messageText) {
@@ -191,7 +191,8 @@ public class TinyJavaLogo {
case LogoToken.SETPC:
token = scanner.getToken();
- final HColor newPenColor = HColorSet.instance().getColorIfValid(token.lexeme);
+ String s = token.lexeme;
+ final HColor newPenColor = s == null ? null : HColorSet.instance().getColorOrWhite(s);
if (newPenColor == null) {
error("Unrecognized color name");
return;
diff --git a/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java b/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java
index 6bd64e313..43e172835 100644
--- a/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java
+++ b/src/net/sourceforge/plantuml/logo/TurtleGraphicsPane.java
@@ -119,8 +119,8 @@ class TurtleGraphicsPane {
poly.rotate(angle);
// ug.setAntiAliasing(false);
final HColorSet htmlColorSet = HColorSet.instance();
- final HColor turtleColor1 = htmlColorSet.getColorIfValid("OliveDrab");
- final HColor turtleColor2 = htmlColorSet.getColorIfValid("MediumSpringGreen");
+ final HColor turtleColor1 = htmlColorSet.getColorOrWhite("OliveDrab");
+ final HColor turtleColor2 = htmlColorSet.getColorOrWhite("MediumSpringGreen");
ug.apply(turtleColor1).apply(turtleColor2.bg()).apply(new UTranslate(x, -y))
.draw(poly);
diff --git a/src/net/sourceforge/plantuml/math/PSystemLatex.java b/src/net/sourceforge/plantuml/math/PSystemLatex.java
index fe1e28230..1a063146f 100644
--- a/src/net/sourceforge/plantuml/math/PSystemLatex.java
+++ b/src/net/sourceforge/plantuml/math/PSystemLatex.java
@@ -109,7 +109,7 @@ public class PSystemLatex extends AbstractPSystem {
}
private Color getColor(final String col) {
- final HColor col2 = HColorSet.instance().getColorIfValid(col);
+ final HColor col2 = col == null ? null : HColorSet.instance().getColorOrWhite(col);
final Color col3 = new ColorMapperIdentity().toColor(col2);
return col3;
}
diff --git a/src/net/sourceforge/plantuml/math/PSystemMath.java b/src/net/sourceforge/plantuml/math/PSystemMath.java
index 3211aeaf6..00b20602c 100644
--- a/src/net/sourceforge/plantuml/math/PSystemMath.java
+++ b/src/net/sourceforge/plantuml/math/PSystemMath.java
@@ -110,7 +110,7 @@ public class PSystemMath extends AbstractPSystem {
}
private Color getColor(final String col) {
- final HColor col2 = HColorSet.instance().getColorIfValid(col);
+ final HColor col2 = col == null ? null : HColorSet.instance().getColorOrWhite(col);
final Color col3 = new ColorMapperIdentity().toColor(col2);
return col3;
}
diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java
index 551c65757..ea95a36cd 100644
--- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java
+++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmode.java
@@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.ugraphic.color.HColor;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMindMapOrgmode extends SingleLineCommand2 {
@@ -62,13 +63,13 @@ public class CommandMindMapOrgmode extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String type = arg.get("TYPE", 0);
final String label = arg.get("LABEL", 0);
final String stringColor = arg.get("BACKCOLOR", 0);
HColor backColor = null;
if (stringColor != null) {
- backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(stringColor);
+ backColor = diagram.getSkinParam().getIHtmlColorSet().getColor(stringColor);
}
final int level = getLevel(type);
return diagram.addIdea(backColor, level, Display.getWithNewlines(label),
diff --git a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java
index 2d14d64ef..061ab11de 100644
--- a/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java
+++ b/src/net/sourceforge/plantuml/mindmap/CommandMindMapOrgmodeMultiline.java
@@ -49,6 +49,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.ugraphic.color.HColor;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandMindMapOrgmodeMultiline extends CommandMultilines2 {
@@ -72,7 +73,7 @@ public class CommandMindMapOrgmodeMultiline extends CommandMultilines2 lineLast = StringUtils.getSplit(MyPattern.cmpile(getPatternEnd()),
@@ -88,7 +89,7 @@ public class CommandMindMapOrgmodeMultiline extends CommandMultilines2 {
@@ -63,13 +64,13 @@ public class CommandMindMapPlus extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(MindMapDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String type = arg.get("TYPE", 0);
final String label = arg.get("LABEL", 0);
final String stringColor = arg.get("BACKCOLOR", 0);
HColor backColor = null;
if (stringColor != null) {
- backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(stringColor);
+ backColor = diagram.getSkinParam().getIHtmlColorSet().getColor(stringColor);
}
final Direction direction = type.contains("-") ? Direction.LEFT : Direction.RIGHT;
return diagram.addIdea(backColor, type.length() - 1, Display.getWithNewlines(label),
diff --git a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java
index 0c208971d..9d436103e 100644
--- a/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java
+++ b/src/net/sourceforge/plantuml/nwdiag/NwDiagram.java
@@ -145,7 +145,8 @@ public class NwDiagram extends UmlDiagram {
if (already != null) {
currentNetwork().addSquare(already, toSet(null));
}
- addSquare(null, name2, toSet(null));
+ final Square added = addSquare(null, name2, toSet(null));
+ added.sameColThan(already);
return CommandExecutionResult.ok();
}
}
@@ -353,7 +354,13 @@ public class NwDiagram extends UmlDiagram {
final Square square = ent.getValue();
if (square.getMainNetwork() == current) {
final Map conns = getLinks(square);
- grid.add(i, j, square.asTextBlock(conns, networks));
+ final Square sameCol = square.getSameCol();
+ if (sameCol != null) {
+ square.setNumCol(sameCol.getNumCol());
+ } else {
+ square.setNumCol(j);
+ }
+ grid.add(i, square.getNumCol(), square.asTextBlock(conns, networks));
}
if (square.hasItsOwnColumn()) {
j++;
@@ -377,7 +384,7 @@ public class NwDiagram extends UmlDiagram {
currentNetwork().setFullWidth("full".equalsIgnoreCase(value));
}
if ("color".equalsIgnoreCase(property)) {
- final HColor color = NwGroup.colors.getColorIfValid(value);
+ final HColor color = value == null ? null : NwGroup.colors.getColorOrWhite(value);
if (currentGroup != null) {
currentGroup.setColor(color);
} else if (currentNetwork() != null) {
diff --git a/src/net/sourceforge/plantuml/nwdiag/NwGroup.java b/src/net/sourceforge/plantuml/nwdiag/NwGroup.java
index c546549af..4e79c577e 100644
--- a/src/net/sourceforge/plantuml/nwdiag/NwGroup.java
+++ b/src/net/sourceforge/plantuml/nwdiag/NwGroup.java
@@ -110,7 +110,7 @@ public class NwGroup {
}
HColor color = getColor();
if (color == null) {
- color = colors.getColorIfValid("#AAA");
+ color = colors.getColorOrWhite("#AAA");
}
size.draw(ug, color);
diff --git a/src/net/sourceforge/plantuml/nwdiag/Square.java b/src/net/sourceforge/plantuml/nwdiag/Square.java
index eba7f9c29..c1e3d347d 100644
--- a/src/net/sourceforge/plantuml/nwdiag/Square.java
+++ b/src/net/sourceforge/plantuml/nwdiag/Square.java
@@ -62,6 +62,7 @@ public class Square {
private final Network mainNetwork;
private final ISkinSimple spriteContainer;
private boolean hasItsOwnColumn = true;
+ private Square sameCol;
@Override
public String toString() {
@@ -136,4 +137,22 @@ public class Square {
return hasItsOwnColumn;
}
+ public void sameColThan(Square sameCol) {
+ this.sameCol = sameCol;
+ }
+
+ public final Square getSameCol() {
+ return sameCol;
+ }
+
+ private int numCol = -1;
+
+ public void setNumCol(int j) {
+ this.numCol = j;
+ }
+
+ public final int getNumCol() {
+ return numCol;
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/nwdiag/VerticalLine2.java b/src/net/sourceforge/plantuml/nwdiag/VerticalLine2.java
deleted file mode 100644
index 95411ee7a..000000000
--- a/src/net/sourceforge/plantuml/nwdiag/VerticalLine2.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/* ========================================================================
- * PlantUML : a free UML diagram generator
- * ========================================================================
- *
- * (C) Copyright 2009-2020, Arnaud Roques
- *
- * Project Info: http://plantuml.com
- *
- * If you like this project or if you find it useful, you can support us at:
- *
- * http://plantuml.com/patreon (only 1$ per month!)
- * http://plantuml.com/paypal
- *
- * This file is part of PlantUML.
- *
- * PlantUML is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * PlantUML distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
- * License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- * USA.
- *
- *
- * Original Author: Arnaud Roques
- *
- */
-package net.sourceforge.plantuml.nwdiag;
-
-import java.util.Set;
-
-import net.sourceforge.plantuml.graphic.UDrawable;
-import net.sourceforge.plantuml.ugraphic.UEllipse;
-import net.sourceforge.plantuml.ugraphic.UGraphic;
-import net.sourceforge.plantuml.ugraphic.ULine;
-import net.sourceforge.plantuml.ugraphic.UTranslate;
-import net.sourceforge.plantuml.ugraphic.color.HColorNone;
-
-public class VerticalLine2 implements UDrawable {
-
- private final double y1;
- private final double y2;
- private final Set skip;
-
- public VerticalLine2(double y1, double y2, Set skip) {
- this.y1 = Math.min(y1, y2);
- this.y2 = Math.max(y1, y2);
- this.skip = skip;
- }
-
- public void drawU(UGraphic ug) {
- boolean drawn = false;
- double current = y1;
- for (Double step : skip) {
- if (step < y1) {
- continue;
- }
- assert step >= y1;
- drawn = true;
- if (step == y2) {
- drawVLine(ug, current, y2);
- } else {
- drawVLine(ug, current, Math.min(y2, step - 3));
- if (y2 > step) {
- drawArc(ug, step - 3);
- }
- }
- current = step + 9;
- if (current >= y2) {
- break;
- }
- }
- if (drawn == false) {
- drawVLine(ug, y1, y2);
- }
-
- }
-
- private void drawArc(UGraphic ug, double y) {
- final UEllipse arc = new UEllipse(11, 11, 90, -180);
- ug.apply(new HColorNone().bg()).apply(new UTranslate(-5, y)).draw(arc);
-
- }
-
- private void drawVLine(UGraphic ug, double start, double end) {
- final ULine line = ULine.vline(end - start);
- ug.apply(UTranslate.dy(start)).draw(line);
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java
index ec6a581da..9101431a4 100644
--- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java
+++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandCreateEntityObject.java
@@ -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.objectdiagram.AbstractClassOrObjectDiagram;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreateEntityObject extends SingleLineCommand2 {
@@ -77,7 +78,7 @@ public class CommandCreateEntityObject extends SingleLineCommand2 {
@@ -85,7 +86,7 @@ public class CommandCreateEntityObjectMultilines extends CommandMultilines2 {
@@ -89,7 +90,8 @@ public class CommandCreateMap extends CommandMultilines2 {
@@ -62,7 +63,7 @@ public class CommandColorTask extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(GanttDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(GanttDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String code = arg.get("CODE", 0);
final Task task = diagram.getExistingTask(code);
@@ -72,8 +73,8 @@ public class CommandColorTask extends SingleLineCommand2 {
final String color1 = arg.get("COLORS", 0);
final String color2 = arg.get("COLORS", 1);
- final HColor col1 = diagram.getIHtmlColorSet().getColorIfValid(color1);
- final HColor col2 = diagram.getIHtmlColorSet().getColorIfValid(color2);
+ final HColor col1 = color1 == null ? null : diagram.getIHtmlColorSet().getColor(color1);
+ final HColor col2 = color2 == null ? null : diagram.getIHtmlColorSet().getColor(color2);
task.setColors(new CenterBorderColor(col1, col2));
return CommandExecutionResult.ok();
diff --git a/src/net/sourceforge/plantuml/project/command/CommandNoteBottom.java b/src/net/sourceforge/plantuml/project/command/CommandNoteBottom.java
index d71917686..5cbe8c50e 100644
--- a/src/net/sourceforge/plantuml/project/command/CommandNoteBottom.java
+++ b/src/net/sourceforge/plantuml/project/command/CommandNoteBottom.java
@@ -40,6 +40,7 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.CommandMultilines;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.project.GanttDiagram;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandNoteBottom extends CommandMultilines {
@@ -52,7 +53,7 @@ public class CommandNoteBottom extends CommandMultilines {
return "(?i)^end[%s]*note$";
}
- public CommandExecutionResult execute(GanttDiagram diagram, BlocLines lines) {
+ public CommandExecutionResult execute(GanttDiagram diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
final Display strings = lines.toDisplay();
diff --git a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java
index 730d4a249..b565d1e7f 100644
--- a/src/net/sourceforge/plantuml/project/draw/TimeHeader.java
+++ b/src/net/sourceforge/plantuml/project/draw/TimeHeader.java
@@ -62,8 +62,8 @@ public abstract class TimeHeader {
return 28;
}
- protected final HColor veryLightGray = HColorSet.instance().getColorIfValid("#E0E8E8");
- protected final HColor lightGray = HColorSet.instance().getColorIfValid("#909898");
+ protected final HColor veryLightGray = HColorSet.instance().getColorOrWhite("#E0E8E8");
+ protected final HColor lightGray = HColorSet.instance().getColorOrWhite("#909898");
private final TimeScale timeScale;
protected final Day min;
diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java b/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java
index d013e3c2e..00b1b881f 100644
--- a/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java
+++ b/src/net/sourceforge/plantuml/project/lang/ComplementInColors.java
@@ -51,8 +51,8 @@ public class ComplementInColors implements Something {
public Failable getMe(GanttDiagram system, RegexResult arg, String suffix) {
final String color1 = arg.get("COMPLEMENT" + suffix, 0);
final String color2 = arg.get("COMPLEMENT" + suffix, 1);
- final HColor col1 = system.getIHtmlColorSet().getColorIfValid(color1);
- final HColor col2 = system.getIHtmlColorSet().getColorIfValid(color2);
+ final HColor col1 = color1 == null ? null : system.getIHtmlColorSet().getColorOrWhite(color1);
+ final HColor col2 = color2 == null ? null : system.getIHtmlColorSet().getColorOrWhite(color2);
return Failable.ok(new CenterBorderColor(col1, col2));
}
}
diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java b/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java
index 131457fd5..534449e68 100644
--- a/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java
+++ b/src/net/sourceforge/plantuml/project/lang/ComplementInColors2.java
@@ -51,8 +51,8 @@ public class ComplementInColors2 implements Something {
public Failable getMe(GanttDiagram system, RegexResult arg, String suffix) {
final String color1 = arg.get("COMPLEMENT" + suffix, 0);
final String color2 = arg.get("COMPLEMENT" + suffix, 1);
- final HColor col1 = system.getIHtmlColorSet().getColorIfValid(color1);
- final HColor col2 = system.getIHtmlColorSet().getColorIfValid(color2);
+ final HColor col1 = color1 == null ? null : system.getIHtmlColorSet().getColorOrWhite(color1);
+ final HColor col2 = color2 == null ? null : system.getIHtmlColorSet().getColorOrWhite(color2);
return Failable.ok(new CenterBorderColor(col1, col2));
}
diff --git a/src/net/sourceforge/plantuml/project/lang/ComplementWithColorLink.java b/src/net/sourceforge/plantuml/project/lang/ComplementWithColorLink.java
index db7137ae1..a0e7d2164 100644
--- a/src/net/sourceforge/plantuml/project/lang/ComplementWithColorLink.java
+++ b/src/net/sourceforge/plantuml/project/lang/ComplementWithColorLink.java
@@ -54,7 +54,7 @@ public class ComplementWithColorLink implements Something {
final String style0 = arg.get("COMPLEMENT" + suffix, 0);
final String color1 = arg.get("COMPLEMENT" + suffix, 1);
final String style2 = arg.get("COMPLEMENT" + suffix, 2);
- final HColor col1 = system.getIHtmlColorSet().getColorIfValid(color1);
+ final HColor col1 = color1 == null ? null : system.getIHtmlColorSet().getColorOrWhite(color1);
final String style = style0 == null ? style2 : style0;
return Failable.ok(new CenterBorderColor(col1, col1, style));
}
diff --git a/src/net/sourceforge/plantuml/salt/PSystemSalt.java b/src/net/sourceforge/plantuml/salt/PSystemSalt.java
index 5721dffd1..4992c0f19 100644
--- a/src/net/sourceforge/plantuml/salt/PSystemSalt.java
+++ b/src/net/sourceforge/plantuml/salt/PSystemSalt.java
@@ -96,6 +96,7 @@ import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class PSystemSalt extends TitledDiagram implements WithSprite {
@@ -217,7 +218,10 @@ public class PSystemSalt extends TitledDiagram implements WithSprite {
s = it.next();
bloc = bloc.addString(s);
} while (s.equals("}") == false);
- final CommandExecutionResult cmdResult = cmd.execute(this, bloc);
+ try {
+ final CommandExecutionResult cmdResult = cmd.execute(this, bloc);
+ } catch (NoSuchColorException e) {
+ }
} else {
result.add(s);
}
diff --git a/src/net/sourceforge/plantuml/salt/element/ElementButton.java b/src/net/sourceforge/plantuml/salt/element/ElementButton.java
index 3e62d4b41..5a9013981 100644
--- a/src/net/sourceforge/plantuml/salt/element/ElementButton.java
+++ b/src/net/sourceforge/plantuml/salt/element/ElementButton.java
@@ -69,7 +69,7 @@ public class ElementButton extends AbstractElementText implements Element {
}
final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0);
ug = ug.apply(new UStroke(stroke));
- ug = ug.apply(HColorSet.instance().getColorIfValid("#EEEEEE").bg());
+ ug = ug.apply(HColorSet.instance().getColorOrWhite("#EEEEEE").bg());
ug.apply(new UTranslate(stroke, stroke)).draw(
new URectangle(dim.getWidth() - 2 * stroke, dim.getHeight() - 2 * stroke).rounded(10));
final Dimension2D dimPureText = getPureTextDimension(ug.getStringBounder());
diff --git a/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java b/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java
index 216fa9ba4..591db1ebd 100644
--- a/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java
+++ b/src/net/sourceforge/plantuml/salt/element/ElementDroplist.java
@@ -93,7 +93,7 @@ public class ElementDroplist extends AbstractElementText implements Element {
public void drawU(UGraphic ug, int zIndex, Dimension2D dimToUse) {
final Dimension2D dim = getPreferredDimension(ug.getStringBounder(), 0, 0);
if (zIndex == 0) {
- ug.apply(HColorSet.instance().getColorIfValid("#EEEEEE").bg())
+ ug.apply(HColorSet.instance().getColorOrWhite("#EEEEEE").bg())
.draw(new URectangle(dim.getWidth() - 1, dim.getHeight() - 1));
drawText(ug, 2, 2);
final double xline = dim.getWidth() - box;
@@ -112,7 +112,7 @@ public class ElementDroplist extends AbstractElementText implements Element {
final Dimension2D dimOpen = Dimension2DDouble.atLeast(openDrop.calculateDimension(ug.getStringBounder()),
dim.getWidth() - 1, 0);
ug = ug.apply(UTranslate.dy(dim.getHeight() - 1));
- ug.apply(HColorSet.instance().getColorIfValid("#EEEEEE").bg())
+ ug.apply(HColorSet.instance().getColorOrWhite("#EEEEEE").bg())
.draw(new URectangle(dimOpen.getWidth() - 1, dimOpen.getHeight() - 1));
openDrop.drawU(ug);
}
diff --git a/src/net/sourceforge/plantuml/salt/element/ElementLine.java b/src/net/sourceforge/plantuml/salt/element/ElementLine.java
index bc52b4e3f..06d4e8e87 100644
--- a/src/net/sourceforge/plantuml/salt/element/ElementLine.java
+++ b/src/net/sourceforge/plantuml/salt/element/ElementLine.java
@@ -61,7 +61,7 @@ public class ElementLine extends AbstractElement {
if (zIndex != 0) {
return;
}
- ug = ug.apply(HColorSet.instance().getColorIfValid("#AAAAAA"));
+ ug = ug.apply(HColorSet.instance().getColorOrWhite("#AAAAAA"));
double y2 = dimToUse.getHeight() / 2;
if (separator == '=') {
y2 = y2 - 1;
diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java
index 0e048ebd8..5479fc457 100644
--- a/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java
+++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuBar.java
@@ -105,7 +105,7 @@ public class ElementMenuBar extends AbstractElement {
double x1 = 0;
if (zIndex == 0) {
- ug.apply(HColorSet.instance().getColorIfValid("#DDDDDD").bg()).draw(
+ ug.apply(HColorSet.instance().getColorOrWhite("#DDDDDD").bg()).draw(
new URectangle(dimToUse.getWidth(), dimToUse.getHeight()));
for (ElementMenuEntry entry : entries) {
entry.drawU(ug.apply(UTranslate.dx(x1)), zIndex, dimToUse);
@@ -118,7 +118,7 @@ public class ElementMenuBar extends AbstractElement {
if (zIndex == 1) {
for (ElementMenuEntry entry : popups.keySet()) {
- entry.setBackground(HColorSet.instance().getColorIfValid("#BBBBBB"));
+ entry.setBackground(HColorSet.instance().getColorOrWhite("#BBBBBB"));
}
final double y1 = preferred.getHeight();
diff --git a/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java b/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java
index 197340170..e52bec1d8 100644
--- a/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java
+++ b/src/net/sourceforge/plantuml/salt/element/ElementMenuPopup.java
@@ -79,7 +79,7 @@ public class ElementMenuPopup extends AbstractElement {
if (zIndex != 1) {
return;
}
- ug.apply(HColorSet.instance().getColorIfValid("#DDDDDD").bg()).draw(
+ ug.apply(HColorSet.instance().getColorOrWhite("#DDDDDD").bg()).draw(
new URectangle(dimToUse.getWidth(), dimToUse.getHeight()));
double y1 = 0;
diff --git a/src/net/sourceforge/plantuml/salt/element/ElementTree.java b/src/net/sourceforge/plantuml/salt/element/ElementTree.java
index a120b94cb..5a6110a97 100644
--- a/src/net/sourceforge/plantuml/salt/element/ElementTree.java
+++ b/src/net/sourceforge/plantuml/salt/element/ElementTree.java
@@ -144,7 +144,7 @@ public class ElementTree extends AbstractElement {
yvar += h;
rows.add(yvar);
}
- ug = ug.apply(HColorSet.instance().getColorIfValid("#888888"));
+ ug = ug.apply(HColorSet.instance().getColorOrWhite("#888888"));
skeleton.draw(ug, 0, 0);
if (strategy != TableStrategy.DRAW_NONE) {
final Grid2 grid = new Grid2(rows, cols, strategy);
diff --git a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java
index d72e65d66..096a13baf 100644
--- a/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java
+++ b/src/net/sourceforge/plantuml/sdot/CucaDiagramFileMakerSmetana.java
@@ -101,7 +101,7 @@ import net.sourceforge.plantuml.svek.DotStringFactory;
import net.sourceforge.plantuml.svek.GeneralImageBuilder;
import net.sourceforge.plantuml.svek.GraphvizCrash;
import net.sourceforge.plantuml.svek.IEntityImage;
-import net.sourceforge.plantuml.svek.Node;
+import net.sourceforge.plantuml.svek.SvekNode;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.ImageParameter;
@@ -147,7 +147,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
final ST_Agnode_s agnode = ent.getValue();
final Point2D corner = getCorner(agnode);
- final Node node = dotStringFactory.getBibliotekon().getNode(leaf);
+ final SvekNode node = dotStringFactory.getBibliotekon().getNode(leaf);
final IEntityImage image = node.getImage();
image.drawU(ug.apply(new UTranslate(corner)));
}
@@ -303,7 +303,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
}
private void exportEntity(ST_Agraph_s g, ILeaf leaf) {
- final Node node = dotStringFactory.getBibliotekon().getNode(leaf);
+ final SvekNode node = dotStringFactory.getBibliotekon().getNode(leaf);
if (node == null) {
System.err.println("CANNOT FIND NODE");
return;
@@ -324,7 +324,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
throw new IllegalStateException();
}
final IEntityImage image = printEntityInternal(ent);
- final Node node = getBibliotekon().createNode(ent, image, dotStringFactory.getColorSequence(), stringBounder);
+ final SvekNode node = getBibliotekon().createNode(ent, image, dotStringFactory.getColorSequence(), stringBounder);
dotStringFactory.addNode(node);
}
@@ -373,7 +373,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
}
private void printCluster(ST_Agraph_s g, Cluster cluster) {
- for (Node node : cluster.getNodes()) {
+ for (SvekNode node : cluster.getNodes()) {
final ST_Agnode_s agnode = agnode(g, new CString(node.getUid()), true);
agsafeset(agnode, new CString("shape"), new CString("box"), new CString(""));
final String width = "" + (node.getWidth() / 72);
@@ -641,7 +641,7 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
return;
}
final IEntityImage image = printEntityInternal(ent);
- final Node shape = getBibliotekon().createNode(ent, image, dotStringFactory.getColorSequence(), stringBounder);
+ final SvekNode shape = getBibliotekon().createNode(ent, image, dotStringFactory.getColorSequence(), stringBounder);
// dotStringFactory.addShape(shape);
}
diff --git a/src/net/sourceforge/plantuml/security/SFile.java b/src/net/sourceforge/plantuml/security/SFile.java
index 99247ab48..67e4d0b08 100644
--- a/src/net/sourceforge/plantuml/security/SFile.java
+++ b/src/net/sourceforge/plantuml/security/SFile.java
@@ -75,7 +75,7 @@ public class SFile implements Comparable {
public static char separatorChar = File.separatorChar;
- public final File internal;
+ private final File internal;
@Override
public String toString() {
@@ -315,7 +315,7 @@ public class SFile implements Comparable {
return null;
}
- public File conv() throws FileNotFoundException {
+ public File conv() {
return internal;
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java b/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java
index 5044ff8d4..bf0023ce8 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/AbstractMessage.java
@@ -154,8 +154,12 @@ public abstract class AbstractMessage implements EventWithDeactivate, WithStyle
return lifeEventsType.contains(LifeEventType.DEACTIVATE);
}
+ public boolean isDestroy() {
+ return lifeEventsType.contains(LifeEventType.DESTROY);
+ }
+
private boolean isDeactivateOrDestroy() {
- return lifeEventsType.contains(LifeEventType.DEACTIVATE) || lifeEventsType.contains(LifeEventType.DESTROY);
+ return isDeactivate() || isDestroy();
}
public final boolean isActivateAndDeactive() {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java
index f351f8fdb..3c6906b96 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate.java
@@ -48,6 +48,7 @@ import net.sourceforge.plantuml.sequencediagram.LifeEventType;
import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.color.HColor;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandActivate extends SingleLineCommand2 {
@@ -70,12 +71,14 @@ public class CommandActivate extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final LifeEventType type = LifeEventType.valueOf(StringUtils.goUpperCase(arg.get("TYPE", 0)));
final Participant p = diagram.getOrCreateParticipant(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("WHO", 0)));
- final HColor backColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("BACK", 0));
- final HColor lineColor = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINE", 0));
+ String s = arg.get("BACK", 0);
+ final HColor backColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
+ String s1 = arg.get("LINE", 0);
+ final HColor lineColor = s1 == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s1);
final String error = diagram.activate(p, type, backColor, lineColor);
if (error == null) {
return CommandExecutionResult.ok();
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate2.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate2.java
index 40e012b29..346b35cbc 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate2.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandActivate2.java
@@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.sequencediagram.LifeEventType;
import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandActivate2 extends SingleLineCommand2 {
@@ -58,15 +59,17 @@ public class CommandActivate2 extends SingleLineCommand2 {
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("TYPE", "(\\+\\+|--)"), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("COLOR", "(#\\w+)?"), RegexLeaf.end()); //
+ new RegexLeaf("COLOR", "(#\\w+)?"), //
+ RegexLeaf.end()); //
}
@Override
- protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final LifeEventType type = arg.get("TYPE", 0).equals("++") ? LifeEventType.ACTIVATE : LifeEventType.DEACTIVATE;
final Participant p = diagram.getOrCreateParticipant(arg.get("NAME", 0));
+ final String s = arg.get("COLOR", 0);
final String error = diagram.activate(p, type,
- diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
+ s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
if (error == null) {
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
index 142d6d55b..333931914 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
@@ -63,6 +63,7 @@ import net.sourceforge.plantuml.skin.ArrowHead;
import net.sourceforge.plantuml.skin.ArrowPart;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandArrow extends SingleLineCommand2 {
@@ -156,7 +157,7 @@ public class CommandArrow extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
Participant p1;
Participant p2;
@@ -269,9 +270,10 @@ public class CommandArrow extends SingleLineCommand2 {
if (error != null) {
return CommandExecutionResult.error(error);
}
+ final String s = arg.get("LIFECOLOR", 0);
- final HColor activationColor = diagram.getSkinParam().getIHtmlColorSet()
- .getColorIfValid(arg.get("LIFECOLOR", 0));
+ final HColor activationColor = s == null ? null
+ : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (activationSpec != null) {
switch (activationSpec.charAt(0)) {
@@ -311,7 +313,7 @@ public class CommandArrow extends SingleLineCommand2 {
return sa.length() + sb.length();
}
- public static ArrowConfiguration applyStyle(String arrowStyle, ArrowConfiguration config) {
+ public static ArrowConfiguration applyStyle(String arrowStyle, ArrowConfiguration config) throws NoSuchColorException {
if (arrowStyle == null) {
return config;
}
@@ -330,7 +332,7 @@ public class CommandArrow extends SingleLineCommand2 {
config = config.withBody(ArrowBody.HIDDEN);
// link.goHidden();
} else {
- config = config.withColor(HColorSet.instance().getColorIfValid(s));
+ config = config.withColor(HColorSet.instance().getColor(s));
}
}
return config;
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java
index 55636a5c5..c6e960f0b 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java
@@ -51,6 +51,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.sequencediagram.SequenceDiagram;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandBoxStart extends SingleLineCommand2 {
@@ -79,7 +80,7 @@ public class CommandBoxStart extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
if (diagram.isBoxPending()) {
return CommandExecutionResult.error("Box cannot be nested");
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java
index d701c470f..6e5cb9be1 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandExoArrowAny.java
@@ -56,6 +56,7 @@ import net.sourceforge.plantuml.skin.ArrowDecoration;
import net.sourceforge.plantuml.skin.ArrowHead;
import net.sourceforge.plantuml.skin.ArrowPart;
import net.sourceforge.plantuml.ugraphic.color.HColor;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
abstract class CommandExoArrowAny extends SingleLineCommand2 {
@@ -64,7 +65,7 @@ abstract class CommandExoArrowAny extends SingleLineCommand2 {
}
@Override
- final protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
+ final protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String body = arg.getLazzy("ARROW_BODYA", 0) + arg.getLazzy("ARROW_BODYB", 0);
final String dressing = arg.getLazzy("ARROW_DRESSING", 0);
final Participant p = diagram.getOrCreateParticipant(
@@ -150,9 +151,10 @@ abstract class CommandExoArrowAny extends SingleLineCommand2 {
if (error != null) {
return CommandExecutionResult.error(error);
}
+ final String s = arg.get("LIFECOLOR", 0);
- final HColor activationColor = diagram.getSkinParam().getIHtmlColorSet()
- .getColorIfValid(arg.get("LIFECOLOR", 0));
+ final HColor activationColor = s == null ? null
+ : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (activationSpec != null) {
switch (activationSpec.charAt(0)) {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java
index e28ff1a0a..e48886384 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandGrouping.java
@@ -50,6 +50,8 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.sequencediagram.GroupingType;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.color.HColor;
+import net.sourceforge.plantuml.ugraphic.color.HColorSet;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandGrouping extends SingleLineCommand2 {
@@ -70,12 +72,19 @@ public class CommandGrouping extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
String type = StringUtils.goLowerCase(arg.get("TYPE", 0));
- final HColor backColorElement = diagram.getSkinParam().getIHtmlColorSet()
- .getColorIfValid(arg.get("COLORS", 0));
- final HColor backColorGeneral = diagram.getSkinParam().getIHtmlColorSet()
- .getColorIfValid(arg.get("COLORS", 1), diagram.getSkinParam().getBackgroundColor(true));
+ final String s = arg.get("COLORS", 0);
+ final HColorSet colorSet = diagram.getSkinParam().getIHtmlColorSet();
+ HColor backColorElement = null;
+ if (s != null) {
+ backColorElement = colorSet.getColor(s, null);
+ }
+ final String s2 = arg.get("COLORS", 1);
+ HColor backColorGeneral = null;
+ if (s2 != null) {
+ backColorGeneral = colorSet.getColor(s2, diagram.getSkinParam().getBackgroundColor(true));
+ }
String comment = arg.get("COMMENT", 0);
final GroupingType groupingType = GroupingType.getType(type);
if ("group".equals(type)) {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java
index e8f8b5e05..bcfd93336 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipant.java
@@ -58,6 +58,7 @@ import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.ParticipantType;
import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.ugraphic.UFont;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public abstract class CommandParticipant extends SingleLineCommand2 {
@@ -82,7 +83,7 @@ public abstract class CommandParticipant extends SingleLineCommand2 {
public CommandReferenceMultilinesOverSeveral() {
- super(
- "(?i)^ref(#\\w+)?[%s]+over[%s]+((?:[\\p{L}0-9_.@]+|[%g][^%g]+[%g])(?:[%s]*,[%s]*(?:[\\p{L}0-9_.@]+|[%g][^%g]+[%g]))*)[%s]*(#\\w+)?$");
+ super("(?i)^ref(#\\w+)?[%s]+over[%s]+((?:[\\p{L}0-9_.@]+|[%g][^%g]+[%g])(?:[%s]*,[%s]*(?:[\\p{L}0-9_.@]+|[%g][^%g]+[%g]))*)[%s]*(#\\w+)?$");
}
@Override
@@ -63,11 +63,14 @@ public class CommandReferenceMultilinesOverSeveral extends CommandMultilines line0 = StringUtils.getSplit(getStartingPattern(), lines.getFirst().getTrimmed()
- .getString());
- final HColor backColorElement = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get(0));
- // final HtmlColor backColorGeneral = HtmlColorSetSimple.instance().getColorIfValid(line0.get(1));
+ public CommandExecutionResult execute(final SequenceDiagram diagram, BlocLines lines) throws NoSuchColorException {
+ final List line0 = StringUtils.getSplit(getStartingPattern(),
+ lines.getFirst().getTrimmed().getString());
+ final String s1 = line0.get(0);
+ final HColor backColorElement = s1 == null ? null
+ : diagram.getSkinParam().getIHtmlColorSet().getColor(s1);
+ // final HtmlColor backColorGeneral =
+ // HtmlColorSetSimple.instance().getColorIfValid(line0.get(1));
final List participants = StringUtils.splitComma(line0.get(1));
final List p = new ArrayList();
@@ -89,8 +92,8 @@ public class CommandReferenceMultilinesOverSeveral extends CommandMultilines {
@@ -76,8 +77,9 @@ public class CommandReferenceOverSeveral extends SingleLineCommand2 participants = StringUtils.splitComma(arg.get("PARTS", 0));
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java
index 815bfa4de..835775a23 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandReturn.java
@@ -53,6 +53,7 @@ import net.sourceforge.plantuml.sequencediagram.SequenceDiagram;
import net.sourceforge.plantuml.skin.ArrowBody;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandReturn extends SingleLineCommand2 {
@@ -75,7 +76,7 @@ public class CommandReturn extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
AbstractMessage message1 = diagram.getActivatingMessage();
boolean doDeactivation = true;
@@ -91,15 +92,15 @@ public class CommandReturn extends SingleLineCommand2 {
ArrowConfiguration arrow = message1.getArrowConfiguration().withBody(ArrowBody.DOTTED);
final String color = arg.get("COLOR", 0);
if (color != null) {
- arrow = arrow.withColor(HColorSet.instance().getColorIfValid(color));
+ arrow = arrow.withColor(HColorSet.instance().getColor(color));
}
final Display display = Display.getWithNewlines(arg.get("MESSAGE", 0));
final AbstractMessage message2;
if (message1 instanceof MessageExo) {
final MessageExo exo1 = (MessageExo) message1;
- message2 = new MessageExo(diagram.getSkinParam().getCurrentStyleBuilder(), exo1.getParticipant(), exo1
- .getType().reverse(), display, arrow, diagram.getNextMessageNumber(), false);
+ message2 = new MessageExo(diagram.getSkinParam().getCurrentStyleBuilder(), exo1.getParticipant(),
+ exo1.getType().reverse(), display, arrow, diagram.getNextMessageNumber(), false);
} else {
message2 = new Message(diagram.getSkinParam().getCurrentStyleBuilder(), message1.getParticipant2(),
message1.getParticipant1(), display, arrow, diagram.getNextMessageNumber());
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java
index 7db19bc75..3c959ca0c 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java
@@ -106,17 +106,12 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
if (message.isActivate()) {
livingSpace1.addStepForLivebox(getEvent(), y + p2.getY());
- Log.info("CommunicationTileSelf::updateStairs activate y=" + (y + p2.getY()) + " " + message);
} else if (message.isDeactivate()) {
livingSpace1.addStepForLivebox(getEvent(), y + p1.getY());
- Log.info("CommunicationTileSelf::updateStairs deactivate y=" + (y + p1.getY()) + " " + message);
+ } else if (message.isDestroy()) {
+ livingSpace1.addStepForLivebox(getEvent(), y + p2.getY());
}
- // livingSpace1.addStep(y + arrowY, level1);
- // livingSpace1.addStep(y + dim.getHeight(), level1);
- // final int level2 = livingSpace2.getLevelAt(this);
- // livingSpace2.addStep(y + arrowY, level2);
- // livingSpace2.addStep(y + dim.getHeight(), level2);
}
public void drawU(UGraphic ug) {
diff --git a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java
index 5e0a3e5db..7fe52dcb2 100644
--- a/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java
+++ b/src/net/sourceforge/plantuml/sprite/StdlibDiagram.java
@@ -70,6 +70,7 @@ 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.HColorUtils;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class StdlibDiagram extends UmlDiagram {
@@ -148,7 +149,11 @@ public class StdlibDiagram extends UmlDiagram {
for (String s : all) {
// System.err.println("s="+s);
final BlocLines bloc = BlocLines.fromArray(s.split("\n"));
- cmd.execute(this, bloc);
+ try {
+ cmd.execute(this, bloc);
+ } catch (NoSuchColorException e) {
+ e.printStackTrace();
+ }
// System.err.println("nb=" + nb);
nb++;
}
diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java
index b8db908bd..feed44448 100644
--- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java
+++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreatePackageState.java
@@ -60,6 +60,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.ugraphic.color.HColor;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreatePackageState extends SingleLineCommand2 {
@@ -68,8 +69,7 @@ public class CommandCreatePackageState extends SingleLineCommand2
}
private static IRegex getRegexConcat() {
- return RegexConcat.build(CommandCreatePackageState.class.getName(),
- RegexLeaf.start(), //
+ return RegexConcat.build(CommandCreatePackageState.class.getName(), RegexLeaf.start(), //
new RegexLeaf("state"), //
RegexLeaf.spaceOneOrMore(), //
new RegexOr(//
@@ -83,7 +83,7 @@ public class CommandCreatePackageState extends SingleLineCommand2
new RegexOptional(new RegexConcat( //
new RegexLeaf("DISPLAY2", "[%g]([^%g]+)[%g]"), RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("as"), RegexLeaf.spaceOneOrMore() //
- )), //
+ )), //
new RegexLeaf("CODE2", "([\\p{L}0-9_.]+)"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("STEREOTYPE", "(\\<\\<.*\\>\\>)?"), //
@@ -108,7 +108,7 @@ public class CommandCreatePackageState extends SingleLineCommand2
}
@Override
- protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final IGroup currentPackage = diagram.getCurrentGroup();
final String idShort = getNotNull(arg, "CODE1", "CODE2");
final Ident idNewLong = diagram.buildLeafIdentSpecial(idShort);
@@ -132,8 +132,9 @@ public class CommandCreatePackageState extends SingleLineCommand2
}
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);
}
@@ -143,9 +144,11 @@ public class CommandCreatePackageState extends SingleLineCommand2
p.setColors(colors);
// p.setSpecificColorTOBEREMOVED(ColorType.BACK,
- // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
+ // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
+ // 0)));
// p.setSpecificColorTOBEREMOVED(ColorType.LINE,
- // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)));
+ // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR",
+ // 1)));
// p.applyStroke(arg.get("LINECOLOR", 0));
return CommandExecutionResult.ok();
}
diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java
index 437376169..9a1c344d6 100644
--- a/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java
+++ b/src/net/sourceforge/plantuml/statediagram/command/CommandCreateState.java
@@ -58,6 +58,7 @@ import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.statediagram.StateDiagram;
import net.sourceforge.plantuml.ugraphic.color.HColor;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandCreateState extends SingleLineCommand2 {
@@ -103,7 +104,7 @@ public class CommandCreateState extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String idShort = arg.getLazzy("CODE", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
@@ -131,8 +132,9 @@ public class CommandCreateState extends SingleLineCommand2 {
}
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);
}
@@ -142,9 +144,11 @@ public class CommandCreateState extends SingleLineCommand2 {
ent.setColors(colors);
// ent.setSpecificColorTOBEREMOVED(ColorType.BACK,
- // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0)));
+ // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR",
+ // 0)));
// ent.setSpecificColorTOBEREMOVED(ColorType.LINE,
- // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR", 1)));
+ // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("LINECOLOR",
+ // 1)));
// ent.applyStroke(arg.get("LINECOLOR", 0));
final String addFields = arg.get("ADDFIELD", 0);
diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java b/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java
index 5cf3bab32..a99cda267 100644
--- a/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java
+++ b/src/net/sourceforge/plantuml/statediagram/command/CommandLinkState.java
@@ -58,6 +58,7 @@ import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.statediagram.StateDiagram;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandLinkState extends SingleLineCommand2 {
@@ -96,7 +97,7 @@ public class CommandLinkState extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String ent1 = arg.get("ENT1", 0);
final String ent2 = arg.get("ENT2", 0);
@@ -115,15 +116,17 @@ public class CommandLinkState extends SingleLineCommand2 {
cl1.setStereotype(new Stereotype(arg.get("ENT1", 1)));
}
if (arg.get("ENT1", 2) != null) {
+ final String s = arg.get("ENT1", 2);
cl1.setSpecificColorTOBEREMOVED(ColorType.BACK,
- diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("ENT1", 2)));
+ diagram.getSkinParam().getIHtmlColorSet().getColor(s));
}
if (arg.get("ENT2", 1) != null) {
cl2.setStereotype(new Stereotype(arg.get("ENT2", 1)));
}
if (arg.get("ENT2", 2) != null) {
+ final String s = arg.get("ENT2", 2);
cl2.setSpecificColorTOBEREMOVED(ColorType.BACK,
- diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("ENT2", 2)));
+ diagram.getSkinParam().getIHtmlColorSet().getColor(s));
}
String queue = arg.get("ARROW_BODY1", 0) + arg.get("ARROW_BODY2", 0);
diff --git a/src/net/sourceforge/plantuml/style/SName.java b/src/net/sourceforge/plantuml/style/SName.java
index 55c2719b1..53e5c5f2d 100644
--- a/src/net/sourceforge/plantuml/style/SName.java
+++ b/src/net/sourceforge/plantuml/style/SName.java
@@ -59,7 +59,6 @@ public enum SName {
componentDiagram, //
control, //
database, //
- databse, //
delay, //
destroy, //
diamond, //
@@ -77,6 +76,7 @@ public enum SName {
interface_, //
jsonDiagram, //
gitDiagram, //
+ label, //
leafNode, //
legend, //
lifeLine, //
diff --git a/src/net/sourceforge/plantuml/style/ValueImpl.java b/src/net/sourceforge/plantuml/style/ValueImpl.java
index 32d2b9014..9a9d2e292 100644
--- a/src/net/sourceforge/plantuml/style/ValueImpl.java
+++ b/src/net/sourceforge/plantuml/style/ValueImpl.java
@@ -48,6 +48,9 @@ public class ValueImpl implements Value {
private final int priority;
public ValueImpl(String value, AutomaticCounter counter) {
+ if (value == null) {
+ throw new IllegalArgumentException();
+ }
this.value = value;
this.priority = counter.getNextInt();
}
@@ -68,7 +71,10 @@ public class ValueImpl implements Value {
if ("transparent".equalsIgnoreCase(value)) {
return HColorUtils.transparent();
}
- return set.getColorIfValid(value);
+ if (value == null) {
+ return null;
+ }
+ return set.getColorOrWhite(value);
}
public boolean asBoolean() {
diff --git a/src/net/sourceforge/plantuml/svek/Bibliotekon.java b/src/net/sourceforge/plantuml/svek/Bibliotekon.java
index f0ba99438..63db03b9c 100644
--- a/src/net/sourceforge/plantuml/svek/Bibliotekon.java
+++ b/src/net/sourceforge/plantuml/svek/Bibliotekon.java
@@ -53,14 +53,14 @@ public class Bibliotekon {
private final List allCluster = new ArrayList();
- private final Map nodeMap = new LinkedHashMap();;
+ private final Map nodeMap = new LinkedHashMap();;
private final List lines0 = new ArrayList();
private final List lines1 = new ArrayList();
private final List allLines = new ArrayList();
- public Node createNode(ILeaf ent, IEntityImage image, ColorSequence colorSequence, StringBounder stringBounder) {
- final Node node = new Node(ent, image, colorSequence, stringBounder);
+ public SvekNode createNode(ILeaf ent, IEntityImage image, ColorSequence colorSequence, StringBounder stringBounder) {
+ final SvekNode node = new SvekNode(ent, image, colorSequence, stringBounder);
nodeMap.put(ent, node);
return node;
}
@@ -107,12 +107,12 @@ public class Bibliotekon {
allCluster.add(current);
}
- public Node getNode(IEntity ent) {
+ public SvekNode getNode(IEntity ent) {
return nodeMap.get(ent);
}
public String getNodeUid(ILeaf ent) {
- final Node result = getNode(ent);
+ final SvekNode result = getNode(ent);
if (result != null) {
String uid = result.getUid();
if (result.isShielded()) {
@@ -134,8 +134,8 @@ public class Bibliotekon {
public String getWarningOrError(int warningOrError) {
final StringBuilder sb = new StringBuilder();
- for (Map.Entry ent : nodeMap.entrySet()) {
- final Node sh = ent.getValue();
+ for (Map.Entry ent : nodeMap.entrySet()) {
+ final SvekNode sh = ent.getValue();
final double maxX = sh.getMinX() + sh.getWidth();
if (maxX > warningOrError) {
final IEntity entity = ent.getKey();
@@ -149,8 +149,8 @@ public class Bibliotekon {
public Map getMaxX() {
final Map result = new HashMap();
- for (Map.Entry ent : nodeMap.entrySet()) {
- final Node sh = ent.getValue();
+ for (Map.Entry ent : nodeMap.entrySet()) {
+ final SvekNode sh = ent.getValue();
final double maxX = sh.getMinX() + sh.getWidth();
final IEntity entity = ent.getKey();
result.put(entity.getCodeGetName(), maxX);
@@ -174,7 +174,7 @@ public class Bibliotekon {
return Collections.unmodifiableList(allCluster);
}
- public Collection allNodes() {
+ public Collection allNodes() {
return Collections.unmodifiableCollection(nodeMap.values());
}
@@ -207,8 +207,8 @@ public class Bibliotekon {
return null;
}
- public ILeaf getLeaf(Node node) {
- for (Map.Entry ent : nodeMap.entrySet()) {
+ public ILeaf getLeaf(SvekNode node) {
+ for (Map.Entry ent : nodeMap.entrySet()) {
if (ent.getValue() == node) {
return ent.getKey();
}
diff --git a/src/net/sourceforge/plantuml/svek/Cluster.java b/src/net/sourceforge/plantuml/svek/Cluster.java
index 55adf81dd..a95279e7e 100644
--- a/src/net/sourceforge/plantuml/svek/Cluster.java
+++ b/src/net/sourceforge/plantuml/svek/Cluster.java
@@ -98,7 +98,7 @@ public class Cluster implements Moveable {
private final Cluster parentCluster;
private final IGroup group;
- private final List nodes = new ArrayList();
+ private final List nodes = new ArrayList();
private final List children = new ArrayList();
private final int color;
private final int colorTitle;
@@ -129,7 +129,7 @@ public class Cluster implements Moveable {
private Set entityPositionsExceptNormal() {
final Set result = EnumSet.noneOf(EntityPosition.class);
- for (Node sh : nodes) {
+ for (SvekNode sh : nodes) {
if (sh.getEntityPosition() != EntityPosition.NORMAL) {
result.add(sh.getEntityPosition());
}
@@ -166,7 +166,7 @@ public class Cluster implements Moveable {
return parentCluster;
}
- public void addNode(Node node) {
+ public void addNode(SvekNode node) {
if (node == null) {
throw new IllegalArgumentException();
}
@@ -174,17 +174,17 @@ public class Cluster implements Moveable {
node.setCluster(this);
}
- public final List getNodes() {
+ public final List