From 16fd39230803b2d3ef59e236aad508a3ed61e189 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Tue, 4 Jan 2022 12:23:39 +0100 Subject: [PATCH] Implements https://forum.plantuml.net/15232 --- .../plantuml/creole/SheetBlock1.java | 12 +- .../plantuml/cucadiagram/Display.java | 31 ++-- .../sequencediagram/DollAbstract.java | 85 +++++++++ .../{Englober.java => DollLeaf.java} | 60 ++----- .../plantuml/sequencediagram/LinkAnchor.java | 1 - .../sequencediagram/ParticipantEnglober.java | 16 +- .../sequencediagram/SequenceDiagram.java | 141 +++++++-------- .../SequenceDiagramFactory.java | 2 + .../command/CommandBoxEnd.java | 4 +- .../command/CommandBoxStart.java | 8 +- .../command/CommandParticipantMultilines.java | 132 ++++++++++++++ .../sequencediagram/graphic/DrawableSet.java | 150 ++++++++-------- .../graphic/DrawableSetInitializer.java | 168 +++++++++--------- .../teoz/{Englobers.java => Dolls.java} | 72 ++++---- .../sequencediagram/teoz/PlayingSpace.java | 8 +- .../teoz/SequenceDiagramFileMakerTeoz.java | 12 +- .../skin/AbstractTextualComponent.java | 2 +- .../sourceforge/plantuml/version/Version.java | 2 +- 18 files changed, 554 insertions(+), 352 deletions(-) create mode 100644 src/net/sourceforge/plantuml/sequencediagram/DollAbstract.java rename src/net/sourceforge/plantuml/sequencediagram/{Englober.java => DollLeaf.java} (76%) create mode 100644 src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantMultilines.java rename src/net/sourceforge/plantuml/sequencediagram/teoz/{Englobers.java => Dolls.java} (70%) diff --git a/src/net/sourceforge/plantuml/creole/SheetBlock1.java b/src/net/sourceforge/plantuml/creole/SheetBlock1.java index 6b6c5b211..1195cf6ba 100644 --- a/src/net/sourceforge/plantuml/creole/SheetBlock1.java +++ b/src/net/sourceforge/plantuml/creole/SheetBlock1.java @@ -70,11 +70,19 @@ public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, S private MinMax minMax; private final LineBreakStrategy maxWidth; private final double padding; + private final double marginX1; + private final double marginX2; public SheetBlock1(Sheet sheet, LineBreakStrategy maxWidth, double padding) { + this(sheet, maxWidth, padding, 0, 0); + } + + public SheetBlock1(Sheet sheet, LineBreakStrategy maxWidth, double padding, double marginX1, double marginX2) { this.sheet = sheet; this.maxWidth = Objects.requireNonNull(maxWidth); this.padding = padding; + this.marginX1 = marginX1; + this.marginX2 = marginX2; } @Override @@ -182,11 +190,11 @@ public class SheetBlock1 extends AbstractTextBlock implements TextBlock, Atom, S } public double getStartingX(StringBounder stringBounder, double y) { - return 0; + return -marginX1; } public double getEndingX(StringBounder stringBounder, double y) { - return calculateDimension(stringBounder).getWidth(); + return calculateDimension(stringBounder).getWidth() + marginX2; } } diff --git a/src/net/sourceforge/plantuml/cucadiagram/Display.java b/src/net/sourceforge/plantuml/cucadiagram/Display.java index 16b837674..a433e2754 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/Display.java +++ b/src/net/sourceforge/plantuml/cucadiagram/Display.java @@ -65,6 +65,7 @@ import net.sourceforge.plantuml.creole.Parser; import net.sourceforge.plantuml.creole.Sheet; import net.sourceforge.plantuml.creole.SheetBlock1; import net.sourceforge.plantuml.creole.SheetBlock2; +import net.sourceforge.plantuml.creole.atom.AtomWithMargin; import net.sourceforge.plantuml.creole.legacy.CreoleParser; import net.sourceforge.plantuml.graphic.CircledCharacter; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -504,6 +505,13 @@ public class Display implements Iterable { public TextBlock create0(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode, UFont fontForStereotype, HColor htmlColorForStereotype) { + return create0(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, creoleMode, + fontForStereotype, htmlColorForStereotype, 0, 0); + } + + public TextBlock create0(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, + ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode, + UFont fontForStereotype, HColor htmlColorForStereotype, double marginX1, double marginX2) { Objects.requireNonNull(maxMessageSize); if (getNaturalHorizontalAlignment() != null) horizontalAlignment = getNaturalHorizontalAlignment(); @@ -513,24 +521,24 @@ public class Display implements Iterable { if (size() > 0) { if (get(0) instanceof Stereotype) return createStereotype(fontConfiguration, horizontalAlignment, spriteContainer, 0, fontForStereotype, - htmlColorForStereotype, maxMessageSize, creoleMode); + htmlColorForStereotype, maxMessageSize, creoleMode, marginX1, marginX2); if (get(size() - 1) instanceof Stereotype) return createStereotype(fontConfiguration, horizontalAlignment, spriteContainer, size() - 1, - fontForStereotype, htmlColorForStereotype, maxMessageSize, creoleMode); + fontForStereotype, htmlColorForStereotype, maxMessageSize, creoleMode, marginX1, marginX2); if (get(0) instanceof MessageNumber) return createMessageNumber(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, - stereotypeConfiguration); + stereotypeConfiguration, marginX1, marginX2); } return getCreole(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, creoleMode, - stereotypeConfiguration); + stereotypeConfiguration, marginX1, marginX2); } private TextBlock createStereotype(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, SpriteContainer spriteContainer, int position, UFont fontForStereotype, HColor htmlColorForStereotype, - LineBreakStrategy maxMessageSize, CreoleMode creoleMode) { + LineBreakStrategy maxMessageSize, CreoleMode creoleMode, double marginX1, double marginX2) { final Stereotype stereotype = (Stereotype) get(position); TextBlock circledCharacter = null; if (stereotype.isSpotted()) @@ -542,7 +550,7 @@ public class Display implements Iterable { final FontConfiguration stereotypeConfiguration = fontConfiguration.forceFont(fontForStereotype, htmlColorForStereotype); final TextBlock result = getCreole(fontConfiguration, horizontalAlignment, (ISkinSimple) spriteContainer, - maxMessageSize, creoleMode, stereotypeConfiguration); + maxMessageSize, creoleMode, stereotypeConfiguration, marginX1, marginX2); if (circledCharacter != null) return new TextBlockSprited(circledCharacter, result); @@ -551,22 +559,23 @@ public class Display implements Iterable { private TextBlock getCreole(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, CreoleMode creoleMode, - FontConfiguration stereotypeConfiguration) { + FontConfiguration stereotypeConfiguration, double marginX1, double marginX2) { final Sheet sheet = Parser .build(fontConfiguration, horizontalAlignment, spriteContainer, creoleMode, stereotypeConfiguration) .createSheet(this); final double padding = spriteContainer == null ? 0 : spriteContainer.getPadding(); - final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, maxMessageSize, padding); + final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, maxMessageSize, padding, marginX1, marginX2); return new SheetBlock2(sheetBlock1, sheetBlock1, new UStroke(1.5)); } private TextBlock createMessageNumber(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment, - ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, FontConfiguration stereotypeConfiguration) { + ISkinSimple spriteContainer, LineBreakStrategy maxMessageSize, FontConfiguration stereotypeConfiguration, + double marginX1, double marginX2) { TextBlock tb1 = subList(0, 1).getCreole(fontConfiguration, horizontalAlignment, spriteContainer, maxMessageSize, - CreoleMode.FULL, stereotypeConfiguration); + CreoleMode.FULL, stereotypeConfiguration, marginX1, marginX2); tb1 = TextBlockUtils.withMargin(tb1, 0, 4, 0, 0); final TextBlock tb2 = subList(1, size()).getCreole(fontConfiguration, horizontalAlignment, spriteContainer, - maxMessageSize, CreoleMode.FULL, stereotypeConfiguration); + maxMessageSize, CreoleMode.FULL, stereotypeConfiguration, marginX1, marginX2); return TextBlockUtils.mergeLR(tb1, tb2, VerticalAlignment.CENTER); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/DollAbstract.java b/src/net/sourceforge/plantuml/sequencediagram/DollAbstract.java new file mode 100644 index 000000000..270ef0458 --- /dev/null +++ b/src/net/sourceforge/plantuml/sequencediagram/DollAbstract.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.sequencediagram; + +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.sequencediagram.teoz.TileArguments; +import net.sourceforge.plantuml.skin.ComponentType; +import net.sourceforge.plantuml.skin.rose.Rose; +import net.sourceforge.plantuml.style.PName; +import net.sourceforge.plantuml.style.Style; +import net.sourceforge.plantuml.style.StyleBuilder; +import net.sourceforge.plantuml.style.StyleSignature; +import net.sourceforge.plantuml.style.WithStyle; +import net.sourceforge.plantuml.ugraphic.color.HColor; + +public abstract class DollAbstract implements WithStyle { + + final protected ParticipantEnglober englober; + final protected StyleBuilder styleBuilder; + final protected boolean isTeoz; + + DollAbstract(ParticipantEnglober englober, StyleBuilder styleBuilder, boolean isTeoz) { + this.englober = englober; + this.styleBuilder = styleBuilder; + this.isTeoz = isTeoz; + } + + final public StyleSignature getDefaultStyleDefinition() { + return ComponentType.ENGLOBER.getDefaultStyleDefinition(); + } + + final public Style[] getUsedStyles() { + Style tmp = getDefaultStyleDefinition().with(englober.getStereotype()).getMergedStyle(styleBuilder); + final HColor backColor = englober.getBoxColor(); + if (tmp != null) { + tmp = tmp.eventuallyOverride(PName.BackGroundColor, backColor); + } + return new Style[] { tmp }; + } + + private static TileArguments convertFunctionToBeRemoved(ISkinParam skinParam, Rose skin, + StringBounder stringBounder) { + final TileArguments result = new TileArguments(stringBounder, null, skin, skinParam, null); + return result; + } + + final public ParticipantEnglober getParticipantEnglober() { + return englober; + } + +} diff --git a/src/net/sourceforge/plantuml/sequencediagram/Englober.java b/src/net/sourceforge/plantuml/sequencediagram/DollLeaf.java similarity index 76% rename from src/net/sourceforge/plantuml/sequencediagram/Englober.java rename to src/net/sourceforge/plantuml/sequencediagram/DollLeaf.java index c0f9b1f9c..0782eac25 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Englober.java +++ b/src/net/sourceforge/plantuml/sequencediagram/DollLeaf.java @@ -53,60 +53,38 @@ import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.rose.Rose; -import net.sourceforge.plantuml.style.PName; -import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.StyleBuilder; -import net.sourceforge.plantuml.style.StyleSignature; -import net.sourceforge.plantuml.style.WithStyle; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; -import net.sourceforge.plantuml.ugraphic.color.HColor; -public class Englober implements WithStyle { +public class DollLeaf extends DollAbstract { - final private ParticipantEnglober participantEnglober; final private List participants = new ArrayList<>(); final private TileArguments tileArguments; - final private StyleBuilder styleBuilder; final private Real core1; final private Real core2; - final private boolean isTeoz; private double marginX = 0; - public StyleSignature getDefaultStyleDefinition() { - return ComponentType.ENGLOBER.getDefaultStyleDefinition(); - } - - public Style[] getUsedStyles() { - Style tmp = getDefaultStyleDefinition().with(participantEnglober.getStereotype()).getMergedStyle(styleBuilder); - final HColor backColor = participantEnglober.getBoxColor(); - if (tmp != null) { - tmp = tmp.eventuallyOverride(PName.BackGroundColor, backColor); - } - return new Style[] { tmp }; - } - - public static Englober createPuma(ParticipantEnglober englober, Participant first, ISkinParam skinParam, Rose skin, + public static DollLeaf createPuma(ParticipantEnglober englober, Participant first, ISkinParam skinParam, Rose skin, StringBounder stringBounder, StyleBuilder styleBuilder) { - return new Englober(englober, first, convertFunctionToBeRemoved(skinParam, skin, stringBounder), false, - styleBuilder); + return new DollLeaf(englober, styleBuilder, false, first, + convertFunctionToBeRemoved(skinParam, skin, stringBounder)); } - public static Englober createTeoz(ParticipantEnglober participantEnglober, Participant first, - TileArguments tileArguments, StyleBuilder styleBuilder) { - return new Englober(participantEnglober, first, tileArguments, true, styleBuilder); + public static DollLeaf createTeoz(ParticipantEnglober englober, Participant first, TileArguments tileArguments, + StyleBuilder styleBuilder) { + return new DollLeaf(englober, styleBuilder, true, first, tileArguments); } - private static TileArguments convertFunctionToBeRemoved(ISkinParam skinParam, Rose skin, StringBounder stringBounder) { + private static TileArguments convertFunctionToBeRemoved(ISkinParam skinParam, Rose skin, + StringBounder stringBounder) { final TileArguments result = new TileArguments(stringBounder, null, skin, skinParam, null); return result; } - private Englober(ParticipantEnglober participantEnglober, Participant first, TileArguments tileArguments, - boolean isTeoz, StyleBuilder styleBuilder) { - this.styleBuilder = styleBuilder; - this.isTeoz = isTeoz; - this.participantEnglober = participantEnglober; + private DollLeaf(ParticipantEnglober englober, StyleBuilder styleBuilder, boolean isTeoz, Participant first, + TileArguments tileArguments) { + super(englober, styleBuilder, isTeoz); this.participants.add(first); this.tileArguments = Objects.requireNonNull(tileArguments); final double preferredWidth = getPreferredWidth(); @@ -166,16 +144,12 @@ public class Englober implements WithStyle { private Component getComponent() { final ParticipantEnglober englober = getParticipantEnglober(); - final ISkinParam s = englober.getBoxColor() == null ? tileArguments.getSkinParam() : new SkinParamBackcolored( - tileArguments.getSkinParam(), englober.getBoxColor()); + final ISkinParam s = englober.getBoxColor() == null ? tileArguments.getSkinParam() + : new SkinParamBackcolored(tileArguments.getSkinParam(), englober.getBoxColor()); return tileArguments.getSkin().createComponent(getUsedStyles(), ComponentType.ENGLOBER, null, s, englober.getTitle()); } - public final ParticipantEnglober getParticipantEnglober() { - return participantEnglober; - } - public boolean contains(Participant p) { return participants.contains(p); } @@ -189,7 +163,7 @@ public class Englober implements WithStyle { @Override public String toString() { - return "ParticipantEngloberContexted:" + participantEnglober.getTitle().toString() + " " + participants; + return "ParticipantEngloberContexted:" + englober.getTitle().toString() + " " + participants; } private double getPreferredWidth() { @@ -209,7 +183,7 @@ public class Englober implements WithStyle { return comp.getPreferredHeight(tileArguments.getStringBounder()); } - public void drawEnglober(UGraphic ug, double height, Context2D context) { + public void drawMe(UGraphic ug, double height, Context2D context) { final double x1 = getX1().getCurrentValue() - 4; final double x2 = getX2().getCurrentValue() + 4; @@ -246,7 +220,7 @@ public class Englober implements WithStyle { return tileArguments.getSkinParam().getPadding(PaddingParam.BOX); } - public void addConstraintAfter(Englober current) { + public void addConstraintAfter(DollLeaf current) { current.getX1().ensureBiggerThan(getX2().addFixed(10 + 2 * padding())); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java index 168cf0b65..b04e59dd2 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java +++ b/src/net/sourceforge/plantuml/sequencediagram/LinkAnchor.java @@ -46,7 +46,6 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.sequencediagram.teoz.CommonTile; -import net.sourceforge.plantuml.sequencediagram.teoz.Tile; import net.sourceforge.plantuml.skin.rose.Rose; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.color.HColor; diff --git a/src/net/sourceforge/plantuml/sequencediagram/ParticipantEnglober.java b/src/net/sourceforge/plantuml/sequencediagram/ParticipantEnglober.java index a5c62da54..e33f9cd97 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/ParticipantEnglober.java +++ b/src/net/sourceforge/plantuml/sequencediagram/ParticipantEnglober.java @@ -41,11 +41,21 @@ import net.sourceforge.plantuml.ugraphic.color.HColor; public class ParticipantEnglober { + final private ParticipantEnglober parent; final private Display title; final private HColor boxColor; final private Stereotype stereotype; - public ParticipantEnglober(Display title, HColor boxColor, Stereotype stereotype) { + public static ParticipantEnglober build(Display title, HColor boxColor, Stereotype stereotype) { + return new ParticipantEnglober(null, title, boxColor, stereotype); + } + + public ParticipantEnglober newChild(Display title, HColor boxColor, Stereotype stereotype) { + return new ParticipantEnglober(this, title, boxColor, stereotype); + } + + private ParticipantEnglober(ParticipantEnglober parent, Display title, HColor boxColor, Stereotype stereotype) { + this.parent = parent; this.title = title; this.boxColor = boxColor; this.stereotype = stereotype; @@ -63,4 +73,8 @@ public class ParticipantEnglober { return stereotype; } + public final ParticipantEnglober getParent() { + return parent; + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index 81fd811b0..d39b20288 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -73,7 +73,7 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder; import net.sourceforge.plantuml.ugraphic.color.HColor; public class SequenceDiagram extends UmlDiagram { - + private boolean hideUnlinkedData; public final boolean isHideUnlinkedData() { @@ -113,11 +113,10 @@ public class SequenceDiagram extends UmlDiagram { } private Participant participantsget(String code) { - for (Participant p : participantsList) { - if (p.getCode().equals(code)) { + for (Participant p : participantsList) + if (p.getCode().equals(code)) return p; - } - } + return null; } @@ -143,12 +142,12 @@ public class SequenceDiagram extends UmlDiagram { } private void addWithOrder(final Participant result) { - for (int i = 0; i < participantsList.size(); i++) { + for (int i = 0; i < participantsList.size(); i++) if (result.getOrder() < participantsList.get(i).getOrder()) { participantsList.add(i, result); return; } - } + participantsList.add(result); } @@ -161,16 +160,16 @@ public class SequenceDiagram extends UmlDiagram { } public String addMessage(AbstractMessage m) { - if (m.isParallel()) { + if (m.isParallel()) m.setParallelBrother(getLastAbstractMessage()); - } + lastEventWithDeactivate = m; lastDelay = null; events.add(m); if (pendingCreate != null) { - if (m.compatibleForCreate(pendingCreate.getParticipant()) == false) { + if (m.compatibleForCreate(pendingCreate.getParticipant()) == false) return "After create command, you have to send a message to \"" + pendingCreate.getParticipant() + "\""; - } + m.addLifeEvent(pendingCreate); pendingCreate = null; } @@ -203,9 +202,9 @@ public class SequenceDiagram extends UmlDiagram { } public void newpage(Display strings) { - if (ignoreNewpage) { + if (ignoreNewpage) return; - } + events.add(new Newpage(strings)); } @@ -253,13 +252,11 @@ public class SequenceDiagram extends UmlDiagram { final FileFormat fileFormat = fileFormatOption.getFileFormat(); - if (fileFormat == FileFormat.ATXT || fileFormat == FileFormat.UTXT) { + if (fileFormat == FileFormat.ATXT || fileFormat == FileFormat.UTXT) return new SequenceDiagramTxtMaker(this, fileFormat); - } - if (modeTeoz()) { + if (modeTeoz()) return new SequenceDiagramFileMakerTeoz(this, skin2, fileFormatOption, index); - } return new SequenceDiagramFileMakerPuma2(this, skin2, fileFormatOption); } @@ -284,9 +281,9 @@ public class SequenceDiagram extends UmlDiagram { private final Stack activationState = new Stack<>(); public AbstractMessage getActivatingMessage() { - if (activationState.empty()) { + if (activationState.empty()) return null; - } + return activationState.peek(); } @@ -297,9 +294,9 @@ public class SequenceDiagram extends UmlDiagram { } public String activate(Participant p, LifeEventType lifeEventType, HColor backcolor, HColor linecolor) { - if (lastDelay != null) { + if (lastDelay != null) return "You cannot Activate/Deactivate just after a ..."; - } + final LifeEvent lifeEvent = new LifeEvent(p, lifeEventType, new SymbolContext(backcolor, linecolor)); events.add(lifeEvent); if (lifeEventType == LifeEventType.CREATE) { @@ -311,24 +308,24 @@ public class SequenceDiagram extends UmlDiagram { p.incInitialLife(new SymbolContext(backcolor, linecolor)); return null; } - if (p.getInitialLife() == 0) { + if (p.getInitialLife() == 0) return "You cannot deactivate here"; - } + return null; } - if (lifeEventType == LifeEventType.ACTIVATE && lastEventWithDeactivate instanceof AbstractMessage) { + if (lifeEventType == LifeEventType.ACTIVATE && lastEventWithDeactivate instanceof AbstractMessage) activationState.push((AbstractMessage) lastEventWithDeactivate); - } else if (lifeEventType == LifeEventType.DEACTIVATE && activationState.empty() == false) { + else if (lifeEventType == LifeEventType.DEACTIVATE && activationState.empty() == false) activationState.pop(); - } + final boolean ok = lastEventWithDeactivate.addLifeEvent(lifeEvent); if (lastEventWithDeactivate instanceof AbstractMessage) { final AbstractMessage lastMessage = (AbstractMessage) lastEventWithDeactivate; lifeEvent.setMessage(lastMessage); } - if (ok) { + if (ok) return null; - } + return "Activate/Deactivate already done on " + p.getCode(); } @@ -336,12 +333,11 @@ public class SequenceDiagram extends UmlDiagram { public boolean grouping(String title, String comment, GroupingType type, HColor backColorGeneral, HColor backColorElement, boolean parallel) { - if (type != GroupingType.START && openGroupings.size() == 0) { + if (type != GroupingType.START && openGroupings.size() == 0) return false; - } - if (backColorGeneral == null) { + + if (backColorGeneral == null) backColorGeneral = getSkinParam().getHtmlColor(ColorParam.sequenceGroupBodyBackground, null, false); - } final GroupingStart top = openGroupings.size() > 0 ? openGroupings.get(0) : null; @@ -353,9 +349,9 @@ public class SequenceDiagram extends UmlDiagram { events.add(g); if (type == GroupingType.START) { - if (parallel) { + if (parallel) ((GroupingStart) g).goParallel(); - } + openGroupings.add(0, (GroupingStart) g); } else if (type == GroupingType.END) { openGroupings.remove(0); @@ -397,16 +393,16 @@ public class SequenceDiagram extends UmlDiagram { } public boolean isShowFootbox() { - if (getSkinParam().strictUmlStyle()) { + if (getSkinParam().strictUmlStyle()) return false; - } + final String footbox = getSkinParam().getValue("footbox"); - if (footbox == null) { + if (footbox == null) return showFootbox; - } - if (footbox.equalsIgnoreCase("hide")) { + + if (footbox.equalsIgnoreCase("hide")) return false; - } + return true; } @@ -414,23 +410,23 @@ public class SequenceDiagram extends UmlDiagram { public void setShowFootbox(boolean footbox) { this.showFootbox = footbox; - } private ParticipantEnglober participantEnglober; public void boxStart(Display comment, HColor color, Stereotype stereotype) { - if (participantEnglober != null) { - throw new IllegalStateException(); - } - this.participantEnglober = new ParticipantEnglober(comment, color, stereotype); + if (participantEnglober == null) + this.participantEnglober = ParticipantEnglober.build(comment, color, stereotype); + else + this.participantEnglober = participantEnglober.newChild(comment, color, stereotype); + } public void endBox() { - if (participantEnglober == null) { + if (participantEnglober == null) throw new IllegalStateException(); - } - this.participantEnglober = null; + + this.participantEnglober = participantEnglober.getParent(); } public boolean isBoxPending() { @@ -449,27 +445,24 @@ public class SequenceDiagram extends UmlDiagram { } public void removeHiddenParticipants() { - for (Participant p : new ArrayList<>(participantsList)) { - if (isAlone(p)) { + for (Participant p : new ArrayList<>(participantsList)) + if (isAlone(p)) remove(p); - } - } } private void remove(Participant p) { final boolean ok = participantsList.remove(p); - if (ok == false) { + if (ok == false) throw new IllegalArgumentException(); - } + participantEnglobers2.remove(p); } private boolean isAlone(Participant p) { - for (Event ev : events) { - if (ev.dealWith(p)) { + for (Event ev : events) + if (ev.dealWith(p)) return false; - } - } + return true; } @@ -496,19 +489,17 @@ public class SequenceDiagram extends UmlDiagram { } public boolean hasUrl() { - for (Participant p : participantsList) { - if (p.getUrl() != null) { + for (Participant p : participantsList) + if (p.getUrl() != null) return true; - } - } - for (Event ev : events) { - if (ev.hasUrl()) { + + for (Event ev : events) + if (ev.hasUrl()) return true; - } - } - if (getLegend().isNull() == false && getLegend().hasUrl()) { + + if (getLegend().isNull() == false && getLegend().hasUrl()) return true; - } + return false; } @@ -518,28 +509,28 @@ public class SequenceDiagram extends UmlDiagram { @Override public boolean isOk() { - if (participantsList.size() == 0) { + if (participantsList.size() == 0) return false; - } + return true; } @Override public String checkFinalError() { - if (this.isHideUnlinkedData()) { + if (this.isHideUnlinkedData()) this.removeHiddenParticipants(); - } + return super.checkFinalError(); } private final Set hiddenPortions = EnumSet.noneOf(EntityPortion.class); public void hideOrShow(Set portions, boolean show) { - if (show) { + if (show) hiddenPortions.removeAll(portions); - } else { + else hiddenPortions.addAll(portions); - } + } public Display manageVariable(Display labels) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java index cbb1fa350..7e2d3ab83 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagramFactory.java @@ -74,6 +74,7 @@ import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA; import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA2; import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA3; import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantA4; +import net.sourceforge.plantuml.sequencediagram.command.CommandParticipantMultilines; import net.sourceforge.plantuml.sequencediagram.command.CommandReferenceMultilinesOverSeveral; import net.sourceforge.plantuml.sequencediagram.command.CommandReferenceOverSeveral; import net.sourceforge.plantuml.sequencediagram.command.CommandReturn; @@ -101,6 +102,7 @@ public class SequenceDiagramFactory extends PSystemCommandFactory { cmds.add(new CommandParticipantA2()); cmds.add(new CommandParticipantA3()); cmds.add(new CommandParticipantA4()); + cmds.add(new CommandParticipantMultilines()); cmds.add(new CommandArrow()); // addCommand(new CommandArrowCrossX()); cmds.add(new CommandExoArrowLeft()); diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxEnd.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxEnd.java index 7c487626f..f9aa8475b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxEnd.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxEnd.java @@ -59,9 +59,9 @@ public class CommandBoxEnd extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) { - if (diagram.isBoxPending() == false) { + if (diagram.isBoxPending() == false) return CommandExecutionResult.error("Missing starting box"); - } + diagram.endBox(); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java index 37287fca6..7fa614e4b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandBoxStart.java @@ -82,9 +82,9 @@ public class CommandBoxStart extends SingleLineCommand2 { @Override protected CommandExecutionResult executeArg(SequenceDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { - if (diagram.isBoxPending()) { - return CommandExecutionResult.error("Box cannot be nested"); - } +// if (diagram.isBoxPending()) +// return CommandExecutionResult.error("Box cannot be nested"); + final String argTitle = arg.getLazzy("NAME", 0); final String argColor = arg.get("COLOR", 0); @@ -95,8 +95,6 @@ public class CommandBoxStart extends SingleLineCommand2 { stereotype = Stereotype.build(stereo); } - // final HtmlColor color = - // diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(argColor); Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg, diagram.getSkinParam().getIHtmlColorSet()); final String title = argTitle == null ? "" : argTitle; diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantMultilines.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantMultilines.java new file mode 100644 index 000000000..754ff8211 --- /dev/null +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandParticipantMultilines.java @@ -0,0 +1,132 @@ +/* ======================================================================== + * 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.command; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.ISkinParam; +import net.sourceforge.plantuml.Url; +import net.sourceforge.plantuml.UrlBuilder; +import net.sourceforge.plantuml.UrlBuilder.ModeUrl; +import net.sourceforge.plantuml.command.BlocLines; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.CommandMultilines2; +import net.sourceforge.plantuml.command.MultilinesStrategy; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.sequencediagram.Participant; +import net.sourceforge.plantuml.sequencediagram.ParticipantType; +import net.sourceforge.plantuml.sequencediagram.SequenceDiagram; +import net.sourceforge.plantuml.ugraphic.UFont; +import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException; + +public class CommandParticipantMultilines extends CommandMultilines2 { + + public CommandParticipantMultilines() { + super(getRegexConcat(), MultilinesStrategy.REMOVE_STARTING_QUOTE); + } + + @Override + public String getPatternEnd() { + return "^([^\\[\\]]*)\\]$"; + } + + private static RegexConcat getRegexConcat() { + return RegexConcat.build(CommandParticipantMultilines.class.getName(), RegexLeaf.start(), // + new RegexLeaf("TYPE", "(participant)"), // + RegexLeaf.spaceOneOrMore(), // + new RegexLeaf("CODE", "([%pLN_.@]+)"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO", "(\\<\\<.+\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // + RegexLeaf.spaceZeroOrMore(), // + ColorParser.exp1(), // + RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("\\["), // + RegexLeaf.end()); + } + + @Override + protected CommandExecutionResult executeNow(SequenceDiagram diagram, BlocLines lines) throws NoSuchColorException { + + final RegexResult arg = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString()); + + final String code = arg.get("CODE", 0); + if (diagram.participantsContainsKey(code)) { + diagram.putParticipantInLast(code); + return CommandExecutionResult.ok(); + } + + lines = lines.subExtract(1, 1); + lines = lines.removeEmptyColumns(); + final Display strings = lines.toDisplay(); + + final ParticipantType type = ParticipantType.PARTICIPANT; + final boolean create = false; + final int order = 0; + + final Participant participant = diagram.createNewParticipant(type, code, strings, order); + + final String stereotype = arg.get("STEREO", 0); + + if (stereotype != null) { + final ISkinParam skinParam = diagram.getSkinParam(); + final boolean stereotypePositionTop = skinParam.stereotypePositionTop(); + final UFont font = skinParam.getFont(null, false, FontParam.CIRCLED_CHARACTER); + participant.setStereotype(Stereotype.build(stereotype, skinParam.getCircledCharacterRadius(), font, + diagram.getSkinParam().getIHtmlColorSet()), stereotypePositionTop); + } + + final String urlString = arg.get("URL", 0); + if (urlString != null) { + final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + final Url url = urlBuilder.getUrl(urlString); + participant.setUrl(url); + } + + return CommandExecutionResult.ok(); + } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + +} diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java index e7971dfdb..c9c3fbdbc 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSet.java @@ -55,7 +55,7 @@ import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.graphic.InnerStrategy; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.TextBlock; -import net.sourceforge.plantuml.sequencediagram.Englober; +import net.sourceforge.plantuml.sequencediagram.DollLeaf; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.Newpage; import net.sourceforge.plantuml.sequencediagram.Participant; @@ -116,9 +116,9 @@ public class DrawableSet { public Collection getAllGraphicalElements() { final Collection result = new ArrayList<>(); - for (Event ev : eventsList) { + for (Event ev : eventsList) result.add(events.get(ev)); - } + return Collections.unmodifiableCollection(result); } @@ -142,19 +142,19 @@ public class DrawableSet { public double getHeadAndEngloberHeight(Participant p, StringBounder stringBounder) { final LivingParticipantBox box = participants.get(p); final double height = box.getParticipantBox().getHeadHeight(stringBounder); - final Englober englober = getParticipantEnglober(p, stringBounder); - if (englober == null) { + final DollLeaf doll = getParticipantEnglober(p, stringBounder); + if (doll == null) return height; - } - final Component comp = skin.createComponent(englober.getUsedStyles(), ComponentType.ENGLOBER, null, skinParam, - englober.getParticipantEnglober().getTitle()); + + final Component comp = skin.createComponent(doll.getUsedStyles(), ComponentType.ENGLOBER, null, skinParam, + doll.getParticipantEnglober().getTitle()); final double heightEnglober = comp.getPreferredHeight(stringBounder); return height + heightEnglober; } - public List getExistingParticipantEnglober(StringBounder stringBounder) { - final List result = new ArrayList<>(); - Englober pending = null; + public List getExistingParticipantEnglober(StringBounder stringBounder) { + final List result = new ArrayList<>(); + DollLeaf pending = null; for (Map.Entry ent : participantEnglobers2.entrySet()) { final ParticipantEnglober englober = ent.getValue(); if (englober == null) { @@ -166,7 +166,7 @@ public class DrawableSet { pending.add(ent.getKey()); continue; } - pending = Englober.createPuma(englober, ent.getKey(), getSkinParam(), skin, stringBounder, + pending = DollLeaf.createPuma(englober, ent.getKey(), getSkinParam(), skin, stringBounder, skinParam.getCurrentStyleBuilder()); result.add(pending); } @@ -175,13 +175,13 @@ public class DrawableSet { public double getOffsetForEnglobers(StringBounder stringBounder) { double result = 0; - for (Englober englober : getExistingParticipantEnglober(stringBounder)) { - final Component comp = skin.createComponent(null, ComponentType.ENGLOBER, null, skinParam, englober - .getParticipantEnglober().getTitle()); + for (DollLeaf englober : getExistingParticipantEnglober(stringBounder)) { + final Component comp = skin.createComponent(null, ComponentType.ENGLOBER, null, skinParam, + englober.getParticipantEnglober().getTitle()); final double height = comp.getPreferredHeight(stringBounder); - if (height > result) { + if (height > result) result = height; - } + } return result; } @@ -190,12 +190,13 @@ public class DrawableSet { static private final int MARGIN_FOR_ENGLOBERS1 = 2; public double getTailHeight(StringBounder stringBounder, boolean showTail) { - final double marginForEnglobers = getExistingParticipantEnglober(stringBounder).size() > 0 ? MARGIN_FOR_ENGLOBERS + final double marginForEnglobers = getExistingParticipantEnglober(stringBounder).size() > 0 + ? MARGIN_FOR_ENGLOBERS : 0; - if (showTail == false) { + if (showTail == false) return 1 + marginForEnglobers; - } + double r = 0; for (LivingParticipantBox livingParticipantBox : participants.values()) { final double y = livingParticipantBox.getParticipantBox().getTailHeight(stringBounder); @@ -210,33 +211,33 @@ public class DrawableSet { } public void setLivingParticipantBox(Participant p, LivingParticipantBox box) { - if (participants.containsKey(p) == false) { + if (participants.containsKey(p) == false) throw new IllegalArgumentException(); - } + participants.put(p, box); } public void addEvent(Event event, GraphicalElement object) { - if (events.keySet().contains(event) == false) { + if (events.keySet().contains(event) == false) eventsList.add(event); - } + events.put(event, object); } public void addEvent(Newpage newpage, GraphicalNewpage object, Event justBefore) { final int idx = eventsList.indexOf(justBefore); - if (idx == -1) { + if (idx == -1) throw new IllegalArgumentException(); - } + eventsList.add(idx, newpage); events.put(newpage, object); assert events.size() == eventsList.size(); } void setDimension(Dimension2D dim) { - if (dimension != null) { + if (dimension != null) throw new IllegalStateException(); - } + this.dimension = dim; } @@ -273,7 +274,7 @@ public class DrawableSet { final UGraphic ugTranslated = clipAndTranslate2(delta, width, page, ug); final SimpleContext2D context = new SimpleContext2D(true); - this.drawEnglobers(ug, height - MARGIN_FOR_ENGLOBERS1, context); + this.drawDolls(ug, height - MARGIN_FOR_ENGLOBERS1, context); this.drawPlaygroundU(ugTranslated, context); this.drawLineU22(ug, showTail, page); @@ -289,9 +290,9 @@ public class DrawableSet { } private UTranslate getTranslate4(final double delta) { - if (delta > 0) { + if (delta > 0) return UTranslate.dy(-delta); - } + return new UTranslate(); } @@ -304,15 +305,14 @@ public class DrawableSet { final double endMax = startMin + page.getBodyHeight() + 2 * box.magicMargin(ug.getStringBounder()); double start = startMin; if (create > 0) { - if (create > page.getNewpage2()) { + if (create > page.getNewpage2()) continue; - } + if (create >= page.getNewpage1() && create < page.getNewpage2()) { - if (isTxt) { + if (isTxt) start = (int) create; - } else { + else start += create - page.getNewpage1() + 2 * box.magicMargin(ug.getStringBounder()); - } } } final double myDelta = page.getNewpage1() - page.getHeaderHeight(); @@ -327,21 +327,21 @@ public class DrawableSet { final double create = box.getCreate(); boolean showHead = true; if (create > 0) { - if (create > page.getNewpage2()) { + if (create > page.getNewpage2()) continue; - } - if (create >= page.getNewpage1() && create < page.getNewpage2()) { + + if (create >= page.getNewpage1() && create < page.getNewpage2()) showHead = false; - } + } final Url url = p.getUrl(); - if (url != null) { + if (url != null) ug.startUrl(url); - } + box.getParticipantBox().drawHeadTailU(ug, topStartingY, showHead, positionTail); - if (url != null) { + if (url != null) ug.closeUrl(); - } + } } @@ -354,24 +354,23 @@ public class DrawableSet { } private void drawPlaygroundU(UGraphic ug, Context2D context) { - for (Participant p : getAllParticipants()) { + for (Participant p : getAllParticipants()) drawLifeLineU(ug, p); - } - for (GraphicalElement element : getAllGraphicalElements()) { + for (GraphicalElement element : getAllGraphicalElements()) element.drawU(ug, getMaxX(), context); - } + } - private void drawEnglobers(UGraphic ug, double height, Context2D context) { - for (Englober englober : getExistingParticipantEnglober(ug.getStringBounder())) { - double x1 = getX1(englober); - final double x2 = getX2(ug.getStringBounder(), englober); + private void drawDolls(UGraphic ug, double height, Context2D context) { + for (DollLeaf doll : getExistingParticipantEnglober(ug.getStringBounder())) { + double x1 = getX1(doll); + final double x2 = getX2(ug.getStringBounder(), doll); - final Component comp = getEngloberComponent(englober); + final Component comp = getEngloberComponent(doll); final double width = x2 - x1; - final double preferedWidth = getEngloberPreferedWidth(ug.getStringBounder(), englober); + final double preferedWidth = getEngloberPreferedWidth(ug.getStringBounder(), doll); if (preferedWidth > width) { // if (englober.getFirst2() == englober.getLast2()) { x1 -= (preferedWidth - width) / 2; @@ -385,26 +384,26 @@ public class DrawableSet { } } - public double getEngloberPreferedWidth(StringBounder stringBounder, Englober englober) { - return getEngloberComponent(englober).getPreferredWidth(stringBounder); + public double getEngloberPreferedWidth(StringBounder stringBounder, DollLeaf doll) { + return getEngloberComponent(doll).getPreferredWidth(stringBounder); } - private Component getEngloberComponent(Englober englober) { - final ParticipantEnglober participantEnglober = englober.getParticipantEnglober(); - final ISkinParam s = participantEnglober.getBoxColor() == null ? skinParam : new SkinParamBackcolored( - skinParam, participantEnglober.getBoxColor()); - return skin.createComponent(englober.getUsedStyles(), ComponentType.ENGLOBER, null, s, + private Component getEngloberComponent(DollLeaf doll) { + final ParticipantEnglober participantEnglober = doll.getParticipantEnglober(); + final ISkinParam s = participantEnglober.getBoxColor() == null ? skinParam + : new SkinParamBackcolored(skinParam, participantEnglober.getBoxColor()); + return skin.createComponent(doll.getUsedStyles(), ComponentType.ENGLOBER, null, s, participantEnglober.getTitle()); } - public double getX1(Englober englober) { - final Participant first = englober.getFirst2TOBEPRIVATE(); + public double getX1(DollLeaf doll) { + final Participant first = doll.getFirst2TOBEPRIVATE(); final ParticipantBox firstBox = participants.get(first).getParticipantBox(); return firstBox.getStartingX() + 1; } - public double getX2(StringBounder stringBounder, Englober englober) { - final Participant last = englober.getLast2TOBEPRIVATE(); + public double getX2(StringBounder stringBounder, DollLeaf doll) { + final Participant last = doll.getLast2TOBEPRIVATE(); final ParticipantBox lastBox = participants.get(last).getParticipantBox(); return lastBox.getMaxX(stringBounder) - 1; } @@ -416,12 +415,11 @@ public class DrawableSet { line.drawU(ug, getSkin(), skinParam); } - private Englober getParticipantEnglober(Participant p, StringBounder stringBounder) { - for (Englober pe : getExistingParticipantEnglober(stringBounder)) { - if (pe.contains(p)) { + private DollLeaf getParticipantEnglober(Participant p, StringBounder stringBounder) { + for (DollLeaf pe : getExistingParticipantEnglober(stringBounder)) + if (pe.contains(p)) return pe; - } - } + return null; } @@ -435,9 +433,9 @@ public class DrawableSet { for (Participant p : someParticipants) { final int n = list.indexOf(p); assert n != -1; - if (min == -1 || min > n) { + if (min == -1 || min > n) min = n; - } + } return list.get(min); } @@ -448,18 +446,18 @@ public class DrawableSet { for (Participant p : someParticipants) { final int n = list.indexOf(p); assert n != -1; - if (max == -1 || max < n) { + if (max == -1 || max < n) max = n; - } + } return list.get(max); } public double getArrowThickness() { final UStroke result = skinParam.getThickness(LineParam.sequenceArrow, null); - if (result == null) { + if (result == null) return 1; - } + return result.getThickness(); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java index ce62e684f..be39843c9 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/DrawableSetInitializer.java @@ -52,7 +52,7 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.sequencediagram.AbstractMessage; import net.sourceforge.plantuml.sequencediagram.Delay; import net.sourceforge.plantuml.sequencediagram.Divider; -import net.sourceforge.plantuml.sequencediagram.Englober; +import net.sourceforge.plantuml.sequencediagram.DollLeaf; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.GroupingLeaf; import net.sourceforge.plantuml.sequencediagram.GroupingStart; @@ -99,17 +99,16 @@ class DrawableSetInitializer { private boolean useContinueLineBecauseOfDelay() { final String strategy = drawableSet.getSkinParam().getValue("lifelineStrategy"); - if ("nosolid".equalsIgnoreCase(strategy)) { + if ("nosolid".equalsIgnoreCase(strategy)) return false; - } - if ("solid".equalsIgnoreCase(strategy)) { + + if ("solid".equalsIgnoreCase(strategy)) return true; - } - for (Event ev : drawableSet.getAllEvents()) { - if (ev instanceof Delay) { + + for (Event ev : drawableSet.getAllEvents()) + if (ev instanceof Delay) return true; - } - } + return false; } @@ -133,16 +132,14 @@ class DrawableSetInitializer { // } public DrawableSet createDrawableSet(StringBounder stringBounder) { - if (freeY2 != null) { + if (freeY2 != null) throw new IllegalStateException(); - } this.defaultLineType = useContinueLineBecauseOfDelay() ? ComponentType.CONTINUE_LINE : ComponentType.PARTICIPANT_LINE; - for (Participant p : drawableSet.getAllParticipants()) { + for (Participant p : drawableSet.getAllParticipants()) prepareParticipant(stringBounder, p); - } this.freeY2 = new FrontierStackImpl(drawableSet.getHeadHeight(stringBounder), drawableSet.getAllParticipants().size()); @@ -153,16 +150,15 @@ class DrawableSetInitializer { for (Participant p : drawableSet.getAllParticipants()) { final LivingParticipantBox living = drawableSet.getLivingParticipantBox(p); - for (int i = 0; i < p.getInitialLife(); i++) { + for (int i = 0; i < p.getInitialLife(); i++) living.getLifeLine().addSegmentVariation(LifeSegmentVariation.LARGER, freeY2.getFreeY(getFullParticipantRange()), p.getLiveSpecificBackColors()); - } + } final List col = new ArrayList<>(); - for (LivingParticipantBox livingParticipantBox : drawableSet.getAllLivingParticipantBox()) { + for (LivingParticipantBox livingParticipantBox : drawableSet.getAllLivingParticipantBox()) col.add(livingParticipantBox.getParticipantBox()); - } constraintSet = new ConstraintSet(col, freeX); @@ -170,36 +166,36 @@ class DrawableSetInitializer { final ParticipantRange range = getParticipantRange(ev); final double diffY = freeY2.getFreeY(range) - lastFreeY2.getFreeY(range); // final double diffY = freeY2.diff(lastFreeY2); - if (autonewpage > 0 && diffY > 0 && diffY + getTotalHeight(0, stringBounder) > autonewpage) { + if (autonewpage > 0 && diffY > 0 && diffY + getTotalHeight(0, stringBounder) > autonewpage) prepareNewpageSpecial(stringBounder, new Newpage(null), ev, range); - } - if (ev instanceof MessageExo) { + + if (ev instanceof MessageExo) prepareMessageExo(stringBounder, (MessageExo) ev, range); - } else if (ev instanceof Message) { + else if (ev instanceof Message) prepareMessage(stringBounder, (Message) ev, range); - } else if (ev instanceof Note) { + else if (ev instanceof Note) prepareNote(stringBounder, (Note) ev, range); - } else if (ev instanceof Notes) { + else if (ev instanceof Notes) prepareNotes(stringBounder, (Notes) ev, range); - } else if (ev instanceof LifeEvent) { + else if (ev instanceof LifeEvent) prepareLiveEvent(stringBounder, (LifeEvent) ev, range); - } else if (ev instanceof GroupingLeaf) { + else if (ev instanceof GroupingLeaf) prepareGroupingLeaf(stringBounder, (GroupingLeaf) ev, range); - } else if (ev instanceof GroupingStart) { + else if (ev instanceof GroupingStart) prepareGroupingStart(stringBounder, (GroupingStart) ev, range); - } else if (ev instanceof Newpage) { + else if (ev instanceof Newpage) prepareNewpage(stringBounder, (Newpage) ev, range); - } else if (ev instanceof Divider) { + else if (ev instanceof Divider) prepareDivider(stringBounder, (Divider) ev, range); - } else if (ev instanceof HSpace) { + else if (ev instanceof HSpace) prepareHSpace(stringBounder, (HSpace) ev, range); - } else if (ev instanceof Delay) { + else if (ev instanceof Delay) prepareDelay(stringBounder, (Delay) ev, col, range); - } else if (ev instanceof Reference) { + else if (ev instanceof Reference) prepareReference(stringBounder, (Reference) ev, range); - } else { + else throw new IllegalStateException(); - } + } takeParticipantEngloberPadding(stringBounder); @@ -215,10 +211,10 @@ class DrawableSetInitializer { private void takeParticipantEngloberPadding(StringBounder stringBounder) { final double padding = drawableSet.getSkinParam().getPadding(PaddingParam.BOX); - if (padding == 0) { + if (padding == 0) return; - } - for (Englober pe : drawableSet.getExistingParticipantEnglober(stringBounder)) { + + for (DollLeaf pe : drawableSet.getExistingParticipantEnglober(stringBounder)) { final ParticipantBox first = drawableSet.getLivingParticipantBox(pe.getFirst2TOBEPRIVATE()) .getParticipantBox(); final ParticipantBox last = drawableSet.getLivingParticipantBox(pe.getLast2TOBEPRIVATE()) @@ -229,14 +225,14 @@ class DrawableSetInitializer { } private void takeParticipantEngloberTitleWidth(StringBounder stringBounder) { - for (Englober englober : drawableSet.getExistingParticipantEnglober(stringBounder)) { - final double preferredWidth = drawableSet.getEngloberPreferedWidth(stringBounder, englober); - final ParticipantBox first = drawableSet.getLivingParticipantBox(englober.getFirst2TOBEPRIVATE()) + for (DollLeaf doll : drawableSet.getExistingParticipantEnglober(stringBounder)) { + final double preferredWidth = drawableSet.getEngloberPreferedWidth(stringBounder, doll); + final ParticipantBox first = drawableSet.getLivingParticipantBox(doll.getFirst2TOBEPRIVATE()) .getParticipantBox(); - final ParticipantBox last = drawableSet.getLivingParticipantBox(englober.getLast2TOBEPRIVATE()) + final ParticipantBox last = drawableSet.getLivingParticipantBox(doll.getLast2TOBEPRIVATE()) .getParticipantBox(); - final double x1 = drawableSet.getX1(englober); - final double x2 = drawableSet.getX2(stringBounder, englober); + final double x1 = drawableSet.getX1(doll); + final double x2 = drawableSet.getX2(stringBounder, doll); final double missing = preferredWidth - (x2 - x1); if (missing > 0) { constraintSet.pushToLeftParticipantBox(missing / 2, first, true); @@ -273,9 +269,9 @@ class DrawableSetInitializer { } final double startX = ev.getStartingX(stringBounder); final double delta1 = -startX; - if (delta1 > missingSpace1) { + if (delta1 > missingSpace1) missingSpace1 = delta1; - } + if (ev instanceof Arrow) { final Arrow a = (Arrow) ev; a.setMaxX(freeX); @@ -283,26 +279,25 @@ class DrawableSetInitializer { double width = ev.getPreferredWidth(stringBounder); if (ev instanceof Arrow) { final Arrow a = (Arrow) ev; - if (width < a.getActualWidth(stringBounder)) { + if (width < a.getActualWidth(stringBounder)) width = a.getActualWidth(stringBounder); - } + } if (ev instanceof GroupingGraphicalElementHeader) { final GroupingGraphicalElementHeader gh = (GroupingGraphicalElementHeader) ev; - if (width < gh.getActualWidth(stringBounder)) { + if (width < gh.getActualWidth(stringBounder)) width = gh.getActualWidth(stringBounder); - } + } final double endX = startX + width; final double delta2 = endX - freeX; - if (delta2 > missingSpace2) { + if (delta2 > missingSpace2) missingSpace2 = delta2; - } } - if (missingSpace1 > 0) { + if (missingSpace1 > 0) constraintSet.pushToLeft(missingSpace1); - } + freeX = constraintSet.getMaxX() + missingSpace2; } @@ -345,9 +340,9 @@ class DrawableSetInitializer { final ParticipantBox last = participants.get(participants.size() - 1); final GraphicalDelayText graphicalDivider = new GraphicalDelayText(freeY2.getFreeY(range), compText, first, last); - for (ParticipantBox p : participants) { + for (ParticipantBox p : participants) p.addDelay(graphicalDivider); - } + freeY2 = freeY2.add(graphicalDivider.getPreferredHeight(stringBounder), range); drawableSet.addEvent(delay, graphicalDivider); } @@ -355,9 +350,9 @@ class DrawableSetInitializer { final private InGroupablesStack inGroupableStack = new InGroupablesStack(); private void prepareGroupingStart(StringBounder stringBounder, GroupingStart start, ParticipantRange range) { - if (start.getType() != GroupingType.START) { + if (start.getType() != GroupingType.START) throw new IllegalStateException(); - } + final ISkinParam skinParam = new SkinParamBackcolored(drawableSet.getSkinParam(), start.getBackColorElement(), start.getBackColorGeneral()); @@ -379,9 +374,8 @@ class DrawableSetInitializer { inGroupableList.setMinWidth(element.getPreferredWidth(stringBounder)); freeY2 = freeY2.add(element.getPreferredHeight(stringBounder), range); drawableSet.addEvent(start, element); - if (start.isParallel()) { + if (start.isParallel()) freeY2 = ((FrontierStack) freeY2).openBar(); - } } @@ -390,17 +384,17 @@ class DrawableSetInitializer { final ISkinParam skinParam = new SkinParamBackcolored(drawableSet.getSkinParam(), null, m.getBackColorGeneral()); if (m.getType() == GroupingType.ELSE) { - if (m.isParallel()) { + if (m.isParallel()) freeY2 = ((FrontierStack) freeY2).restore(); - } + final Component compElse = drawableSet.getSkin().createComponent(m.getUsedStyles(), ComponentType.GROUPING_ELSE, null, skinParam, Display.create(m.getComment())); final Lazy lazy = new Lazy() { public double getNow() { final GraphicalElement after = drawableSet.getEvent(m.getJustAfter()); - if (after == null) { + if (after == null) return 0; - } + return after.getStartingY(); } }; @@ -418,9 +412,9 @@ class DrawableSetInitializer { noteOnMessage.getNoteStyle().getNoteComponentType(), sk, noteOnMessage.getStrings()); notes.add(note); } - if (m.isParallel()) { + if (m.isParallel()) freeY2 = ((FrontierStack) freeY2).closeBar(); - } + final GroupingGraphicalElementHeader groupingHeaderStart = (GroupingGraphicalElementHeader) drawableSet .getEvent(m.getGroupingStart()); if (groupingHeaderStart != null) { @@ -434,9 +428,9 @@ class DrawableSetInitializer { final double preferredHeight = comp.getPreferredHeight(stringBounder); freeY2 = freeY2.add(preferredHeight, range); inGroupableStack.pop(); - } else { + } else throw new IllegalStateException(); - } + drawableSet.addEvent(m, element); } @@ -452,9 +446,9 @@ class DrawableSetInitializer { private NoteBox createNoteBox(StringBounder stringBounder, Note n, ParticipantRange range) { LivingParticipantBox p1 = drawableSet.getLivingParticipantBox(n.getParticipant()); LivingParticipantBox p2; - if (n.getParticipant2() == null) { + if (n.getParticipant2() == null) p2 = null; - } else { + else { p2 = drawableSet.getLivingParticipantBox(n.getParticipant2()); if (p1.getParticipantBox().getCenterX(stringBounder) > p2.getParticipantBox().getCenterX(stringBounder)) { final LivingParticipantBox tmp = p1; @@ -464,14 +458,14 @@ class DrawableSetInitializer { } final ISkinParam skinParam = n.getSkinParamBackcolored(drawableSet.getSkinParam()); final ComponentType type = n.getNoteStyle().getNoteComponentType(); - if (p1 == null && p2 == null) { + if (p1 == null && p2 == null) for (LivingParticipantBox p : drawableSet.getAllLivingParticipantBox()) { - if (p1 == null) { + if (p1 == null) p1 = p; - } + p2 = p; } - } + final Component component = drawableSet.getSkin().createComponentNote(n.getUsedStyles(), type, skinParam, n.getStrings(), n.getPosition()); final NoteBox noteBox = new NoteBox(freeY2.getFreeY(range), component, p1, p2, n.getPosition(), n.getUrl()); @@ -501,26 +495,26 @@ class DrawableSetInitializer { double pos = 0; if (message != null) { int delta1 = 0; - if (message.isCreate()) { + if (message.isCreate()) delta1 += 10; - } else if (OptionFlags.STRICT_SELFMESSAGE_POSITION && message.isSelfMessage()) { + else if (OptionFlags.STRICT_SELFMESSAGE_POSITION && message.isSelfMessage()) delta1 += 8; - } + pos = message.getPosYstartLevel() + delta1; } final LifeLine line1 = drawableSet.getLivingParticipantBox(lifeEvent.getParticipant()).getLifeLine(); line1.addSegmentVariation(LifeSegmentVariation.LARGER, pos, lifeEvent.getSpecificColors()); } else if (lifeEvent.getType() == LifeEventType.DESTROY || lifeEvent.getType() == LifeEventType.DEACTIVATE) { double delta = 0; - if (OptionFlags.STRICT_SELFMESSAGE_POSITION && message != null && message.isSelfMessage()) { + if (OptionFlags.STRICT_SELFMESSAGE_POSITION && message != null && message.isSelfMessage()) delta += 7; - } + final Participant p = lifeEvent.getParticipant(); final LifeLine line = drawableSet.getLivingParticipantBox(p).getLifeLine(); double pos2 = y; - if (message != null) { + if (message != null) pos2 = message.getPosYendLevel() - delta; - } + line.addSegmentVariation(LifeSegmentVariation.SMALLER, pos2, lifeEvent.getSpecificColors()); } @@ -534,14 +528,13 @@ class DrawableSetInitializer { if (message == null) { pos2 = y; freeY2 = freeY2.add(comp.getPreferredHeight(stringBounder), range); - } else { + } else pos2 = message.getPosYendLevel() - delta; - } + final LifeDestroy destroy = new LifeDestroy(pos2, livingParticipantBox.getParticipantBox(), comp); drawableSet.addEvent(lifeEvent, destroy); - } else { + } else drawableSet.addEvent(lifeEvent, new GraphicalElementLiveEvent(y)); - } } @@ -577,18 +570,17 @@ class DrawableSetInitializer { - pbox1.getPreferredWidth(stringBounder) / 2 - pbox2.getPreferredWidth(stringBounder) / 2; final Constraint constraint; - if (p1 == p2) { + if (p1 == p2) constraint = constraintSet.getConstraintAfter(pbox1); - } else { + else constraint = constraintSet.getConstraint(pbox1, pbox2); - } + constraint.ensureValue(width); inGroupableStack.addElement(graphicalReference); inGroupableStack.addElement(p1); - if (p1 != p2) { + if (p1 != p2) inGroupableStack.addElement(p2); - } freeY2 = freeY2.add(graphicalReference.getPreferredHeight(stringBounder), range); drawableSet.addEvent(reference, graphicalReference); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/Dolls.java similarity index 70% rename from src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java rename to src/net/sourceforge/plantuml/sequencediagram/teoz/Dolls.java index cf438593b..aaf906ffe 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/Englobers.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/Dolls.java @@ -41,18 +41,18 @@ import java.util.List; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.real.RealUtils; -import net.sourceforge.plantuml.sequencediagram.Englober; +import net.sourceforge.plantuml.sequencediagram.DollLeaf; import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.ParticipantEnglober; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.ugraphic.UGraphic; -public class Englobers { +public class Dolls { - private final List englobers = new ArrayList<>(); + private final List dolls = new ArrayList<>(); - public Englobers(TileArguments tileArguments) { - Englober pending = null; + public Dolls(TileArguments tileArguments) { + DollLeaf pending = null; for (Participant p : tileArguments.getLivingSpaces().participants()) { final ParticipantEnglober englober = tileArguments.getLivingSpaces().get(p).getEnglober(); if (englober == null) { @@ -64,64 +64,64 @@ public class Englobers { pending.add(p); continue; } - pending = Englober.createTeoz(englober, p, tileArguments, + pending = DollLeaf.createTeoz(englober, p, tileArguments, tileArguments.getSkinParam().getCurrentStyleBuilder()); - englobers.add(pending); + dolls.add(pending); } } public int size() { - return englobers.size(); + return dolls.size(); } public double getOffsetForEnglobers(StringBounder stringBounder) { double result = 0; - for (Englober englober : englobers) { - final double height = englober.getPreferredHeight(); - if (height > result) { + for (DollLeaf doll : dolls) { + final double height = doll.getPreferredHeight(); + if (height > result) result = height; - } + } return result; } public void addConstraints(StringBounder stringBounder) { - Englober last = null; - for (Englober current : englobers) { - current.addInternalConstraints(); - if (last != null) { - last.addConstraintAfter(current); - } - last = current; + DollLeaf last = null; + for (DollLeaf doll : dolls) { + doll.addInternalConstraints(); + if (last != null) + last.addConstraintAfter(doll); + + last = doll; } } public void drawEnglobers(UGraphic ug, double height, Context2D context) { - for (Englober englober : englobers) { - englober.drawEnglober(ug, height, context); - } + for (DollLeaf doll : dolls) + doll.drawMe(ug, height, context); + } public Real getMinX(StringBounder stringBounder) { - if (size() == 0) { + if (size() == 0) throw new IllegalStateException(); - } - final List all = new ArrayList<>(); - for (Englober englober : englobers) { - all.add(englober.getMinX(stringBounder)); - } - return RealUtils.min(all); + + final List result = new ArrayList<>(); + for (DollLeaf doll : dolls) + result.add(doll.getMinX(stringBounder)); + + return RealUtils.min(result); } public Real getMaxX(StringBounder stringBounder) { - if (size() == 0) { + if (size() == 0) throw new IllegalStateException(); - } - final List all = new ArrayList<>(); - for (Englober englober : englobers) { - all.add(englober.getMaxX(stringBounder)); - } - return RealUtils.max(all); + + final List result = new ArrayList<>(); + for (DollLeaf doll : dolls) + result.add(doll.getMaxX(stringBounder)); + + return RealUtils.max(result); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java index 500005894..0f7fb5826 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/PlayingSpace.java @@ -60,7 +60,7 @@ public class PlayingSpace implements Bordered { private final List linkAnchors; private final ISkinParam skinParam; - public PlayingSpace(SequenceDiagram diagram, Englobers englobers, TileArguments tileArguments) { + public PlayingSpace(SequenceDiagram diagram, Dolls dolls, TileArguments tileArguments) { this.livingSpaces = tileArguments.getLivingSpaces(); this.linkAnchors = diagram.getLinkAnchors(); @@ -72,9 +72,9 @@ public class PlayingSpace implements Bordered { min2.add(tileArguments.getOrigin()); max2.add(tileArguments.getOrigin()); - if (englobers.size() > 0) { - min2.add(englobers.getMinX(tileArguments.getStringBounder())); - max2.add(englobers.getMaxX(tileArguments.getStringBounder())); + if (dolls.size() > 0) { + min2.add(dolls.getMinX(tileArguments.getStringBounder())); + max2.add(dolls.getMaxX(tileArguments.getStringBounder())); } tiles.addAll(TileBuilder.buildSeveral(diagram.events().iterator(), tileArguments, null)); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java index c6a9bc5e6..d550a5f7d 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/SequenceDiagramFileMakerTeoz.java @@ -99,7 +99,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { this.legend = getLegend(); this.caption = annotatedWorker.getCaption(); - this.heightEnglober1 = englobers.getOffsetForEnglobers(stringBounder); + this.heightEnglober1 = dolls.getOffsetForEnglobers(stringBounder); this.heightEnglober2 = heightEnglober1 == 0 ? 0 : 10; final double totalWidth = MathUtils.max(body.calculateDimension(stringBounder).getWidth(), @@ -115,7 +115,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { this.dimTotal = new Dimension2DDouble(totalWidth, totalHeight); } - private Englobers englobers; + private Dolls dolls; private final StringBounder stringBounder; private final TextBlock footer; @@ -193,11 +193,11 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { final TileArguments tileArguments = new TileArguments(stringBounder, livingSpaces, skin, diagram.getSkinParam(), origin); - this.englobers = new Englobers(tileArguments); - final PlayingSpace mainTile = new PlayingSpace(diagram, englobers, tileArguments); + this.dolls = new Dolls(tileArguments); + final PlayingSpace mainTile = new PlayingSpace(diagram, dolls, tileArguments); this.livingSpaces.addConstraints(stringBounder); mainTile.addConstraints(); - this.englobers.addConstraints(stringBounder); + this.dolls.addConstraints(stringBounder); origin.compileNow(); tileArguments.setBordered(mainTile); return mainTile; @@ -262,7 +262,7 @@ public class SequenceDiagramFileMakerTeoz implements FileMaker { final UTranslate min1translate = UTranslate.dx(-min1.getCurrentValue()); ug = ug.apply(min1translate); - englobers.drawEnglobers(goDownAndCenterForEnglobers(ug), + dolls.drawEnglobers(goDownAndCenterForEnglobers(ug), body.calculateDimension(stringBounder).getHeight() + heightEnglober1 + heightEnglober2 / 2, new SimpleContext2D(true)); diff --git a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java index 9c57f755a..48cc98a5f 100644 --- a/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java +++ b/src/net/sourceforge/plantuml/skin/AbstractTextualComponent.java @@ -117,7 +117,7 @@ public abstract class AbstractTextualComponent extends AbstractComponent { maxMessageSize); } else { textBlock = this.display.create0(fc, horizontalAlignment, spriteContainer, maxMessageSize, CreoleMode.FULL, - fontForStereotype, htmlColorForStereotype); + fontForStereotype, htmlColorForStereotype, marginX1, marginX2); } this.alignment = horizontalAlignment; } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 0d94b0ca7..db372f3d5 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -80,7 +80,7 @@ public class Version { } public static int beta() { - final int beta = 7; + final int beta = 8; return beta; }