highlighted) {
- final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted);
+ final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted, getStyle(SName.node));
final ST_Agnode_s node1 = createNode(block.calculateDimension(stringBounder), block.size(), current.isArray(),
(int) block.getWidthColA(stringBounder), (int) block.getWidthColB(stringBounder));
nodes.add(new InternalNode(block, node1));
@@ -157,14 +162,15 @@ public class SmetanaForJson {
xMirror = new Mirror(max);
for (InternalNode node : nodes) {
- node.block.drawU(ug.apply(getPosition(node.node)));
+ node.block.drawU(getUgFor(SName.node).apply(getPosition(node.node)));
}
- final HColor color = getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
+ final HColor color = getStyle(SName.arrow).value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
for (ST_Agedge_s edge : edges) {
final JsonCurve curve = getCurve(edge, 13);
- curve.drawCurve(color, ug.apply(new UStroke(3, 3, 1)));
- curve.drawSpot(ug.apply(color.bg()));
+ // curve.drawCurve(color, getUgFor(SName.arrow).apply(new UStroke(3, 3, 1)));
+ curve.drawCurve(color, getUgFor(SName.arrow));
+ curve.drawSpot(getUgFor(SName.arrow).apply(color.bg()));
}
}
@@ -235,7 +241,8 @@ public class SmetanaForJson {
agsafeset(node, new CString("height"), new CString("" + width), new CString(""));
agsafeset(node, new CString("width"), new CString("" + height), new CString(""));
- final String dotLabel = getDotLabel(size, isArray, colAwidth - 8, colBwidth - 8);
+ final int lineHeight = 0;
+ final String dotLabel = getDotLabel(size, isArray, colAwidth - 8, colBwidth - 8, lineHeight);
if (size > 0) {
agsafeset(node, new CString("label"), new CString(dotLabel), new CString(""));
}
@@ -250,14 +257,15 @@ public class SmetanaForJson {
return node;
}
- private String getDotLabel(int size, boolean isArray, int widthA, int widthB) {
+ private String getDotLabel(int size, boolean isArray, int widthA, int widthB, int height) {
final StringBuilder sb = new StringBuilder("");
if (isArray == false) {
- sb.append("{_dim_0_" + widthA + "_|{");
+ // "+height+"
+ sb.append("{_dim_" + height + "_" + widthA + "_|{");
}
for (int i = 0; i < size; i++) {
sb.append("");
- sb.append("_dim_0_" + widthB + "_");
+ sb.append("_dim_" + height + "_" + widthB + "_");
if (i < size - 1)
sb.append("|");
}
diff --git a/src/net/sourceforge/plantuml/jsondiagram/StyleExtractor.java b/src/net/sourceforge/plantuml/jsondiagram/StyleExtractor.java
new file mode 100644
index 000000000..697e9f4b9
--- /dev/null
+++ b/src/net/sourceforge/plantuml/jsondiagram/StyleExtractor.java
@@ -0,0 +1,85 @@
+/* ========================================================================
+ * 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.jsondiagram;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.StringLocated;
+import net.sourceforge.plantuml.command.BlocLines;
+import net.sourceforge.plantuml.style.Style;
+import net.sourceforge.plantuml.style.StyleBuilder;
+import net.sourceforge.plantuml.style.StyleLoader;
+
+public class StyleExtractor {
+
+ private final List list = new ArrayList();
+ private final List style = new ArrayList();
+
+ public StyleExtractor(Iterator data) {
+ while (data.hasNext()) {
+ StringLocated line = data.next();
+ if (line.getString().trim().equals("")) {
+ break;
+ }
+ line = data.next();
+ }
+ } else {
+ list.add(line.getString());
+ }
+ }
+ }
+
+ public void applyStyles(ISkinParam skinParam) {
+ if (style.size() > 0) {
+ final StyleBuilder styleBuilder = skinParam.getCurrentStyleBuilder();
+ final BlocLines blocLines = BlocLines.from(style);
+ for (Style modifiedStyle : StyleLoader.getDeclaredStyles(blocLines.subExtract(1, 1), styleBuilder)) {
+ skinParam.muteStyle(modifiedStyle);
+ }
+ }
+ }
+
+ public Iterator getIterator() {
+ return list.iterator();
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
index b69d64027..bab6b506d 100644
--- a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
+++ b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
@@ -42,6 +42,7 @@ import java.util.List;
import net.sourceforge.plantuml.Dimension2DDouble;
import net.sourceforge.plantuml.ISkinParam;
+import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
@@ -54,14 +55,13 @@ import net.sourceforge.plantuml.json.JsonArray;
import net.sourceforge.plantuml.json.JsonObject;
import net.sourceforge.plantuml.json.JsonObject.Member;
import net.sourceforge.plantuml.json.JsonValue;
+import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
-import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.svek.TextBlockBackcolored;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.ULine;
import net.sourceforge.plantuml.ugraphic.URectangle;
-import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@@ -70,6 +70,7 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
private final List lines = new ArrayList();
+ private final Style style;
private final ISkinParam skinParam;
private double totalWidth;
private final JsonValue root;
@@ -99,8 +100,9 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
}
- public TextBlockJson(ISkinParam skinParam, JsonValue root, List highlighted) {
+ public TextBlockJson(ISkinParam skinParam, JsonValue root, List highlighted, Style style) {
this.skinParam = skinParam;
+ this.style = style;
this.root = root;
if (root instanceof JsonObject)
for (Member member : (JsonObject) root) {
@@ -230,17 +232,37 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
return width;
}
- public void drawU(UGraphic ug) {
+ public void drawU(final UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Dimension2D fullDim = calculateDimension(stringBounder);
double trueWidth = Math.max(fullDim.getWidth(), totalWidth);
final double widthColA = getWidthColA(stringBounder);
+ final double widthColB = getWidthColB(stringBounder);
double y = 0;
- ug = getStyle().applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
+ final UGraphic ugNode = style.applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
for (Line line : lines) {
- final UGraphic ugline = ug.apply(UTranslate.dy(y));
+ final double heightOfRow = line.getHeightOfRow(stringBounder);
+ y += heightOfRow;
+ }
+ if (y == 0)
+ y = 15;
+ if (trueWidth == 0)
+ trueWidth = 30;
+
+ final double round = style.value(PName.RoundCorner).asDouble();
+ final URectangle fullNodeRectangle = new URectangle(trueWidth, y).rounded(round);
+ final HColor backColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
+ ugNode.apply(backColor.bg()).apply(backColor).draw(fullNodeRectangle);
+
+ final Style styleSeparator = style.getSignature().add(SName.separator)
+ .getMergedStyle(skinParam.getCurrentStyleBuilder());
+ final UGraphic ugSeparator = styleSeparator.applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
+
+ y = 0;
+ for (Line line : lines) {
+ final UGraphic ugline = ugSeparator.apply(UTranslate.dy(y));
final double heightOfRow = line.getHeightOfRow(stringBounder);
if (line.highlighted) {
final URectangle back = new URectangle(trueWidth - 2, heightOfRow).rounded(4);
@@ -251,24 +273,19 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
if (y > 0)
ugline.draw(ULine.hline(trueWidth));
- final double posColA = (widthColA - line.b1.calculateDimension(stringBounder).getWidth()) / 2;
- line.b1.drawU(ugline.apply(UTranslate.dx(posColA)));
+ final HorizontalAlignment horizontalAlignment = style.getHorizontalAlignment();
+ horizontalAlignment.draw(ugline, line.b1, 0, widthColA);
if (line.b2 != null) {
- line.b2.drawU(ugline.apply(UTranslate.dx(widthColA)));
- ugline.apply(UTranslate.dx(widthColA)).draw(ULine.vline(heightOfRow));
+ final UGraphic uglineColB = ugline.apply(UTranslate.dx(widthColA));
+ horizontalAlignment.draw(uglineColB, line.b2, 0, widthColB);
+ uglineColB.draw(ULine.vline(heightOfRow));
}
y += heightOfRow;
}
+ ugNode.draw(fullNodeRectangle);
- if (y == 0)
- y = 15;
- if (trueWidth == 0)
- trueWidth = 30;
-
- final URectangle full = new URectangle(trueWidth, y).rounded(10);
- ug.apply(new UStroke(1.5)).draw(full);
}
private double getTotalHeight(StringBounder stringBounder) {
@@ -281,18 +298,15 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
private TextBlock getTextBlock(String key) {
final Display display = Display.getWithNewlines(key);
- final FontConfiguration fontConfiguration = getStyle().getFontConfiguration(skinParam.getIHtmlColorSet());
- TextBlock result = display.create7(fontConfiguration, HorizontalAlignment.LEFT, skinParam,
- CreoleMode.NO_CREOLE);
+ final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getIHtmlColorSet());
+ final LineBreakStrategy wrap = style.wrapWidth();
+ final HorizontalAlignment horizontalAlignment = style.getHorizontalAlignment();
+ TextBlock result = display.create0(fontConfiguration, horizontalAlignment, skinParam, wrap,
+ CreoleMode.NO_CREOLE, null, null);
result = TextBlockUtils.withMargin(result, 5, 2);
return result;
}
- private Style getStyle() {
- return StyleSignature.of(SName.root, SName.element, SName.jsonDiagram)
- .getMergedStyle(skinParam.getCurrentStyleBuilder());
- }
-
public void setTotalWidth(double totalWidth) {
this.totalWidth = totalWidth;
}
diff --git a/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java b/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java
index 7ae3b7a9e..6adf633b5 100644
--- a/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java
+++ b/src/net/sourceforge/plantuml/objectdiagram/command/CommandAddData.java
@@ -45,6 +45,7 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
import net.sourceforge.plantuml.skin.VisibilityModifier;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandAddData extends SingleLineCommand2 {
@@ -63,7 +64,7 @@ public class CommandAddData extends SingleLineCommand2emptyList()
- );
- imageData = ssr.noStartumlFound(os, option.getFileFormatOption(),42);
+ system = PSystemErrorUtils.buildV2(null,
+ new ErrorUml(SYNTAX_ERROR, "No @startuml/@enduml found", 0, new LineLocationImpl("", null)), null,
+ Collections.emptyList());
+ imageData = ssr.noStartumlFound(os, option.getFileFormatOption(), 42);
} else {
system = ssr.getBlocks().get(0).getDiagram();
imageData = system.exportDiagram(os, 0, option.getFileFormatOption());
@@ -201,9 +198,9 @@ public class PicoWebServer implements Runnable {
sendDiagram(out, system, option.getFileFormatOption(), "200", imageData, os.toByteArray());
}
- private void sendDiagram(final BufferedOutputStream out, final Diagram system, final FileFormatOption fileFormatOption,
- final String returnCode, final ImageData imageData, final byte[] fileData)
- throws IOException {
+ private void sendDiagram(final BufferedOutputStream out, final Diagram system,
+ final FileFormatOption fileFormatOption, final String returnCode, final ImageData imageData,
+ final byte[] fileData) throws IOException {
write(out, "HTTP/1.1 " + returnCode);
write(out, "Cache-Control: no-cache");
diff --git a/src/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java b/src/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java
index 6696f884d..31242f9c5 100644
--- a/src/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java
+++ b/src/net/sourceforge/plantuml/picoweb/PicoWebServerTest.java
@@ -248,11 +248,16 @@ public class PicoWebServerTest {
}
private static String httpRaw(String request) throws Exception {
- try (Socket socket = socketConnection()) {
+ Socket socket = null;
+ try {
+ socket = socketConnection();
socket.getOutputStream().write(request.getBytes(UTF_8));
socket.shutdownOutput();
- return readStreamAsString(socket.getInputStream())
- .replaceAll("\r\n", "\n");
+ return readStreamAsString(socket.getInputStream()).replaceAll("\r\n", "\n");
+ } finally {
+ if (socket != null) {
+ socket.close();
+ }
}
}
diff --git a/src/net/sourceforge/plantuml/preproc/Sub.java b/src/net/sourceforge/plantuml/preproc/Sub.java
index b8095c968..2764ca628 100644
--- a/src/net/sourceforge/plantuml/preproc/Sub.java
+++ b/src/net/sourceforge/plantuml/preproc/Sub.java
@@ -102,7 +102,6 @@ public class Sub {
result.add(s);
}
}
- reader.close();
return result;
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java
index 38b677d05..c8ad626ef 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java
@@ -82,11 +82,10 @@ public class LinkAnchor {
public void drawAnchor(UGraphic ug, YPositionedTile tile1, YPositionedTile tile2, ISkinParam param) {
- final StringBounder stringBounder = ug.getStringBounder();
- final double y1 = tile1.getY(stringBounder);
- final double y2 = tile2.getY(stringBounder);
- final double xx1 = tile1.getMiddleX(stringBounder);
- final double xx2 = tile2.getMiddleX(stringBounder);
+ final double y1 = tile1.getY();
+ final double y2 = tile2.getY();
+ final double xx1 = tile1.getMiddleX();
+ final double xx2 = tile2.getMiddleX();
final double x = (xx1 + xx2) / 2;
final double ymin = Math.min(y1, y2);
final double ymax = Math.max(y1, y2);
diff --git a/src/net/sourceforge/plantuml/sequencediagram/Message.java b/src/net/sourceforge/plantuml/sequencediagram/Message.java
index 05305ace9..d9a3660b7 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/Message.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/Message.java
@@ -35,6 +35,9 @@
*/
package net.sourceforge.plantuml.sequencediagram;
+import java.util.Collections;
+import java.util.List;
+
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
import net.sourceforge.plantuml.style.StyleBuilder;
@@ -79,4 +82,14 @@ public final class Message extends AbstractMessage {
return p1 == p2;
}
+ private List multicast = Collections.emptyList();
+
+ public void setMulticast(List multicast) {
+ this.multicast = multicast;
+ }
+
+ public List getMulticast() {
+ return multicast;
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
index 333931914..09111537b 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java
@@ -35,6 +35,9 @@
*/
package net.sourceforge.plantuml.sequencediagram.command;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.LineLocation;
@@ -48,6 +51,7 @@ import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
+import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
@@ -106,9 +110,10 @@ public class CommandArrow extends SingleLineCommand2 {
new RegexLeaf("PART2LONG", "[%g]([^%g]+)[%g]"), //
new RegexLeaf("PART2LONGCODE", "[%g]([^%g]+)[%g][%s]*as[%s]+([\\p{L}0-9_.@]+)"), //
new RegexLeaf("PART2CODELONG", "([\\p{L}0-9_.@]+)[%s]+as[%s]*[%g]([^%g]+)[%g]")), //
+ new RegexLeaf("MULTICAST", "((?:\\s&\\s[\\p{L}0-9_.@]+)*)"), //
new RegexLeaf("PART2ANCHOR", ANCHOR), //
RegexLeaf.spaceZeroOrMore(), //
- new RegexLeaf("ACTIVATION", "(?:([+*!-]+)?)"), //
+ new RegexLeaf("ACTIVATION", "(?:(\\+\\+|\\*\\*|!!|--|--\\+\\+|\\+\\+--)?)"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LIFECOLOR", "(?:(#\\w+)?)"), //
RegexLeaf.spaceZeroOrMore(), //
@@ -118,6 +123,25 @@ public class CommandArrow extends SingleLineCommand2 {
RegexLeaf.end());
}
+ private List getMulticasts(SequenceDiagram system, RegexResult arg2) {
+ final String multicast = arg2.get("MULTICAST", 0);
+ if (multicast != null) {
+ final List result = new ArrayList();
+ for (String s : multicast.split("&")) {
+ s = s.trim();
+ if (s.length() == 0) {
+ continue;
+ }
+ final Participant participant = system.getOrCreateParticipant(s);
+ if (participant != null) {
+ result.add(participant);
+ }
+ }
+ return Collections.unmodifiableList(result);
+ }
+ return Collections.emptyList();
+ }
+
private Participant getOrCreateParticipant(SequenceDiagram system, RegexResult arg2, String n) {
final String code;
final Display display;
@@ -157,7 +181,8 @@ public class CommandArrow extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
+ protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg)
+ throws NoSuchColorException {
Participant p1;
Participant p2;
@@ -251,6 +276,7 @@ public class CommandArrow extends SingleLineCommand2 {
final String messageNumber = diagram.getNextMessageNumber();
final Message msg = new Message(diagram.getSkinParam().getCurrentStyleBuilder(), p1, p2,
diagram.manageVariable(labels), config, messageNumber);
+ msg.setMulticast(getMulticasts(diagram, arg));
final String url = arg.get("URL", 0);
if (url != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
@@ -272,31 +298,44 @@ public class CommandArrow extends SingleLineCommand2 {
}
final String s = arg.get("LIFECOLOR", 0);
- final HColor activationColor = s == null ? null
- : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
+ final HColor activationColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
if (activationSpec != null) {
- switch (activationSpec.charAt(0)) {
+ return manageActivations(activationSpec, diagram, p1, p2, activationColor);
+ }
+
+ if (diagram.isAutoactivate() && (config.getHead() == ArrowHead.NORMAL || config.getHead() == ArrowHead.ASYNC)) {
+ if (config.isDotted()) {
+ diagram.activate(p1, LifeEventType.DEACTIVATE, null);
+ } else {
+ diagram.activate(p2, LifeEventType.ACTIVATE, activationColor);
+ }
+ }
+ return CommandExecutionResult.ok();
+ }
+
+ private CommandExecutionResult manageActivations(String spec, SequenceDiagram diagram, Participant p1,
+ Participant p2, HColor activationColor) {
+ switch (spec.charAt(0)) {
+ case '+':
+ diagram.activate(p2, LifeEventType.ACTIVATE, activationColor);
+ break;
+ case '-':
+ diagram.activate(p1, LifeEventType.DEACTIVATE, null);
+ break;
+ case '!':
+ diagram.activate(p2, LifeEventType.DESTROY, null);
+ break;
+ }
+ if (spec.length() == 4) {
+ switch (spec.charAt(2)) {
case '+':
diagram.activate(p2, LifeEventType.ACTIVATE, activationColor);
break;
case '-':
diagram.activate(p1, LifeEventType.DEACTIVATE, null);
break;
- case '!':
- diagram.activate(p2, LifeEventType.DESTROY, null);
- break;
- default:
- break;
}
- } else if (diagram.isAutoactivate()
- && (config.getHead() == ArrowHead.NORMAL || config.getHead() == ArrowHead.ASYNC)) {
- if (config.isDotted()) {
- diagram.activate(p1, LifeEventType.DEACTIVATE, null);
- } else {
- diagram.activate(p2, LifeEventType.ACTIVATE, activationColor);
- }
-
}
return CommandExecutionResult.ok();
}
@@ -313,7 +352,8 @@ public class CommandArrow extends SingleLineCommand2 {
return sa.length() + sb.length();
}
- public static ArrowConfiguration applyStyle(String arrowStyle, ArrowConfiguration config) throws NoSuchColorException {
+ public static ArrowConfiguration applyStyle(String arrowStyle, ArrowConfiguration config)
+ throws NoSuchColorException {
if (arrowStyle == null) {
return config;
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java
index df18bb5eb..682a30030 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/SequenceDiagramTxtMaker.java
@@ -113,13 +113,13 @@ public class SequenceDiagramTxtMaker implements FileMaker {
if (title.isWhite()) {
ug2 = ug;
} else {
- ug2 = (UGraphicTxt) ug.apply(UTranslate.dy(title.as().size() + 1));
+ ug2 = (UGraphicTxt) ug.apply(UTranslate.dy(title.asList().size() + 1));
}
drawableSet.drawU22(ug2, 0, fullDimension.getWidth(), page, diagram.isShowFootbox());
if (title.isWhite() == false) {
final int widthTitle = StringUtils.getWcWidth(title);
final UmlCharArea charArea = ug.getCharArea();
- charArea.drawStringsLRSimple(title.as(), (int) ((fullDimension.getWidth() - widthTitle) / 2), 0);
+ charArea.drawStringsLRSimple(title.asList(), (int) ((fullDimension.getWidth() - widthTitle) / 2), 0);
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java
index 72f1e4b58..c35be02f3 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/AbstractTile.java
@@ -39,18 +39,22 @@ import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
import net.sourceforge.plantuml.sequencediagram.Event;
-public abstract class AbstractTile implements Tile {
+public abstract class AbstractTile extends CommonTile implements Tile {
- public double getYPoint(StringBounder stringBounder) {
- throw new UnsupportedOperationException(getClass().toString());
+ public AbstractTile(StringBounder stringBounder) {
+ super(stringBounder);
}
- final public double getZ(StringBounder stringBounder) {
- final double result = getPreferredHeight(stringBounder) - getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return -1;
+ }
+
+ final public double getZZZ() {
+ final double result = getPreferredHeight() - getContactPointRelative();
assert result >= 0;
return result;
}
-
+
public boolean matchAnchorV1(String anchor) {
final Event event = this.getEvent();
if (event instanceof AbstractMessage) {
@@ -62,5 +66,4 @@ public abstract class AbstractTile implements Tile {
return false;
}
-
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/Bordered.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Bordered.java
index 4bc5d0d66..13815a30d 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/Bordered.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Bordered.java
@@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.sequencediagram.teoz;
-
public interface Bordered {
public double getBorder1();
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithUpdateStairs.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommonTile.java
similarity index 78%
rename from src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithUpdateStairs.java
rename to src/net/sourceforge/plantuml/sequencediagram/teoz/CommonTile.java
index 14a1edb10..7abb4015c 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithUpdateStairs.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommonTile.java
@@ -37,10 +37,23 @@ package net.sourceforge.plantuml.sequencediagram.teoz;
import net.sourceforge.plantuml.graphic.StringBounder;
-public interface TileWithUpdateStairs extends Tile {
+public abstract class CommonTile implements Tile {
- public void updateStairs(StringBounder stringBounder, double y);
+ private final StringBounder stringBounder;
- public double getYPoint(StringBounder stringBounder);
+ public CommonTile(StringBounder stringBounder) {
+ this.stringBounder = stringBounder;
+ }
+
+ final public void callbackY(double y) {
+ callbackY_internal(y);
+ }
+
+ public void callbackY_internal(double y) {
+ }
+
+ protected final StringBounder getStringBounder() {
+ return stringBounder;
+ }
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java
index b277feb3a..8455ecc5a 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java
@@ -54,7 +54,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class CommunicationExoTile extends AbstractTile implements TileWithUpdateStairs {
+public class CommunicationExoTile extends AbstractTile {
private final LivingSpace livingSpace;
private final MessageExo message;
@@ -68,6 +68,7 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
public CommunicationExoTile(LivingSpace livingSpace, MessageExo message, Rose skin, ISkinParam skinParam,
TileArguments tileArguments) {
+ super(tileArguments.getStringBounder());
this.tileArguments = tileArguments;
this.livingSpace = livingSpace;
this.message = message;
@@ -76,8 +77,8 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
}
@Override
- public double getYPoint(StringBounder stringBounder) {
- return getComponent(stringBounder).getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return getComponent(getStringBounder()).getYPoint(getStringBounder());
}
private ArrowComponent getComponent(StringBounder stringBounder) {
@@ -129,9 +130,9 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
return message.isShortArrow();
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
return dim.getHeight();
}
@@ -141,15 +142,15 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
return dim.getWidth();
}
- public void addConstraints(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public void addConstraints() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
final double width = dim.getWidth();
if (message.getType().isRightBorder()) {
} else {
- livingSpace.getPosC(stringBounder).ensureBiggerThan(tileArguments.getOrigin().addFixed(width));
+ livingSpace.getPosC(getStringBounder()).ensureBiggerThan(tileArguments.getOrigin().addFixed(width));
}
// final Real point1 = getPoint1(stringBounder);
@@ -165,10 +166,11 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
// }
}
- public void updateStairs(StringBounder stringBounder, double y) {
- final ArrowComponent comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- final double arrowY = comp.getStartPoint(stringBounder, dim).getY();
+ @Override
+ public void callbackY_internal(double y) {
+ final ArrowComponent comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ final double arrowY = comp.getStartPoint(getStringBounder(), dim).getY();
livingSpace.addStepForLivebox(getEvent(), y + arrowY);
@@ -201,15 +203,15 @@ public class CommunicationExoTile extends AbstractTile implements TileWithUpdate
return livingSpace.getPosC(stringBounder).getCurrentValue();
}
- public Real getMinX(StringBounder stringBounder) {
- return getPoint1(stringBounder);
+ public Real getMinX() {
+ return getPoint1(getStringBounder());
}
- public Real getMaxX(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public Real getMaxX() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
final double width = dim.getWidth();
- return getPoint1(stringBounder).addFixed(width);
+ return getPoint1(getStringBounder()).addFixed(width);
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java
index 0efc9b38a..89dd70cf1 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java
@@ -39,12 +39,14 @@ import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineParam;
+import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.Message;
+import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.skin.Area;
import net.sourceforge.plantuml.skin.ArrowComponent;
import net.sourceforge.plantuml.skin.ArrowConfiguration;
@@ -56,10 +58,11 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class CommunicationTile extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
+public class CommunicationTile extends AbstractTile {
private final LivingSpace livingSpace1;
private final LivingSpace livingSpace2;
+ private final LivingSpaces livingSpaces;
private final Message message;
private final Rose skin;
private final ISkinParam skinParam;
@@ -73,13 +76,12 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
return super.toString() + " " + message;
}
- public CommunicationTile(LivingSpace livingSpace1, LivingSpace livingSpace2, Message message, Rose skin,
+ public CommunicationTile(StringBounder stringBounder, LivingSpaces livingSpaces, Message message, Rose skin,
ISkinParam skinParam) {
- if (livingSpace1 == livingSpace2) {
- throw new IllegalArgumentException();
- }
- this.livingSpace1 = livingSpace1;
- this.livingSpace2 = livingSpace2;
+ super(stringBounder);
+ this.livingSpace1 = livingSpaces.get(message.getParticipant1());
+ this.livingSpace2 = livingSpaces.get(message.getParticipant2());
+ this.livingSpaces = livingSpaces;
this.message = message;
this.skin = skin;
this.skinParam = skinParam;
@@ -87,11 +89,6 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
if (message.isCreate()) {
livingSpace2.goCreate();
}
- // for (LifeEvent lifeEvent : message.getLiveEvents()) {
- // System.err.println("lifeEvent = " + lifeEvent);
- // // livingSpace1.addLifeEvent(this, lifeEvent);
- // // livingSpace2.addLifeEvent(this, lifeEvent);
- // }
}
public boolean isReverse(StringBounder stringBounder) {
@@ -117,37 +114,45 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
private ArrowComponent getComponent(StringBounder stringBounder) {
ArrowConfiguration arrowConfiguration = message.getArrowConfiguration();
- /*
- * if (isSelf()) { arrowConfiguration = arrowConfiguration.self(); } else
- */
if (isReverse(stringBounder)) {
arrowConfiguration = arrowConfiguration.reverse();
}
arrowConfiguration = arrowConfiguration.withThickness(getArrowThickness());
- final ArrowComponent comp = skin.createComponentArrow(message.getUsedStyles(), arrowConfiguration, skinParam,
+ return skin.createComponentArrow(message.getUsedStyles(), arrowConfiguration, skinParam,
message.getLabelNumbered());
- return comp;
+ }
+
+ private ArrowComponent getComponentMulticast(StringBounder stringBounder, boolean reverse) {
+ ArrowConfiguration arrowConfiguration = message.getArrowConfiguration();
+ if (reverse) {
+ arrowConfiguration = arrowConfiguration.reverse();
+ }
+ arrowConfiguration = arrowConfiguration.withThickness(getArrowThickness());
+
+ return skin.createComponentArrow(message.getUsedStyles(), arrowConfiguration, skinParam, Display.NULL);
}
@Override
- public double getYPoint(StringBounder stringBounder) {
- return getComponent(stringBounder).getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return getComponent(getStringBounder()).getYPoint(getStringBounder());
}
public static final double LIVE_DELTA_SIZE = 5;
- public void updateStairs(StringBounder stringBounder, double y) {
- final AbstractComponentRoseArrow comp = (AbstractComponentRoseArrow) getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- // final Point2D p2 = comp.getEndPoint(stringBounder, dim);
- // System.err.println("CommunicationTile::updateStairs y=" + y + " p1=" + p1 + " p2=" + p2 + " dim=" + dim);
- final double arrowY = comp.getStartPoint(stringBounder, dim).getY();
+ @Override
+ public void callbackY_internal(double y) {
+ if (message.isCreate()) {
+ livingSpace2.goCreate(y);
+ }
+
+ final AbstractComponentRoseArrow comp = (AbstractComponentRoseArrow) getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+
+ final double arrowY = comp.getStartPoint(getStringBounder(), dim).getY();
livingSpace1.addStepForLivebox(getEvent(), y + arrowY);
livingSpace2.addStepForLivebox(getEvent(), y + arrowY);
-
- // System.err.println("CommunicationTile::updateStairs msg=" + message + " y=" + y + " arrowY=" + arrowY);
}
public void drawU(UGraphic ug) {
@@ -161,6 +166,7 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
final Dimension2D dim = comp.getPreferredDimension(stringBounder);
double x1 = getPoint1(stringBounder).getCurrentValue();
double x2 = getPoint2(stringBounder).getCurrentValue();
+ drawMulticast(ug.apply(UTranslate.dy(comp.getPosArrow(stringBounder))));
final Area area;
if (isReverse(stringBounder)) {
@@ -193,24 +199,45 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
comp.drawU(ug, area, (Context2D) ug);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ private void drawMulticast(final UGraphic ug) {
+ if (message.getMulticast().size() == 0) {
+ return;
+ }
+ final StringBounder stringBounder = ug.getStringBounder();
+
+ final double x1 = getPoint1(stringBounder).getCurrentValue();
+ double dy = 2;
+ for (Participant participant : message.getMulticast()) {
+ final double x2 = livingSpaces.get(participant).getPosC(stringBounder).getCurrentValue();
+ final boolean reverse = x2 < x1;
+ final ArrowComponent comp = getComponentMulticast(stringBounder, reverse);
+ final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ final Area area = new Area(Math.abs(x2 - x1), dim.getHeight());
+ final UGraphic ug2 = ug.apply(UTranslate.dx(Math.min(x1, x2))).apply(UTranslate.dy(dy));
+ dy += 2;
+ comp.drawU(ug2, area, (Context2D) ug2);
+ }
+
+ }
+
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
double height = dim.getHeight();
if (isCreate()) {
- height = Math.max(height, livingSpace2.getHeadPreferredDimension(stringBounder).getHeight());
+ height = Math.max(height, livingSpace2.getHeadPreferredDimension(getStringBounder()).getHeight());
}
return height;
}
- public void addConstraints(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public void addConstraints() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
final double width = dim.getWidth();
- Real point1 = getPoint1(stringBounder);
- Real point2 = getPoint2(stringBounder);
- if (isReverse(stringBounder)) {
+ Real point1 = getPoint1(getStringBounder());
+ Real point2 = getPoint2(getStringBounder());
+ if (isReverse(getStringBounder())) {
final int level1 = livingSpace1.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);
final int level2 = livingSpace2.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE);
if (level1 > 0) {
@@ -241,24 +268,18 @@ public class CommunicationTile extends AbstractTile implements TileWithUpdateSta
return livingSpace2.getPosC(stringBounder);
}
- public Real getMinX(StringBounder stringBounder) {
- if (isReverse(stringBounder)) {
- return getPoint2(stringBounder);
+ public Real getMinX() {
+ if (isReverse(getStringBounder())) {
+ return getPoint2(getStringBounder());
}
- return getPoint1(stringBounder);
+ return getPoint1(getStringBounder());
}
- public Real getMaxX(StringBounder stringBounder) {
- if (isReverse(stringBounder)) {
- return getPoint1(stringBounder);
- }
- return getPoint2(stringBounder);
- }
-
- public void callbackY(double y) {
- if (message.isCreate()) {
- livingSpace2.goCreate(y);
+ public Real getMaxX() {
+ if (isReverse(getStringBounder())) {
+ return getPoint1(getStringBounder());
}
+ return getPoint2(getStringBounder());
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java
index d323aff3f..7137eb44f 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteBottom.java
@@ -55,9 +55,9 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
-public class CommunicationTileNoteBottom extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
+public class CommunicationTileNoteBottom extends AbstractTile {
- private final TileWithUpdateStairs tile;
+ private final Tile tile;
private final AbstractMessage message;
private final Rose skin;
private final ISkinParam skinParam;
@@ -68,12 +68,13 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
}
@Override
- public double getYPoint(StringBounder stringBounder) {
- return tile.getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return tile.getContactPointRelative();
}
- public CommunicationTileNoteBottom(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
- ISkinParam skinParam, Note noteOnMessage) {
+ public CommunicationTileNoteBottom(Tile tile, AbstractMessage message, Rose skin, ISkinParam skinParam,
+ Note noteOnMessage) {
+ super(((AbstractTile) tile).getStringBounder());
this.tile = tile;
this.message = message;
this.skin = skin;
@@ -81,8 +82,9 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
this.noteOnMessage = noteOnMessage;
}
- public void updateStairs(StringBounder stringBounder, double y) {
- tile.updateStairs(stringBounder, y);
+ @Override
+ public void callbackY_internal(double y) {
+ tile.callbackY(y);
}
private Component getComponent(StringBounder stringBounder) {
@@ -92,7 +94,7 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
}
private Real getNotePosition(StringBounder stringBounder) {
- final Real minX = tile.getMinX(stringBounder);
+ final Real minX = tile.getMinX();
return minX;
}
@@ -103,15 +105,15 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
final Area area = new Area(dim.getWidth(), dim.getHeight());
tile.drawU(ug);
- final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder).getCurrentValue()) / 2;
+ final double middleMsg = (tile.getMinX().getCurrentValue() + tile.getMaxX().getCurrentValue()) / 2;
final double xNote = getNotePosition(stringBounder).getCurrentValue();
- final double yNote = tile.getPreferredHeight(stringBounder);
+ final double yNote = tile.getPreferredHeight();
comp.drawU(ug.apply(new UTranslate(xNote, yNote + spacey)), area, (Context2D) ug);
- drawLine(ug, middleMsg, tile.getYPoint(stringBounder), xNote + dim.getWidth() / 2, yNote + spacey
- + Rose.paddingY);
+ drawLine(ug, middleMsg, tile.getContactPointRelative(), xNote + dim.getWidth() / 2,
+ yNote + spacey + Rose.paddingY);
}
@@ -123,33 +125,26 @@ public class CommunicationTileNoteBottom extends AbstractTile implements TileWit
final double dx = x2 - x1;
final double dy = y2 - y1;
- ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1))
- .draw(new ULine(dx, dy));
+ ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1)).draw(new ULine(dx, dy));
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- return tile.getPreferredHeight(stringBounder) + dim.getHeight() + spacey;
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ return tile.getPreferredHeight() + dim.getHeight() + spacey;
}
- public void addConstraints(StringBounder stringBounder) {
- tile.addConstraints(stringBounder);
+ public void addConstraints() {
+ tile.addConstraints();
}
- public Real getMinX(StringBounder stringBounder) {
- return tile.getMinX(stringBounder);
+ public Real getMinX() {
+ return tile.getMinX();
}
- public Real getMaxX(StringBounder stringBounder) {
- return tile.getMaxX(stringBounder);
- }
-
- public void callbackY(double y) {
- if (tile instanceof TileWithCallbackY) {
- ((TileWithCallbackY) tile).callbackY(y);
- }
+ public Real getMaxX() {
+ return tile.getMaxX();
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java
index 96b5cf6bc..960864cf5 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteLeft.java
@@ -51,9 +51,9 @@ import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class CommunicationTileNoteLeft extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
+public class CommunicationTileNoteLeft extends AbstractTile {
- private final TileWithUpdateStairs tile;
+ private final Tile tile;
private final AbstractMessage message;
private final Rose skin;
private final ISkinParam skinParam;
@@ -65,12 +65,13 @@ public class CommunicationTileNoteLeft extends AbstractTile implements TileWithU
}
@Override
- public double getYPoint(StringBounder stringBounder) {
- return tile.getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return tile.getContactPointRelative();
}
- public CommunicationTileNoteLeft(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
- ISkinParam skinParam, LivingSpace livingSpace, Note noteOnMessage) {
+ public CommunicationTileNoteLeft(Tile tile, AbstractMessage message, Rose skin, ISkinParam skinParam,
+ LivingSpace livingSpace, Note noteOnMessage) {
+ super(((AbstractTile) tile).getStringBounder());
this.tile = tile;
this.message = message;
this.skin = skin;
@@ -79,8 +80,9 @@ public class CommunicationTileNoteLeft extends AbstractTile implements TileWithU
this.livingSpace = livingSpace;
}
- public void updateStairs(StringBounder stringBounder, double y) {
- tile.updateStairs(stringBounder, y);
+ @Override
+ public void callbackY_internal(double y) {
+ tile.callbackY(y);
}
private Component getComponent(StringBounder stringBounder) {
@@ -106,28 +108,22 @@ public class CommunicationTileNoteLeft extends AbstractTile implements TileWithU
comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- return Math.max(tile.getPreferredHeight(stringBounder), dim.getHeight());
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ return Math.max(tile.getPreferredHeight(), dim.getHeight());
}
- public void addConstraints(StringBounder stringBounder) {
- tile.addConstraints(stringBounder);
+ public void addConstraints() {
+ tile.addConstraints();
}
- public Real getMinX(StringBounder stringBounder) {
- return getNotePosition(stringBounder);
+ public Real getMinX() {
+ return getNotePosition(getStringBounder());
}
- public Real getMaxX(StringBounder stringBounder) {
- return tile.getMaxX(stringBounder);
- }
-
- public void callbackY(double y) {
- if (tile instanceof TileWithCallbackY) {
- ((TileWithCallbackY) tile).callbackY(y);
- }
+ public Real getMaxX() {
+ return tile.getMaxX();
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java
index 9c35dae9f..75bdbf274 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java
@@ -51,9 +51,9 @@ import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class CommunicationTileNoteRight extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
+public class CommunicationTileNoteRight extends AbstractTile {
- private final TileWithUpdateStairs tile;
+ private final Tile tile;
private final AbstractMessage message;
private final Rose skin;
private final ISkinParam skinParam;
@@ -69,12 +69,13 @@ public class CommunicationTileNoteRight extends AbstractTile implements TileWith
}
@Override
- public double getYPoint(StringBounder stringBounder) {
- return tile.getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return tile.getContactPointRelative();
}
- public CommunicationTileNoteRight(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
- ISkinParam skinParam, LivingSpace livingSpace, Note noteOnMessage) {
+ public CommunicationTileNoteRight(Tile tile, AbstractMessage message, Rose skin, ISkinParam skinParam,
+ LivingSpace livingSpace, Note noteOnMessage) {
+ super(((AbstractTile) tile).getStringBounder());
this.tile = tile;
this.message = message;
this.skin = skin;
@@ -83,8 +84,9 @@ public class CommunicationTileNoteRight extends AbstractTile implements TileWith
this.livingSpace = livingSpace;
}
- public void updateStairs(StringBounder stringBounder, double y) {
- tile.updateStairs(stringBounder, y);
+ @Override
+ public void callbackY_internal(double y) {
+ tile.callbackY(y);
}
private Component getComponent(StringBounder stringBounder) {
@@ -114,30 +116,24 @@ public class CommunicationTileNoteRight extends AbstractTile implements TileWith
comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- return Math.max(tile.getPreferredHeight(stringBounder), dim.getHeight());
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ return Math.max(tile.getPreferredHeight(), dim.getHeight());
}
- public void addConstraints(StringBounder stringBounder) {
- tile.addConstraints(stringBounder);
+ public void addConstraints() {
+ tile.addConstraints();
}
- public Real getMinX(StringBounder stringBounder) {
- return tile.getMinX(stringBounder);
+ public Real getMinX() {
+ return tile.getMinX();
}
- public Real getMaxX(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- return getNotePosition(stringBounder).addFixed(dim.getWidth());
- }
-
- public void callbackY(double y) {
- if (tile instanceof TileWithCallbackY) {
- ((TileWithCallbackY) tile).callbackY(y);
- }
+ public Real getMaxX() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ return getNotePosition(getStringBounder()).addFixed(dim.getWidth());
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java
index 2b2152ac2..f8371bbc3 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteTop.java
@@ -55,9 +55,9 @@ import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
-public class CommunicationTileNoteTop extends AbstractTile implements TileWithUpdateStairs, TileWithCallbackY {
+public class CommunicationTileNoteTop extends AbstractTile {
- private final TileWithUpdateStairs tile;
+ private final Tile tile;
private final AbstractMessage message;
private final Rose skin;
private final ISkinParam skinParam;
@@ -68,12 +68,13 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
}
@Override
- public double getYPoint(StringBounder stringBounder) {
- return tile.getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return tile.getContactPointRelative();
}
- public CommunicationTileNoteTop(TileWithUpdateStairs tile, AbstractMessage message, Rose skin,
- ISkinParam skinParam, Note noteOnMessage) {
+ public CommunicationTileNoteTop(Tile tile, AbstractMessage message, Rose skin, ISkinParam skinParam,
+ Note noteOnMessage) {
+ super(((AbstractTile) tile).getStringBounder());
this.tile = tile;
this.message = message;
this.skin = skin;
@@ -81,8 +82,9 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
this.noteOnMessage = noteOnMessage;
}
- public void updateStairs(StringBounder stringBounder, double y) {
- tile.updateStairs(stringBounder, y);
+ @Override
+ public void callbackY_internal(double y) {
+ tile.callbackY(y);
}
private Component getComponent(StringBounder stringBounder) {
@@ -92,7 +94,7 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
}
private Real getNotePosition(StringBounder stringBounder) {
- final Real minX = tile.getMinX(stringBounder);
+ final Real minX = tile.getMinX();
return minX;
}
@@ -104,14 +106,13 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
tile.drawU(ug.apply(UTranslate.dy(dim.getHeight() + spacey)));
- final double middleMsg = (tile.getMinX(stringBounder).getCurrentValue() + tile.getMaxX(stringBounder)
- .getCurrentValue()) / 2;
+ final double middleMsg = (tile.getMinX().getCurrentValue() + tile.getMaxX().getCurrentValue()) / 2;
final double xNote = getNotePosition(stringBounder).getCurrentValue();
comp.drawU(ug.apply(UTranslate.dx(xNote)), area, (Context2D) ug);
- drawLine(ug, middleMsg, tile.getYPoint(stringBounder) + dim.getHeight() + spacey, xNote + dim.getWidth() / 2,
+ drawLine(ug, middleMsg, tile.getContactPointRelative() + dim.getHeight() + spacey, xNote + dim.getWidth() / 2,
dim.getHeight() - 2 * Rose.paddingY);
}
@@ -124,33 +125,26 @@ public class CommunicationTileNoteTop extends AbstractTile implements TileWithUp
final double dx = x2 - x1;
final double dy = y2 - y1;
- ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1))
- .draw(new ULine(dx, dy));
+ ug.apply(new UTranslate(x1, y1)).apply(color).apply(new UStroke(2, 2, 1)).draw(new ULine(dx, dy));
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- return tile.getPreferredHeight(stringBounder) + dim.getHeight() + spacey;
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ return tile.getPreferredHeight() + dim.getHeight() + spacey;
}
- public void addConstraints(StringBounder stringBounder) {
- tile.addConstraints(stringBounder);
+ public void addConstraints() {
+ tile.addConstraints();
}
- public Real getMinX(StringBounder stringBounder) {
- return tile.getMinX(stringBounder);
+ public Real getMinX() {
+ return tile.getMinX();
}
- public Real getMaxX(StringBounder stringBounder) {
- return tile.getMaxX(stringBounder);
- }
-
- public void callbackY(double y) {
- if (tile instanceof TileWithCallbackY) {
- ((TileWithCallbackY) tile).callbackY(y);
- }
+ public Real getMaxX() {
+ return tile.getMaxX();
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java
index 3c959ca0c..c9c1e5cc9 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java
@@ -54,7 +54,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class CommunicationTileSelf extends AbstractTile implements TileWithUpdateStairs {
+public class CommunicationTileSelf extends AbstractTile {
private final LivingSpace livingSpace1;
private final Message message;
@@ -67,12 +67,13 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
}
@Override
- public double getYPoint(StringBounder stringBounder) {
- return getComponent(stringBounder).getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return getComponent(getStringBounder()).getYPoint(getStringBounder());
}
- public CommunicationTileSelf(LivingSpace livingSpace1, Message message, Rose skin, ISkinParam skinParam,
- LivingSpaces livingSpaces) {
+ public CommunicationTileSelf(StringBounder stringBounder, LivingSpace livingSpace1, Message message, Rose skin,
+ ISkinParam skinParam, LivingSpaces livingSpaces) {
+ super(stringBounder);
this.livingSpace1 = livingSpace1;
this.livingSpaces = livingSpaces;
this.message = message;
@@ -98,11 +99,12 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
return comp;
}
- public void updateStairs(StringBounder stringBounder, double y) {
- final ArrowComponent comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- final Point2D p1 = comp.getStartPoint(stringBounder, dim);
- final Point2D p2 = comp.getEndPoint(stringBounder, dim);
+ @Override
+ public void callbackY_internal(double y) {
+ final ArrowComponent comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ final Point2D p1 = comp.getStartPoint(getStringBounder(), dim);
+ final Point2D p2 = comp.getEndPoint(getStringBounder(), dim);
if (message.isActivate()) {
livingSpace1.addStepForLivebox(getEvent(), y + p2.getY());
@@ -139,20 +141,20 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
comp.drawU(ug, area, (Context2D) ug);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
return dim.getHeight();
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
// final Component comp = getComponent(stringBounder);
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
// final double width = dim.getWidth();
final LivingSpace next = getNext();
if (next != null) {
- next.getPosC(stringBounder).ensureBiggerThan(getMaxX(stringBounder));
+ next.getPosC(getStringBounder()).ensureBiggerThan(getMaxX());
}
}
@@ -174,15 +176,15 @@ public class CommunicationTileSelf extends AbstractTile implements TileWithUpdat
return livingSpace1.getPosC(stringBounder);
}
- public Real getMinX(StringBounder stringBounder) {
- return getPoint1(stringBounder);
+ public Real getMinX() {
+ return getPoint1(getStringBounder());
}
- public Real getMaxX(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public Real getMaxX() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
final double width = dim.getWidth();
- return livingSpace1.getPosC2(stringBounder).addFixed(width);
+ return livingSpace1.getPosC2(getStringBounder()).addFixed(width);
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java
index 546bcf7cc..4e20330d0 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelfNoteRight.java
@@ -51,7 +51,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class CommunicationTileSelfNoteRight extends AbstractTile implements TileWithUpdateStairs {
+public class CommunicationTileSelfNoteRight extends AbstractTile {
private final CommunicationTileSelf tile;
private final Message message;
@@ -62,14 +62,15 @@ public class CommunicationTileSelfNoteRight extends AbstractTile implements Tile
public Event getEvent() {
return message;
}
-
+
@Override
- public double getYPoint(StringBounder stringBounder) {
- return tile.getYPoint(stringBounder);
+ public double getContactPointRelative() {
+ return tile.getContactPointRelative();
}
public CommunicationTileSelfNoteRight(CommunicationTileSelf tile, Message message, Rose skin, ISkinParam skinParam,
Note noteOnMessage) {
+ super(((AbstractTile) tile).getStringBounder());
this.tile = tile;
this.message = message;
this.skin = skin;
@@ -77,18 +78,19 @@ public class CommunicationTileSelfNoteRight extends AbstractTile implements Tile
this.noteOnMessage = noteOnMessage;
}
- public void updateStairs(StringBounder stringBounder, double y) {
- tile.updateStairs(stringBounder, y);
+ @Override
+ public void callbackY_internal(double y) {
+ tile.callbackY(y);
}
private Component getComponent(StringBounder stringBounder) {
- final Component comp = skin.createComponent(null, ComponentType.NOTE,
- null, noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings());
+ final Component comp = skin.createComponent(null, ComponentType.NOTE, null,
+ noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings());
return comp;
}
private Real getNotePosition(StringBounder stringBounder) {
- return tile.getMaxX(stringBounder);
+ return tile.getMaxX();
}
public void drawU(UGraphic ug) {
@@ -102,24 +104,24 @@ public class CommunicationTileSelfNoteRight extends AbstractTile implements Tile
comp.drawU(ug.apply(UTranslate.dx(p.getCurrentValue())), area, (Context2D) ug);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- return Math.max(tile.getPreferredHeight(stringBounder), dim.getHeight());
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ return Math.max(tile.getPreferredHeight(), dim.getHeight());
}
- public void addConstraints(StringBounder stringBounder) {
- tile.addConstraints(stringBounder);
+ public void addConstraints() {
+ tile.addConstraints();
}
- public Real getMinX(StringBounder stringBounder) {
- return tile.getMinX(stringBounder);
+ public Real getMinX() {
+ return tile.getMinX();
}
- public Real getMaxX(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- return getNotePosition(stringBounder).addFixed(dim.getWidth());
+ public Real getMaxX() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ return getNotePosition(getStringBounder()).addFixed(dim.getWidth());
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java
index d7e59329c..ba3420141 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/DelayTile.java
@@ -49,7 +49,7 @@ import net.sourceforge.plantuml.skin.Context2D;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class DelayTile extends AbstractTile implements Tile, TileWithCallbackY {
+public class DelayTile extends AbstractTile implements Tile {
private final Delay delay;
private final TileArguments tileArguments;
@@ -62,11 +62,13 @@ public class DelayTile extends AbstractTile implements Tile, TileWithCallbackY {
return delay;
}
- public void callbackY(double y) {
+ @Override
+ public void callbackY_internal(double y) {
this.y = y;
}
public DelayTile(Delay delay, TileArguments tileArguments) {
+ super(tileArguments.getStringBounder());
this.delay = delay;
this.tileArguments = tileArguments;
}
@@ -102,27 +104,27 @@ public class DelayTile extends AbstractTile implements Tile, TileWithCallbackY {
final Area area = new Area(getPreferredWidth(stringBounder), dim.getHeight());
tileArguments.getLivingSpaces().delayOn(y, dim.getHeight());
- ug = ug.apply(UTranslate.dx(getMinX(stringBounder).getCurrentValue()));
+ ug = ug.apply(UTranslate.dx(getMinX().getCurrentValue()));
comp.drawU(ug, area, (Context2D) ug);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
return dim.getHeight();
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
}
- public Real getMinX(StringBounder stringBounder) {
- init(stringBounder);
- return this.middle.addFixed(-getPreferredWidth(stringBounder) / 2);
+ public Real getMinX() {
+ init(getStringBounder());
+ return this.middle.addFixed(-getPreferredWidth(getStringBounder()) / 2);
}
- public Real getMaxX(StringBounder stringBounder) {
- init(stringBounder);
- return this.middle.addFixed(getPreferredWidth(stringBounder) / 2);
+ public Real getMaxX() {
+ init(getStringBounder());
+ return this.middle.addFixed(getPreferredWidth(getStringBounder()) / 2);
}
// private double startingY;
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java
index f7795fb7b..db5411c7a 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/DividerTile.java
@@ -63,6 +63,7 @@ public class DividerTile extends AbstractTile implements Tile {
}
public DividerTile(Divider divider, TileArguments tileArguments) {
+ super(tileArguments.getStringBounder());
this.tileArguments = tileArguments;
this.divider = divider;
this.skin = tileArguments.getSkin();
@@ -87,25 +88,25 @@ public class DividerTile extends AbstractTile implements Tile {
comp.drawU(ug, area, (Context2D) ug);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
return dim.getHeight();
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
// final Component comp = getComponent(stringBounder);
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
// final double width = dim.getWidth();
}
- public Real getMinX(StringBounder stringBounder) {
+ public Real getMinX() {
return origin;
}
- public Real getMaxX(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public Real getMaxX() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
return origin.addFixed(dim.getWidth());
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java
index fcb6d3391..42c35d104 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/ElseTile.java
@@ -49,7 +49,7 @@ import net.sourceforge.plantuml.skin.ComponentType;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
-public class ElseTile extends AbstractTile implements TileWithCallbackY {
+public class ElseTile extends AbstractTile {
private final Rose skin;
private final ISkinParam skinParam;
@@ -61,11 +61,12 @@ public class ElseTile extends AbstractTile implements TileWithCallbackY {
}
@Override
- public double getYPoint(StringBounder stringBounder) {
+ public double getContactPointRelative() {
return 0;
}
public ElseTile(GroupingLeaf anElse, Rose skin, ISkinParam skinParam, Tile parent) {
+ super(((AbstractTile) parent).getStringBounder());
this.anElse = anElse;
this.skin = skin;
this.skinParam = skinParam;
@@ -96,14 +97,15 @@ public class ElseTile extends AbstractTile implements TileWithCallbackY {
// // final double totalParentHeight = parent.getPreferredHeight(stringBounder);
// // height = totalParentHeight - (startingY - y);
// // }
- // final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), height);
+ // final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(),
+ // height);
// ug = ug.apply(new UTranslate(min.getCurrentValue(), 0));
// comp.drawU(ug, area, context);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
double height = dim.getHeight();
if (anElse.getComment() != null) {
@@ -112,25 +114,26 @@ public class ElseTile extends AbstractTile implements TileWithCallbackY {
return height;
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
// final Component comp = getComponent(stringBounder);
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
// final double width = dim.getWidth();
}
- public Real getMinX(StringBounder stringBounder) {
- return parent.getMinX(stringBounder);
+ public Real getMinX() {
+ return parent.getMinX();
}
- public Real getMaxX(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
- return getMinX(stringBounder).addFixed(dim.getWidth());
+ public Real getMaxX() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
+ return getMinX().addFixed(dim.getWidth());
}
private double y;
- public void callbackY(double y) {
+ @Override
+ public void callbackY_internal(double y) {
this.y = y;
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java
index b13982755..72b424e9e 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/EmptyTile.java
@@ -36,7 +36,6 @@
package net.sourceforge.plantuml.sequencediagram.teoz;
import net.sourceforge.plantuml.Url;
-import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.Participant;
@@ -48,6 +47,7 @@ public class EmptyTile extends AbstractTile implements Tile {
private final Tile position;
public EmptyTile(double height, Tile position) {
+ super(((AbstractTile) position).getStringBounder());
this.height = height;
this.position = position;
}
@@ -55,19 +55,19 @@ public class EmptyTile extends AbstractTile implements Tile {
public void drawU(UGraphic ug) {
}
- public double getPreferredHeight(StringBounder stringBounder) {
+ public double getPreferredHeight() {
return height;
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
}
- public Real getMinX(StringBounder stringBounder) {
- return position.getMinX(stringBounder);
+ public Real getMinX() {
+ return position.getMinX();
}
- public Real getMaxX(StringBounder stringBounder) {
- return position.getMaxX(stringBounder);
+ public Real getMaxX() {
+ return position.getMaxX();
}
public Event getEvent() {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java
index ce5e8f401..c537118d8 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java
@@ -64,8 +64,8 @@ public class Englobers {
pending.add(p);
continue;
}
- pending = Englober.createTeoz(englober, p, tileArguments, tileArguments.getSkinParam()
- .getCurrentStyleBuilder());
+ pending = Englober.createTeoz(englober, p, tileArguments,
+ tileArguments.getSkinParam().getCurrentStyleBuilder());
englobers.add(pending);
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java
index f03da25ce..40bebd6e2 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/EventsHistory.java
@@ -69,7 +69,8 @@ public class EventsHistory {
public int getLevelAt(Event event, EventsHistoryMode mode) {
final int result = getLevelAtInternal(event, mode);
- // System.err.println("EventsHistory::getLevelAt " + mode + " " + result + " " + event);
+ // System.err.println("EventsHistory::getLevelAt " + mode + " " + result + " " +
+ // event);
return result;
}
@@ -181,7 +182,8 @@ public class EventsHistory {
int value = 0;
for (Event event : events) {
final Double position = ys3.get(event);
- // System.err.println("EventsHistory::getStairs event=" + event + " position=" + position);
+ // System.err.println("EventsHistory::getStairs event=" + event + " position=" +
+ // position);
if (position != null) {
assert position <= totalHeight : "position=" + position + " totalHeight=" + totalHeight;
value = getLevelAt(event, EventsHistoryMode.CONSIDERE_FUTURE_DEACTIVATE);
@@ -190,7 +192,8 @@ public class EventsHistory {
activateColor);
}
}
- // System.err.println("EventsHistory::getStairs finishing totalHeight=" + totalHeight);
+ // System.err.println("EventsHistory::getStairs finishing totalHeight=" +
+ // totalHeight);
result.addStep(new StairsPosition(totalHeight, false), value, null);
// System.err.println("EventsHistory::getStairs " + p + " result=" + result);
return result;
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java
index 500f66ab0..b73926b24 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/GroupingTile.java
@@ -59,12 +59,13 @@ import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class GroupingTile extends AbstractTile implements TileWithCallbackY {
+public class GroupingTile extends AbstractTile {
private static final int EXTERNAL_MARGINX1 = 3;
private static final int EXTERNAL_MARGINX2 = 9;
private static final int MARGINX = 16;
- private static final int MARGINY = 10;
+ // private static final int MARGINY = 10;
+ private static final int MARGINY_MAGIC = 20;
private List tiles = new ArrayList();
private final Real min;
private final Real max;
@@ -83,24 +84,27 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
}
@Override
- public double getYPoint(StringBounder stringBounder) {
+ public double getContactPointRelative() {
return 0;
}
- public GroupingTile(Iterator it, GroupingStart start, TileArguments tileArgumentsBachColorChanged,
+ public GroupingTile(Iterator it, GroupingStart start, TileArguments tileArgumentsBackColorChanged,
TileArguments tileArgumentsOriginal) {
+ super(tileArgumentsBackColorChanged.getStringBounder());
final StringBounder stringBounder = tileArgumentsOriginal.getStringBounder();
this.start = start;
this.display = start.getTitle().equals("group") ? Display.create(start.getComment())
: Display.create(start.getTitle(), start.getComment());
this.skin = tileArgumentsOriginal.getSkin();
// this.skinParam = tileArgumentsOriginal.getSkinParam();
- this.skinParam = tileArgumentsBachColorChanged.getSkinParam();
+ this.skinParam = tileArgumentsBackColorChanged.getSkinParam();
final List min2 = new ArrayList();
final List max2 = new ArrayList();
final List allElses = new ArrayList();
+ final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder);
+
while (it.hasNext()) {
final Event ev = it.next();
if (ev instanceof GroupingLeaf && ((Grouping) ev).getType() == GroupingType.END) {
@@ -110,31 +114,31 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
tiles.add(tile);
}
}
- tiles = mergeParallel(tiles);
+
+ tiles = mergeParallel(getStringBounder(), tiles);
+
for (Tile tile : tiles) {
- bodyHeight += tile.getPreferredHeight(stringBounder);
+ bodyHeight += tile.getPreferredHeight();
final Event ev = tile.getEvent();
if (ev instanceof GroupingLeaf && ((Grouping) ev).getType() == GroupingType.ELSE) {
allElses.add(tile);
continue;
}
- min2.add(tile.getMinX(stringBounder).addFixed(-MARGINX));
- final Real m = tile.getMaxX(stringBounder);
+ min2.add(tile.getMinX().addFixed(-MARGINX));
+ final Real m = tile.getMaxX();
// max2.add(m == tileArgumentsOriginal.getOmega() ? m : m.addFixed(MARGINX));
max2.add(m.addFixed(MARGINX));
}
- final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder);
final double width = dim1.getWidth();
if (min2.size() == 0) {
min2.add(tileArgumentsOriginal.getOrigin());
}
this.min = RealUtils.min(min2);
for (Tile anElse : allElses) {
- max2.add(anElse.getMaxX(stringBounder));
+ max2.add(anElse.getMaxX());
}
max2.add(this.min.addFixed(width + 16));
this.max = RealUtils.max(max2);
-
}
private Component getComponent(StringBounder stringBounder) {
@@ -154,36 +158,31 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder);
final Area area = new Area(max.getCurrentValue() - min.getCurrentValue(), getTotalHeight(stringBounder));
- if (ug instanceof LiveBoxFinder == false) {
- comp.drawU(ug.apply(UTranslate.dx(min.getCurrentValue())), area, (Context2D) ug);
- drawAllElses(ug);
- }
- // ug.apply(UChangeBackColor.nnn(HtmlColorUtils.LIGHT_GRAY)).draw(new
- // URectangle(area.getDimensionToUse()));
+ comp.drawU(ug.apply(UTranslate.dx(min.getCurrentValue())), area, (Context2D) ug);
+ drawAllElses(ug);
- double h = dim1.getHeight() + MARGINY / 2;
+ double h = dim1.getHeight() + MARGINY_MAGIC / 2;
for (Tile tile : tiles) {
- ug.apply(UTranslate.dy(h)).draw(tile);
- final double preferredHeight = tile.getPreferredHeight(stringBounder);
+ tile.drawU(ug.apply(UTranslate.dy(h)));
+ final double preferredHeight = tile.getPreferredHeight();
h += preferredHeight;
}
}
private double getTotalHeight(StringBounder stringBounder) {
final Dimension2D dimIfEmpty = getPreferredDimensionIfEmpty(stringBounder);
- return bodyHeight + dimIfEmpty.getHeight() + MARGINY / 2;
+ return bodyHeight + dimIfEmpty.getHeight() + MARGINY_MAGIC / 2;
}
private void drawAllElses(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final double totalHeight = getTotalHeight(stringBounder);
- // final double suppHeight =
- // getPreferredDimensionIfEmpty(stringBounder).getHeight() + MARGINY / 2;
+
final List ys = new ArrayList();
for (Tile tile : tiles) {
if (tile instanceof ElseTile) {
final ElseTile elseTile = (ElseTile) tile;
- ys.add(elseTile.getCallbackY() - y + MARGINY / 2/* suppHeight */);
+ ys.add(elseTile.getCallbackY() - y + MARGINY_MAGIC / 2);
}
}
ys.add(totalHeight);
@@ -199,34 +198,35 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
}
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Dimension2D dim1 = getPreferredDimensionIfEmpty(stringBounder);
- return dim1.getHeight() + bodyHeight + MARGINY;
+ public double getPreferredHeight() {
+ final Dimension2D dim1 = getPreferredDimensionIfEmpty(getStringBounder());
+ return dim1.getHeight() + bodyHeight + MARGINY_MAGIC;
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
for (Tile tile : tiles) {
- tile.addConstraints(stringBounder);
+ tile.addConstraints();
}
}
- public Real getMinX(StringBounder stringBounder) {
+ public Real getMinX() {
return min.addFixed(-EXTERNAL_MARGINX1);
}
- public Real getMaxX(StringBounder stringBounder) {
+ public Real getMaxX() {
return max.addFixed(EXTERNAL_MARGINX2);
}
private double y;
- public void callbackY(double y) {
+ @Override
+ public void callbackY_internal(double y) {
this.y = y;
}
public static double fillPositionelTiles(StringBounder stringBounder, double y, List tiles,
final List local, List full) {
- for (Tile tile : mergeParallel(tiles)) {
+ for (Tile tile : mergeParallel(stringBounder, tiles)) {
final YPositionedTile ytile = new YPositionedTile(tile, y);
local.add(ytile);
full.add(ytile);
@@ -236,7 +236,7 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
final ArrayList local2 = new ArrayList();
fillPositionelTiles(stringBounder, y + headerHeight, groupingTile.tiles, local2, full);
}
- y += tile.getPreferredHeight(stringBounder);
+ y += tile.getPreferredHeight();
}
return y;
@@ -246,14 +246,14 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
return getPreferredDimensionIfEmpty(stringBounder).getHeight() + 10;
}
- private static List mergeParallel(List tiles) {
+ private static List mergeParallel(StringBounder stringBounder, List tiles) {
TileParallel pending = null;
tiles = removeEmptyCloseToParallel(tiles);
final List result = new ArrayList();
for (Tile tile : tiles) {
if (isParallel(tile)) {
if (pending == null) {
- pending = new TileParallel();
+ pending = new TileParallel(stringBounder);
final Tile tmp = result.get(result.size() - 1);
if (tmp instanceof LifeEventTile) {
pending.add(result.get(result.size() - 2));
@@ -293,7 +293,7 @@ public class GroupingTile extends AbstractTile implements TileWithCallbackY {
}
}
- private static boolean isParallel(Tile tile) {
+ public static boolean isParallel(Tile tile) {
return tile instanceof TileParallel == false && tile.getEvent().isParallel();
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java
index 818f19a3a..7e02df7c5 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java
@@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.sequencediagram.teoz;
-import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.HSpace;
@@ -51,6 +50,7 @@ public class HSpaceTile extends AbstractTile implements Tile {
}
public HSpaceTile(HSpace hspace, TileArguments tileArguments) {
+ super(tileArguments.getStringBounder());
this.hspace = hspace;
this.origin = tileArguments.getOrigin();
}
@@ -58,18 +58,18 @@ public class HSpaceTile extends AbstractTile implements Tile {
public void drawU(UGraphic ug) {
}
- public double getPreferredHeight(StringBounder stringBounder) {
+ public double getPreferredHeight() {
return hspace.getPixel();
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
}
- public Real getMinX(StringBounder stringBounder) {
+ public Real getMinX() {
return origin;
}
- public Real getMaxX(StringBounder stringBounder) {
+ public Real getMaxX() {
return origin.addFixed(10);
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java
index 5ed13a66d..ad1bd3613 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java
@@ -38,7 +38,6 @@ package net.sourceforge.plantuml.sequencediagram.teoz;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ISkinParam;
-import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.real.RealUtils;
import net.sourceforge.plantuml.sequencediagram.Event;
@@ -51,7 +50,7 @@ import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class LifeEventTile extends AbstractTile implements TileWithUpdateStairs {
+public class LifeEventTile extends AbstractTile {
private final LifeEvent lifeEvent;
private final TileArguments tileArguments;
@@ -59,22 +58,25 @@ public class LifeEventTile extends AbstractTile implements TileWithUpdateStairs
private final Rose skin;
private final ISkinParam skinParam;
- public void updateStairs(StringBounder stringBounder, double y) {
- // System.err.println("LifeEventTile::updateStairs " + lifeEvent + " " + livingSpace.getParticipant() + " y=" + y);
+ @Override
+ public void callbackY_internal(double y) {
+ // System.err.println("LifeEventTile::updateStairs " + lifeEvent + " " +
+ // livingSpace.getParticipant() + " y=" + y);
livingSpace.addStepForLivebox(getEvent(), y);
}
public Event getEvent() {
return lifeEvent;
}
-
+
@Override
- public double getYPoint(StringBounder stringBounder) {
+ public double getContactPointRelative() {
return 0;
}
public LifeEventTile(LifeEvent lifeEvent, TileArguments tileArguments, LivingSpace livingSpace, Rose skin,
ISkinParam skinParam) {
+ super(tileArguments.getStringBounder());
this.lifeEvent = lifeEvent;
this.tileArguments = tileArguments;
this.livingSpace = livingSpace;
@@ -95,29 +97,30 @@ public class LifeEventTile extends AbstractTile implements TileWithUpdateStairs
return lifeEvent.getMessage() == null && lifeEvent.getType() == LifeEventType.DESTROY;
}
- public double getPreferredHeight(StringBounder stringBounder) {
+ public double getPreferredHeight() {
// if (lifeEvent.isActivate()) {
// return 20;
// }
if (isDestroyWithoutMessage()) {
final Component cross = skin.createComponent(null, ComponentType.DESTROY, null, skinParam, null);
- final Dimension2D dimCross = cross.getPreferredDimension(stringBounder);
+ final Dimension2D dimCross = cross.getPreferredDimension(getStringBounder());
return dimCross.getHeight();
}
return 0;
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
}
- public Real getMinX(StringBounder stringBounder) {
+ public Real getMinX() {
// return tileArguments.getLivingSpace(lifeEvent.getParticipant()).getPosB();
return livingSpace.getPosB();
}
- public Real getMaxX(StringBounder stringBounder) {
- // final LivingSpace livingSpace2 = tileArguments.getLivingSpace(lifeEvent.getParticipant());
- return RealUtils.max(livingSpace.getPosD(stringBounder), livingSpace.getPosC2(stringBounder));
+ public Real getMaxX() {
+ // final LivingSpace livingSpace2 =
+ // tileArguments.getLivingSpace(lifeEvent.getParticipant());
+ return RealUtils.max(livingSpace.getPosD(getStringBounder()), livingSpace.getPosC2(getStringBounder()));
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java
deleted file mode 100644
index 50ef30d5a..000000000
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxFinder.java
+++ /dev/null
@@ -1,127 +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.sequencediagram.teoz;
-
-import net.sourceforge.plantuml.graphic.StringBounder;
-import net.sourceforge.plantuml.ugraphic.UBackground;
-import net.sourceforge.plantuml.ugraphic.UChange;
-import net.sourceforge.plantuml.ugraphic.UGraphic;
-import net.sourceforge.plantuml.ugraphic.UGraphicNo;
-import net.sourceforge.plantuml.ugraphic.UParam;
-import net.sourceforge.plantuml.ugraphic.UParamNull;
-import net.sourceforge.plantuml.ugraphic.UShape;
-import net.sourceforge.plantuml.ugraphic.UStroke;
-import net.sourceforge.plantuml.ugraphic.UTranslate;
-import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
-import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
-import net.sourceforge.plantuml.ugraphic.color.HColor;
-
-public class LiveBoxFinder extends UGraphicNo implements UGraphic {
-
- public boolean matchesProperty(String propertyName) {
- return false;
- }
-
- public double dpiFactor() {
- return 1;
- }
-
- public UGraphic apply(UChange change) {
- if (change instanceof UTranslate) {
- return new LiveBoxFinder(stringBounder, translate.compose((UTranslate) change));
- } else if (change instanceof UStroke) {
- return new LiveBoxFinder(this);
- } else if (change instanceof UBackground) {
- return new LiveBoxFinder(this);
- } else if (change instanceof HColor) {
- return new LiveBoxFinder(this);
- }
- throw new UnsupportedOperationException();
- }
-
- private final StringBounder stringBounder;
- private final UTranslate translate;
-
- public LiveBoxFinder(StringBounder stringBounder) {
- this(stringBounder, new UTranslate());
- }
-
- private LiveBoxFinder(StringBounder stringBounder, UTranslate translate) {
- this.stringBounder = stringBounder;
- this.translate = translate;
- }
-
- private LiveBoxFinder(LiveBoxFinder other) {
- this(other.stringBounder, other.translate);
- }
-
- public StringBounder getStringBounder() {
- return stringBounder;
- }
-
- public UParam getParam() {
- return new UParamNull();
- }
-
- public void draw(UShape shape) {
- final double x = translate.getDx();
- final double y = translate.getDy();
- if (shape instanceof GroupingTile) {
- ((GroupingTile) shape).drawU(this);
- } else if (shape instanceof TileWithUpdateStairs) {
- ((TileWithUpdateStairs) shape).updateStairs(stringBounder, y);
- // } else if (shape instanceof EmptyTile) {
- // // Nothing ?
- // } else if (shape instanceof TileParallel) {
- // // Nothing ?
- // } else if (shape instanceof NotesTile) {
- // // Nothing ?
- // } else if (shape instanceof Tile) {
- // Log.info("OtherTile " + shape);
- } else {
- // Nothing ?
- // throw new UnsupportedOperationException(shape.getClass().getName());
- }
- }
-
- public ColorMapper getColorMapper() {
- return new ColorMapperIdentity();
- }
-
- public void flushUg() {
- }
-
-}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java
index 8f6866133..36e7df992 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LiveBoxesDrawer.java
@@ -68,10 +68,13 @@ public class LiveBoxesDrawer {
private final Collection delays;
public LiveBoxesDrawer(Context2D context, Rose skin, ISkinParam skinParam, Map delays) {
- this.cross = skin.createComponent(new Style[] { ComponentType.DESTROY.getDefaultStyleDefinition()
- .getMergedStyle(skinParam.getCurrentStyleBuilder()) }, ComponentType.DESTROY, null, skinParam, null);
- this.compForWidth = skin.createComponent(new Style[] { ComponentType.ALIVE_BOX_CLOSE_CLOSE
- .getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder()) },
+ this.cross = skin.createComponent(
+ new Style[] { ComponentType.DESTROY.getDefaultStyleDefinition()
+ .getMergedStyle(skinParam.getCurrentStyleBuilder()) },
+ ComponentType.DESTROY, null, skinParam, null);
+ this.compForWidth = skin.createComponent(
+ new Style[] { ComponentType.ALIVE_BOX_CLOSE_CLOSE.getDefaultStyleDefinition()
+ .getMergedStyle(skinParam.getCurrentStyleBuilder()) },
ComponentType.ALIVE_BOX_CLOSE_CLOSE, null, skinParam, null);
this.context = context;
this.skin = skin;
@@ -121,8 +124,8 @@ public class LiveBoxesDrawer {
private void drawInternal(UGraphic ug, StairsPosition yposition, double ya, double yb, ComponentType type) {
final double width = getWidth(ug.getStringBounder());
final Area area = new Area(width, yb - ya);
- ISkinParam skinParam2 = new SkinParamBackcolored(skinParam, symbolContext == null ? null
- : symbolContext.getBackColor());
+ ISkinParam skinParam2 = new SkinParamBackcolored(skinParam,
+ symbolContext == null ? null : symbolContext.getBackColor());
Style style = type.getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
if (style != null) {
style = style.eventuallyOverride(symbolContext);
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/NewpageTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/NewpageTile.java
index 81b72c67a..f287336ee 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/NewpageTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/NewpageTile.java
@@ -35,23 +35,23 @@
*/
package net.sourceforge.plantuml.sequencediagram.teoz;
-import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.sequencediagram.Newpage;
import net.sourceforge.plantuml.ugraphic.UGraphic;
-public class NewpageTile extends AbstractTile implements TileWithCallbackY {
+public class NewpageTile extends AbstractTile {
private final Newpage newpage;
private final TileArguments tileArguments;
@Override
- public double getYPoint(StringBounder stringBounder) {
+ public double getContactPointRelative() {
return 0;
}
public NewpageTile(Newpage newpage, TileArguments tileArguments) {
+ super(tileArguments.getStringBounder());
this.newpage = newpage;
this.tileArguments = tileArguments;
}
@@ -59,24 +59,25 @@ public class NewpageTile extends AbstractTile implements TileWithCallbackY {
public void drawU(UGraphic ug) {
}
- public double getPreferredHeight(StringBounder stringBounder) {
+ public double getPreferredHeight() {
return 0;
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
}
- public Real getMinX(StringBounder stringBounder) {
+ public Real getMinX() {
return tileArguments.getOrigin();
}
- public Real getMaxX(StringBounder stringBounder) {
+ public Real getMaxX() {
return tileArguments.getOrigin();
}
private double y;
- public void callbackY(double y) {
+ @Override
+ public void callbackY_internal(double y) {
this.y = y;
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java
index 17348cc28..12bd884aa 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/NoteTile.java
@@ -66,11 +66,13 @@ public class NoteTile extends AbstractTile implements Tile {
}
@Override
- public double getYPoint(StringBounder stringBounder) {
- return getComponent(stringBounder).getPreferredHeight(stringBounder) / 2;
+ public double getContactPointRelative() {
+ return getComponent(getStringBounder()).getPreferredHeight(getStringBounder()) / 2;
}
- public NoteTile(LivingSpace livingSpace1, LivingSpace livingSpace2, Note note, Rose skin, ISkinParam skinParam) {
+ public NoteTile(StringBounder stringBounder, LivingSpace livingSpace1, LivingSpace livingSpace2, Note note,
+ Rose skin, ISkinParam skinParam) {
+ super(stringBounder);
this.livingSpace1 = livingSpace1;
this.livingSpace2 = livingSpace2;
this.note = note;
@@ -140,20 +142,20 @@ public class NoteTile extends AbstractTile implements Tile {
}
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
return dim.getHeight();
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
// final Component comp = getComponent(stringBounder);
// final Dimension2D dim = comp.getPreferredDimension(stringBounder);
// final double width = dim.getWidth();
}
- public Real getMinX(StringBounder stringBounder) {
- final Real result = getX(stringBounder);
+ public Real getMinX() {
+ final Real result = getX(getStringBounder());
if (note.getPosition() == NotePosition.OVER_SEVERAL) {
final Real x1 = livingSpace1.getPosB();
return RealUtils.min(result, x1);
@@ -161,10 +163,10 @@ public class NoteTile extends AbstractTile implements Tile {
return result;
}
- public Real getMaxX(StringBounder stringBounder) {
- final Real result = getX(stringBounder).addFixed(getUsedWidth(stringBounder));
+ public Real getMaxX() {
+ final Real result = getX(getStringBounder()).addFixed(getUsedWidth(getStringBounder()));
if (note.getPosition() == NotePosition.OVER_SEVERAL) {
- final Real x2 = livingSpace2.getPosD(stringBounder);
+ final Real x2 = livingSpace2.getPosD(getStringBounder());
return RealUtils.max(result, x2);
}
return result;
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java
index e85f37948..9752edc73 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java
@@ -67,7 +67,9 @@ public class NotesTile extends AbstractTile implements Tile {
return notes;
}
- public NotesTile(LivingSpaces livingSpaces, Notes notes, Rose skin, ISkinParam skinParam) {
+ public NotesTile(StringBounder stringBounder, LivingSpaces livingSpaces, Notes notes, Rose skin,
+ ISkinParam skinParam) {
+ super(stringBounder);
this.livingSpaces = livingSpaces;
this.notes = notes;
this.skin = skin;
@@ -138,39 +140,39 @@ public class NotesTile extends AbstractTile implements Tile {
}
}
- public double getPreferredHeight(StringBounder stringBounder) {
+ public double getPreferredHeight() {
double result = 0;
for (Note note : notes) {
- final Component comp = getComponent(stringBounder, note);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ final Component comp = getComponent(getStringBounder(), note);
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
result = Math.max(result, dim.getHeight());
}
return result;
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
final List all = notes.asList();
for (int i = 0; i < all.size() - 1; i++) {
for (int j = i + 1; j < all.size(); j++) {
- final double center1 = getXcenter(stringBounder, all.get(i)).getCurrentValue();
- final double center2 = getXcenter(stringBounder, all.get(j)).getCurrentValue();
+ final double center1 = getXcenter(getStringBounder(), all.get(i)).getCurrentValue();
+ final double center2 = getXcenter(getStringBounder(), all.get(j)).getCurrentValue();
if (center2 > center1) {
- final Real point1b = getX2(stringBounder, all.get(i));
- final Real point2 = getX(stringBounder, all.get(j));
+ final Real point1b = getX2(getStringBounder(), all.get(i));
+ final Real point2 = getX(getStringBounder(), all.get(j));
point2.ensureBiggerThan(point1b);
} else {
- final Real point1 = getX(stringBounder, all.get(i));
- final Real point2b = getX2(stringBounder, all.get(j));
+ final Real point1 = getX(getStringBounder(), all.get(i));
+ final Real point2b = getX2(getStringBounder(), all.get(j));
point1.ensureBiggerThan(point2b);
}
}
}
}
- public Real getMinX(StringBounder stringBounder) {
+ public Real getMinX() {
final List reals = new ArrayList();
for (Note note : notes) {
- reals.add(getX(stringBounder, note));
+ reals.add(getX(getStringBounder(), note));
}
return RealUtils.min(reals);
}
@@ -179,10 +181,10 @@ public class NotesTile extends AbstractTile implements Tile {
return getX(stringBounder, note).addFixed(getUsedWidth(stringBounder, note));
}
- public Real getMaxX(StringBounder stringBounder) {
+ public Real getMaxX() {
final List reals = new ArrayList();
for (Note note : notes) {
- reals.add(getX2(stringBounder, note));
+ reals.add(getX2(getStringBounder(), note));
}
return RealUtils.max(reals);
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java
index 8986a1bc7..1578fc61f 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java
@@ -79,8 +79,8 @@ public class PlayingSpace implements Bordered {
tiles.addAll(TileBuilder.buildSeveral(diagram.events().iterator(), tileArguments, null));
for (Tile tile : tiles) {
- min2.add(tile.getMinX(tileArguments.getStringBounder()));
- max2.add(tile.getMaxX(tileArguments.getStringBounder()));
+ min2.add(tile.getMinX());
+ max2.add(tile.getMaxX());
}
for (LivingSpace livingSpace : livingSpaces.values()) {
@@ -95,10 +95,6 @@ public class PlayingSpace implements Bordered {
}
public void drawBackground(UGraphic ug) {
- final StringBounder stringBounder = ug.getStringBounder();
- final LiveBoxFinder liveBoxFinder = new LiveBoxFinder(stringBounder);
-
- drawUInternal(liveBoxFinder, false);
final UGraphicInterceptorTile interceptor = new UGraphicInterceptorTile(ug, true);
drawUInternal(interceptor, false);
}
@@ -146,9 +142,9 @@ public class PlayingSpace implements Bordered {
return result;
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
for (Tile tile : tiles) {
- tile.addConstraints(stringBounder);
+ tile.addConstraints();
}
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java
index 3c8f800b2..468bbc692 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpaceWithParticipants.java
@@ -72,8 +72,8 @@ public class PlayingSpaceWithParticipants extends AbstractTextBlock implements T
- playingSpace.getMinX(stringBounder).getCurrentValue();
final int factor = playingSpace.isShowFootbox() ? 2 : 1;
- final double height = playingSpace.getPreferredHeight(stringBounder) + factor
- * playingSpace.getLivingSpaces().getHeadHeight(stringBounder);
+ final double height = playingSpace.getPreferredHeight(stringBounder)
+ + factor * playingSpace.getLivingSpaces().getHeadHeight(stringBounder);
cacheDimension = new Dimension2DDouble(width, height);
}
@@ -106,7 +106,8 @@ public class PlayingSpaceWithParticipants extends AbstractTextBlock implements T
playingSpace.drawForeground(ug.apply(UTranslate.dy(headHeight)));
} else {
final UClip clip = new UClip(-1000, ymin, Double.MAX_VALUE, ymax - ymin + 1);
- // playingSpace.drawForeground(new UGraphicNewpages(ug.apply(UTranslate.dy(headHeight)), ymin, ymax));
+ // playingSpace.drawForeground(new
+ // UGraphicNewpages(ug.apply(UTranslate.dy(headHeight)), ymin, ymax));
playingSpace.drawForeground(ug.apply(UTranslate.dy(headHeight)).apply(clip));
}
// drawNewPages(ug.apply(UTranslate.dy(headHeight)));
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java
index 39bb1e6e7..b04a9cf1b 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/ReferenceTile.java
@@ -62,6 +62,7 @@ public class ReferenceTile extends AbstractTile implements Tile {
}
public ReferenceTile(Reference reference, TileArguments tileArguments) {
+ super(tileArguments.getStringBounder());
this.reference = reference;
this.tileArguments = tileArguments;
}
@@ -94,8 +95,8 @@ public class ReferenceTile extends AbstractTile implements Tile {
strings = strings.add("ref");
strings = strings.addAll(reference.getStrings());
- final Component comp = tileArguments.getSkin().createComponent(null, ComponentType.REFERENCE,
- null, tileArguments.getSkinParam(), strings);
+ final Component comp = tileArguments.getSkin().createComponent(null, ComponentType.REFERENCE, null,
+ tileArguments.getSkinParam(), strings);
return comp;
}
@@ -110,22 +111,22 @@ public class ReferenceTile extends AbstractTile implements Tile {
comp.drawU(ug, area, (Context2D) ug);
}
- public double getPreferredHeight(StringBounder stringBounder) {
- final Component comp = getComponent(stringBounder);
- final Dimension2D dim = comp.getPreferredDimension(stringBounder);
+ public double getPreferredHeight() {
+ final Component comp = getComponent(getStringBounder());
+ final Dimension2D dim = comp.getPreferredDimension(getStringBounder());
return dim.getHeight();
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
}
- public Real getMinX(StringBounder stringBounder) {
- init(stringBounder);
+ public Real getMinX() {
+ init(getStringBounder());
return this.first;
}
- public Real getMaxX(StringBounder stringBounder) {
- init(stringBounder);
+ public Real getMaxX() {
+ init(getStringBounder());
return this.last;
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java
index ccbbdfc76..bf25878d4 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java
@@ -227,7 +227,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker {
this.englobers = new Englobers(tileArguments);
final PlayingSpace mainTile = new PlayingSpace(diagram, englobers, tileArguments);
this.livingSpaces.addConstraints(stringBounder);
- mainTile.addConstraints(stringBounder);
+ mainTile.addConstraints();
this.englobers.addConstraints(stringBounder);
origin.compileNow();
tileArguments.setBordered(mainTile);
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java
index b80dff41b..8ec3634bd 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Stairs2.java
@@ -58,7 +58,8 @@ public class Stairs2 {
if (value < 0) {
throw new IllegalArgumentException();
}
- // System.err.println("Stairs2::addStep " + position + " " + value + " color=" + color);
+ // System.err.println("Stairs2::addStep " + position + " " + value + " color=" +
+ // color);
assert ys.size() == values.size();
if (ys.size() > 0) {
final double lastY = ys.get(ys.size() - 1).getValue();
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java
index 447d71c49..e72797b74 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile.java
@@ -35,29 +35,27 @@
*/
package net.sourceforge.plantuml.sequencediagram.teoz;
-import net.sourceforge.plantuml.graphic.StringBounder;
-import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.sequencediagram.Event;
-import net.sourceforge.plantuml.ugraphic.UShape;
-public interface Tile extends UDrawable, UShape {
+public interface Tile extends Tile2 {
- public double getPreferredHeight(StringBounder stringBounder);
+ public double getPreferredHeight();
- public void addConstraints(StringBounder stringBounder);
+ public void callbackY(double y);
- public Real getMinX(StringBounder stringBounder);
+ public void addConstraints();
- public Real getMaxX(StringBounder stringBounder);
+ public Real getMinX();
+
+ public Real getMaxX();
public Event getEvent();
- public double getYPoint(StringBounder stringBounder);
+ public double getContactPointRelative();
+
+ public double getZZZ();
- public double getZ(StringBounder stringBounder);
-
public boolean matchAnchorV1(String anchor);
-
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithCallbackY.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile2.java
similarity index 93%
rename from src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithCallbackY.java
rename to src/net/sourceforge/plantuml/sequencediagram/teoz/Tile2.java
index 2e24e8b76..34f2b39dc 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileWithCallbackY.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Tile2.java
@@ -35,8 +35,8 @@
*/
package net.sourceforge.plantuml.sequencediagram.teoz;
+import net.sourceforge.plantuml.graphic.UDrawable;
-public interface TileWithCallbackY extends Tile {
+public interface Tile2 extends UDrawable {
- public void callbackY(double y);
}
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java
index c658416df..158aefe2f 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileArguments.java
@@ -62,8 +62,8 @@ public class TileArguments implements Bordered {
}
public TileArguments withBackColorGeneral(HColor backColorElement, HColor backColorGeneral) {
- return new TileArguments(stringBounder, livingSpaces, skin, new SkinParamBackcolored(skinParam,
- backColorElement, backColorGeneral), origin);
+ return new TileArguments(stringBounder, livingSpaces, skin,
+ new SkinParamBackcolored(skinParam, backColorElement, backColorGeneral), origin);
}
public TileArguments withBackColor(Reference reference) {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java
index 4c703a64b..cd5d2b693 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java
@@ -68,7 +68,7 @@ public class TileBuilder {
final Event ev = it.next();
for (Tile tile : TileBuilder.buildOne(it, tileArguments, ev, parent)) {
tiles.add(tile);
- final Real tmpMax = tile.getMaxX(tileArguments.getStringBounder());
+ final Real tmpMax = tile.getMaxX();
}
}
return Collections.unmodifiableList(tiles);
@@ -90,29 +90,27 @@ public class TileBuilder {
boolean reverse = false;
Tile result = null;
if (msg.isSelfMessage()) {
- result = new CommunicationTileSelf(livingSpace1, msg, skin, skinParam, livingSpaces);
+ result = new CommunicationTileSelf(tileArguments.getStringBounder(), livingSpace1, msg, skin, skinParam,
+ livingSpaces);
} else {
- // System.err.println("msg=" + msg);
- result = new CommunicationTile(livingSpace1, livingSpace2, msg, skin, skinParam);
+ result = new CommunicationTile(tileArguments.getStringBounder(), livingSpaces, msg, skin, skinParam);
reverse = ((CommunicationTile) result).isReverse(stringBounder);
}
for (Note noteOnMessage : msg.getNoteOnMessages()) {
final NotePosition notePosition = noteOnMessage.getPosition();
if (notePosition == NotePosition.LEFT) {
- result = new CommunicationTileNoteLeft((TileWithUpdateStairs) result, msg, skin, skinParam,
+ result = new CommunicationTileNoteLeft(result, msg, skin, skinParam,
reverse ? livingSpace2 : livingSpace1, noteOnMessage);
} else if (notePosition == NotePosition.RIGHT && msg.isSelfMessage()) {
result = new CommunicationTileSelfNoteRight((CommunicationTileSelf) result, msg, skin, skinParam,
noteOnMessage);
} else if (notePosition == NotePosition.RIGHT) {
- result = new CommunicationTileNoteRight((TileWithUpdateStairs) result, msg, skin, skinParam,
+ result = new CommunicationTileNoteRight(result, msg, skin, skinParam,
reverse ? livingSpace1 : livingSpace2, noteOnMessage);
} else if (notePosition == NotePosition.BOTTOM) {
- result = new CommunicationTileNoteBottom((TileWithUpdateStairs) result, msg, skin, skinParam,
- noteOnMessage);
+ result = new CommunicationTileNoteBottom(result, msg, skin, skinParam, noteOnMessage);
} else if (notePosition == NotePosition.TOP) {
- result = new CommunicationTileNoteTop((TileWithUpdateStairs) result, msg, skin, skinParam,
- noteOnMessage);
+ result = new CommunicationTileNoteTop(result, msg, skin, skinParam, noteOnMessage);
}
}
tiles.add(result);
@@ -124,11 +122,9 @@ public class TileBuilder {
for (Note noteOnMessage : exo.getNoteOnMessages()) {
final NotePosition notePosition = exo.getNoteOnMessages().get(0).getPosition();
if (notePosition == NotePosition.LEFT) {
- result = new CommunicationTileNoteLeft((TileWithUpdateStairs) result, exo, skin, skinParam,
- livingSpace1, noteOnMessage);
+ result = new CommunicationTileNoteLeft(result, exo, skin, skinParam, livingSpace1, noteOnMessage);
} else if (notePosition == NotePosition.RIGHT) {
- result = new CommunicationTileNoteRight((TileWithUpdateStairs) result, exo, skin, skinParam,
- livingSpace1, noteOnMessage);
+ result = new CommunicationTileNoteRight(result, exo, skin, skinParam, livingSpace1, noteOnMessage);
}
}
tiles.add(result);
@@ -140,17 +136,19 @@ public class TileBuilder {
livingSpace1 = tileArguments.getFirstLivingSpace();
livingSpace2 = tileArguments.getLastLivingSpace();
}
- tiles.add(new NoteTile(livingSpace1, livingSpace2, note, skin, skinParam));
+ tiles.add(
+ new NoteTile(tileArguments.getStringBounder(), livingSpace1, livingSpace2, note, skin, skinParam));
} else if (ev instanceof Notes) {
final Notes notes = (Notes) ev;
- tiles.add(new NotesTile(livingSpaces, notes, skin, skinParam));
+ tiles.add(new NotesTile(tileArguments.getStringBounder(), livingSpaces, notes, skin, skinParam));
} else if (ev instanceof Divider) {
final Divider divider = (Divider) ev;
tiles.add(new DividerTile(divider, tileArguments));
} else if (ev instanceof GroupingStart) {
final GroupingStart start = (GroupingStart) ev;
- final GroupingTile groupingTile = new GroupingTile(it, start, tileArguments.withBackColorGeneral(
- start.getBackColorElement(), start.getBackColorGeneral()), tileArguments);
+ final GroupingTile groupingTile = new GroupingTile(it, start,
+ tileArguments.withBackColorGeneral(start.getBackColorElement(), start.getBackColorGeneral()),
+ tileArguments);
tiles.add(new EmptyTile(4, groupingTile));
tiles.add(groupingTile);
tiles.add(new EmptyTile(4, groupingTile));
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileMarged.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileMarged.java
index 00c871317..f797caa1d 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileMarged.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileMarged.java
@@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.sequencediagram.teoz;
-import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.real.Real;
import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@@ -50,6 +49,7 @@ public class TileMarged extends AbstractTile implements Tile {
private final double y2;
public TileMarged(Tile tile, double x1, double x2, double y1, double y2) {
+ super(((AbstractTile) tile).getStringBounder());
this.tile = tile;
this.x1 = x1;
this.x2 = x2;
@@ -62,20 +62,20 @@ public class TileMarged extends AbstractTile implements Tile {
}
- public double getPreferredHeight(StringBounder stringBounder) {
- return tile.getPreferredHeight(stringBounder) + y1 + y2;
+ public double getPreferredHeight() {
+ return tile.getPreferredHeight() + y1 + y2;
}
- public void addConstraints(StringBounder stringBounder) {
- tile.addConstraints(stringBounder);
+ public void addConstraints() {
+ tile.addConstraints();
}
- public Real getMinX(StringBounder stringBounder) {
- return tile.getMinX(stringBounder);
+ public Real getMinX() {
+ return tile.getMinX();
}
- public Real getMaxX(StringBounder stringBounder) {
- return tile.getMaxX(stringBounder).addFixed(x1 + x2);
+ public Real getMaxX() {
+ return tile.getMaxX().addFixed(x1 + x2);
}
public Event getEvent() {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java
index 1f52d07bf..99754facd 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileParallel.java
@@ -47,23 +47,18 @@ import net.sourceforge.plantuml.sequencediagram.Event;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
-public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbackY {
+public class TileParallel extends CommonTile {
+
+ public TileParallel(StringBounder stringBounder) {
+ super(stringBounder);
+ }
private final List tiles = new ArrayList();
- public void callbackY(double y) {
+ @Override
+ public void callbackY_internal(double y) {
for (Tile tile : tiles) {
- if (tile instanceof TileWithCallbackY) {
- ((TileWithCallbackY) tile).callbackY(y);
- }
- }
- }
-
- public void updateStairs(StringBounder stringBounder, double y) {
- for (Tile tile : tiles) {
- if (tile instanceof TileWithUpdateStairs) {
- ((TileWithUpdateStairs) tile).updateStairs(stringBounder, y);
- }
+ tile.callbackY(y);
}
}
@@ -72,44 +67,40 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac
}
public void drawU(UGraphic ug) {
- final StringBounder stringBounder = ug.getStringBounder();
- // final double totalHeight = getPreferredHeight(stringBounder);
- final double yPointAll = getYPoint(stringBounder);
+ final double yPointAll = getContactPointRelative();
for (Tile tile : tiles) {
- final double yPoint = tile.getYPoint(stringBounder);
- // tile.drawU(ug.apply(UTranslate.dy(totalHeight -
- // tile.getPreferredHeight(stringBounder))));
+ final double yPoint = tile.getContactPointRelative();
tile.drawU(ug.apply(UTranslate.dy(yPointAll - yPoint)));
}
}
- public double getYPoint(StringBounder stringBounder) {
+ public double getContactPointRelative() {
double result = 0;
for (Tile tile : tiles) {
- result = Math.max(result, tile.getYPoint(stringBounder));
+ result = Math.max(result, tile.getContactPointRelative());
}
return result;
}
- public double getZ(StringBounder stringBounder) {
+ public double getZZZ() {
double result = 0;
for (Tile tile : tiles) {
- result = Math.max(result, tile.getZ(stringBounder));
+ result = Math.max(result, tile.getZZZ());
}
return result;
}
- public double getPreferredHeight(StringBounder stringBounder) {
- return getYPoint(stringBounder) + getZ(stringBounder);
+ public double getPreferredHeight() {
+ return getContactPointRelative() + getZZZ();
}
- public void addConstraints(StringBounder stringBounder) {
+ public void addConstraints() {
for (Tile tile : tiles) {
- tile.addConstraints(stringBounder);
+ tile.addConstraints();
}
}
- public Real getMinX(final StringBounder stringBounder) {
+ public Real getMinX() {
return RealUtils.min(new AbstractCollection() {
public Iterator iterator() {
return new Iterator() {
@@ -120,7 +111,7 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac
}
public Real next() {
- return source.next().getMinX(stringBounder);
+ return source.next().getMinX();
}
public void remove() {
@@ -135,7 +126,7 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac
});
}
- public Real getMaxX(final StringBounder stringBounder) {
+ public Real getMaxX() {
return RealUtils.max(new AbstractCollection() {
public Iterator iterator() {
return new Iterator() {
@@ -146,7 +137,7 @@ public class TileParallel implements Tile, TileWithUpdateStairs, TileWithCallbac
}
public Real next() {
- return source.next().getMaxX(stringBounder);
+ return source.next().getMaxX();
}
public void remove() {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicInterceptorTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicInterceptorTile.java
index c6149c9cb..15eaf0359 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicInterceptorTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/UGraphicInterceptorTile.java
@@ -42,7 +42,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UShape;
public class UGraphicInterceptorTile extends UGraphicDelegator implements Context2D {
-
+
private final boolean isBackground;
public UGraphicInterceptorTile(UGraphic ug, boolean isBackground) {
diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java
index 391939abb..0089213a4 100644
--- a/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java
+++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/YPositionedTile.java
@@ -35,7 +35,6 @@
*/
package net.sourceforge.plantuml.sequencediagram.teoz;
-import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
@@ -44,16 +43,10 @@ public class YPositionedTile {
private final Tile tile;
private final double y;
- public boolean inArea(double ymin, double ymax) {
- return y >= ymin && y < ymax;
- }
-
public YPositionedTile(Tile tile, double y) {
this.tile = tile;
this.y = y;
- if (tile instanceof TileWithCallbackY) {
- ((TileWithCallbackY) tile).callbackY(y);
- }
+ tile.callbackY(y);
}
@Override
@@ -63,7 +56,7 @@ public class YPositionedTile {
public void drawInArea(UGraphic ug) {
// System.err.println("YPositionedTile::drawU y=" + y + " " + tile);
- ug.apply(UTranslate.dy(y)).draw(tile);
+ tile.drawU(ug.apply(UTranslate.dy(y)));
}
public boolean matchAnchorV2(String anchor) {
@@ -71,14 +64,13 @@ public class YPositionedTile {
return result;
}
- public final double getY(StringBounder stringBounder) {
- final TileWithUpdateStairs communicationTile = (TileWithUpdateStairs) tile;
- return y + communicationTile.getYPoint(stringBounder);
+ public final double getY() {
+ return y + tile.getContactPointRelative();
}
- public double getMiddleX(StringBounder stringBounder) {
- final double max = tile.getMaxX(stringBounder).getCurrentValue();
- final double min = tile.getMinX(stringBounder).getCurrentValue();
+ public double getMiddleX() {
+ final double max = tile.getMaxX().getCurrentValue();
+ final double min = tile.getMinX().getCurrentValue();
return (min + max) / 2;
}
diff --git a/src/net/sourceforge/plantuml/skin/ArrowComponent.java b/src/net/sourceforge/plantuml/skin/ArrowComponent.java
index 758a857ff..7002bdcb6 100644
--- a/src/net/sourceforge/plantuml/skin/ArrowComponent.java
+++ b/src/net/sourceforge/plantuml/skin/ArrowComponent.java
@@ -49,6 +49,8 @@ public interface ArrowComponent extends Component {
double getPaddingY();
public double getYPoint(StringBounder stringBounder);
+
+ public double getPosArrow(StringBounder stringBounder);
}
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java
index aaf5daba0..9dbdc030f 100644
--- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseArrow.java
@@ -103,14 +103,17 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
final double pos1 = start + 1;
final double pos2 = len - 1;
- if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE && dressing2.getHead() == ArrowHead.NONE) {
+ if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE
+ && dressing2.getHead() == ArrowHead.NONE) {
len -= diamCircle / 2;
}
- if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE && dressing2.getHead() != ArrowHead.NONE) {
+ if (getArrowConfiguration().getDecoration2() == ArrowDecoration.CIRCLE
+ && dressing2.getHead() != ArrowHead.NONE) {
len -= diamCircle / 2 + thinCircle;
}
- if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE && dressing1.getHead() == ArrowHead.NONE) {
+ if (getArrowConfiguration().getDecoration1() == ArrowDecoration.CIRCLE
+ && dressing1.getHead() == ArrowHead.NONE) {
start += diamCircle / 2;
len -= diamCircle / 2;
}
@@ -161,12 +164,20 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
- (direction2 == ArrowDirection.LEFT_TO_RIGHT_NORMAL ? getArrowDeltaX() : 0);
} else {
textPos = getMarginX1()
- + (direction2 == ArrowDirection.RIGHT_TO_LEFT_REVERSE
- || direction2 == ArrowDirection.BOTH_DIRECTION ? getArrowDeltaX() : 0);
+ + (direction2 == ArrowDirection.RIGHT_TO_LEFT_REVERSE || direction2 == ArrowDirection.BOTH_DIRECTION
+ ? getArrowDeltaX()
+ : 0);
}
getTextBlock().drawU(ug.apply(new UTranslate(textPos, yText)));
}
+ public double getPosArrow(StringBounder stringBounder) {
+ if (isBelowForResponse()) {
+ return 0;
+ }
+ return getTextHeight(stringBounder) - 2 * getMarginY();
+ }
+
private boolean isBelowForResponse() {
return belowForResponse && getDirection2() == ArrowDirection.RIGHT_TO_LEFT_REVERSE;
}
@@ -192,10 +203,10 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
}
} else if (dressing.getHead() == ArrowHead.CROSSX) {
ug = ug.apply(new UStroke(2));
- ug.apply(new UTranslate(spaceCrossX, -getArrowDeltaX() / 2)).draw(
- new ULine(getArrowDeltaX(), getArrowDeltaX()));
- ug.apply(new UTranslate(spaceCrossX, getArrowDeltaX() / 2)).draw(
- new ULine(getArrowDeltaX(), -getArrowDeltaX()));
+ ug.apply(new UTranslate(spaceCrossX, -getArrowDeltaX() / 2))
+ .draw(new ULine(getArrowDeltaX(), getArrowDeltaX()));
+ ug.apply(new UTranslate(spaceCrossX, getArrowDeltaX() / 2))
+ .draw(new ULine(getArrowDeltaX(), -getArrowDeltaX()));
} else if (dressing.getHead() == ArrowHead.NORMAL) {
final UPolygon polygon = getPolygonReverse(dressing.getPart());
ug.apply(getForegroundColor().bg()).apply(UTranslate.dx(x)).draw(polygon);
@@ -224,10 +235,10 @@ public class ComponentRoseArrow extends AbstractComponentRoseArrow {
}
} else if (dressing.getHead() == ArrowHead.CROSSX) {
ug = ug.apply(new UStroke(2));
- ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), -getArrowDeltaX() / 2)).draw(
- new ULine(getArrowDeltaX(), getArrowDeltaX()));
- ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), getArrowDeltaX() / 2)).draw(
- new ULine(getArrowDeltaX(), -getArrowDeltaX()));
+ ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), -getArrowDeltaX() / 2))
+ .draw(new ULine(getArrowDeltaX(), getArrowDeltaX()));
+ ug.apply(new UTranslate(x - spaceCrossX - getArrowDeltaX(), getArrowDeltaX() / 2))
+ .draw(new ULine(getArrowDeltaX(), -getArrowDeltaX()));
ug = ug.apply(new UStroke());
} else if (dressing.getHead() == ArrowHead.NORMAL) {
final UPolygon polygon = getPolygonNormal(dressing.getPart(), x);
diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java
index 276698081..4f6f59070 100644
--- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java
+++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseSelfArrow.java
@@ -194,5 +194,10 @@ public class ComponentRoseSelfArrow extends AbstractComponentRoseArrow {
public double getPreferredWidth(StringBounder stringBounder) {
return Math.max(getTextWidth(stringBounder), arrowWidth);
}
+
+ public double getPosArrow(StringBounder stringBounder) {
+ throw new UnsupportedOperationException();
+ }
+
}
diff --git a/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java b/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java
index bc704d1eb..c5c7b1923 100644
--- a/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java
+++ b/src/net/sourceforge/plantuml/statediagram/command/CommandAddField.java
@@ -47,6 +47,7 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.statediagram.StateDiagram;
+import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
public class CommandAddField extends SingleLineCommand2 {
@@ -66,7 +67,7 @@ public class CommandAddField extends SingleLineCommand2 {
}
@Override
- protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) {
+ protected CommandExecutionResult executeArg(StateDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final String codeString = arg.getLazzy("CODE", 0);
final String field = arg.get("FIELD", 0);
diff --git a/src/net/sourceforge/plantuml/style/SName.java b/src/net/sourceforge/plantuml/style/SName.java
index 53e5c5f2d..52d8b683e 100644
--- a/src/net/sourceforge/plantuml/style/SName.java
+++ b/src/net/sourceforge/plantuml/style/SName.java
@@ -105,7 +105,8 @@ public enum SName {
task, //
title, //
usecase, //
- wbsDiagram; //
+ wbsDiagram, //
+ yamlDiagram; //
public static String depth(int level) {
return "depth(" + level + ")";
diff --git a/src/net/sourceforge/plantuml/style/StyleSignature.java b/src/net/sourceforge/plantuml/style/StyleSignature.java
index 7e572fb59..4c89bb442 100644
--- a/src/net/sourceforge/plantuml/style/StyleSignature.java
+++ b/src/net/sourceforge/plantuml/style/StyleSignature.java
@@ -90,6 +90,10 @@ public class StyleSignature {
return new StyleSignature(result);
}
+ public StyleSignature add(SName name) {
+ return add(name.name().toLowerCase().replace("_", ""));
+ }
+
public StyleSignature addStar() {
final Set result = new HashSet(names);
result.add("*");
diff --git a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java
index 515c60235..86dbd8758 100644
--- a/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java
+++ b/src/net/sourceforge/plantuml/svek/extremity/MiddleCircleCircled.java
@@ -42,7 +42,7 @@ import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UStroke;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
-import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
+import net.sourceforge.plantuml.ugraphic.color.HColorNone;
class MiddleCircleCircled extends Extremity {
@@ -80,11 +80,11 @@ class MiddleCircleCircled extends Extremity {
final double d = 0;
if (mode == MiddleCircleCircledMode.MODE1 || mode == MiddleCircleCircledMode.BOTH) {
final UEllipse arc1 = new UEllipse(2 * radius2, 2 * radius2, angle, 90);
- ug.apply(new UTranslate(-radius2 + d, -radius2 + d)).draw(arc1);
+ ug.apply(new HColorNone().bg()).apply(new UTranslate(-radius2 + d, -radius2 + d)).draw(arc1);
}
if (mode == MiddleCircleCircledMode.MODE2 || mode == MiddleCircleCircledMode.BOTH) {
final UEllipse arc2 = new UEllipse(2 * radius2, 2 * radius2, angle + 180, 90);
- ug.apply(new UTranslate(-radius2 + d, -radius2 + d)).draw(arc2);
+ ug.apply(new HColorNone().bg()).apply(new UTranslate(-radius2 + d, -radius2 + d)).draw(arc2);
}
ug.apply(new UTranslate(-radius1, -radius1)).draw(circle);
}
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
index 18c3e38d0..6b15ebf03 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageDescription.java
@@ -200,8 +200,8 @@ public class EntityImageDescription extends AbstractEntityImage {
HorizontalAlignment.CENTER, getSkinParam());
}
- name = BodyFactory.create2(codeDisplay, symbol.getFontParam(), getSkinParam(), HorizontalAlignment.CENTER,
- stereotype, entity, style);
+ name = BodyFactory.create2(skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), codeDisplay,
+ symbol.getFontParam(), getSkinParam(), stereotype, entity, style);
if (hideText) {
asSmall = symbol.asSmall(TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java
index b26e27463..48a9f2984 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageLollipopInterfaceEye2.java
@@ -85,8 +85,9 @@ public class EntityImageLollipopInterfaceEye2 extends AbstractEntityImage {
throw new IllegalArgumentException();
}
- this.desc = BodyFactory.create2(entity.getDisplay(), symbol.getFontParam(), skinParam,
- HorizontalAlignment.CENTER, stereotype, entity, getStyle(symbol.getFontParam()));
+ this.desc = BodyFactory.create2(skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER),
+ entity.getDisplay(), symbol.getFontParam(), skinParam, stereotype, entity,
+ getStyle(symbol.getFontParam()));
this.url = entity.getUrl99();
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java
index 04ffbfda4..adf31d6c4 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageState2.java
@@ -94,8 +94,9 @@ public class EntityImageState2 extends AbstractEntityImage {
this.url = entity.getUrl99();
TextBlock stereo = TextBlockUtils.empty(0, 0);
- final TextBlock desc = BodyFactory.create2(entity.getDisplay(), symbol.getFontParam(), skinParam,
- HorizontalAlignment.CENTER, stereotype, entity, getStyle(symbol.getFontParam()));
+ final TextBlock desc = BodyFactory.create2(skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER),
+ entity.getDisplay(), symbol.getFontParam(), skinParam, stereotype, entity,
+ getStyle(symbol.getFontParam()));
asSmall = symbol.asSmall(null, desc, stereo, ctx, skinParam.getStereotypeAlignment());
diff --git a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java
index e739855dd..4887d3ab0 100644
--- a/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java
+++ b/src/net/sourceforge/plantuml/svek/image/EntityImageUseCase.java
@@ -5,12 +5,12 @@
* (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
@@ -30,7 +30,7 @@
*
*
* Original Author: Arnaud Roques
- *
+ *
*
*/
package net.sourceforge.plantuml.svek.image;
@@ -87,8 +87,15 @@ public class EntityImageUseCase extends AbstractEntityImage {
super(entity, skinParam);
final Stereotype stereotype = entity.getStereotype();
- final TextBlock tmp = BodyFactory.create2(entity.getDisplay(), FontParam.USECASE, skinParam,
- HorizontalAlignment.CENTER, stereotype, entity, getStyle());
+ final HorizontalAlignment align;
+ if (UseStyle.useBetaStyle()) {
+ final Style style = getStyle();
+ align = style.getHorizontalAlignment();
+ } else {
+ align = HorizontalAlignment.CENTER;
+ }
+ final TextBlock tmp = BodyFactory.create2(skinParam.getDefaultTextAlignment(align), entity.getDisplay(),
+ FontParam.USECASE, skinParam, stereotype, entity, getStyle());
if (stereotype == null || stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR) == null
|| portionShower.showPortion(EntityPortion.STEREOTYPE, entity) == false) {
diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java
index d8d00d6c6..ecbaabe8f 100644
--- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java
+++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java
@@ -5,12 +5,12 @@
* (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
@@ -30,7 +30,7 @@
*
*
* Original Author: Arnaud Roques
- *
+ *
*
*/
package net.sourceforge.plantuml.svg;
@@ -40,6 +40,7 @@ import java.awt.geom.PathIterator;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
@@ -64,6 +65,7 @@ import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
+import net.sourceforge.plantuml.FileUtils;
import net.sourceforge.plantuml.Log;
import net.sourceforge.plantuml.SignatureUtils;
import net.sourceforge.plantuml.code.Base64Coder;
@@ -159,9 +161,15 @@ public class SvgGraphics {
defs.appendChild(getPathHover(hover));
}
- // Add styles and script for interactive SVG
- defs.appendChild(getStylesForInteractiveMode());
- defs.appendChild(getScriptForInteractiveMode());
+ final Element styles = getStylesForInteractiveMode();
+ if (styles != null) {
+ defs.appendChild(styles);
+ }
+
+ final Element script = getScriptForInteractiveMode();
+ if (script != null) {
+ defs.appendChild(script);
+ }
} catch (ParserConfigurationException e) {
e.printStackTrace();
throw new IllegalStateException(e);
@@ -170,11 +178,11 @@ public class SvgGraphics {
private Element getStylesForInteractiveMode() {
final Element style = simpleElement("style");
- final CDATASection cdata = document.createCDATASection(
- ".elem {cursor: pointer;} " + "\n" +
- ".elem, .link {opacity: 0.3;}" + "\n" +
- ".elem.selected, .link.selected {opacity: 1;}"
- );
+ final String text = getData("default.css");
+ if (text == null) {
+ return null;
+ }
+ final CDATASection cdata = document.createCDATASection(text);
style.setAttribute("type", "text/css");
style.appendChild(cdata);
return style;
@@ -182,121 +190,24 @@ public class SvgGraphics {
private Element getScriptForInteractiveMode() {
final Element script = document.createElement("script");
- script.setTextContent(
- "function addItemToMapOfLists(mapOfLists, name, item) {" + "\n" +
- " // mapOfLists = {" + "\n" +
- " // 'key1': [item1, item2, ...]," + "\n" +
- " // 'key2': [item3, item4, ...]," + "\n" +
- " // }" + "\n" +
- " if (mapOfLists[name].length > 0) {" + "\n" +
- " if (!mapOfLists[name].includes(item)) {" + "\n" +
- " mapOfLists[name].push(item);" + "\n" +
- " }" + "\n" +
- " } else {" + "\n" +
- " mapOfLists[name] = [item];" + "\n" +
- " }" + "\n" +
- "}" + "\n" +
- "" + "\n" +
- "function main() {" + "\n" +
- " let elems = Array.from(document.getElementsByClassName('elem'));" + "\n" +
- " let links = Array.from(document.getElementsByClassName('link'));" + "\n" +
- "" + "\n" +
- " let elemsMap = {};" + "\n" +
- " let linkedElems = {};" + "\n" +
- " let linkedLinks = {};" + "\n" +
- "" + "\n" +
- " elems.forEach(elem => {" + "\n" +
- " let name = elem.classList[1];" + "\n" +
- " elemsMap[name] = elem;" + "\n" +
- " linkedElems[name] = [];" + "\n" +
- " linkedLinks[name] = [];" + "\n" +
- " });" + "\n" +
- "" + "\n" +
- " links.forEach(link => {" + "\n" +
- " if (elemsMap[name1]) {" + "\n" +
- " if (elemsMap[name2]) {" + "\n" +
- " let name1 = link.classList[1];" + "\n" +
- " let name2 = link.classList[2];" + "\n" +
- "" + "\n" +
- " let elem1 = elemsMap[name1];" + "\n" +
- " let elem2 = elemsMap[name2];" + "\n" +
- "" + "\n" +
- " addItemToMapOfLists(linkedElems, name1, elem2);" + "\n" +
- " addItemToMapOfLists(linkedElems, name2, elem1);" + "\n" +
- "" + "\n" +
- " addItemToMapOfLists(linkedLinks, name1, link);" + "\n" +
- " addItemToMapOfLists(linkedLinks, name2, link);" + "\n" +
- " }" + "\n" +
- " }" + "\n" +
- " });" + "\n" +
- "" + "\n" +
- " let selectedElems = [];" + "\n" +
- " let selectedLinks = [];" + "\n" +
- " let selectedElemName = null;" + "\n" +
- "" + "\n" +
- " function clearSelected() {" + "\n" +
- " selectedElems.forEach(item => {" + "\n" +
- " item.classList.remove('selected');" + "\n" +
- " });" + "\n" +
- " selectedElems = [];" + "\n" +
- "" + "\n" +
- " selectedLinks.forEach(item => {" + "\n" +
- " item.classList.remove('selected');" + "\n" +
- " });" + "\n" +
- " selectedLinks = [];" + "\n" +
- " }" + "\n" +
- "" + "\n" +
- " function selectAll() {" + "\n" +
- " selectedElemName = null;" + "\n" +
- "" + "\n" +
- " selectedElems = Array.from(elems);" + "\n" +
- " selectedElems.forEach(item => {" + "\n" +
- " item.classList.add('selected');" + "\n" +
- " });" + "\n" +
- "" + "\n" +
- " selectedLinks = Array.from(links);" + "\n" +
- " selectedLinks.forEach(item => {" + "\n" +
- " item.classList.add('selected');" + "\n" +
- " });" + "\n" +
- " }" + "\n" +
- "" + "\n" +
- " function selectElem(elemName) {" + "\n" +
- " if (elemName === selectedElemName) {" + "\n" +
- " selectAll();" + "\n" +
- "" + "\n" +
- " } else {" + "\n" +
- " clearSelected();" + "\n" +
- " selectedElemName = elemName;" + "\n" +
- "" + "\n" +
- " elemsMap[elemName].classList.add('selected');" + "\n" +
- " selectedElems.push(elemsMap[elemName]);" + "\n" +
- "" + "\n" +
- " linkedElems[elemName].forEach(linkedElem => {" + "\n" +
- " selectedElems.push(linkedElem);" + "\n" +
- " linkedElem.classList.add('selected');" + "\n" +
- " });" + "\n" +
- "" + "\n" +
- " linkedLinks[elemName].forEach(linkedLink => {" + "\n" +
- " selectedLinks.push(linkedLink);" + "\n" +
- " linkedLink.classList.add('selected');" + "\n" +
- " });" + "\n" +
- " }" + "\n" +
- " }" + "\n" +
- "" + "\n" +
- " Object.keys(elemsMap).forEach(name => {" + "\n" +
- " elemsMap[name].onclick = () => { selectElem(name); };" + "\n" +
- " });" + "\n" +
- "" + "\n" +
- " selectAll();" + "\n" +
- "}" + "\n" +
- "" + "\n" +
- "document.addEventListener('DOMContentLoaded', (event) => {" + "\n" +
- " main();" + "\n" +
- "});"
- );
+ final String text = getData("default.js");
+ if (text == null) {
+ return null;
+ }
+ script.setTextContent(text);
return script;
}
+ private static String getData(final String name) {
+ try {
+ final InputStream is = SvgGraphics.class.getResourceAsStream("/svg/" + name);
+ return FileUtils.readText(is);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
private Element getPathHover(String hover) {
final Element style = simpleElement("style");
final CDATASection cdata = document.createCDATASection("path:hover { stroke: " + hover + " !important;}");
@@ -1066,6 +977,7 @@ public class SvgGraphics {
}
public void startGroupWithClass(String groupClasses) {
+
pendingAction.add(0, (Element) document.createElement("g"));
pendingAction.get(0).setAttribute("class", groupClasses);
}
diff --git a/src/net/sourceforge/plantuml/tim/TContext.java b/src/net/sourceforge/plantuml/tim/TContext.java
index e263c4970..585158bf9 100644
--- a/src/net/sourceforge/plantuml/tim/TContext.java
+++ b/src/net/sourceforge/plantuml/tim/TContext.java
@@ -50,7 +50,6 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.json.Json;
-import net.sourceforge.plantuml.json.JsonObject;
import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.preproc.Defines;
import net.sourceforge.plantuml.preproc.FileWithSuffix;
@@ -197,17 +196,6 @@ public class TContext {
}
}
- private TValue fromJsonOld(TMemory memory, String name) {
- final int x = name.indexOf('.');
- final TValue data = memory.getVariable(name.substring(0, x));
- if (data == null) {
- return null;
- }
- final JsonObject json = (JsonObject) data.toJson();
- final JsonValue result = json.get(name.substring(x + 1));
- return TValue.fromJson(result);
- }
-
private CodeIterator buildCodeIterator(TMemory memory, List body) {
final CodeIterator it10 = new CodeIteratorImpl(body);
final CodeIterator it20 = new CodeIteratorLongComment(it10, debug);
@@ -498,9 +486,13 @@ public class TContext {
if (reader == null) {
throw EaterException.located("cannot include " + location);
}
- ReadLine readerline = ReadLineReader.create(reader, location, s.getLocation());
- readerline = new UncommentReadLine(readerline);
- sub = Sub.fromFile(readerline, blocname, this, memory);
+ try {
+ ReadLine readerline = ReadLineReader.create(reader, location, s.getLocation());
+ readerline = new UncommentReadLine(readerline);
+ sub = Sub.fromFile(readerline, blocname, this, memory);
+ } finally {
+ reader.close();
+ }
}
} catch (IOException e) {
e.printStackTrace();
@@ -526,7 +518,7 @@ public class TContext {
include.analyze(this, memory);
final String definitionName = include.getLocation();
final List definition = definitionsContainer.getDefinition(definitionName);
- ReadLine reader2 = new ReadLineList(definition, s.getLocation());
+ final ReadLine reader2 = new ReadLineList(definition, s.getLocation());
try {
final List body = new ArrayList();
@@ -541,6 +533,12 @@ public class TContext {
} catch (IOException e) {
e.printStackTrace();
throw EaterException.located("" + e);
+ } finally {
+ try {
+ reader2.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
}
}
@@ -565,9 +563,7 @@ public class TContext {
throw EaterException.located("Cannot open URL");
}
reader2 = PreprocessorUtils.getReaderIncludeUrl2(url, s, suf, charset);
-
- }
- if (location.startsWith("<") && location.endsWith(">")) {
+ } else if (location.startsWith("<") && location.endsWith(">")) {
reader2 = PreprocessorUtils.getReaderStdlibInclude(s, location.substring(1, location.length() - 1));
} else {
final FileWithSuffix f2 = importedFiles.getFile(location, suf);
@@ -614,6 +610,14 @@ public class TContext {
} catch (IOException e) {
e.printStackTrace();
throw EaterException.located("cannot include " + e);
+ } finally {
+ if (reader2 != null) {
+ try {
+ reader2.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
}
throw EaterException.located("cannot include " + location);
diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java
index 137b1984b..40a8091ab 100644
--- a/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java
+++ b/src/net/sourceforge/plantuml/timingdiagram/TimingRuler.java
@@ -37,6 +37,8 @@ package net.sourceforge.plantuml.timingdiagram;
import java.awt.geom.Dimension2D;
import java.math.BigDecimal;
import java.util.Collection;
+import java.util.Comparator;
+import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -76,6 +78,9 @@ public class TimingRuler {
if (times.size() == 0) {
this.times.add(new TimeTick(BigDecimal.ZERO, TimingFormat.DECIMAL));
}
+ if (getMax().getTime().signum() > 0 && getMin().getTime().signum() < 0) {
+ this.times.add(new TimeTick(BigDecimal.ZERO, TimingFormat.DECIMAL));
+ }
}
public TimingRuler(ISkinParam skinParam) {
@@ -99,22 +104,39 @@ public class TimingRuler {
private long highestCommonFactor() {
if (highestCommonFactorInternal == -1) {
- for (TimeTick time : times) {
- long tick = time.getTime().longValue();
- if (tick > 0) {
- if (highestCommonFactorInternal == -1) {
- highestCommonFactorInternal = time.getTime().longValue();
- } else {
- highestCommonFactorInternal = computeHighestCommonFactor(highestCommonFactorInternal,
- Math.abs(time.getTime().longValue()));
+ for (long tick : getAbsolutesTicks()) {
+ if (highestCommonFactorInternal == -1) {
+ highestCommonFactorInternal = tick;
+ } else {
+ final long candidate = computeHighestCommonFactor(highestCommonFactorInternal, tick);
+ final double size = (getMax().getTime().doubleValue() - getMin().getTime().doubleValue())
+ / candidate;
+ if (size > 200) {
+ return highestCommonFactorInternal;
}
+ highestCommonFactorInternal = candidate;
}
}
}
return highestCommonFactorInternal;
}
- private int getNbTick(boolean capped) {
+ private Set getAbsolutesTicks() {
+ final Set result = new TreeSet(new Comparator() {
+ public int compare(Long o1, Long o2) {
+ return o2.compareTo(o1);
+ }
+ });
+ for (TimeTick time : times) {
+ final long value = Math.abs(time.getTime().longValue());
+ if (value > 0) {
+ result.add(value);
+ }
+ }
+ return result;
+ }
+
+ private int getNbTick() {
if (times.size() == 0) {
return 1;
}
@@ -123,7 +145,9 @@ public class TimingRuler {
}
public double getWidth() {
- return getNbTick(false) * tickIntervalInPixels;
+ final double delta = getMax().getTime().doubleValue() - getMin().getTime().doubleValue();
+
+ return (delta / tickUnitary() + 1) * tickIntervalInPixels;
}
public final double getPosInPixel(TimeTick when) {
@@ -160,11 +184,13 @@ public class TimingRuler {
ug = ug.apply(new UStroke(2.0)).apply(HColorUtils.BLACK);
final double tickHeight = 5;
final ULine line = ULine.vline(tickHeight);
- final int nb = getNbTick(true);
- for (int i = 0; i <= nb; i++) {
- ug.apply(UTranslate.dx(tickIntervalInPixels * i)).draw(line);
+ final double firstTickPosition = getPosInPixelInternal(getFirstPositiveOrZeroValue().doubleValue());
+ int nb = 0;
+ while (firstTickPosition + nb * tickIntervalInPixels <= getWidth()) {
+ ug.apply(UTranslate.dx(firstTickPosition + nb * tickIntervalInPixels)).draw(line);
+ nb++;
}
- ug.draw(ULine.hline(nb * tickIntervalInPixels));
+ ug.apply(UTranslate.dx(firstTickPosition)).draw(ULine.hline((nb - 1) * tickIntervalInPixels));
for (long round : roundValues()) {
final TextBlock text = getTimeTextBlock(round);
@@ -173,6 +199,15 @@ public class TimingRuler {
}
}
+ private BigDecimal getFirstPositiveOrZeroValue() {
+ for (TimeTick time : times) {
+ if (time.getTime().signum() >= 0) {
+ return time.getTime();
+ }
+ }
+ throw new IllegalStateException();
+ }
+
private Collection roundValues() {
final SortedSet result = new TreeSet();
if (tickUnitary == 0) {
@@ -181,7 +216,7 @@ public class TimingRuler {
result.add(round);
}
} else {
- final int nb = getNbTick(true);
+ final int nb = getNbTick();
for (int i = 0; i <= nb; i++) {
final long round = tickToTime(i);
result.add(round);
@@ -196,7 +231,7 @@ public class TimingRuler {
public void drawVlines(UGraphic ug, double height) {
ug = applyForVLines(ug);
final ULine line = ULine.vline(height);
- final int nb = getNbTick(true);
+ final int nb = getNbTick();
for (int i = 0; i <= nb; i++) {
ug.apply(UTranslate.dx(tickIntervalInPixels * i)).draw(line);
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java b/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java
index 6149ecefe..5a8c62885 100644
--- a/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java
+++ b/src/net/sourceforge/plantuml/ugraphic/AbstractCommonUGraphic.java
@@ -172,10 +172,11 @@ public abstract class AbstractCommonUGraphic implements UGraphic {
public void startGroup(String groupId) {
}
-
+
public void startGroupWithClass(String groupClasses) {
}
+
public void closeGroup() {
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2Right.java b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2Right.java
new file mode 100644
index 000000000..b2eae23a9
--- /dev/null
+++ b/src/net/sourceforge/plantuml/ugraphic/PlacementStrategyY1Y2Right.java
@@ -0,0 +1,66 @@
+/* ========================================================================
+ * 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.ugraphic;
+
+import java.awt.geom.Dimension2D;
+import java.awt.geom.Point2D;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import net.sourceforge.plantuml.graphic.StringBounder;
+import net.sourceforge.plantuml.graphic.TextBlock;
+
+public class PlacementStrategyY1Y2Right extends AbstractPlacementStrategy {
+
+ public PlacementStrategyY1Y2Right(StringBounder stringBounder) {
+ super(stringBounder);
+ }
+
+ public Map getPositions(double width, double height) {
+ final double usedHeight = getSumHeight();
+
+ final double space = (height - usedHeight) / (getDimensions().size() + 1);
+ final Map result = new LinkedHashMap();
+ double y = space;
+ for (Map.Entry ent : getDimensions().entrySet()) {
+ final double x = width - ent.getValue().getWidth();
+ result.put(ent.getKey(), new Point2D.Double(x, y));
+ y += ent.getValue().getHeight() + space;
+ }
+ return result;
+ }
+
+}
diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverEllipseSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverEllipseSvg.java
index 0e9440d41..dc62aa8a5 100644
--- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverEllipseSvg.java
+++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverEllipseSvg.java
@@ -76,7 +76,7 @@ public class DriverEllipseSvg implements UDriver {
gr.getPolicy());
svg.setFillColor("url(#" + id + ")");
} else if (back == null || back instanceof HColorBackground) {
- svg.setFillColor("none");
+ svg.setFillColor("#00000000");
} else {
final String backcolor = mapper.toSvg(back);
svg.setFillColor(backcolor);
diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java
index 1ff12319c..1d970e3af 100644
--- a/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java
+++ b/src/net/sourceforge/plantuml/ugraphic/svg/DriverTextSvg.java
@@ -87,7 +87,8 @@ public class DriverTextSvg implements UDriver {
} else if (fontConfiguration.containsStyle(FontStyle.STRIKE)) {
textDecoration = "line-through";
} else if (fontConfiguration.containsStyle(FontStyle.WAVE)) {
- // Beware that some current SVG implementations do not render the wave properly (e.g. Chrome just draws a straight line)
+ // Beware that some current SVG implementations do not render the wave properly
+ // (e.g. Chrome just draws a straight line)
// Works ok on Firefox 85.
textDecoration = "wavy underline";
}
diff --git a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java
index 794d66f68..fb2838d19 100644
--- a/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java
+++ b/src/net/sourceforge/plantuml/ugraphic/svg/UGraphicSvg.java
@@ -179,12 +179,13 @@ public class UGraphicSvg extends AbstractUGraphic implements ClipCo
public void startGroup(String groupId) {
getGraphicObject().startGroup(groupId);
}
-
+
@Override
public void startGroupWithClass(String groupClasses) {
getGraphicObject().startGroupWithClass(groupClasses);
}
+
@Override
public void closeGroup() {
getGraphicObject().closeGroup();
diff --git a/src/net/sourceforge/plantuml/version/LicenseInfo.java b/src/net/sourceforge/plantuml/version/LicenseInfo.java
index 695d35eb9..33103540c 100644
--- a/src/net/sourceforge/plantuml/version/LicenseInfo.java
+++ b/src/net/sourceforge/plantuml/version/LicenseInfo.java
@@ -217,13 +217,16 @@ public class LicenseInfo {
if (br == null) {
return null;
}
- final String s = br.readLine();
- br.close();
- final LicenseInfo result = retrieveNamed(s);
- if (result != null) {
- Log.info("Reading license from " + f.getAbsolutePath());
+ try {
+ final String s = br.readLine();
+ final LicenseInfo result = retrieveNamed(s);
+ if (result != null) {
+ Log.info("Reading license from " + f.getAbsolutePath());
+ }
+ return result;
+ } finally {
+ br.close();
}
- return result;
}
public static void main(String[] args) {
diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java
index 0777873f7..3d8667921 100644
--- a/src/net/sourceforge/plantuml/version/Version.java
+++ b/src/net/sourceforge/plantuml/version/Version.java
@@ -68,7 +68,7 @@ public class Version {
private static String dotted(int nb) {
final String minor = "" + nb % MAJOR_SEPARATOR;
final String major = "" + nb / MAJOR_SEPARATOR;
- return major + "." + minor.substring(0, 4) + "." + minor.substring(4);
+ return major + "." + minor.substring(0, 4) + "." + Integer.parseInt(minor.substring(4));
}
public static String versionString(int size) {
@@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
- final int beta = 0;
+ final int beta = 11;
return beta;
}
diff --git a/src/net/sourceforge/plantuml/yaml/SimpleYamlParser.java b/src/net/sourceforge/plantuml/yaml/SimpleYamlParser.java
index f9c630c32..0667e5ba6 100644
--- a/src/net/sourceforge/plantuml/yaml/SimpleYamlParser.java
+++ b/src/net/sourceforge/plantuml/yaml/SimpleYamlParser.java
@@ -42,65 +42,28 @@ import java.util.regex.Pattern;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.json.JsonArray;
import net.sourceforge.plantuml.json.JsonObject;
+import net.sourceforge.plantuml.json.JsonString;
import net.sourceforge.plantuml.json.JsonValue;
public class SimpleYamlParser {
- private static final String KEY = "([_0-9\\w][- _0-9\\w./]*)";
-
- private JsonObject result;
+ private JsonValue result;
private final List pendingIndents = new ArrayList();
- public JsonObject parse(List lines) {
- List tmp = new ArrayList();
- for (String s : lines) {
- if (s.trim().length() == 0)
- continue;
- if (s.trim().startsWith("#"))
- continue;
- tmp.add(s);
- }
- tmp = mergeMultiline(tmp);
+ public JsonValue parse(List lines) {
result = new JsonObject();
pendingIndents.clear();
pendingIndents.add(0);
- for (String s : tmp) {
+ final YamlLines yamlLines = new YamlLines(lines);
+ for (String s : yamlLines) {
parseSingleLine(s);
}
return result;
}
- private List mergeMultiline(List tmp) {
- final List result = new ArrayList();
- for (int i = 0; i < tmp.size(); i++) {
- if (nameOnly(tmp.get(i)) != null && textOnly(tmp.get(i + 1))) {
- final StringBuilder sb = new StringBuilder(tmp.get(i));
- while (textOnly(tmp.get(i + 1))) {
- sb.append(" " + tmp.get(i + 1).trim());
- i++;
- }
- result.add(sb.toString());
- } else {
- result.add(tmp.get(i));
- }
- }
- return result;
- }
-
- private String[] dashNameAndValue(String s) {
- final Pattern p1 = Pattern.compile("^\\s*[-]\\s*" + KEY + "\\s*:\\s*(\\S.*)$");
- final Matcher m1 = p1.matcher(s);
- if (m1.matches()) {
- final String name = m1.group(1);
- final String data = m1.group(2).trim();
- return new String[] { name, data };
- }
- return null;
- }
-
private String[] nameAndValue(String s) {
- final Pattern p1 = Pattern.compile("^\\s*" + KEY + "\\s*:\\s*(\\S.*)$");
+ final Pattern p1 = Pattern.compile("^\\s*" + YamlLines.KEY + "\\s*: \\s*(\\S.*)$");
final Matcher m1 = p1.matcher(s);
if (m1.matches()) {
final String name = m1.group(1);
@@ -110,45 +73,12 @@ public class SimpleYamlParser {
return null;
}
- private String nameOnly(String s) {
- final Pattern p1 = Pattern.compile("^\\s*" + KEY + "\\s*:\\s*\\|?\\s*$");
- final Matcher m1 = p1.matcher(s);
- if (m1.matches()) {
- final String name = m1.group(1);
- return name;
- }
- return null;
- }
-
- private String listedValue(String s) {
- final Pattern p1 = Pattern.compile("^\\s*[-]\\s*(\\S.*)$");
- final Matcher m1 = p1.matcher(s);
- if (m1.matches()) {
- final String name = m1.group(1).trim();
- return name;
- }
- return null;
- }
-
- private boolean textOnly(String s) {
- if (isList(s))
- return false;
- return s.indexOf(':') == -1;
- }
-
private void parseSingleLine(String s) {
- // System.err.println("s=" + s);
final int indent = getIndent(s);
+// System.err.println("s=" + s);
if (isListStrict(s)) {
- muteToArray(indent);
- return;
- }
-
- final String[] dashNameAndValue = dashNameAndValue(s);
- if (dashNameAndValue != null) {
- muteToArray(indent);
- parseSingleLine(s.replaceFirst("[-]", " "));
+ strictMuteToArray(indent);
return;
}
@@ -159,7 +89,7 @@ public class SimpleYamlParser {
return;
}
- final JsonObject working = getWorking(indent);
+ final JsonObject working = (JsonObject) getWorking(indent);
if (working == null) {
System.err.println("ERROR: ignoring " + s);
return;
@@ -173,7 +103,7 @@ public class SimpleYamlParser {
return;
}
- final String nameOnly = nameOnly(s);
+ final String nameOnly = YamlLines.nameOnly(s);
if (nameOnly != null) {
working.add(nameOnly, new JsonObject());
return;
@@ -182,11 +112,27 @@ public class SimpleYamlParser {
throw new UnsupportedOperationException(s);
}
+ private String listedValue(String s) {
+ final Pattern p1 = Pattern.compile("^\\s*[-]\\s*(\\S.*)$");
+ final Matcher m1 = p1.matcher(s);
+ if (m1.matches()) {
+ final String name = m1.group(1).trim();
+ return name;
+ }
+ return null;
+ }
+
private JsonArray getForceArray(int indent) {
+ if (indent == 0 && getLastIndent() == 0) {
+ if (result instanceof JsonArray == false) {
+ result = new JsonArray();
+ }
+ return (JsonArray) result;
+ }
while (getLastIndent() > indent - 1)
pendingIndents.remove(pendingIndents.size() - 1);
- final JsonObject last = search(result, pendingIndents.size());
+ final JsonObject last = (JsonObject) search(result, pendingIndents.size());
final String field = last.names().get(last.size() - 1);
if (last.get(field) instanceof JsonArray == false) {
last.set(field, new JsonArray());
@@ -194,11 +140,22 @@ public class SimpleYamlParser {
return (JsonArray) last.get(field);
}
- private void muteToArray(int indent) {
+ private void strictMuteToArray(int indent) {
+ if (indent == 0 && getLastIndent() == 0) {
+ if (result instanceof JsonArray == false) {
+ result = new JsonArray();
+ }
+ return;
+ }
while (getLastIndent() > indent)
pendingIndents.remove(pendingIndents.size() - 1);
- final JsonObject last = search(result, pendingIndents.size());
+ if (result instanceof JsonArray) {
+ ((JsonArray) result).add(new JsonObject());
+ return;
+ }
+
+ final JsonObject last = (JsonObject) search(result, pendingIndents.size());
final String field = last.names().get(last.size() - 1);
if (last.get(field) instanceof JsonArray == false) {
last.set(field, new JsonArray());
@@ -207,10 +164,6 @@ public class SimpleYamlParser {
}
}
- private boolean isList(String s) {
- return s.trim().startsWith("-");
- }
-
private boolean isListStrict(String s) {
return s.trim().equals("-");
}
@@ -219,7 +172,7 @@ public class SimpleYamlParser {
return pendingIndents.get(pendingIndents.size() - 1);
}
- private JsonObject getWorking(int indent) {
+ private JsonValue getWorking(int indent) {
if (indent > getLastIndent()) {
pendingIndents.add(indent);
return search(result, pendingIndents.size());
@@ -238,10 +191,24 @@ public class SimpleYamlParser {
return search(result, pendingIndents.size());
}
- private static JsonObject search(JsonObject current, int size) {
- if (size <= 1) {
- return current;
+ private static JsonValue search(JsonValue current1, int size) {
+ if (current1 instanceof JsonArray) {
+ JsonArray array = (JsonArray) current1;
+
+ final JsonValue tmp;
+ if (array.size() == 0) {
+ tmp = new JsonObject();
+ array.add(tmp);
+ } else {
+ tmp = array.get(array.size() - 1);
+ }
+ return tmp;
}
+ if (size <= 1) {
+ return current1;
+ }
+
+ final JsonObject current = (JsonObject) current1;
final String last = current.names().get(current.size() - 1);
// System.err.println("last=" + last);
JsonValue tmp = current.get(last);
@@ -254,7 +221,11 @@ public class SimpleYamlParser {
tmp = array.get(array.size() - 1);
}
}
- return search((JsonObject) tmp, size - 1);
+ if (tmp instanceof JsonString) {
+ System.err.println("JsonString? " + tmp);
+ return null;
+ }
+ return search(tmp, size - 1);
}
private int getIndent(String s) {
diff --git a/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java b/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java
index f351ab708..9081cd650 100644
--- a/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java
+++ b/src/net/sourceforge/plantuml/yaml/YamlDiagramFactory.java
@@ -39,14 +39,14 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import net.sourceforge.plantuml.StringLocated;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.command.PSystemAbstractFactory;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.DiagramType;
import net.sourceforge.plantuml.core.UmlSource;
-import net.sourceforge.plantuml.json.JsonObject;
+import net.sourceforge.plantuml.json.JsonValue;
import net.sourceforge.plantuml.jsondiagram.JsonDiagram;
+import net.sourceforge.plantuml.jsondiagram.StyleExtractor;
public class YamlDiagramFactory extends PSystemAbstractFactory {
@@ -55,13 +55,15 @@ public class YamlDiagramFactory extends PSystemAbstractFactory {
}
public Diagram createSystem(UmlSource source) {
- JsonObject yaml = null;
+ JsonValue yaml = null;
+ StyleExtractor styleExtractor = null;
try {
final List list = new ArrayList();
- final Iterator it = source.iterator2();
+ styleExtractor = new StyleExtractor(source.iterator2());
+ final Iterator it = styleExtractor.getIterator();
it.next();
while (true) {
- final String line = it.next().getString();
+ final String line = it.next();
if (it.hasNext() == false) {
break;
}
@@ -72,6 +74,9 @@ public class YamlDiagramFactory extends PSystemAbstractFactory {
e.printStackTrace();
}
final JsonDiagram result = new JsonDiagram(UmlDiagramType.YAML, yaml, new ArrayList());
+ if (styleExtractor != null) {
+ styleExtractor.applyStyles(result.getSkinParam());
+ }
result.setSource(source);
return result;
}
diff --git a/src/net/sourceforge/plantuml/yaml/YamlLines.java b/src/net/sourceforge/plantuml/yaml/YamlLines.java
new file mode 100644
index 000000000..4913fffa9
--- /dev/null
+++ b/src/net/sourceforge/plantuml/yaml/YamlLines.java
@@ -0,0 +1,186 @@
+/* ========================================================================
+ * 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.yaml;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class YamlLines implements Iterable {
+
+ public static final String KEY = "([_0-9\\w].*)";
+
+ private List lines = new ArrayList();
+
+ public YamlLines(List rawLines) {
+ for (String s : rawLines) {
+ if (s.startsWith("#")) {
+ continue;
+ }
+ s = removeDiese(s);
+ if (s.trim().length() == 0)
+ continue;
+ lines.add(s);
+ }
+ mergeMultiline();
+ manageSpaceTwoPoints();
+ manageList();
+ final int startingEmptyCols = startingEmptyCols();
+ removeFirstCols(startingEmptyCols);
+ }
+
+ private void manageSpaceTwoPoints() {
+ for (ListIterator it = lines.listIterator(); it.hasNext();) {
+ String s = it.next();
+ if (s.contains("\"") == false && s.contains("'") == false && s.contains(":")
+ && s.indexOf(':') == s.lastIndexOf(':') && s.contains(": ") == false) {
+ s = s.replace(":", ": ");
+ it.set(s);
+ }
+ }
+
+ }
+
+ private String removeDiese(String s) {
+ final int idx = s.indexOf(" #");
+ if (idx == -1) {
+ return s;
+ }
+ return s.substring(0, idx);
+ }
+
+ private void manageList() {
+ final List result = new ArrayList();
+ for (String s : lines) {
+ final Pattern p1 = Pattern.compile("^(\\s*[-])(\\s*\\S.*)$");
+ final Matcher m1 = p1.matcher(s);
+ if (s.contains(": ") && m1.matches()) {
+ result.add(m1.group(1));
+ result.add(s.replaceFirst("[-]", " "));
+ } else if (m1.matches()) {
+ result.add(" " + s);
+ } else {
+ result.add(s);
+ }
+
+ }
+ this.lines = result;
+ }
+
+ private void removeFirstCols(int startingEmptyCols) {
+ if (startingEmptyCols == 0) {
+ return;
+ }
+ for (ListIterator it = lines.listIterator(); it.hasNext();) {
+ final String s = it.next().substring(startingEmptyCols);
+ it.set(s);
+ }
+ }
+
+ private int startingEmptyCols() {
+ int result = Integer.MAX_VALUE;
+ for (String s : lines) {
+ result = Math.min(result, startingSpaces(s));
+ if (result == 0) {
+ return 0;
+ }
+ }
+ return result;
+ }
+
+ private static int startingSpaces(String s) {
+ final Pattern p1 = Pattern.compile("^(\\s*).*");
+ final Matcher m1 = p1.matcher(s);
+ if (m1.matches()) {
+ return m1.group(1).length();
+ }
+ return 0;
+ }
+
+ private void mergeMultiline() {
+ final List result = new ArrayList();
+ for (int i = 0; i < lines.size(); i++) {
+ final String init = isMultilineStart(i);
+ if (init != null) {
+ final StringBuilder sb = new StringBuilder(init);
+ while (i + 1 < lines.size() && textOnly(lines.get(i + 1))) {
+ sb.append(" " + lines.get(i + 1).trim());
+ i++;
+ }
+ result.add(sb.toString());
+ } else {
+ result.add(lines.get(i));
+ }
+ }
+ this.lines = result;
+ }
+
+ private String isMultilineStart(int i) {
+ if (nameOnly(lines.get(i)) != null && textOnly(lines.get(i + 1))) {
+ final int idx = lines.get(i).indexOf(':');
+ return lines.get(i).substring(0, idx + 1);
+ }
+ return null;
+ }
+
+ public static String nameOnly(String s) {
+ final Pattern p1 = Pattern.compile("^\\s*" + KEY + "\\s*:\\s*[|>]?\\s*$");
+ final Matcher m1 = p1.matcher(s);
+ if (m1.matches()) {
+ final String name = m1.group(1);
+ return name;
+ }
+ return null;
+ }
+
+ private boolean textOnly(String s) {
+ if (isList(s))
+ return false;
+ return s.indexOf(':') == -1;
+ }
+
+ private boolean isList(String s) {
+ return s.trim().startsWith("-");
+ }
+
+ public Iterator iterator() {
+ return Collections.unmodifiableList(lines).iterator();
+ }
+
+}
\ No newline at end of file
diff --git a/stdlib/c4-abx.repx b/stdlib/c4-abx.repx
index 86f12fdf5..91d855d1e 100644
Binary files a/stdlib/c4-abx.repx and b/stdlib/c4-abx.repx differ
diff --git a/svg/default.css b/svg/default.css
new file mode 100644
index 000000000..aecd589ec
--- /dev/null
+++ b/svg/default.css
@@ -0,0 +1,3 @@
+.elem {cursor: pointer;}
+.elem, .link {opacity: 0.3;}
+.elem.selected, .link.selected {opacity: 1;}
\ No newline at end of file
diff --git a/svg/default.js b/svg/default.js
new file mode 100644
index 000000000..0ad651b35
--- /dev/null
+++ b/svg/default.js
@@ -0,0 +1,110 @@
+function addItemToMapOfLists(mapOfLists, name, item) {
+ // mapOfLists = {
+ // 'key1': [item1, item2, ...],
+ // 'key2': [item3, item4, ...],
+ // }
+ if (mapOfLists[name].length > 0) {
+ if (!mapOfLists[name].includes(item)) {
+ mapOfLists[name].push(item);
+ }
+ } else {
+ mapOfLists[name] = [item];
+ }
+}
+
+function main() {
+ let elems = Array.from(document.getElementsByClassName('elem'));
+ let links = Array.from(document.getElementsByClassName('link'));
+
+ let elemsMap = {};
+ let linkedElems = {};
+ let linkedLinks = {};
+
+ elems.forEach(elem => {
+ let name = elem.classList[1];
+ elemsMap[name] = elem;
+ linkedElems[name] = [];
+ linkedLinks[name] = [];
+ });
+
+ links.forEach(link => {
+ if (elemsMap[name1]) {
+ if (elemsMap[name2]) {
+ let name1 = link.classList[1];
+ let name2 = link.classList[2];
+
+ let elem1 = elemsMap[name1];
+ let elem2 = elemsMap[name2];
+
+ addItemToMapOfLists(linkedElems, name1, elem2);
+ addItemToMapOfLists(linkedElems, name2, elem1);
+
+ addItemToMapOfLists(linkedLinks, name1, link);
+ addItemToMapOfLists(linkedLinks, name2, link);
+ }
+ }
+ });
+
+ let selectedElems = [];
+ let selectedLinks = [];
+ let selectedElemName = null;
+
+ function clearSelected() {
+ selectedElems.forEach(item => {
+ item.classList.remove('selected');
+ });
+ selectedElems = [];
+
+ selectedLinks.forEach(item => {
+ item.classList.remove('selected');
+ });
+ selectedLinks = [];
+ }
+
+ function selectAll() {
+ selectedElemName = null;
+
+ selectedElems = Array.from(elems);
+ selectedElems.forEach(item => {
+ item.classList.add('selected');
+ });
+
+ selectedLinks = Array.from(links);
+ selectedLinks.forEach(item => {
+ item.classList.add('selected');
+ });
+ }
+
+ function selectElem(elemName) {
+ if (elemName === selectedElemName) {
+ selectAll();
+
+ } else {
+ clearSelected();
+ selectedElemName = elemName;
+
+ elemsMap[elemName].classList.add('selected');
+ selectedElems.push(elemsMap[elemName]);
+
+ linkedElems[elemName].forEach(linkedElem => {
+ selectedElems.push(linkedElem);
+ linkedElem.classList.add('selected');
+ });
+
+ linkedLinks[elemName].forEach(linkedLink => {
+ selectedLinks.push(linkedLink);
+ linkedLink.classList.add('selected');
+ });
+ }
+ }
+
+ Object.keys(elemsMap).forEach(name => {
+ elemsMap[name].onclick = () => { selectElem(name); };
+ });
+
+ selectAll();
+}
+
+document.addEventListener('DOMContentLoaded', (event) => {
+ main();
+});
\ No newline at end of file