1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

Import version 1.2020.23

This commit is contained in:
Arnaud Roques 2020-12-14 19:31:06 +01:00
parent 7e81ef289b
commit 56cd2269dd
88 changed files with 1398 additions and 1015 deletions

View File

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

View File

@ -42,13 +42,12 @@ import java.util.List;
public class BackSlash { public class BackSlash {
private static final char PRIVATE_BLOCK = '\uE000';
public static final String BS_BS_N = "\\n"; public static final String BS_BS_N = "\\n";
public static final String NEWLINE = "\n"; public static final String NEWLINE = "\n";
public static final char CHAR_NEWLINE = '\n'; public static final char CHAR_NEWLINE = '\n';
public static char hiddenNewLine() { public static char hiddenNewLine() {
return PRIVATE_BLOCK + BackSlash.CHAR_NEWLINE; return StringUtils.PRIVATE_BLOCK + BackSlash.CHAR_NEWLINE;
} }
public static String convertHiddenNewLine(String s) { public static String convertHiddenNewLine(String s) {
@ -126,8 +125,8 @@ public class BackSlash {
final StringBuilder result = new StringBuilder(); final StringBuilder result = new StringBuilder();
for (int i = 0; i < s.length(); i++) { for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i); char c = s.charAt(i);
if (c > PRIVATE_BLOCK && c < '\uE07F') { if (c > StringUtils.PRIVATE_BLOCK && c < '\uE07F') {
c = (char) (c - PRIVATE_BLOCK); c = (char) (c - StringUtils.PRIVATE_BLOCK);
} }
result.append(c); result.append(c);
} }
@ -138,7 +137,7 @@ public class BackSlash {
if (c > 128) { if (c > 128) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
return (char) (PRIVATE_BLOCK + c); return (char) (StringUtils.PRIVATE_BLOCK + c);
} }
} }

View File

@ -80,6 +80,9 @@ public class EmbeddedDiagram implements CharSequence {
if (s.equals("{{gantt")) { if (s.equals("{{gantt")) {
return "gantt"; return "gantt";
} }
if (s.equals("{{json")) {
return "json";
}
return null; return null;
} }

View File

@ -51,6 +51,59 @@ import net.sourceforge.plantuml.cucadiagram.Display;
// Do not move // Do not move
public class StringUtils { public class StringUtils {
public static final char USER_NEWLINE = '\uEE00';
public static final char USER_TAB = '\uEE01';
public static final char HR_SIMPLE = '\uEEFF';
public static final char HR_DOUBLE = '\uEEFE';
public static final char HR_DOTTED = '\uEEFD';
public static final char HR_BOLD = '\uEEFC';
public static final char PRIVATE_FIELD = '\uEEFB';
public static final char PROTECTED_FIELD = '\uEEFA';
public static final char PACKAGE_PRIVATE_FIELD = '\uEEF9';
public static final char PUBLIC_FIELD = '\uEEF8';
public static final char PRIVATE_METHOD = '\uEEF7';
public static final char PROTECTED_METHOD = '\uEEF6';
public static final char PACKAGE_PRIVATE_METHOD = '\uEEF5';
public static final char PUBLIC_METHOD = '\uEEF4';
public static final char IE_MANDATORY = '\uEEF3';
// Used in BackSlash
public static final char PRIVATE_BLOCK = '\uE000';
public static final char INTERNAL_BOLD = '\uE100';
public static String toInternalBoldNumber(String s) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
final char c = s.charAt(i);
if (c >= '0' && c <= '9') {
sb.append(Character.toChars('\uE100' + c - '0'));
} else {
sb.append(c);
}
}
return sb.toString();
}
public static void appendInternalToRealBoldNumber(StringBuilder sb, char c) {
if (c >= '\uE100' && c <= ('\uE100' + 9)) {
sb.append(Character.toChars(0x1d7ce + c - '\uE100'));
} else {
sb.append(c);
}
}
public static void appendInternalToPlainNumber(StringBuilder sb, char c) {
if (c >= '\uE100' && c <= ('\uE100' + 9)) {
sb.append(Character.toChars('0' + c - '\uE100'));
} else {
sb.append(c);
}
}
final static public List<String> getSplit(Pattern2 pattern, String line) { final static public List<String> getSplit(Pattern2 pattern, String line) {
final Matcher2 m = pattern.matcher(line); final Matcher2 m = pattern.matcher(line);
if (m.find() == false) { if (m.find() == false) {

View File

@ -40,6 +40,8 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.sourceforge.plantuml.StringUtils;
public class BasicCharAreaImpl implements BasicCharArea { public class BasicCharAreaImpl implements BasicCharArea {
private int charSize1 = 160; private int charSize1 = 160;
@ -141,7 +143,7 @@ public class BasicCharAreaImpl implements BasicCharArea {
for (int x = 0; x < width; x++) { for (int x = 0; x < width; x++) {
final char c = chars[x][line]; final char c = chars[x][line];
if (c != '\0') { if (c != '\0') {
sb.append(c); StringUtils.appendInternalToRealBoldNumber(sb, c);
} }
} }
return sb.toString(); return sb.toString();

View File

@ -70,17 +70,19 @@ public class ComponentTextActor extends AbstractComponentText {
final int xman = width / 2 - 1; final int xman = width / 2 - 1;
if (type == ComponentType.ACTOR_HEAD) { if (type == ComponentType.ACTOR_HEAD) {
charArea.drawStringsLR(stringsToDisplay.as(), 1, getHeight());
if (fileFormat == FileFormat.UTXT) { if (fileFormat == FileFormat.UTXT) {
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 1, getHeight());
charArea.drawShape(AsciiShape.STICKMAN_UNICODE, xman, 0); charArea.drawShape(AsciiShape.STICKMAN_UNICODE, xman, 0);
} else { } else {
charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, getHeight());
charArea.drawShape(AsciiShape.STICKMAN, xman, 0); charArea.drawShape(AsciiShape.STICKMAN, xman, 0);
} }
} else if (type == ComponentType.ACTOR_TAIL) { } else if (type == ComponentType.ACTOR_TAIL) {
charArea.drawStringsLR(stringsToDisplay.as(), 1, 0);
if (fileFormat == FileFormat.UTXT) { if (fileFormat == FileFormat.UTXT) {
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 1, 0);
charArea.drawShape(AsciiShape.STICKMAN_UNICODE, xman, 1); charArea.drawShape(AsciiShape.STICKMAN_UNICODE, xman, 1);
} else { } else {
charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, 0);
charArea.drawShape(AsciiShape.STICKMAN, xman, 1); charArea.drawShape(AsciiShape.STICKMAN, xman, 1);
} }
} else { } else {

View File

@ -37,6 +37,8 @@ package net.sourceforge.plantuml.asciiart;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.awt.geom.Point2D; import java.awt.geom.Point2D;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
@ -62,14 +64,14 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
public ComponentTextArrow(ComponentType type, ArrowConfiguration config, Display stringsToDisplay, public ComponentTextArrow(ComponentType type, ArrowConfiguration config, Display stringsToDisplay,
FileFormat fileFormat, int maxAsciiMessageLength) { FileFormat fileFormat, int maxAsciiMessageLength) {
this.fileFormat = fileFormat;
this.maxAsciiMessageLength = maxAsciiMessageLength; this.maxAsciiMessageLength = maxAsciiMessageLength;
this.type = type; this.type = type;
this.config = config; this.config = config;
this.stringsToDisplay = clean(stringsToDisplay); this.stringsToDisplay = clean(stringsToDisplay);
this.fileFormat = fileFormat;
} }
private static Display clean(Display orig) { private Display clean(Display orig) {
if (orig.size() == 0 || orig.get(0) instanceof MessageNumber == false) { if (orig.size() == 0 || orig.get(0) instanceof MessageNumber == false) {
return orig; return orig;
} }
@ -86,7 +88,19 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
return result; return result;
} }
private static String removeTag(String s) { private String removeTag(String s) {
if (fileFormat == FileFormat.UTXT) {
final Pattern pattern = Pattern.compile("\\<b\\>([0-9]+)\\</b\\>");
final Matcher matcher = pattern.matcher(s);
final StringBuffer result = new StringBuffer();
while (matcher.find()) {
final String num = matcher.group(1);
final String replace = StringUtils.toInternalBoldNumber(num);
matcher.appendReplacement(result, Matcher.quoteReplacement(replace));
}
matcher.appendTail(result);
s = result.toString();
}
return s.replaceAll("\\<[^<>]+\\>", ""); return s.replaceAll("\\<[^<>]+\\>", "");
} }
@ -119,7 +133,12 @@ public class ComponentTextArrow extends AbstractComponentText implements ArrowCo
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
// final int position = Math.max(0, (width - textWidth) / 2); // final int position = Math.max(0, (width - textWidth) / 2);
charArea.drawStringsLR(stringsToDisplay.as(), (width - textWidth) / 2, 0);
if (fileFormat == FileFormat.UTXT) {
charArea.drawStringsLRUnicode(stringsToDisplay.as(), (width - textWidth) / 2, 0);
} else {
charArea.drawStringsLRSimple(stringsToDisplay.as(), (width - textWidth) / 2, 0);
}
} }
public double getPreferredHeight(StringBounder stringBounder) { public double getPreferredHeight(StringBounder stringBounder) {

View File

@ -78,7 +78,11 @@ public class ComponentTextNote extends AbstractComponentText {
charArea.drawBoxSimple(2, 0, width - 2, height); charArea.drawBoxSimple(2, 0, width - 2, height);
} }
} }
charArea.drawStringsLR(stringsToDisplay.as(), 3, 1); if (fileFormat == FileFormat.UTXT) {
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 3, 1);
} else {
charArea.drawStringsLRSimple(stringsToDisplay.as(), 3, 1);
}
} }
public double getPreferredHeight(StringBounder stringBounder) { public double getPreferredHeight(StringBounder stringBounder) {

View File

@ -53,8 +53,7 @@ public class ComponentTextParticipant extends AbstractComponentText {
private final Display stringsToDisplay; private final Display stringsToDisplay;
private final FileFormat fileFormat; private final FileFormat fileFormat;
public ComponentTextParticipant(ComponentType type, Display stringsToDisplay, public ComponentTextParticipant(ComponentType type, Display stringsToDisplay, FileFormat fileFormat) {
FileFormat fileFormat) {
this.type = type; this.type = type;
this.stringsToDisplay = stringsToDisplay; this.stringsToDisplay = stringsToDisplay;
this.fileFormat = fileFormat; this.fileFormat = fileFormat;
@ -83,7 +82,11 @@ public class ComponentTextParticipant extends AbstractComponentText {
charArea.drawChar('+', (width - 1) / 2, height - 1); charArea.drawChar('+', (width - 1) / 2, height - 1);
} }
} }
charArea.drawStringsLR(stringsToDisplay.as(), 1, 1); if (fileFormat == FileFormat.UTXT) {
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 1, 1);
} else {
charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, 1);
}
} }
public double getPreferredHeight(StringBounder stringBounder) { public double getPreferredHeight(StringBounder stringBounder) {

View File

@ -57,8 +57,8 @@ public class ComponentTextSelfArrow extends AbstractComponentText implements Arr
private final FileFormat fileFormat; private final FileFormat fileFormat;
private final ArrowConfiguration config; private final ArrowConfiguration config;
public ComponentTextSelfArrow(ComponentType type, ArrowConfiguration config, public ComponentTextSelfArrow(ComponentType type, ArrowConfiguration config, Display stringsToDisplay,
Display stringsToDisplay, FileFormat fileFormat) { FileFormat fileFormat) {
this.type = type; this.type = type;
this.stringsToDisplay = stringsToDisplay; this.stringsToDisplay = stringsToDisplay;
this.fileFormat = fileFormat; this.fileFormat = fileFormat;
@ -96,7 +96,11 @@ public class ComponentTextSelfArrow extends AbstractComponentText implements Arr
charArea.drawStringLR("<---'", 0, 2); charArea.drawStringLR("<---'", 0, 2);
} }
charArea.drawStringsLR(stringsToDisplay.as(), 6, 1); if (fileFormat == FileFormat.UTXT) {
charArea.drawStringsLRUnicode(stringsToDisplay.as(), 6, 1);
} else {
charArea.drawStringsLRSimple(stringsToDisplay.as(), 6, 1);
}
} }
public double getPreferredHeight(StringBounder stringBounder) { public double getPreferredHeight(StringBounder stringBounder) {

View File

@ -67,10 +67,10 @@ public class ComponentTextShape extends AbstractComponentText {
final int xman = width / 2 - shape.getWidth() / 2 + 1; final int xman = width / 2 - shape.getWidth() / 2 + 1;
if (type.name().endsWith("_HEAD")) { if (type.name().endsWith("_HEAD")) {
charArea.drawStringsLR(stringsToDisplay.as(), 1, getHeight()); charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, getHeight());
charArea.drawShape(shape, xman, 0); charArea.drawShape(shape, xman, 0);
} else { } else {
charArea.drawStringsLR(stringsToDisplay.as(), 1, 0); charArea.drawStringsLRSimple(stringsToDisplay.as(), 1, 0);
charArea.drawShape(shape, xman, 1); charArea.drawShape(shape, xman, 1);
} }
} }

View File

@ -44,7 +44,10 @@ import net.sourceforge.plantuml.ugraphic.UFont;
public class TextStringBounder implements StringBounder { public class TextStringBounder implements StringBounder {
public Dimension2D calculateDimension(UFont font, String text) { public Dimension2D calculateDimension(UFont font, String text) {
return new Dimension2DDouble(text.length(), 1); final int length1 = text.codePointCount(0, text.length());
final int length2 = text.length();
final int length3 = Wcwidth.length(text);
return new Dimension2DDouble(length2, 1);
} }
} }

View File

@ -116,8 +116,12 @@ public class TranslatedCharArea implements UmlCharArea {
charArea.print(ps); charArea.print(ps);
} }
public void drawStringsLR(Collection<? extends CharSequence> strings, int x, int y) { public void drawStringsLRSimple(Collection<? extends CharSequence> strings, int x, int y) {
charArea.drawStringsLR(strings, x + dx, y + dy); charArea.drawStringsLRSimple(strings, x + dx, y + dy);
}
public void drawStringsLRUnicode(Collection<? extends CharSequence> strings, int x, int y) {
charArea.drawStringsLRUnicode(strings, x + dx, y + dy);
} }
public void fillRect(char c, int x, int y, int width, int height) { public void fillRect(char c, int x, int y, int width, int height) {

View File

@ -49,6 +49,8 @@ public interface UmlCharArea extends BasicCharArea {
void drawShape(AsciiShape shape, int x, int y); void drawShape(AsciiShape shape, int x, int y);
void drawStringsLR(Collection<? extends CharSequence> strings, int x, int y); void drawStringsLRSimple(Collection<? extends CharSequence> strings, int x, int y);
void drawStringsLRUnicode(Collection<? extends CharSequence> strings, int x, int y);
} }

View File

@ -37,6 +37,9 @@ package net.sourceforge.plantuml.asciiart;
import java.util.Collection; import java.util.Collection;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.sequencediagram.MessageNumber;
public class UmlCharAreaImpl extends BasicCharAreaImpl implements UmlCharArea { public class UmlCharAreaImpl extends BasicCharAreaImpl implements UmlCharArea {
public void drawBoxSimple(int x, int y, int width, int height) { public void drawBoxSimple(int x, int y, int width, int height) {
@ -69,16 +72,32 @@ public class UmlCharAreaImpl extends BasicCharAreaImpl implements UmlCharArea {
shape.draw(this, x, y); shape.draw(this, x, y);
} }
public void drawStringsLR(Collection<? extends CharSequence> strings, int x, int y) { public void drawStringsLRSimple(Collection<? extends CharSequence> strings, int x, int y) {
int i = 0; int i = 0;
if (x < 0) { if (x < 0) {
x = 0; x = 0;
} }
for (CharSequence s : strings) { for (CharSequence s : strings) {
if (s instanceof MessageNumber) {
s = ((MessageNumber) s).getNumberRaw();
}
this.drawStringLR(s.toString(), x, y + i); this.drawStringLR(s.toString(), x, y + i);
i++; i++;
} }
}
public void drawStringsLRUnicode(Collection<? extends CharSequence> strings, int x, int y) {
int i = 0;
if (x < 0) {
x = 0;
}
for (CharSequence s : strings) {
if (s instanceof MessageNumber) {
s = StringUtils.toInternalBoldNumber((((MessageNumber) s).getNumberRaw()));
}
this.drawStringLR(s.toString(), x, y + i);
i++;
}
} }
public void drawNoteSimple(int x, int y, int width, int height) { public void drawNoteSimple(int x, int y, int width, int height) {

View File

@ -67,6 +67,7 @@ import net.sourceforge.plantuml.ugraphic.UImage;
public class AtomImg extends AbstractAtom implements Atom { public class AtomImg extends AbstractAtom implements Atom {
private static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,"; private static final String DATA_IMAGE_PNG_BASE64 = "data:image/png;base64,";
private static final String DATA_IMAGE_SVG_BASE64 = "data:image/svg+xml;base64,";
private final BufferedImage image; private final BufferedImage image;
private final double scale; private final double scale;
private final Url url; private final Url url;
@ -102,8 +103,19 @@ public class AtomImg extends AbstractAtom implements Atom {
} catch (Exception e) { } catch (Exception e) {
return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc); return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc);
} }
} }
if (src.startsWith(DATA_IMAGE_SVG_BASE64)) {
final String data = src.substring(DATA_IMAGE_SVG_BASE64.length(), src.length());
try {
final byte bytes[] = Base64Coder.decode(data);
final String tmp = new String(bytes);
return new AtomImgSvg(new TileImageSvg(tmp));
} catch (Exception e) {
return AtomTextUtils.createLegacy("ERROR " + e.toString(), fc);
}
}
try { try {
// Check if valid URL // Check if valid URL
if (src.startsWith("http:") || src.startsWith("https:")) { if (src.startsWith("http:") || src.startsWith("https:")) {

View File

@ -54,13 +54,16 @@ import net.sourceforge.plantuml.creole.atom.AbstractAtom;
import net.sourceforge.plantuml.creole.atom.Atom; import net.sourceforge.plantuml.creole.atom.Atom;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UText; import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.UTranslate; import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorAutomatic; import net.sourceforge.plantuml.ugraphic.color.HColorAutomatic;
import net.sourceforge.plantuml.ugraphic.color.HColorSimple; import net.sourceforge.plantuml.ugraphic.color.HColorSimple;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
import net.sourceforge.plantuml.utils.CharHidder; import net.sourceforge.plantuml.utils.CharHidder;
public final class AtomText extends AbstractAtom implements Atom { public final class AtomText extends AbstractAtom implements Atom {
@ -75,12 +78,24 @@ public final class AtomText extends AbstractAtom implements Atom {
private final DelayedDouble marginRight; private final DelayedDouble marginRight;
private final Url url; private final Url url;
private final boolean manageSpecialChars; private final boolean manageSpecialChars;
private TextBlock visibility;
protected AtomText(String text, FontConfiguration style, Url url, DelayedDouble marginLeft, protected AtomText(String text, FontConfiguration style, Url url, DelayedDouble marginLeft,
DelayedDouble marginRight, boolean manageSpecialChars) { DelayedDouble marginRight, boolean manageSpecialChars) {
if (text.contains("" + BackSlash.hiddenNewLine())) { if (text.contains("" + BackSlash.hiddenNewLine())) {
throw new IllegalArgumentException(text); throw new IllegalArgumentException(text);
} }
// if (text.length() > 0) {
// final VisibilityModifier visibilityModifier = VisibilityModifier.getByUnicode(text.charAt(0));
// if (visibilityModifier != null) {
// final HColor back = HColorUtils.GREEN;
// final HColor fore = HColorUtils.RED;
// visibility = visibilityModifier.getUBlock(11, fore, back, url != null);
// text = text.substring(1);
// }
// }
this.marginLeft = marginLeft; this.marginLeft = marginLeft;
this.marginRight = marginRight; this.marginRight = marginRight;
String s = CharHidder.unhide(text); String s = CharHidder.unhide(text);
@ -109,9 +124,12 @@ public final class AtomText extends AbstractAtom implements Atom {
if (h < 10) { if (h < 10) {
h = 10; h = 10;
} }
final double width = text.indexOf("\t") == -1 ? rect.getWidth() : getWidth(stringBounder, text); double width = text.indexOf("\t") == -1 ? rect.getWidth() : getWidth(stringBounder, text);
final double left = marginLeft.getDouble(stringBounder); final double left = marginLeft.getDouble(stringBounder);
final double right = marginRight.getDouble(stringBounder); final double right = marginRight.getDouble(stringBounder);
if (visibility != null) {
width += visibility.calculateDimension(stringBounder).getWidth();
}
return new Dimension2DDouble(width + left + right, h); return new Dimension2DDouble(width + left + right, h);
} }
@ -123,6 +141,11 @@ public final class AtomText extends AbstractAtom implements Atom {
if (ug.matchesProperty("SPECIALTXT")) { if (ug.matchesProperty("SPECIALTXT")) {
ug.draw(this); ug.draw(this);
} else { } else {
if (visibility != null) {
visibility.drawU(ug.apply(UTranslate.dy(2)));
final double width = visibility.calculateDimension(ug.getStringBounder()).getWidth();
ug = ug.apply(UTranslate.dx(width));
}
HColor textColor = fontConfiguration.getColor(); HColor textColor = fontConfiguration.getColor();
FontConfiguration useFontConfiguration = fontConfiguration; FontConfiguration useFontConfiguration = fontConfiguration;
if (textColor instanceof HColorAutomatic && ug.getParam().getBackcolor() != null) { if (textColor instanceof HColorAutomatic && ug.getParam().getBackcolor() != null) {

View File

@ -104,7 +104,7 @@ public class CreoleParser implements SheetBuilder {
.createStripe(context); .createStripe(context);
} }
private static boolean isTableLine(String line) { public static boolean isTableLine(String line) {
return line.matches("^(\\<#\\w+(,#?\\w+)?\\>)?\\|(\\=)?.*\\|$"); return line.matches("^(\\<#\\w+(,#?\\w+)?\\>)?\\|(\\=)?.*\\|$");
} }

View File

@ -46,16 +46,16 @@ public interface Bodier {
public void setLeaf(ILeaf leaf); public void setLeaf(ILeaf leaf);
public List<Member> getFieldsToDisplay(); public Display getFieldsToDisplay();
public List<Member> getMethodsToDisplay(); public Display getMethodsToDisplay();
public void addFieldOrMethod(String s); public void addFieldOrMethod(String s);
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); Stereotype stereotype, Style style);
public List<String> getRawBody(); public List<CharSequence> getRawBody();
public void muteClassToObject(); public void muteClassToObject();

View File

@ -43,6 +43,8 @@ import java.util.Set;
import net.sourceforge.plantuml.FontParam; 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.creole.legacy.CreoleParser;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
@ -50,14 +52,13 @@ import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
public class BodierImpl implements Bodier { public class BodierLikeClassOrObject implements Bodier {
private final List<String> rawBody = new ArrayList<String>(); private final List<CharSequence> rawBody = new ArrayList<CharSequence>();
private final Set<VisibilityModifier> hides; private final Set<VisibilityModifier> hides;
private LeafType type; private LeafType type;
private List<Member> methodsToDisplay; private List<Member> methodsToDisplay;
private List<Member> fieldsToDisplay; private List<Member> fieldsToDisplay;
private final boolean manageModifier;
private ILeaf leaf; private ILeaf leaf;
public void muteClassToObject() { public void muteClassToObject() {
@ -66,13 +67,16 @@ public class BodierImpl implements Bodier {
type = LeafType.OBJECT; type = LeafType.OBJECT;
} }
public BodierImpl(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();
} }
if (type == null) {
throw new IllegalArgumentException();
}
assert type.isLikeClass() || type == LeafType.OBJECT;
this.hides = hides; this.hides = hides;
this.type = type; this.type = type;
this.manageModifier = type == null ? false : type.manageModifier();
} }
public void setLeaf(ILeaf leaf) { public void setLeaf(ILeaf leaf) {
@ -91,44 +95,47 @@ public class BodierImpl implements Bodier {
} }
private boolean isBodyEnhanced() { private boolean isBodyEnhanced() {
for (String s : rawBody) { for (CharSequence s : rawBody) {
if (BodyEnhanced.isBlockSeparator(s)) { if (BodyEnhanced1.isBlockSeparator(s) || CreoleParser.isTableLine(s.toString())) {
return true; return true;
} }
} }
return false; return false;
} }
private boolean isMethod(String s) { private boolean isMethod(CharSequence s) {
if (type == LeafType.ANNOTATION || type == LeafType.ABSTRACT_CLASS || type == LeafType.CLASS final String purged = s.toString().replaceAll(UrlBuilder.getRegexp(), "");
|| type == LeafType.INTERFACE || type == LeafType.ENUM) { if (purged.contains("{method}")) {
return Member.isMethod(s); return true;
} }
if (purged.contains("{field}")) {
return false; return false;
} }
return purged.contains("(") || purged.contains(")");
}
public List<Member> getMethodsToDisplay() { public Display getMethodsToDisplay() {
if (methodsToDisplay == null) { if (methodsToDisplay == null) {
methodsToDisplay = new ArrayList<Member>(); methodsToDisplay = new ArrayList<Member>();
for (int i = 0; i < rawBody.size(); i++) { for (int i = 0; i < rawBody.size(); i++) {
final String 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 = new Member(s, true, manageModifier); 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);
} }
return Collections.unmodifiableList(methodsToDisplay); return Display.create(methodsToDisplay);
} }
private boolean isMethod(int i, List<String> rawBody) { private boolean isMethod(int i, List<CharSequence> rawBody) {
if (i > 0 && i < rawBody.size() - 1 && rawBody.get(i).length() == 0 && isMethod(rawBody.get(i - 1)) if (i > 0 && i < rawBody.size() - 1 && rawBody.get(i).length() == 0 && isMethod(rawBody.get(i - 1))
&& isMethod(rawBody.get(i + 1))) { && isMethod(rawBody.get(i + 1))) {
return true; return true;
@ -136,24 +143,24 @@ public class BodierImpl implements Bodier {
return isMethod(rawBody.get(i)); return isMethod(rawBody.get(i));
} }
public List<Member> getFieldsToDisplay() { public Display getFieldsToDisplay() {
if (fieldsToDisplay == null) { if (fieldsToDisplay == null) {
fieldsToDisplay = new ArrayList<Member>(); fieldsToDisplay = new ArrayList<Member>();
for (String s : rawBody) { for (CharSequence s : rawBody) {
if (isMethod(s) == true) { if (isMethod(s) == true) {
continue; continue;
} }
if (s.length() == 0 && fieldsToDisplay.size() == 0) { if (s.length() == 0 && fieldsToDisplay.size() == 0) {
continue; continue;
} }
final Member m = new Member(s, false, manageModifier); 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);
} }
return Collections.unmodifiableList(fieldsToDisplay); return Display.create(fieldsToDisplay);
} }
private void removeFinalEmptyMembers(List<Member> result) { private void removeFinalEmptyMembers(List<Member> result) {
@ -163,12 +170,14 @@ public class BodierImpl implements Bodier {
} }
public boolean hasUrl() { public boolean hasUrl() {
for (Member m : getFieldsToDisplay()) { for (CharSequence cs : getFieldsToDisplay()) {
final Member m = (Member) cs;
if (m.hasUrl()) { if (m.hasUrl()) {
return true; return true;
} }
} }
for (Member m : getMethodsToDisplay()) { for (CharSequence cs : getMethodsToDisplay()) {
final Member m = (Member) cs;
if (m.hasUrl()) { if (m.hasUrl()) {
return true; return true;
} }
@ -176,15 +185,17 @@ public class BodierImpl implements Bodier {
return false; return false;
} }
private List<String> rawBodyWithoutHidden() { private List<CharSequence> rawBodyWithoutHidden() {
if (hides == null || hides.size() == 0) { final List<CharSequence> result = new ArrayList<CharSequence>();
return rawBody; for (CharSequence s : rawBody) {
final Member m;
if (isMethod(s)) {
m = Member.method(s);
} else {
m = Member.field(s);
} }
final List<String> result = new ArrayList<String>();
for (String s : rawBody) {
final Member m = new Member(s, isMethod(s), manageModifier);
if (hides.contains(m.getVisibilityModifier()) == false) { if (hides.contains(m.getVisibilityModifier()) == false) {
result.add(s); result.add(m);
} }
} }
@ -193,28 +204,31 @@ public class BodierImpl 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) { Stereotype stereotype, Style style) {
if (BodyFactory.BODY3) {
return new Body3(rawBody, fontParam, skinParam, stereotype, style);
}
if (type.isLikeClass() && isBodyEnhanced()) { if (type.isLikeClass() && isBodyEnhanced()) {
if (showMethods || showFields) { if (showMethods || showFields) {
return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf, return BodyFactory.create1(rawBodyWithoutHidden(), fontParam, skinParam, stereotype, leaf, style);
style);
} }
return null; return null;
} }
if (leaf == null) { if (leaf == null) {
throw new IllegalStateException(); throw new IllegalStateException();
} }
final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), fontParam, skinParam,
stereotype, leaf, style);
if (type == LeafType.OBJECT) { if (type == LeafType.OBJECT) {
if (showFields == false) { if (showFields == false) {
return new TextBlockLineBefore(TextBlockUtils.empty(0, 0)); return new TextBlockLineBefore(TextBlockUtils.empty(0, 0));
} }
return new BodyEnhanced(rawBodyWithoutHidden(), fontParam, skinParam, manageModifier, stereotype, leaf, return BodyFactory.create1(rawBodyWithoutHidden(), fontParam, skinParam, stereotype, leaf, style);
style);
}
if (type.isLikeClass() == false) {
throw new UnsupportedOperationException();
} }
assert type.isLikeClass();
final MethodsOrFieldsArea fields = new MethodsOrFieldsArea(getFieldsToDisplay(), fontParam, skinParam,
stereotype, leaf, style);
final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), fontParam, skinParam, final MethodsOrFieldsArea methods = new MethodsOrFieldsArea(getMethodsToDisplay(), fontParam, skinParam,
stereotype, leaf, style); stereotype, leaf, style);
if (showFields && showMethods == false) { if (showFields && showMethods == false) {
@ -230,7 +244,7 @@ public class BodierImpl implements Bodier {
return TextBlockUtils.mergeTB(bb1, bb2, HorizontalAlignment.LEFT); return TextBlockUtils.mergeTB(bb1, bb2, HorizontalAlignment.LEFT);
} }
public List<String> getRawBody() { public List<CharSequence> getRawBody() {
return Collections.unmodifiableList(rawBody); return Collections.unmodifiableList(rawBody);
} }

View File

@ -50,7 +50,7 @@ import net.sourceforge.plantuml.style.Style;
public class BodierMap implements Bodier { public class BodierMap implements Bodier {
private final List<String> rawBody = new ArrayList<String>(); private final List<CharSequence> rawBody = new ArrayList<CharSequence>();
private final Map<String, String> map = new LinkedHashMap<String, String>(); private final Map<String, String> map = new LinkedHashMap<String, String>();
private ILeaf leaf; private ILeaf leaf;
@ -89,11 +89,11 @@ public class BodierMap implements Bodier {
} }
} }
public List<Member> getMethodsToDisplay() { public Display getMethodsToDisplay() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
public List<Member> getFieldsToDisplay() { public Display getFieldsToDisplay() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@ -106,7 +106,7 @@ public class BodierMap implements Bodier {
return new TextBlockMap(fontParam, skinParam, map); return new TextBlockMap(fontParam, skinParam, map);
} }
public List<String> getRawBody() { public List<CharSequence> getRawBody() {
return Collections.unmodifiableList(rawBody); return Collections.unmodifiableList(rawBody);
} }

View File

@ -0,0 +1,91 @@
/* ========================================================================
* 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.cucadiagram;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.style.Style;
public class BodierSimple implements Bodier {
private final List<CharSequence> rawBody = new ArrayList<CharSequence>();
private ILeaf leaf;
public void muteClassToObject() {
throw new UnsupportedOperationException();
}
BodierSimple() {
}
public void setLeaf(ILeaf leaf) {
if (leaf == null) {
throw new IllegalArgumentException();
}
this.leaf = leaf;
}
public void addFieldOrMethod(String s) {
rawBody.add(s);
}
public Display getMethodsToDisplay() {
throw new UnsupportedOperationException();
}
public Display getFieldsToDisplay() {
throw new UnsupportedOperationException();
}
public boolean hasUrl() {
throw new UnsupportedOperationException();
}
public List<CharSequence> getRawBody() {
return Collections.unmodifiableList(rawBody);
}
public TextBlock getBody(FontParam fontParam, ISkinParam skinParam, boolean showMethods, boolean showFields,
Stereotype stereotype, Style style) {
return BodyFactory.create1(rawBody, fontParam, skinParam, stereotype, leaf, style);
}
}

View File

@ -0,0 +1,101 @@
/* ========================================================================
* 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.cucadiagram;
import java.awt.geom.Dimension2D;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class Body3 extends AbstractTextBlock implements TextBlock, WithPorts {
private final List<CharSequence> rawBody = new ArrayList<CharSequence>();
private final FontParam fontParam;
private final ISkinParam skinParam;
private final Stereotype stereotype;
private final Style style;
public Body3(List<CharSequence> rawBody_, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype,
Style style) {
for (CharSequence s : rawBody_) {
this.rawBody.add(VisibilityModifier.replaceVisibilityModifierByUnicodeChar(s.toString(), true));
}
this.fontParam = fontParam;
this.skinParam = skinParam;
this.stereotype = stereotype;
this.style = style;
}
public void drawU(UGraphic ug) {
getTextBlock().drawU(ug);
}
private TextBlock getTextBlock() {
Display display = Display.create(rawBody);
FontConfiguration config;
if (style != null) {
config = new FontConfiguration(skinParam, style);
} else {
config = new FontConfiguration(skinParam, fontParam, stereotype);
}
TextBlock foo = display.create(config, HorizontalAlignment.LEFT, skinParam);
return foo;
}
public Ports getPorts(StringBounder stringBounder) {
return new Ports();
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return getTextBlock().calculateDimension(stringBounder);
}
}

View File

@ -1,289 +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.cucadiagram;
import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockVertical2;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class BodyEnhanced extends AbstractTextBlock implements TextBlock, WithPorts {
private TextBlock area;
private final FontConfiguration titleConfig;
private final List<CharSequence> rawBody;
private final FontParam fontParam;
private final ISkinParam skinParam;
private final boolean lineFirst;
private final HorizontalAlignment align;
private final boolean manageHorizontalLine;
private final boolean manageModifier;
private final List<Url> urls = new ArrayList<Url>();
private final Stereotype stereotype;
private final ILeaf entity;
private final boolean inEllipse;
private final double minClassWidth;
private final Style style;
public BodyEnhanced(List<String> rawBody, FontParam fontParam, ISkinParam skinParam, boolean manageModifier,
Stereotype stereotype, ILeaf entity, Style style) {
this.style = style;
this.rawBody = new ArrayList<CharSequence>(rawBody);
this.stereotype = stereotype;
this.fontParam = fontParam;
this.skinParam = skinParam;
this.titleConfig = new FontConfiguration(skinParam, fontParam, stereotype);
this.lineFirst = true;
this.align = skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT);
this.manageHorizontalLine = true;
this.manageModifier = manageModifier;
this.entity = entity;
this.inEllipse = false;
this.minClassWidth = 0;
}
public BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align,
Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity, Style style) {
this(display, fontParam, skinParam, align, stereotype, manageHorizontalLine, manageHorizontalLine, entity, 0,
style);
}
private BodyEnhanced(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align,
Stereotype stereotype, boolean manageHorizontalLine, boolean manageModifier, ILeaf entity,
double minClassWidth, Style style) {
this.style = style;
this.minClassWidth = minClassWidth;
this.entity = entity;
this.stereotype = stereotype;
this.rawBody = new ArrayList<CharSequence>();
this.fontParam = fontParam;
this.skinParam = skinParam;
if (style == null) {
this.titleConfig = new FontConfiguration(skinParam, fontParam, stereotype);
} else {
this.titleConfig = style.getFontConfiguration(skinParam.getIHtmlColorSet());
}
this.lineFirst = false;
this.align = skinParam.getDefaultTextAlignment(align);
this.manageHorizontalLine = manageHorizontalLine;
this.manageModifier = manageModifier;
this.inEllipse = fontParam == FontParam.USECASE;
if (manageHorizontalLine && inEllipse && display.size() > 0 && isBlockSeparator(display.get(0).toString())) {
this.rawBody.add("");
}
for (CharSequence s : display) {
this.rawBody.add(s);
}
}
private TextBlock decorate(StringBounder stringBounder, TextBlock b, char separator, TextBlock title) {
if (separator == 0) {
return b;
}
if (title == null) {
return new TextBlockLineBefore(TextBlockUtils.withMargin(b, 6, 4), separator);
}
final Dimension2D dimTitle = title.calculateDimension(stringBounder);
final TextBlock raw = new TextBlockLineBefore(TextBlockUtils.withMargin(b, 6, 6, dimTitle.getHeight() / 2, 4),
separator, title);
return TextBlockUtils.withMargin(raw, 0, 0, dimTitle.getHeight() / 2, 0);
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return getArea(stringBounder).calculateDimension(stringBounder);
}
private TextBlock getArea(StringBounder stringBounder) {
if (area != null) {
return area;
}
urls.clear();
final List<TextBlock> blocks = new ArrayList<TextBlock>();
char separator = lineFirst ? '_' : 0;
TextBlock title = null;
List<Member> members = new ArrayList<Member>();
for (ListIterator<CharSequence> it = rawBody.listIterator(); it.hasNext();) {
final CharSequence s2 = it.next();
if (s2 instanceof EmbeddedDiagram) {
if (members.size() > 0 || separator != 0) {
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity, style),
separator, title));
separator = 0;
title = null;
members = new ArrayList<Member>();
}
blocks.add(((EmbeddedDiagram) s2).asDraw(skinParam));
} else {
final String s = s2.toString();
if (manageHorizontalLine && isBlockSeparator(s)) {
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity, style),
separator, title));
separator = s.charAt(0);
title = getTitle(s, skinParam);
members = new ArrayList<Member>();
} else if (Parser.isTreeStart(s)) {
if (members.size() > 0) {
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(members, fontParam, skinParam, align,
stereotype, entity, style), separator, title));
}
separator = 0;
title = null;
members = new ArrayList<Member>();
final List<CharSequence> allTree = buildAllTree(s, it);
final TextBlock bloc = Display.create(allTree).create7(fontParam.getFontConfiguration(skinParam),
align, skinParam, CreoleMode.FULL);
blocks.add(bloc);
} else {
final Member m = new Member(s, Member.isMethod(s), manageModifier);
members.add(m);
if (m.getUrl() != null) {
urls.add(m.getUrl());
}
}
}
}
if (inEllipse && members.size() == 0) {
members.add(new Member("", false, false));
}
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(members, fontParam, skinParam, align, stereotype, entity, style), separator,
title));
if (blocks.size() == 1) {
this.area = blocks.get(0);
} else {
this.area = new TextBlockVertical2(blocks, align);
}
if (minClassWidth > 0) {
this.area = TextBlockUtils.withMinWidth(this.area, minClassWidth,
skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT));
}
return area;
}
private static List<CharSequence> buildAllTree(String init, ListIterator<CharSequence> it) {
final List<CharSequence> result = new ArrayList<CharSequence>();
result.add(init);
while (it.hasNext()) {
final CharSequence s = it.next();
if (Parser.isTreeStart(StringUtils.trinNoTrace(s))) {
result.add(s);
} else {
it.previous();
return result;
}
}
return result;
}
public static boolean isBlockSeparator(String s) {
if (s.startsWith("--") && s.endsWith("--")) {
return true;
}
if (s.startsWith("==") && s.endsWith("==")) {
return true;
}
if (s.startsWith("..") && s.endsWith("..") && s.equals("...") == false) {
return true;
}
if (s.startsWith("__") && s.endsWith("__")) {
return true;
}
return false;
}
private TextBlock getTitle(String s, ISkinSimple spriteContainer) {
if (s.length() <= 4) {
return null;
}
s = StringUtils.trin(s.substring(2, s.length() - 2));
return Display.getWithNewlines(s).create(titleConfig, HorizontalAlignment.LEFT, spriteContainer);
}
public Ports getPorts(StringBounder stringBounder) {
final TextBlock area = getArea(stringBounder);
if (area instanceof WithPorts) {
return ((WithPorts) area).getPorts(stringBounder);
}
return new Ports();
}
public void drawU(UGraphic ug) {
getArea(ug.getStringBounder()).drawU(ug);
}
public List<Url> getUrls() {
return Collections.unmodifiableList(urls);
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
return getArea(stringBounder).getInnerPosition(member, stringBounder, strategy);
}
}

View File

@ -0,0 +1,232 @@
/* ========================================================================
* 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.cucadiagram;
import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.creole.CreoleMode;
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;
import net.sourceforge.plantuml.graphic.InnerStrategy;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockVertical2;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts;
public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, WithPorts {
private final Display rawBody2;
private final FontParam fontParam;
private final ISkinParam skinParam;
private final boolean lineFirst;
private final List<Url> urls = new ArrayList<Url>();
private final Stereotype stereotype;
private final ILeaf entity;
private final boolean inEllipse;
private final Style style;
BodyEnhanced1(List<CharSequence> rawBody, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype,
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;
this.fontParam = fontParam;
this.skinParam = skinParam;
this.lineFirst = true;
this.entity = entity;
this.inEllipse = false;
}
BodyEnhanced1(Display display, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align,
Stereotype stereotype, ILeaf entity, Style style) {
super(skinParam.getDefaultTextAlignment(align),
style == null ? new FontConfiguration(skinParam, fontParam, stereotype)
: style.getFontConfiguration(skinParam.getIHtmlColorSet()));
this.style = style;
this.entity = entity;
this.stereotype = stereotype;
this.fontParam = fontParam;
this.skinParam = skinParam;
this.lineFirst = false;
this.inEllipse = fontParam == FontParam.USECASE;
if (inEllipse && display.size() > 0 && isBlockSeparator(display.get(0).toString())) {
display = display.add("");
}
this.rawBody2 = display;
}
@Override
protected double getMarginX() {
return 6;
}
private static boolean isTreeOrTable(String s) {
return Parser.isTreeStart(s) || CreoleParser.isTableLine(s);
}
@Override
protected TextBlock getArea(StringBounder stringBounder) {
if (area != null) {
return area;
}
urls.clear();
final List<TextBlock> blocks = new ArrayList<TextBlock>();
char separator = lineFirst ? '_' : 0;
TextBlock title = null;
Display display = Display.empty();
for (ListIterator<CharSequence> it = rawBody2.iterator(); it.hasNext();) {
final CharSequence cs = it.next();
if (cs instanceof EmbeddedDiagram) {
if (display.size() > 0 || separator != 0) {
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(display, fontParam, skinParam, align, stereotype, entity, style),
separator, title));
separator = 0;
title = null;
display = Display.empty();
}
blocks.add(((EmbeddedDiagram) cs).asDraw(skinParam));
} else {
final String s = cs.toString();
if (isBlockSeparator(s)) {
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(display, fontParam, skinParam, align, stereotype, entity, style),
separator, title));
separator = s.charAt(0);
title = getTitle(s, skinParam);
display = Display.empty();
} else if (isTreeOrTable(s)) {
final boolean isTable = CreoleParser.isTableLine(s);
if (display.size() > 0) {
blocks.add(decorate(stringBounder, new MethodsOrFieldsArea(display, fontParam, skinParam, align,
stereotype, entity, style), separator, title));
}
separator = 0;
title = null;
display = Display.empty();
final List<CharSequence> allTree = buildTreeOrTable(s, it);
TextBlock bloc = Display.create(allTree).create7(fontParam.getFontConfiguration(skinParam), align,
skinParam, CreoleMode.FULL);
if (isTable) {
bloc = TextBlockUtils.withMargin(bloc, 10, 10, 0, 5);
}
blocks.add(bloc);
} else {
display = display.add(cs);
if (cs instanceof Member && ((Member) cs).getUrl() != null) {
urls.add(((Member) cs).getUrl());
}
}
}
}
if (inEllipse && display.size() == 0) {
display = display.add("");
}
blocks.add(decorate(stringBounder,
new MethodsOrFieldsArea(display, fontParam, skinParam, align, stereotype, entity, style), separator,
title));
if (blocks.size() == 1) {
this.area = blocks.get(0);
} else {
this.area = new TextBlockVertical2(blocks, align);
}
if (skinParam.minClassWidth() > 0) {
this.area = TextBlockUtils.withMinWidth(this.area, skinParam.minClassWidth(), align);
}
return area;
}
private static List<CharSequence> buildTreeOrTable(String init, ListIterator<CharSequence> it) {
final List<CharSequence> result = new ArrayList<CharSequence>();
result.add(init);
while (it.hasNext()) {
final CharSequence s = it.next();
if (isTreeOrTable(StringUtils.trinNoTrace(s))) {
result.add(s);
} else {
it.previous();
return result;
}
}
return result;
}
public Ports getPorts(StringBounder stringBounder) {
final TextBlock area = getArea(stringBounder);
if (area instanceof WithPorts) {
return ((WithPorts) area).getPorts(stringBounder);
}
return new Ports();
}
public List<Url> getUrls() {
return Collections.unmodifiableList(urls);
}
public Rectangle2D getInnerPosition(String member, StringBounder stringBounder, InnerStrategy strategy) {
return getArea(stringBounder).getInnerPosition(member, stringBounder, strategy);
}
}

View File

@ -35,7 +35,6 @@
*/ */
package net.sourceforge.plantuml.cucadiagram; package net.sourceforge.plantuml.cucadiagram;
import java.awt.geom.Dimension2D;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -43,59 +42,37 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Guillemet; import net.sourceforge.plantuml.Guillemet;
import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockVertical2; import net.sourceforge.plantuml.graphic.TextBlockVertical2;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock { public class BodyEnhanced2 extends BodyEnhancedAbstract {
private TextBlock area;
private final FontConfiguration titleConfig;
private final Display rawBody; private final Display rawBody;
private final ISkinSimple spriteContainer; private final ISkinSimple skinParam;
private final HorizontalAlignment align;
private final LineBreakStrategy lineBreakStrategy; private final LineBreakStrategy lineBreakStrategy;
private final double minClassWidth;
// private final List<Url> urls = new ArrayList<Url>(); BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple skinParam, HorizontalAlignment align,
FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy) {
super(align, titleConfig);
public BodyEnhanced2(Display rawBody, FontParam fontParam, ISkinSimple spriteContainer, HorizontalAlignment align,
FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy, double minClassWidth) {
this.rawBody = rawBody; this.rawBody = rawBody;
this.lineBreakStrategy = lineBreakStrategy; this.lineBreakStrategy = lineBreakStrategy;
this.spriteContainer = spriteContainer; this.skinParam = skinParam;
this.minClassWidth = minClassWidth;
this.titleConfig = titleConfig;
this.align = align;
} }
private TextBlock decorate(StringBounder stringBounder, TextBlock b, char separator, TextBlock title) { @Override
if (separator == 0) { protected double getMarginX() {
return b; return 0;
}
if (title == null) {
return new TextBlockLineBefore(TextBlockUtils.withMargin(b, 0, 4), separator);
}
final Dimension2D dimTitle = title.calculateDimension(stringBounder);
final TextBlock raw = new TextBlockLineBefore(TextBlockUtils.withMargin(b, 0, 6, dimTitle.getHeight() / 2, 4),
separator, title);
return TextBlockUtils.withMargin(raw, 0, 0, dimTitle.getHeight() / 2, 0);
} }
public Dimension2D calculateDimension(StringBounder stringBounder) { @Override
return getArea(stringBounder).calculateDimension(stringBounder); protected TextBlock getArea(StringBounder stringBounder) {
}
private TextBlock getArea(StringBounder stringBounder) {
if (area != null) { if (area != null) {
return area; return area;
} }
@ -107,9 +84,9 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
Display display = Display.empty(); Display display = Display.empty();
for (CharSequence s : rawBody) { for (CharSequence s : rawBody) {
if (isBlockSeparator(s.toString())) { if (isBlockSeparator(s.toString())) {
blocks.add(decorate(stringBounder, getTextBlock(display, stringBounder), separator, title)); blocks.add(decorate(stringBounder, getTextBlock(display), separator, title));
separator = s.charAt(0); separator = s.charAt(0);
title = getTitle(s.toString(), spriteContainer); title = getTitle(s.toString(), skinParam);
display = Display.empty(); display = Display.empty();
} else { } else {
if (s instanceof String) { if (s instanceof String) {
@ -118,7 +95,7 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
display = display.add(s); display = display.add(s);
} }
} }
blocks.add(decorate(stringBounder, getTextBlock(display, stringBounder), separator, title)); blocks.add(decorate(stringBounder, getTextBlock(display), separator, title));
if (blocks.size() == 1) { if (blocks.size() == 1) {
this.area = blocks.get(0); this.area = blocks.get(0);
@ -126,44 +103,16 @@ public class BodyEnhanced2 extends AbstractTextBlock implements TextBlock {
this.area = new TextBlockVertical2(blocks, align); this.area = new TextBlockVertical2(blocks, align);
} }
if (minClassWidth > 0) { if (skinParam.minClassWidth() > 0) {
this.area = TextBlockUtils.withMinWidth(this.area, minClassWidth, align); this.area = TextBlockUtils.withMinWidth(this.area, skinParam.minClassWidth(), align);
} }
return area; return area;
} }
private TextBlock getTextBlock(Display display, StringBounder stringBounder) { private TextBlock getTextBlock(Display display) {
final TextBlock result = display.create9(titleConfig, align, spriteContainer, lineBreakStrategy); final TextBlock result = display.create9(titleConfig, align, skinParam, lineBreakStrategy);
return result; return result;
} }
public static boolean isBlockSeparator(String s) {
if (s.startsWith("--") && s.endsWith("--")) {
return true;
}
if (s.startsWith("==") && s.endsWith("==")) {
return true;
}
if (s.startsWith("..") && s.endsWith("..")) {
return true;
}
if (s.startsWith("__") && s.endsWith("__")) {
return true;
}
return false;
}
private TextBlock getTitle(String s, ISkinSimple spriteContainer) {
if (s.length() <= 4) {
return null;
}
s = StringUtils.trin(s.substring(2, s.length() - 2));
return Display.getWithNewlines(s).create(titleConfig, HorizontalAlignment.LEFT, spriteContainer);
}
public void drawU(UGraphic ug) {
getArea(ug.getStringBounder()).drawU(ug);
}
} }

View File

@ -0,0 +1,113 @@
/* ========================================================================
* 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.cucadiagram;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public abstract class BodyEnhancedAbstract extends AbstractTextBlock implements TextBlock {
protected final HorizontalAlignment align;
protected final FontConfiguration titleConfig;
protected TextBlock area;
BodyEnhancedAbstract(HorizontalAlignment align, FontConfiguration titleConfig) {
this.align = align;
this.titleConfig = titleConfig;
}
public static boolean isBlockSeparator(CharSequence cs) {
final String s = cs.toString();
if (s.startsWith("--") && s.endsWith("--")) {
return true;
}
if (s.startsWith("==") && s.endsWith("==")) {
return true;
}
if (s.startsWith("..") && s.endsWith("..") && s.equals("...") == false) {
return true;
}
if (s.startsWith("__") && s.endsWith("__")) {
return true;
}
return false;
}
public final Dimension2D calculateDimension(StringBounder stringBounder) {
return getArea(stringBounder).calculateDimension(stringBounder);
}
final public void drawU(UGraphic ug) {
getArea(ug.getStringBounder()).drawU(ug);
}
final protected TextBlock getTitle(String s, ISkinSimple spriteContainer) {
if (s.length() <= 4) {
return null;
}
s = StringUtils.trin(s.substring(2, s.length() - 2));
return Display.getWithNewlines(s).create(titleConfig, HorizontalAlignment.LEFT, spriteContainer);
}
abstract protected TextBlock getArea(StringBounder stringBounder);
abstract protected double getMarginX();
final protected TextBlock decorate(StringBounder stringBounder, TextBlock b, char separator, TextBlock title) {
final double marginX = getMarginX();
if (separator == 0) {
return TextBlockUtils.withMargin(b, marginX, 0);
}
if (title == null) {
return new TextBlockLineBefore(TextBlockUtils.withMargin(b, marginX, 4), separator);
}
final Dimension2D dimTitle = title.calculateDimension(stringBounder);
final TextBlock raw = new TextBlockLineBefore(
TextBlockUtils.withMargin(b, marginX, 6, dimTitle.getHeight() / 2, 4), separator, title);
return TextBlockUtils.withMargin(raw, 0, 0, dimTitle.getHeight() / 2, 0);
}
}

View File

@ -0,0 +1,81 @@
/* ========================================================================
* 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.cucadiagram;
import java.util.List;
import java.util.Set;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.Style;
public class BodyFactory {
public final static boolean BODY3 = false;
public static Bodier createLeaf(LeafType type, Set<VisibilityModifier> hides) {
if (type.isLikeClass() || type == LeafType.OBJECT) {
return new BodierLikeClassOrObject(type, hides);
}
return new BodierSimple();
}
public static Bodier createGroup(Set<VisibilityModifier> hides) {
return new BodierSimple();
}
public static TextBlock create1(List<CharSequence> rawBody, FontParam fontParam, ISkinParam skinParam,
Stereotype stereotype, ILeaf entity, Style style) {
return new BodyEnhanced1(rawBody, fontParam, skinParam, stereotype, entity, style);
}
public static TextBlock create2(Display display, FontParam fontParam, ISkinParam skinParam,
HorizontalAlignment align, Stereotype stereotype, ILeaf entity, Style style) {
return new BodyEnhanced1(display, fontParam, skinParam, align, stereotype, entity, style);
}
public static TextBlock create3(Display rawBody, FontParam fontParam, ISkinSimple skinParam,
HorizontalAlignment align, FontConfiguration titleConfig, LineBreakStrategy lineBreakStrategy) {
return new BodyEnhanced2(rawBody, fontParam, skinParam, align, titleConfig, lineBreakStrategy);
}
}

View File

@ -597,8 +597,9 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
result.add(s); result.add(s);
} }
} }
final String aspect = getPragma().getValue("aspect"); String aspect = getPragma().getValue("aspect");
if (aspect != null) { if (aspect != null) {
aspect = aspect.replace(',', '.');
result.add("aspect=" + aspect + ";"); result.add("aspect=" + aspect + ";");
} }
final String ratio = getPragma().getValue("ratio"); final String ratio = getPragma().getValue("ratio");

View File

@ -41,6 +41,7 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.ListIterator;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -242,7 +243,7 @@ public class Display implements Iterable<CharSequence> {
final List<CharSequence> other = new ArrayList<CharSequence>(); final List<CharSequence> other = new ArrayList<CharSequence>();
other.add("@start" + type); other.add("@start" + type);
while (it.hasNext()) { while (it.hasNext()) {
CharSequence s2 = it.next(); final CharSequence s2 = it.next();
if (s2 != null && StringUtils.trin(s2.toString()).equals("}}")) { if (s2 != null && StringUtils.trin(s2.toString()).equals("}}")) {
break; break;
} }
@ -398,8 +399,8 @@ public class Display implements Iterable<CharSequence> {
return displayData.get(i); return displayData.get(i);
} }
public Iterator<CharSequence> iterator() { public ListIterator<CharSequence> iterator() {
return Collections.unmodifiableList(displayData).iterator(); return Collections.unmodifiableList(displayData).listIterator();
} }
public Display subList(int i, int size) { public Display subList(int i, int size) {

View File

@ -45,15 +45,15 @@ import java.util.Map;
class Election { class Election {
private final Map<String, Member> all = new HashMap<String, Member>(); private final Map<String, CharSequence> all = new HashMap<String, CharSequence>();
public void addCandidate(String display, Member candidate) { public void addCandidate(String display, CharSequence candidate) {
all.put(display, candidate); all.put(display, candidate);
} }
private Member getCandidate(String shortName) { private CharSequence getCandidate(String shortName) {
List<Member> list = getAllCandidateContains(shortName); List<CharSequence> list = getAllCandidateContains(shortName);
if (list.size() == 1) { if (list.size() == 1) {
return list.get(0); return list.get(0);
} }
@ -64,9 +64,9 @@ class Election {
return null; return null;
} }
private List<Member> getAllCandidateContains(String shortName) { private List<CharSequence> getAllCandidateContains(String shortName) {
final List<Member> result = new ArrayList<Member>(); final List<CharSequence> result = new ArrayList<CharSequence>();
for (Map.Entry<String, Member> ent : all.entrySet()) { for (Map.Entry<String, CharSequence> ent : all.entrySet()) {
if (ent.getKey().contains(shortName)) { if (ent.getKey().contains(shortName)) {
result.add(ent.getValue()); result.add(ent.getValue());
} }
@ -74,9 +74,9 @@ class Election {
return result; return result;
} }
private List<Member> getAllCandidateContainsStrict(String shortName) { private List<CharSequence> getAllCandidateContainsStrict(String shortName) {
final List<Member> result = new ArrayList<Member>(); final List<CharSequence> result = new ArrayList<CharSequence>();
for (Map.Entry<String, Member> ent : all.entrySet()) { for (Map.Entry<String, CharSequence> ent : all.entrySet()) {
final String key = ent.getKey(); final String key = ent.getKey();
if (key.matches(".*\\b" + shortName + "\\b.*")) { if (key.matches(".*\\b" + shortName + "\\b.*")) {
result.add(ent.getValue()); result.add(ent.getValue());
@ -85,10 +85,10 @@ class Election {
return result; return result;
} }
public Map<Member, String> getAllElected(Collection<String> shortNames) { public Map<CharSequence, String> getAllElected(Collection<String> shortNames) {
final Map<Member, String> memberWithPort = new HashMap<Member, String>(); final Map<CharSequence, String> memberWithPort = new HashMap<CharSequence, String>();
for (String shortName : new HashSet<String>(shortNames)) { for (String shortName : new HashSet<String>(shortNames)) {
final Member m = getCandidate(shortName); final CharSequence m = getCandidate(shortName);
if (m != null) { if (m != null) {
memberWithPort.put(m, shortName); memberWithPort.put(m, shortName);
shortNames.remove(shortName); shortNames.remove(shortName);

View File

@ -42,7 +42,8 @@ public enum LeafType {
EMPTY_PACKAGE, EMPTY_PACKAGE,
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, ASSOCIATION, ENUM, CIRCLE, ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, ASSOCIATION,
ENUM, CIRCLE,
USECASE, USECASE_BUSINESS, USECASE, USECASE_BUSINESS,
@ -83,11 +84,11 @@ public enum LeafType {
return StringUtils.capitalize(html); return StringUtils.capitalize(html);
} }
public boolean manageModifier() { // public boolean manageModifier() {
if (this == ANNOTATION || this == ABSTRACT_CLASS || this == CLASS || this == INTERFACE || this == ENUM // if (this == ANNOTATION || this == ABSTRACT_CLASS || this == CLASS || this == INTERFACE || this == ENUM
|| this == OBJECT || this == ENTITY) { // || this == OBJECT || this == ENTITY) {
return true; // return true;
} // }
return false; // return false;
} // }
} }

View File

@ -45,9 +45,10 @@ import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2; import net.sourceforge.plantuml.command.regex.Pattern2;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
public class Member { public class Member implements CharSequence {
private final String display; private final String display;
private final CharSequence raw;
private final boolean staticModifier; private final boolean staticModifier;
private final boolean abstractModifier; private final boolean abstractModifier;
private final Url url; private final Url url;
@ -57,11 +58,40 @@ public class Member {
@Override @Override
public String toString() { public String toString() {
return super.toString() + " " + display; return raw.toString();
} }
public Member(String tmpDisplay, boolean isMethod, boolean manageModifier) { public char charAt(int index) {
tmpDisplay = tmpDisplay.replaceAll("(?i)\\{(method|field)\\}\\s*", ""); return raw.charAt(index);
}
public int length() {
return raw.length();
}
public CharSequence subSequence(int start, int end) {
return raw.subSequence(start, end);
}
public static Member method(CharSequence tmpDisplay) {
return new Member(true, tmpDisplay, true);
}
public static Member field(CharSequence tmpDisplay) {
return new Member(true, tmpDisplay, false);
}
public static Member method(CharSequence tmpDisplay, boolean manageModifier) {
return new Member(manageModifier, tmpDisplay, true);
}
public static Member field(CharSequence tmpDisplay, boolean manageModifier) {
return new Member(manageModifier, tmpDisplay, false);
}
private Member(boolean manageModifier, CharSequence tmpDisplay, boolean isMethod) {
this.raw = tmpDisplay;
tmpDisplay = tmpDisplay.toString().replaceAll("(?i)\\{(method|field)\\}\\s*", "");
if (manageModifier) { if (manageModifier) {
final Pattern2 finalUrl = MyPattern.cmpile("^(.*?)(?:\\[(" + UrlBuilder.getRegexp() + ")\\])?$"); final Pattern2 finalUrl = MyPattern.cmpile("^(.*?)(?:\\[(" + UrlBuilder.getRegexp() + ")\\])?$");
final Matcher2 matcher = finalUrl.matcher(tmpDisplay); final Matcher2 matcher = finalUrl.matcher(tmpDisplay);
@ -79,12 +109,13 @@ public class Member {
this.url = null; this.url = null;
} }
this.hasUrl = this.url != null; this.hasUrl = this.url != null;
final String lower = StringUtils.goLowerCase(tmpDisplay); final String lower = StringUtils.goLowerCase(tmpDisplay.toString());
if (manageModifier) { if (manageModifier) {
this.staticModifier = lower.contains("{static}") || lower.contains("{classifier}"); this.staticModifier = lower.contains("{static}") || lower.contains("{classifier}");
this.abstractModifier = lower.contains("{abstract}"); this.abstractModifier = lower.contains("{abstract}");
String displayClean = tmpDisplay.replaceAll("(?i)\\{(static|classifier|abstract)\\}\\s*", "").trim(); String displayClean = tmpDisplay.toString().replaceAll("(?i)\\{(static|classifier|abstract)\\}\\s*", "")
.trim();
if (displayClean.length() == 0) { if (displayClean.length() == 0) {
displayClean = " "; displayClean = " ";
} }
@ -100,9 +131,9 @@ public class Member {
this.staticModifier = false; this.staticModifier = false;
this.visibilityModifier = null; this.visibilityModifier = null;
this.abstractModifier = false; this.abstractModifier = false;
tmpDisplay = StringUtils.trin(tmpDisplay); tmpDisplay = StringUtils.trin(tmpDisplay.toString());
this.display = tmpDisplay.length() == 0 ? " " this.display = tmpDisplay.length() == 0 ? " "
: Guillemet.GUILLEMET.manageGuillemet(StringUtils.trin(tmpDisplay)); : Guillemet.GUILLEMET.manageGuillemet(StringUtils.trin(tmpDisplay.toString()));
} }
} }
@ -114,8 +145,6 @@ public class Member {
} }
private String getDisplayWithoutVisibilityChar() { private String getDisplayWithoutVisibilityChar() {
// assert display.length() == 0 ||
// VisibilityModifier.isVisibilityCharacter(display.charAt(0)) == false;
return display; return display;
} }
@ -193,14 +222,6 @@ public class Member {
return hasUrl; return hasUrl;
} }
public static boolean isMethod(String s) {
final String purged = s.replaceAll(UrlBuilder.getRegexp(), "");
if (purged.contains("{method}")) {
return true;
}
if (purged.contains("{field}")) {
return false;
}
return purged.contains("(") || purged.contains(")");
}
} }

View File

@ -37,14 +37,11 @@ package net.sourceforge.plantuml.cucadiagram;
import java.awt.geom.Dimension2D; import java.awt.geom.Dimension2D;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParam;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.AbstractTextBlock;
@ -55,11 +52,9 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockLineBefore; import net.sourceforge.plantuml.graphic.TextBlockLineBefore;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockWidth;
import net.sourceforge.plantuml.graphic.TextBlockWithUrl; import net.sourceforge.plantuml.graphic.TextBlockWithUrl;
import net.sourceforge.plantuml.skin.VisibilityModifier; import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.Ports; import net.sourceforge.plantuml.svek.Ports;
import net.sourceforge.plantuml.svek.WithPorts; import net.sourceforge.plantuml.svek.WithPorts;
@ -72,7 +67,7 @@ import net.sourceforge.plantuml.ugraphic.ULayoutGroup;
import net.sourceforge.plantuml.ugraphic.color.HColor; import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.utils.CharHidder; import net.sourceforge.plantuml.utils.CharHidder;
public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockWidth, TextBlock, WithPorts { public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlock, WithPorts {
public TextBlock asBlockMemberImpl() { public TextBlock asBlockMemberImpl() {
return new TextBlockLineBefore(TextBlockUtils.withMargin(this, 6, 4)); return new TextBlockLineBefore(TextBlockUtils.withMargin(this, 6, 4));
@ -81,33 +76,36 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
private final FontParam fontParam; private final FontParam fontParam;
private final ISkinParam skinParam; private final ISkinParam skinParam;
private final Rose rose = new Rose(); private final Rose rose = new Rose();
private final List<Member> members = new ArrayList<Member>(); private final Display members;
private final HorizontalAlignment align; private final HorizontalAlignment align;
private final Stereotype stereotype; private final Stereotype stereotype;
private final ILeaf leaf; private final ILeaf leaf;
private final Style style; private final Style style;
public MethodsOrFieldsArea(List<Member> members, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype, public MethodsOrFieldsArea(Display members, FontParam fontParam, ISkinParam skinParam, Stereotype stereotype,
ILeaf leaf, Style style) { ILeaf leaf, Style style) {
this(members, fontParam, skinParam, HorizontalAlignment.LEFT, stereotype, leaf, style); this(members, fontParam, skinParam, HorizontalAlignment.LEFT, stereotype, leaf, style);
} }
public MethodsOrFieldsArea(List<Member> members, FontParam fontParam, ISkinParam skinParam, public MethodsOrFieldsArea(Display members, FontParam fontParam, ISkinParam skinParam, HorizontalAlignment align,
HorizontalAlignment align, Stereotype stereotype, ILeaf leaf, Style style) { Stereotype stereotype, ILeaf leaf, Style style) {
this.style = style; this.style = style;
this.leaf = leaf; this.leaf = leaf;
this.stereotype = stereotype; this.stereotype = stereotype;
this.align = align; this.align = align;
this.skinParam = skinParam; this.skinParam = skinParam;
this.fontParam = fontParam; this.fontParam = fontParam;
this.members.addAll(members); this.members = members;
} }
private boolean hasSmallIcon() { private boolean hasSmallIcon() {
if (skinParam.classAttributeIconSize() == 0) { if (skinParam.classAttributeIconSize() == 0) {
return false; return false;
} }
for (Member m : members) { for (CharSequence cs : members) {
if (cs instanceof Member == false)
continue;
final Member m = (Member) cs;
if (m.getVisibilityModifier() != null) { if (m.getVisibilityModifier() != null) {
return true; return true;
} }
@ -122,8 +120,8 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
} }
double x = 0; double x = 0;
double y = 0; double y = 0;
for (Member m : members) { for (CharSequence cs : members) {
final TextBlock bloc = createTextBlock(m); final TextBlock bloc = createTextBlock(cs);
final Dimension2D dim = bloc.calculateDimension(stringBounder); final Dimension2D dim = bloc.calculateDimension(stringBounder);
x = Math.max(dim.getWidth(), x); x = Math.max(dim.getWidth(), x);
y += dim.getHeight(); y += dim.getHeight();
@ -136,14 +134,19 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
final Ports result = new Ports(); final Ports result = new Ports();
double y = 0; double y = 0;
final Election election = new Election(); final Election election = new Election();
for (Member m : members) { for (CharSequence cs : members) {
if (cs instanceof Member) {
final Member m = (Member) cs;
election.addCandidate(m.getDisplay(false), m); election.addCandidate(m.getDisplay(false), m);
} else {
election.addCandidate(cs.toString(), cs);
} }
final Map<Member, String> memberWithPort = election.getAllElected(leaf.getPortShortNames()); }
for (Member m : members) { final Map<CharSequence, String> memberWithPort = election.getAllElected(leaf.getPortShortNames());
final TextBlock bloc = createTextBlock(m); for (CharSequence cs : members) {
final TextBlock bloc = createTextBlock(cs);
final Dimension2D dim = bloc.calculateDimension(stringBounder); final Dimension2D dim = bloc.calculateDimension(stringBounder);
final String port = memberWithPort.get(m); final String port = memberWithPort.get(cs);
if (port != null) { if (port != null) {
result.add(port, y, dim.getHeight()); result.add(port, y, dim.getHeight());
} }
@ -152,18 +155,22 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
return result; return result;
} }
private TextBlock createTextBlock(Member m) { private TextBlock createTextBlock(CharSequence cs) {
final boolean withVisibilityChar = skinParam.classAttributeIconSize() == 0;
String s = m.getDisplay(withVisibilityChar);
if (withVisibilityChar && s.startsWith("#")) {
s = CharHidder.addTileAtBegin(s);
}
FontConfiguration config; FontConfiguration config;
if (style != null) { if (style != null) {
config = new FontConfiguration(skinParam, style); config = new FontConfiguration(skinParam, style);
} else { } else {
config = new FontConfiguration(skinParam, fontParam, stereotype); config = new FontConfiguration(skinParam, fontParam, stereotype);
} }
if (cs instanceof Member) {
final Member m = (Member) cs;
final boolean withVisibilityChar = skinParam.classAttributeIconSize() == 0;
String s = m.getDisplay(withVisibilityChar);
if (withVisibilityChar && s.startsWith("#")) {
s = CharHidder.addTileAtBegin(s);
}
if (m.isAbstract()) { if (m.isAbstract()) {
config = config.italic(); config = config.italic();
} }
@ -177,6 +184,12 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
return new TextBlockTracer(m, bloc); return new TextBlockTracer(m, bloc);
} }
TextBlock bloc = Display.getWithNewlines(cs.toString()).create8(config, align, skinParam,
CreoleMode.SIMPLE_LINE, skinParam.wrapWidth());
return bloc;
}
static class TextBlockTracer extends AbstractTextBlock implements TextBlock { static class TextBlockTracer extends AbstractTextBlock implements TextBlock {
private final TextBlock bloc; private final TextBlock bloc;
@ -235,12 +248,9 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
return TextBlockWithUrl.withUrl(uBlock, url); return TextBlockWithUrl.withUrl(uBlock, url);
} }
public TextBlock asTextBlock(final double widthToUse) {
return this;
}
public boolean contains(String member) { public boolean contains(String member) {
for (Member att : members) { for (CharSequence cs : members) {
final Member att = (Member) cs;
if (att.getDisplay(false).startsWith(member)) { if (att.getDisplay(false).startsWith(member)) {
return true; return true;
} }
@ -260,7 +270,8 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
if (hasSmallIcon()) { if (hasSmallIcon()) {
group = new ULayoutGroup( group = new ULayoutGroup(
new PlacementStrategyVisibility(stringBounder, skinParam.getCircledCharacterRadius() + 3)); new PlacementStrategyVisibility(stringBounder, skinParam.getCircledCharacterRadius() + 3));
for (Member att : members) { for (CharSequence cs : members) {
final Member att = (Member) cs;
final TextBlock bloc = createTextBlock(att); final TextBlock bloc = createTextBlock(att);
final VisibilityModifier modifier = att.getVisibilityModifier(); final VisibilityModifier modifier = att.getVisibilityModifier();
group.add(getUBlock(modifier, att.getUrl())); group.add(getUBlock(modifier, att.getUrl()));
@ -276,8 +287,8 @@ public class MethodsOrFieldsArea extends AbstractTextBlock implements TextBlockW
placementStrategy = new PlacementStrategyY1Y2Left(stringBounder); placementStrategy = new PlacementStrategyY1Y2Left(stringBounder);
} }
group = new ULayoutGroup(placementStrategy); group = new ULayoutGroup(placementStrategy);
for (Member att : members) { for (CharSequence cs : members) {
final TextBlock bloc = createTextBlock(att); final TextBlock bloc = createTextBlock(cs);
group.add(bloc); group.add(bloc);
} }
} }

View File

@ -78,7 +78,7 @@ abstract class AbstractGraphviz implements Graphviz {
this.type = type; this.type = type;
} }
private File searchDotExe() { protected File searchDotExe() {
String getenv = GraphvizUtils.getenvGraphvizDot(); String getenv = GraphvizUtils.getenvGraphvizDot();
if (getenv == null) { if (getenv == null) {
getenv = findExecutableOnPath(getExeName()); getenv = findExecutableOnPath(getExeName());

View File

@ -132,23 +132,28 @@ public final class CucaDiagramTxtMaker {
final int w = getWidth(ent); final int w = getWidth(ent);
final int h = getHeight(ent); final int h = getHeight(ent);
ug.getCharArea().drawBoxSimple(0, 0, w, h); ug.getCharArea().drawBoxSimple(0, 0, w, h);
ug.getCharArea().drawStringsLR(ent.getDisplay().as(), 1, 1); ug.getCharArea().drawStringsLRSimple(ent.getDisplay().as(), 1, 1);
if (showMember(ent)) { if (showMember(ent)) {
int y = 2; int y = 2;
ug.getCharArea().drawHLine('-', y, 1, w - 1); ug.getCharArea().drawHLine('-', y, 1, w - 1);
y++; y++;
for (Member att : ent.getBodier().getFieldsToDisplay()) { for (CharSequence att : ent.getBodier().getRawBody()) {
final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true)); final List<String> disp = BackSlash.getWithNewlines(att.toString());
ug.getCharArea().drawStringsLR(disp, 1, y); ug.getCharArea().drawStringsLRSimple(disp, 1, y);
y += StringUtils.getHeight(disp);
}
ug.getCharArea().drawHLine('-', y, 1, w - 1);
y++;
for (Member att : ent.getBodier().getMethodsToDisplay()) {
final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true));
ug.getCharArea().drawStringsLR(disp, 1, y);
y += StringUtils.getHeight(disp); y += StringUtils.getHeight(disp);
} }
// for (Member att : ent.getBodier().getFieldsToDisplay()) {
// final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true));
// ug.getCharArea().drawStringsLR(disp, 1, y);
// y += StringUtils.getHeight(disp);
// }
// ug.getCharArea().drawHLine('-', y, 1, w - 1);
// y++;
// for (Member att : ent.getBodier().getMethodsToDisplay()) {
// final List<String> disp = BackSlash.getWithNewlines(att.getDisplay(true));
// ug.getCharArea().drawStringsLR(disp, 1, y);
// y += StringUtils.getHeight(disp);
// }
} }
} }
@ -164,33 +169,42 @@ public final class CucaDiagramTxtMaker {
private int getHeight(IEntity entity) { private int getHeight(IEntity entity) {
int result = StringUtils.getHeight(entity.getDisplay()); int result = StringUtils.getHeight(entity.getDisplay());
if (showMember(entity)) { if (showMember(entity)) {
for (Member att : entity.getBodier().getMethodsToDisplay()) { for (CharSequence att : entity.getBodier().getRawBody()) {
result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true))); result += StringUtils.getHeight(Display.getWithNewlines(att.toString()));
} }
result++; // for (Member att : entity.getBodier().getMethodsToDisplay()) {
for (Member att : entity.getBodier().getFieldsToDisplay()) { // result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true)));
result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true))); // }
// result++;
// for (Member att : entity.getBodier().getFieldsToDisplay()) {
// result += StringUtils.getHeight(Display.getWithNewlines(att.getDisplay(true)));
// }
// result++;
} }
result++; return result + 3;
}
return result + 2;
} }
private int getWidth(IEntity entity) { private int getWidth(IEntity entity) {
int result = StringUtils.getWcWidth(entity.getDisplay()); int result = StringUtils.getWcWidth(entity.getDisplay());
if (showMember(entity)) { if (showMember(entity)) {
for (Member att : entity.getBodier().getMethodsToDisplay()) { for (CharSequence att : entity.getBodier().getRawBody()) {
final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.getDisplay(true))); final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.toString()));
if (w > result) {
result = w;
}
}
for (Member att : entity.getBodier().getFieldsToDisplay()) {
final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.getDisplay(true)));
if (w > result) { if (w > result) {
result = w; result = w;
} }
} }
// for (Member att : entity.getBodier().getMethodsToDisplay()) {
// final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.getDisplay(true)));
// if (w > result) {
// result = w;
// }
// }
// for (Member att : entity.getBodier().getFieldsToDisplay()) {
// final int w = StringUtils.getWcWidth(Display.getWithNewlines(att.getDisplay(true)));
// if (w > result) {
// result = w;
// }
// }
} }
return result + 2; return result + 2;
} }

View File

@ -36,26 +36,23 @@
package net.sourceforge.plantuml.cucadiagram.dot; package net.sourceforge.plantuml.cucadiagram.dot;
import java.io.File; import java.io.File;
import java.io.FileFilter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.windowsdot.WindowsDotArchive; import net.sourceforge.plantuml.windowsdot.WindowsDotArchive;
class GraphvizWindows extends AbstractGraphviz { class GraphvizWindows extends AbstractGraphviz {
static private File specificDotExe; static private File specificDotExe;
@Override
protected File searchDotExe() {
return specificDotExe();
}
@Override @Override
protected File specificDotExe() { protected File specificDotExe() {
synchronized (GraphvizWindows.class) { synchronized (GraphvizWindows.class) {
if (specificDotExe == null) {
specificDotExe = specificDotExeSlow();
}
if (specificDotExe == null) if (specificDotExe == null)
try { try {
specificDotExe = new WindowsDotArchive().getWindowsExeLite(); specificDotExe = new WindowsDotArchive().getWindowsExeLite();
@ -68,61 +65,8 @@ class GraphvizWindows extends AbstractGraphviz {
} }
public boolean graphviz244onWindows() { public boolean graphviz244onWindows() {
try {
return GraphvizUtils.getDotVersion() == 244;
} catch (Exception e) {
e.printStackTrace();
return false; return false;
} }
}
private File specificDotExeSlow() {
for (File tmp : new File("c:/").listFiles(new FileFilter() {
public boolean accept(java.io.File pathname) {
return pathname.isDirectory() && pathname.canRead();
}
})) {
final File result = searchInDir(tmp);
if (result != null) {
return result;
}
}
return null;
}
private static File searchInDir(final File dir) {
if (dir.exists() == false || dir.isDirectory() == false) {
return null;
}
final List<File> dots = new ArrayList<File>();
final File[] files = dir.listFiles(new FileFilter() {
public boolean accept(java.io.File pathname) {
return pathname.isDirectory() && StringUtils.goLowerCase(pathname.getName()).startsWith("graphviz");
}
});
if (files == null) {
return null;
}
for (File f : files) {
final File result = new File(new File(f, "bin"), "dot.exe");
if (result.exists() && result.canRead()) {
dots.add(result.getAbsoluteFile());
}
final File result2 = new File(new File(f, "release/bin"), "dot.exe");
if (result2.exists() && result2.canRead()) {
dots.add(result2.getAbsoluteFile());
}
}
return higherVersion(dots);
}
static File higherVersion(List<File> dots) {
if (dots.size() == 0) {
return null;
}
Collections.sort(dots, Collections.reverseOrder());
return dots.get(0);
}
GraphvizWindows(ISkinParam skinParam, String dotString, String... type) { GraphvizWindows(ISkinParam skinParam, String dotString, String... type) {
super(skinParam, dotString, type); super(skinParam, dotString, type);

View File

@ -0,0 +1,136 @@
/* ========================================================================
* 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.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;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.windowsdot.WindowsDotArchive;
class GraphvizWindowsOld extends AbstractGraphviz {
static private File specificDotExe;
@Override
protected File specificDotExe() {
synchronized (GraphvizWindowsOld.class) {
if (specificDotExe == null) {
specificDotExe = specificDotExeSlow();
}
if (specificDotExe == null)
try {
specificDotExe = new WindowsDotArchive().getWindowsExeLite();
} catch (IOException e) {
e.printStackTrace();
}
return specificDotExe;
}
}
public boolean graphviz244onWindows() {
try {
return GraphvizUtils.getDotVersion() == 244;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
private File specificDotExeSlow() {
for (File tmp : new File("c:/").listFiles(new FileFilter() {
public boolean accept(java.io.File pathname) {
return pathname.isDirectory() && pathname.canRead();
}
})) {
final File result = searchInDir(tmp);
if (result != null) {
return result;
}
}
return null;
}
private static File searchInDir(final File dir) {
if (dir.exists() == false || dir.isDirectory() == false) {
return null;
}
final List<File> dots = new ArrayList<File>();
final File[] files = dir.listFiles(new FileFilter() {
public boolean accept(java.io.File pathname) {
return pathname.isDirectory() && StringUtils.goLowerCase(pathname.getName()).startsWith("graphviz");
}
});
if (files == null) {
return null;
}
for (File f : files) {
final File result = new File(new File(f, "bin"), "dot.exe");
if (result.exists() && result.canRead()) {
dots.add(result.getAbsoluteFile());
}
final File result2 = new File(new File(f, "release/bin"), "dot.exe");
if (result2.exists() && result2.canRead()) {
dots.add(result2.getAbsoluteFile());
}
}
return higherVersion(dots);
}
static File higherVersion(List<File> dots) {
if (dots.size() == 0) {
return null;
}
Collections.sort(dots, Collections.reverseOrder());
return dots.get(0);
}
GraphvizWindowsOld(ISkinParam skinParam, String dotString, String... type) {
super(skinParam, dotString, type);
}
@Override
protected String getExeName() {
return "dot.exe";
}
}

View File

@ -51,8 +51,8 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Bodier; import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.BodierImpl;
import net.sourceforge.plantuml.cucadiagram.BodierMap; import net.sourceforge.plantuml.cucadiagram.BodierMap;
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
@ -224,7 +224,7 @@ public final class EntityFactory {
if (entityType == null) { if (entityType == null) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
final Bodier bodier = entityType == LeafType.MAP ? new BodierMap() : new BodierImpl(entityType, hides); final Bodier bodier = entityType == LeafType.MAP ? new BodierMap() : BodyFactory.createLeaf(entityType, hides);
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, entityType, final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, entityType,
namespaceSeparator, rawLayout); namespaceSeparator, rawLayout);
bodier.setLeaf(result); bodier.setLeaf(result);
@ -242,7 +242,7 @@ public final class EntityFactory {
return ent.getValue(); return ent.getValue();
} }
} }
final Bodier bodier = new BodierImpl(null, hides); final Bodier bodier = BodyFactory.createGroup(hides);
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, groupType, namespace, final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, groupType, namespace,
namespaceSeparator, rawLayout); namespaceSeparator, rawLayout);
if (Display.isNull(display) == false) { if (Display.isNull(display) == false) {

View File

@ -45,7 +45,7 @@ import net.sourceforge.plantuml.LineParam;
import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
@ -56,7 +56,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.svek.AbstractEntityImage; import net.sourceforge.plantuml.svek.AbstractEntityImage;
import net.sourceforge.plantuml.svek.ShapeType; import net.sourceforge.plantuml.svek.ShapeType;
import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine; import net.sourceforge.plantuml.ugraphic.AbstractUGraphicHorizontalLine;
@ -78,8 +77,8 @@ public class EntityImageRequirement extends AbstractEntityImage {
super(entity, skinParam); super(entity, skinParam);
final Stereotype stereotype = entity.getStereotype(); final Stereotype stereotype = entity.getStereotype();
final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.REQUIREMENT, skinParam, final TextBlock tmp = BodyFactory.create2(entity.getDisplay(), FontParam.REQUIREMENT, skinParam,
HorizontalAlignment.CENTER, stereotype, true, false, entity, null); HorizontalAlignment.CENTER, stereotype, entity, null);
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) { if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null) {
this.desc = tmp; this.desc = tmp;

View File

@ -82,7 +82,7 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
return "(?i)^(.*)[%g]$"; return "(?i)^(.*)[%g]$";
} }
if (type == 1) { if (type == 1) {
return "(?i)^(.*)\\]$"; return "(?i)^([^\\[\\]]*)\\]$";
} }
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }

View File

@ -218,7 +218,7 @@ public abstract class PSystemError extends AbstractPSystem {
if (fileFormat.getFileFormat() == FileFormat.ATXT || fileFormat.getFileFormat() == FileFormat.UTXT) { if (fileFormat.getFileFormat() == FileFormat.ATXT || fileFormat.getFileFormat() == FileFormat.UTXT) {
final UGraphicTxt ugt = new UGraphicTxt(); final UGraphicTxt ugt = new UGraphicTxt();
final UmlCharArea area = ugt.getCharArea(); final UmlCharArea area = ugt.getCharArea();
area.drawStringsLR(getPureAsciiFormatted(), 0, 0); area.drawStringsLRSimple(getPureAsciiFormatted(), 0, 0);
area.print(SecurityUtils.createPrintStream(os)); area.print(SecurityUtils.createPrintStream(os));
return new ImageDataSimple(1, 1); return new ImageDataSimple(1, 1);

View File

@ -40,7 +40,7 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
public class TextBlockEmpty extends AbstractTextBlock implements TextBlockWidth, TextBlock { public class TextBlockEmpty extends AbstractTextBlock {
private final double width; private final double width;
private final double height; private final double height;
@ -61,16 +61,4 @@ public class TextBlockEmpty extends AbstractTextBlock implements TextBlockWidth,
public void drawU(UGraphic ug) { public void drawU(UGraphic ug) {
} }
public TextBlock asTextBlock(final double widthToUse) {
return new AbstractTextBlock() {
public void drawU(UGraphic ug) {
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return TextBlockEmpty.this.calculateDimension(stringBounder);
}
};
}
} }

View File

@ -107,6 +107,9 @@ public class TextBlockUtils {
} }
public static TextBlock withMargin(TextBlock textBlock, double marginX, double marginY) { public static TextBlock withMargin(TextBlock textBlock, double marginX, double marginY) {
if (marginX == 0 && marginY == 0) {
return textBlock;
}
return new TextBlockMarged(textBlock, marginY, marginX, marginY, marginX); return new TextBlockMarged(textBlock, marginY, marginX, marginY, marginX);
} }

View File

@ -1,45 +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.graphic;
import java.awt.geom.Dimension2D;
public interface TextBlockWidth {
Dimension2D calculateDimension(StringBounder stringBounder);
TextBlock asTextBlock(double widthToUse);
}

View File

@ -1,64 +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.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ugraphic.UGraphic;
public class TextBlockWidthAdapter implements TextBlockWidth {
private final TextBlock textBlock;
private final double width;
public TextBlockWidthAdapter(TextBlock textBlock, double widthToUse) {
this.textBlock = textBlock;
this.width = widthToUse;
}
public void drawU(UGraphic ug) {
textBlock.drawU(ug);
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
return textBlock.calculateDimension(stringBounder);
}
public TextBlock asTextBlock(double widthToUse) {
return textBlock;
}
}

View File

@ -161,10 +161,6 @@ public abstract class USymbol {
} }
} }
public boolean manageHorizontalLine() {
return false;
}
public int suppHeightBecauseOfShape() { public int suppHeightBecauseOfShape() {
return 0; return 0;
} }

View File

@ -88,11 +88,6 @@ class USymbolArtifact extends USymbol {
private Margin getMargin() { private Margin getMargin() {
return new Margin(10, 10 + 10, 10 + 3, 10); return new Margin(10, 10 + 10, 10 + 3, 10);
} }
public boolean manageHorizontalLine() {
return true;
}
@Override @Override
public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype, public TextBlock asSmall(TextBlock name, final TextBlock label, final TextBlock stereotype,
final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) { final SymbolContext symbolContext, final HorizontalAlignment stereoAlignment) {

View File

@ -121,9 +121,4 @@ class USymbolCard extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -264,9 +264,4 @@ class USymbolCloud extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -139,9 +139,4 @@ class USymbolCollections extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -104,9 +104,4 @@ class USymbolComponent1 extends USymbol {
stereoAlignment); stereoAlignment);
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -127,9 +127,4 @@ class USymbolComponent2 extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -166,10 +166,6 @@ class USymbolDatabase extends USymbol {
}; };
} }
public boolean manageHorizontalLine() {
return true;
}
@Override @Override
public int suppHeightBecauseOfShape() { public int suppHeightBecauseOfShape() {
return 15; return 15;

View File

@ -159,9 +159,4 @@ class USymbolFile extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -196,9 +196,4 @@ public class USymbolFolder extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -179,9 +179,4 @@ class USymbolFrame extends USymbol {
// //
// } // }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -117,9 +117,4 @@ class USymbolLabel extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -183,10 +183,6 @@ class USymbolNode extends USymbol {
}; };
} }
public boolean manageHorizontalLine() {
return true;
}
@Override @Override
public int suppHeightBecauseOfShape() { public int suppHeightBecauseOfShape() {
return 5; return 5;

View File

@ -175,8 +175,4 @@ class USymbolQueue extends USymbol {
}; };
} }
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -134,9 +134,4 @@ class USymbolRect extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -138,9 +138,4 @@ class USymbolStack extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -110,9 +110,4 @@ class USymbolStorage extends USymbol {
}; };
} }
@Override
public boolean manageHorizontalLine() {
return true;
}
} }

View File

@ -49,7 +49,6 @@ import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Member;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.security.SFile; import net.sourceforge.plantuml.security.SFile;
@ -140,9 +139,9 @@ public final class CucaDiagramHtmlMaker {
} else { } else {
pw.println("<h2>Fields:</h2>"); pw.println("<h2>Fields:</h2>");
pw.println("<ul>"); pw.println("<ul>");
for (Member m : entity.getBodier().getFieldsToDisplay()) { for (CharSequence m : entity.getBodier().getFieldsToDisplay()) {
pw.println("<li>"); pw.println("<li>");
pw.println(StringUtils.unicodeForHtml(m.getDisplay(true))); pw.println(StringUtils.unicodeForHtml(m.toString()));
pw.println("</li>"); pw.println("</li>");
} }
pw.println("</ul>"); pw.println("</ul>");
@ -154,9 +153,9 @@ public final class CucaDiagramHtmlMaker {
} else { } else {
pw.println("<h2>Methods:</h2>"); pw.println("<h2>Methods:</h2>");
pw.println("<ul>"); pw.println("<ul>");
for (Member m : entity.getBodier().getMethodsToDisplay()) { for (CharSequence m : entity.getBodier().getMethodsToDisplay()) {
pw.println("<li>"); pw.println("<li>");
pw.println(StringUtils.unicodeForHtml(m.getDisplay(true))); pw.println(StringUtils.unicodeForHtml(m.toString()));
pw.println("</li>"); pw.println("</li>");
} }
pw.println("</ul>"); pw.println("</ul>");

View File

@ -92,7 +92,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockEmpty; import net.sourceforge.plantuml.graphic.TextBlockEmpty;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockWidth;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft; import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
@ -259,14 +258,9 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker {
final TextBlock stereoAndTitle = TextBlockUtils.mergeTB(stereo, title, HorizontalAlignment.CENTER); final TextBlock stereoAndTitle = TextBlockUtils.mergeTB(stereo, title, HorizontalAlignment.CENTER);
final Dimension2D dimLabel = stereoAndTitle.calculateDimension(stringBounder); final Dimension2D dimLabel = stereoAndTitle.calculateDimension(stringBounder);
if (dimLabel.getWidth() > 0) { if (dimLabel.getWidth() > 0) {
final List<Member> members = ((IEntity) g).getBodier().getFieldsToDisplay();
final TextBlockWidth attribute; final TextBlock attribute = GeneralImageBuilder.stateHeader(g, null, diagram.getSkinParam());
if (members.size() == 0) {
attribute = new TextBlockEmpty();
} else {
attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, diagram.getSkinParam(),
g.getStereotype(), null, getStyle(FontParam.STATE_ATTRIBUTE));
}
final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder); final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder);
final double attributeHeight = dimAttribute.getHeight(); final double attributeHeight = dimAttribute.getHeight();
final double attributeWidth = dimAttribute.getWidth(); final double attributeWidth = dimAttribute.getWidth();

View File

@ -75,7 +75,7 @@ public class JsonDiagram extends UmlDiagram {
private final List<String> highlighted; private final List<String> highlighted;
public JsonDiagram(JsonValue json, List<String> highlighted) { public JsonDiagram(JsonValue json, List<String> highlighted) {
if (json.isString() || json.isBoolean() || json.isNumber()) { if (json != null && (json.isString() || json.isBoolean() || json.isNumber())) {
this.root = new JsonArray(); this.root = new JsonArray();
((JsonArray) this.root).add(json); ((JsonArray) this.root).add(json);
} else { } else {
@ -110,8 +110,9 @@ public class JsonDiagram extends UmlDiagram {
margin2 = 10; margin2 = 10;
} }
final ClockwiseTopRightBottomLeft margins = ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2); final ClockwiseTopRightBottomLeft margins = ClockwiseTopRightBottomLeft.margin1margin2(margin1, margin2);
final ImageParameter imageParameter = new ImageParameter(new ColorMapperIdentity(), false, null, dpiFactor, "", final String metadata = fileFormatOption.isWithMetadata() ? getMetadata() : null;
"", margins, null); final ImageParameter imageParameter = new ImageParameter(new ColorMapperIdentity(), false, null, dpiFactor,
metadata, "", margins, null);
final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter); final ImageBuilder imageBuilder = ImageBuilder.build(imageParameter);
TextBlock result = getTextBlock(); TextBlock result = getTextBlock();
result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam())) result = new AnnotatedWorker(this, skinParam, fileFormatOption.getDefaultStringBounder(getSkinParam()))

View File

@ -148,9 +148,20 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
if (value.isString()) { if (value.isString()) {
return value.asString(); return value.asString();
} }
if (value.isNumber() || value.isBoolean()) { if (value.isNull()) {
return "<U+2400>";
// return "<U+2205> null";
}
if (value.isNumber()) {
return value.toString(); return value.toString();
} }
if (value.isBoolean()) {
if (value.isTrue()) {
return "<U+2611> true";
} else {
return "<U+2610> false";
}
}
return " "; return " ";
} }

View File

@ -48,8 +48,8 @@ public class MessageNumber implements CharSequence {
this.representation = s; this.representation = s;
} }
public String getNumber() { public String getNumberRaw() {
return representation; return representation.replaceAll("\\</?b\\>", "");
} }
public char charAt(int arg0) { public char charAt(int arg0) {

View File

@ -119,7 +119,7 @@ public class SequenceDiagramTxtMaker implements FileMaker {
if (title.isWhite() == false) { if (title.isWhite() == false) {
final int widthTitle = StringUtils.getWcWidth(title); final int widthTitle = StringUtils.getWcWidth(title);
final UmlCharArea charArea = ug.getCharArea(); final UmlCharArea charArea = ug.getCharArea();
charArea.drawStringsLR(title.as(), (int) ((fullDimension.getWidth() - widthTitle) / 2), 0); charArea.drawStringsLRSimple(title.as(), (int) ((fullDimension.getWidth() - widthTitle) / 2), 0);
} }
} }

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.ISkinSimple;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.creole.CreoleMode; import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
@ -111,8 +111,8 @@ public abstract class AbstractTextualComponent extends AbstractComponent {
if (this.display.size() == 1 && this.display.get(0).length() == 0) { if (this.display.size() == 1 && this.display.get(0).length() == 0) {
textBlock = new TextBlockEmpty(); textBlock = new TextBlockEmpty();
} else if (enhanced) { } else if (enhanced) {
textBlock = new BodyEnhanced2(this.display, FontParam.NOTE, spriteContainer, horizontalAlignment, fc, textBlock = BodyFactory.create3(this.display, FontParam.NOTE, spriteContainer, horizontalAlignment, fc,
maxMessageSize, spriteContainer.minClassWidth()); maxMessageSize);
} else { } else {
textBlock = this.display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL, textBlock = this.display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL,
fontForStereotype, htmlColorForStereotype); fontForStereotype, htmlColorForStereotype);

View File

@ -40,6 +40,7 @@ import java.awt.geom.Rectangle2D;
import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.StringUtils;
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;
@ -54,26 +55,31 @@ import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorNone; import net.sourceforge.plantuml.ugraphic.color.HColorNone;
public enum VisibilityModifier { public enum VisibilityModifier {
PRIVATE_FIELD(ColorParam.iconPrivate, null), PROTECTED_FIELD(ColorParam.iconProtected, null), PRIVATE_FIELD(StringUtils.PRIVATE_FIELD, ColorParam.iconPrivate, null),
PACKAGE_PRIVATE_FIELD(ColorParam.iconPackage, null), PUBLIC_FIELD(ColorParam.iconPublic, null), PROTECTED_FIELD(StringUtils.PROTECTED_FIELD, ColorParam.iconProtected, null),
PACKAGE_PRIVATE_FIELD(StringUtils.PACKAGE_PRIVATE_FIELD, ColorParam.iconPackage, null),
PUBLIC_FIELD(StringUtils.PUBLIC_FIELD, ColorParam.iconPublic, null),
PRIVATE_METHOD(ColorParam.iconPrivate, ColorParam.iconPrivateBackground), PRIVATE_METHOD(StringUtils.PRIVATE_METHOD, ColorParam.iconPrivate, ColorParam.iconPrivateBackground),
PROTECTED_METHOD(ColorParam.iconProtected, ColorParam.iconProtectedBackground), PROTECTED_METHOD(StringUtils.PROTECTED_METHOD, ColorParam.iconProtected, ColorParam.iconProtectedBackground),
PACKAGE_PRIVATE_METHOD(ColorParam.iconPackage, ColorParam.iconPackageBackground), PACKAGE_PRIVATE_METHOD(StringUtils.PACKAGE_PRIVATE_METHOD, ColorParam.iconPackage,
PUBLIC_METHOD(ColorParam.iconPublic, ColorParam.iconPublicBackground), ColorParam.iconPackageBackground),
PUBLIC_METHOD(StringUtils.PUBLIC_METHOD, ColorParam.iconPublic, ColorParam.iconPublicBackground),
IE_MANDATORY(ColorParam.iconIEMandatory, ColorParam.iconIEMandatory); IE_MANDATORY(StringUtils.IE_MANDATORY, ColorParam.iconIEMandatory, ColorParam.iconIEMandatory);
private final ColorParam foregroundParam; private final ColorParam foregroundParam;
private final ColorParam backgroundParam; private final ColorParam backgroundParam;
private final char unicode;
public static String regexForVisibilityCharacterInClassName() { public static String regexForVisibilityCharacterInClassName() {
return "[-#+~]"; return "[-#+~]";
} }
private VisibilityModifier(ColorParam foreground, ColorParam background) { private VisibilityModifier(char unicode, ColorParam foreground, ColorParam background) {
this.foregroundParam = foreground; this.foregroundParam = foreground;
this.backgroundParam = background; this.backgroundParam = background;
this.unicode = unicode;
} }
public UDrawable getUDrawable(final int size, final HColor foregroundColor, final HColor backgoundColor) { public UDrawable getUDrawable(final int size, final HColor foregroundColor, final HColor backgoundColor) {
@ -218,6 +224,23 @@ public enum VisibilityModifier {
return false; return false;
} }
public static VisibilityModifier getByUnicode(char c) {
for (VisibilityModifier modifier : VisibilityModifier.values()) {
if (modifier.unicode == c) {
return modifier;
}
}
return null;
}
public static String replaceVisibilityModifierByUnicodeChar(String s, boolean isField) {
final VisibilityModifier modifier = getVisibilityModifier(s, isField);
if (modifier == null) {
return s;
}
return "" + modifier.unicode + s.substring(1);
}
public static VisibilityModifier getVisibilityModifier(CharSequence s, boolean isField) { public static VisibilityModifier getVisibilityModifier(CharSequence s, boolean isField) {
if (s.length() <= 2) { if (s.length() <= 2) {
return null; return null;

View File

@ -62,15 +62,11 @@ import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.EntityUtils; import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.Member;
import net.sourceforge.plantuml.cucadiagram.MethodsOrFieldsArea;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizVersion;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
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.graphic.TextBlockEmpty;
import net.sourceforge.plantuml.graphic.TextBlockWidth;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.graphic.color.Colors;
@ -481,7 +477,8 @@ public class Cluster implements Moveable {
stateBack = getColor(skinParam2, ColorParam.stateBackground, group.getStereotype()); stateBack = getColor(skinParam2, ColorParam.stateBackground, group.getStereotype());
} }
final HColor background = getColor(skinParam2, ColorParam.background, null); final HColor background = getColor(skinParam2, ColorParam.background, null);
final TextBlockWidth attribute = getTextBlockAttribute(skinParam2); final Style style = getStyle(FontParam.STATE_ATTRIBUTE, skinParam2);
final TextBlock attribute = GeneralImageBuilder.stateHeader(group, style, skinParam2);
final double attributeHeight = attribute.calculateDimension(ug.getStringBounder()).getHeight(); final double attributeHeight = attribute.calculateDimension(ug.getStringBounder()).getHeight();
if (total.getWidth() == 0) { if (total.getWidth() == 0) {
System.err.println("Cluster::drawUState issue"); System.err.println("Cluster::drawUState issue");
@ -497,7 +494,7 @@ public class Cluster implements Moveable {
} }
if (attributeHeight > 0) { if (attributeHeight > 0) {
attribute.asTextBlock(total.getWidth()).drawU( attribute.drawU(
ug.apply(new UTranslate(minX + IEntityImage.MARGIN, minY + suppY + IEntityImage.MARGIN / 2.0))); ug.apply(new UTranslate(minX + IEntityImage.MARGIN, minY + suppY + IEntityImage.MARGIN / 2.0)));
} }
@ -509,18 +506,6 @@ public class Cluster implements Moveable {
} }
private TextBlockWidth getTextBlockAttribute(ISkinParam skinParam) {
final TextBlockWidth attribute;
final List<Member> members = group.getBodier().getFieldsToDisplay();
if (members.size() == 0) {
attribute = new TextBlockEmpty();
} else {
attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, skinParam, group.getStereotype(),
null, getStyle(FontParam.STATE_ATTRIBUTE, skinParam));
}
return attribute;
}
public void setPosition(double minX, double minY, double maxX, double maxY) { public void setPosition(double minX, double minY, double maxX, double maxY) {
this.minX = minX; this.minX = minX;
this.maxX = maxX; this.maxX = maxX;

View File

@ -100,7 +100,6 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockEmpty; import net.sourceforge.plantuml.graphic.TextBlockEmpty;
import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockUtils;
import net.sourceforge.plantuml.graphic.TextBlockWidth;
import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.USymbolInterface; import net.sourceforge.plantuml.graphic.USymbolInterface;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
@ -172,7 +171,7 @@ public final class GeneralImageBuilder {
final Cluster stateParent = bibliotekon.getCluster(leaf.getParentContainer()); final Cluster stateParent = bibliotekon.getCluster(leaf.getParentContainer());
return new EntityImageStateBorder(leaf, skinParam, stateParent, bibliotekon); return new EntityImageStateBorder(leaf, skinParam, stateParent, bibliotekon);
} }
if (isHideEmptyDescriptionForState && leaf.getBodier().getFieldsToDisplay().size() == 0) { if (isHideEmptyDescriptionForState && leaf.getBodier().getRawBody().size() == 0) {
return new EntityImageStateEmptyDescription(leaf, skinParam); return new EntityImageStateEmptyDescription(leaf, skinParam);
} }
if (leaf.getStereotype() != null if (leaf.getStereotype() != null
@ -463,10 +462,11 @@ public final class GeneralImageBuilder {
try { try {
svg = dotStringFactory.getSvg(basefile, dotStrings); svg = dotStringFactory.getSvg(basefile, dotStrings);
} catch (IOException e) { } catch (IOException e) {
return new GraphvizCrash(source.getPlainString(), GraphvizUtils.graphviz244onWindows()); return new GraphvizCrash(source.getPlainString(), GraphvizUtils.graphviz244onWindows(), e);
} }
if (svg.length() == 0) { if (svg.length() == 0) {
return new GraphvizCrash(source.getPlainString(), GraphvizUtils.graphviz244onWindows()); return new GraphvizCrash(source.getPlainString(), GraphvizUtils.graphviz244onWindows(),
new EmptySvgException());
} }
final String graphvizVersion = extractGraphvizVersion(svg); final String graphvizVersion = extractGraphvizVersion(svg);
try { try {
@ -629,15 +629,8 @@ public final class GeneralImageBuilder {
final TextBlock stereoAndTitle = TextBlockUtils.mergeTB(stereo, title, HorizontalAlignment.CENTER); final TextBlock stereoAndTitle = TextBlockUtils.mergeTB(stereo, title, HorizontalAlignment.CENTER);
final Dimension2D dimLabel = stereoAndTitle.calculateDimension(stringBounder); final Dimension2D dimLabel = stereoAndTitle.calculateDimension(stringBounder);
if (dimLabel.getWidth() > 0) { if (dimLabel.getWidth() > 0) {
final List<Member> members = ((IEntity) g).getBodier().getFieldsToDisplay(); final Dimension2D dimAttribute = stateHeader((IEntity) g, getStyle(FontParam.STATE_ATTRIBUTE),
final TextBlockWidth attribute; dotData.getSkinParam()).calculateDimension(stringBounder);
if (members.size() == 0) {
attribute = new TextBlockEmpty();
} else {
attribute = new MethodsOrFieldsArea(members, FontParam.STATE_ATTRIBUTE, dotData.getSkinParam(),
g.getStereotype(), null, getStyle(FontParam.STATE_ATTRIBUTE));
}
final Dimension2D dimAttribute = attribute.calculateDimension(stringBounder);
final double attributeHeight = dimAttribute.getHeight(); final double attributeHeight = dimAttribute.getHeight();
final double attributeWidth = dimAttribute.getWidth(); final double attributeWidth = dimAttribute.getWidth();
final double marginForFields = attributeHeight > 0 ? IEntityImage.MARGIN : 0; final double marginForFields = attributeHeight > 0 ? IEntityImage.MARGIN : 0;
@ -658,6 +651,31 @@ public final class GeneralImageBuilder {
dotStringFactory.closeCluster(); dotStringFactory.closeCluster();
} }
public static TextBlock stateHeader(IEntity group, Style style, ISkinParam skinParam) {
final List<CharSequence> details = group.getBodier().getRawBody();
if (details.size() == 0) {
return new TextBlockEmpty();
}
final FontConfiguration fontConfiguration;
if (style == null) {
fontConfiguration = new FontConfiguration(skinParam, FontParam.STATE_ATTRIBUTE, null);
} else {
fontConfiguration = new FontConfiguration(skinParam, style);
}
Display display = null;
for (CharSequence s : details) {
if (display == null) {
display = Display.getWithNewlines(s.toString());
} else {
display = display.addAll(Display.getWithNewlines(s.toString()));
}
}
return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam);
}
private Style getStyle(FontParam fontParam) { private Style getStyle(FontParam fontParam) {
return fontParam.getStyleDefinition(SName.stateDiagram) return fontParam.getStyleDefinition(SName.stateDiagram)
.getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder()); .getMergedStyle(dotData.getSkinParam().getCurrentStyleBuilder());

View File

@ -44,6 +44,7 @@ import java.util.List;
import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.OptionPrint; import net.sourceforge.plantuml.OptionPrint;
import net.sourceforge.plantuml.StringUtils; import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils; import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.flashcode.FlashCodeFactory; import net.sourceforge.plantuml.flashcode.FlashCodeFactory;
import net.sourceforge.plantuml.flashcode.FlashCodeUtils; import net.sourceforge.plantuml.flashcode.FlashCodeUtils;
@ -72,12 +73,12 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage {
private final String text; private final String text;
private final boolean graphviz244onWindows; private final boolean graphviz244onWindows;
public GraphvizCrash(String text, boolean graphviz244onWindows) { public GraphvizCrash(String text, boolean graphviz244onWindows, Throwable rootCause) {
this.text = text; this.text = text;
this.graphviz244onWindows = graphviz244onWindows; this.graphviz244onWindows = graphviz244onWindows;
final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils();
this.flashCode = utils.exportFlashcode(text, Color.BLACK, Color.WHITE); this.flashCode = utils.exportFlashcode(text, Color.BLACK, Color.WHITE);
this.text1 = GraphicStrings.createBlackOnWhite(init(), IconLoader.getRandom(), this.text1 = GraphicStrings.createBlackOnWhite(init(rootCause), IconLoader.getRandom(),
GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT); GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT);
} }
@ -132,9 +133,15 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage {
strings.add(" - a problem in GraphViz"); strings.add(" - a problem in GraphViz");
} }
private List<String> init() { private List<String> init(Throwable rootCause) {
final List<String> strings = anErrorHasOccured(null, text); final List<String> strings = anErrorHasOccured(null, text);
strings.add("For some reason, dot/GraphViz has crashed."); strings.add("For some reason, dot/GraphViz has crashed.");
strings.add("");
strings.add("RootCause " + rootCause);
if (rootCause != null) {
strings.addAll(CommandExecutionResult.getStackTrace(rootCause));
}
strings.add("");
strings.add("This has been generated with PlantUML (" + Version.versionString() + ")."); strings.add("This has been generated with PlantUML (" + Version.versionString() + ").");
checkOldVersionWarning(strings); checkOldVersionWarning(strings);
strings.add(" "); strings.add(" ");
@ -217,7 +224,7 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage {
final UImage dotd = new UImage(new PixelImage(PSystemVersion.getDotd(), AffineTransformType.TYPE_BILINEAR)); final UImage dotd = new UImage(new PixelImage(PSystemVersion.getDotd(), AffineTransformType.TYPE_BILINEAR));
result = TextBlockUtils.mergeTB(result, dotd, HorizontalAlignment.LEFT); result = TextBlockUtils.mergeTB(result, dotd, HorizontalAlignment.LEFT);
} }
return result; return result;
} }

View File

@ -60,9 +60,6 @@ import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
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.graphic.TextBlockEmpty;
import net.sourceforge.plantuml.graphic.TextBlockWidth;
import net.sourceforge.plantuml.graphic.TextBlockWidthAdapter;
import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
@ -158,7 +155,7 @@ public final class GroupPngMakerState {
final HColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null final HColor backColor = group.getColors(skinParam).getColor(ColorType.BACK) == null
? getColor(ColorParam.stateBackground, stereo) ? getColor(ColorParam.stateBackground, stereo)
: group.getColors(skinParam).getColor(ColorType.BACK); : group.getColors(skinParam).getColor(ColorType.BACK);
final TextBlockWidth attribute = getAttributes(skinParam); final TextBlock attribute = GeneralImageBuilder.stateHeader((IEntity) group, null, skinParam);
final Stereotype stereotype = group.getStereotype(); final Stereotype stereotype = group.getStereotype();
final boolean withSymbol = stereotype != null && stereotype.isWithOOSymbol(); final boolean withSymbol = stereotype != null && stereotype.isWithOOSymbol();
@ -175,27 +172,6 @@ public final class GroupPngMakerState {
} }
private TextBlockWidth getAttributes(final ISkinParam skinParam) {
final List<String> details = ((IEntity) group).getBodier().getRawBody();
if (details.size() == 0) {
return new TextBlockEmpty();
}
final FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.STATE_ATTRIBUTE, null);
Display display = null;
for (String s : details) {
if (display == null) {
display = Display.getWithNewlines(s);
} else {
display = display.addAll(Display.getWithNewlines(s));
}
}
final TextBlock result = display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam);
return new TextBlockWidthAdapter(result, 0);
}
private IEntityImage buildImageForConcurrentState(DotData dotData) { private IEntityImage buildImageForConcurrentState(DotData dotData) {
final List<IEntityImage> inners = new ArrayList<IEntityImage>(); final List<IEntityImage> inners = new ArrayList<IEntityImage>();
for (ILeaf inner : dotData.getLeafs()) { for (ILeaf inner : dotData.getLeafs()) {

View File

@ -42,7 +42,6 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.graphic.AbstractTextBlock; import net.sourceforge.plantuml.graphic.AbstractTextBlock;
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.graphic.TextBlockWidth;
import net.sourceforge.plantuml.svek.image.EntityImageState; import net.sourceforge.plantuml.svek.image.EntityImageState;
import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke; import net.sourceforge.plantuml.ugraphic.UStroke;
@ -53,7 +52,7 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
private final IEntityImage im; private final IEntityImage im;
private final TextBlock title; private final TextBlock title;
private final TextBlockWidth attribute; private final TextBlock attribute;
private final HColor borderColor; private final HColor borderColor;
private final HColor backColor; private final HColor backColor;
private final boolean shadowing; private final boolean shadowing;
@ -61,8 +60,8 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
private final boolean withSymbol; private final boolean withSymbol;
private final UStroke stroke; private final UStroke stroke;
public InnerStateAutonom(final IEntityImage im, final TextBlock title, TextBlockWidth attribute, public InnerStateAutonom(final IEntityImage im, final TextBlock title, TextBlock attribute, HColor borderColor,
HColor borderColor, HColor backColor, boolean shadowing, Url url, boolean withSymbol, UStroke stroke) { HColor backColor, boolean shadowing, Url url, boolean withSymbol, UStroke stroke) {
this.im = im; this.im = im;
this.withSymbol = withSymbol; this.withSymbol = withSymbol;
this.title = title; this.title = title;
@ -90,9 +89,8 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
r.drawU(ug, shadowing); r.drawU(ug, shadowing);
title.drawU(ug.apply(new UTranslate((total.getWidth() - text.getWidth()) / 2, IEntityImage.MARGIN))); title.drawU(ug.apply(new UTranslate((total.getWidth() - text.getWidth()) / 2, IEntityImage.MARGIN)));
attribute.asTextBlock(total.getWidth()).drawU( attribute.drawU(ug.apply(
ug.apply(new UTranslate(0 + IEntityImage.MARGIN, IEntityImage.MARGIN + text.getHeight() new UTranslate(0 + IEntityImage.MARGIN, IEntityImage.MARGIN + text.getHeight() + IEntityImage.MARGIN)));
+ IEntityImage.MARGIN)));
final double spaceYforURL = getSpaceYforURL(ug.getStringBounder()); final double spaceYforURL = getSpaceYforURL(ug.getStringBounder());
im.drawU(ug.apply(new UTranslate(IEntityImage.MARGIN, spaceYforURL))); im.drawU(ug.apply(new UTranslate(IEntityImage.MARGIN, spaceYforURL)));
@ -128,8 +126,8 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
final Dimension2D dim = Dimension2DDouble.mergeTB(text, attr, img); final Dimension2D dim = Dimension2DDouble.mergeTB(text, attr, img);
final double marginForFields = attr.getHeight() > 0 ? IEntityImage.MARGIN : 0; final double marginForFields = attr.getHeight() > 0 ? IEntityImage.MARGIN : 0;
final Dimension2D result = Dimension2DDouble.delta(dim, IEntityImage.MARGIN * 2 + 2 * IEntityImage.MARGIN_LINE final Dimension2D result = Dimension2DDouble.delta(dim,
+ marginForFields); IEntityImage.MARGIN * 2 + 2 * IEntityImage.MARGIN_LINE + marginForFields);
return result; return result;
} }
@ -150,5 +148,4 @@ public final class InnerStateAutonom extends AbstractTextBlock implements IEntit
return 0; return 0;
} }
} }

View File

@ -47,8 +47,7 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
@ -175,9 +174,9 @@ public class EntityImageDescription extends AbstractEntityImage {
desc = TextBlockUtils.empty(getSkinParam().minClassWidth(), 0); desc = TextBlockUtils.empty(getSkinParam().minClassWidth(), 0);
} else { } else {
desc = new BodyEnhanced2(entity.getDisplay(), symbol.getFontParam(), getSkinParam(), desc = BodyFactory.create3(entity.getDisplay(), symbol.getFontParam(), getSkinParam(),
getSkinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), fcTitle, getSkinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), fcTitle,
getSkinParam().wrapWidth(), getSkinParam().minClassWidth()); getSkinParam().wrapWidth());
} }
stereo = TextBlockUtils.empty(0, 0); stereo = TextBlockUtils.empty(0, 0);
@ -191,8 +190,8 @@ public class EntityImageDescription extends AbstractEntityImage {
HorizontalAlignment.CENTER, getSkinParam()); HorizontalAlignment.CENTER, getSkinParam());
} }
name = new BodyEnhanced(codeDisplay, symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER, name = BodyFactory.create2(codeDisplay, symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER,
stereotype, symbol.manageHorizontalLine(), false, entity, style); stereotype, entity, style);
if (hideText) { if (hideText) {
asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.Guillemet;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.ILeaf;
@ -85,8 +85,8 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
this.desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam, HorizontalAlignment.CENTER, this.desc = BodyFactory.create2(entity.getDisplay(), symbol.getFontParam(), skinParam,
stereotype, symbol.manageHorizontalLine(), false, entity, getStyle(symbol.getFontParam())); HorizontalAlignment.CENTER, stereotype, entity, getStyle(symbol.getFontParam()));
this.url = entity.getUrl99(); this.url = entity.getUrl99();

View File

@ -51,7 +51,7 @@ import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.ILeaf;
@ -125,9 +125,9 @@ public class EntityImageNote extends AbstractEntityImage implements Stencil {
if (strings.size() == 1 && strings.get(0).length() == 0) { if (strings.size() == 1 && strings.get(0).length() == 0) {
textBlock = new TextBlockEmpty(); textBlock = new TextBlockEmpty();
} else { } else {
textBlock = new BodyEnhanced2(strings, FontParam.NOTE, getSkinParam(), HorizontalAlignment.LEFT, final FontConfiguration fc = new FontConfiguration(getSkinParam(), FontParam.NOTE, null);
new FontConfiguration(getSkinParam(), FontParam.NOTE, null), getSkinParam().wrapWidth(), textBlock = BodyFactory.create3(strings, FontParam.NOTE, getSkinParam(), HorizontalAlignment.LEFT, fc,
getSkinParam().minClassWidth()); getSkinParam().wrapWidth());
} }
} }

View File

@ -92,10 +92,11 @@ public class EntityImageState extends AbstractEntityImage {
this.desc = entity.getDisplay().create8(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype), this.desc = entity.getDisplay().create8(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype),
HorizontalAlignment.CENTER, skinParam, CreoleMode.FULL, skinParam.wrapWidth()); HorizontalAlignment.CENTER, skinParam, CreoleMode.FULL, skinParam.wrapWidth());
Display list = Display.empty(); // Display list = Display.empty();
for (Member att : entity.getBodier().getFieldsToDisplay()) { // for (Member att : entity.getBodier().getFieldsToDisplay()) {
list = list.addAll(Display.getWithNewlines(att.getDisplay(true))); // list = list.addAll(Display.getWithNewlines(att.getDisplay(true)));
} // }
final Display list = Display.create(entity.getBodier().getRawBody());
this.url = entity.getUrl99(); this.url = entity.getUrl99();

View File

@ -42,10 +42,8 @@ import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineConfigurable; import net.sourceforge.plantuml.LineConfigurable;
import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Member;
import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.StringBounder;
@ -75,10 +73,11 @@ public class EntityImageState2 extends AbstractEntityImage {
this.lineConfig = entity; this.lineConfig = entity;
final Stereotype stereotype = entity.getStereotype(); final Stereotype stereotype = entity.getStereotype();
Display list = Display.empty(); // Display list = Display.empty();
for (Member att : entity.getBodier().getFieldsToDisplay()) { // for (Member att : entity.getBodier().getFieldsToDisplay()) {
list = list.addAll(Display.getWithNewlines(att.getDisplay(true))); // list = list.addAll(Display.getWithNewlines(att.getDisplay(true)));
} // }
// final Display list = Display.create(entity.getBodier().getRawBody());
final USymbol symbol = USymbol.FRAME; final USymbol symbol = USymbol.FRAME;
@ -95,9 +94,8 @@ public class EntityImageState2 extends AbstractEntityImage {
this.url = entity.getUrl99(); this.url = entity.getUrl99();
TextBlock stereo = TextBlockUtils.empty(0, 0); TextBlock stereo = TextBlockUtils.empty(0, 0);
final TextBlock desc = new BodyEnhanced(entity.getDisplay(), symbol.getFontParam(), skinParam, final TextBlock desc = BodyFactory.create2(entity.getDisplay(), symbol.getFontParam(), skinParam,
HorizontalAlignment.CENTER, stereotype, symbol.manageHorizontalLine(), false, entity, HorizontalAlignment.CENTER, stereotype, entity, getStyle(symbol.getFontParam()));
getStyle(symbol.getFontParam()));
asSmall = symbol.asSmall(null, desc, stereo, ctx, skinParam.getStereotypeAlignment()); asSmall = symbol.asSmall(null, desc, stereo, ctx, skinParam.getStereotypeAlignment());

View File

@ -77,10 +77,11 @@ public class EntityImageStateEmptyDescription extends AbstractEntityImage {
this.desc = entity.getDisplay().create8(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype), this.desc = entity.getDisplay().create8(new FontConfiguration(getSkinParam(), FontParam.STATE, stereotype),
HorizontalAlignment.CENTER, skinParam, CreoleMode.FULL, skinParam.wrapWidth()); HorizontalAlignment.CENTER, skinParam, CreoleMode.FULL, skinParam.wrapWidth());
Display list = Display.empty(); // Display list = Display.empty();
for (Member att : entity.getBodier().getFieldsToDisplay()) { // for (Member att : entity.getBodier().getFieldsToDisplay()) {
list = list.addAll(Display.getWithNewlines(att.getDisplay(true))); // list = list.addAll(Display.getWithNewlines(att.getDisplay(true)));
} // }
// final Display list = Display.create(entity.getBodier().getRawBody());
this.url = entity.getUrl99(); this.url = entity.getUrl99();

View File

@ -47,7 +47,7 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineBreakStrategy; import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.command.Position; import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced2; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.ILeaf;
@ -163,11 +163,9 @@ public class EntityImageTips extends AbstractEntityImage {
} }
private Opale getOpale(final Display display) { private Opale getOpale(final Display display) {
// final HtmlColor fontColor = rose.getFontColor(skinParam, FontParam.NOTE); final FontConfiguration fc = new FontConfiguration(skinParam, FontParam.NOTE, null);
// final UFont fontNote = skinParam.getFont(FontParam.NOTE, null, false); final TextBlock textBlock = BodyFactory.create3(display, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT,
final TextBlock textBlock = new BodyEnhanced2(display, FontParam.NOTE, skinParam, HorizontalAlignment.LEFT, fc, LineBreakStrategy.NONE);
new FontConfiguration(skinParam, FontParam.NOTE, null), LineBreakStrategy.NONE,
skinParam.minClassWidth());
final double shadowing = skinParam.shadowing(getEntity().getStereotype()) ? 4 : 0; final double shadowing = skinParam.shadowing(getEntity().getStereotype()) ? 4 : 0;
final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, textBlock, true); final Opale opale = new Opale(shadowing, borderColor, noteBackgroundColor, textBlock, true);
return opale; return opale;

View File

@ -47,7 +47,7 @@ import net.sourceforge.plantuml.SkinParamUtils;
import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UseStyle; import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.creole.Stencil; import net.sourceforge.plantuml.creole.Stencil;
import net.sourceforge.plantuml.cucadiagram.BodyEnhanced; import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPortion; import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.ILeaf;
@ -87,8 +87,8 @@ public class EntityImageUseCase extends AbstractEntityImage {
super(entity, skinParam); super(entity, skinParam);
final Stereotype stereotype = entity.getStereotype(); final Stereotype stereotype = entity.getStereotype();
final TextBlock tmp = new BodyEnhanced(entity.getDisplay(), FontParam.USECASE, skinParam, final TextBlock tmp = BodyFactory.create2(entity.getDisplay(), FontParam.USECASE, skinParam,
HorizontalAlignment.CENTER, stereotype, true, false, entity, getStyle()); HorizontalAlignment.CENTER, stereotype, entity, getStyle());
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) { || portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {

View File

@ -44,7 +44,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000; private static final int MAJOR_SEPARATOR = 1000000;
public static int version() { public static int version() {
return 1202022; return 1202023;
} }
public static int versionPatched() { public static int versionPatched() {
@ -93,7 +93,7 @@ public class Version {
} }
public static long compileTime() { public static long compileTime() {
return 1607247387732L; return 1607886898413L;
} }
public static String compileTimeString() { public static String compileTimeString() {

View File

@ -180,7 +180,8 @@ abstract class XmiClassDiagramAbstract implements IXmiClassDiagram {
final Element feature = document.createElement("UML:Classifier.feature"); final Element feature = document.createElement("UML:Classifier.feature");
cla.appendChild(feature); cla.appendChild(feature);
for (Member m : entity.getBodier().getFieldsToDisplay()) { for (CharSequence cs : entity.getBodier().getFieldsToDisplay()) {
final Member m = (Member) cs;
// <UML:Attribute xmi.id="UMLAttribute.6" name="Attribute1" // <UML:Attribute xmi.id="UMLAttribute.6" name="Attribute1"
// visibility="public" isSpecification="false" // visibility="public" isSpecification="false"
// ownerScope="instance" changeability="changeable" // ownerScope="instance" changeability="changeable"
@ -195,7 +196,8 @@ abstract class XmiClassDiagramAbstract implements IXmiClassDiagram {
feature.appendChild(attribute); feature.appendChild(attribute);
} }
for (Member m : entity.getBodier().getMethodsToDisplay()) { for (CharSequence cs : entity.getBodier().getMethodsToDisplay()) {
final Member m = (Member) cs;
// <UML:Operation xmi.id="UMLOperation.7" name="Operation1" // <UML:Operation xmi.id="UMLOperation.7" name="Operation1"
// visibility="public" isSpecification="false" // visibility="public" isSpecification="false"
// ownerScope="instance" isQuery="false" concurrency="sequential" // ownerScope="instance" isQuery="false" concurrency="sequential"

View File

@ -210,19 +210,19 @@ public class XmiDescriptionDiagram implements IXmiClassDiagram {
final Element feature = document.createElement("UML:Classifier.feature"); final Element feature = document.createElement("UML:Classifier.feature");
cla.appendChild(feature); cla.appendChild(feature);
for (Member m : entity.getBodier().getFieldsToDisplay()) { // for (Member m : entity.getBodier().getFieldsToDisplay()) {
final Element attribute = document.createElement("UML:Attribute"); // final Element attribute = document.createElement("UML:Attribute");
attribute.setAttribute("xmi.id", "att" + UniqueSequence.getValue()); // attribute.setAttribute("xmi.id", "att" + UniqueSequence.getValue());
attribute.setAttribute("name", m.getDisplay(false)); // attribute.setAttribute("name", m.getDisplay(false));
feature.appendChild(attribute); // feature.appendChild(attribute);
} // }
//
for (Member m : entity.getBodier().getMethodsToDisplay()) { // for (Member m : entity.getBodier().getMethodsToDisplay()) {
final Element operation = document.createElement("UML:Operation"); // final Element operation = document.createElement("UML:Operation");
operation.setAttribute("xmi.id", "att" + UniqueSequence.getValue()); // operation.setAttribute("xmi.id", "att" + UniqueSequence.getValue());
operation.setAttribute("name", m.getDisplay(false)); // operation.setAttribute("name", m.getDisplay(false));
feature.appendChild(operation); // feature.appendChild(operation);
} // }
return cla; return cla;
} }

View File

@ -215,28 +215,28 @@ public class XmiStateDiagram implements IXmiClassDiagram {
final Element feature = document.createElement("UML:Classifier.feature"); final Element feature = document.createElement("UML:Classifier.feature");
cla.appendChild(feature); cla.appendChild(feature);
for (Member m : entity.getBodier().getFieldsToDisplay()) { // for (Member m : entity.getBodier().getFieldsToDisplay()) {
// <UML:Attribute xmi.id="UMLAttribute.6" name="Attribute1" // // <UML:Attribute xmi.id="UMLAttribute.6" name="Attribute1"
// visibility="public" isSpecification="false" // // visibility="public" isSpecification="false"
// ownerScope="instance" changeability="changeable" // // ownerScope="instance" changeability="changeable"
// targetScope="instance" type="" owner="UMLClass.5"/> // // targetScope="instance" type="" owner="UMLClass.5"/>
final Element attribute = document.createElement("UML:Attribute"); // final Element attribute = document.createElement("UML:Attribute");
attribute.setAttribute("xmi.id", "att" + UniqueSequence.getValue()); // attribute.setAttribute("xmi.id", "att" + UniqueSequence.getValue());
attribute.setAttribute("name", m.getDisplay(false)); // attribute.setAttribute("name", m.getDisplay(false));
feature.appendChild(attribute); // feature.appendChild(attribute);
} // }
//
for (Member m : entity.getBodier().getMethodsToDisplay()) { // for (Member m : entity.getBodier().getMethodsToDisplay()) {
// <UML:Operation xmi.id="UMLOperation.7" name="Operation1" // // <UML:Operation xmi.id="UMLOperation.7" name="Operation1"
// visibility="public" isSpecification="false" // // visibility="public" isSpecification="false"
// ownerScope="instance" isQuery="false" concurrency="sequential" // // ownerScope="instance" isQuery="false" concurrency="sequential"
// isRoot="false" isLeaf="false" // // isRoot="false" isLeaf="false"
// isAbstract="false" specification="" owner="UMLClass.5"/> // // isAbstract="false" specification="" owner="UMLClass.5"/>
final Element operation = document.createElement("UML:Operation"); // final Element operation = document.createElement("UML:Operation");
operation.setAttribute("xmi.id", "att" + UniqueSequence.getValue()); // operation.setAttribute("xmi.id", "att" + UniqueSequence.getValue());
operation.setAttribute("name", m.getDisplay(false)); // operation.setAttribute("name", m.getDisplay(false));
feature.appendChild(operation); // feature.appendChild(operation);
} // }
return cla; return cla;
} }