Minor bug fixes

This commit is contained in:
Arnaud Roques 2022-05-31 18:31:10 +02:00
parent 1afe7aae82
commit a5952259b7
16 changed files with 184 additions and 199 deletions

View File

@ -146,18 +146,18 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
@Override
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 false;
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
if (mode == Mode.NORMAL_KEYWORD && diagram.isAllowMixing() == false) {
if (mode == Mode.NORMAL_KEYWORD && diagram.isAllowMixing() == false)
return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements.");
}
String codeRaw = arg.getLazzy("CODE", 0);
final String displayRaw = arg.getLazzy("DISPLAY", 0);
final char codeChar = getCharEncoding(codeRaw);
@ -188,34 +188,36 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
} else if (symbol.equalsIgnoreCase("usecase")) {
type = LeafType.USECASE;
usymbol = null;
} else if (symbol.equalsIgnoreCase("usecase/")) {
type = LeafType.USECASE_BUSINESS;
usymbol = null;
} else if (symbol.equalsIgnoreCase("state")) {
type = LeafType.STATE;
usymbol = null;
} else {
type = LeafType.DESCRIPTION;
usymbol = USymbols.fromString(symbol, diagram.getSkinParam());
if (usymbol == null) {
if (usymbol == null)
throw new IllegalStateException();
}
}
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
String display = displayRaw;
if (display == null) {
if (display == null)
display = code.getName();
}
display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display);
final String stereotype = arg.getLazzy("STEREOTYPE", 0);
final IEntity entity = diagram.getOrCreateLeaf(ident, code, type, usymbol);
entity.setDisplay(Display.getWithNewlines(display));
entity.setUSymbol(usymbol);
if (stereotype != null) {
if (stereotype != null)
entity.setStereotype(Stereotype.build(stereotype, diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet()));
}
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
final String urlString = arg.get("URL", 0);

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.core.Diagram;
public abstract class CommandMultilines<S extends Diagram> implements Command<S> {
private final Pattern2 starting;
public CommandMultilines(String patternStart) {
if (patternStart.startsWith("^") == false || patternStart.endsWith("$") == false) {
throw new IllegalArgumentException("Bad pattern " + patternStart);
@ -58,21 +58,19 @@ public abstract class CommandMultilines<S extends Diagram> implements Command<S>
}
final public CommandControl isValid(BlocLines lines) {
if (isCommandForbidden()) {
if (isCommandForbidden())
return CommandControl.NOT_OK;
}
Matcher2 m1 = starting.matcher(lines.getFirst().getTrimmed().getString());
if (m1.matches() == false) {
if (m1.matches() == false)
return CommandControl.NOT_OK;
}
if (lines.size() == 1) {
if (lines.size() == 1)
return CommandControl.OK_PARTIAL;
}
m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast().getTrimmed().getString());
if (m1.matches() == false) {
if (m1.matches() == false)
return CommandControl.OK_PARTIAL;
}
actionIfCommandValid();
return CommandControl.OK;

View File

@ -47,7 +47,7 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
private final IRegex starting;
private final MultilinesStrategy strategy;
public CommandMultilines2(IRegex patternStart, MultilinesStrategy strategy) {
if (patternStart.getPattern().startsWith("^") == false || patternStart.getPattern().endsWith("$") == false) {
throw new IllegalArgumentException("Bad pattern " + patternStart.getPattern());
@ -68,35 +68,33 @@ public abstract class CommandMultilines2<S extends Diagram> implements Command<S
final public CommandControl isValid(BlocLines lines) {
lines = lines.cleanList(strategy);
if (isCommandForbidden()) {
if (isCommandForbidden())
return CommandControl.NOT_OK;
}
if (syntaxWithFinalBracket()) {
if (lines.size() == 1 && lines.getFirst().getTrimmed().getString().endsWith("{") == false) {
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.NOT_OK;
}
lines = lines.eventuallyMoveBracket();
}
final StringLocated first = lines.getFirst();
if (first == null) {
if (first == null)
return CommandControl.NOT_OK;
}
final boolean result1 = starting.match(first.getTrimmed());
if (result1 == false) {
if (result1 == false)
return CommandControl.NOT_OK;
}
if (lines.size() == 1) {
if (lines.size() == 1)
return CommandControl.OK_PARTIAL;
}
final Matcher2 m1 = MyPattern.cmpile(getPatternEnd()).matcher(lines.getLast().getTrimmed().getString());
if (m1.matches() == false) {
if (m1.matches() == false)
return CommandControl.OK_PARTIAL;
}
actionIfCommandValid();
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) {
lines = lines.cleanList(strategy);
if (syntaxWithFinalBracket()) {
if (syntaxWithFinalBracket())
lines = lines.eventuallyMoveBracket();
}
try {
return executeNow(system, lines);
} catch (NoSuchColorException e) {

View File

@ -45,11 +45,11 @@ public abstract class CommandMultilines3<S extends Diagram> implements Command<S
private final IRegex starting;
private final 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());
}
this.strategy = strategy;
this.starting = patternStart;
}
@ -62,26 +62,24 @@ public abstract class CommandMultilines3<S extends Diagram> implements Command<S
final public CommandControl isValid(BlocLines lines) {
lines = lines.cleanList(strategy);
if (isCommandForbidden()) {
if (isCommandForbidden())
return CommandControl.NOT_OK;
}
final StringLocated first = lines.getFirst();
if (first == null) {
if (first == null)
return CommandControl.NOT_OK;
}
final boolean result1 = starting.match(first.getTrimmed());
if (result1 == false) {
if (result1 == false)
return CommandControl.NOT_OK;
}
if (lines.size() == 1) {
if (lines.size() == 1)
return CommandControl.OK_PARTIAL;
}
final StringLocated potentialLast = lines.getLast().getTrimmed();
final boolean m1 = getPatternEnd2().match(potentialLast);
if (m1 == false) {
if (m1 == false)
return CommandControl.OK_PARTIAL;
}
actionIfCommandValid();
return CommandControl.OK;

View File

@ -44,18 +44,18 @@ import net.sourceforge.plantuml.core.Diagram;
public abstract class CommandMultilinesBracket<S extends Diagram> implements Command<S> {
private final Pattern2 starting;
public CommandMultilinesBracket(String patternStart) {
if (patternStart.startsWith("^") == false || patternStart.endsWith("$") == false) {
if (patternStart.startsWith("^") == false || patternStart.endsWith("$") == false)
throw new IllegalArgumentException("Bad pattern " + patternStart);
}
this.starting = MyPattern.cmpile(patternStart);
}
protected boolean isCommandForbidden() {
return false;
}
public String[] getDescription() {
return new String[] { "BRACKET: " + starting.pattern() };
}
@ -68,37 +68,35 @@ public abstract class CommandMultilinesBracket<S extends Diagram> implements Com
}
final public CommandControl isValid(BlocLines lines) {
if (isCommandForbidden()) {
if (isCommandForbidden())
return CommandControl.NOT_OK;
}
final Matcher2 m1 = starting.matcher(lines.getFirst().getTrimmed().getString());
if (m1.matches() == false) {
if (m1.matches() == false)
return CommandControl.NOT_OK;
}
if (lines.size() == 1) {
if (lines.size() == 1)
return CommandControl.OK_PARTIAL;
}
int level = 1;
for (StringLocated cs : lines.subExtract(1, 0)) {
final String s = cs.getTrimmed().getString();
if (isLineConsistent(s, level) == false) {
if (isLineConsistent(s, level) == false)
return CommandControl.NOT_OK;
}
if (s.endsWith("{")) {
if (s.endsWith("{"))
level++;
}
if (s.endsWith("}")) {
if (s.endsWith("}"))
level--;
}
if (level < 0) {
if (level < 0)
return CommandControl.NOT_OK;
}
}
if (level != 0) {
if (level != 0)
return CommandControl.OK_PARTIAL;
}
actionIfCommandValid();
return CommandControl.OK;

View File

@ -70,50 +70,51 @@ public abstract class SingleLineCommand2<S extends Diagram> implements Command<S
}
private String myTrim(StringLocated s) {
if (doTrim) {
if (doTrim)
return s.getTrimmed().getString();
}
return s.getString();
}
private StringLocated myTrim2(StringLocated s) {
if (doTrim) {
if (doTrim)
return s.getTrimmed();
}
return s;
}
final public CommandControl isValid(BlocLines lines) {
if (lines.size() == 2 && syntaxWithFinalBracket()) {
if (lines.size() == 2 && syntaxWithFinalBracket())
return isValidBracket(lines);
}
if (lines.size() != 1) {
if (lines.size() != 1)
return CommandControl.NOT_OK;
}
if (isCommandForbidden()) {
if (isCommandForbidden())
return CommandControl.NOT_OK;
}
final StringLocated line2 = myTrim2(lines.getFirst());
if (syntaxWithFinalBracket() && line2.getString().endsWith("{") == false) {
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.NOT_OK;
}
final boolean result = pattern.match(line2);
if (result) {
if (result)
actionIfCommandValid();
}
return result ? CommandControl.OK : CommandControl.NOT_OK;
}
private CommandControl isValidBracket(BlocLines lines) {
assert lines.size() == 2;
assert syntaxWithFinalBracket();
if (myTrim(lines.getAt(1)).equals("{") == false) {
if (myTrim(lines.getAt(1)).equals("{") == false)
return CommandControl.NOT_OK;
}
final String vline = lines.getAt(0).getString() + " {";
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("{");
lines = BlocLines.singleString(lines.getFirst().getString() + " {");
}
if (lines.size() != 1) {
if (lines.size() != 1)
throw new IllegalArgumentException();
}
final StringLocated first = lines.getFirst();
final String line = myTrim(first);
if (isForbidden(line)) {
if (isForbidden(line))
return CommandExecutionResult.error("Syntax error: " + line);
}
final RegexResult arg = pattern.matcher(line);
if (arg == null) {
if (arg == null)
return CommandExecutionResult.error("Cannot parse line " + line);
}
if (system instanceof PSystemError) {
if (system instanceof PSystemError)
return CommandExecutionResult.error("PSystemError cannot be cast");
}
// System.err.println("lines="+lines);
// System.err.println("pattern="+pattern.getPattern());
try {
return executeArg(system, first.getLocation(), arg);
} catch (NoSuchColorException e) {

View File

@ -35,21 +35,23 @@
*/
package net.sourceforge.plantuml.creole;
import net.sourceforge.plantuml.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.util.List;
import java.util.Objects;
import net.sourceforge.plantuml.awt.geom.Dimension2D;
import net.sourceforge.plantuml.creole.atom.Atom;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
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.UGraphicStencil;
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) {
throw new UnsupportedOperationException(getClass().toString());
@ -89,9 +91,9 @@ public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom {
}
public void drawU(UGraphic ug) {
if (stencil != null) {
if (stencil != null)
ug = UGraphicStencil.create(ug, stencil, defaultStroke);
}
block.drawU(ug);
}
@ -104,4 +106,9 @@ public class SheetBlock2 extends AbstractTextBlock implements TextBlock, Atom {
return block.getInnerPosition(member, stringBounder, strategy);
}
@Override
public Ports getPorts(StringBounder stringBounder) {
return new Ports();
}
}

View File

@ -132,16 +132,17 @@ public class CreoleParser implements SheetBuilder {
}
};
} 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));
}
continue;
} else {
stripe = createStripe(cs.toString(), context, sheet.getLastStripe(), fontConfiguration);
}
if (stripe != null) {
if (stripe != null)
sheet.add(stripe);
}
}
}
return sheet;

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -72,9 +73,9 @@ public class BodierLikeClassOrObject implements Bodier {
}
BodierLikeClassOrObject(LeafType type, Set<VisibilityModifier> hides) {
if (type == LeafType.MAP) {
if (type == LeafType.MAP)
throw new IllegalArgumentException();
}
this.type = Objects.requireNonNull(type);
assert type.isLikeClass() || type == LeafType.OBJECT;
this.hides = hides;
@ -96,22 +97,21 @@ public class BodierLikeClassOrObject implements Bodier {
}
private boolean isBodyEnhanced() {
for (CharSequence s : rawBody) {
if (BodyEnhanced1.isBlockSeparator(s) || CreoleParser.isTableLine(s.toString())) {
for (CharSequence s : rawBody)
if (BodyEnhanced1.isBlockSeparator(s) || CreoleParser.isTableLine(s.toString()) || Parser.isTreeStart(s.toString()))
return true;
}
}
return false;
}
private boolean isMethod(CharSequence s) {
final String purged = s.toString().replaceAll(UrlBuilder.getRegexp(), "");
if (purged.contains("{method}")) {
if (purged.contains("{method}"))
return true;
}
if (purged.contains("{field}")) {
if (purged.contains("{field}"))
return false;
}
return purged.contains("(") || purged.contains(")");
}
@ -121,16 +121,16 @@ public class BodierLikeClassOrObject implements Bodier {
methodsToDisplay = new ArrayList<>();
for (int i = 0; i < rawBody.size(); i++) {
final CharSequence s = rawBody.get(i);
if (isMethod(i, rawBody) == false) {
if (isMethod(i, rawBody) == false)
continue;
}
if (s.length() == 0 && methodsToDisplay.size() == 0) {
if (s.length() == 0 && methodsToDisplay.size() == 0)
continue;
}
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);
}
}
removeFinalEmptyMembers(methodsToDisplay);
}
@ -150,16 +150,16 @@ public class BodierLikeClassOrObject implements Bodier {
if (fieldsToDisplay == null) {
fieldsToDisplay = new ArrayList<>();
for (CharSequence s : rawBody) {
if (type != LeafType.OBJECT && isMethod(s) == true) {
if (type != LeafType.OBJECT && isMethod(s) == true)
continue;
}
if (s.length() == 0 && fieldsToDisplay.size() == 0) {
if (s.length() == 0 && fieldsToDisplay.size() == 0)
continue;
}
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);
}
}
removeFinalEmptyMembers(fieldsToDisplay);
}
@ -167,29 +167,28 @@ public class BodierLikeClassOrObject implements Bodier {
}
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);
}
}
@Override
public boolean hasUrl() {
for (CharSequence cs : getFieldsToDisplay()) {
for (CharSequence cs : getFieldsToDisplay())
if (cs instanceof Member) {
final Member m = (Member) cs;
if (m.hasUrl()) {
if (m.hasUrl())
return true;
}
}
}
for (CharSequence cs : getMethodsToDisplay()) {
for (CharSequence cs : getMethodsToDisplay())
if (cs instanceof Member) {
final Member m = (Member) cs;
if (m.hasUrl()) {
if (m.hasUrl())
return true;
}
}
}
return false;
}
@ -197,14 +196,13 @@ public class BodierLikeClassOrObject implements Bodier {
final List<CharSequence> result = new ArrayList<>();
for (CharSequence s : rawBody) {
final Member m;
if (isMethod(s)) {
if (isMethod(s))
m = Member.method(s);
} else {
else
m = Member.field(s);
}
if (hides.contains(m.getVisibilityModifier()) == false) {
if (hides.contains(m.getVisibilityModifier()) == false)
result.add(m);
}
}
return result;
@ -214,41 +212,37 @@ public class BodierLikeClassOrObject implements Bodier {
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
Stereotype stereotype, Style style, FontConfiguration fontConfiguration) {
if (BodyFactory.BODY3) {
if (BodyFactory.BODY3)
return new Body3(rawBody, fontParam, skinParam, stereotype, style);
}
if (type.isLikeClass() && isBodyEnhanced()) {
if (showMethods || showFields) {
if (showMethods || showFields)
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
rawBodyWithoutHidden(), skinParam, stereotype, leaf, style);
}
return null;
}
if (leaf == null) {
if (leaf == null)
throw new IllegalStateException();
}
if (type == LeafType.OBJECT) {
if (showFields == false) {
if (showFields == false)
return new TextBlockLineBefore(style.value(PName.LineThickness).asDouble(), TextBlockUtils.empty(0, 0));
}
return BodyFactory.create1(skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
rawBodyWithoutHidden(), skinParam, stereotype, leaf, style);
}
assert type.isLikeClass();
final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), skinParam, leaf,
style);
final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), skinParam, leaf, style);
final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), skinParam, leaf,
style);
if (showFields && showMethods == false) {
final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), skinParam, leaf, style);
if (showFields && showMethods == false)
return fields.asBlockMemberImpl();
} else if (showMethods && showFields == false) {
else if (showMethods && showFields == false)
return methods.asBlockMemberImpl();
} else if (showFields == false && showMethods == false) {
else if (showFields == false && showMethods == false)
return TextBlockUtils.empty(0, 0);
}
final TextBlock bb1 = fields.asBlockMemberImpl();
final TextBlock bb2 = methods.asBlockMemberImpl();

View File

@ -131,35 +131,40 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
char separator = lineFirst ? '_' : 0;
TextBlock title = null;
Display display = Display.empty();
Display display = null;
for (ListIterator<CharSequence> it = rawBody2.iterator(); it.hasNext();) {
final CharSequence cs = it.next();
if (cs instanceof EmbeddedDiagram) {
if (display == null)
display = Display.empty();
if (display.size() > 0 || separator != 0) {
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
separator = 0;
title = null;
display = Display.empty();
display = null;
}
blocks.add(((EmbeddedDiagram) cs).asDraw(skinParam));
blocks.add(TextBlockUtils.withMargin(((EmbeddedDiagram) cs).asDraw(skinParam), 2, 2));
} else {
final String s = cs.toString();
if (isBlockSeparator(s)) {
if (display == null)
display = Display.empty();
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
separator = s.charAt(0);
title = getTitle(s, skinParam);
display = Display.empty();
display = null;
} else if (isTreeOrTable(s)) {
final boolean isTable = CreoleParser.isTableLine(s);
if (display.size() > 0)
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
if (display == null)
display = Display.empty();
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator, title));
separator = 0;
title = null;
display = Display.empty();
display = null;
final List<CharSequence> allTree = buildTreeOrTable(s, it);
final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
@ -170,6 +175,8 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
blocks.add(bloc);
} else {
if (display == null)
display = Display.empty();
display = display.add(cs);
if (cs instanceof Member && ((Member) cs).getUrl() != null)
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("");
}
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(display, skinParam, align, entity, style), separator,
title));

View File

@ -64,18 +64,18 @@ public abstract class BodyEnhancedAbstract extends AbstractTextBlock implements
public static boolean isBlockSeparator(CharSequence cs) {
final String s = cs.toString();
if (s.startsWith("--") && s.endsWith("--")) {
if (s.startsWith("--") && s.endsWith("--"))
return true;
}
if (s.startsWith("==") && s.endsWith("==")) {
if (s.startsWith("==") && s.endsWith("=="))
return true;
}
if (s.startsWith("..") && s.endsWith("..") && s.equals("...") == false) {
if (s.startsWith("..") && s.endsWith("..") && s.equals("...") == false)
return true;
}
if (s.startsWith("__") && s.endsWith("__")) {
if (s.startsWith("__") && s.endsWith("__"))
return true;
}
return false;
}

View File

@ -104,31 +104,12 @@ public class CommandCreateJson extends CommandMultilines2<AbstractClassOrObjectD
assert line.length() > 0;
System.err.println("l=" + 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("}");
final DefaultHandler handler = new DefaultHandler();
new JsonParser(handler).parse(sb.toString());
final JsonValue json = handler.getValue();
System.err.println("foo=" + json);
((BodierJSon) entity1.getBodier()).setJson(json);
return CommandExecutionResult.ok();

View File

@ -104,9 +104,9 @@ public class EntityImageState extends EntityImageStateCommon {
final Dimension2D dimTotal = 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.draw(getShape(dimTotal));

View File

@ -68,8 +68,8 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
this.lineConfig = entity;
final FontConfiguration fontConfiguration = getStyleStateHeader()
.getFontConfiguration(getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet());
final FontConfiguration fontConfiguration = getStyleStateHeader().getFontConfiguration(
getSkinParam().getThemeStyle(), getSkinParam().getIHtmlColorSet(), entity.getColors());
this.desc = entity.getDisplay().create8(fontConfiguration, HorizontalAlignment.CENTER, skinParam,
CreoleMode.FULL, skinParam.wrapWidth());
@ -109,7 +109,7 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
return rect;
}
final protected UGraphic applyColorAndStroke(UGraphic ug) {
final protected UGraphic applyColor(UGraphic ug) {
HColor border = lineConfig.getColors().getColor(ColorType.LINE);
if (border == null)
@ -117,7 +117,7 @@ public abstract class EntityImageStateCommon extends AbstractEntityImage {
getSkinParam().getIHtmlColorSet());
ug = ug.apply(border);
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
HColor backcolor = lineConfig.getColors().getColor(ColorType.BACK);
if (backcolor == null)
backcolor = getStyleState().value(PName.BackGroundColor).asColor(getSkinParam().getThemeStyle(),
getSkinParam().getIHtmlColorSet());

View File

@ -70,7 +70,7 @@ public class EntityImageStateEmptyDescription extends EntityImageStateCommon {
final UStroke stroke = getStyleState().getStroke();
ug = applyColorAndStroke(ug);
ug = applyColor(ug);
ug = ug.apply(stroke);
ug.draw(getShape(dimTotal));

View File

@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
final int beta = 4;
final int beta = 5;
return beta;
}