From 8f074cfbdf95f69ffb4be1d7a9a1d7ee39274ddd Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Tue, 14 Mar 2023 18:50:51 +0100 Subject: [PATCH] fix: improve note syntax in sequence diagrams https://forum.plantuml.net/17587/notes-linked-to-messages-in-sequence-diagrams --- src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java | 1 + .../sequence/FactorySequenceNoteAcrossCommand.java | 10 +++++++--- .../note/sequence/FactorySequenceNoteCommand.java | 10 +++++++--- .../sequence/FactorySequenceNoteOnArrowCommand.java | 10 +++++++--- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java b/src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java index 952e0099b..b029395da 100644 --- a/src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java +++ b/src/ext/plantuml/com/ctreber/aclib/gui/MOBoolean.java @@ -10,6 +10,7 @@ package ext.plantuml.com.ctreber.aclib.gui; public class MOBoolean extends MonitoredObject { // ::remove folder when __CORE__ + // ::remove folder when __MIT__ private boolean fBoolean; public MOBoolean() diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java index 39bfa6591..ccbbfb5ad 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteAcrossCommand.java @@ -71,10 +71,12 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), // RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), // + new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("ACROSS", "(accross|across)"), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // RegexLeaf.spaceZeroOrMore(), // UrlBuilder.OPTIONAL, // @@ -88,10 +90,12 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), // RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), // + new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("ACROSS", "(accross|across)"), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // RegexLeaf.spaceZeroOrMore(), // UrlBuilder.OPTIONAL, // @@ -157,7 +161,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor final Note note = new Note((Participant) null, (Participant) null, display, diagram.getSkinParam().getCurrentStyleBuilder()); Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet()); - final String stereotypeString = line0.get("STEREO", 0); + final String stereotypeString = line0.getLazzy("STEREO", 0); if (stereotypeString != null) { final Stereotype stereotype = Stereotype.build(stereotypeString); colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), ColorParam.noteBackground, diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java index 52c935812..fb6a746fb 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteCommand.java @@ -75,12 +75,14 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), // RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), // + new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("POSITION", "(right|left|over)"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("PARTICIPANT", "(?:of[%s]+)?([%pLN_.@]+|[%g][^%g]+[%g])"), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // RegexLeaf.spaceZeroOrMore(), // UrlBuilder.OPTIONAL, // @@ -94,12 +96,14 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), // RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), // + new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("POSITION", "(right|left|over)"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("PARTICIPANT", "(?:of[%s])?([%pLN_.@]+|[%g][^%g]+[%g])"), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // color().getRegex(), // RegexLeaf.spaceZeroOrMore(), // UrlBuilder.OPTIONAL, // @@ -157,7 +161,7 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma final Display display = diagram.manageVariable(strings.toDisplay()); final Note note = new Note(p, position, display, diagram.getSkinParam().getCurrentStyleBuilder()); Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); - final String stereotypeString = arg.get("STEREO", 0); + final String stereotypeString = arg.getLazzy("STEREO", 0); if (stereotypeString != null) { final Stereotype stereotype = Stereotype.build(stereotypeString); colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), ColorParam.noteBackground, diff --git a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java index b8a1698bb..9703ea464 100644 --- a/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java +++ b/src/net/sourceforge/plantuml/command/note/sequence/FactorySequenceNoteOnArrowCommand.java @@ -75,10 +75,12 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), // RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), // + new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left|bottom|top)"), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // ColorParser.exp1(), // RegexLeaf.spaceZeroOrMore(), // UrlBuilder.OPTIONAL, // @@ -90,10 +92,12 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STYLE", "(note|hnote|rnote)"), // RegexLeaf.spaceZeroOrMore(), // - new RegexLeaf("STEREO", "(\\<\\<.*\\>\\>)?"), // + new RegexLeaf("STEREO1", "(\\<\\<.*\\>\\>)?"), // RegexLeaf.spaceOneOrMore(), // new RegexLeaf("POSITION", "(right|left|bottom|top)"), // RegexLeaf.spaceZeroOrMore(), // + new RegexLeaf("STEREO2", "(\\<\\<.*\\>\\>)?"), // + RegexLeaf.spaceZeroOrMore(), // ColorParser.exp1(), // RegexLeaf.spaceZeroOrMore(), // UrlBuilder.OPTIONAL, // @@ -152,7 +156,7 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto 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.get("STEREO", 0); + final String stereotypeString = line0.getLazzy("STEREO", 0); if (stereotypeString != null) { final Stereotype stereotype = Stereotype.build(stereotypeString); colors = colors.applyStereotypeForNote(stereotype, diagram.getSkinParam(), ColorParam.noteBackground,