From 37344654416e2de28e0385ff2304c3c8bb458ef3 Mon Sep 17 00:00:00 2001 From: Benjamin Davies Date: Thu, 16 Nov 2023 13:36:34 +1300 Subject: [PATCH] Style associations --- .../plantuml/cheneer/command/CommandAssociate.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java b/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java index 9c96bd6eb..a43da9d3c 100644 --- a/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java +++ b/src/net/sourceforge/plantuml/cheneer/command/CommandAssociate.java @@ -42,6 +42,8 @@ import net.sourceforge.plantuml.cheneer.ChenEerDiagram; import net.sourceforge.plantuml.command.CommandExecutionResult; import net.sourceforge.plantuml.command.SingleLineCommand2; import net.sourceforge.plantuml.decoration.LinkDecor; +import net.sourceforge.plantuml.decoration.LinkMiddleDecor; +import net.sourceforge.plantuml.decoration.LinkStyle; import net.sourceforge.plantuml.decoration.LinkType; import net.sourceforge.plantuml.klimt.color.NoSuchColorException; import net.sourceforge.plantuml.klimt.creole.Display; @@ -77,6 +79,8 @@ public class CommandAssociate extends SingleLineCommand2 { throws NoSuchColorException { final String name1 = diagram.cleanId(arg.get("NAME1", 0)); final String name2 = diagram.cleanId(arg.get("NAME2", 0)); + final boolean isDouble = arg.get("PARTICIPATION", 0).equals("="); + final String cardinality = arg.get("CARDINALITY", 0); final Quark quark1 = diagram.quarkInContext(true, name1); final Entity entity1 = quark1.getData(); @@ -90,11 +94,13 @@ public class CommandAssociate extends SingleLineCommand2 { return CommandExecutionResult.error("No such entity: " + name2); } - final LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE); + LinkType linkType = new LinkType(LinkDecor.NONE, LinkDecor.NONE); + if (isDouble) { + linkType = linkType.goBold(); + } final Link link = new Link(diagram.getEntityFactory(), diagram.getCurrentStyleBuilder(), entity1, entity2, linkType, - // TODO: Cardinality - LinkArg.build(Display.NULL, 3)); + LinkArg.build(Display.getWithNewlines(cardinality), 3)); link.setPortMembers(diagram.getPortId(entity1.getName()), diagram.getPortId(entity2.getName())); diagram.addLink(link);