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:
parent
e23d7e56fc
commit
beb3cb25e2
@ -481,9 +481,9 @@ public class StringUtils {
|
||||
final Matcher matcher = pattern.matcher(s);
|
||||
final StringBuffer result = new StringBuffer(); // Can't be switched to StringBuilder in order to support Java 8
|
||||
while (matcher.find()) {
|
||||
final String num = matcher.group(1);
|
||||
final char c = (char) Integer.parseInt(num);
|
||||
matcher.appendReplacement(result, "" + c);
|
||||
final int codePoint = Integer.parseInt(matcher.group(1));
|
||||
final String unicode = new String(Character.toChars(codePoint));
|
||||
matcher.appendReplacement(result, unicode);
|
||||
}
|
||||
matcher.appendTail(result);
|
||||
return result.toString();
|
||||
|
@ -44,9 +44,7 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
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.font.FontConfiguration;
|
||||
import net.sourceforge.plantuml.skin.Pragma;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
@ -74,23 +72,19 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
|
||||
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
|
||||
.getMergedStyle(skinParam().getCurrentStyleBuilder());
|
||||
final HColor borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
|
||||
final HColor backColor = branch0.getColor() == null
|
||||
? styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet())
|
||||
: 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 (pragma.useVerticalIf()/* OptionFlags.USE_IF_VERTICAL */)
|
||||
return FtileIfLongVertical.create(swimlane, borderColor, backColor, arrowColor, getFactory(),
|
||||
conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile);
|
||||
return FtileIfLongHorizontal.create(swimlane, borderColor, backColor, arrowColor, getFactory(),
|
||||
conditionStyle, thens, elseBranch, fcArrow, topInlinkRendering, afterEndwhile, fcTest);
|
||||
return FtileIfLongVertical.create(swimlane, backColor, getFactory(), conditionStyle, thens, elseBranch,
|
||||
topInlinkRendering, afterEndwhile, styleArrow, styleDiamond);
|
||||
return FtileIfLongHorizontal.create(swimlane, backColor, getFactory(), conditionStyle, thens, elseBranch,
|
||||
topInlinkRendering, afterEndwhile, styleArrow, styleDiamond);
|
||||
}
|
||||
return ConditionalBuilder.create(swimlane, borderColor, backColor, arrowColor, getFactory(), conditionStyle,
|
||||
conditionEndStyle, thens.get(0), elseBranch, skinParam(), getStringBounder(), fcArrow, fcTest, url);
|
||||
return ConditionalBuilder.create(swimlane, backColor, getFactory(), conditionStyle, conditionEndStyle,
|
||||
thens.get(0), elseBranch, skinParam(), getStringBounder(), url, styleArrow, styleDiamond);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,8 +60,10 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Snake;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
|
||||
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInside2;
|
||||
import net.sourceforge.plantuml.decoration.Rainbow;
|
||||
import net.sourceforge.plantuml.klimt.LineBreakStrategy;
|
||||
import net.sourceforge.plantuml.klimt.UTranslate;
|
||||
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.drawing.UGraphic;
|
||||
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.XPoint2D;
|
||||
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;
|
||||
|
||||
class FtileIfLongHorizontal extends AbstractFtile {
|
||||
@ -143,11 +147,17 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
return getSwimlaneIn();
|
||||
}
|
||||
|
||||
static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor,
|
||||
FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens, Branch branch2,
|
||||
FontConfiguration fcArrow, LinkRendering topInlinkRendering, LinkRendering afterEndwhile,
|
||||
FontConfiguration fcTest) {
|
||||
static Ftile create(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory, ConditionStyle conditionStyle,
|
||||
List<Branch> thens, Branch branch2, LinkRendering topInlinkRendering, LinkRendering afterEndwhile,
|
||||
Style styleArrow, Style styleDiamond) {
|
||||
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<>();
|
||||
|
||||
for (Branch branch : thens)
|
||||
@ -160,9 +170,10 @@ class FtileIfLongHorizontal extends AbstractFtile {
|
||||
for (Branch branch : thens) {
|
||||
final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
|
||||
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());
|
||||
ftileFactory.skinParam(), lineBreak, CreoleMode.FULL, null, null);
|
||||
final HColor diamondColor = branch.getColor() == null ? backColor : branch.getColor();
|
||||
|
||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), diamondColor, borderColor,
|
||||
|
@ -69,6 +69,8 @@ import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
|
||||
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
|
||||
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;
|
||||
|
||||
class FtileIfLongVertical extends AbstractFtile {
|
||||
@ -126,17 +128,21 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
return getSwimlaneIn();
|
||||
}
|
||||
|
||||
static Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor,
|
||||
FtileFactory ftileFactory, ConditionStyle conditionStyle, List<Branch> thens, Branch branch2,
|
||||
FontConfiguration fc, LinkRendering topInlinkRendering, LinkRendering afterEndwhile) {
|
||||
static Ftile create(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory, ConditionStyle conditionStyle,
|
||||
List<Branch> thens, Branch branch2, 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<>();
|
||||
|
||||
double west = 10;
|
||||
for (Branch branch : thens) {
|
||||
final TextBlock tb1 = branch.getDisplayPositive().create(fc, HorizontalAlignment.LEFT,
|
||||
final TextBlock tb1 = branch.getDisplayPositive().create(fcArrow, HorizontalAlignment.LEFT,
|
||||
ftileFactory.skinParam());
|
||||
final TextBlock tbTest = branch.getLabelTest().create(fc,
|
||||
final TextBlock tbTest = branch.getLabelTest().create(fcArrow,
|
||||
ftileFactory.skinParam().getDefaultTextAlignment(HorizontalAlignment.LEFT),
|
||||
ftileFactory.skinParam());
|
||||
FtileDiamondInside2 diamond = new FtileDiamondInside2(tbTest, branch.skinParam(), backColor, borderColor,
|
||||
@ -146,7 +152,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
diamonds.add(diamond);
|
||||
|
||||
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());
|
||||
west = Math.max(west, tbInlabel.calculateDimension(ftileFactory.getStringBounder()).getWidth());
|
||||
}
|
||||
@ -178,7 +184,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Branch branch = thens.get(i + 1);
|
||||
TextBlock tbInlabel = null;
|
||||
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));
|
||||
}
|
||||
@ -189,7 +195,7 @@ class FtileIfLongVertical extends AbstractFtile {
|
||||
final Rainbow topInColor = topInlinkRendering.getRainbow(arrowColor);
|
||||
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());
|
||||
conns.add(result.new ConnectionLastElse(topInColor, tb2));
|
||||
conns.add(result.new ConnectionLastElseOut(arrowColor));
|
||||
|
@ -63,6 +63,7 @@ import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
|
||||
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
||||
import net.sourceforge.plantuml.klimt.shape.TextBlock;
|
||||
import net.sourceforge.plantuml.style.ISkinParam;
|
||||
import net.sourceforge.plantuml.style.PName;
|
||||
import net.sourceforge.plantuml.style.SName;
|
||||
import net.sourceforge.plantuml.style.Style;
|
||||
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||
@ -100,27 +101,21 @@ public class ConditionalBuilder {
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.arrow);
|
||||
}
|
||||
|
||||
public ConditionalBuilder(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor,
|
||||
FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle,
|
||||
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder,
|
||||
FontConfiguration fontArrow, FontConfiguration fontTest, Url url) {
|
||||
public ConditionalBuilder(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory,
|
||||
ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2,
|
||||
ISkinParam skinParam, StringBounder stringBounder, Url url, Style styleArrow, Style styleDiamond) {
|
||||
|
||||
if (backColor == null)
|
||||
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.fontArrow = styleArrow.getFontConfiguration(skinParam.getIHtmlColorSet());
|
||||
this.diamondLineBreak = styleDiamond.wrapWidth();
|
||||
this.labelLineBreak = styleArrow.wrapWidth();
|
||||
this.borderColor = borderColor;
|
||||
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.swimlane = swimlane;
|
||||
@ -137,13 +132,11 @@ public class ConditionalBuilder {
|
||||
|
||||
}
|
||||
|
||||
static public Ftile create(Swimlane swimlane, HColor borderColor, HColor backColor, Rainbow arrowColor,
|
||||
FtileFactory ftileFactory, ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle,
|
||||
Branch branch1, Branch branch2, ISkinParam skinParam, StringBounder stringBounder,
|
||||
FontConfiguration fcArrow, FontConfiguration fcTest, Url url) {
|
||||
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor,
|
||||
ftileFactory, conditionStyle, conditionEndStyle, branch1, branch2, skinParam, stringBounder, fcArrow,
|
||||
fcTest, url);
|
||||
static public Ftile create(Swimlane swimlane, HColor backColor, FtileFactory ftileFactory,
|
||||
ConditionStyle conditionStyle, ConditionEndStyle conditionEndStyle, Branch branch1, Branch branch2,
|
||||
ISkinParam skinParam, StringBounder stringBounder, Url url, Style styleArrow, Style styleDiamond) {
|
||||
final ConditionalBuilder builder = new ConditionalBuilder(swimlane, backColor, ftileFactory, conditionStyle,
|
||||
conditionEndStyle, branch1, branch2, skinParam, stringBounder, url, styleArrow, styleDiamond);
|
||||
if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false)
|
||||
return builder.createDown(builder.branch1, builder.branch2);
|
||||
|
||||
|
@ -53,9 +53,7 @@ import net.sourceforge.plantuml.regex.IRegex;
|
||||
import net.sourceforge.plantuml.regex.RegexConcat;
|
||||
import net.sourceforge.plantuml.regex.RegexLeaf;
|
||||
import net.sourceforge.plantuml.regex.RegexResult;
|
||||
import net.sourceforge.plantuml.sequencediagram.AbstractMessage;
|
||||
import net.sourceforge.plantuml.sequencediagram.EventWithDeactivate;
|
||||
import net.sourceforge.plantuml.sequencediagram.GroupingLeaf;
|
||||
import net.sourceforge.plantuml.sequencediagram.EventWithNote;
|
||||
import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
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)
|
||||
throws NoSuchColorException {
|
||||
final EventWithDeactivate m = diagram.getLastEventWithDeactivate();
|
||||
if (m instanceof AbstractMessage || m instanceof GroupingLeaf) {
|
||||
final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0)));
|
||||
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 EventWithNote event = diagram.getLastEventWithNote();
|
||||
if (event == null)
|
||||
return CommandExecutionResult.ok();
|
||||
|
||||
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);
|
||||
if (m instanceof AbstractMessage) {
|
||||
((AbstractMessage) m).setNote(note);
|
||||
} else {
|
||||
((GroupingLeaf) m).setNote(note);
|
||||
}
|
||||
final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0)));
|
||||
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 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();
|
||||
}
|
||||
|
||||
|
41
src/net/sourceforge/plantuml/project/DayStatus.java
Normal file
41
src/net/sourceforge/plantuml/project/DayStatus.java
Normal 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;
|
||||
|
||||
}
|
@ -35,9 +35,9 @@
|
||||
*/
|
||||
package net.sourceforge.plantuml.project;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.plantuml.project.core3.Histogram;
|
||||
import net.sourceforge.plantuml.project.core3.TimeLine;
|
||||
@ -46,25 +46,23 @@ import net.sourceforge.plantuml.project.time.DayOfWeek;
|
||||
|
||||
public class OpenClose implements Histogram, LoadPlanable {
|
||||
|
||||
private final Collection<DayOfWeek> closedDayOfWeek = EnumSet.noneOf(DayOfWeek.class);
|
||||
private final Collection<DayOfWeek> openedDayOfWeek = EnumSet.noneOf(DayOfWeek.class);
|
||||
private final Collection<Day> closedDays = new HashSet<>();
|
||||
private final Collection<Day> openedDays = new HashSet<>();
|
||||
private final Map<DayOfWeek, DayStatus> weekdayStatus = new EnumMap<>(DayOfWeek.class);
|
||||
private final Map<Day, DayStatus> dayStatus = new HashMap<>();
|
||||
private Day startingDay;
|
||||
|
||||
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) {
|
||||
if (closedDayOfWeek.size() > 0)
|
||||
if (weekdayStatus.size() > 0)
|
||||
return true;
|
||||
|
||||
for (Day tmp : closedDays)
|
||||
if (tmp.compareTo(day) >= 0)
|
||||
return true;
|
||||
|
||||
for (Day tmp : openedDays)
|
||||
for (Day tmp : dayStatus.keySet())
|
||||
if (tmp.compareTo(day) >= 0)
|
||||
return true;
|
||||
|
||||
@ -72,14 +70,10 @@ public class OpenClose implements Histogram, LoadPlanable {
|
||||
}
|
||||
|
||||
private boolean isThereSomeChangeBefore(Day day) {
|
||||
if (closedDayOfWeek.size() > 0)
|
||||
if (weekdayStatus.size() > 0)
|
||||
return true;
|
||||
|
||||
for (Day tmp : closedDays)
|
||||
if (tmp.compareTo(day) <= 0)
|
||||
return true;
|
||||
|
||||
for (Day tmp : openedDays)
|
||||
for (Day tmp : dayStatus.keySet())
|
||||
if (tmp.compareTo(day) <= 0)
|
||||
return true;
|
||||
|
||||
@ -87,28 +81,40 @@ public class OpenClose implements Histogram, LoadPlanable {
|
||||
}
|
||||
|
||||
public boolean isClosed(Day day) {
|
||||
if (openedDays.contains(day))
|
||||
return false;
|
||||
final DayStatus status = getLocalStatus(day);
|
||||
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();
|
||||
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) {
|
||||
closedDayOfWeek.add(day);
|
||||
weekdayStatus.put(day, DayStatus.CLOSE);
|
||||
}
|
||||
|
||||
public void open(DayOfWeek day) {
|
||||
closedDayOfWeek.remove(day);
|
||||
openedDayOfWeek.add(day);
|
||||
weekdayStatus.put(day, DayStatus.OPEN);
|
||||
}
|
||||
|
||||
public void close(Day day) {
|
||||
closedDays.add(day);
|
||||
dayStatus.put(day, DayStatus.CLOSE);
|
||||
}
|
||||
|
||||
public void open(Day day) {
|
||||
openedDays.add(day);
|
||||
dayStatus.put(day, DayStatus.OPEN);
|
||||
}
|
||||
|
||||
public final Day getStartingDay() {
|
||||
@ -180,11 +186,10 @@ public class OpenClose implements Histogram, LoadPlanable {
|
||||
return new LoadPlanable() {
|
||||
@Override
|
||||
public int getLoadAt(Day instant) {
|
||||
if (except.openedDays.contains(instant))
|
||||
return 100;
|
||||
if (except.closedDays.contains(instant))
|
||||
final DayStatus exceptStatus = except.getLocalStatus(instant);
|
||||
if (exceptStatus == DayStatus.CLOSE)
|
||||
return 0;
|
||||
if (except.openedDayOfWeek.size() > 0 && except.openedDayOfWeek.contains(instant.getDayOfWeek()))
|
||||
else if (exceptStatus == DayStatus.OPEN)
|
||||
return 100;
|
||||
return OpenClose.this.getLoadAt(instant);
|
||||
}
|
||||
|
@ -79,13 +79,16 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
|
||||
|
||||
@Override
|
||||
protected double getShapeHeight(StringBounder stringBounder) {
|
||||
// final Style style = getStyle();
|
||||
// final ClockwiseTopRightBottomLeft padding = style.getPadding();
|
||||
final TextBlock title = getTitle();
|
||||
final XDimension2D titleDim = title.calculateDimension(stringBounder);
|
||||
return Math.max(titleDim.getHeight(), getDiamondHeight());
|
||||
}
|
||||
|
||||
private double getDiamondHeight() {
|
||||
int result = (int) getFontConfiguration().getFont().getSize2D();
|
||||
if (result % 2 == 1)
|
||||
result--;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -115,7 +118,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
|
||||
} else {
|
||||
final double x1 = timeScale.getStartingPosition(start);
|
||||
final double x2 = timeScale.getEndingPosition(start);
|
||||
final double width = getShapeHeight(ug.getStringBounder());
|
||||
final double width = getDiamondHeight();
|
||||
final double delta = x2 - x1 - width;
|
||||
x = x2 - delta / 2 + padding.getLeft();
|
||||
}
|
||||
@ -137,7 +140,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
|
||||
|
||||
final double x1 = timeScale.getStartingPosition(start);
|
||||
final double x2 = timeScale.getEndingPosition(start);
|
||||
final double width = getShapeHeight(ug.getStringBounder());
|
||||
final double width = getDiamondHeight();
|
||||
final double delta = x2 - x1 - width;
|
||||
|
||||
if (url != null)
|
||||
@ -158,7 +161,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
|
||||
}
|
||||
|
||||
private void drawShape(UGraphic ug) {
|
||||
ug.draw(getDiamond(ug.getStringBounder()));
|
||||
ug.draw(getDiamond());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -174,8 +177,8 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
|
||||
getY(stringBounder).getCurrentValue() + h);
|
||||
}
|
||||
|
||||
private UShape getDiamond(StringBounder stringBounder) {
|
||||
final double h = getShapeHeight(stringBounder);
|
||||
private UShape getDiamond() {
|
||||
final double h = getDiamondHeight();
|
||||
final UPolygon result = new UPolygon();
|
||||
result.addPoint(h / 2, 0);
|
||||
result.addPoint(h, h / 2);
|
||||
@ -188,7 +191,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
|
||||
public double getX1(TaskAttribute taskAttribute) {
|
||||
final double x1 = timeScale.getStartingPosition(start);
|
||||
final double x2 = timeScale.getEndingPosition(start);
|
||||
final double width = getShapeHeight(null);
|
||||
final double width = getDiamondHeight();
|
||||
final double delta = x2 - x1 - width;
|
||||
return x1 + delta;
|
||||
}
|
||||
@ -197,7 +200,7 @@ public class TaskDrawDiamond extends AbstractTaskDraw {
|
||||
public double getX2(TaskAttribute taskAttribute) {
|
||||
final double x1 = timeScale.getStartingPosition(start);
|
||||
final double x2 = timeScale.getEndingPosition(start);
|
||||
final double width = getShapeHeight(null);
|
||||
final double width = getDiamondHeight();
|
||||
final double delta = x2 - x1 - width;
|
||||
return x2 - delta;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||
import net.sourceforge.plantuml.style.WithStyle;
|
||||
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;
|
||||
|
||||
@ -199,7 +199,8 @@ public abstract class AbstractMessage extends AbstractEvent implements EventWith
|
||||
return noteOnMessages;
|
||||
}
|
||||
|
||||
public final void setNote(Note note) {
|
||||
@Override
|
||||
public final void addNote(Note note) {
|
||||
if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT
|
||||
&& note.getPosition() != NotePosition.BOTTOM && note.getPosition() != NotePosition.TOP)
|
||||
throw new IllegalArgumentException();
|
||||
|
@ -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);
|
||||
|
||||
}
|
@ -43,7 +43,7 @@ import net.sourceforge.plantuml.klimt.color.HColor;
|
||||
import net.sourceforge.plantuml.style.StyleBuilder;
|
||||
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 HColor backColorGeneral;
|
||||
@ -58,12 +58,12 @@ final public class GroupingLeaf extends Grouping implements EventWithDeactivate
|
||||
|
||||
public Grouping getJustAfter() {
|
||||
final int idx = start.getChildren().indexOf(this);
|
||||
if (idx == -1) {
|
||||
if (idx == -1)
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (idx + 1 >= start.getChildren().size()) {
|
||||
|
||||
if (idx + 1 >= start.getChildren().size())
|
||||
return null;
|
||||
}
|
||||
|
||||
return start.getChildren().get(idx + 1);
|
||||
}
|
||||
|
||||
@ -117,10 +117,11 @@ final public class GroupingLeaf extends Grouping implements EventWithDeactivate
|
||||
|
||||
private List<Note> noteOnMessages = new ArrayList<>();
|
||||
|
||||
public final void setNote(Note note) {
|
||||
if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT) {
|
||||
@Override
|
||||
public final void addNote(Note note) {
|
||||
if (note.getPosition() != NotePosition.LEFT && note.getPosition() != NotePosition.RIGHT)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
this.noteOnMessages.add(note);
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,9 @@ final public class Note extends AbstractEvent implements Event, SpecificBackcolo
|
||||
private/* final */NotePosition position;
|
||||
|
||||
public void temporaryProtectedUntilTeozIsStandard() {
|
||||
if (position == NotePosition.BOTTOM || position == NotePosition.TOP) {
|
||||
if (position == NotePosition.BOTTOM || position == NotePosition.TOP)
|
||||
position = NotePosition.LEFT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final StyleBuilder styleBuilder;
|
||||
@ -129,7 +129,7 @@ final public class Note extends AbstractEvent implements Event, SpecificBackcolo
|
||||
return p2;
|
||||
}
|
||||
|
||||
public Display getStrings() {
|
||||
public Display getDisplay() {
|
||||
return strings;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ import net.sourceforge.plantuml.style.StyleBuilder;
|
||||
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||
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 Url url;
|
||||
@ -132,4 +132,19 @@ public class Reference extends AbstractEvent implements Event {
|
||||
public final HColor getBackColorElement() {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -126,13 +126,23 @@ public class SequenceDiagram extends UmlDiagram {
|
||||
private EventWithDeactivate lastEventWithDeactivate;
|
||||
|
||||
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) {
|
||||
if (participantsget(code) != null) {
|
||||
if (participantsget(code) != null)
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
|
||||
if (Display.isNull(display)) {
|
||||
// display = Arrays.asList(code);
|
||||
display = Display.getWithNewlines(code);
|
||||
|
@ -59,6 +59,7 @@ import net.sourceforge.plantuml.sequencediagram.Message;
|
||||
import net.sourceforge.plantuml.sequencediagram.MessageExo;
|
||||
import net.sourceforge.plantuml.sequencediagram.Newpage;
|
||||
import net.sourceforge.plantuml.sequencediagram.Note;
|
||||
import net.sourceforge.plantuml.sequencediagram.NotePosition;
|
||||
import net.sourceforge.plantuml.sequencediagram.Notes;
|
||||
import net.sourceforge.plantuml.sequencediagram.Participant;
|
||||
import net.sourceforge.plantuml.sequencediagram.ParticipantEnglober;
|
||||
@ -406,7 +407,7 @@ class DrawableSetInitializer {
|
||||
for (Note noteOnMessage : m.getNoteOnMessages()) {
|
||||
final ISkinParam sk = noteOnMessage.getSkinParamBackcolored(drawableSet.getSkinParam());
|
||||
final Component note = drawableSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(),
|
||||
noteOnMessage.getNoteStyle().getNoteComponentType(), sk, noteOnMessage.getStrings(),
|
||||
noteOnMessage.getNoteStyle().getNoteComponentType(), sk, noteOnMessage.getDisplay(),
|
||||
noteOnMessage.getColors());
|
||||
notes.add(note);
|
||||
}
|
||||
@ -465,7 +466,7 @@ class DrawableSetInitializer {
|
||||
}
|
||||
|
||||
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());
|
||||
return noteBox;
|
||||
}
|
||||
@ -557,10 +558,24 @@ class DrawableSetInitializer {
|
||||
Display strings = Display.empty();
|
||||
strings = strings.add("ref");
|
||||
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,
|
||||
null, skinParam, strings);
|
||||
final GraphicalReference graphicalReference = new GraphicalReference(freeY2.getFreeY(range), comp, p1, p2,
|
||||
reference.getUrl());
|
||||
reference.getUrl(), noteLeft, noteRight);
|
||||
|
||||
final ParticipantBox pbox1 = p1.getParticipantBox();
|
||||
final ParticipantBox pbox2 = p2.getParticipantBox();
|
||||
|
@ -53,10 +53,14 @@ class GraphicalReference extends GraphicalElement implements InGroupable {
|
||||
private final LivingParticipantBox livingParticipantBox1;
|
||||
private final LivingParticipantBox livingParticipantBox2;
|
||||
private final Url url;
|
||||
private final Component noteLeft;
|
||||
private final Component noteRight;
|
||||
|
||||
public GraphicalReference(double startingY, Component comp, LivingParticipantBox livingParticipantBox1,
|
||||
LivingParticipantBox livingParticipantBox2, Url url) {
|
||||
LivingParticipantBox livingParticipantBox2, Url url, Component noteLeft, Component noteRight) {
|
||||
super(startingY);
|
||||
this.noteLeft = noteLeft;
|
||||
this.noteRight = noteRight;
|
||||
this.url = url;
|
||||
this.comp = comp;
|
||||
this.livingParticipantBox1 = Objects.requireNonNull(livingParticipantBox1);
|
||||
@ -67,22 +71,33 @@ class GraphicalReference extends GraphicalElement implements InGroupable {
|
||||
protected void drawInternalU(UGraphic ug, double maxX, Context2D context) {
|
||||
|
||||
final StringBounder stringBounder = ug.getStringBounder();
|
||||
final double posX = getMinX(stringBounder);
|
||||
// final double posX = getMinX(stringBounder);
|
||||
|
||||
ug = ug.apply(new UTranslate(posX, getStartingY()));
|
||||
final double preferredWidth = comp.getPreferredWidth(stringBounder);
|
||||
final double w = getMaxX(stringBounder) - getMinX(stringBounder);
|
||||
ug = ug.apply(UTranslate.dy(getStartingY()));
|
||||
|
||||
final double width = Math.max(preferredWidth, w);
|
||||
|
||||
final XDimension2D dim = new XDimension2D(width, comp.getPreferredHeight(stringBounder));
|
||||
if (url != null) {
|
||||
final double r1 = getR1(stringBounder);
|
||||
final double r2 = getR2(stringBounder);
|
||||
final XDimension2D dim = new XDimension2D(r2 - r1, comp.getPreferredHeight(stringBounder));
|
||||
if (url != null)
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -92,7 +107,26 @@ class GraphicalReference extends GraphicalElement implements InGroupable {
|
||||
|
||||
@Override
|
||||
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
|
||||
@ -100,12 +134,20 @@ class GraphicalReference extends GraphicalElement implements InGroupable {
|
||||
return getMinX(stringBounder);
|
||||
}
|
||||
|
||||
public double getMaxX(StringBounder stringBounder) {
|
||||
return Math.max(livingParticipantBox1.getMaxX(stringBounder), livingParticipantBox2.getMaxX(stringBounder));
|
||||
@Override
|
||||
public double getMinX(StringBounder stringBounder) {
|
||||
double result = getR1(stringBounder);
|
||||
if (noteLeft != null)
|
||||
result -= noteLeft.getPreferredWidth(stringBounder);
|
||||
return result;
|
||||
}
|
||||
|
||||
public double getMinX(StringBounder stringBounder) {
|
||||
return Math.min(livingParticipantBox1.getMinX(stringBounder), livingParticipantBox2.getMinX(stringBounder));
|
||||
@Override
|
||||
public double getMaxX(StringBounder stringBounder) {
|
||||
double result = getR2(stringBounder);
|
||||
if (noteRight != null)
|
||||
result += noteRight.getPreferredWidth(stringBounder);
|
||||
return result;
|
||||
}
|
||||
|
||||
public String toString(StringBounder stringBounder) {
|
||||
|
@ -86,7 +86,7 @@ class Step1Message extends Step1Abstract {
|
||||
for (Note noteOnMessage : noteOnMessages) {
|
||||
final ISkinParam skinParam = noteOnMessage.getSkinParamBackcolored(drawingSet.getSkinParam());
|
||||
final Component note = drawingSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(),
|
||||
noteOnMessage.getNoteStyle().getNoteComponentType(), skinParam, noteOnMessage.getStrings(),
|
||||
noteOnMessage.getNoteStyle().getNoteComponentType(), skinParam, noteOnMessage.getDisplay(),
|
||||
noteOnMessage.getColors());
|
||||
addNote(note);
|
||||
}
|
||||
@ -103,14 +103,13 @@ class Step1Message extends Step1Abstract {
|
||||
getMessage().setPosYstartLevel(arrowYStartLevel + delta1);
|
||||
|
||||
final double length;
|
||||
if (isSelfMessage()) {
|
||||
if (isSelfMessage())
|
||||
length = graphic.getArrowOnlyWidth(getStringBounder()) + getLivingParticipantBox1()
|
||||
.getLiveThicknessAt(getStringBounder(), arrowYStartLevel).getSegment().getLength();
|
||||
} else {
|
||||
else
|
||||
length = graphic.getArrowOnlyWidth(getStringBounder())
|
||||
+ getLivingParticipantBox(NotePosition.LEFT).getLifeLine().getRightShift(arrowYStartLevel)
|
||||
+ getLivingParticipantBox(NotePosition.RIGHT).getLifeLine().getLeftShift(arrowYStartLevel);
|
||||
}
|
||||
|
||||
incFreeY(graphic.getPreferredHeight(getStringBounder()));
|
||||
double marginActivateAndDeactive = 0;
|
||||
@ -121,11 +120,10 @@ class Step1Message extends Step1Abstract {
|
||||
getDrawingSet().addEvent(getMessage(), graphic);
|
||||
|
||||
if (isSelfMessage()) {
|
||||
if (this.getConfig().isReverseDefine()) {
|
||||
if (this.getConfig().isReverseDefine())
|
||||
constraintSet.getConstraintBefore(getParticipantBox1()).ensureValue(length);
|
||||
} else {
|
||||
else
|
||||
constraintSet.getConstraintAfter(getParticipantBox1()).ensureValue(length);
|
||||
}
|
||||
} else {
|
||||
constraintSet.getConstraint(getParticipantBox1(), getParticipantBox2()).ensureValue(length);
|
||||
}
|
||||
@ -137,9 +135,8 @@ class Step1Message extends Step1Abstract {
|
||||
if (graphic instanceof InGroupable) {
|
||||
inGroupablesStack.addElement((InGroupable) graphic);
|
||||
inGroupablesStack.addElement(getLivingParticipantBox1());
|
||||
if (isSelfMessage() == false) {
|
||||
if (isSelfMessage() == false)
|
||||
inGroupablesStack.addElement(getLivingParticipantBox2());
|
||||
}
|
||||
}
|
||||
|
||||
return getFreeY();
|
||||
@ -166,16 +163,16 @@ class Step1Message extends Step1Abstract {
|
||||
}
|
||||
|
||||
private LivingParticipantBox getLivingParticipantBox(NotePosition position) {
|
||||
if (isSelfMessage()) {
|
||||
if (isSelfMessage())
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
return messageArrow.getParticipantAt(getStringBounder(), position);
|
||||
}
|
||||
|
||||
private Arrow createArrow() {
|
||||
if (getMessage().isCreate()) {
|
||||
if (getMessage().isCreate())
|
||||
return createArrowCreate();
|
||||
}
|
||||
|
||||
if (getMessage().getNoteOnMessages().size() > 0 && isSelfMessage()) {
|
||||
final MessageSelfArrow messageSelfArrow = createMessageSelfArrow();
|
||||
final List<NoteBox> noteBoxes = new ArrayList<>();
|
||||
@ -208,13 +205,12 @@ class Step1Message extends Step1Abstract {
|
||||
double deltaX = 0;
|
||||
if (getMessage().isActivate()) {
|
||||
deltaY -= getHalfLifeWidth();
|
||||
if (OptionFlags.STRICT_SELFMESSAGE_POSITION) {
|
||||
if (OptionFlags.STRICT_SELFMESSAGE_POSITION)
|
||||
deltaX += 5;
|
||||
}
|
||||
|
||||
}
|
||||
if (getMessage().isDeactivate()) {
|
||||
if (getMessage().isDeactivate())
|
||||
deltaY += getHalfLifeWidth();
|
||||
}
|
||||
|
||||
final Style[] styles = getMessage().getUsedStyles();
|
||||
final ArrowComponent comp = getDrawingSet().getSkin().createComponentArrow(styles, getConfig(),
|
||||
@ -233,9 +229,9 @@ class Step1Message extends Step1Abstract {
|
||||
}
|
||||
|
||||
private Arrow createArrowCreate() {
|
||||
if (messageArrow == null) {
|
||||
if (messageArrow == null)
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
Arrow result = new ArrowAndParticipant(getStringBounder(), messageArrow, getParticipantBox2(),
|
||||
getDrawingSet().getSkinParam().getPadding(PaddingParam.PARTICIPANT));
|
||||
if (getMessage().getNoteOnMessages().size() > 0) {
|
||||
@ -244,9 +240,9 @@ class Step1Message extends Step1Abstract {
|
||||
final Component note = getNotes().get(i);
|
||||
final Note noteOnMessage = getMessage().getNoteOnMessages().get(i);
|
||||
final NoteBox noteBox = createNoteBox(getStringBounder(), result, note, noteOnMessage);
|
||||
if (noteOnMessage.getPosition() == NotePosition.RIGHT) {
|
||||
if (noteOnMessage.getPosition() == NotePosition.RIGHT)
|
||||
noteBox.pushToRight(getParticipantBox2().getPreferredWidth(getStringBounder()) / 2);
|
||||
}
|
||||
|
||||
noteBoxes.add(noteBox);
|
||||
}
|
||||
result = new ArrowAndNoteBox(getStringBounder(), result, noteBoxes);
|
||||
@ -258,15 +254,15 @@ class Step1Message extends Step1Abstract {
|
||||
|
||||
private ArrowConfiguration getSelfArrowType(Message m) {
|
||||
ArrowConfiguration result = ArrowConfiguration.withDirectionSelf(m.getArrowConfiguration().isReverseDefine());
|
||||
if (m.getArrowConfiguration().isDotted()) {
|
||||
if (m.getArrowConfiguration().isDotted())
|
||||
result = result.withBody(ArrowBody.DOTTED);
|
||||
}
|
||||
if (m.getArrowConfiguration().isHidden()) {
|
||||
|
||||
if (m.getArrowConfiguration().isHidden())
|
||||
result = result.withBody(ArrowBody.HIDDEN);
|
||||
}
|
||||
if (m.getArrowConfiguration().isAsync()) {
|
||||
|
||||
if (m.getArrowConfiguration().isAsync())
|
||||
result = result.withHead(ArrowHead.ASYNC);
|
||||
}
|
||||
|
||||
result = result.withHead1(m.getArrowConfiguration().getDressing1().getHead());
|
||||
result = result.withHead2(m.getArrowConfiguration().getDressing2().getHead());
|
||||
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) {
|
||||
if (x2 > x1) {
|
||||
if (x2 > x1)
|
||||
return m.getArrowConfiguration();
|
||||
}
|
||||
|
||||
return m.getArrowConfiguration().reverse();
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Step1MessageExo extends Step1Abstract {
|
||||
for (Note noteOnMessage : noteOnMessages) {
|
||||
final ISkinParam skinParam = noteOnMessage.getSkinParamBackcolored(drawingSet.getSkinParam());
|
||||
final Component note = drawingSet.getSkin().createComponentNote(noteOnMessage.getUsedStyles(),
|
||||
ComponentType.NOTE, skinParam, noteOnMessage.getStrings(), noteOnMessage.getColors());
|
||||
ComponentType.NOTE, skinParam, noteOnMessage.getDisplay(), noteOnMessage.getColors());
|
||||
addNote(note);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public abstract class CommunicationTileNoteBottomTopAbstract extends AbstractTil
|
||||
|
||||
final protected Component getComponent(StringBounder stringBounder) {
|
||||
final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE,
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings(),
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getDisplay(),
|
||||
noteOnMessage.getColors());
|
||||
return comp;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class CommunicationTileNoteLeft extends AbstractTile {
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE,
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings(),
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getDisplay(),
|
||||
noteOnMessage.getColors());
|
||||
return comp;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ public class CommunicationTileNoteRight extends AbstractTile {
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE,
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings(),
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getDisplay(),
|
||||
noteOnMessage.getColors());
|
||||
return comp;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ public class CommunicationTileSelfNoteRight extends AbstractTile {
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
final Component comp = skin.createComponentNote(noteOnMessage.getUsedStyles(), ComponentType.NOTE,
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getStrings(),
|
||||
noteOnMessage.getSkinParamBackcolored(skinParam), noteOnMessage.getDisplay(),
|
||||
noteOnMessage.getColors());
|
||||
return comp;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class NoteTile extends AbstractTile implements Tile {
|
||||
|
||||
private Component getComponent(StringBounder stringBounder) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class NotesTile extends AbstractTile implements Tile {
|
||||
|
||||
private Component getComponent(StringBounder stringBounder, Note note) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,8 @@ public class EntityImageCircleEnd extends AbstractEntityImage {
|
||||
private static final int SIZE = 20;
|
||||
|
||||
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) {
|
||||
|
@ -56,7 +56,8 @@ public class EntityImageCircleStart extends AbstractEntityImage {
|
||||
private static final int SIZE = 20;
|
||||
|
||||
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) {
|
||||
|
@ -41,6 +41,7 @@ import net.sourceforge.plantuml.klimt.UStroke;
|
||||
import net.sourceforge.plantuml.klimt.UTranslate;
|
||||
import net.sourceforge.plantuml.klimt.color.ColorType;
|
||||
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.font.FontParam;
|
||||
import net.sourceforge.plantuml.klimt.font.StringBounder;
|
||||
@ -95,6 +96,8 @@ public class EntityImageStateBorder extends AbstractEntityImageBorder {
|
||||
HColor backcolor = getEntity().getColors().getColor(ColorType.BACK);
|
||||
if (backcolor == null)
|
||||
backcolor = style.value(PName.BackGroundColor).asColor(getSkinParam().getIHtmlColorSet());
|
||||
if (backcolor.isTransparent())
|
||||
backcolor = getSkinParam().getBackgroundColor();
|
||||
|
||||
ug = ug.apply(getUStroke()).apply(borderColor);
|
||||
ug = ug.apply(backcolor.bg());
|
||||
|
@ -46,7 +46,7 @@ public class Version {
|
||||
private static final int MAJOR_SEPARATOR = 1000000;
|
||||
|
||||
public static int version() {
|
||||
return 1202305;
|
||||
return 1202306;
|
||||
}
|
||||
|
||||
public static int versionPatched() {
|
||||
@ -82,7 +82,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static int beta() {
|
||||
final int beta = 4;
|
||||
final int beta = 0;
|
||||
return beta;
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public class Version {
|
||||
}
|
||||
|
||||
public static long compileTime() {
|
||||
return 1679680470757L;
|
||||
return 1681833838880L;
|
||||
}
|
||||
|
||||
public static String compileTimeString() {
|
||||
|
@ -150,7 +150,7 @@ public class XmiSequenceDiagramStandard extends XmiSequenceDiagram {
|
||||
comment.setAttribute("annotatedElement", String.join(" ", annotated));
|
||||
}
|
||||
comment.appendChild(document.createElement("body"))
|
||||
.appendChild(document.createTextNode(getDisplayString(note.getStrings())));
|
||||
.appendChild(document.createTextNode(getDisplayString(note.getDisplay())));
|
||||
packagedElement.appendChild(comment);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user