1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-22 21:15:09 +00:00

feat: version 1.2023.6

This commit is contained in:
Arnaud Roques 2023-04-18 18:14:10 +02:00
parent e23d7e56fc
commit beb3cb25e2
30 changed files with 375 additions and 200 deletions

View File

@ -481,9 +481,9 @@ public class StringUtils {
final Matcher matcher = pattern.matcher(s); final Matcher matcher = pattern.matcher(s);
final StringBuffer result = new StringBuffer(); // Can't be switched to StringBuilder in order to support Java 8 final StringBuffer result = new StringBuffer(); // Can't be switched to StringBuilder in order to support Java 8
while (matcher.find()) { while (matcher.find()) {
final String num = matcher.group(1); final int codePoint = Integer.parseInt(matcher.group(1));
final char c = (char) Integer.parseInt(num); final String unicode = new String(Character.toChars(codePoint));
matcher.appendReplacement(result, "" + c); matcher.appendReplacement(result, unicode);
} }
matcher.appendTail(result); matcher.appendTail(result);
return result.toString(); return result.toString();

View File

@ -44,9 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder; import net.sourceforge.plantuml.activitydiagram3.ftile.vcompact.cond.ConditionalBuilder;
import net.sourceforge.plantuml.decoration.Rainbow;
import net.sourceforge.plantuml.klimt.color.HColor; import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.font.FontConfiguration;
import net.sourceforge.plantuml.skin.Pragma; import net.sourceforge.plantuml.skin.Pragma;
import net.sourceforge.plantuml.style.PName; import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
@ -74,23 +72,19 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder()); final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond() final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam().getCurrentStyleBuilder()); .getMergedStyle(skinParam().getCurrentStyleBuilder());
final HColor borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
final HColor backColor = branch0.getColor() == null final HColor backColor = branch0.getColor() == null
? styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet()) ? styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet())
: branch0.getColor(); : branch0.getColor();
final Rainbow arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());
final FontConfiguration fcTest = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet());
final FontConfiguration fcArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet());
if (thens.size() > 1) { if (thens.size() > 1) {
if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */) if (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */)
return FtileIfLongVertical.create(swimlane, borderColor, backColor, arrowColor, getFactory(), return FtileIfLongVertical.create(swimlane, backColor, getFactory(), conditionStyle, thens, elseBranch,
conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile); topInlinkRendering, afterEndwhile, styleArrow, styleDiamond);
return FtileIfLongHorizontal.create(swimlane, borderColor, backColor, arrowColor, getFactory(), return FtileIfLongHorizontal.create(swimlane, backColor, getFactory(), conditionStyle, thens, elseBranch,
conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile, fcTest); topInlinkRendering, afterEndwhile, styleArrow, styleDiamond);
} }
return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle, return ConditionalBuilder.create(swimlane, backColor, getFactory(), conditionStyle, conditionEndStyle,
conditionEndStyle, thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest, url); thens.get(0), elseBranch, skinParam(), getStringBounder(), url, styleArrow, styleDiamond);
} }
} }

View File

@ -60,8 +60,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2; import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
import net.sourceforge.plantuml.decoration.Rainbow; import net.sourceforge.plantuml.decoration.Rainbow;
import net.sourceforge.plantuml.klimt.LineBreakStrategy;
import net.sourceforge.plantuml.klimt.UTranslate; import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.HColor; import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.creole.CreoleMode;
import net.sourceforge.plantuml.klimt.creole.Display; import net.sourceforge.plantuml.klimt.creole.Display;
import net.sourceforge.plantuml.klimt.drawing.UGraphic; import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.FontConfiguration; import net.sourceforge.plantuml.klimt.font.FontConfiguration;
@ -70,6 +72,8 @@ import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
import net.sourceforge.plantuml.klimt.geom.XDimension2D; import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.geom.XPoint2D; import net.sourceforge.plantuml.klimt.geom.XPoint2D;
import net.sourceforge.plantuml.klimt.shape.TextBlock; import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
class FtileIfLongHorizontal extends AbstractFtile { class FtileIfLongHorizontal extends AbstractFtile {
@ -143,11 +147,17 @@ class FtileIfLongHorizontal extends AbstractFtile {
return getSwimlaneIn(); return getSwimlaneIn();
} }
static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, static Ftile create(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory, ConditionStyle conditionStyle,
FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens, Branch branch2, List<Branch> thens, Branch branch2, LinkRendering topInlinkRendering, LinkRendering afterEndwhile,
FontConfiguration fcArrow, LinkRendering topInlinkRendering, LinkRendering afterEndwhile, Style styleArrow, Style styleDiamond) {
FontConfiguration fcTest) {
Objects.requireNonNull(afterEndwhile); Objects.requireNonNull(afterEndwhile);
final HColor borderColor = styleDiamond.value(PName.LineColor)
.asColor(ftileFactory.skinParam().getIHtmlColorSet());
final Rainbow arrowColor = Rainbow.build(styleArrow, ftileFactory.skinParam().getIHtmlColorSet());
final FontConfiguration fcTest = styleDiamond.getFontConfiguration(ftileFactory.skinParam().getIHtmlColorSet());
final FontConfiguration fcArrow = styleArrow.getFontConfiguration(ftileFactory.skinParam().getIHtmlColorSet());
final List<Ftile> tiles = new ArrayList<>(); final List<Ftile> tiles = new ArrayList<>();
for (Branch branch : thens) for (Branch branch : thens)
@ -160,9 +170,10 @@ class FtileIfLongHorizontal extends AbstractFtile {
for (Branch branch : thens) { for (Branch branch : thens) {
final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT, final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
ftileFactory.skinParam()); ftileFactory.skinParam());
final TextBlock tbTest = branch.getLabelTest().create(fcTest, final LineBreakStrategy lineBreak = styleDiamond.wrapWidth();
final TextBlock tbTest = branch.getLabelTest().create0(fcTest,
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
ftileFactory.skinParam()); ftileFactory.skinParam(), lineBreak, CreoleMode.FULL, null, null);
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor(); final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, borderColor, FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, borderColor,

View File

@ -69,6 +69,8 @@ import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
import net.sourceforge.plantuml.klimt.geom.XDimension2D; import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.geom.XPoint2D; import net.sourceforge.plantuml.klimt.geom.XPoint2D;
import net.sourceforge.plantuml.klimt.shape.TextBlock; import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.ConditionStyle; import net.sourceforge.plantuml.svek.ConditionStyle;
class FtileIfLongVertical extends AbstractFtile { class FtileIfLongVertical extends AbstractFtile {
@ -126,17 +128,21 @@ class FtileIfLongVertical extends AbstractFtile {
return getSwimlaneIn(); return getSwimlaneIn();
} }
static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, static Ftile create(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory, ConditionStyle conditionStyle,
FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens, Branch branch2, List<Branch> thens, Branch branch2, LinkRendering topInlinkRendering, LinkRendering afterEndwhile,
FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) { Style styleArrow, Style styleDiamond) {
final FontConfiguration fcArrow = styleArrow.getFontConfiguration(ftileFactory.skinParam().getIHtmlColorSet());
final HColor borderColor = styleDiamond.value(PName.LineColor).asColor(ftileFactory.skinParam().getIHtmlColorSet());
final Rainbow arrowColor = Rainbow.build(styleArrow, ftileFactory.skinParam().getIHtmlColorSet());
List<Ftile> diamonds = new ArrayList<>(); List<Ftile> diamonds = new ArrayList<>();
double west = 10; double west = 10;
for (Branch branch : thens) { for (Branch branch : thens) {
final TextBlock tb1 = branch.getDisplayPositive().create(fc, HorizontalAlignment.LEFT, final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
ftileFactory.skinParam()); ftileFactory.skinParam());
final TextBlock tbTest = branch.getLabelTest().create(fc, final TextBlock tbTest = branch.getLabelTest().create(fcArrow,
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT), ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
ftileFactory.skinParam()); ftileFactory.skinParam());
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), backColor, borderColor, FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), backColor, borderColor,
@ -146,7 +152,7 @@ class FtileIfLongVertical extends AbstractFtile {
diamonds.add(diamond); diamonds.add(diamond);
if (Display.isNull(branch.getInlabel()) == false) { if (Display.isNull(branch.getInlabel()) == false) {
final TextBlock tbInlabel = branch.getInlabel().create(fc, HorizontalAlignment.LEFT, final TextBlock tbInlabel = branch.getInlabel().create(fcArrow, HorizontalAlignment.LEFT,
ftileFactory.skinParam()); ftileFactory.skinParam());
west = Math.max(west, tbInlabel.calculateDimension(ftileFactory.getStringBounder()).getWidth()); west = Math.max(west, tbInlabel.calculateDimension(ftileFactory.getStringBounder()).getWidth());
} }
@ -178,7 +184,7 @@ class FtileIfLongVertical extends AbstractFtile {
final Branch branch = thens.get(i + 1); final Branch branch = thens.get(i + 1);
TextBlock tbInlabel = null; TextBlock tbInlabel = null;
if (Display.isNull(branch.getInlabel()) == false) if (Display.isNull(branch.getInlabel()) == false)
tbInlabel = branch.getInlabel().create(fc, HorizontalAlignment.LEFT, ftileFactory.skinParam()); tbInlabel = branch.getInlabel().create(fcArrow, HorizontalAlignment.LEFT, ftileFactory.skinParam());
conns.add(result.new ConnectionVertical(diamonds.get(i), diamonds.get(i + 1), arrowColor, tbInlabel)); conns.add(result.new ConnectionVertical(diamonds.get(i), diamonds.get(i + 1), arrowColor, tbInlabel));
} }
@ -189,7 +195,7 @@ class FtileIfLongVertical extends AbstractFtile {
final Rainbow topInColor = topInlinkRendering.getRainbow(arrowColor); final Rainbow topInColor = topInlinkRendering.getRainbow(arrowColor);
conns.add(result.new ConnectionIn(topInColor)); conns.add(result.new ConnectionIn(topInColor));
final TextBlock tb2 = branch2.getDisplayPositive().create(fc, HorizontalAlignment.LEFT, final TextBlock tb2 = branch2.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
ftileFactory.skinParam()); ftileFactory.skinParam());
conns.add(result.new ConnectionLastElse(topInColor, tb2)); conns.add(result.new ConnectionLastElse(topInColor, tb2));
conns.add(result.new ConnectionLastElseOut(arrowColor)); conns.add(result.new ConnectionLastElseOut(arrowColor));

View File

@ -63,6 +63,7 @@ import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
import net.sourceforge.plantuml.klimt.geom.XDimension2D; import net.sourceforge.plantuml.klimt.geom.XDimension2D;
import net.sourceforge.plantuml.klimt.shape.TextBlock; import net.sourceforge.plantuml.klimt.shape.TextBlock;
import net.sourceforge.plantuml.style.ISkinParam; import net.sourceforge.plantuml.style.ISkinParam;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName; import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style; import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
@ -100,27 +101,21 @@ public class ConditionalBuilder {
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.arrow); return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
} }
public ConditionalBuilder(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, public ConditionalBuilder(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory,
FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2,
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder, ISkinParam skinParam, StringBounder stringBounder, Url url, Style styleArrow, Style styleDiamond) {
FontConfiguration fontArrow, FontConfiguration fontTest, Url url) {
if (backColor == null) if (backColor == null)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
if (borderColor == null)
throw new IllegalArgumentException();
if (arrowColor == null)
throw new IllegalArgumentException();
final Style styleArrow = getStyleSignatureArrow().getMergedStyle(skinParam.getCurrentStyleBuilder());
final Style styleDiamond = getStyleSignatureDiamond().getMergedStyle(skinParam.getCurrentStyleBuilder());
this.fontTest = styleDiamond.getFontConfiguration(skinParam.getIHtmlColorSet()); this.fontTest = styleDiamond.getFontConfiguration(skinParam.getIHtmlColorSet());
this.fontArrow = styleArrow.getFontConfiguration(skinParam.getIHtmlColorSet()); this.fontArrow = styleArrow.getFontConfiguration(skinParam.getIHtmlColorSet());
this.diamondLineBreak = styleDiamond.wrapWidth(); this.diamondLineBreak = styleDiamond.wrapWidth();
this.labelLineBreak = styleArrow.wrapWidth(); this.labelLineBreak = styleArrow.wrapWidth();
this.borderColor = borderColor;
this.backColor = backColor; this.backColor = backColor;
this.arrowColor = arrowColor;
this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
this.arrowColor = Rainbow.build(styleArrow, skinParam.getIHtmlColorSet());
this.ftileFactory = ftileFactory; this.ftileFactory = ftileFactory;
this.swimlane = swimlane; this.swimlane = swimlane;
@ -137,13 +132,11 @@ public class ConditionalBuilder {
} }
static public Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor, static public Ftile create(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory,
FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2,
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder, ISkinParam skinParam, StringBounder stringBounder, Url url, Style styleArrow, Style styleDiamond) {
FontConfiguration fcArrow, FontConfiguration fcTest, Url url) { final ConditionalBuilder builder = new ConditionalBuilder(swimlane, backColor, ftileFactory, conditionStyle,
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor, conditionEndStyle, branch1, branch2, skinParam, stringBounder, url, styleArrow, styleDiamond);
ftileFactory, conditionStyle, conditionEndStyle, branch1, branch2, skinParam, stringBounder, fcArrow,
fcTest, url);
if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false) if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false)
return builder.createDown(builder.branch1, builder.branch2); return builder.createDown(builder.branch1, builder.branch2);

View File

@ -53,9 +53,7 @@ import net.sourceforge.plantuml.regex.IRegex;
import net.sourceforge.plantuml.regex.RegexConcat; import net.sourceforge.plantuml.regex.RegexConcat;
import net.sourceforge.plantuml.regex.RegexLeaf; import net.sourceforge.plantuml.regex.RegexLeaf;
import net.sourceforge.plantuml.regex.RegexResult; import net.sourceforge.plantuml.regex.RegexResult;
import net.sourceforge.plantuml.sequencediagram.AbstractMessage; import net.sourceforge.plantuml.sequencediagram.EventWithNote;
import net.sourceforge.plantuml.sequencediagram.EventWithDeactivate;
import net.sourceforge.plantuml.sequencediagram.GroupingLeaf;
import net.sourceforge.plantuml.sequencediagram.Note; import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NotePosition; import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.NoteStyle;
@ -141,37 +139,34 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines)
throws NoSuchColorException { throws NoSuchColorException {
final EventWithDeactivate m = diagram.getLastEventWithDeactivate(); final EventWithNote event = diagram.getLastEventWithNote();
if (m instanceof AbstractMessage || m instanceof GroupingLeaf) { if (event == null)
final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0))); return CommandExecutionResult.ok();
Url url = null;
if (line0.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
url = urlBuilder.getUrl(line0.get("URL", 0));
}
final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0)); final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0)));
final Display display = diagram.manageVariable(lines.toDisplay()); Url url = null;
final String backcolor0 = line0.get("COLOR", 0); if (line0.get("URL", 0) != null) {
Colors colors = Colors.empty().add(ColorType.BACK, final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
backcolor0 == null ? null : HColorSet.instance().getColor(backcolor0)); url = urlBuilder.getUrl(line0.get("URL", 0));
final Note note = new Note(display, position, style, diagram.getSkinParam().getCurrentStyleBuilder());
final String stereotypeString = line0.getLazzy("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = Stereotype.build(stereotypeString);
colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), ColorParam.noteBackground,
ColorParam.noteBorder);
note.setStereotype(stereotype);
}
note.setUrl(url);
note.setColors(colors);
if (m instanceof AbstractMessage) {
((AbstractMessage) m).setNote(note);
} else {
((GroupingLeaf) m).setNote(note);
}
} }
final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0));
final Display display = diagram.manageVariable(lines.toDisplay());
final String backcolor0 = line0.get("COLOR", 0);
Colors colors = Colors.empty().add(ColorType.BACK,
backcolor0 == null ? null : HColorSet.instance().getColor(backcolor0));
final Note note = new Note(display, position, style, diagram.getSkinParam().getCurrentStyleBuilder());
final String stereotypeString = line0.getLazzy("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = Stereotype.build(stereotypeString);
colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), ColorParam.noteBackground,
ColorParam.noteBorder);
note.setStereotype(stereotype);
}
note.setUrl(url);
note.setColors(colors);
event.addNote(note);
return CommandExecutionResult.ok(); return CommandExecutionResult.ok();
} }

View File

@ -0,0 +1,41 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://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.project;
public enum DayStatus {
OPEN, CLOSE;
}

View File

@ -35,9 +35,9 @@
*/ */
package net.sourceforge.plantuml.project; package net.sourceforge.plantuml.project;
import java.util.Collection; import java.util.EnumMap;
import java.util.EnumSet; import java.util.HashMap;
import java.util.HashSet; import java.util.Map;
import net.sourceforge.plantuml.project.core3.Histogram; import net.sourceforge.plantuml.project.core3.Histogram;
import net.sourceforge.plantuml.project.core3.TimeLine; import net.sourceforge.plantuml.project.core3.TimeLine;
@ -46,25 +46,23 @@ import net.sourceforge.plantuml.project.time.DayOfWeek;
public class OpenClose implements Histogram, LoadPlanable { public class OpenClose implements Histogram, LoadPlanable {
private final Collection<DayOfWeek> closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class); private final Map<DayOfWeek, DayStatus> weekdayStatus = new EnumMap<>(DayOfWeek.class);
private final Collection<DayOfWeek> openedDayOfWeek = EnumSet.noneOf(DayOfWeek.class); private final Map<Day, DayStatus> dayStatus = new HashMap<>();
private final Collection<Day> closedDays = new HashSet<>();
private final Collection<Day> openedDays = new HashSet<>();
private Day startingDay; private Day startingDay;
public int daysInWeek() { public int daysInWeek() {
return 7 - closedDayOfWeek.size(); int result = 7;
for (DayStatus status : weekdayStatus.values())
if (status == DayStatus.CLOSE)
result--;
return result;
} }
private boolean isThereSomeChangeAfter(Day day) { private boolean isThereSomeChangeAfter(Day day) {
if (closedDayOfWeek.size() > 0) if (weekdayStatus.size() > 0)
return true; return true;
for (Day tmp : closedDays) for (Day tmp : dayStatus.keySet())
if (tmp.compareTo(day) >= 0)
return true;
for (Day tmp : openedDays)
if (tmp.compareTo(day) >= 0) if (tmp.compareTo(day) >= 0)
return true; return true;
@ -72,14 +70,10 @@ public class OpenClose implements Histogram, LoadPlanable {
} }
private boolean isThereSomeChangeBefore(Day day) { private boolean isThereSomeChangeBefore(Day day) {
if (closedDayOfWeek.size() > 0) if (weekdayStatus.size() > 0)
return true; return true;
for (Day tmp : closedDays) for (Day tmp : dayStatus.keySet())
if (tmp.compareTo(day) <= 0)
return true;
for (Day tmp : openedDays)
if (tmp.compareTo(day) <= 0) if (tmp.compareTo(day) <= 0)
return true; return true;
@ -87,28 +81,40 @@ public class OpenClose implements Histogram, LoadPlanable {
} }
public boolean isClosed(Day day) { public boolean isClosed(Day day) {
if (openedDays.contains(day)) final DayStatus status = getLocalStatus(day);
return false; if (status != null)
return status == DayStatus.CLOSE;
return false;
}
private DayStatus getLocalStatus(Day day) {
final DayStatus status1 = dayStatus.get(day);
if (status1 != null)
return status1;
final DayOfWeek dayOfWeek = day.getDayOfWeek(); final DayOfWeek dayOfWeek = day.getDayOfWeek();
return closedDayOfWeek.contains(dayOfWeek) || closedDays.contains(day); final DayStatus status2 = weekdayStatus.get(dayOfWeek);
if (status2 != null)
return status2;
return null;
} }
public void close(DayOfWeek day) { public void close(DayOfWeek day) {
closedDayOfWeek.add(day); weekdayStatus.put(day, DayStatus.CLOSE);
} }
public void open(DayOfWeek day) { public void open(DayOfWeek day) {
closedDayOfWeek.remove(day); weekdayStatus.put(day, DayStatus.OPEN);
openedDayOfWeek.add(day);
} }
public void close(Day day) { public void close(Day day) {
closedDays.add(day); dayStatus.put(day, DayStatus.CLOSE);
} }
public void open(Day day) { public void open(Day day) {
openedDays.add(day); dayStatus.put(day, DayStatus.OPEN);
} }
public final Day getStartingDay() { public final Day getStartingDay() {
@ -180,11 +186,10 @@ public class OpenClose implements Histogram, LoadPlanable {
return new LoadPlanable() { return new LoadPlanable() {
@Override @Override
public int getLoadAt(Day instant) { public int getLoadAt(Day instant) {
if (except.openedDays.contains(instant)) final DayStatus exceptStatus = except.getLocalStatus(instant);
return 100; if (exceptStatus == DayStatus.CLOSE)
if (except.closedDays.contains(instant))
return 0; return 0;
if (except.openedDayOfWeek.size() > 0 && except.openedDayOfWeek.contains(instant.getDayOfWeek())) else if (exceptStatus == DayStatus.OPEN)
return 100; return 100;
return OpenClose.this.getLoadAt(instant); return OpenClose.this.getLoadAt(instant);
} }

View File

@ -79,13 +79,16 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
@Override @Override
protected double getShapeHeight(StringBounder stringBounder) { protected double getShapeHeight(StringBounder stringBounder) {
// final Style style = getStyle(); final TextBlock title = getTitle();
// final ClockwiseTopRightBottomLeft padding = style.getPadding(); final XDimension2D titleDim = title.calculateDimension(stringBounder);
return Math.max(titleDim.getHeight(), getDiamondHeight());
}
private double getDiamondHeight() {
int result = (int) getFontConfiguration().getFont().getSize2D(); int result = (int) getFontConfiguration().getFont().getSize2D();
if (result % 2 == 1) if (result % 2 == 1)
result--; result--;
return result; return result;
} }
@Override @Override
@ -115,7 +118,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
} else { } else {
final double x1 = timeScale.getStartingPosition(start); final double x1 = timeScale.getStartingPosition(start);
final double x2 = timeScale.getEndingPosition(start); final double x2 = timeScale.getEndingPosition(start);
final double width = getShapeHeight(ug.getStringBounder()); final double width = getDiamondHeight();
final double delta = x2 - x1 - width; final double delta = x2 - x1 - width;
x = x2 - delta / 2 + padding.getLeft(); x = x2 - delta / 2 + padding.getLeft();
} }
@ -137,7 +140,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
final double x1 = timeScale.getStartingPosition(start); final double x1 = timeScale.getStartingPosition(start);
final double x2 = timeScale.getEndingPosition(start); final double x2 = timeScale.getEndingPosition(start);
final double width = getShapeHeight(ug.getStringBounder()); final double width = getDiamondHeight();
final double delta = x2 - x1 - width; final double delta = x2 - x1 - width;
if (url != null) if (url != null)
@ -158,7 +161,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
} }
private void drawShape(UGraphic ug) { private void drawShape(UGraphic ug) {
ug.draw(getDiamond(ug.getStringBounder())); ug.draw(getDiamond());
} }
@Override @Override
@ -174,8 +177,8 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
getY(stringBounder).getCurrentValue() + h); getY(stringBounder).getCurrentValue() + h);
} }
private UShape getDiamond(StringBounder stringBounder) { private UShape getDiamond() {
final double h = getShapeHeight(stringBounder); final double h = getDiamondHeight();
final UPolygon result = new UPolygon(); final UPolygon result = new UPolygon();
result.addPoint(h / 2, 0); result.addPoint(h / 2, 0);
result.addPoint(h, h / 2); result.addPoint(h, h / 2);
@ -188,7 +191,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
public double getX1(TaskAttribute taskAttribute) { public double getX1(TaskAttribute taskAttribute) {
final double x1 = timeScale.getStartingPosition(start); final double x1 = timeScale.getStartingPosition(start);
final double x2 = timeScale.getEndingPosition(start); final double x2 = timeScale.getEndingPosition(start);
final double width = getShapeHeight(null); final double width = getDiamondHeight();
final double delta = x2 - x1 - width; final double delta = x2 - x1 - width;
return x1 + delta; return x1 + delta;
} }
@ -197,7 +200,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
public double getX2(TaskAttribute taskAttribute) { public double getX2(TaskAttribute taskAttribute) {
final double x1 = timeScale.getStartingPosition(start); final double x1 = timeScale.getStartingPosition(start);
final double x2 = timeScale.getEndingPosition(start); final double x2 = timeScale.getEndingPosition(start);
final double width = getShapeHeight(null); final double width = getDiamondHeight();
final double delta = x2 - x1 - width; final double delta = x2 - x1 - width;
return x2 - delta; return x2 - delta;
} }

View File

@ -53,7 +53,7 @@ import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.style.WithStyle; import net.sourceforge.plantuml.style.WithStyle;
import net.sourceforge.plantuml.url.Url; import net.sourceforge.plantuml.url.Url;
public abstract class AbstractMessage extends AbstractEvent implements EventWithDeactivate, WithStyle { public abstract class AbstractMessage extends AbstractEvent implements EventWithDeactivate, WithStyle, EventWithNote {
private Stereotype stereotype; private Stereotype stereotype;
@ -199,7 +199,8 @@ public abstract class AbstractMessage extends AbstractEvent implements EventWith
return noteOnMessages; return noteOnMessages;
} }
public final void setNote(Note note) { @Override
public final void addNote(Note note) {
if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT
&& note.getPosition() != NotePosition.BOTTOM && note.getPosition() != NotePosition.TOP) && note.getPosition() != NotePosition.BOTTOM && note.getPosition() != NotePosition.TOP)
throw new IllegalArgumentException(); throw new IllegalArgumentException();

View File

@ -0,0 +1,42 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2024, Arnaud Roques
*
* Project Info: https://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* https://plantuml.com/patreon (only 1$ per month!)
* https://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;
public interface EventWithNote extends Event {
public void addNote(Note note);
}

View File

@ -43,7 +43,7 @@ import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.style.StyleBuilder; import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.url.Url; import net.sourceforge.plantuml.url.Url;
final public class GroupingLeaf extends Grouping implements EventWithDeactivate { final public class GroupingLeaf extends Grouping implements EventWithDeactivate, EventWithNote {
private final GroupingStart start; private final GroupingStart start;
private final HColor backColorGeneral; private final HColor backColorGeneral;
@ -58,12 +58,12 @@ final public class GroupingLeaf extends Grouping implements EventWithDeactivate
public Grouping getJustAfter() { public Grouping getJustAfter() {
final int idx = start.getChildren().indexOf(this); final int idx = start.getChildren().indexOf(this);
if (idx == -1) { if (idx == -1)
throw new IllegalStateException(); throw new IllegalStateException();
}
if (idx + 1 >= start.getChildren().size()) { if (idx + 1 >= start.getChildren().size())
return null; return null;
}
return start.getChildren().get(idx + 1); return start.getChildren().get(idx + 1);
} }
@ -117,10 +117,11 @@ final public class GroupingLeaf extends Grouping implements EventWithDeactivate
private List<Note> noteOnMessages = new ArrayList<>(); private List<Note> noteOnMessages = new ArrayList<>();
public final void setNote(Note note) { @Override
if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT) { public final void addNote(Note note) {
if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
this.noteOnMessages.add(note); this.noteOnMessages.add(note);
} }

View File

@ -58,9 +58,9 @@ final public class Note extends AbstractEvent implements Event, SpecificBackcolo
private/* final */NotePosition position; private/* final */NotePosition position;
public void temporaryProtectedUntilTeozIsStandard() { public void temporaryProtectedUntilTeozIsStandard() {
if (position == NotePosition.BOTTOM || position == NotePosition.TOP) { if (position == NotePosition.BOTTOM || position == NotePosition.TOP)
position = NotePosition.LEFT; position = NotePosition.LEFT;
}
} }
private final StyleBuilder styleBuilder; private final StyleBuilder styleBuilder;
@ -129,7 +129,7 @@ final public class Note extends AbstractEvent implements Event, SpecificBackcolo
return p2; return p2;
} }
public Display getStrings() { public Display getDisplay() {
return strings; return strings;
} }

View File

@ -49,7 +49,7 @@ import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignatureBasic; import net.sourceforge.plantuml.style.StyleSignatureBasic;
import net.sourceforge.plantuml.url.Url; import net.sourceforge.plantuml.url.Url;
public class Reference extends AbstractEvent implements Event { public class Reference extends AbstractEvent implements EventWithNote {
private final List<Participant> participants; private final List<Participant> participants;
private final Url url; private final Url url;
@ -132,4 +132,19 @@ public class Reference extends AbstractEvent implements Event {
public final HColor getBackColorElement() { public final HColor getBackColorElement() {
return backColorElement; return backColorElement;
} }
private List<Note> noteOnMessages = new ArrayList<>();
@Override
public final void addNote(Note note) {
if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT)
throw new IllegalArgumentException();
this.noteOnMessages.add(note);
}
public final List<Note> getNoteOnMessages() {
return noteOnMessages;
}
} }

View File

@ -126,13 +126,23 @@ public class SequenceDiagram extends UmlDiagram {
private EventWithDeactivate lastEventWithDeactivate; private EventWithDeactivate lastEventWithDeactivate;
public EventWithDeactivate getLastEventWithDeactivate() { public EventWithDeactivate getLastEventWithDeactivate() {
return lastEventWithDeactivate; for (int i = events.size() - 1; i >= 0; i--)
if (events.get(i) instanceof EventWithDeactivate)
return (EventWithDeactivate) events.get(i);
return null;
}
public EventWithNote getLastEventWithNote() {
for (int i = events.size() - 1; i >= 0; i--)
if (events.get(i) instanceof EventWithNote)
return (EventWithNote) events.get(i);
return null;
} }
public Participant createNewParticipant(ParticipantType type, String code, Display display, int order) { public Participant createNewParticipant(ParticipantType type, String code, Display display, int order) {
if (participantsget(code) != null) { if (participantsget(code) != null)
throw new IllegalArgumentException(); throw new IllegalArgumentException();
}
if (Display.isNull(display)) { if (Display.isNull(display)) {
// display = Arrays.asList(code); // display = Arrays.asList(code);
display = Display.getWithNewlines(code); display = Display.getWithNewlines(code);

View File

@ -59,6 +59,7 @@ import net.sourceforge.plantuml.sequencediagram.Message;
import net.sourceforge.plantuml.sequencediagram.MessageExo; import net.sourceforge.plantuml.sequencediagram.MessageExo;
import net.sourceforge.plantuml.sequencediagram.Newpage; import net.sourceforge.plantuml.sequencediagram.Newpage;
import net.sourceforge.plantuml.sequencediagram.Note; import net.sourceforge.plantuml.sequencediagram.Note;
import net.sourceforge.plantuml.sequencediagram.NotePosition;
import net.sourceforge.plantuml.sequencediagram.Notes; import net.sourceforge.plantuml.sequencediagram.Notes;
import net.sourceforge.plantuml.sequencediagram.Participant; import net.sourceforge.plantuml.sequencediagram.Participant;
import net.sourceforge.plantuml.sequencediagram.ParticipantEnglober; import net.sourceforge.plantuml.sequencediagram.ParticipantEnglober;
@ -406,7 +407,7 @@ class DrawableSetInitializer {
for (Note noteOnMessage : m.getNoteOnMessages()) { for (Note noteOnMessage : m.getNoteOnMessages()) {
final ISkinParam sk = noteOnMessage.getSkinParamBackcolored(drawableSet.getSkinParam()); final ISkinParam sk = noteOnMessage.getSkinParamBackcolored(drawableSet.getSkinParam());
final Component note = drawableSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(), final Component note = drawableSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(),
noteOnMessage.getNoteStyle().getNoteComponentType(), sk, noteOnMessage.getStrings(), noteOnMessage.getNoteStyle().getNoteComponentType(), sk, noteOnMessage.getDisplay(),
noteOnMessage.getColors()); noteOnMessage.getColors());
notes.add(note); notes.add(note);
} }
@ -465,7 +466,7 @@ class DrawableSetInitializer {
} }
final Component component = drawableSet.getSkin().createComponentNote(n.getUsedStyles(), type, skinParam, final Component component = drawableSet.getSkin().createComponentNote(n.getUsedStyles(), type, skinParam,
n.getStrings(), n.getColors(), n.getPosition()); n.getDisplay(), n.getColors(), n.getPosition());
final NoteBox noteBox = new NoteBox(freeY2.getFreeY(range), component, p1, p2, n.getPosition(), n.getUrl()); final NoteBox noteBox = new NoteBox(freeY2.getFreeY(range), component, p1, p2, n.getPosition(), n.getUrl());
return noteBox; return noteBox;
} }
@ -557,10 +558,24 @@ class DrawableSetInitializer {
Display strings = Display.empty(); Display strings = Display.empty();
strings = strings.add("ref"); strings = strings.add("ref");
strings = strings.addAll(reference.getStrings()); strings = strings.addAll(reference.getStrings());
Component noteLeft = null;
Component noteRight = null;
for (Note noteOnMessage : reference.getNoteOnMessages()) {
final ISkinParam skinParam2 = noteOnMessage.getSkinParamBackcolored(drawableSet.getSkinParam());
final Component note = drawableSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(),
noteOnMessage.getNoteStyle().getNoteComponentType(), skinParam2, noteOnMessage.getDisplay(),
noteOnMessage.getColors());
if (noteOnMessage.getPosition() == NotePosition.RIGHT)
noteRight = note;
else
noteLeft = note;
}
final Component comp = drawableSet.getSkin().createComponent(reference.getUsedStyles(), ComponentType.REFERENCE, final Component comp = drawableSet.getSkin().createComponent(reference.getUsedStyles(), ComponentType.REFERENCE,
null, skinParam, strings); null, skinParam, strings);
final GraphicalReference graphicalReference = new GraphicalReference(freeY2.getFreeY(range), comp, p1, p2, final GraphicalReference graphicalReference = new GraphicalReference(freeY2.getFreeY(range), comp, p1, p2,
reference.getUrl()); reference.getUrl(), noteLeft, noteRight);
final ParticipantBox pbox1 = p1.getParticipantBox(); final ParticipantBox pbox1 = p1.getParticipantBox();
final ParticipantBox pbox2 = p2.getParticipantBox(); final ParticipantBox pbox2 = p2.getParticipantBox();

View File

@ -53,10 +53,14 @@ class GraphicalReference extends GraphicalElement implements InGroupable {
private final LivingParticipantBox livingParticipantBox1; private final LivingParticipantBox livingParticipantBox1;
private final LivingParticipantBox livingParticipantBox2; private final LivingParticipantBox livingParticipantBox2;
private final Url url; private final Url url;
private final Component noteLeft;
private final Component noteRight;
public GraphicalReference(double startingY, Component comp, LivingParticipantBox livingParticipantBox1, public GraphicalReference(double startingY, Component comp, LivingParticipantBox livingParticipantBox1,
LivingParticipantBox livingParticipantBox2, Url url) { LivingParticipantBox livingParticipantBox2, Url url, Component noteLeft, Component noteRight) {
super(startingY); super(startingY);
this.noteLeft = noteLeft;
this.noteRight = noteRight;
this.url = url; this.url = url;
this.comp = comp; this.comp = comp;
this.livingParticipantBox1 = Objects.requireNonNull(livingParticipantBox1); this.livingParticipantBox1 = Objects.requireNonNull(livingParticipantBox1);
@ -67,22 +71,33 @@ class GraphicalReference extends GraphicalElement implements InGroupable {
protected void drawInternalU(UGraphic ug, double maxX, Context2D context) { protected void drawInternalU(UGraphic ug, double maxX, Context2D context) {
final StringBounder stringBounder = ug.getStringBounder(); final StringBounder stringBounder = ug.getStringBounder();
final double posX = getMinX(stringBounder); // final double posX = getMinX(stringBounder);
ug = ug.apply(new UTranslate(posX, getStartingY())); ug = ug.apply(UTranslate.dy(getStartingY()));
final double preferredWidth = comp.getPreferredWidth(stringBounder);
final double w = getMaxX(stringBounder) - getMinX(stringBounder);
final double width = Math.max(preferredWidth, w); final double r1 = getR1(stringBounder);
final double r2 = getR2(stringBounder);
final XDimension2D dim = new XDimension2D(width, comp.getPreferredHeight(stringBounder)); final XDimension2D dim = new XDimension2D(r2 - r1, comp.getPreferredHeight(stringBounder));
if (url != null) { if (url != null)
ug.startUrl(url); ug.startUrl(url);
comp.drawU(ug.apply(UTranslate.dx(r1)), new Area(dim), context);
if (noteLeft != null) {
final double wn = noteLeft.getPreferredWidth(stringBounder);
final double hn = noteLeft.getPreferredHeight(stringBounder);
noteLeft.drawU(ug, new Area(new XDimension2D(wn, hn)), context);
} }
comp.drawU(ug, new Area(dim), context);
if (url != null) { if (noteRight != null) {
final double wn = noteRight.getPreferredWidth(stringBounder);
final double hn = noteRight.getPreferredHeight(stringBounder);
noteRight.drawU(ug.apply(UTranslate.dx(r2)), new Area(new XDimension2D(wn, hn)), context);
}
if (url != null)
ug.closeUrl(); ug.closeUrl();
}
} }
@Override @Override
@ -92,7 +107,26 @@ class GraphicalReference extends GraphicalElement implements InGroupable {
@Override @Override
public double getPreferredWidth(StringBounder stringBounder) { public double getPreferredWidth(StringBounder stringBounder) {
return comp.getPreferredWidth(stringBounder); double result = comp.getPreferredWidth(stringBounder);
if (noteLeft != null)
result += noteLeft.getPreferredWidth(stringBounder);
if (noteRight != null)
result += noteRight.getPreferredWidth(stringBounder);
return result;
}
private double getR1(StringBounder stringBounder) {
return Math.min(livingParticipantBox1.getMinX(stringBounder), livingParticipantBox2.getMinX(stringBounder));
}
private double getR2(StringBounder stringBounder) {
final double diff = Math.max(livingParticipantBox1.getMaxX(stringBounder),
livingParticipantBox2.getMaxX(stringBounder)) - getR1(stringBounder);
final double preferredWidth = comp.getPreferredWidth(stringBounder);
final double width = Math.max(diff, preferredWidth);
return getR1(stringBounder) + width;
} }
@Override @Override
@ -100,12 +134,20 @@ class GraphicalReference extends GraphicalElement implements InGroupable {
return getMinX(stringBounder); return getMinX(stringBounder);
} }
public double getMaxX(StringBounder stringBounder) { @Override
return Math.max(livingParticipantBox1.getMaxX(stringBounder), livingParticipantBox2.getMaxX(stringBounder)); public double getMinX(StringBounder stringBounder) {
double result = getR1(stringBounder);
if (noteLeft != null)
result -= noteLeft.getPreferredWidth(stringBounder);
return result;
} }
public double getMinX(StringBounder stringBounder) { @Override
return Math.min(livingParticipantBox1.getMinX(stringBounder), livingParticipantBox2.getMinX(stringBounder)); public double getMaxX(StringBounder stringBounder) {
double result = getR2(stringBounder);
if (noteRight != null)
result += noteRight.getPreferredWidth(stringBounder);
return result;
} }
public String toString(StringBounder stringBounder) { public String toString(StringBounder stringBounder) {

View File

@ -86,7 +86,7 @@ class Step1Message extends Step1Abstract {
for (Note noteOnMessage : noteOnMessages) { for (Note noteOnMessage : noteOnMessages) {
final ISkinParam skinParam = noteOnMessage.getSkinParamBackcolored(drawingSet.getSkinParam()); final ISkinParam skinParam = noteOnMessage.getSkinParamBackcolored(drawingSet.getSkinParam());
final Component note = drawingSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(), final Component note = drawingSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(),
noteOnMessage.getNoteStyle().getNoteComponentType(), skinParam, noteOnMessage.getStrings(), noteOnMessage.getNoteStyle().getNoteComponentType(), skinParam, noteOnMessage.getDisplay(),
noteOnMessage.getColors()); noteOnMessage.getColors());
addNote(note); addNote(note);
} }
@ -103,14 +103,13 @@ class Step1Message extends Step1Abstract {
getMessage().setPosYstartLevel(arrowYStartLevel + delta1); getMessage().setPosYstartLevel(arrowYStartLevel + delta1);
final double length; final double length;
if (isSelfMessage()) { if (isSelfMessage())
length = graphic.getArrowOnlyWidth(getStringBounder()) + getLivingParticipantBox1() length = graphic.getArrowOnlyWidth(getStringBounder()) + getLivingParticipantBox1()
.getLiveThicknessAt(getStringBounder(), arrowYStartLevel).getSegment().getLength(); .getLiveThicknessAt(getStringBounder(), arrowYStartLevel).getSegment().getLength();
} else { else
length = graphic.getArrowOnlyWidth(getStringBounder()) length = graphic.getArrowOnlyWidth(getStringBounder())
+ getLivingParticipantBox(NotePosition.LEFT).getLifeLine().getRightShift(arrowYStartLevel) + getLivingParticipantBox(NotePosition.LEFT).getLifeLine().getRightShift(arrowYStartLevel)
+ getLivingParticipantBox(NotePosition.RIGHT).getLifeLine().getLeftShift(arrowYStartLevel); + getLivingParticipantBox(NotePosition.RIGHT).getLifeLine().getLeftShift(arrowYStartLevel);
}
incFreeY(graphic.getPreferredHeight(getStringBounder())); incFreeY(graphic.getPreferredHeight(getStringBounder()));
double marginActivateAndDeactive = 0; double marginActivateAndDeactive = 0;
@ -121,11 +120,10 @@ class Step1Message extends Step1Abstract {
getDrawingSet().addEvent(getMessage(), graphic); getDrawingSet().addEvent(getMessage(), graphic);
if (isSelfMessage()) { if (isSelfMessage()) {
if (this.getConfig().isReverseDefine()) { if (this.getConfig().isReverseDefine())
constraintSet.getConstraintBefore(getParticipantBox1()).ensureValue(length); constraintSet.getConstraintBefore(getParticipantBox1()).ensureValue(length);
} else { else
constraintSet.getConstraintAfter(getParticipantBox1()).ensureValue(length); constraintSet.getConstraintAfter(getParticipantBox1()).ensureValue(length);
}
} else { } else {
constraintSet.getConstraint(getParticipantBox1(), getParticipantBox2()).ensureValue(length); constraintSet.getConstraint(getParticipantBox1(), getParticipantBox2()).ensureValue(length);
} }
@ -137,9 +135,8 @@ class Step1Message extends Step1Abstract {
if (graphic instanceof InGroupable) { if (graphic instanceof InGroupable) {
inGroupablesStack.addElement((InGroupable) graphic); inGroupablesStack.addElement((InGroupable) graphic);
inGroupablesStack.addElement(getLivingParticipantBox1()); inGroupablesStack.addElement(getLivingParticipantBox1());
if (isSelfMessage() == false) { if (isSelfMessage() == false)
inGroupablesStack.addElement(getLivingParticipantBox2()); inGroupablesStack.addElement(getLivingParticipantBox2());
}
} }
return getFreeY(); return getFreeY();
@ -166,16 +163,16 @@ class Step1Message extends Step1Abstract {
} }
private LivingParticipantBox getLivingParticipantBox(NotePosition position) { private LivingParticipantBox getLivingParticipantBox(NotePosition position) {
if (isSelfMessage()) { if (isSelfMessage())
throw new IllegalStateException(); throw new IllegalStateException();
}
return messageArrow.getParticipantAt(getStringBounder(), position); return messageArrow.getParticipantAt(getStringBounder(), position);
} }
private Arrow createArrow() { private Arrow createArrow() {
if (getMessage().isCreate()) { if (getMessage().isCreate())
return createArrowCreate(); return createArrowCreate();
}
if (getMessage().getNoteOnMessages().size() > 0 && isSelfMessage()) { if (getMessage().getNoteOnMessages().size() > 0 && isSelfMessage()) {
final MessageSelfArrow messageSelfArrow = createMessageSelfArrow(); final MessageSelfArrow messageSelfArrow = createMessageSelfArrow();
final List<NoteBox> noteBoxes = new ArrayList<>(); final List<NoteBox> noteBoxes = new ArrayList<>();
@ -208,13 +205,12 @@ class Step1Message extends Step1Abstract {
double deltaX = 0; double deltaX = 0;
if (getMessage().isActivate()) { if (getMessage().isActivate()) {
deltaY -= getHalfLifeWidth(); deltaY -= getHalfLifeWidth();
if (OptionFlags.STRICT_SELFMESSAGE_POSITION) { if (OptionFlags.STRICT_SELFMESSAGE_POSITION)
deltaX += 5; deltaX += 5;
}
} }
if (getMessage().isDeactivate()) { if (getMessage().isDeactivate())
deltaY += getHalfLifeWidth(); deltaY += getHalfLifeWidth();
}
final Style[] styles = getMessage().getUsedStyles(); final Style[] styles = getMessage().getUsedStyles();
final ArrowComponent comp = getDrawingSet().getSkin().createComponentArrow(styles, getConfig(), final ArrowComponent comp = getDrawingSet().getSkin().createComponentArrow(styles, getConfig(),
@ -233,9 +229,9 @@ class Step1Message extends Step1Abstract {
} }
private Arrow createArrowCreate() { private Arrow createArrowCreate() {
if (messageArrow == null) { if (messageArrow == null)
throw new IllegalStateException(); throw new IllegalStateException();
}
Arrow result = new ArrowAndParticipant(getStringBounder(), messageArrow, getParticipantBox2(), Arrow result = new ArrowAndParticipant(getStringBounder(), messageArrow, getParticipantBox2(),
getDrawingSet().getSkinParam().getPadding(PaddingParam.PARTICIPANT)); getDrawingSet().getSkinParam().getPadding(PaddingParam.PARTICIPANT));
if (getMessage().getNoteOnMessages().size() > 0) { if (getMessage().getNoteOnMessages().size() > 0) {
@ -244,9 +240,9 @@ class Step1Message extends Step1Abstract {
final Component note = getNotes().get(i); final Component note = getNotes().get(i);
final Note noteOnMessage = getMessage().getNoteOnMessages().get(i); final Note noteOnMessage = getMessage().getNoteOnMessages().get(i);
final NoteBox noteBox = createNoteBox(getStringBounder(), result, note, noteOnMessage); final NoteBox noteBox = createNoteBox(getStringBounder(), result, note, noteOnMessage);
if (noteOnMessage.getPosition() == NotePosition.RIGHT) { if (noteOnMessage.getPosition() == NotePosition.RIGHT)
noteBox.pushToRight(getParticipantBox2().getPreferredWidth(getStringBounder()) / 2); noteBox.pushToRight(getParticipantBox2().getPreferredWidth(getStringBounder()) / 2);
}
noteBoxes.add(noteBox); noteBoxes.add(noteBox);
} }
result = new ArrowAndNoteBox(getStringBounder(), result, noteBoxes); result = new ArrowAndNoteBox(getStringBounder(), result, noteBoxes);
@ -258,15 +254,15 @@ class Step1Message extends Step1Abstract {
private ArrowConfiguration getSelfArrowType(Message m) { private ArrowConfiguration getSelfArrowType(Message m) {
ArrowConfiguration result = ArrowConfiguration.withDirectionSelf(m.getArrowConfiguration().isReverseDefine()); ArrowConfiguration result = ArrowConfiguration.withDirectionSelf(m.getArrowConfiguration().isReverseDefine());
if (m.getArrowConfiguration().isDotted()) { if (m.getArrowConfiguration().isDotted())
result = result.withBody(ArrowBody.DOTTED); result = result.withBody(ArrowBody.DOTTED);
}
if (m.getArrowConfiguration().isHidden()) { if (m.getArrowConfiguration().isHidden())
result = result.withBody(ArrowBody.HIDDEN); result = result.withBody(ArrowBody.HIDDEN);
}
if (m.getArrowConfiguration().isAsync()) { if (m.getArrowConfiguration().isAsync())
result = result.withHead(ArrowHead.ASYNC); result = result.withHead(ArrowHead.ASYNC);
}
result = result.withHead1(m.getArrowConfiguration().getDressing1().getHead()); result = result.withHead1(m.getArrowConfiguration().getDressing1().getHead());
result = result.withHead2(m.getArrowConfiguration().getDressing2().getHead()); result = result.withHead2(m.getArrowConfiguration().getDressing2().getHead());
result = result.withPart(m.getArrowConfiguration().getPart()); result = result.withPart(m.getArrowConfiguration().getPart());
@ -278,9 +274,9 @@ class Step1Message extends Step1Abstract {
} }
private ArrowConfiguration getArrowType(Message m, final double x1, final double x2) { private ArrowConfiguration getArrowType(Message m, final double x1, final double x2) {
if (x2 > x1) { if (x2 > x1)
return m.getArrowConfiguration(); return m.getArrowConfiguration();
}
return m.getArrowConfiguration().reverse(); return m.getArrowConfiguration().reverse();
} }

View File

@ -69,7 +69,7 @@ class Step1MessageExo extends Step1Abstract {
for (Note noteOnMessage : noteOnMessages) { for (Note noteOnMessage : noteOnMessages) {
final ISkinParam skinParam = noteOnMessage.getSkinParamBackcolored(drawingSet.getSkinParam()); final ISkinParam skinParam = noteOnMessage.getSkinParamBackcolored(drawingSet.getSkinParam());
final Component note = drawingSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(), final Component note = drawingSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(),
ComponentType.NOTE, skinParam, noteOnMessage.getStrings(), noteOnMessage.getColors()); ComponentType.NOTE, skinParam, noteOnMessage.getDisplay(), noteOnMessage.getColors());
addNote(note); addNote(note);
} }

View File

@ -97,7 +97,7 @@ public abstract class CommunicationTileNoteBottomTopAbstract extends AbstractTil
final protected Component getComponent(StringBounder stringBounder) { final protected Component getComponent(StringBounder stringBounder) {
final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE, final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE,
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings(), noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getDisplay(),
noteOnMessage.getColors()); noteOnMessage.getColors());
return comp; return comp;
} }

View File

@ -95,7 +95,7 @@ public class CommunicationTileNoteLeft extends AbstractTile {
private Component getComponent(StringBounder stringBounder) { private Component getComponent(StringBounder stringBounder) {
final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE, final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE,
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings(), noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getDisplay(),
noteOnMessage.getColors()); noteOnMessage.getColors());
return comp; return comp;
} }

View File

@ -99,7 +99,7 @@ public class CommunicationTileNoteRight extends AbstractTile {
private Component getComponent(StringBounder stringBounder) { private Component getComponent(StringBounder stringBounder) {
final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE, final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE,
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings(), noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getDisplay(),
noteOnMessage.getColors()); noteOnMessage.getColors());
return comp; return comp;
} }

View File

@ -92,7 +92,7 @@ public class CommunicationTileSelfNoteRight extends AbstractTile {
private Component getComponent(StringBounder stringBounder) { private Component getComponent(StringBounder stringBounder) {
final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE, final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE,
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings(), noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getDisplay(),
noteOnMessage.getColors()); noteOnMessage.getColors());
return comp; return comp;
} }

View File

@ -88,7 +88,7 @@ public class NoteTile extends AbstractTile implements Tile {
private Component getComponent(StringBounder stringBounder) { private Component getComponent(StringBounder stringBounder) {
final Component comp = skin.createComponentNote(note.getUsedStyles(), getNoteComponentType(note.getNoteStyle()), final Component comp = skin.createComponentNote(note.getUsedStyles(), getNoteComponentType(note.getNoteStyle()),
note.getSkinParamBackcolored(skinParam), note.getStrings(), note.getColors(), note.getPosition()); note.getSkinParamBackcolored(skinParam), note.getDisplay(), note.getColors(), note.getPosition());
return comp; return comp;
} }

View File

@ -85,7 +85,7 @@ public class NotesTile extends AbstractTile implements Tile {
private Component getComponent(StringBounder stringBounder, Note note) { private Component getComponent(StringBounder stringBounder, Note note) {
final Component comp = skin.createComponentNote(note.getUsedStyles(), getNoteComponentType(note.getNoteStyle()), final Component comp = skin.createComponentNote(note.getUsedStyles(), getNoteComponentType(note.getNoteStyle()),
note.getSkinParamBackcolored(skinParam), note.getStrings(), note.getColors(), note.getPosition()); note.getSkinParamBackcolored(skinParam), note.getDisplay(), note.getColors(), note.getPosition());
return comp; return comp;
} }

View File

@ -58,7 +58,8 @@ public class EntityImageCircleEnd extends AbstractEntityImage {
private static final int SIZE = 20; private static final int SIZE = 20;
public StyleSignatureBasic getDefaultStyleDefinitionCircle() { public StyleSignatureBasic getDefaultStyleDefinitionCircle() {
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.end); return StyleSignatureBasic.of(SName.root, SName.element, getSkinParam().getUmlDiagramType().getStyleName(),
SName.circle, SName.end);
} }
public EntityImageCircleEnd(Entity entity, ISkinParam skinParam) { public EntityImageCircleEnd(Entity entity, ISkinParam skinParam) {

View File

@ -56,7 +56,8 @@ public class EntityImageCircleStart extends AbstractEntityImage {
private static final int SIZE = 20; private static final int SIZE = 20;
public StyleSignatureBasic getDefaultStyleDefinitionCircle() { public StyleSignatureBasic getDefaultStyleDefinitionCircle() {
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.circle, SName.start); return StyleSignatureBasic.of(SName.root, SName.element, getSkinParam().getUmlDiagramType().getStyleName(),
SName.circle, SName.start);
} }
public EntityImageCircleStart(Entity entity, ISkinParam skinParam) { public EntityImageCircleStart(Entity entity, ISkinParam skinParam) {

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.klimt.UStroke;
import net.sourceforge.plantuml.klimt.UTranslate; import net.sourceforge.plantuml.klimt.UTranslate;
import net.sourceforge.plantuml.klimt.color.ColorType; import net.sourceforge.plantuml.klimt.color.ColorType;
import net.sourceforge.plantuml.klimt.color.HColor; import net.sourceforge.plantuml.klimt.color.HColor;
import net.sourceforge.plantuml.klimt.color.HColors;
import net.sourceforge.plantuml.klimt.drawing.UGraphic; import net.sourceforge.plantuml.klimt.drawing.UGraphic;
import net.sourceforge.plantuml.klimt.font.FontParam; import net.sourceforge.plantuml.klimt.font.FontParam;
import net.sourceforge.plantuml.klimt.font.StringBounder; import net.sourceforge.plantuml.klimt.font.StringBounder;
@ -95,6 +96,8 @@ public class EntityImageStateBorder extends AbstractEntityImageBorder {
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK); HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
if (backcolor == null) if (backcolor == null)
backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet()); backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet());
if (backcolor.isTransparent())
backcolor = getSkinParam().getBackgroundColor();
ug = ug.apply(getUStroke()).apply(borderColor); ug = ug.apply(getUStroke()).apply(borderColor);
ug = ug.apply(backcolor.bg()); ug = ug.apply(backcolor.bg());

View File

@ -46,7 +46,7 @@ public class Version {
private static final int MAJOR_SEPARATOR = 1000000; private static final int MAJOR_SEPARATOR = 1000000;
public static int version() { public static int version() {
return 1202305; return 1202306;
} }
public static int versionPatched() { public static int versionPatched() {
@ -82,7 +82,7 @@ public class Version {
} }
public static int beta() { public static int beta() {
final int beta = 4; final int beta = 0;
return beta; return beta;
} }
@ -95,7 +95,7 @@ public class Version {
} }
public static long compileTime() { public static long compileTime() {
return 1679680470757L; return 1681833838880L;
} }
public static String compileTimeString() { public static String compileTimeString() {

View File

@ -150,7 +150,7 @@ public class XmiSequenceDiagramStandard extends XmiSequenceDiagram {
comment.setAttribute("annotatedElement", String.join(" ", annotated)); comment.setAttribute("annotatedElement", String.join(" ", annotated));
} }
comment.appendChild(document.createElement("body")) comment.appendChild(document.createElement("body"))
.appendChild(document.createTextNode(getDisplayString(note.getStrings()))); .appendChild(document.createTextNode(getDisplayString(note.getDisplay())));
packagedElement.appendChild(comment); packagedElement.appendChild(comment);
} }