mirror of
https://github.com/octoleo/plantuml.git
synced 2024-12-22 10:59:01 +00:00
Minor bug fixes
This commit is contained in:
parent
1afe7aae82
commit
a5952259b7
@ -146,18 +146,18 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
final protected boolean isForbidden(CharSequence line) {
|
final protected boolean isForbidden(CharSequence line) {
|
||||||
if (line.toString().matches("^[\\p{L}0-9_.]+$")) {
|
if (line.toString().matches("^[\\p{L}0-9_.]+$"))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
|
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
|
||||||
throws NoSuchColorException {
|
throws NoSuchColorException {
|
||||||
if (mode == Mode.NORMAL_KEYWORD && diagram.isAllowMixing() == false) {
|
if (mode == Mode.NORMAL_KEYWORD && diagram.isAllowMixing() == false)
|
||||||
return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements.");
|
return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements.");
|
||||||
}
|
|
||||||
String codeRaw = arg.getLazzy("CODE", 0);
|
String codeRaw = arg.getLazzy("CODE", 0);
|
||||||
final String displayRaw = arg.getLazzy("DISPLAY", 0);
|
final String displayRaw = arg.getLazzy("DISPLAY", 0);
|
||||||
final char codeChar = getCharEncoding(codeRaw);
|
final char codeChar = getCharEncoding(codeRaw);
|
||||||
@ -188,34 +188,36 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
|
|||||||
} else if (symbol.equalsIgnoreCase("usecase")) {
|
} else if (symbol.equalsIgnoreCase("usecase")) {
|
||||||
type = LeafType.USECASE;
|
type = LeafType.USECASE;
|
||||||
usymbol = null;
|
usymbol = null;
|
||||||
|
} else if (symbol.equalsIgnoreCase("usecase/")) {
|
||||||
|
type = LeafType.USECASE_BUSINESS;
|
||||||
|
usymbol = null;
|
||||||
} else if (symbol.equalsIgnoreCase("state")) {
|
} else if (symbol.equalsIgnoreCase("state")) {
|
||||||
type = LeafType.STATE;
|
type = LeafType.STATE;
|
||||||
usymbol = null;
|
usymbol = null;
|
||||||
} else {
|
} else {
|
||||||
type = LeafType.DESCRIPTION;
|
type = LeafType.DESCRIPTION;
|
||||||
usymbol = USymbols.fromString(symbol, diagram.getSkinParam());
|
usymbol = USymbols.fromString(symbol, diagram.getSkinParam());
|
||||||
if (usymbol == null) {
|
if (usymbol == null)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
|
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
|
||||||
final Ident ident = diagram.buildLeafIdent(idShort);
|
final Ident ident = diagram.buildLeafIdent(idShort);
|
||||||
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
|
||||||
String display = displayRaw;
|
String display = displayRaw;
|
||||||
if (display == null) {
|
if (display == null)
|
||||||
display = code.getName();
|
display = code.getName();
|
||||||
}
|
|
||||||
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
|
||||||
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
|
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
|
||||||
final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol);
|
final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol);
|
||||||
entity.setDisplay(Display.getWithNewlines(display));
|
entity.setDisplay(Display.getWithNewlines(display));
|
||||||
entity.setUSymbol(usymbol);
|
entity.setUSymbol(usymbol);
|
||||||
if (stereotype != null) {
|
if (stereotype != null)
|
||||||
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
|
||||||
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
|
||||||
diagram.getSkinParam().getIHtmlColorSet()));
|
diagram.getSkinParam().getIHtmlColorSet()));
|
||||||
}
|
|
||||||
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
|
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
|
||||||
|
|
||||||
final String urlString = arg.get("URL", 0);
|
final String urlString = arg.get("URL", 0);
|
||||||
|
@ -58,21 +58,19 @@ public abstract class CommandMultilines<S extends Diagram> implements Command<S>
|
|||||||
}
|
}
|
||||||
|
|
||||||
final public CommandControl isValid(BlocLines lines) {
|
final public CommandControl isValid(BlocLines lines) {
|
||||||
if (isCommandForbidden()) {
|
if (isCommandForbidden())
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
Matcher2 m1 = starting.matcher(lines.getFirst().getTrimmed().getString());
|
Matcher2 m1 = starting.matcher(lines.getFirst().getTrimmed().getString());
|
||||||
if (m1.matches() == false) {
|
if (m1.matches() == false)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
if (lines.size() == 1) {
|
if (lines.size() == 1)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
|
|
||||||
m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast().getTrimmed().getString());
|
m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast().getTrimmed().getString());
|
||||||
if (m1.matches() == false) {
|
if (m1.matches() == false)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
|
|
||||||
actionIfCommandValid();
|
actionIfCommandValid();
|
||||||
return CommandControl.OK;
|
return CommandControl.OK;
|
||||||
|
@ -68,35 +68,33 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
|
|||||||
|
|
||||||
final public CommandControl isValid(BlocLines lines) {
|
final public CommandControl isValid(BlocLines lines) {
|
||||||
lines = lines.cleanList(strategy);
|
lines = lines.cleanList(strategy);
|
||||||
if (isCommandForbidden()) {
|
if (isCommandForbidden())
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
if (syntaxWithFinalBracket()) {
|
if (syntaxWithFinalBracket()) {
|
||||||
if (lines.size() == 1 && lines.getFirst().getTrimmed().getString().endsWith("{") == false) {
|
if (lines.size() == 1 && lines.getFirst().getTrimmed().getString().endsWith("{") == false) {
|
||||||
final String vline = ((StringLocated) lines.getAt(0)).getString() + " {";
|
final String vline = ((StringLocated) lines.getAt(0)).getString() + " {";
|
||||||
if (isValid(BlocLines.singleString(vline)) == CommandControl.OK_PARTIAL) {
|
if (isValid(BlocLines.singleString(vline)) == CommandControl.OK_PARTIAL)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
}
|
||||||
lines = lines.eventuallyMoveBracket();
|
lines = lines.eventuallyMoveBracket();
|
||||||
}
|
}
|
||||||
final StringLocated first = lines.getFirst();
|
final StringLocated first = lines.getFirst();
|
||||||
if (first == null) {
|
if (first == null)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
final boolean result1 = starting.match(first.getTrimmed());
|
final boolean result1 = starting.match(first.getTrimmed());
|
||||||
if (result1 == false) {
|
if (result1 == false)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
if (lines.size() == 1) {
|
if (lines.size() == 1)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
|
|
||||||
final Matcher2 m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast().getTrimmed().getString());
|
final Matcher2 m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast().getTrimmed().getString());
|
||||||
if (m1.matches() == false) {
|
if (m1.matches() == false)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
|
|
||||||
actionIfCommandValid();
|
actionIfCommandValid();
|
||||||
return CommandControl.OK;
|
return CommandControl.OK;
|
||||||
@ -104,9 +102,9 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
|
|||||||
|
|
||||||
public final CommandExecutionResult execute(S system, BlocLines lines) {
|
public final CommandExecutionResult execute(S system, BlocLines lines) {
|
||||||
lines = lines.cleanList(strategy);
|
lines = lines.cleanList(strategy);
|
||||||
if (syntaxWithFinalBracket()) {
|
if (syntaxWithFinalBracket())
|
||||||
lines = lines.eventuallyMoveBracket();
|
lines = lines.eventuallyMoveBracket();
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
return executeNow(system, lines);
|
return executeNow(system, lines);
|
||||||
} catch (NoSuchColorException e) {
|
} catch (NoSuchColorException e) {
|
||||||
|
@ -47,9 +47,9 @@ public abstract class CommandMultilines3<S extends Diagram> implements Command<S
|
|||||||
private final MultilinesStrategy strategy;
|
private final MultilinesStrategy strategy;
|
||||||
|
|
||||||
public CommandMultilines3(IRegex patternStart, MultilinesStrategy strategy) {
|
public CommandMultilines3(IRegex patternStart, MultilinesStrategy strategy) {
|
||||||
if (patternStart.getPattern().startsWith("^") == false || patternStart.getPattern().endsWith("$") == false) {
|
if (patternStart.getPattern().startsWith("^") == false || patternStart.getPattern().endsWith("$") == false)
|
||||||
throw new IllegalArgumentException("Bad pattern " + patternStart.getPattern());
|
throw new IllegalArgumentException("Bad pattern " + patternStart.getPattern());
|
||||||
}
|
|
||||||
this.strategy = strategy;
|
this.strategy = strategy;
|
||||||
this.starting = patternStart;
|
this.starting = patternStart;
|
||||||
}
|
}
|
||||||
@ -62,26 +62,24 @@ public abstract class CommandMultilines3<S extends Diagram> implements Command<S
|
|||||||
|
|
||||||
final public CommandControl isValid(BlocLines lines) {
|
final public CommandControl isValid(BlocLines lines) {
|
||||||
lines = lines.cleanList(strategy);
|
lines = lines.cleanList(strategy);
|
||||||
if (isCommandForbidden()) {
|
if (isCommandForbidden())
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
final StringLocated first = lines.getFirst();
|
final StringLocated first = lines.getFirst();
|
||||||
if (first == null) {
|
if (first == null)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
final boolean result1 = starting.match(first.getTrimmed());
|
final boolean result1 = starting.match(first.getTrimmed());
|
||||||
if (result1 == false) {
|
if (result1 == false)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
if (lines.size() == 1) {
|
if (lines.size() == 1)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
|
|
||||||
final StringLocated potentialLast = lines.getLast().getTrimmed();
|
final StringLocated potentialLast = lines.getLast().getTrimmed();
|
||||||
final boolean m1 = getPatternEnd2().match(potentialLast);
|
final boolean m1 = getPatternEnd2().match(potentialLast);
|
||||||
if (m1 == false) {
|
if (m1 == false)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
|
|
||||||
actionIfCommandValid();
|
actionIfCommandValid();
|
||||||
return CommandControl.OK;
|
return CommandControl.OK;
|
||||||
|
@ -46,9 +46,9 @@ public abstract class CommandMultilinesBracket<S extends Diagram> implements Com
|
|||||||
private final Pattern2 starting;
|
private final Pattern2 starting;
|
||||||
|
|
||||||
public CommandMultilinesBracket(String patternStart) {
|
public CommandMultilinesBracket(String patternStart) {
|
||||||
if (patternStart.startsWith("^") == false || patternStart.endsWith("$") == false) {
|
if (patternStart.startsWith("^") == false || patternStart.endsWith("$") == false)
|
||||||
throw new IllegalArgumentException("Bad pattern " + patternStart);
|
throw new IllegalArgumentException("Bad pattern " + patternStart);
|
||||||
}
|
|
||||||
this.starting = MyPattern.cmpile(patternStart);
|
this.starting = MyPattern.cmpile(patternStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,37 +68,35 @@ public abstract class CommandMultilinesBracket<S extends Diagram> implements Com
|
|||||||
}
|
}
|
||||||
|
|
||||||
final public CommandControl isValid(BlocLines lines) {
|
final public CommandControl isValid(BlocLines lines) {
|
||||||
if (isCommandForbidden()) {
|
if (isCommandForbidden())
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
final Matcher2 m1 = starting.matcher(lines.getFirst().getTrimmed().getString());
|
final Matcher2 m1 = starting.matcher(lines.getFirst().getTrimmed().getString());
|
||||||
if (m1.matches() == false) {
|
if (m1.matches() == false)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
if (lines.size() == 1) {
|
if (lines.size() == 1)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
|
|
||||||
int level = 1;
|
int level = 1;
|
||||||
for (StringLocated cs : lines.subExtract(1, 0)) {
|
for (StringLocated cs : lines.subExtract(1, 0)) {
|
||||||
final String s = cs.getTrimmed().getString();
|
final String s = cs.getTrimmed().getString();
|
||||||
if (isLineConsistent(s, level) == false) {
|
if (isLineConsistent(s, level) == false)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
if (s.endsWith("{")) {
|
if (s.endsWith("{"))
|
||||||
level++;
|
level++;
|
||||||
}
|
|
||||||
if (s.endsWith("}")) {
|
if (s.endsWith("}"))
|
||||||
level--;
|
level--;
|
||||||
}
|
|
||||||
if (level < 0) {
|
if (level < 0)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level != 0) {
|
if (level != 0)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
|
|
||||||
actionIfCommandValid();
|
actionIfCommandValid();
|
||||||
return CommandControl.OK;
|
return CommandControl.OK;
|
||||||
|
@ -70,50 +70,51 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String myTrim(StringLocated s) {
|
private String myTrim(StringLocated s) {
|
||||||
if (doTrim) {
|
if (doTrim)
|
||||||
return s.getTrimmed().getString();
|
return s.getTrimmed().getString();
|
||||||
}
|
|
||||||
return s.getString();
|
return s.getString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private StringLocated myTrim2(StringLocated s) {
|
private StringLocated myTrim2(StringLocated s) {
|
||||||
if (doTrim) {
|
if (doTrim)
|
||||||
return s.getTrimmed();
|
return s.getTrimmed();
|
||||||
}
|
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final public CommandControl isValid(BlocLines lines) {
|
final public CommandControl isValid(BlocLines lines) {
|
||||||
if (lines.size() == 2 && syntaxWithFinalBracket()) {
|
if (lines.size() == 2 && syntaxWithFinalBracket())
|
||||||
return isValidBracket(lines);
|
return isValidBracket(lines);
|
||||||
}
|
|
||||||
if (lines.size() != 1) {
|
if (lines.size() != 1)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
if (isCommandForbidden()) {
|
if (isCommandForbidden())
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
final StringLocated line2 = myTrim2(lines.getFirst());
|
final StringLocated line2 = myTrim2(lines.getFirst());
|
||||||
if (syntaxWithFinalBracket() && line2.getString().endsWith("{") == false) {
|
if (syntaxWithFinalBracket() && line2.getString().endsWith("{") == false) {
|
||||||
final String vline = lines.getAt(0).getString() + " {";
|
final String vline = lines.getAt(0).getString() + " {";
|
||||||
if (isValid(BlocLines.singleString(vline)) == CommandControl.OK) {
|
if (isValid(BlocLines.singleString(vline)) == CommandControl.OK)
|
||||||
return CommandControl.OK_PARTIAL;
|
return CommandControl.OK_PARTIAL;
|
||||||
}
|
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean result = pattern.match(line2);
|
final boolean result = pattern.match(line2);
|
||||||
if (result) {
|
if (result)
|
||||||
actionIfCommandValid();
|
actionIfCommandValid();
|
||||||
}
|
|
||||||
return result ? CommandControl.OK : CommandControl.NOT_OK;
|
return result ? CommandControl.OK : CommandControl.NOT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandControl isValidBracket(BlocLines lines) {
|
private CommandControl isValidBracket(BlocLines lines) {
|
||||||
assert lines.size() == 2;
|
assert lines.size() == 2;
|
||||||
assert syntaxWithFinalBracket();
|
assert syntaxWithFinalBracket();
|
||||||
if (myTrim(lines.getAt(1)).equals("{") == false) {
|
if (myTrim(lines.getAt(1)).equals("{") == false)
|
||||||
return CommandControl.NOT_OK;
|
return CommandControl.NOT_OK;
|
||||||
}
|
|
||||||
final String vline = lines.getAt(0).getString() + " {";
|
final String vline = lines.getAt(0).getString() + " {";
|
||||||
return isValid(BlocLines.singleString(vline));
|
return isValid(BlocLines.singleString(vline));
|
||||||
}
|
}
|
||||||
@ -130,24 +131,21 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
|
|||||||
assert myTrim(lines.getAt(1)).equals("{");
|
assert myTrim(lines.getAt(1)).equals("{");
|
||||||
lines = BlocLines.singleString(lines.getFirst().getString() + " {");
|
lines = BlocLines.singleString(lines.getFirst().getString() + " {");
|
||||||
}
|
}
|
||||||
if (lines.size() != 1) {
|
if (lines.size() != 1)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
|
||||||
final StringLocated first = lines.getFirst();
|
final StringLocated first = lines.getFirst();
|
||||||
final String line = myTrim(first);
|
final String line = myTrim(first);
|
||||||
if (isForbidden(line)) {
|
if (isForbidden(line))
|
||||||
return CommandExecutionResult.error("Syntax error: " + line);
|
return CommandExecutionResult.error("Syntax error: " + line);
|
||||||
}
|
|
||||||
|
|
||||||
final RegexResult arg = pattern.matcher(line);
|
final RegexResult arg = pattern.matcher(line);
|
||||||
if (arg == null) {
|
if (arg == null)
|
||||||
return CommandExecutionResult.error("Cannot parse line " + line);
|
return CommandExecutionResult.error("Cannot parse line " + line);
|
||||||
}
|
|
||||||
if (system instanceof PSystemError) {
|
if (system instanceof PSystemError)
|
||||||
return CommandExecutionResult.error("PSystemError cannot be cast");
|
return CommandExecutionResult.error("PSystemError cannot be cast");
|
||||||
}
|
|
||||||
// System.err.println("lines="+lines);
|
|
||||||
// System.err.println("pattern="+pattern.getPattern());
|
|
||||||
try {
|
try {
|
||||||
return executeArg(system, first.getLocation(), arg);
|
return executeArg(system, first.getLocation(), arg);
|
||||||
} catch (NoSuchColorException e) {
|
} catch (NoSuchColorException e) {
|
||||||
|
@ -35,21 +35,23 @@
|
|||||||
*/
|
*/
|
||||||
package net.sourceforge.plantuml.creole;
|
package net.sourceforge.plantuml.creole;
|
||||||
|
|
||||||
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import net.sourceforge.plantuml.awt.geom.Dimension2D;
|
||||||
import net.sourceforge.plantuml.creole.atom.Atom;
|
import net.sourceforge.plantuml.creole.atom.Atom;
|
||||||
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
|
||||||
import net.sourceforge.plantuml.graphic.InnerStrategy;
|
import net.sourceforge.plantuml.graphic.InnerStrategy;
|
||||||
import net.sourceforge.plantuml.graphic.StringBounder;
|
import net.sourceforge.plantuml.graphic.StringBounder;
|
||||||
import net.sourceforge.plantuml.graphic.TextBlock;
|
import net.sourceforge.plantuml.graphic.TextBlock;
|
||||||
|
import net.sourceforge.plantuml.svek.Ports;
|
||||||
|
import net.sourceforge.plantuml.svek.WithPorts;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
import net.sourceforge.plantuml.ugraphic.UGraphic;
|
||||||
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
import net.sourceforge.plantuml.ugraphic.UGraphicStencil;
|
||||||
import net.sourceforge.plantuml.ugraphic.UStroke;
|
import net.sourceforge.plantuml.ugraphic.UStroke;
|
||||||
|
|
||||||
public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom {
|
final public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom, WithPorts {
|
||||||
|
|
||||||
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
|
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
|
||||||
throw new UnsupportedOperationException(getClass().toString());
|
throw new UnsupportedOperationException(getClass().toString());
|
||||||
@ -89,9 +91,9 @@ public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawU(UGraphic ug) {
|
public void drawU(UGraphic ug) {
|
||||||
if (stencil != null) {
|
if (stencil != null)
|
||||||
ug = UGraphicStencil.create(ug, stencil, defaultStroke);
|
ug = UGraphicStencil.create(ug, stencil, defaultStroke);
|
||||||
}
|
|
||||||
block.drawU(ug);
|
block.drawU(ug);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,4 +106,9 @@ public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom {
|
|||||||
return block.getInnerPosition(member, stringBounder, strategy);
|
return block.getInnerPosition(member, stringBounder, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Ports getPorts(StringBounder stringBounder) {
|
||||||
|
return new Ports();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -132,16 +132,17 @@ public class CreoleParser implements SheetBuilder {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else if (cs instanceof Stereotype) {
|
} else if (cs instanceof Stereotype) {
|
||||||
for (String st : ((Stereotype) cs).getLabels(skinParam.guillemet())) {
|
for (String st : ((Stereotype) cs).getLabels(skinParam.guillemet()))
|
||||||
sheet.add(createStripe(st, context, sheet.getLastStripe(), stereotype));
|
sheet.add(createStripe(st, context, sheet.getLastStripe(), stereotype));
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
stripe = createStripe(cs.toString(), context, sheet.getLastStripe(), fontConfiguration);
|
stripe = createStripe(cs.toString(), context, sheet.getLastStripe(), fontConfiguration);
|
||||||
}
|
}
|
||||||
if (stripe != null) {
|
|
||||||
|
if (stripe != null)
|
||||||
sheet.add(stripe);
|
sheet.add(stripe);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sheet;
|
return sheet;
|
||||||
|
@ -45,6 +45,7 @@ import net.sourceforge.plantuml.FontParam;
|
|||||||
import net.sourceforge.plantuml.ISkinParam;
|
import net.sourceforge.plantuml.ISkinParam;
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.UrlBuilder;
|
import net.sourceforge.plantuml.UrlBuilder;
|
||||||
|
import net.sourceforge.plantuml.creole.Parser;
|
||||||
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
|
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
|
||||||
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
import net.sourceforge.plantuml.graphic.FontConfiguration;
|
||||||
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
|
||||||
@ -72,9 +73,9 @@ public class BodierLikeClassOrObject implements Bodier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BodierLikeClassOrObject(LeafType type, Set<VisibilityModifier> hides) {
|
BodierLikeClassOrObject(LeafType type, Set<VisibilityModifier> hides) {
|
||||||
if (type == LeafType.MAP) {
|
if (type == LeafType.MAP)
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
|
||||||
this.type = Objects.requireNonNull(type);
|
this.type = Objects.requireNonNull(type);
|
||||||
assert type.isLikeClass() || type == LeafType.OBJECT;
|
assert type.isLikeClass() || type == LeafType.OBJECT;
|
||||||
this.hides = hides;
|
this.hides = hides;
|
||||||
@ -96,22 +97,21 @@ public class BodierLikeClassOrObject implements Bodier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBodyEnhanced() {
|
private boolean isBodyEnhanced() {
|
||||||
for (CharSequence s : rawBody) {
|
for (CharSequence s : rawBody)
|
||||||
if (BodyEnhanced1.isBlockSeparator(s) || CreoleParser.isTableLine(s.toString())) {
|
if (BodyEnhanced1.isBlockSeparator(s) || CreoleParser.isTableLine(s.toString()) || Parser.isTreeStart(s.toString()))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMethod(CharSequence s) {
|
private boolean isMethod(CharSequence s) {
|
||||||
final String purged = s.toString().replaceAll(UrlBuilder.getRegexp(), "");
|
final String purged = s.toString().replaceAll(UrlBuilder.getRegexp(), "");
|
||||||
if (purged.contains("{method}")) {
|
if (purged.contains("{method}"))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (purged.contains("{field}")) {
|
if (purged.contains("{field}"))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
return purged.contains("(") || purged.contains(")");
|
return purged.contains("(") || purged.contains(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,16 +121,16 @@ public class BodierLikeClassOrObject implements Bodier {
|
|||||||
methodsToDisplay = new ArrayList<>();
|
methodsToDisplay = new ArrayList<>();
|
||||||
for (int i = 0; i < rawBody.size(); i++) {
|
for (int i = 0; i < rawBody.size(); i++) {
|
||||||
final CharSequence s = rawBody.get(i);
|
final CharSequence s = rawBody.get(i);
|
||||||
if (isMethod(i, rawBody) == false) {
|
if (isMethod(i, rawBody) == false)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (s.length() == 0 && methodsToDisplay.size() == 0) {
|
if (s.length() == 0 && methodsToDisplay.size() == 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
final Member m = Member.method(s);
|
final Member m = Member.method(s);
|
||||||
if (hides == null || hides.contains(m.getVisibilityModifier()) == false) {
|
if (hides == null || hides.contains(m.getVisibilityModifier()) == false)
|
||||||
methodsToDisplay.add(m);
|
methodsToDisplay.add(m);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
removeFinalEmptyMembers(methodsToDisplay);
|
removeFinalEmptyMembers(methodsToDisplay);
|
||||||
}
|
}
|
||||||
@ -150,16 +150,16 @@ public class BodierLikeClassOrObject implements Bodier {
|
|||||||
if (fieldsToDisplay == null) {
|
if (fieldsToDisplay == null) {
|
||||||
fieldsToDisplay = new ArrayList<>();
|
fieldsToDisplay = new ArrayList<>();
|
||||||
for (CharSequence s : rawBody) {
|
for (CharSequence s : rawBody) {
|
||||||
if (type != LeafType.OBJECT && isMethod(s) == true) {
|
if (type != LeafType.OBJECT && isMethod(s) == true)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
if (s.length() == 0 && fieldsToDisplay.size() == 0) {
|
if (s.length() == 0 && fieldsToDisplay.size() == 0)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
final Member m = Member.field(s);
|
final Member m = Member.field(s);
|
||||||
if (hides == null || hides.contains(m.getVisibilityModifier()) == false) {
|
if (hides == null || hides.contains(m.getVisibilityModifier()) == false)
|
||||||
fieldsToDisplay.add(m);
|
fieldsToDisplay.add(m);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
removeFinalEmptyMembers(fieldsToDisplay);
|
removeFinalEmptyMembers(fieldsToDisplay);
|
||||||
}
|
}
|
||||||
@ -167,28 +167,27 @@ public class BodierLikeClassOrObject implements Bodier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void removeFinalEmptyMembers(List<Member> result) {
|
private void removeFinalEmptyMembers(List<Member> result) {
|
||||||
while (result.size() > 0 && StringUtils.trin(result.get(result.size() - 1).getDisplay(false)).length() == 0) {
|
while (result.size() > 0 && StringUtils.trin(result.get(result.size() - 1).getDisplay(false)).length() == 0)
|
||||||
result.remove(result.size() - 1);
|
result.remove(result.size() - 1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasUrl() {
|
public boolean hasUrl() {
|
||||||
for (CharSequence cs : getFieldsToDisplay()) {
|
for (CharSequence cs : getFieldsToDisplay())
|
||||||
if (cs instanceof Member) {
|
if (cs instanceof Member) {
|
||||||
final Member m = (Member) cs;
|
final Member m = (Member) cs;
|
||||||
if (m.hasUrl()) {
|
if (m.hasUrl())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
for (CharSequence cs : getMethodsToDisplay())
|
||||||
for (CharSequence cs : getMethodsToDisplay()) {
|
|
||||||
if (cs instanceof Member) {
|
if (cs instanceof Member) {
|
||||||
final Member m = (Member) cs;
|
final Member m = (Member) cs;
|
||||||
if (m.hasUrl()) {
|
if (m.hasUrl())
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -197,14 +196,13 @@ public class BodierLikeClassOrObject implements Bodier {
|
|||||||
final List<CharSequence> result = new ArrayList<>();
|
final List<CharSequence> result = new ArrayList<>();
|
||||||
for (CharSequence s : rawBody) {
|
for (CharSequence s : rawBody) {
|
||||||
final Member m;
|
final Member m;
|
||||||
if (isMethod(s)) {
|
if (isMethod(s))
|
||||||
m = Member.method(s);
|
m = Member.method(s);
|
||||||
} else {
|
else
|
||||||
m = Member.field(s);
|
m = Member.field(s);
|
||||||
}
|
|
||||||
if (hides.contains(m.getVisibilityModifier()) == false) {
|
if (hides.contains(m.getVisibilityModifier()) == false)
|
||||||
result.add(m);
|
result.add(m);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -214,41 +212,37 @@ public class BodierLikeClassOrObject implements Bodier {
|
|||||||
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
|
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
|
||||||
Stereotype stereotype, Style style, FontConfiguration fontConfiguration) {
|
Stereotype stereotype, Style style, FontConfiguration fontConfiguration) {
|
||||||
|
|
||||||
if (BodyFactory.BODY3) {
|
if (BodyFactory.BODY3)
|
||||||
return new Body3(rawBody, fontParam, skinParam, stereotype, style);
|
return new Body3(rawBody, fontParam, skinParam, stereotype, style);
|
||||||
}
|
|
||||||
|
|
||||||
if (type.isLikeClass() && isBodyEnhanced()) {
|
if (type.isLikeClass() && isBodyEnhanced()) {
|
||||||
if (showMethods || showFields) {
|
if (showMethods || showFields)
|
||||||
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||||
rawBodyWithoutHidden(), skinParam, stereotype, leaf, style);
|
rawBodyWithoutHidden(), skinParam, stereotype, leaf, style);
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (leaf == null) {
|
if (leaf == null)
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
|
||||||
if (type == LeafType.OBJECT) {
|
if (type == LeafType.OBJECT) {
|
||||||
if (showFields == false) {
|
if (showFields == false)
|
||||||
return new TextBlockLineBefore(style.value(PName.LineThickness).asDouble(), TextBlockUtils.empty(0, 0));
|
return new TextBlockLineBefore(style.value(PName.LineThickness).asDouble(), TextBlockUtils.empty(0, 0));
|
||||||
}
|
|
||||||
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||||
rawBodyWithoutHidden(), skinParam, stereotype, leaf, style);
|
rawBodyWithoutHidden(), skinParam, stereotype, leaf, style);
|
||||||
}
|
}
|
||||||
assert type.isLikeClass();
|
assert type.isLikeClass();
|
||||||
|
|
||||||
final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), skinParam, leaf,
|
final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), skinParam, leaf, style);
|
||||||
style);
|
|
||||||
|
|
||||||
final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), skinParam, leaf,
|
final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), skinParam, leaf, style);
|
||||||
style);
|
if (showFields && showMethods == false)
|
||||||
if (showFields && showMethods == false) {
|
|
||||||
return fields.asBlockMemberImpl();
|
return fields.asBlockMemberImpl();
|
||||||
} else if (showMethods && showFields == false) {
|
else if (showMethods && showFields == false)
|
||||||
return methods.asBlockMemberImpl();
|
return methods.asBlockMemberImpl();
|
||||||
} else if (showFields == false && showMethods == false) {
|
else if (showFields == false && showMethods == false)
|
||||||
return TextBlockUtils.empty(0, 0);
|
return TextBlockUtils.empty(0, 0);
|
||||||
}
|
|
||||||
|
|
||||||
final TextBlock bb1 = fields.asBlockMemberImpl();
|
final TextBlock bb1 = fields.asBlockMemberImpl();
|
||||||
final TextBlock bb2 = methods.asBlockMemberImpl();
|
final TextBlock bb2 = methods.asBlockMemberImpl();
|
||||||
|
@ -131,35 +131,40 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
|||||||
|
|
||||||
char separator = lineFirst ? '_' : 0;
|
char separator = lineFirst ? '_' : 0;
|
||||||
TextBlock title = null;
|
TextBlock title = null;
|
||||||
Display display = Display.empty();
|
Display display = null;
|
||||||
for (ListIterator<CharSequence> it = rawBody2.iterator(); it.hasNext();) {
|
for (ListIterator<CharSequence> it = rawBody2.iterator(); it.hasNext();) {
|
||||||
final CharSequence cs = it.next();
|
final CharSequence cs = it.next();
|
||||||
if (cs instanceof EmbeddedDiagram) {
|
if (cs instanceof EmbeddedDiagram) {
|
||||||
|
if (display == null)
|
||||||
|
display = Display.empty();
|
||||||
if (display.size() > 0 || separator != 0) {
|
if (display.size() > 0 || separator != 0) {
|
||||||
blocks.add(decorate(stringBounder,
|
blocks.add(decorate(stringBounder,
|
||||||
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
|
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
|
||||||
separator = 0;
|
separator = 0;
|
||||||
title = null;
|
title = null;
|
||||||
display = Display.empty();
|
display = null;
|
||||||
}
|
}
|
||||||
blocks.add(((EmbeddedDiagram) cs).asDraw(skinParam));
|
blocks.add(TextBlockUtils.withMargin(((EmbeddedDiagram) cs).asDraw(skinParam), 2, 2));
|
||||||
} else {
|
} else {
|
||||||
final String s = cs.toString();
|
final String s = cs.toString();
|
||||||
if (isBlockSeparator(s)) {
|
if (isBlockSeparator(s)) {
|
||||||
|
if (display == null)
|
||||||
|
display = Display.empty();
|
||||||
blocks.add(decorate(stringBounder,
|
blocks.add(decorate(stringBounder,
|
||||||
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
|
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
|
||||||
separator = s.charAt(0);
|
separator = s.charAt(0);
|
||||||
title = getTitle(s, skinParam);
|
title = getTitle(s, skinParam);
|
||||||
display = Display.empty();
|
display = null;
|
||||||
} else if (isTreeOrTable(s)) {
|
} else if (isTreeOrTable(s)) {
|
||||||
final boolean isTable = CreoleParser.isTableLine(s);
|
final boolean isTable = CreoleParser.isTableLine(s);
|
||||||
if (display.size() > 0)
|
if (display == null)
|
||||||
|
display = Display.empty();
|
||||||
blocks.add(decorate(stringBounder,
|
blocks.add(decorate(stringBounder,
|
||||||
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
|
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
|
||||||
|
|
||||||
separator = 0;
|
separator = 0;
|
||||||
title = null;
|
title = null;
|
||||||
display = Display.empty();
|
display = null;
|
||||||
final List<CharSequence> allTree = buildTreeOrTable(s, it);
|
final List<CharSequence> allTree = buildTreeOrTable(s, it);
|
||||||
final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getThemeStyle(),
|
final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getThemeStyle(),
|
||||||
skinParam.getIHtmlColorSet());
|
skinParam.getIHtmlColorSet());
|
||||||
@ -170,6 +175,8 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
|||||||
|
|
||||||
blocks.add(bloc);
|
blocks.add(bloc);
|
||||||
} else {
|
} else {
|
||||||
|
if (display == null)
|
||||||
|
display = Display.empty();
|
||||||
display = display.add(cs);
|
display = display.add(cs);
|
||||||
if (cs instanceof Member && ((Member) cs).getUrl() != null)
|
if (cs instanceof Member && ((Member) cs).getUrl() != null)
|
||||||
urls.add(((Member) cs).getUrl());
|
urls.add(((Member) cs).getUrl());
|
||||||
@ -177,9 +184,12 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (inEllipse && display.size() == 0) {
|
|
||||||
|
if (display == null)
|
||||||
|
display = Display.empty();
|
||||||
|
if (inEllipse && display.size() == 0)
|
||||||
display = display.add("");
|
display = display.add("");
|
||||||
}
|
|
||||||
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator,
|
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator,
|
||||||
title));
|
title));
|
||||||
|
|
||||||
|
@ -64,18 +64,18 @@ public abstract class BodyEnhancedAbstract extends AbstractTextBlock implements
|
|||||||
|
|
||||||
public static boolean isBlockSeparator(CharSequence cs) {
|
public static boolean isBlockSeparator(CharSequence cs) {
|
||||||
final String s = cs.toString();
|
final String s = cs.toString();
|
||||||
if (s.startsWith("--") && s.endsWith("--")) {
|
if (s.startsWith("--") && s.endsWith("--"))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (s.startsWith("==") && s.endsWith("==")) {
|
if (s.startsWith("==") && s.endsWith("=="))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (s.startsWith("..") && s.endsWith("..") && s.equals("...") == false) {
|
if (s.startsWith("..") && s.endsWith("..") && s.equals("...") == false)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
if (s.startsWith("__") && s.endsWith("__")) {
|
if (s.startsWith("__") && s.endsWith("__"))
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,31 +104,12 @@ public class CommandCreateJson extends CommandMultilines2<AbstractClassOrObjectD
|
|||||||
assert line.length() > 0;
|
assert line.length() > 0;
|
||||||
System.err.println("l=" + line);
|
System.err.println("l=" + line);
|
||||||
sb.append(line);
|
sb.append(line);
|
||||||
// entity1.getBodier().addFieldOrMethod(line);
|
|
||||||
// if (BodierMap.getLinkedEntry(line) != null) {
|
|
||||||
// final String linkStr = BodierMap.getLinkedEntry(line);
|
|
||||||
// final int x = line.indexOf(linkStr);
|
|
||||||
// final String key = line.substring(0, x).trim();
|
|
||||||
// final String dest = line.substring(x + linkStr.length()).trim();
|
|
||||||
// final Ident ident2 = diagram.buildLeafIdentSpecial(dest);
|
|
||||||
// final ILeaf entity2 = diagram.getEntityFactory().getLeafStrict(ident2);
|
|
||||||
// if (entity2 == null)
|
|
||||||
// return CommandExecutionResult.error("No such entity " + ident2.getName());
|
|
||||||
//
|
|
||||||
// final LinkType linkType = new LinkType(LinkDecor.ARROW, LinkDecor.NONE);
|
|
||||||
// final int length = linkStr.length() - 2;
|
|
||||||
// final Link link = new Link(entity1, entity2, linkType, Display.NULL, length,
|
|
||||||
// diagram.getSkinParam().getCurrentStyleBuilder());
|
|
||||||
// link.setPortMembers(key, null);
|
|
||||||
// diagram.addLink(link);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
|
|
||||||
final DefaultHandler handler = new DefaultHandler();
|
final DefaultHandler handler = new DefaultHandler();
|
||||||
new JsonParser(handler).parse(sb.toString());
|
new JsonParser(handler).parse(sb.toString());
|
||||||
final JsonValue json = handler.getValue();
|
final JsonValue json = handler.getValue();
|
||||||
System.err.println("foo=" + json);
|
|
||||||
((BodierJSon) entity1.getBodier()).setJson(json);
|
((BodierJSon) entity1.getBodier()).setJson(json);
|
||||||
|
|
||||||
return CommandExecutionResult.ok();
|
return CommandExecutionResult.ok();
|
||||||
|
@ -104,9 +104,9 @@ public class EntityImageState extends EntityImageStateCommon {
|
|||||||
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
final Dimension2D dimTotal = calculateDimension(stringBounder);
|
||||||
final Dimension2D dimDesc = desc.calculateDimension(stringBounder);
|
final Dimension2D dimDesc = desc.calculateDimension(stringBounder);
|
||||||
|
|
||||||
final UStroke stroke = getStyleState().getStroke();
|
final UStroke stroke = getStyleState().getStroke(lineConfig.getColors());
|
||||||
|
|
||||||
ug = applyColorAndStroke(ug);
|
ug = applyColor(ug);
|
||||||
ug = ug.apply(stroke);
|
ug = ug.apply(stroke);
|
||||||
ug.draw(getShape(dimTotal));
|
ug.draw(getShape(dimTotal));
|
||||||
|
|
||||||
|
@ -68,8 +68,8 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
|
|||||||
|
|
||||||
this.lineConfig = entity;
|
this.lineConfig = entity;
|
||||||
|
|
||||||
final FontConfiguration fontConfiguration = getStyleStateHeader()
|
final FontConfiguration fontConfiguration = getStyleStateHeader().getFontConfiguration(
|
||||||
.getFontConfiguration(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet());
|
getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet(), entity.getColors());
|
||||||
|
|
||||||
this.desc = entity.getDisplay().create8(fontConfiguration, HorizontalAlignment.CENTER, skinParam,
|
this.desc = entity.getDisplay().create8(fontConfiguration, HorizontalAlignment.CENTER, skinParam,
|
||||||
CreoleMode.FULL, skinParam.wrapWidth());
|
CreoleMode.FULL, skinParam.wrapWidth());
|
||||||
@ -109,7 +109,7 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected UGraphic applyColorAndStroke(UGraphic ug) {
|
final protected UGraphic applyColor(UGraphic ug) {
|
||||||
|
|
||||||
HColor border = lineConfig.getColors().getColor(ColorType.LINE);
|
HColor border = lineConfig.getColors().getColor(ColorType.LINE);
|
||||||
if (border == null)
|
if (border == null)
|
||||||
@ -117,7 +117,7 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
|
|||||||
getSkinParam().getIHtmlColorSet());
|
getSkinParam().getIHtmlColorSet());
|
||||||
|
|
||||||
ug = ug.apply(border);
|
ug = ug.apply(border);
|
||||||
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
HColor backcolor = lineConfig.getColors().getColor(ColorType.BACK);
|
||||||
if (backcolor == null)
|
if (backcolor == null)
|
||||||
backcolor = getStyleState().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
backcolor = getStyleState().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
|
||||||
getSkinParam().getIHtmlColorSet());
|
getSkinParam().getIHtmlColorSet());
|
||||||
|
@ -70,7 +70,7 @@ public class EntityImageStateEmptyDescription extends EntityImageStateCommon {
|
|||||||
|
|
||||||
final UStroke stroke = getStyleState().getStroke();
|
final UStroke stroke = getStyleState().getStroke();
|
||||||
|
|
||||||
ug = applyColorAndStroke(ug);
|
ug = applyColor(ug);
|
||||||
ug = ug.apply(stroke);
|
ug = ug.apply(stroke);
|
||||||
|
|
||||||
ug.draw(getShape(dimTotal));
|
ug.draw(getShape(dimTotal));
|
||||||
|
@ -80,7 +80,7 @@ public class Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int beta() {
|
public static int beta() {
|
||||||
final int beta = 4;
|
final int beta = 5;
|
||||||
return beta;
|
return beta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user