From 86c9c6d6033a1fb5e73e73e626246786c6ef6f18 Mon Sep 17 00:00:00 2001 From: Arnaud Roques Date: Fri, 9 Mar 2018 22:37:34 +0100 Subject: [PATCH] version 1.2018.2 --- pom.xml | 2 +- src/net/sourceforge/plantuml/ColorParam.java | 11 +- src/net/sourceforge/plantuml/ISkinParam.java | 8 + src/net/sourceforge/plantuml/SkinParam.java | 38 +++- .../plantuml/SkinParamDelegator.java | 16 ++ src/net/sourceforge/plantuml/StringUtils.java | 5 +- src/net/sourceforge/plantuml/UmlDiagram.java | 3 + .../activitydiagram/ActivityDiagram.java | 9 +- .../command/CommandLinkActivity.java | 13 +- .../command/CommandLinkLongActivity.java | 4 +- .../command/CommandPartition.java | 6 +- .../plantuml/activitydiagram3/Branch.java | 4 +- .../activitydiagram3/InstructionList.java | 11 +- .../vcompact/FtileFactoryDelegatorWhile.java | 50 ++++- .../ftile/vcompact/FtileWhile.java | 10 + .../vcompact/cond/ConditionalBuilder.java | 16 +- .../plantuml/classdiagram/ClassDiagram.java | 76 +++++--- .../classdiagram/ClassDiagramFactory.java | 8 +- .../command/CommandCreateClass.java | 4 + .../command/CommandCreateClassMultilines.java | 33 +++- .../command/CommandCreateElementFull2.java | 4 + .../command/CommandHideShow2.java | 67 +++++++ .../command/CommandHideShowSpecificClass.java | 35 ++-- .../CommandHideShowSpecificStereotype.java | 9 +- .../command/CommandRemoveRestore.java | 67 +++++++ .../plantuml/command/CommandNamespace.java | 5 +- .../plantuml/command/CommandPackage.java | 11 +- .../plantuml/command/CommandPackageEmpty.java | 9 +- .../command/note/FactoryNoteCommand.java | 8 + .../note/FactoryNoteOnEntityCommand.java | 12 +- .../FactorySequenceNoteOnArrowCommand.java | 6 +- .../command/CommandCreatePackageBlock.java | 4 +- .../sourceforge/plantuml/creole/AtomText.java | 13 +- .../plantuml/creole/CreoleParser.java | 4 +- .../plantuml/creole/StripeTable.java | 20 +- .../plantuml/cucadiagram/BodyEnhanced.java | 2 + .../plantuml/cucadiagram/BodyEnhanced2.java | 7 +- .../plantuml/cucadiagram/Code.java | 54 +----- .../plantuml/cucadiagram/CucaDiagram.java | 182 +++++++++--------- .../plantuml/cucadiagram/Display.java | 17 ++ .../plantuml/cucadiagram/GroupRoot.java | 11 +- .../plantuml/cucadiagram/HideOrShow2.java | 102 ++++++++++ .../plantuml/cucadiagram/IEntity.java | 6 +- .../plantuml/cucadiagram/LinkStyle.java | 24 +-- .../cucadiagram/MethodsOrFieldsArea.java | 3 +- .../plantuml/cucadiagram/Namespace.java | 32 --- .../cucadiagram/NamespaceStrategy.java | 42 ++++ .../plantuml/cucadiagram/Stereotag.java | 77 ++++++++ .../plantuml/cucadiagram/Stereotype.java | 7 +- .../cucadiagram/dot/CucaDiagramTxtMaker.java | 78 +++++--- .../cucadiagram/entity/EntityFactory.java | 47 +++-- .../cucadiagram/entity/EntityImpl.java | 83 +++++--- .../DescriptionDiagramFactory.java | 6 +- .../CommandCreateElementMultilines.java | 5 +- .../command/CommandPackageWithUSymbol.java | 11 +- .../plantuml/donors/PSystemDonors.java | 26 +-- .../sourceforge/plantuml/fun/IconLoader.java | 2 +- .../sourceforge/plantuml/fun/sprite000.png | Bin 223 -> 116 bytes .../sourceforge/plantuml/fun/sprite001.png | Bin 229 -> 134 bytes .../sourceforge/plantuml/fun/sprite002.png | Bin 227 -> 108 bytes .../sourceforge/plantuml/fun/sprite003.png | Bin 309 -> 193 bytes .../sourceforge/plantuml/fun/sprite004.png | Bin 236 -> 150 bytes .../sourceforge/plantuml/fun/sprite005.png | Bin 216 -> 126 bytes .../sourceforge/plantuml/fun/sprite006.png | Bin 249 -> 141 bytes .../sourceforge/plantuml/fun/sprite007.png | Bin 338 -> 161 bytes .../sourceforge/plantuml/fun/sprite008.png | Bin 534 -> 181 bytes .../sourceforge/plantuml/fun/sprite009.png | Bin 223 -> 124 bytes .../sourceforge/plantuml/fun/sprite010.png | Bin 240 -> 133 bytes .../sourceforge/plantuml/fun/sprite011.png | Bin 285 -> 160 bytes .../sourceforge/plantuml/fun/sprite012.png | Bin 3112 -> 802 bytes .../sourceforge/plantuml/fun/sprite013.png | Bin 323 -> 160 bytes .../sourceforge/plantuml/fun/sprite014.png | Bin 263 -> 136 bytes .../sourceforge/plantuml/fun/sprite015.png | Bin 245 -> 122 bytes .../sourceforge/plantuml/fun/sprite016.png | Bin 252 -> 134 bytes .../sourceforge/plantuml/fun/sprite017.png | Bin 226 -> 128 bytes .../sourceforge/plantuml/fun/sprite018.png | Bin 272 -> 164 bytes .../sourceforge/plantuml/fun/sprite019.png | Bin 457 -> 199 bytes .../sourceforge/plantuml/fun/sprite020.png | Bin 261 -> 143 bytes .../sourceforge/plantuml/fun/sprite021.png | Bin 0 -> 2040 bytes .../sourceforge/plantuml/fun/sprite022.png | Bin 0 -> 360 bytes .../sourceforge/plantuml/fun/sprite023.png | Bin 0 -> 770 bytes .../sourceforge/plantuml/fun/sprite024.png | Bin 0 -> 1472 bytes .../plantuml/graphic/HtmlColorAutomatic.java | 39 ++++ .../plantuml/graphic/HtmlColorSetSimple.java | 5 + .../plantuml/graphic/QuoteUtils.java | 5 +- .../plantuml/graphic/TextBlockBordered.java | 18 +- .../plantuml/mda/MDADiagramImpl.java | 2 +- .../sourceforge/plantuml/posimo/DotPath.java | 45 ++--- .../plantuml/posimo/GraphvizSolverB.java | 41 ++-- .../plantuml/project/PSystemProject.java | 2 +- .../plantuml/project2/PSystemProject2.java | 2 +- .../plantuml/sequencediagram/AutoNumber.java | 11 +- .../sequencediagram/SequenceDiagram.java | 3 + .../sequencediagram/command/CommandArrow.java | 8 +- .../skin/AbstractTextualComponent.java | 14 +- .../skin/rose/ComponentRoseArrow.java | 109 ++++++----- .../sourceforge/plantuml/skin/rose/Rose.java | 2 +- .../plantuml/statediagram/StateDiagram.java | 15 +- .../statediagram/StateDiagramFactory.java | 7 +- .../command/CommandCreatePackageState.java | 19 +- .../sourceforge/plantuml/svek/Cluster.java | 3 + ...ucaDiagramFileMakerSvek2InternalImage.java | 11 +- .../plantuml/svek/DotDataImageBuilder.java | 12 +- .../plantuml/svek/DotStringFactory.java | 24 ++- .../plantuml/svek/GroupPngMakerState.java | 2 +- src/net/sourceforge/plantuml/svek/Line.java | 32 +-- .../plantuml/svek/Point2DFunction.java | 44 +++++ .../plantuml/svek/PointListIterator.java | 46 +++++ .../plantuml/svek/PointListIteratorImpl.java | 90 +++++++++ .../sourceforge/plantuml/svek/SvekUtils.java | 111 ----------- .../sourceforge/plantuml/svek/SvgResult.java | 135 +++++++++++++ src/net/sourceforge/plantuml/svek/YDelta.java | 59 ++++++ .../plantuml/svek/image/EntityImageClass.java | 9 +- .../svek/image/EntityImageClassHeader2.java | 98 +++++++--- .../plantuml/svek/image/EntityImageNote.java | 2 +- .../plantuml/svek/image/EntityImageTips.java | 6 +- .../plantuml/svek/image/Footprint.java | 8 + .../sourceforge/plantuml/svg/SvgGraphics.java | 21 +- .../plantuml/timingdiagram/Ribbon.java | 8 +- .../plantuml/timingdiagram/TimingRuler.java | 3 + .../plantuml/ugraphic/FontChecker.java | 2 +- .../plantuml/ugraphic/ImageBuilder.java | 18 +- .../plantuml/ugraphic/UGraphicUtils.java | 2 +- .../plantuml/ugraphic/svg/UGraphicSvg.java | 20 +- .../sourceforge/plantuml/version/License.java | 1 + .../sourceforge/plantuml/version/Version.java | 4 +- stdlib/aws-dat.repx | Bin 584011 -> 584091 bytes stdlib/aws-idx.repx | Bin 78218 -> 78218 bytes stdlib/home.repx | 2 +- 129 files changed, 1784 insertions(+), 761 deletions(-) create mode 100644 src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java create mode 100644 src/net/sourceforge/plantuml/classdiagram/command/CommandRemoveRestore.java create mode 100644 src/net/sourceforge/plantuml/cucadiagram/HideOrShow2.java create mode 100644 src/net/sourceforge/plantuml/cucadiagram/NamespaceStrategy.java create mode 100644 src/net/sourceforge/plantuml/cucadiagram/Stereotag.java create mode 100644 src/net/sourceforge/plantuml/fun/sprite021.png create mode 100644 src/net/sourceforge/plantuml/fun/sprite022.png create mode 100644 src/net/sourceforge/plantuml/fun/sprite023.png create mode 100644 src/net/sourceforge/plantuml/fun/sprite024.png create mode 100644 src/net/sourceforge/plantuml/graphic/HtmlColorAutomatic.java create mode 100644 src/net/sourceforge/plantuml/svek/Point2DFunction.java create mode 100644 src/net/sourceforge/plantuml/svek/PointListIterator.java create mode 100644 src/net/sourceforge/plantuml/svek/PointListIteratorImpl.java create mode 100644 src/net/sourceforge/plantuml/svek/SvgResult.java create mode 100644 src/net/sourceforge/plantuml/svek/YDelta.java diff --git a/pom.xml b/pom.xml index 21cc5a6ca..70f8eeec3 100644 --- a/pom.xml +++ b/pom.xml @@ -35,7 +35,7 @@ net.sourceforge.plantuml plantuml - 1.2018.2-SNAPSHOT + 1.2018.3-SNAPSHOT jar PlantUML diff --git a/src/net/sourceforge/plantuml/ColorParam.java b/src/net/sourceforge/plantuml/ColorParam.java index 8913c3d16..608ff72f1 100644 --- a/src/net/sourceforge/plantuml/ColorParam.java +++ b/src/net/sourceforge/plantuml/ColorParam.java @@ -51,16 +51,13 @@ public enum ColorParam { activityStart(HtmlColorUtils.BLACK), activityEnd(HtmlColorUtils.BLACK), activityBar(HtmlColorUtils.BLACK), - // activityArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), swimlaneBorder(HtmlColorUtils.BLACK), usecaseBorder(HtmlColorUtils.MY_RED, ColorType.LINE), usecaseBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), - // usecaseArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), objectBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), objectBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - // objectArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), classHeaderBackground(null, true, ColorType.BACK), classBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), @@ -70,7 +67,11 @@ public enum ColorParam { stereotypeABackground(HtmlColorUtils.COL_A9DCDF), stereotypeIBackground(HtmlColorUtils.COL_B4A7E5), stereotypeEBackground(HtmlColorUtils.COL_EB937F), - // classArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), + stereotypeCBorder(null), + stereotypeNBorder(null), + stereotypeABorder(null), + stereotypeIBorder(null), + stereotypeEBorder(null), packageBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), packageBorder(HtmlColorUtils.BLACK, ColorType.LINE), @@ -86,7 +87,6 @@ public enum ColorParam { stateBackground(HtmlColorUtils.MY_YELLOW, true, ColorType.BACK), stateBorder(HtmlColorUtils.MY_RED, ColorType.LINE), - // stateArrow(HtmlColorUtils.MY_RED, ColorType.ARROW), stateStart(HtmlColorUtils.BLACK), stateEnd(HtmlColorUtils.BLACK), @@ -116,7 +116,6 @@ public enum ColorParam { sequenceLifeLineBackground(HtmlColorUtils.WHITE, true, ColorType.BACK), sequenceLifeLineBorder(HtmlColorUtils.MY_RED, ColorType.LINE), sequenceNewpageSeparator(HtmlColorUtils.BLACK, ColorType.LINE), - // sequenceArrow(HtmlColorUtils.MY_RED), sequenceBoxBorder(HtmlColorUtils.MY_RED, ColorType.LINE), sequenceBoxBackground(HtmlColorUtils.COL_DDDDDD, true, ColorType.BACK), diff --git a/src/net/sourceforge/plantuml/ISkinParam.java b/src/net/sourceforge/plantuml/ISkinParam.java index 3ed1e0116..f463186c1 100644 --- a/src/net/sourceforge/plantuml/ISkinParam.java +++ b/src/net/sourceforge/plantuml/ISkinParam.java @@ -73,6 +73,8 @@ public interface ISkinParam extends ISkinSimple { public int getCircledCharacterRadius(); + public char getCircledCharacter(Stereotype stereotype); + public int classAttributeIconSize(); public ColorMapper getColorMapper(); @@ -103,6 +105,8 @@ public interface ISkinParam extends ISkinSimple { public LineBreakStrategy maxMessageSize(); + public LineBreakStrategy wrapWidth(); + public boolean strictUmlStyle(); public boolean forceSequenceParticipantUnderlined(); @@ -147,4 +151,8 @@ public interface ISkinParam extends ISkinSimple { public boolean displayGenericWithOldFashion(); + public boolean responseMessageBelowArrow(); + + public boolean svgDimensionStyle(); + } \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/SkinParam.java b/src/net/sourceforge/plantuml/SkinParam.java index 81691d0d6..d53b9a266 100644 --- a/src/net/sourceforge/plantuml/SkinParam.java +++ b/src/net/sourceforge/plantuml/SkinParam.java @@ -216,6 +216,17 @@ public class SkinParam implements ISkinParam { return getIHtmlColorSet().getColorIfValid(value, acceptTransparent); } + public char getCircledCharacter(Stereotype stereotype) { + if (stereotype == null) { + throw new IllegalArgumentException(); + } + final String value2 = getValue("spotchar" + stereotype.getLabel(false)); + if (value2 != null && value2.length() > 0) { + return value2.charAt(0); + } + return 0; + } + public Colors getColors(ColorParam param, Stereotype stereotype) { if (stereotype != null) { checkStereotype(stereotype); @@ -707,7 +718,16 @@ public class SkinParam implements ISkinParam { } public LineBreakStrategy maxMessageSize() { - return new LineBreakStrategy(getValue("maxmessagesize")); + String value = getValue("wrapmessagewidth"); + if (value == null) { + value = getValue("maxmessagesize"); + } + return new LineBreakStrategy(value); + } + + public LineBreakStrategy wrapWidth() { + final String value = getValue("wrapwidth"); + return new LineBreakStrategy(value); } public boolean strictUmlStyle() { @@ -920,9 +940,25 @@ public class SkinParam implements ISkinParam { return false; } + public boolean responseMessageBelowArrow() { + final String value = getValue("responsemessagebelowarrow"); + if ("true".equalsIgnoreCase(value)) { + return true; + } + return false; + } + public TikzFontDistortion getTikzFontDistortion() { final String value = getValue("tikzFont"); return TikzFontDistortion.fromValue(value); } + public boolean svgDimensionStyle() { + final String value = getValue("svgdimensionstyle"); + if ("false".equalsIgnoreCase(value)) { + return false; + } + return true; + } + } diff --git a/src/net/sourceforge/plantuml/SkinParamDelegator.java b/src/net/sourceforge/plantuml/SkinParamDelegator.java index 63ef4ef36..dd8dc85d7 100644 --- a/src/net/sourceforge/plantuml/SkinParamDelegator.java +++ b/src/net/sourceforge/plantuml/SkinParamDelegator.java @@ -159,6 +159,10 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.maxMessageSize(); } + public LineBreakStrategy wrapWidth() { + return skinParam.wrapWidth(); + } + public boolean strictUmlStyle() { return skinParam.strictUmlStyle(); } @@ -275,4 +279,16 @@ public class SkinParamDelegator implements ISkinParam { return skinParam.getTikzFontDistortion(); } + public boolean responseMessageBelowArrow() { + return skinParam.responseMessageBelowArrow(); + } + + public boolean svgDimensionStyle() { + return skinParam.svgDimensionStyle(); + } + + public char getCircledCharacter(Stereotype stereotype) { + return skinParam.getCircledCharacter(stereotype); + } + } diff --git a/src/net/sourceforge/plantuml/StringUtils.java b/src/net/sourceforge/plantuml/StringUtils.java index 374beedeb..bacf7df44 100644 --- a/src/net/sourceforge/plantuml/StringUtils.java +++ b/src/net/sourceforge/plantuml/StringUtils.java @@ -298,8 +298,11 @@ public class StringUtils { public static int getWcWidth(Display stringsToDisplay) { int result = 1; for (CharSequence s : stringsToDisplay) { + if (s == null) { + continue; + } final int length = Wcwidth.length(s); - if (s != null && result < length) { + if (result < length) { result = length; } } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index efabd6823..fd1a6f776 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -103,6 +103,9 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann private final SkinParam skinParam = SkinParam.create(getUmlDiagramType()); final public void setTitle(DisplayPositionned title) { + if (DisplayPositionned.isNull(title) || title.getDisplay().isWhite()) { + return; + } this.title = title; } diff --git a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java index 77d86f0d8..693ce5c2d 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java +++ b/src/net/sourceforge/plantuml/activitydiagram/ActivityDiagram.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.graphic.USymbol; import net.sourceforge.plantuml.utils.UniqueSequence; @@ -154,8 +155,9 @@ public class ActivityDiagram extends CucaDiagram { public IEntity createInnerActivity() { // Log.println("createInnerActivity A"); final Code code = Code.of("##" + UniqueSequence.getValue()); - final IEntity g = getOrCreateGroup(code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, - getCurrentGroup()); + gotoGroup2(code, Display.getWithNewlines(code), GroupType.INNER_ACTIVITY, getCurrentGroup(), + NamespaceStrategy.SINGLE); + final IEntity g = getCurrentGroup(); // g.setRankdir(Rankdir.LEFT_TO_RIGHT); lastEntityConsulted = null; lastEntityBrancheConsulted = null; @@ -175,7 +177,8 @@ public class ActivityDiagram extends CucaDiagram { if (getCurrentGroup().getGroupType() != GroupType.INNER_ACTIVITY) { throw new IllegalStateException("type=" + getCurrentGroup().getGroupType()); } - getOrCreateGroup(code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup()); + gotoGroup2(code, Display.getWithNewlines("code"), GroupType.CONCURRENT_ACTIVITY, getCurrentGroup(), + NamespaceStrategy.SINGLE); lastEntityConsulted = null; lastEntityBrancheConsulted = null; } diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java index d9f08dd0f..82d0de299 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkActivity.java @@ -58,6 +58,7 @@ import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; +import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.graphic.color.ColorParser; @@ -197,8 +198,8 @@ public class CommandLinkActivity extends SingleLineCommand2 { final Code code = Code.of(arg.get("CODE" + suf, 0)); if (code != null) { if (partition != null) { - system.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, - system.getRootGroup()); + system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, + system.getRootGroup(), NamespaceStrategy.SINGLE); } final IEntity result = system.getOrCreate(code, Display.getWithNewlines(code), CommandLinkActivity.getTypeIfExisting(system, code)); @@ -215,8 +216,8 @@ public class CommandLinkActivity extends SingleLineCommand2 { if (quoted.get(0) != null) { final Code quotedCode = Code.of(quoted.get(1) == null ? quoted.get(0) : quoted.get(1)); if (partition != null) { - system.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, - system.getRootGroup()); + system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, + system.getRootGroup(), NamespaceStrategy.SINGLE); } final IEntity result = system.getOrCreate(quotedCode, Display.getWithNewlines(quoted.get(0)), CommandLinkActivity.getTypeIfExisting(system, quotedCode)); @@ -228,8 +229,8 @@ public class CommandLinkActivity extends SingleLineCommand2 { final Code quotedInvisible = Code.of(arg.get("QUOTED_INVISIBLE" + suf, 0)); if (quotedInvisible != null) { if (partition != null) { - system.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, - system.getRootGroup()); + system.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, + system.getRootGroup(), NamespaceStrategy.SINGLE); } final IEntity result = system.getOrCreate(quotedInvisible, Display.getWithNewlines(quotedInvisible), LeafType.ACTIVITY); diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java index 5720fd53f..99df5ef68 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandLinkLongActivity.java @@ -63,6 +63,7 @@ import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; +import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; import net.sourceforge.plantuml.graphic.color.ColorType; @@ -164,7 +165,8 @@ public class CommandLinkLongActivity extends CommandMultilines2 partition = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(partition); } if (partition != null) { - diagram.getOrCreateGroup(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null); + diagram.gotoGroup2(Code.of(partition), Display.getWithNewlines(partition), GroupType.PACKAGE, null, + NamespaceStrategy.SINGLE); } final IEntity entity2 = diagram.createLeaf(code, Display.getWithNewlines(display), LeafType.ACTIVITY, null); if (partition != null) { diff --git a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java index 7e91fa39d..b43be2c00 100644 --- a/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java +++ b/src/net/sourceforge/plantuml/activitydiagram/command/CommandPartition.java @@ -48,6 +48,7 @@ import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.GroupType; import net.sourceforge.plantuml.cucadiagram.IEntity; import net.sourceforge.plantuml.cucadiagram.IGroup; +import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy; import net.sourceforge.plantuml.graphic.color.ColorParser; import net.sourceforge.plantuml.graphic.color.ColorType; import net.sourceforge.plantuml.graphic.color.Colors; @@ -79,8 +80,9 @@ public class CommandPartition extends SingleLineCommand2 { protected CommandExecutionResult executeArg(ActivityDiagram diagram, RegexResult arg) { final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0))); final IGroup currentPackage = diagram.getCurrentGroup(); - final IEntity p = diagram.getOrCreateGroup(code, Display.getWithNewlines(code), GroupType.PACKAGE, - currentPackage); + diagram.gotoGroup2(code, Display.getWithNewlines(code), GroupType.PACKAGE, currentPackage, + NamespaceStrategy.SINGLE); + final IEntity p = diagram.getCurrentGroup(); final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); if (colors.isEmpty() == false) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java index 90263ab3a..87c6dd2f7 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/Branch.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/Branch.java @@ -149,8 +149,8 @@ public class Branch { return list.getLast(); } - public boolean isOnlySingleStop() { - return list.isOnlySingleStop(); + public boolean isOnlySingleStopOrSpot() { + return list.isOnlySingleStopOrSpot(); } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java index 7e1df560c..7c1add042 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionList.java @@ -65,9 +65,14 @@ public class InstructionList extends WithNote implements Instruction, Instructio return all.isEmpty(); } - public boolean isOnlySingleStop() { - return all.size() == 1 && getLast() instanceof InstructionStop - && ((InstructionStop) getLast()).hasNotes() == false; + public boolean isOnlySingleStopOrSpot() { + if (all.size() != 1) { + return false; + } + if (getLast() instanceof InstructionSpot) { + return true; + } + return getLast() instanceof InstructionStop && ((InstructionStop) getLast()).hasNotes() == false; } public InstructionList(Swimlane defaultSwimlane) { diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java index d29467d2e..e77f635fb 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileFactoryDelegatorWhile.java @@ -35,20 +35,33 @@ */ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; +import java.awt.geom.Dimension2D; +import java.util.List; + import net.sourceforge.plantuml.ColorParam; import net.sourceforge.plantuml.FontParam; import net.sourceforge.plantuml.activitydiagram3.Instruction; import net.sourceforge.plantuml.activitydiagram3.LinkRendering; +import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows; +import net.sourceforge.plantuml.activitydiagram3.ftile.Connection; +import net.sourceforge.plantuml.activitydiagram3.ftile.Diamond; import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileBreak; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactory; import net.sourceforge.plantuml.activitydiagram3.ftile.FtileFactoryDelegator; +import net.sourceforge.plantuml.activitydiagram3.ftile.FtileUtils; +import net.sourceforge.plantuml.activitydiagram3.ftile.Genealogy; +import net.sourceforge.plantuml.activitydiagram3.ftile.Snake; import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane; +import net.sourceforge.plantuml.activitydiagram3.ftile.WeldingPoint; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.graphic.FontConfiguration; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.HtmlColorAndStyle; import net.sourceforge.plantuml.graphic.Rainbow; import net.sourceforge.plantuml.svek.ConditionStyle; +import net.sourceforge.plantuml.ugraphic.UGraphic; +import net.sourceforge.plantuml.ugraphic.UTranslate; public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { @@ -60,8 +73,8 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { public Ftile createWhile(Swimlane swimlane, Ftile whileBlock, Display test, Display yes, Display out, LinkRendering afterEndwhile, HtmlColor color, Instruction specialOut) { final HtmlColor borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder); - final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground) - : color; + final HtmlColor backColor = color == null ? getRose().getHtmlColor(skinParam(), + ColorParam.activityDiamondBackground) : color; final Rainbow arrowColor = HtmlColorAndStyle.build(skinParam()); final ConditionStyle conditionStyle = skinParam().getConditionStyle(); @@ -75,8 +88,39 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator { final FontConfiguration fontArrow = new FontConfiguration(skinParam(), FontParam.ARROW, null); - return FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out, + Ftile result = FtileWhile.create(swimlane, whileBlock, test, borderColor, backColor, arrowColor, yes, out, endInlinkColor, afterEndwhile, fontArrow, getFactory(), conditionStyle, fcTest, specialOut); + + final List weldingPoints = whileBlock.getWeldingPoints(); + if (weldingPoints.size() > 0) { + // printAllChild(repeat); + + final Genealogy genealogy = new Genealogy(result); + + final FtileBreak ftileBreak = (FtileBreak) weldingPoints.get(0); + + result = FtileUtils.addConnection(result, new Connection() { + public void drawU(UGraphic ug) { + final UTranslate tr1 = genealogy.getTranslate(ftileBreak, ug.getStringBounder()); + + final Snake snake = new Snake(getFtile1().arrowHorizontalAlignment(), arrowColor, Arrows.asToLeft()); + snake.addPoint(tr1.getDx(), tr1.getDy()); + snake.addPoint(Diamond.diamondHalfSize, tr1.getDy()); + ug.draw(snake); + } + + public Ftile getFtile1() { + return ftileBreak; + } + + public Ftile getFtile2() { + return null; + } + + }); + } + + return result; } } diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java index 4f47eb80c..93f59ec48 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/FtileWhile.java @@ -38,6 +38,8 @@ package net.sourceforge.plantuml.activitydiagram3.ftile.vcompact; import java.awt.geom.Dimension2D; import java.awt.geom.Point2D; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -81,6 +83,14 @@ class FtileWhile extends AbstractFtile { private final Ftile diamond1; private final Ftile specialOut; + @Override + public Collection getMyChildren() { + if (specialOut == null) { + return Arrays.asList(whileBlock, diamond1); + } + return Arrays.asList(whileBlock, diamond1, specialOut); + } + public Set getSwimlanes() { final Set result = new HashSet(whileBlock.getSwimlanes()); result.add(getSwimlaneIn()); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java index 04ebdbb84..280819394 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/ftile/vcompact/cond/ConditionalBuilder.java @@ -108,16 +108,16 @@ public class ConditionalBuilder { ISkinParam skinParam, StringBounder stringBounder, FontConfiguration fcArrow, FontConfiguration fcTest) { final ConditionalBuilder builder = new ConditionalBuilder(swimlane, borderColor, backColor, arrowColor, ftileFactory, conditionStyle, branch1, branch2, skinParam, stringBounder, fcArrow, fcTest); - if (isEmptyOrOnlySingleStop(branch2) && isEmptyOrOnlySingleStop(branch1) == false) { + if (isEmptyOrOnlySingleStopOrSpot(branch2) && isEmptyOrOnlySingleStopOrSpot(branch1) == false) { return builder.createDown(builder.branch1, builder.branch2); } - if (branch1.isEmpty() && branch2.isOnlySingleStop()) { + if (branch1.isEmpty() && branch2.isOnlySingleStopOrSpot()) { return builder.createDown(builder.branch1, builder.branch2); } - if (isEmptyOrOnlySingleStop(branch1) && isEmptyOrOnlySingleStop(branch2) == false) { + if (isEmptyOrOnlySingleStopOrSpot(branch1) && isEmptyOrOnlySingleStopOrSpot(branch2) == false) { return builder.createDown(builder.branch2, builder.branch1); } - if (branch2.isEmpty() && branch1.isOnlySingleStop()) { + if (branch2.isEmpty() && branch1.isOnlySingleStopOrSpot()) { return builder.createDown(builder.branch2, builder.branch1); } return builder.createWithLinks(); @@ -125,8 +125,8 @@ public class ConditionalBuilder { // return builder.createNude(); } - private static boolean isEmptyOrOnlySingleStop(Branch branch) { - return branch.isEmpty() || branch.isOnlySingleStop(); + private static boolean isEmptyOrOnlySingleStopOrSpot(Branch branch) { + return branch.isEmpty() || branch.isOnlySingleStopOrSpot(); } private Ftile createDown(Branch branch1, Branch branch2) { @@ -136,11 +136,11 @@ public class ConditionalBuilder { final TextBlock tb2 = getLabelPositive(branch2); final Ftile diamond1 = getDiamond1(false, tb1, tb2); final Ftile diamond2 = getDiamond2(branch1, branch2, true); - if (branch2.isOnlySingleStop()) { + if (branch2.isOnlySingleStopOrSpot()) { return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile1, 10), arrowColor, ftileFactory, branch2.getFtile(), branch2.getInlinkRenderingColorAndStyle()); } - if (branch1.isOnlySingleStop()) { + if (branch1.isOnlySingleStopOrSpot()) { return FtileIfDown.create(diamond1, diamond2, swimlane, FtileUtils.addHorizontalMargin(tile2, 10), arrowColor, ftileFactory, branch1.getFtile(), branch1.getInlinkRenderingColorAndStyle()); } diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java index 225f64330..6200a7529 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagram.java @@ -58,6 +58,38 @@ import net.sourceforge.plantuml.ugraphic.ImageBuilder; public class ClassDiagram extends AbstractClassOrObjectDiagram { + private final String getNamespace(Code fullyCode) { + return getNamespace(fullyCode, fullyCode.getSeparator()); + } + + private final String getNamespace(Code fullyCode, String separator) { + String name = fullyCode.getFullName(); + if (separator == null) { + throw new IllegalArgumentException(toString()); + } + do { + final int x = name.lastIndexOf(separator); + if (x == -1) { + return null; + } + name = name.substring(0, x); + } while (entityFactory.getLeafsget(Code.of(name, separator)) != null); + return name; + } + + public final Code getShortName(Code code) { + final String separator = code.getSeparator(); + if (separator == null) { + throw new IllegalArgumentException(); + } + final String codeString = code.getFullName(); + final String namespace = getNamespace(code); + if (namespace == null) { + return Code.of(codeString, separator); + } + return Code.of(codeString.substring(namespace.length() + separator.length()), separator); + } + @Override public ILeaf getOrCreateLeaf(Code code, LeafType type, USymbol symbol) { if (getNamespaceSeparator() != null) { @@ -68,24 +100,22 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { if (getNamespaceSeparator() == null) { return getOrCreateLeafDefault(code, LeafType.CLASS, symbol); } - code = code.getFullyQualifiedCode(getCurrentGroup()); + code = getFullyQualifiedCode(code); if (super.leafExist(code)) { return getOrCreateLeafDefault(code, LeafType.CLASS, symbol); } - return createEntityWithNamespace(code, Display.getWithNewlines(code.getShortName(getLeafs())), - LeafType.CLASS, symbol); + return createEntityWithNamespace(code, Display.getWithNewlines(getShortName(code)), LeafType.CLASS, symbol); } if (getNamespaceSeparator() == null) { return getOrCreateLeafDefault(code, LeafType.CLASS, symbol); } - code = code.getFullyQualifiedCode(getCurrentGroup()); + code = getFullyQualifiedCode(code); if (super.leafExist(code)) { return getOrCreateLeafDefault(code, type, symbol); } - return createEntityWithNamespace(code, Display.getWithNewlines(code.getShortName(getLeafs())), type, symbol); + return createEntityWithNamespace(code, Display.getWithNewlines(getShortName(code)), type, symbol); } - @Override public ILeaf createLeaf(Code code, Display display, LeafType type, USymbol symbol) { if (getNamespaceSeparator() != null) { @@ -99,7 +129,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { if (getNamespaceSeparator() == null) { return super.createLeaf(code, display, type, symbol); } - code = code.getFullyQualifiedCode(getCurrentGroup()); + code = getFullyQualifiedCode(code); if (super.leafExist(code)) { throw new IllegalArgumentException("Already known: " + code); } @@ -107,30 +137,20 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { } private ILeaf createEntityWithNamespace(Code fullyCode, Display display, LeafType type, USymbol symbol) { - IGroup group = getCurrentGroup(); - final String namespace = getNamespace(fullyCode); + final IGroup backupCurrentGroup = getCurrentGroup(); + final IGroup group = backupCurrentGroup; + final String namespace = getNamespace(fullyCode, getNamespaceSeparator()); if (namespace != null && (EntityUtils.groupRoot(group) || group.getCode().getFullName().equals(namespace) == false)) { final Code namespace2 = Code.of(namespace); - group = getOrCreateNamespaceInternal(namespace2, Display.getWithNewlines(namespace), GroupType.PACKAGE, - getRootGroup()); + gotoGroupInternal(namespace2, Display.getWithNewlines(namespace), namespace2, GroupType.PACKAGE, getRootGroup()); } - return createLeafInternal( + final ILeaf result = createLeafInternal( fullyCode, - Display.isNull(display) ? Display.getWithNewlines(fullyCode.getShortName(getLeafs())).withCreoleMode( - CreoleMode.SIMPLE_LINE) : display, type, group, symbol); - } - - private final String getNamespace(Code fullyCode) { - String name = fullyCode.getFullName(); - do { - final int x = name.lastIndexOf(getNamespaceSeparator()); - if (x == -1) { - return null; - } - name = name.substring(0, x); - } while (getLeafs().containsKey(Code.of(name, getNamespaceSeparator()))); - return name; + Display.isNull(display) ? Display.getWithNewlines(getShortName(fullyCode)).withCreoleMode( + CreoleMode.SIMPLE_LINE) : display, type, symbol); + gotoThisGroup(backupCurrentGroup); + return result; } @Override @@ -139,7 +159,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { return super.leafExist(code); } code = code.withSeparator(getNamespaceSeparator()); - return super.leafExist(code.getFullyQualifiedCode(getCurrentGroup())); + return super.leafExist(getFullyQualifiedCode(code)); } @Override @@ -187,7 +207,7 @@ public class ClassDiagram extends AbstractClassOrObjectDiagram { private RowLayout getRawLayout(int raw) { final RowLayout rawLayout = new RowLayout(); - for (ILeaf leaf : getLeafs().values()) { + for (ILeaf leaf : entityFactory.getLeafsvalues()) { if (leaf.getRawLayout() == raw) { rawLayout.addLeaf(getEntityImageClass(leaf)); } diff --git a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java index 2562ba38e..213b499df 100644 --- a/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java +++ b/src/net/sourceforge/plantuml/classdiagram/ClassDiagramFactory.java @@ -46,6 +46,7 @@ import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultiline import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2; import net.sourceforge.plantuml.classdiagram.command.CommandCreateElementFull2.Mode; import net.sourceforge.plantuml.classdiagram.command.CommandDiamondAssociation; +import net.sourceforge.plantuml.classdiagram.command.CommandHideShow2; import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificClass; import net.sourceforge.plantuml.classdiagram.command.CommandHideShowSpecificStereotype; import net.sourceforge.plantuml.classdiagram.command.CommandImport; @@ -53,6 +54,7 @@ import net.sourceforge.plantuml.classdiagram.command.CommandLayoutNewLine; import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass; import net.sourceforge.plantuml.classdiagram.command.CommandLinkLollipop; import net.sourceforge.plantuml.classdiagram.command.CommandNamespaceSeparator; +import net.sourceforge.plantuml.classdiagram.command.CommandRemoveRestore; import net.sourceforge.plantuml.classdiagram.command.CommandStereotype; import net.sourceforge.plantuml.classdiagram.command.CommandUrl; import net.sourceforge.plantuml.command.Command; @@ -91,10 +93,12 @@ public class ClassDiagramFactory extends UmlDiagramFactory { cmds.add(new CommandRankDir()); cmds.add(new CommandNewpage(this)); - cmds.add(new CommandHideShowSpecificStereotype()); +// cmds.add(new CommandHideShowSpecificStereotype()); cmds.add(new CommandPage()); cmds.add(new CommandAddMethod()); + cmds.add(new CommandHideShow2()); + cmds.add(new CommandRemoveRestore()); cmds.add(new CommandCreateClass()); cmds.add(new CommandCreateEntityObject()); @@ -142,7 +146,7 @@ public class ClassDiagramFactory extends UmlDiagramFactory { cmds.add(new CommandDiamondAssociation()); - cmds.add(new CommandHideShowSpecificClass()); +// cmds.add(new CommandHideShowSpecificClass()); cmds.add(new CommandNamespaceSeparator()); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java index 4e4f20db0..d04755840 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.cucadiagram.Code; import net.sourceforge.plantuml.cucadiagram.Display; import net.sourceforge.plantuml.cucadiagram.ILeaf; import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; @@ -90,6 +91,8 @@ public class CommandCreateClass extends SingleLineCommand2 { new RegexLeaf("[%s]*"), // new RegexLeaf("STEREO", "(\\<{2}.*\\>{2})?"), // new RegexLeaf("[%s]*"), // + new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // + new RegexLeaf("[%s]*"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("[%s]*"), // color().getRegex(), // @@ -163,6 +166,7 @@ public class CommandCreateClass extends SingleLineCommand2 { // manageExtends(diagram, arg, entity); CommandCreateClassMultilines.manageExtends("EXTENDS", diagram, arg, entity); CommandCreateClassMultilines.manageExtends("IMPLEMENTS", diagram, arg, entity); + CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index 0c85260ef..39cd676c9 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -57,6 +57,7 @@ import net.sourceforge.plantuml.cucadiagram.LeafType; import net.sourceforge.plantuml.cucadiagram.Link; import net.sourceforge.plantuml.cucadiagram.LinkDecor; import net.sourceforge.plantuml.cucadiagram.LinkType; +import net.sourceforge.plantuml.cucadiagram.Stereotag; import net.sourceforge.plantuml.cucadiagram.Stereotype; import net.sourceforge.plantuml.graphic.HtmlColor; import net.sourceforge.plantuml.graphic.color.ColorParser; @@ -102,6 +103,8 @@ public class CommandCreateClassMultilines extends CommandMultilines2\\>)?"), // new RegexLeaf("[%s]*"), // + new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // + new RegexLeaf("[%s]*"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("[%s]*"), // color().getRegex(), // @@ -127,15 +130,15 @@ public class CommandCreateClassMultilines extends CommandMultilines2 1) { lines = lines.subExtract(1, 1); final Url url = null; -// if (lines.size() > 0) { -// final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); -// url = urlBuilder.getUrl(lines.getFirst499().toString()); -// } else { -// url = null; -// } -// if (url != null) { -// lines = lines.subExtract(1, 0); -// } + // if (lines.size() > 0) { + // final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT); + // url = urlBuilder.getUrl(lines.getFirst499().toString()); + // } else { + // url = null; + // } + // if (url != null) { + // lines = lines.subExtract(1, 0); + // } for (CharSequence s : lines) { if (s.length() > 0 && VisibilityModifier.isVisibilityCharacter(s)) { diagram.setVisibilityModifierPresent(true); @@ -149,10 +152,22 @@ public class CommandCreateClassMultilines extends CommandMultilines2 ), // new RegexLeaf("STEREOTYPE", "(?:[%s]*(\\<\\<.+\\>\\>))?"), // new RegexLeaf("[%s]*"), // + new RegexLeaf("TAGS", Stereotag.pattern() + "?"), // + new RegexLeaf("[%s]*"), // new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), // new RegexLeaf("[%s]*"), // ColorParser.exp1(), // @@ -165,6 +168,7 @@ public class CommandCreateElementFull2 extends SingleLineCommand2 .getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER), diagram.getSkinParam() .getIHtmlColorSet())); } + CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0)); final String urlString = arg.get("URL", 0); if (urlString != null) { diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java new file mode 100644 index 000000000..6df888553 --- /dev/null +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShow2.java @@ -0,0 +1,67 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.classdiagram.command; + +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.CucaDiagram; + +public class CommandHideShow2 extends SingleLineCommand2 { + + public CommandHideShow2() { + super(getRegexConcat()); + } + + static RegexConcat getRegexConcat() { + return new RegexConcat(new RegexLeaf("^"), // + new RegexLeaf("COMMAND", "(hide|show)"), // + new RegexLeaf("[%s]+"), // + new RegexLeaf("WHAT", "(.+)"), // + new RegexLeaf("$")); + } + + @Override + protected CommandExecutionResult executeArg(CucaDiagram diagram, RegexResult arg) { + + final boolean show = arg.get("COMMAND", 0).equalsIgnoreCase("show"); + final String what = arg.get("WHAT", 0).trim(); + diagram.hideOrShow2(what, show); + return CommandExecutionResult.ok(); + } +} diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java index 3f52a8fbf..8ee8ded4d 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandHideShowSpecificClass.java @@ -62,22 +62,23 @@ public class CommandHideShowSpecificClass extends SingleLineCommand2