diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java b/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java index d34990f78cf..01e329c2f54 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java @@ -43,6 +43,8 @@ import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.decoration.LinkDecor; import net.sourceforge.plantuml.decoration.LinkType; +import net.sourceforge.plantuml.klimt.color.ColorParser; +import net.sourceforge.plantuml.klimt.color.ColorType; import net.sourceforge.plantuml.klimt.color.NoSuchColorException; import net.sourceforge.plantuml.klimt.creole.Display; import net.sourceforge.plantuml.plasma.Quark; @@ -69,9 +71,15 @@ protected static IRegex getRegexConcat() { new RegexLeaf("PARTICIPATION2", "([-=])"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("NAME2", "([\\w-]+)"), // + RegexLeaf.spaceZeroOrMore(), // + color().getRegex(), // RegexLeaf.end()); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.LINE); + } + @Override protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { @@ -99,6 +107,7 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation final Link link = new Link(diagram, diagram.getCurrentStyleBuilder(), entity1, entity2, linkType, LinkArg.build(Display.getWithNewlines(cardinality), 3)); link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName())); + link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet())); diagram.addLink(link); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java index b4d25343629..d846c886029 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateAttribute.java @@ -44,6 +44,9 @@ import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.decoration.LinkDecor; import net.sourceforge.plantuml.decoration.LinkType; +import net.sourceforge.plantuml.klimt.color.ColorParser; +import net.sourceforge.plantuml.klimt.color.ColorType; +import net.sourceforge.plantuml.klimt.color.Colors; import net.sourceforge.plantuml.klimt.color.NoSuchColorException; import net.sourceforge.plantuml.klimt.creole.Display; import net.sourceforge.plantuml.plasma.Quark; @@ -74,10 +77,16 @@ protected static IRegex getRegexConcat() { RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(<<.*>>)?"), // RegexLeaf.spaceZeroOrMore(), // + color().getRegex(), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("COMPOSITE", "(\\{)?"), // RegexLeaf.end()); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.LINE); + } + @Override protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { @@ -98,6 +107,8 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation final String stereo = arg.get("STEREO", 0); final boolean composite = arg.get("COMPOSITE", 0) != null; + final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + Entity entity = quark.getData(); if (entity == null) { final Display display = Display.getWithNewlines(displayText); @@ -111,9 +122,12 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation entity.setStereostyle(stereo); } + entity.setColors(colors); + final LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE); final Link link = new Link(diagram, diagram.getCurrentStyleBuilder(), entity, owner, linkType, LinkArg.build(Display.NULL, 2)); + link.setColors(colors); diagram.addLink(link); if (composite) { diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateEntity.java b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateEntity.java index 904e2c6253b..aee95e94489 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandCreateEntity.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandCreateEntity.java @@ -40,6 +40,8 @@ import net.sourceforge.plantuml.cheneer.ChenEerDiagram; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.klimt.color.ColorParser; +import net.sourceforge.plantuml.klimt.color.ColorType; import net.sourceforge.plantuml.klimt.color.NoSuchColorException; import net.sourceforge.plantuml.klimt.creole.Display; import net.sourceforge.plantuml.plasma.Quark; @@ -73,10 +75,16 @@ protected static IRegex getRegexConcat() { RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("STEREO", "(<<.+>>)?"), // RegexLeaf.spaceZeroOrMore(), // + color().getRegex(), // + RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("\\{"), // RegexLeaf.end()); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + @Override protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { @@ -115,6 +123,8 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation entity.setStereostyle(stereo); } + entity.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet())); + diagram.pushOwner(entity); return CommandExecutionResult.ok(); diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandMultiSubclass.java b/src/net/sourceforge/plantuml/cheneer/command/CommandMultiSubclass.java index f11a03a1704..84b13c96b72 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandMultiSubclass.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandMultiSubclass.java @@ -47,6 +47,9 @@ import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.decoration.LinkDecor; import net.sourceforge.plantuml.decoration.LinkType; +import net.sourceforge.plantuml.klimt.color.ColorParser; +import net.sourceforge.plantuml.klimt.color.ColorType; +import net.sourceforge.plantuml.klimt.color.Colors; import net.sourceforge.plantuml.klimt.color.NoSuchColorException; import net.sourceforge.plantuml.klimt.creole.Display; import net.sourceforge.plantuml.plasma.Quark; @@ -75,9 +78,15 @@ protected static IRegex getRegexConcat() { new RegexLeaf("\\{"), // new RegexLeaf("SUBCLASSES", "(.+)"), // new RegexLeaf("\\}"), // + RegexLeaf.spaceZeroOrMore(), // + color().getRegex(), // RegexLeaf.end()); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + @Override protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { @@ -92,11 +101,15 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation final boolean isDouble = arg.get("PARTICIPATION", 0).equals("="); final String symbol = arg.get("SYMBOL", 0); + final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + final Quark centerQuark = diagram.quarkInContext(false, superclass + "/" + symbol + subclasses + "/center"); final Entity centerEntity = diagram.reallyCreateLeaf(centerQuark, Display.create(symbol), LeafType.CHEN_CIRCLE, null); + centerEntity.setColors(colors); + final Quark superclassQuark = diagram.quarkInContext(true, superclass); final Entity superclassEntity = superclassQuark.getData(); if (superclassEntity == null) { @@ -113,6 +126,7 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation final Link link = new Link(diagram, diagram.getCurrentStyleBuilder(), superclassEntity, centerEntity, linkType, LinkArg.build(Display.NULL, 2)); link.setPortMembers(diagram.getPortId(superclassEntity.getName()), diagram.getPortId(centerEntity.getName())); + link.setColors(colors); diagram.addLink(link); for (String subclass : subclassIds) { @@ -128,6 +142,7 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation } final Link subclassLink = new Link(diagram, diagram.getCurrentStyleBuilder(), centerEntity, subclassEntity, subclassLinkType, LinkArg.build(Display.NULL, 3)); + subclassLink.setColors(colors); diagram.addLink(subclassLink); } diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandSimpleSubclass.java b/src/net/sourceforge/plantuml/cheneer/command/CommandSimpleSubclass.java index ef47575f795..8f8381b6d94 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandSimpleSubclass.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandSimpleSubclass.java @@ -43,6 +43,8 @@ import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.decoration.LinkDecor; import net.sourceforge.plantuml.decoration.LinkType; +import net.sourceforge.plantuml.klimt.color.ColorParser; +import net.sourceforge.plantuml.klimt.color.ColorType; import net.sourceforge.plantuml.klimt.color.NoSuchColorException; import net.sourceforge.plantuml.klimt.creole.Display; import net.sourceforge.plantuml.plasma.Quark; @@ -67,9 +69,15 @@ protected static IRegex getRegexConcat() { new RegexLeaf("PARTICIPATION2", "([-=])"), // RegexLeaf.spaceZeroOrMore(), // new RegexLeaf("NAME2", "([\\w-]+)"), // + RegexLeaf.spaceZeroOrMore(), // + color().getRegex(), // RegexLeaf.end()); } + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.LINE); + } + @Override protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException { @@ -102,6 +110,7 @@ protected CommandExecutionResult executeArg(ChenEerDiagram diagram, LineLocation final Link link = new Link(diagram, diagram.getCurrentStyleBuilder(), entity1, entity2, linkType, LinkArg.build(Display.NULL, 3)); link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName())); + link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet())); diagram.addLink(link); return CommandExecutionResult.ok(); diff --git a/test/nonreg/simple/ChenMovieExtended_Test.java b/test/nonreg/simple/ChenMovieExtended_Test.java index d26d61e0d34..9406499ef81 100644 --- a/test/nonreg/simple/ChenMovieExtended_Test.java +++ b/test/nonreg/simple/ChenMovieExtended_Test.java @@ -24,8 +24,8 @@ Age } -entity CUSTOMER { - Number <> +entity CUSTOMER #lightblue;line:blue { + Number <> #lime;line:orange Bonus <> Name <> } @@ -34,11 +34,11 @@ Code } -relationship RENTED_TO { +relationship RENTED_TO #pink;line:red { Date } -RENTED_TO -1- CUSTOMER +RENTED_TO -1- CUSTOMER #lime RENTED_TO -N- MOVIE RENTED_TO -(N,M)- DIRECTOR @@ -48,8 +48,8 @@ entity MEMBER { } -CUSTOMER ->- PARENT -MEMBER -<- CUSTOMER +CUSTOMER ->- PARENT #line:purple +MEMBER -<- CUSTOMER #line:purple entity CHILD <> { Name <> @@ -78,7 +78,7 @@ entity PERSON { } -PERSON ->- U { CUSTOMER, DIRECTOR } +PERSON ->- U { CUSTOMER, DIRECTOR } #lime;line:green @endchen """ diff --git a/test/nonreg/simple/ChenMovieExtended_TestResult.java b/test/nonreg/simple/ChenMovieExtended_TestResult.java index df4b0199d9a..82d1c14a6c3 100644 --- a/test/nonreg/simple/ChenMovieExtended_TestResult.java +++ b/test/nonreg/simple/ChenMovieExtended_TestResult.java @@ -7,7 +7,7 @@ public class ChenMovieExtended_TestResult { DPI: 96 dimension: [ 1617.3106 ; 720.0000 ] scaleFactor: 1.0000 -seed: -7760046765121812191 +seed: -8173812650123393805 svgLinkTarget: _top hoverPathColorRGB: null preserveAspectRatio: none @@ -163,8 +163,8 @@ public class ChenMovieExtended_TestResult { yCorner: 0 stroke: 0.0-0.0-0.5 shadow: 0 - color: ff181818 - backcolor: fff1f1f1 + color: ff0000ff + backcolor: ffadd8e6 TEXT: text: CUSTOMER @@ -181,7 +181,7 @@ public class ChenMovieExtended_TestResult { extend: 0.0 stroke: 0.0-0.0-0.5 shadow: 0 - color: ff181818 + color: ffffa500 backcolor: fff1f1f1 TEXT: @@ -282,8 +282,8 @@ public class ChenMovieExtended_TestResult { - [ 744.2105 ; 173.7105 ] stroke: 0.0-0.0-0.5 shadow: 0 - color: ff181818 - backcolor: fff1f1f1 + color: ffff0000 + backcolor: ffffc0cb TEXT: text: RENTED_TO @@ -574,8 +574,8 @@ public class ChenMovieExtended_TestResult { extend: 0.0 stroke: 0.0-0.0-0.5 shadow: 0 - color: ff181818 - backcolor: fff1f1f1 + color: ff008000 + backcolor: ff00ff00 TEXT: text: U @@ -686,7 +686,7 @@ public class ChenMovieExtended_TestResult { pt3: [ 1189.8552 ; 303.8761 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ff181818 + color: ffffa500 backcolor: NULL_COLOR PATH: @@ -754,7 +754,7 @@ public class ChenMovieExtended_TestResult { pt3: [ 1157.8461 ; 313.3561 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ff181818 + color: ff00ff00 backcolor: NULL_COLOR EMPTY: @@ -842,7 +842,7 @@ public class ChenMovieExtended_TestResult { pt3: [ 1283.8492 ; 458.6705 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ff181818 + color: ff800080 backcolor: NULL_COLOR PATH: @@ -862,7 +862,7 @@ public class ChenMovieExtended_TestResult { pt3: [ 1252.5110 ; 303.9427 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ff181818 + color: ff800080 backcolor: NULL_COLOR PATH: @@ -1046,7 +1046,7 @@ public class ChenMovieExtended_TestResult { pt3: [ 909.0000 ; 109.9627 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ff181818 + color: ff008000 backcolor: NULL_COLOR PATH: @@ -1066,7 +1066,7 @@ public class ChenMovieExtended_TestResult { pt3: [ 1258.4998 ; 303.8713 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ff181818 + color: ff008000 backcolor: NULL_COLOR PATH: @@ -1086,7 +1086,7 @@ public class ChenMovieExtended_TestResult { pt3: [ 407.8635 ; 314.6541 ] stroke: 0.0-0.0-1.0 shadow: 0 - color: ff181818 + color: ff008000 backcolor: NULL_COLOR """