From 83478c04037a70fd9986e659350df900c91b31f9 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Sun, 1 Nov 2015 19:37:20 +0100 Subject: [PATCH] version 8032 --- src/net/sourceforge/plantuml/ColorParam.java | 3 +- src/net/sourceforge/plantuml/ISkinParam.java | 2 + src/net/sourceforge/plantuml/SkinParam.java | 27 ++++--- .../sourceforge/plantuml/SkinParamColors.java | 8 ++ .../plantuml/SkinParamDelegator.java | 4 + .../plantuml/SpecificBackcolorable.java | 4 +- src/net/sourceforge/plantuml/StringUtils.java | 5 ++ src/net/sourceforge/plantuml/UrlBuilder.java | 17 +++- .../ftile/vcompact/FtileWhile.java | 12 ++- .../plantuml/command/BlocLines.java | 12 ++- .../command/CommandMultilinesComment.java | 5 +- .../plantuml/command/SingleLineCommand.java | 4 +- .../plantuml/command/SingleLineCommand2.java | 2 + .../note/FactoryNoteOnEntityCommand.java | 5 +- .../sequence/FactorySequenceNoteCommand.java | 32 ++++++-- ...FactorySequenceNoteOverSeveralCommand.java | 14 +++- .../plantuml/command/regex/MyPattern.java | 12 ++- .../sourceforge/plantuml/creole/AtomText.java | 4 +- .../plantuml/donors/PSystemDonors.java | 2 +- .../plantuml/graphic/color/ColorParser.java | 21 +---- .../plantuml/graphic/color/Colors.java | 53 ++++++++++++- .../sourceforge/plantuml/preproc/Defines.java | 4 +- .../plantuml/preproc/UncommentReadLine.java | 5 +- .../plantuml/sequencediagram/Englober.java | 2 +- .../plantuml/sequencediagram/Note.java | 32 +++++--- .../plantuml/sequencediagram/Notes.java | 5 ++ .../sequencediagram/SequenceDiagram.java | 5 ++ .../sequencediagram/command/CommandArrow.java | 4 +- .../graphic/ArrowAndNoteBox.java | 8 +- .../sequencediagram/graphic/NoteBox.java | 21 +++-- .../teoz/CommunicationExoTile.java | 19 +++++ .../teoz/CommunicationTile.java | 40 ++++------ .../teoz/CommunicationTileNoteRight.java | 11 ++- .../teoz/CommunicationTileSelf.java | 2 +- .../sequencediagram/teoz/HSpaceTile.java | 74 ++++++++++++++++++ .../sequencediagram/teoz/LifeEventTile.java | 6 +- .../sequencediagram/teoz/LivingSpace.java | 5 +- .../sequencediagram/teoz/NotesTile.java | 77 ++++++++----------- .../sequencediagram/teoz/TileBuilder.java | 10 +-- .../rose/ComponentRoseGroupingHeader.java | 16 ++-- .../sourceforge/plantuml/skin/rose/Rose.java | 18 +++-- .../plantuml/statediagram/StateDiagram.java | 9 ++- .../plantuml/svek/GroupPngMakerState.java | 5 +- .../plantuml/utils/StartUtils.java | 4 + .../sourceforge/plantuml/version/Version.java | 6 +- 45 files changed, 431 insertions(+), 205 deletions(-) create mode 100644 src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java diff --git a/src/net/sourceforge/plantuml/ColorParam.java b/src/net/sourceforge/plantuml/ColorParam.java index 36c1ad867..f4f1f06cd 100644 --- a/src/net/sourceforge/plantuml/ColorParam.java +++ b/src/net/sourceforge/plantuml/ColorParam.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 17054 $ + * Revision $Revision: 17433 $ * */ package net.sourceforge.plantuml; @@ -96,6 +96,7 @@ public enum ColorParam { participantBorder(HtmlColorUtils.MY_RED, ColorType.LINE), sequenceGroupBorder(HtmlColorUtils.BLACK, ColorType.LINE), sequenceGroupBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), + sequenceGroupBodyBackground(HtmlColorUtils.RED, true, ColorType.BACK), sequenceReferenceBorder(HtmlColorUtils.BLACK, ColorType.LINE), sequenceReferenceHeaderBackground(HtmlColorUtils.COL_EEEEEE, true, ColorType.BACK), sequenceReferenceBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index a41a556d0..a1e54264c 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -83,6 +83,8 @@ public interface ISkinParam extends ISkinSimple { public GraphvizLayoutStrategy getStrategy(); public boolean shadowing(); + + public boolean shadowingForNote(Stereotype stereotype); public boolean shadowing2(SkinParameter skinParameter); diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index ad22e2114..8f3f74b4a 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 17125 $ + * Revision $Revision: 17444 $ * */ package net.sourceforge.plantuml; @@ -78,22 +78,12 @@ public class SkinParam implements ISkinParam { private static final String stereoPatternString = "\\<\\<(.*?)\\>\\>"; private static final Pattern stereoPattern = MyPattern.cmpile(stereoPatternString); - // public SkinParam() { - // - // } - public static SkinParam noShadowing() { final SkinParam result = new SkinParam(); result.setParam("shadowing", "false"); return result; } - // public SkinParam(String type) { - // if (type == null) { - // setParam("shadowing", "false"); - // } - // } - static String cleanForKey(String key) { key = StringUtils.trin(StringUtils.goLowerCase(key)); key = key.replaceAll("_|\\.|\\s", ""); @@ -452,6 +442,21 @@ public class SkinParam implements ISkinParam { return true; } + public boolean shadowingForNote(Stereotype stereotype) { + if (stereotype != null) { + checkStereotype(stereotype); + final String value2 = getValue("note" + "shadowing" + stereotype.getLabel(false)); + if (value2 != null) { + return value2.equalsIgnoreCase("true"); + } + } + final String value2 = getValue("note" + "shadowing"); + if (value2 != null) { + return value2.equalsIgnoreCase("true"); + } + return shadowing(); + } + public boolean shadowing2(SkinParameter skinParameter) { if (skinParameter == null) { throw new IllegalArgumentException(); diff --git a/src/net/sourceforge/plantuml/SkinParamColors.java b/src/net/sourceforge/plantuml/SkinParamColors.java index 1400a24df..6468e788a 100644 --- a/src/net/sourceforge/plantuml/SkinParamColors.java +++ b/src/net/sourceforge/plantuml/SkinParamColors.java @@ -52,6 +52,14 @@ public class SkinParamColors extends SkinParamDelegator { return super.toString() + colors; } + @Override + public boolean shadowing() { + if (colors.getShadowing() == null) { + return super.shadowing(); + } + return colors.getShadowing(); + } + public HtmlColor getFontHtmlColor(FontParam param, Stereotype stereotype) { final HtmlColor value = colors.getColor(ColorType.TEXT); if (value == null) { diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index 283489bd2..a4c3f1a8e 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -229,4 +229,8 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.getTabSize(); } + public boolean shadowingForNote(Stereotype stereotype) { + return shadowingForNote(stereotype); + } + } diff --git a/src/net/sourceforge/plantuml/SpecificBackcolorable.java b/src/net/sourceforge/plantuml/SpecificBackcolorable.java index 62aaa6f56..fa1b1d70a 100644 --- a/src/net/sourceforge/plantuml/SpecificBackcolorable.java +++ b/src/net/sourceforge/plantuml/SpecificBackcolorable.java @@ -33,15 +33,13 @@ */ package net.sourceforge.plantuml; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; public interface SpecificBackcolorable { public Colors getColors(ISkinParam skinParam); - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color); + // public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color); public void setColors(Colors colors); diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java index 589838ccb..70feb2e67 100644 --- a/src/net/sourceforge/plantuml/StringUtils.java +++ b/src/net/sourceforge/plantuml/StringUtils.java @@ -444,6 +444,11 @@ public class StringUtils { return result.toString(); } + public static String manageTildeArobaseStart(String s) { + s = s.replaceAll("~@start", "@start"); + return s; + } + public static String trinNoTrace(CharSequence s) { return s.toString().trim(); } diff --git a/src/net/sourceforge/plantuml/UrlBuilder.java b/src/net/sourceforge/plantuml/UrlBuilder.java index e9f2b1a85..49b4c0f5c 100644 --- a/src/net/sourceforge/plantuml/UrlBuilder.java +++ b/src/net/sourceforge/plantuml/UrlBuilder.java @@ -44,7 +44,7 @@ public class UrlBuilder { STRICT, AT_START, ANYWHERE, AT_END } - private static final String URL_PATTERN = "\\[\\[([%g][^%g]+[%g]|[^{}%s\\]\\[]*)(?:[%s]*\\{([^{}]+)\\})?(?:[%s]*([^\\]\\[]+))?\\]\\]"; + private static final String URL_PATTERN = "\\[\\[([%g][^%g]+[%g]|[^{}%s\\]\\[]*)(?:[%s]*\\{((?:[^{}]|\\{[^{}]*\\})+)\\})?(?:[%s]*([^\\]\\[]+))?\\]\\]"; private final String topurl; private ModeUrl mode; @@ -54,6 +54,21 @@ public class UrlBuilder { this.mode = mode; } + public static String multilineTooltip(String label) { + final Pattern p = MyPattern.cmpile("(?i)^(" + URL_PATTERN + ")?(.*)$"); + final Matcher m = p.matcher(label); + if (m.matches() == false) { + return label; + } + String gr1 = m.group(1); + if (gr1 == null) { + return label; + } + final String gr2 = m.group(m.groupCount()); + gr1 = gr1.replaceAll("\\\\n", "\n"); + return gr1 + gr2; + } + public Url getUrl(String s) { final Pattern p; if (mode == ModeUrl.STRICT) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index 6aac43a11..426d1a787 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -208,6 +208,11 @@ class FtileWhile extends AbstractFtile { return getTranslateForWhile(stringBounder).getTranslated(geo.getPointOut()); } + private double getBottom(final StringBounder stringBounder) { + final FtileGeometry geo = whileBlock.calculateDimension(stringBounder); + return getTranslateForWhile(stringBounder).getDy() + geo.getHeight(); + } + private Point2D getP2(final StringBounder stringBounder) { return getTranslateDiamond1(stringBounder).getTranslated(new Point2D.Double(0, 0)); } @@ -230,16 +235,17 @@ class FtileWhile extends AbstractFtile { final double y2 = p2.getY() + dimDiamond1.getOutY() / 2; snake.addPoint(x1, y1); - snake.addPoint(x1, y1 + Diamond.diamondHalfSize); + final double y1bis = Math.max(y1, getBottom(stringBounder)) + Diamond.diamondHalfSize; + snake.addPoint(x1, y1bis); final double xx = dimTotal.getWidth(); - snake.addPoint(xx, y1 + Diamond.diamondHalfSize); + snake.addPoint(xx, y1bis); snake.addPoint(xx, y2); snake.addPoint(x2, y2); snake.emphasizeDirection(Direction.UP); ug.draw(snake); - ug.apply(new UTranslate(x1, y1 + Diamond.diamondHalfSize)).draw(new UEmpty(5, Diamond.diamondHalfSize)); + ug.apply(new UTranslate(x1, y1bis)).draw(new UEmpty(5, Diamond.diamondHalfSize)); // ug = ug.apply(new UChangeColor(endInlinkColor)).apply(new UChangeBackColor(endInlinkColor)); // ug.apply(new UTranslate(xx, (y1 + y2) / 2)).draw(Arrows.asToUp()); diff --git a/src/net/sourceforge/plantuml/command/BlocLines.java b/src/net/sourceforge/plantuml/command/BlocLines.java index bb23043cb..9aa67cf26 100644 --- a/src/net/sourceforge/plantuml/command/BlocLines.java +++ b/src/net/sourceforge/plantuml/command/BlocLines.java @@ -46,14 +46,14 @@ import net.sourceforge.plantuml.cucadiagram.Display; public class BlocLines implements Iterable { private List lines; - + @Override public String toString() { return lines.toString(); } private BlocLines(List lines) { - this.lines = Collections.unmodifiableList(lines); + this.lines = (List) Collections.unmodifiableList(lines); } public Display toDisplay() { @@ -248,4 +248,12 @@ public class BlocLines implements Iterable { return new BlocLines(copy); } + public BlocLines removeInnerComments() { + final List copy = new ArrayList(); + for (CharSequence cs : lines) { + copy.add(MyPattern.removeAll(cs, CommandMultilinesComment.INNER_COMMENT)); + } + return new BlocLines(copy); + } + } diff --git a/src/net/sourceforge/plantuml/command/CommandMultilinesComment.java b/src/net/sourceforge/plantuml/command/CommandMultilinesComment.java index c74cff3ed..1dc3b0dab 100644 --- a/src/net/sourceforge/plantuml/command/CommandMultilinesComment.java +++ b/src/net/sourceforge/plantuml/command/CommandMultilinesComment.java @@ -37,9 +37,10 @@ import net.sourceforge.plantuml.core.Diagram; public class CommandMultilinesComment extends CommandMultilines { - public static final String COMMENT_MULTILINE_END = "(?i)^.*[%q]/[%s]*$"; - public static final String COMMENT_MULTILINE_START = "(?i)^[%s]*/[%q].*$"; + public static final String COMMENT_MULTILINE_START = "(?i)^[%s]*/[%q]([^%q]|[%q][^/])*$"; + public static final String COMMENT_MULTILINE_END = "(?i)^([^%q]|[%q][^/])*[%q]/[%s]*$"; public static final String COMMENT_SINGLE_LINE = "(?i)^[%s]*([%q].*||/[%q].*[%q]/[%s]*)$"; + public static final String INNER_COMMENT = "/[%q].*?[%q]/"; public CommandMultilinesComment() { super(COMMENT_MULTILINE_START); diff --git a/src/net/sourceforge/plantuml/command/SingleLineCommand.java b/src/net/sourceforge/plantuml/command/SingleLineCommand.java index 90d3c7a6e..80c3196e3 100644 --- a/src/net/sourceforge/plantuml/command/SingleLineCommand.java +++ b/src/net/sourceforge/plantuml/command/SingleLineCommand.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 16447 $ + * Revision $Revision: 17468 $ * */ package net.sourceforge.plantuml.command; @@ -64,6 +64,7 @@ public abstract class SingleLineCommand implements Command if (lines.size() != 1) { return CommandControl.NOT_OK; } + lines = lines.removeInnerComments(); if (isCommandForbidden()) { return CommandControl.NOT_OK; } @@ -87,6 +88,7 @@ public abstract class SingleLineCommand implements Command if (lines.size() != 1) { throw new IllegalArgumentException(); } + lines = lines.removeInnerComments(); final String line = StringUtils.trin(lines.getFirst499()); if (isForbidden(line)) { return CommandExecutionResult.error("Forbidden line " + line); diff --git a/src/net/sourceforge/plantuml/command/SingleLineCommand2.java b/src/net/sourceforge/plantuml/command/SingleLineCommand2.java index 7d5f39441..e31f5ec44 100644 --- a/src/net/sourceforge/plantuml/command/SingleLineCommand2.java +++ b/src/net/sourceforge/plantuml/command/SingleLineCommand2.java @@ -62,6 +62,7 @@ public abstract class SingleLineCommand2 implements Command implements Command{2})?"), // + new RegexLeaf("[%s]*"), // new RegexLeaf("POSITION", "(right|left|over)[%s]+"), // new RegexLeaf("PARTICIPANT", "(?:of[%s]+)?([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("$")); } @@ -69,15 +76,22 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma return new RegexConcat(// new RegexLeaf("^"), // new RegexLeaf("VMERGE", "(/)?[%s]*"), // - new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+"), // + new RegexLeaf("STYLE", "(note|hnote|rnote)"), // + new RegexLeaf("[%s]*"), // + new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // + new RegexLeaf("[%s]*"), // new RegexLeaf("POSITION", "(right|left|over)[%s]+"), // new RegexLeaf("PARTICIPANT", "(?:of[%s])?([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("[%s]*:[%s]*"), // new RegexLeaf("NOTE", "(.*)"), // new RegexLeaf("$")); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + public Command createMultiLine(boolean withBracket) { return new CommandMultilines2(getRegexConcatMultiLine(), MultilinesStrategy.KEEP_STARTING_QUOTE) { @@ -116,7 +130,15 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma if (strings.size() > 0) { final boolean tryMerge = arg.get("VMERGE", 0) != null; final Note note = new Note(p, position, strings.toDisplay()); - note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(arg.get("COLOR", 0))); + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + final String stereotypeString = arg.get("STEREO", 0); + if (stereotypeString != null) { + final Stereotype stereotype = new Stereotype(stereotypeString); + note.setStereotype(stereotype); + colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), FontParam.NOTE, + ColorParam.noteBackground, ColorParam.noteBorder); + } + note.setColors(colors); note.setStyle(NoteStyle.getNoteStyle(arg.get("STYLE", 0))); diagram.addNote(note, tryMerge); } diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java index f7d8edc13..2686a5e30 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOverSeveralCommand.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; import net.sourceforge.plantuml.sequencediagram.Note; import net.sourceforge.plantuml.sequencediagram.NoteStyle; import net.sourceforge.plantuml.sequencediagram.Participant; @@ -60,7 +61,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), // new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), // new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("$") // ); } @@ -72,11 +73,16 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF new RegexLeaf("STYLE", "(note|hnote|rnote)[%s]+over[%s]+"), // new RegexLeaf("P1", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*\\,[%s]*"), // new RegexLeaf("P2", "([\\p{L}0-9_.@]+|[%g][^%g]+[%g])[%s]*"), // - ColorParser.exp1(), // + color().getRegex(), // new RegexLeaf("[%s]*:[%s]*"), // new RegexLeaf("NOTE", "(.*)"), // new RegexLeaf("$")); } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + public Command createSingleLine() { return new SingleLineCommand2(getRegexConcatSingleLine()) { @@ -119,7 +125,9 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF if (lines.size() > 0) { final boolean tryMerge = line0.get("VMERGE", 0) != null; final Note note = new Note(p1, p2, lines.toDisplay()); - note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); + final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); + note.setColors(colors); + // note.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0))); note.setStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0))); diagram.addNote(note, tryMerge); } diff --git a/src/net/sourceforge/plantuml/command/regex/MyPattern.java b/src/net/sourceforge/plantuml/command/regex/MyPattern.java index 6b029b759..6a7967d2e 100644 --- a/src/net/sourceforge/plantuml/command/regex/MyPattern.java +++ b/src/net/sourceforge/plantuml/command/regex/MyPattern.java @@ -91,12 +91,16 @@ public abstract class MyPattern { return p; } -// public static boolean mtches(String input, String regex) { -// return cmpile(regex).matcher(input).matches(); -// } -// + // public static boolean mtches(String input, String regex) { + // return cmpile(regex).matcher(input).matches(); + // } + // public static boolean mtches(CharSequence input, String regex) { return cmpile(regex).matcher(input).matches(); } + public static CharSequence removeAll(CharSequence src, String regex) { + return src.toString().replaceAll(transform(regex), ""); + } + } diff --git a/src/net/sourceforge/plantuml/creole/AtomText.java b/src/net/sourceforge/plantuml/creole/AtomText.java index 0c18bf0f2..6d31d51b6 100644 --- a/src/net/sourceforge/plantuml/creole/AtomText.java +++ b/src/net/sourceforge/plantuml/creole/AtomText.java @@ -118,8 +118,8 @@ public class AtomText implements Atom { this.marginLeft = marginLeft; this.marginRight = marginRight; // this.text = StringUtils.showComparatorCharacters(StringUtils.manageBackslash(text)); - this.text = StringUtils.manageUnicodeNotationUplus(StringUtils.manageAmpDiese(StringUtils - .showComparatorCharacters(CharHidder.unhide(text)))); + this.text = StringUtils.manageTildeArobaseStart(StringUtils.manageUnicodeNotationUplus(StringUtils + .manageAmpDiese(StringUtils.showComparatorCharacters(CharHidder.unhide(text))))); this.fontConfiguration = style; this.url = url; } diff --git a/src/net/sourceforge/plantuml/donors/PSystemDonors.java b/src/net/sourceforge/plantuml/donors/PSystemDonors.java index 6f4fd7026..84325e8b1 100644 --- a/src/net/sourceforge/plantuml/donors/PSystemDonors.java +++ b/src/net/sourceforge/plantuml/donors/PSystemDonors.java @@ -58,7 +58,7 @@ import net.sourceforge.plantuml.version.PSystemVersion; public class PSystemDonors extends AbstractPSystem { - public static final String DONORS = "UDfTKi6IsZ0ClUihVCwq7v4b7Jg1tUr0syFUHA8b0cEbjaERV7sLROCDEbaZFUaz-PMs-1_auHj5ygPqKHnZ0z-fI24Ns4fAVO1oWU81rZwLQ8Gz7J14HcTUf7DGkbQyMGl5YURd-xjsBEteO8lP8XUXuYLX2sKQBLVO3ud226ikxiC9r0lB8S0-Kj-HCokHNlLLonuAiBayGCN3IYmxivCX4DJ3GxquYGfPafxXEMEDbppLLQMbF-XQFUUgOvrwH3-gqjrDjZl2Iyu-Jl1g-Qg0YfkpChzLsC6NS1ljCX85NQ6QBXpzQBROIOjGpqT_wr37Ptq5sVHT6kTHp-GmQf_oKrxrF_9qlbFbshlq0yawo2hirKUUu6igjmBFt7HapHEo7NC5Tih9XF18hIPqdsjiVWqKJ3KSFEhNsYJ_fvmYDPtPU0oOA1r97PjzuE_PQDfYDdBbt3SVplcHz3F2BlFolE9EvqdHVUOoES-7UXAF3ct_oRnHHEa3_0KmFDNM"; + public static final String DONORS = "UDfTKi6IsZ0ClUihVCwq7v4b7Jg1tUr0syFUHA8b0cEbjaERV7sLROCDEbaZFUaz-PMs-1_auHj5ygPqKHnZ0z-fI24Ns4fAVO1oWU81rZwLQ8Gz7J14HcTUf7DGkbQyMGl5YURd-xjsBEteO8lP8XUXuYLX2sKQBLVO3ud226ikxiC9r0lB8S0-Kj-HCokHNlLLonuAiBayGCN3IYmxivCX4DJ3GxquYGfPafxXEMEDbppLLQMbF-XQFUUgOvrwH3-gqjrDjZl2Iyu-Jl1g-Qg0YfkpChzLsC6NS1ljCX85NQ6QBXpzQBROIOjGpqT_wr37Ptq5sVHT6kTHp-GmQf_oKrxrF_9qlbFbshlq0yawo2hirKUUu6igjmBFt7HapHEo7NC5Tih9XF18hIPqdsjiVWqKJ3KSFEhNsYJ_fvmYDPtPU0oOA1r97PjzuE_PQDfYDdBbt3SVplcHz3F2BlFolE9EvqdHVUOoES-7UXAF3ct_oRnHHEa3x5Gl-jPiUFvf-0laPjiQ"; public ImageData exportDiagram(OutputStream os, int num, FileFormatOption fileFormat) throws IOException { final GraphicStrings result = getGraphicStrings(); diff --git a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java index b36236ec7..57c750ec4 100644 --- a/src/net/sourceforge/plantuml/graphic/color/ColorParser.java +++ b/src/net/sourceforge/plantuml/graphic/color/ColorParser.java @@ -35,15 +35,14 @@ package net.sourceforge.plantuml.graphic.color; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexResult; -import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.IHtmlColorSet; public class ColorParser { private static final String COLOR_REGEXP = "#\\w+[-\\\\|/]?\\w+"; - private static final String PART2 = "#(?:\\w+[-\\\\|/]?\\w+;)?(?:(?:text|back|header|line|line\\.dashed|line\\.dotted|line\\.bold)(?::\\w+[-\\\\|/]?\\w+)?(?:;|(?![\\w;:.])))+"; - private static final String COLORS_REGEXP = "(?:" + COLOR_REGEXP + ")|(?:" + PART2 + ")"; + private static final String PART2 = "#(?:\\w+[-\\\\|/]?\\w+;)?(?:(?:text|back|header|line|line\\.dashed|line\\.dotted|line\\.bold|shadowing)(?::\\w+[-\\\\|/]?\\w+)?(?:;|(?![\\w;:.])))+"; + private static final String COLORS_REGEXP = "(?:" + PART2 + ")|(?:" + COLOR_REGEXP + ")"; private final RegexLeaf regex; private final String name; @@ -55,18 +54,6 @@ public class ColorParser { this.mainType = mainType; } - public HtmlColor getLegacyColoe(RegexResult arg, IHtmlColorSet set) { - if (mainType != null) { - throw new IllegalStateException(); - } - final String data = arg.get("COLOR", 0); - if (data != null && data.matches(PART2)) { - throw new IllegalStateException(); - } - final HtmlColor result = set.getColorIfValid(data); - return result; - } - public Colors getColor(RegexResult arg, IHtmlColorSet set) { if (mainType == null) { throw new IllegalStateException(); @@ -107,10 +94,6 @@ public class ColorParser { return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + "):)?"); } - public static RegexLeaf exp5() { - return new RegexLeaf("COLOR", "(?::?(" + COLOR_REGEXP + "))?"); - } - public static RegexLeaf exp6() { return new RegexLeaf("COLOR", "(?:(" + COLOR_REGEXP + ")\\|)?"); } diff --git a/src/net/sourceforge/plantuml/graphic/color/Colors.java b/src/net/sourceforge/plantuml/graphic/color/Colors.java index c1c3a8ad5..d7ca783f0 100644 --- a/src/net/sourceforge/plantuml/graphic/color/Colors.java +++ b/src/net/sourceforge/plantuml/graphic/color/Colors.java @@ -38,6 +38,7 @@ import java.util.Map; import java.util.StringTokenizer; import net.sourceforge.plantuml.ColorParam; +import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.SkinParamColors; import net.sourceforge.plantuml.StringUtils; @@ -52,6 +53,7 @@ public class Colors { private final Map map = new EnumMap(ColorType.class); private LinkStyle lineStyle = null; + private Boolean shadowing = null; @Override public String toString() { @@ -83,9 +85,15 @@ public class Colors { map.put(mainType, set.getColorIfValid(s)); } } else { - final ColorType key = ColorType.getType(s.substring(0, x)); - final HtmlColor color = set.getColorIfValid(s.substring(x + 1)); - map.put(key, color); + final String name = s.substring(0, x); + final String value = s.substring(x + 1); + if (name.equalsIgnoreCase("shadowing")) { + this.shadowing = value.equalsIgnoreCase("true"); + } else { + final ColorType key = ColorType.getType(name); + final HtmlColor color = set.getColorIfValid(value); + map.put(key, color); + } } } if (data.contains("line.dashed")) { @@ -126,6 +134,9 @@ public class Colors { // } public Colors add(ColorType type, HtmlColor color) { + if (color == null) { + return this; + } final Colors result = copy(); result.map.put(type, color); return result; @@ -186,4 +197,40 @@ public class Colors { return add(colorType, colors); } + private Colors applyFontParamStereotype(Stereotype stereotype, ISkinParam skinParam, FontParam param) { + if (stereotype == null) { + throw new IllegalArgumentException(); + } + if (param == null) { + return this; + } + final ColorType colorType = ColorType.TEXT; + if (getColor(colorType) != null) { + return this; + } + final HtmlColor col = skinParam.getFontHtmlColor(param, stereotype); + return add(colorType, col); + } + + public Colors applyStereotypeForNote(Stereotype stereotype, ISkinParam skinParam, FontParam fontParam, + ColorParam... params) { + if (stereotype == null) { + throw new IllegalArgumentException(); + } + if (params == null) { + throw new IllegalArgumentException(); + } + Colors result = this; + for (ColorParam param : params) { + result = result.applyStereotype(stereotype, skinParam, param); + } + result = result.applyFontParamStereotype(stereotype, skinParam, fontParam); + result.shadowing = skinParam.shadowingForNote(stereotype); + return result; + } + + public Boolean getShadowing() { + return shadowing; + } + } diff --git a/src/net/sourceforge/plantuml/preproc/Defines.java b/src/net/sourceforge/plantuml/preproc/Defines.java index f491019ca..0f32588bf 100644 --- a/src/net/sourceforge/plantuml/preproc/Defines.java +++ b/src/net/sourceforge/plantuml/preproc/Defines.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 17316 $ + * Revision $Revision: 17496 $ * */ package net.sourceforge.plantuml.preproc; @@ -102,7 +102,7 @@ public class Defines { int i = 1; while (st.hasMoreTokens()) { - regex.append("(?:(?:\\s*\"([^\"]*)\"\\s*)|(?:\\s*'([^']*)'\\s*)|\\s*([^,]*))"); + regex.append("(?:(?:\\s*\"([^\"]*)\"\\s*)|(?:\\s*'([^']*)'\\s*)|\\s*" + "((?:\\([^()]*\\)|[^,])*?)" + ")"); final String var1 = st.nextToken(); final String var2 = "(##" + var1 + "\\b)|(\\b" + var1 + "##)|(\\b" + var1 + "\\b)"; newValue = newValue.replaceAll(var2, "\\$" + i + "\\$" + (i + 1) + "\\$" + (i + 2)); diff --git a/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java b/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java index 3fa5d1152..e343e2e84 100644 --- a/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java +++ b/src/net/sourceforge/plantuml/preproc/UncommentReadLine.java @@ -40,6 +40,7 @@ import java.util.regex.Pattern; import net.sourceforge.plantuml.CharSequence2; import net.sourceforge.plantuml.CharSequence2Impl; import net.sourceforge.plantuml.command.regex.MyPattern; +import net.sourceforge.plantuml.utils.StartUtils; public class UncommentReadLine implements ReadLine { @@ -51,8 +52,8 @@ public class UncommentReadLine implements ReadLine { public UncommentReadLine(ReadLine source) { this.raw = source; - this.start = MyPattern.cmpile("(?i)((?:\\W|\\<[^<>]*\\>)*)@start"); - this.unpause = MyPattern.cmpile("(?i)((?:\\W|\\<[^<>]*\\>)*)@unpause"); + this.start = MyPattern.cmpile(StartUtils.START_PATTERN); + this.unpause = MyPattern.cmpile(StartUtils.PAUSE_PATTERN); } public CharSequence2 readLine() throws IOException { diff --git a/src/net/sourceforge/plantuml/sequencediagram/Englober.java b/src/net/sourceforge/plantuml/sequencediagram/Englober.java index ed68be710..dd2d60a5f 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Englober.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Englober.java @@ -206,7 +206,7 @@ public class Englober { } public Real getMaxX(StringBounder stringBounder) { - return getX2(); + return getX2().addFixed(10); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/Note.java b/src/net/sourceforge/plantuml/sequencediagram/Note.java index c8a434895..d22bdd1d4 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Note.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Note.java @@ -28,20 +28,18 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 17004 $ + * Revision $Revision: 17479 $ * */ package net.sourceforge.plantuml.sequencediagram; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.SkinParamBackcolored; import net.sourceforge.plantuml.SpecificBackcolorable; import net.sourceforge.plantuml.Url; import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.UrlBuilder.ModeUrl; import net.sourceforge.plantuml.cucadiagram.Display; -import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.color.Colors; public class Note extends AbstractEvent implements Event, SpecificBackcolorable { @@ -54,6 +52,8 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable private final NotePosition position; private NoteStyle style = NoteStyle.NORMAL; + // private Stereotype stereotype; + private final Url url; public Note(Participant p, NotePosition position, Display strings) { @@ -102,11 +102,11 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable return colors; } - public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { - if (color != null) { - this.colors = colors.add(type, color); - } - } + // public void setSpecificColorTOBEREMOVED(ColorType type, HtmlColor color) { + // if (color != null) { + // this.colors = colors.add(type, color); + // } + // } private Colors colors = Colors.empty(); @@ -134,8 +134,18 @@ public class Note extends AbstractEvent implements Event, SpecificBackcolorable this.style = style; } - public SkinParamBackcolored getSkinParamBackcolored(ISkinParam skinParam) { - return new SkinParamBackcolored(skinParam, getColors(skinParam).getColor(ColorType.BACK)); + public ISkinParam getSkinParamBackcolored(ISkinParam skinParam) { + // return new SkinParamBackcolored(skinParam, getColors(skinParam).getColor(ColorType.BACK)); + return colors.mute(skinParam); + } + + public void setStereotype(Stereotype stereotype) { + // this.stereotype = stereotype; + } + + @Override + public String toString() { + return super.toString() + " " + strings; } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/Notes.java b/src/net/sourceforge/plantuml/sequencediagram/Notes.java index 82cf78ebc..a0e4b3c7c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/Notes.java +++ b/src/net/sourceforge/plantuml/sequencediagram/Notes.java @@ -34,6 +34,7 @@ package net.sourceforge.plantuml.sequencediagram; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -66,4 +67,8 @@ public class Notes extends AbstractEvent implements Event, Iterable { public Note get(int i) { return notes.get(i); } + + public List asList() { + return Collections.unmodifiableList(notes); + } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java index d31cfc3fd..3d9bc9d11 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java +++ b/src/net/sourceforge/plantuml/sequencediagram/SequenceDiagram.java @@ -43,6 +43,7 @@ import java.util.List; import java.util.Map; import java.util.Stack; +import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FileFormat; import net.sourceforge.plantuml.FileFormatOption; import net.sourceforge.plantuml.OptionFlags; @@ -129,6 +130,7 @@ public class SequenceDiagram extends UmlDiagram { } public void addNote(Note n, boolean tryMerge) { + // this.lastEventWithDeactivate = null; if (tryMerge && events.size() > 0) { final Event last = events.get(events.size() - 1); if (last instanceof Note) { @@ -272,6 +274,9 @@ public class SequenceDiagram extends UmlDiagram { if (type != GroupingType.START && openGroupings.size() == 0) { return false; } + if (backColorGeneral == null) { + backColorGeneral = getSkinParam().getHtmlColor(ColorParam.sequenceGroupBodyBackground, null, false); + } final GroupingStart top = openGroupings.size() > 0 ? openGroupings.get(0) : null; diff --git a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java index 26640694a..9004344c3 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java +++ b/src/net/sourceforge/plantuml/sequencediagram/command/CommandArrow.java @@ -36,6 +36,7 @@ package net.sourceforge.plantuml.sequencediagram.command; import java.util.StringTokenizer; import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.UrlBuilder; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; @@ -167,7 +168,8 @@ public class CommandArrow extends SingleLineCommand2 { if (arg.get("MESSAGE", 0) == null) { labels = Display.create(""); } else { - labels = Display.getWithNewlines(arg.get("MESSAGE", 0)); + final String message = UrlBuilder.multilineTooltip(arg.get("MESSAGE", 0)); + labels = Display.getWithNewlines(message); } ArrowConfiguration config = hasDressing1 && hasDressing2 ? ArrowConfiguration.withDirectionBoth() diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndNoteBox.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndNoteBox.java index 05338de6e..2be161137 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndNoteBox.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/ArrowAndNoteBox.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12235 $ + * Revision $Revision: 17359 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; @@ -89,7 +89,11 @@ class ArrowAndNoteBox extends Arrow implements InGroupable { public double getPreferredWidth(StringBounder stringBounder) { double w = arrow.getPreferredWidth(stringBounder); w = Math.max(w, arrow.getActualWidth(stringBounder)); - return w + noteBox.getPreferredWidth(stringBounder); + double result = w + noteBox.getPreferredWidth(stringBounder); + if (noteBox.getNotePosition() == NotePosition.RIGHT) { + result += noteBox.getRightShift(arrow.getStartingY()); + } + return result; } @Override diff --git a/src/net/sourceforge/plantuml/sequencediagram/graphic/NoteBox.java b/src/net/sourceforge/plantuml/sequencediagram/graphic/NoteBox.java index 8b9b16c7b..39b23e93c 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/graphic/NoteBox.java +++ b/src/net/sourceforge/plantuml/sequencediagram/graphic/NoteBox.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 12235 $ + * Revision $Revision: 17359 $ * */ package net.sourceforge.plantuml.sequencediagram.graphic; @@ -74,6 +74,13 @@ final class NoteBox extends GraphicalElement implements InGroupable { this.comp = comp; } + public double getRightShift(double y) { + if (p1 == null) { + return 0; + } + return p1.getLifeLine().getRightShift(y) + 5; + } + @Override final public double getPreferredWidth(StringBounder stringBounder) { final double preferredWidth = comp.getPreferredWidth(stringBounder); @@ -98,8 +105,8 @@ final class NoteBox extends GraphicalElement implements InGroupable { final StringBounder stringBounder = ug.getStringBounder(); final double xStart = getStartingX(stringBounder); ug = ug.apply(new UTranslate(xStart, getStartingY())); - final Dimension2D dimensionToUse = new Dimension2DDouble(getPreferredWidth(stringBounder), comp - .getPreferredHeight(stringBounder)); + final Dimension2D dimensionToUse = new Dimension2DDouble(getPreferredWidth(stringBounder), + comp.getPreferredHeight(stringBounder)); if (url != null) { ug.startUrl(url); } @@ -131,8 +138,8 @@ final class NoteBox extends GraphicalElement implements InGroupable { private SegmentColored getSegment(StringBounder stringBounder) { final SegmentColored segment = p1.getLiveThicknessAt(stringBounder, getStartingY()); - final SegmentColored segment2 = p1.getLiveThicknessAt(stringBounder, getStartingY() - + comp.getPreferredHeight(stringBounder)); + final SegmentColored segment2 = p1.getLiveThicknessAt(stringBounder, + getStartingY() + comp.getPreferredHeight(stringBounder)); return segment.merge(segment2); } @@ -156,4 +163,8 @@ final class NoteBox extends GraphicalElement implements InGroupable { return url; } + public NotePosition getNotePosition() { + return position; + } + } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java index af30b2c37..3593eb2d0 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationExoTile.java @@ -40,13 +40,16 @@ import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.real.Real; import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.MessageExo; +import net.sourceforge.plantuml.sequencediagram.MessageExoType; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.skin.ArrowComponent; import net.sourceforge.plantuml.skin.ArrowConfiguration; +import net.sourceforge.plantuml.skin.ArrowDecoration; import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.Skin; +import net.sourceforge.plantuml.skin.rose.ComponentRoseArrow; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UTranslate; @@ -95,6 +98,22 @@ public class CommunicationExoTile implements TileWithUpdateStairs { x2 += CommunicationTile.LIVE_DELTA_SIZE * (level - 2); } } + + final ArrowConfiguration arrowConfiguration = message.getArrowConfiguration(); + final MessageExoType type = message.getType(); + if (arrowConfiguration.getDecoration1() == ArrowDecoration.CIRCLE && type == MessageExoType.FROM_LEFT) { + x1 += ComponentRoseArrow.diamCircle / 2 + 2; + } + if (arrowConfiguration.getDecoration2() == ArrowDecoration.CIRCLE && type == MessageExoType.TO_LEFT) { + x1 += ComponentRoseArrow.diamCircle / 2 + 2; + } + if (arrowConfiguration.getDecoration2() == ArrowDecoration.CIRCLE && type == MessageExoType.TO_RIGHT) { + x2 -= ComponentRoseArrow.diamCircle / 2 + 2; + } + if (arrowConfiguration.getDecoration1() == ArrowDecoration.CIRCLE && type == MessageExoType.FROM_RIGHT) { + x2 -= ComponentRoseArrow.diamCircle / 2 + 2; + } + final Area area = new Area(x2 - x1, dim.getHeight()); ug = ug.apply(new UTranslate(x1, 0)); comp.drawU(ug, area, (Context2D) ug); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java index 27a03f7f2..7f71104e4 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTile.java @@ -37,7 +37,6 @@ import java.awt.geom.Dimension2D; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.graphic.HorizontalAlignment; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.StringBounder; import net.sourceforge.plantuml.graphic.VerticalAlignment; import net.sourceforge.plantuml.real.Real; @@ -50,9 +49,7 @@ import net.sourceforge.plantuml.skin.Component; import net.sourceforge.plantuml.skin.ComponentType; import net.sourceforge.plantuml.skin.Context2D; import net.sourceforge.plantuml.skin.Skin; -import net.sourceforge.plantuml.ugraphic.UChangeColor; import net.sourceforge.plantuml.ugraphic.UGraphic; -import net.sourceforge.plantuml.ugraphic.URectangle; import net.sourceforge.plantuml.ugraphic.UTranslate; public class CommunicationTile implements TileWithUpdateStairs, TileWithCallbackY { @@ -184,26 +181,25 @@ public class CommunicationTile implements TileWithUpdateStairs, TileWithCallback final Dimension2D dim = comp.getPreferredDimension(stringBounder); final double width = dim.getWidth(); - // if (isSelf()) { - // final LivingSpace next = livingSpace1.getNext(); - // if (next != null) { - // next.getPosB().ensureBiggerThan(getMaxX(stringBounder)); - // } - // } else { - final Real point1 = getPoint1(stringBounder); - final Real point2 = getPoint2(stringBounder); - if (point1.getCurrentValue() < point2.getCurrentValue()) { - point2.ensureBiggerThan(point1.addFixed(width)); - } else { + Real point1 = getPoint1(stringBounder); + Real point2 = getPoint2(stringBounder); + if (isReverse(stringBounder)) { + final int level1 = livingSpace1.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE); + final int level2 = livingSpace2.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE); + if (level1 > 0) { + point1 = point1.addFixed(-LIVE_DELTA_SIZE); + } + point2 = point2.addFixed(level2 * LIVE_DELTA_SIZE); point1.ensureBiggerThan(point2.addFixed(width)); - // } + } else { + final int level2 = livingSpace2.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE); + if (level2 > 0) { + point2 = point2.addFixed(-LIVE_DELTA_SIZE); + } + point2.ensureBiggerThan(point1.addFixed(width)); } } - // private boolean isSelf() { - // return livingSpace1 == livingSpace2; - // } - private Real getPoint1(final StringBounder stringBounder) { return livingSpace1.getPosC(stringBounder); } @@ -226,12 +222,6 @@ public class CommunicationTile implements TileWithUpdateStairs, TileWithCallback } public Real getMaxX(StringBounder stringBounder) { - // if (isSelf()) { - // final Component comp = getComponent(stringBounder); - // final Dimension2D dim = comp.getPreferredDimension(stringBounder); - // final double width = dim.getWidth(); - // return livingSpace1.getPosC(stringBounder).addFixed(width); - // } if (isReverse(stringBounder)) { return getPoint1(stringBounder); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java index 25f9075b7..fefbdb830 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileNoteRight.java @@ -56,13 +56,12 @@ public class CommunicationTileNoteRight implements TileWithUpdateStairs, TileWit private final Skin skin; private final ISkinParam skinParam; private final Display notes; - // private final NotePosition notePosition; private final LivingSpace livingSpace; public Event getEvent() { return message; } - + private boolean isCreate() { return message.isCreate(); } @@ -74,7 +73,6 @@ public class CommunicationTileNoteRight implements TileWithUpdateStairs, TileWit this.skin = skin; this.skinParam = skinParam; this.notes = message.getNote(); - // this.notePosition = message.getNotePosition(); this.livingSpace = livingSpace; } @@ -89,12 +87,13 @@ public class CommunicationTileNoteRight implements TileWithUpdateStairs, TileWit } private Real getNotePosition(StringBounder stringBounder) { - final Component comp = getComponent(stringBounder); - final Dimension2D dim = comp.getPreferredDimension(stringBounder); + // final Component comp = getComponent(stringBounder); + // final Dimension2D dim = comp.getPreferredDimension(stringBounder); if (isCreate()) { return livingSpace.getPosD(stringBounder); } - return livingSpace.getPosC(stringBounder); + final int level = livingSpace.getLevelAt(this, EventsHistoryMode.IGNORE_FUTURE_DEACTIVATE); + return livingSpace.getPosC(stringBounder).addFixed(level * CommunicationTile.LIVE_DELTA_SIZE); } public void drawU(UGraphic ug) { diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java index 76cfc9b76..7e76bd038 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/CommunicationTileSelf.java @@ -152,7 +152,7 @@ public class CommunicationTileSelf implements TileWithUpdateStairs { final LivingSpace next = getNext(); if (next != null) { - next.getPosB().ensureBiggerThan(getMaxX(stringBounder)); + next.getPosC(stringBounder).ensureBiggerThan(getMaxX(stringBounder)); } } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java new file mode 100644 index 000000000..351c96559 --- /dev/null +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/HSpaceTile.java @@ -0,0 +1,74 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2014, Arnaud Roques + * + * Project Info: http://plantuml.sourceforge.net + * + * 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. + * + * [Java is a trademark or registered trademark of Sun Microsystems, Inc. + * in the United States and other countries.] + * + * Original Author: Arnaud Roques + * + * Revision $Revision: 4636 $ + * + */ +package net.sourceforge.plantuml.sequencediagram.teoz; + +import net.sourceforge.plantuml.graphic.StringBounder; +import net.sourceforge.plantuml.real.Real; +import net.sourceforge.plantuml.sequencediagram.Event; +import net.sourceforge.plantuml.sequencediagram.HSpace; +import net.sourceforge.plantuml.ugraphic.UGraphic; + +public class HSpaceTile implements Tile { + + private final HSpace hspace; + private final Real origin; + + public Event getEvent() { + return hspace; + } + + public HSpaceTile(HSpace hspace, TileArguments tileArguments) { + this.hspace = hspace; + this.origin = tileArguments.getOrigin(); + } + + public void drawU(UGraphic ug) { + } + + public double getPreferredHeight(StringBounder stringBounder) { + return hspace.getPixel(); + } + + public void addConstraints(StringBounder stringBounder) { + } + + public Real getMinX(StringBounder stringBounder) { + return origin; + } + + public Real getMaxX(StringBounder stringBounder) { + return origin.addFixed(10); + } + +} diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java index f875d50b7..e448e3d5b 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LifeEventTile.java @@ -89,9 +89,9 @@ public class LifeEventTile implements TileWithUpdateStairs { } public double getPreferredHeight(StringBounder stringBounder) { - if (lifeEvent.isActivate()) { - return 20; - } +// if (lifeEvent.isActivate()) { +// return 20; +// } if (isDestroyWithoutMessage()) { final Component cross = skin.createComponent(ComponentType.DESTROY, null, skinParam, null); final Dimension2D dimCross = cross.getPreferredDimension(stringBounder); diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java index 9de9d4bbf..367a7b015 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/LivingSpace.java @@ -167,7 +167,7 @@ public class LivingSpace { return; } final Component comp = rose.createComponent(headType, null, p.getSkinParamBackcolored(skinParam), - p.getDisplay(false)); + p.getDisplay(skinParam.forceSequenceParticipantUnderlined())); final Dimension2D dim = comp.getPreferredDimension(ug.getStringBounder()); if (horizontalAlignment == HorizontalAlignment.RIGHT) { ug = ug.apply(new UTranslate(-dim.getWidth(), 0)); @@ -187,8 +187,7 @@ public class LivingSpace { } public Dimension2D getHeadPreferredDimension(StringBounder stringBounder) { - // final Component comp = skin.createComponent(headType, null, skinParam, p.getDisplay(false)); - final Component comp = rose.createComponent(headType, null, skinParam, p.getDisplay(false)); + final Component comp = rose.createComponent(headType, null, skinParam, p.getDisplay(skinParam.forceSequenceParticipantUnderlined())); final Dimension2D dim = comp.getPreferredDimension(stringBounder); return dim; } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java index 996c805b6..68d28f939 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/NotesTile.java @@ -56,7 +56,7 @@ import net.sourceforge.plantuml.ugraphic.UTranslate; public class NotesTile implements Tile { - private final List noteLivingSpaces; + private final LivingSpaces livingSpaces; private final Skin skin; private final ISkinParam skinParam; private final Notes notes; @@ -65,15 +65,14 @@ public class NotesTile implements Tile { return notes; } - public NotesTile(List noteLivingSpaces, Notes notes, Skin skin, ISkinParam skinParam) { - this.noteLivingSpaces = noteLivingSpaces; + public NotesTile(LivingSpaces livingSpaces, Notes notes, Skin skin, ISkinParam skinParam) { + this.livingSpaces = livingSpaces; this.notes = notes; this.skin = skin; this.skinParam = skinParam; } - private Component getComponent(StringBounder stringBounder, int i) { - final Note note = notes.get(i); + private Component getComponent(StringBounder stringBounder, Note note) { final Component comp = skin.createComponent(getNoteComponentType(note.getStyle()), null, note.getSkinParamBackcolored(skinParam), note.getStrings()); return comp; @@ -92,45 +91,28 @@ public class NotesTile implements Tile { public void drawU(UGraphic ug) { final StringBounder stringBounder = ug.getStringBounder(); - for (int i = 0; i < noteLivingSpaces.size(); i++) { - final Component comp = getComponent(stringBounder, i); + for (Note note : notes) { + final Component comp = getComponent(stringBounder, note); final Dimension2D dim = comp.getPreferredDimension(stringBounder); - final double x = getX(stringBounder, i).getCurrentValue(); - final Area area = new Area(getUsedWidth(stringBounder, i), dim.getHeight()); + final double x = getX(stringBounder, note).getCurrentValue(); + final Area area = new Area(getUsedWidth(stringBounder, note), dim.getHeight()); final UGraphic ug2 = ug.apply(new UTranslate(x, 0)); comp.drawU(ug2, area, (Context2D) ug2); } - - // final Component comp = getComponent(stringBounder); - // final Dimension2D dim = comp.getPreferredDimension(stringBounder); - // final double x = getX(stringBounder).getCurrentValue(); - // final Area area = new Area(getUsedWidth(stringBounder), dim.getHeight()); - // - // ug = ug.apply(new UTranslate(x, 0)); - // comp.drawU(ug, area, (Context2D) ug); } - private double getUsedWidth(StringBounder stringBounder, int i) { - final Component comp = getComponent(stringBounder, i); + private double getUsedWidth(StringBounder stringBounder, Note note) { + final Component comp = getComponent(stringBounder, note); final Dimension2D dim = comp.getPreferredDimension(stringBounder); final double width = dim.getWidth(); - // if (note.getPosition() == NotePosition.OVER_SEVERAL) { - // final double x1 = livingSpace1.getPosB().getCurrentValue(); - // final double x2 = livingSpace2.getPosD(stringBounder).getCurrentValue(); - // final double w = x2 - x1; - // if (width < w) { - // return w; - // } - // } return width; } - private Real getX(StringBounder stringBounder, int i) { - final Note note = notes.get(i); - final LivingSpace livingSpace1 = noteLivingSpaces.get(i); + private Real getX(StringBounder stringBounder, Note note) { + final LivingSpace livingSpace1 = livingSpaces.get(note.getParticipant()); final NotePosition position = note.getPosition(); - final double width = getUsedWidth(stringBounder, i); + final double width = getUsedWidth(stringBounder, note); if (position == NotePosition.LEFT) { return livingSpace1.getPosC(stringBounder).addFixed(-width); } else if (position == NotePosition.RIGHT) { @@ -138,10 +120,10 @@ public class NotesTile implements Tile { final double dx = level * CommunicationTile.LIVE_DELTA_SIZE; return livingSpace1.getPosC(stringBounder).addFixed(dx); } else if (position == NotePosition.OVER_SEVERAL) { - // final Real x1 = livingSpace1.getPosC(stringBounder); - // final Real x2 = livingSpace2.getPosC(stringBounder); - // return RealUtils.middle(x1, x2).addFixed(-width / 2); - throw new UnsupportedOperationException(position.toString()); + final LivingSpace livingSpace2 = livingSpaces.get(note.getParticipant2()); + final Real x1 = livingSpace1.getPosC(stringBounder); + final Real x2 = livingSpace2.getPosC(stringBounder); + return RealUtils.middle(x1, x2).addFixed(-width / 2); } else if (position == NotePosition.OVER) { return livingSpace1.getPosC(stringBounder).addFixed(-width / 2); } else { @@ -151,8 +133,8 @@ public class NotesTile implements Tile { public double getPreferredHeight(StringBounder stringBounder) { double result = 0; - for (int i = 0; i < noteLivingSpaces.size(); i++) { - final Component comp = getComponent(stringBounder, i); + for (Note note : notes) { + final Component comp = getComponent(stringBounder, note); final Dimension2D dim = comp.getPreferredDimension(stringBounder); result = Math.max(result, dim.getHeight()); } @@ -160,10 +142,11 @@ public class NotesTile implements Tile { } public void addConstraints(StringBounder stringBounder) { - for (int i = 0; i < noteLivingSpaces.size() - 1; i++) { - for (int j = i + 1; j < noteLivingSpaces.size(); j++) { - final Real point1 = getX2(stringBounder, i); - final Real point2 = getX(stringBounder, j); + final List all = notes.asList(); + for (int i = 0; i < all.size() - 1; i++) { + for (int j = i + 1; j < all.size(); j++) { + final Real point1 = getX2(stringBounder, all.get(i)); + final Real point2 = getX(stringBounder, all.get(j)); point2.ensureBiggerThan(point1); } } @@ -171,20 +154,20 @@ public class NotesTile implements Tile { public Real getMinX(StringBounder stringBounder) { final List reals = new ArrayList(); - for (int i = 0; i < noteLivingSpaces.size(); i++) { - reals.add(getX(stringBounder, i)); + for (Note note : notes) { + reals.add(getX(stringBounder, note)); } return RealUtils.min(reals); } - private Real getX2(StringBounder stringBounder, int i) { - return getX(stringBounder, i).addFixed(getUsedWidth(stringBounder, i)); + private Real getX2(StringBounder stringBounder, Note note) { + return getX(stringBounder, note).addFixed(getUsedWidth(stringBounder, note)); } public Real getMaxX(StringBounder stringBounder) { final List reals = new ArrayList(); - for (int i = 0; i < noteLivingSpaces.size(); i++) { - reals.add(getX2(stringBounder, i)); + for (Note note : notes) { + reals.add(getX2(stringBounder, note)); } return RealUtils.max(reals); } diff --git a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java index da809457d..ef972a268 100644 --- a/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java +++ b/src/net/sourceforge/plantuml/sequencediagram/teoz/TileBuilder.java @@ -47,6 +47,7 @@ import net.sourceforge.plantuml.sequencediagram.Event; import net.sourceforge.plantuml.sequencediagram.GroupingLeaf; import net.sourceforge.plantuml.sequencediagram.GroupingStart; import net.sourceforge.plantuml.sequencediagram.GroupingType; +import net.sourceforge.plantuml.sequencediagram.HSpace; import net.sourceforge.plantuml.sequencediagram.LifeEvent; import net.sourceforge.plantuml.sequencediagram.Message; import net.sourceforge.plantuml.sequencediagram.MessageExo; @@ -129,11 +130,7 @@ public class TileBuilder { tiles.add(new NoteTile(livingSpace1, livingSpace2, note, skin, skinParam)); } else if (ev instanceof Notes) { final Notes notes = (Notes) ev; - final List noteLivingSpaces = new ArrayList(); - for (Note n : notes) { - noteLivingSpaces.add(livingSpaces.get(n.getParticipant())); - } - tiles.add(new NotesTile(noteLivingSpaces, notes, skin, skinParam)); + tiles.add(new NotesTile(livingSpaces, notes, skin, skinParam)); } else if (ev instanceof Divider) { final Divider divider = (Divider) ev; tiles.add(new DividerTile(divider, tileArguments)); @@ -153,6 +150,9 @@ public class TileBuilder { } else if (ev instanceof Delay) { final Delay delay = (Delay) ev; tiles.add(new DelayTile(delay, tileArguments)); + } else if (ev instanceof HSpace) { + final HSpace hspace = (HSpace) ev; + tiles.add(new HSpaceTile(hspace, tileArguments)); } else if (ev instanceof LifeEvent) { final LifeEvent lifeEvent = (LifeEvent) ev; final LivingSpace livingSpace = livingSpaces.get(lifeEvent.getParticipant()); diff --git a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java index 38b0cd3aa..91a1f3577 100644 --- a/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java +++ b/src/net/sourceforge/plantuml/skin/rose/ComponentRoseGroupingHeader.java @@ -28,14 +28,13 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 17092 $ + * Revision $Revision: 17431 $ * */ package net.sourceforge.plantuml.skin.rose; import java.awt.geom.Dimension2D; -import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinSimple; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -48,7 +47,6 @@ import net.sourceforge.plantuml.skin.AbstractTextualComponent; import net.sourceforge.plantuml.skin.Area; import net.sourceforge.plantuml.ugraphic.UChangeBackColor; import net.sourceforge.plantuml.ugraphic.UChangeColor; -import net.sourceforge.plantuml.ugraphic.UFont; import net.sourceforge.plantuml.ugraphic.UGraphic; import net.sourceforge.plantuml.ugraphic.UPolygon; import net.sourceforge.plantuml.ugraphic.URectangle; @@ -66,7 +64,7 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { private final SymbolContext symbolContext; public ComponentRoseGroupingHeader(HtmlColor background, SymbolContext symbolContext, FontConfiguration bigFont, - UFont smallFont, Display strings, ISkinSimple spriteContainer, FontParam sequenceGroupHeader) { + FontConfiguration smallFont2, Display strings, ISkinSimple spriteContainer) { super(strings.get(0), bigFont, HorizontalAlignment.LEFT, 15, 30, 1, spriteContainer, 0, null, null); this.symbolContext = symbolContext; this.background = background; @@ -74,17 +72,17 @@ public class ComponentRoseGroupingHeader extends AbstractTextualComponent { this.commentTextBlock = null; } else { final Display display = Display.getWithNewlines("[" + strings.get(1) + "]"); - final FontConfiguration fontConfiguration = bigFont.forceFont(smallFont, null); - // new FontConfiguration(smallFont, bigFont.getColor(), - // bigFont.getHyperlinkColor(), bigFont.useUnderlineForHyperlink()); - this.commentTextBlock = display.create(fontConfiguration, HorizontalAlignment.LEFT, spriteContainer); + // final FontConfiguration smallFont2 = bigFont.forceFont(smallFont, null); + this.commentTextBlock = display.create(smallFont2, HorizontalAlignment.LEFT, spriteContainer); } if (this.background == null) { throw new IllegalArgumentException(); } - } + // new FontConfiguration(smallFont, bigFont.getColor(), bigFont.getHyperlinkColor(), + // bigFont.useUnderlineForHyperlink()); + private double getSuppHeightForComment(StringBounder stringBounder) { if (commentTextBlock == null) { return 0; diff --git a/src/net/sourceforge/plantuml/skin/rose/Rose.java b/src/net/sourceforge/plantuml/skin/rose/Rose.java index e19673269..d58609de5 100644 --- a/src/net/sourceforge/plantuml/skin/rose/Rose.java +++ b/src/net/sourceforge/plantuml/skin/rose/Rose.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 17124 $ + * Revision $Revision: 17432 $ * */ package net.sourceforge.plantuml.skin.rose; @@ -38,6 +38,7 @@ import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; import net.sourceforge.plantuml.LineParam; +import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.FontConfiguration; @@ -186,10 +187,15 @@ public class Rose implements Skin { return new ComponentRoseNoteBox(getSymbolContext(param, ColorParam.noteBorder), getUFont2(param, FontParam.NOTE), stringsToDisplay, param); } + final FontConfiguration bigFont = getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER); if (type == ComponentType.GROUPING_HEADER) { + FontConfiguration smallFont = bigFont.forceFont(fontGrouping, null); + final HtmlColor smallColor = SkinParamUtils.getFontColor(param, FontParam.SEQUENCE_GROUP, null); + if (smallColor != null) { + smallFont = smallFont.changeColor(smallColor); + } return new ComponentRoseGroupingHeader(param.getBackgroundColor(), getSymbolContext(param, - ColorParam.sequenceGroupBorder), getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER), fontGrouping, - stringsToDisplay, param, FontParam.SEQUENCE_GROUP_HEADER); + ColorParam.sequenceGroupBorder), bigFont, smallFont, stringsToDisplay, param); } if (type == ComponentType.GROUPING_ELSE) { return new ComponentRoseGroupingElse(getHtmlColor(param, ColorParam.sequenceGroupBorder), getUFont2(param, @@ -229,9 +235,9 @@ public class Rose implements Skin { } if (type == ComponentType.REFERENCE) { return new ComponentRoseReference(getUFont2(param, FontParam.SEQUENCE_REFERENCE), getSymbolContext(param, - ColorParam.sequenceReferenceBorder), getUFont2(param, FontParam.SEQUENCE_GROUP_HEADER), - stringsToDisplay, param.getHorizontalAlignment(AlignParam.SEQUENCE_REFERENCE_ALIGN), param, - getHtmlColor(param, ColorParam.sequenceReferenceBackground)); + ColorParam.sequenceReferenceBorder), bigFont, stringsToDisplay, + param.getHorizontalAlignment(AlignParam.SEQUENCE_REFERENCE_ALIGN), param, getHtmlColor(param, + ColorParam.sequenceReferenceBackground)); } if (type == ComponentType.TITLE) { return new ComponentRoseTitle(getUFont2(param, FontParam.SEQUENCE_TITLE), stringsToDisplay, param); diff --git a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java index 14aae4ffe..5155335ce 100644 --- a/src/net/sourceforge/plantuml/statediagram/StateDiagram.java +++ b/src/net/sourceforge/plantuml/statediagram/StateDiagram.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 15147 $ + * Revision $Revision: 17451 $ * */ package net.sourceforge.plantuml.statediagram; @@ -42,12 +42,13 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; import net.sourceforge.plantuml.cucadiagram.LeafType; -import net.sourceforge.plantuml.cucadiagram.Rankdir; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.utils.UniqueSequence; public class StateDiagram extends AbstractEntityDiagram { + private static final String CONCURRENT_PREFIX = "CONC"; + public boolean checkConcurrentStateOk(Code code) { if (leafExist(code) == false) { return true; @@ -121,12 +122,12 @@ public class StateDiagram extends AbstractEntityDiagram { super.endGroup(); } getCurrentGroup().setConcurrentSeparator(direction); - final IGroup conc1 = getOrCreateGroup(UniqueSequence.getCode("CONC"), Display.create(""), + final IGroup conc1 = getOrCreateGroup(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""), GroupType.CONCURRENT_STATE, getCurrentGroup()); if (EntityUtils.groupRoot(cur) == false && cur.getGroupType() == GroupType.STATE) { cur.moveEntitiesTo(conc1); super.endGroup(); - getOrCreateGroup(UniqueSequence.getCode("CONC"), Display.create(""), GroupType.CONCURRENT_STATE, + getOrCreateGroup(UniqueSequence.getCode(CONCURRENT_PREFIX), Display.create(""), GroupType.CONCURRENT_STATE, getCurrentGroup()); } // printlink("AFTER"); diff --git a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java index 870c41cdd..1f0fb3e1c 100644 --- a/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java +++ b/src/net/sourceforge/plantuml/svek/GroupPngMakerState.java @@ -40,7 +40,6 @@ import java.util.List; import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.ISkinParam; -import net.sourceforge.plantuml.SkinParamUtils; import net.sourceforge.plantuml.cucadiagram.CucaDiagram; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.EntityUtils; @@ -58,10 +57,8 @@ import net.sourceforge.plantuml.cucadiagram.dot.DotData; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HorizontalAlignment; import net.sourceforge.plantuml.graphic.HtmlColor; -import net.sourceforge.plantuml.graphic.HtmlColorUtils; import net.sourceforge.plantuml.graphic.TextBlock; import net.sourceforge.plantuml.graphic.TextBlockEmpty; -import net.sourceforge.plantuml.graphic.TextBlockUtils; import net.sourceforge.plantuml.graphic.TextBlockWidth; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.skin.rose.Rose; @@ -114,7 +111,7 @@ public final class GroupPngMakerState { new FontConfiguration(skinParam, FontParam.STATE, group.getStereotype()), HorizontalAlignment.CENTER, diagram.getSkinParam()); - if (group.size() == 0) { + if (group.size() == 0 && group.getChildren().size() == 0) { return new EntityImageState(group, diagram.getSkinParam()); } final List links = getPureInnerLinks(); diff --git a/src/net/sourceforge/plantuml/utils/StartUtils.java b/src/net/sourceforge/plantuml/utils/StartUtils.java index 201541d19..2276c4fa6 100644 --- a/src/net/sourceforge/plantuml/utils/StartUtils.java +++ b/src/net/sourceforge/plantuml/utils/StartUtils.java @@ -42,6 +42,10 @@ import net.sourceforge.plantuml.command.regex.MyPattern; public class StartUtils { + public static final String PAUSE_PATTERN = "(?i)((?:\\W|\\<[^<>]*\\>)*)@unpause"; + public static final String START_PATTERN = "(?i)((?:[^\\w~]|\\<[^<>]*\\>)*)@start"; + + public static boolean isArobaseStartDiagram(CharSequence s) { return StringUtils.trinNoTrace(s).startsWith("@start"); } diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index b87273024..a60405b99 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -28,7 +28,7 @@ * * Original Author: Arnaud Roques * - * Revision $Revision: 17343 $ + * Revision $Revision: 17510 $ * */ package net.sourceforge.plantuml.version; @@ -39,7 +39,7 @@ import java.util.Date; public class Version { public static int version() { - return 8031; + return 8032; } public static String versionString() { @@ -63,7 +63,7 @@ public class Version { } private static long compileTime() { - return 1443460759164L; + return 1446389976158L; } public static String compileTimeString() {