1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-05-29 06:30:48 +00:00
This commit is contained in:
Arnaud Roques 2022-11-04 18:36:03 +01:00
parent 7a6261f00a
commit 48ae51e8c3
316 changed files with 6377 additions and 1293 deletions

View File

@ -38,13 +38,14 @@ package net.sourceforge.plantuml;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.creole.atom.Atom;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.Line;
@ -59,20 +60,96 @@ import net.sourceforge.plantuml.ugraphic.UImage;
import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.UShape;
class EmbeddedDiagramDraw extends AbstractTextBlock implements Line, Atom {
private BufferedImage image;
public class EmbeddedDiagram extends AbstractTextBlock implements Line, Atom {
public static final String EMBEDDED_START = "{{";
public static final String EMBEDDED_END = "}}";
public static String getEmbeddedType(CharSequence cs) {
if (cs == null)
return null;
final String s = StringUtils.trin(cs.toString());
if (s.startsWith(EMBEDDED_START) == false)
return null;
if (s.equals(EMBEDDED_START))
return "uml";
if (s.equals(EMBEDDED_START))
return "uml";
if (s.equals(EMBEDDED_START + "uml"))
return "uml";
if (s.equals(EMBEDDED_START + "wbs"))
return "wbs";
if (s.equals(EMBEDDED_START + "mindmap"))
return "mindmap";
if (s.equals(EMBEDDED_START + "gantt"))
return "gantt";
if (s.equals(EMBEDDED_START + "json"))
return "json";
if (s.equals(EMBEDDED_START + "yaml"))
return "yaml";
if (s.equals(EMBEDDED_START + "wire"))
return "wire";
if (s.equals(EMBEDDED_START + "creole"))
return "creole";
if (s.equals(EMBEDDED_START + "board"))
return "board";
if (s.equals(EMBEDDED_START + "ebnf"))
return "ebnf";
return null;
}
public static EmbeddedDiagram createAndSkip(String type, Iterator<CharSequence> it, ISkinSimple skinParam) {
final List<String> result = new ArrayList<String>();
result.add("@start" + type);
int nested = 1;
while (it.hasNext()) {
final CharSequence s2 = it.next();
if (EmbeddedDiagram.getEmbeddedType(StringUtils.trinNoTrace(s2)) != null)
// if (StringUtils.trinNoTrace(s2).startsWith(EmbeddedDiagram.EMBEDDED_START))
nested++;
else if (StringUtils.trinNoTrace(s2).equals(EmbeddedDiagram.EMBEDDED_END)) {
nested--;
if (nested == 0)
break;
}
result.add(s2.toString());
}
result.add("@end" + type);
return EmbeddedDiagram.from(skinParam, result);
}
private final List<StringLocated> list;
private final ISkinSimple skinParam;
private final List<StringLocated> as2;
private BufferedImage image;
private EmbeddedDiagram(ISkinSimple skinParam, List<StringLocated> system) {
this.list = system;
this.skinParam = skinParam;
}
public static EmbeddedDiagram from(ISkinSimple skinParam, List<String> strings) {
return new EmbeddedDiagram(skinParam, BlockUml.convert(strings));
}
public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
return Arrays.asList((Atom) this);
}
EmbeddedDiagramDraw(ISkinSimple skinParam, List<StringLocated> as2) {
this.skinParam = skinParam;
this.as2 = as2;
}
public double getStartingAltitude(StringBounder stringBounder) {
return 0;
}
@ -137,75 +214,9 @@ class EmbeddedDiagramDraw extends AbstractTextBlock implements Line, Atom {
}
private Diagram getSystem() throws IOException, InterruptedException {
final BlockUml blockUml = new BlockUml(as2, Defines.createEmpty(), skinParam, null, null);
final BlockUml blockUml = new BlockUml(list, Defines.createEmpty(), skinParam, null, null);
return blockUml.getDiagram();
}
}
public class EmbeddedDiagram implements CharSequence {
public static String getEmbeddedType(CharSequence s) {
if (s == null)
return null;
s = StringUtils.trin(s.toString());
if (s.equals("{{"))
return "uml";
if (s.equals("{{uml"))
return "uml";
if (s.equals("{{wbs"))
return "wbs";
if (s.equals("{{mindmap"))
return "mindmap";
if (s.equals("{{gantt"))
return "gantt";
if (s.equals("{{json"))
return "json";
if (s.equals("{{yaml"))
return "yaml";
if (s.equals("{{wire"))
return "wire";
if (s.equals("{{creole"))
return "creole";
if (s.equals("{{board"))
return "board";
if (s.equals("{{ebnf"))
return "ebnf";
return null;
}
private final Display system;
public EmbeddedDiagram(Display system) {
this.system = system;
}
public int length() {
return toString().length();
}
public char charAt(int index) {
return toString().charAt(index);
}
public CharSequence subSequence(int start, int end) {
return toString().subSequence(start, end);
}
public EmbeddedDiagramDraw asDraw(ISkinSimple skinParam) {
return new EmbeddedDiagramDraw(skinParam, system.as2());
}
}

View File

@ -72,13 +72,17 @@ public class FileSystem {
}
public SFile getFile(String nameOrPath) throws IOException {
if (isAbsolute(nameOrPath))
return new SFile(nameOrPath).getCanonicalFile();
if (isAbsolute(nameOrPath)) {
final SFile result = new SFile(nameOrPath);
Log.info("Trying " + result.getAbsolutePath());
return result.getCanonicalFile();
}
final SFile dir = getCurrentDir();
SFile filecurrent = null;
if (dir != null) {
filecurrent = dir.getAbsoluteFile().file(nameOrPath);
Log.info("Current dir is " + dir.getAbsolutePath() + " so trying " + filecurrent.getAbsolutePath());
if (filecurrent.exists())
return filecurrent.getCanonicalFile();

View File

@ -37,6 +37,10 @@ package net.sourceforge.plantuml;
import java.util.Map;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.SheetBuilder;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public interface ISkinSimple extends SpriteContainer {
@ -59,4 +63,10 @@ public interface ISkinSimple extends SpriteContainer {
public void copyAllFrom(Map<String, String> other);
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
CreoleMode creoleMode);
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
CreoleMode creoleMode, FontConfiguration stereo);
}

View File

@ -44,9 +44,9 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.core.Diagram;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.html.CucaDiagramHtmlMaker;
import net.sourceforge.plantuml.png.PngSplitter;
import net.sourceforge.plantuml.project.GanttDiagram;
@ -169,19 +169,14 @@ public class PSystemUtils {
return maker.create();
}
private static List<FileImageData> splitPng(TitledDiagram diagram, SuggestedFile pngFile, ImageData imageData, FileFormatOption fileFormatOption)
throws IOException {
private static List<FileImageData> splitPng(TitledDiagram diagram, SuggestedFile pngFile, ImageData imageData,
FileFormatOption fileFormatOption) throws IOException {
final List<SFile> files = new PngSplitter(
pngFile,
diagram.getSplitPagesHorizontal(),
diagram.getSplitPagesVertical(),
fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null,
diagram.getSkinParam().getDpi(),
diagram instanceof GanttDiagram
? new SplitParam(HColors.BLACK, null, 5) // for backwards compatibility
: diagram.getSkinParam().getSplitParam()
).getFiles();
final List<SFile> files = new PngSplitter(fileFormatOption.getColorMapper(), pngFile,
diagram.getSplitPagesHorizontal(), diagram.getSplitPagesVertical(),
fileFormatOption.isWithMetadata() ? diagram.getMetadata() : null, diagram.getSkinParam().getDpi(),
diagram instanceof GanttDiagram ? new SplitParam(HColors.BLACK, null, 5) // for backwards compatibility
: diagram.getSkinParam().getSplitParam()).getFiles();
final List<FileImageData> result = new ArrayList<>();
for (SFile f : files) {

View File

@ -39,6 +39,7 @@ import java.awt.Font;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
@ -56,11 +57,15 @@ import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.SheetBuilder;
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.log.Logme;
@ -1195,4 +1200,25 @@ public class SkinParam implements ISkinParam {
return paramSameClassWidth;
}
@Override
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
CreoleMode creoleMode) {
final FontConfiguration stereotype = fontConfiguration.forceFont(null, null);
return sheet(fontConfiguration, horizontalAlignment, creoleMode, stereotype);
}
private final Map<Object, CreoleParser> cache = new HashMap<>();
@Override
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
CreoleMode creoleMode, FontConfiguration stereo) {
final Object key = Arrays.asList(horizontalAlignment, creoleMode, fontConfiguration, stereo);
CreoleParser result = cache.get(key);
if (result == null) {
result = new CreoleParser(fontConfiguration, horizontalAlignment, this, creoleMode, stereo);
cache.put(key, result);
}
return result;
}
}

View File

@ -38,9 +38,12 @@ package net.sourceforge.plantuml;
import java.util.Collection;
import java.util.Map;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.SheetBuilder;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.ActorStyle;
@ -443,4 +446,16 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getParamSameClassWidth();
}
@Override
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
CreoleMode creoleMode) {
return skinParam.sheet(fontConfiguration, horizontalAlignment, creoleMode);
}
@Override
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
CreoleMode creoleMode, FontConfiguration stereo) {
return skinParam.sheet(fontConfiguration, horizontalAlignment, creoleMode, stereo);
}
}

View File

@ -37,7 +37,12 @@ package net.sourceforge.plantuml;
import java.util.Map;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.SheetBuilder;
import net.sourceforge.plantuml.creole.legacy.CreoleParser;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.sprite.SpriteImage;
import net.sourceforge.plantuml.style.Style;
@ -45,46 +50,57 @@ import net.sourceforge.plantuml.ugraphic.color.HColorSet;
public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
@Override
public Sprite getSprite(String name) {
return SpriteImage.fromInternal(name);
}
@Override
public String getValue(String key) {
return null;
}
@Override
public double getPadding() {
return 0;
}
@Override
public Guillemet guillemet() {
return Guillemet.DOUBLE_COMPARATOR;
}
@Override
public String getMonospacedFamily() {
return Parser.MONOSPACED;
}
@Override
public int getTabSize() {
return 8;
}
@Override
public HColorSet getIHtmlColorSet() {
return HColorSet.instance();
}
@Override
public int getDpi() {
return 96;
}
@Override
public LineBreakStrategy wrapWidth() {
return LineBreakStrategy.NONE;
}
@Override
public void copyAllFrom(Map<String, String> other) {
throw new UnsupportedOperationException();
}
@Override
public Map<String, String> values() {
throw new UnsupportedOperationException();
}
@ -93,8 +109,21 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
return 0;
}
@Override
public String transformStringForSizeHack(String s) {
return s;
}
@Override
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
CreoleMode creoleMode) {
throw new UnsupportedOperationException();
}
@Override
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
CreoleMode creoleMode, FontConfiguration stereo) {
return new CreoleParser(fontConfiguration, horizontalAlignment, this, creoleMode, stereo);
}
}

View File

@ -42,14 +42,14 @@ import java.util.Objects;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.ILeaf;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;

View File

@ -38,7 +38,7 @@ package net.sourceforge.plantuml.activitydiagram;
import java.util.Objects;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.cucadiagram.LeafType;
public class ConditionalContext {

View File

@ -37,13 +37,13 @@ package net.sourceforge.plantuml.activitydiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
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.IEntity;
public class CommandElse extends SingleLineCommand2<ActivityDiagram> {

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.activitydiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -44,7 +45,6 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.IEntity;
public class CommandEndPartition extends SingleLineCommand2<ActivityDiagram> {

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -49,7 +50,6 @@ import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -125,8 +125,8 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
final IEntity branch = diagram.getCurrentContext().getBranch();
final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(arg.get("BRACKET", 0)), lenght);
Link link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), entity1, branch,
new LinkType(LinkDecor.ARROW, LinkDecor.NONE), linkArg.withQuantifier(null, ifLabel)
Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
branch, new LinkType(LinkDecor.ARROW, LinkDecor.NONE), linkArg.withQuantifier(null, ifLabel)
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
if (arg.get("ARROW", 0) != null) {
final Direction direction = StringUtils.getArrowDirection(arg.get("ARROW", 0));

View File

@ -42,6 +42,8 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.ILeaf;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -55,8 +57,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -134,8 +134,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
if (arg.get("BACKCOLOR", 0) != null) {
String s = arg.get("BACKCOLOR", 0);
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColor(s));
}
final IEntity entity2 = getEntity(diagram, arg, false);
@ -144,8 +143,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
if (arg.get("BACKCOLOR2", 0) != null) {
String s = arg.get("BACKCOLOR2", 0);
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColor(s));
}
if (arg.get("STEREOTYPE2", 0) != null)
entity2.setStereotype(Stereotype.build(arg.get("STEREOTYPE2", 0)));
@ -166,7 +164,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
type = type.goDotted();
final LinkArg linkArg = LinkArg.build(linkLabel, lenght, diagram.getSkinParam().classAttributeIconSize() > 0);
Link link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), entity1, entity2, type, linkArg);
Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
entity2, type, linkArg);
if (arrowDirection.contains("*"))
link.setConstraint(false);

View File

@ -45,6 +45,7 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.command.CommandLinkClass;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -61,7 +62,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -131,8 +131,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
final String stringColor = line0.get("BACKCOLOR", 0);
if (stringColor != null) {
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
.getColor(stringColor));
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(stringColor));
}
final StringBuilder sb = new StringBuilder();
@ -199,8 +199,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
if (lineLast.get(4) != null) {
String s = lineLast.get(4);
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet().getColor(s));
}
final String arrowBody1 = CommandLinkClass.notNull(line0.get("ARROW_BODY1", 0));
@ -218,7 +217,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
type = type.goDotted();
final LinkArg linkArg = LinkArg.build(linkLabel, lenght, diagram.getSkinParam().classAttributeIconSize() > 0);
Link link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), entity1, entity2, type, linkArg);
Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), entity1,
entity2, type, linkArg);
final Direction direction = StringUtils.getArrowDirection(arrowBody1 + arrowDirection + arrowBody2 + ">");
if (direction == Direction.LEFT || direction == Direction.UP)
link = link.getInv();

View File

@ -38,6 +38,8 @@ package net.sourceforge.plantuml.activitydiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -48,8 +50,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;

View File

@ -73,11 +73,10 @@ public class InstructionSplit extends AbstractInstruction implements Instruction
@Override
public boolean containsBreak() {
for (InstructionList split : splits) {
if (split.containsBreak()) {
for (InstructionList split : splits)
if (split.containsBreak())
return true;
}
}
return false;
}
@ -112,9 +111,9 @@ public class InstructionSplit extends AbstractInstruction implements Instruction
@Override
public Ftile createFtile(FtileFactory factory) {
final List<Ftile> all = new ArrayList<>();
for (InstructionList list : splits) {
for (InstructionList list : splits)
all.add(list.createFtile(factory));
}
return factory.createParallel(all, ForkStyle.SPLIT, null, swimlaneIn, swimlaneOut);
}
@ -123,17 +122,17 @@ public class InstructionSplit extends AbstractInstruction implements Instruction
}
public void splitAgain(LinkRendering inlinkRendering) {
if (inlinkRendering != null) {
if (inlinkRendering != null)
getLast().setOutRendering(inlinkRendering);
}
final InstructionList list = new InstructionList(swimlaneIn);
this.splits.add(list);
}
public void endSplit(LinkRendering inlinkRendering, Swimlane endSwimlane) {
if (inlinkRendering != null) {
if (inlinkRendering != null)
getLast().setOutRendering(inlinkRendering);
}
this.swimlaneOut = endSwimlane;
}

View File

@ -35,6 +35,8 @@
*/
package net.sourceforge.plantuml.activitydiagram3.ftile;
import java.util.Set;
import net.sourceforge.plantuml.SpecificBackcolorable;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.graphic.color.ColorType;
@ -43,17 +45,19 @@ import net.sourceforge.plantuml.ugraphic.MinMax;
import net.sourceforge.plantuml.ugraphic.UTranslate;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public class Swimlane implements SpecificBackcolorable {
public class Swimlane implements SpecificBackcolorable, Comparable<Swimlane> {
private final String name;
private final int order;
private Display display;
private UTranslate translate = new UTranslate();
private double actualWidth;
public Swimlane(String name) {
public Swimlane(String name, int order) {
this.name = name;
this.display = Display.getWithNewlines(name);
this.order = order;
}
@ -116,4 +120,18 @@ public class Swimlane implements SpecificBackcolorable {
public MinMax getMinMax() {
return minMax;
}
@Override
public int compareTo(Swimlane other) {
return Integer.compare(this.order, other.order);
}
public boolean isSmallerThanAllOthers(Set<Swimlane> others) {
if (others.size() == 1 && others.contains(this))
return false;
for (Swimlane sw : others)
if (sw.compareTo(this) < 0)
return false;
return true;
}
}

View File

@ -110,7 +110,7 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
private List<Swimlane> swimlanesSpecial() {
if (swimlanesSpecial.size() == 0) {
swimlanesSpecial.addAll(swimlanesRaw);
final Swimlane last = new Swimlane("");
final Swimlane last = new Swimlane("", Integer.MAX_VALUE);
last.setMinMax(MinMax.getEmpty(true));
swimlanesSpecial.add(last);
}
@ -151,21 +151,20 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
public void swimlane(String name, HColor color, Display label) {
currentSwimlane = getOrCreate(name);
if (color != null) {
if (color != null)
currentSwimlane.setSpecificColorTOBEREMOVED(ColorType.BACK, color);
}
if (Display.isNull(label) == false) {
if (Display.isNull(label) == false)
currentSwimlane.setDisplay(label);
}
}
private Swimlane getOrCreate(String name) {
for (Swimlane s : swimlanes()) {
if (s.getName().equals(name)) {
for (Swimlane s : swimlanes())
if (s.getName().equals(name))
return s;
}
}
final Swimlane result = new Swimlane(name);
final Swimlane result = new Swimlane(name, swimlanesRaw.size());
swimlanesRaw.add(result);
return result;
}
@ -186,9 +185,9 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
final Ftile tile1 = connection.getFtile1();
final Ftile tile2 = connection.getFtile2();
if (tile1 == null || tile2 == null) {
if (tile1 == null || tile2 == null)
return;
}
if (tile1.getSwimlaneOut() != tile2.getSwimlaneIn()) {
final ConnectionCross connectionCross = new ConnectionCross(connection);
connectionCross.drawU(getUg());
@ -364,11 +363,10 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
double min = skinParam.swimlaneWidth();
if (min == ISkinParam.SWIMLANE_WIDTH_SAME) {
for (Swimlane swimlane : swimlanes()) {
if (min == ISkinParam.SWIMLANE_WIDTH_SAME)
for (Swimlane swimlane : swimlanes())
min = Math.max(min, getWidthWithoutTitle(swimlane));
}
}
final StringBounder stringBounder = ug.getStringBounder();
for (int i = 0; i < swimlanesSpecial().size(); i++) {
@ -400,15 +398,15 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
}
public double getHalfMissingSpace(StringBounder stringBounder, int i, double min) {
if (i == 0 || i > swimlanesSpecial().size()) {
if (i == 0 || i > swimlanesSpecial().size())
return 5;
}
final Swimlane swimlane = swimlanesSpecial().get(i - 1);
final double swimlaneActualWidth = Math.max(min, getWidthWithoutTitle(swimlane));
final double titleWidth = getTitle(swimlane).calculateDimension(stringBounder).getWidth();
if (titleWidth <= swimlaneActualWidth) {
if (titleWidth <= swimlaneActualWidth)
return 5;
}
assert titleWidth > swimlaneActualWidth;
return Math.max(5, 5 + (titleWidth - swimlaneActualWidth) / 2);
}
@ -445,9 +443,9 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
@Override
public MinMax getMinMax(StringBounder stringBounder) {
if (cachedMinMax == null) {
if (cachedMinMax == null)
cachedMinMax = TextBlockUtils.getMinMax(this, stringBounder, false);
}
return cachedMinMax;
}

View File

@ -41,7 +41,6 @@ import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -76,8 +75,8 @@ public class FloatingNote extends AbstractTextBlock implements Stencil, TextBloc
final UStroke stroke = style.getStroke();
final double shadowing = style.value(PName.Shadowing).asDouble();
final Sheet sheet = Parser
.build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam
.sheet(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
.createSheet(note);
final SheetBlock2 sheetBlock2 = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this,
stroke);

View File

@ -53,15 +53,15 @@ public final class FtileFactoryDelegatorCreateParallel extends FtileFactoryDeleg
public Ftile createParallel(List<Ftile> all, ForkStyle style, String label, Swimlane in, Swimlane out) {
AbstractParallelFtilesBuilder builder;
if (style == ForkStyle.SPLIT) {
if (style == ForkStyle.SPLIT)
builder = new ParallelBuilderSplit(skinParam(), getStringBounder(), all);
} else if (style == ForkStyle.MERGE) {
else if (style == ForkStyle.MERGE)
builder = new ParallelBuilderMerge(skinParam(), getStringBounder(), all);
} else if (style == ForkStyle.FORK) {
else if (style == ForkStyle.FORK)
builder = new ParallelBuilderFork(skinParam(), getStringBounder(), label, in, out, all);
} else {
else
throw new IllegalStateException();
}
final Ftile inner = super.createParallel(builder.list99, style, label, in, out);
return builder.build(inner);
}

View File

@ -125,8 +125,8 @@ class FtileIfAndStop extends AbstractFtile {
final UStroke thickness = tileNonStop.getThickness(style);
final FontConfiguration fcTest = FontConfiguration.create(skinParam, style);
final Sheet sheet = Parser
.build(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam
.sheet(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
.createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());

View File

@ -115,6 +115,7 @@ public class FtileIfDown extends AbstractFtile {
ConditionEndStyle conditionEndStyle, FtileFactory ftileFactory, Ftile optionalStop, Rainbow elseColor) {
elseColor = elseColor.withDefault(arrowColor);
final FtileIfDown result = new FtileIfDown(thenBlock, diamond1,
optionalStop == null ? diamond2 : new FtileEmpty(ftileFactory.skinParam()), optionalStop,
conditionEndStyle);
@ -125,7 +126,13 @@ public class FtileIfDown extends AbstractFtile {
if (optionalStop == null) {
if (hasPointOut1) {
if (conditionEndStyle == ConditionEndStyle.DIAMOND) {
conns.add(result.new ConnectionElse(elseColor));
if (swimlane != null && swimlane.isSmallerThanAllOthers(thenBlock.getSwimlanes())) {
conns.add(result.new ConnectionElse1(elseColor));
if (diamond1 instanceof FtileDiamondInside)
((FtileDiamondInside) diamond1).swapEastWest();
} else {
conns.add(result.new ConnectionElse2(elseColor));
}
} else if (conditionEndStyle == ConditionEndStyle.HLINE) {
conns.add(result.new ConnectionElseHline(elseColor));
conns.add(result.new ConnectionHline(elseColor));
@ -285,10 +292,62 @@ public class FtileIfDown extends AbstractFtile {
}
}
class ConnectionElse extends AbstractConnection {
class ConnectionElse1 extends AbstractConnection {
private final Rainbow endInlinkColor;
public ConnectionElse(Rainbow endInlinkColor) {
public ConnectionElse1(Rainbow endInlinkColor) {
super(diamond1, diamond2);
this.endInlinkColor = endInlinkColor;
}
protected XPoint2D getP1(StringBounder stringBounder) {
final FtileGeometry dimDiamond1 = diamond1.calculateDimension(stringBounder);
final double x = 0;
final double half = (dimDiamond1.getOutY() - dimDiamond1.getInY()) / 2;
return getTranslateDiamond1(stringBounder).getTranslated(new XPoint2D(x, dimDiamond1.getInY() + half));
}
protected XPoint2D getP2(final StringBounder stringBounder) {
final FtileGeometry dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double x = 0;
final double half = (dimDiamond2.getOutY() - dimDiamond2.getInY()) / 2;
return getTranslateDiamond2(stringBounder).getTranslated(new XPoint2D(x, dimDiamond2.getInY() + half));
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final XPoint2D p1 = getP1(stringBounder);
if (calculateDimension(stringBounder).hasPointOut() == false)
return;
final XPoint2D p2 = getP2(stringBounder);
final double x1 = p1.getX();
final double y1 = p1.getY();
final double x2 = p2.getX();
final double y2 = p2.getY();
final double t11 = getTranslateForThen(stringBounder).getDx();
final double xmin = Math.min(x1 - Hexagon.hexagonHalfSize, getTranslateForThen(stringBounder).getDx());
final Snake snake = Snake.create(skinParam(), endInlinkColor, Arrows.asToRight())
.emphasizeDirection(Direction.DOWN);
snake.addPoint(x1, y1);
snake.addPoint(xmin, y1);
snake.addPoint(xmin, y2);
snake.addPoint(x2, y2);
ug.apply(new UTranslate(x2, y2 - Hexagon.hexagonHalfSize)).draw(new UEmpty(5, Hexagon.hexagonHalfSize));
ug.draw(snake);
}
}
class ConnectionElse2 extends AbstractConnection {
private final Rainbow endInlinkColor;
public ConnectionElse2(Rainbow endInlinkColor) {
super(diamond1, diamond2);
this.endInlinkColor = endInlinkColor;
}
@ -338,7 +397,7 @@ public class FtileIfDown extends AbstractFtile {
}
class ConnectionElseHline extends ConnectionElse {
class ConnectionElseHline extends ConnectionElse2 {
private final Rainbow endInlinkColor;
public ConnectionElseHline(Rainbow endInlinkColor) {
@ -389,7 +448,7 @@ public class FtileIfDown extends AbstractFtile {
}
class ConnectionElseNoDiamond extends ConnectionElse {
class ConnectionElseNoDiamond extends ConnectionElse2 {
public ConnectionElseNoDiamond(Rainbow endInlinkColor) {
super(endInlinkColor);

View File

@ -667,12 +667,12 @@ class FtileIfLongHorizontal extends AbstractFtile {
private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
XDimension2D result = new XDimension2D(0, 0);
for (Ftile couple : couples) {
result = XDimension2D.mergeLR(result, couple.calculateDimension(stringBounder));
result = result.mergeLR(couple.calculateDimension(stringBounder));
}
XDimension2D dimTile2 = tile2.calculateDimension(stringBounder);
dimTile2 = XDimension2D.delta(dimTile2, 0, getDiamondsHeight(stringBounder) / 2);
result = XDimension2D.mergeLR(result, dimTile2);
result = XDimension2D.delta(result, xSeparation * couples.size(), 100);
dimTile2 = dimTile2.delta(0, getDiamondsHeight(stringBounder) / 2);
result = result.mergeLR(dimTile2);
result = result.delta(xSeparation * couples.size(), 100);
return new FtileGeometry(result, result.getWidth() / 2, 0);
}

View File

@ -48,7 +48,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -112,8 +111,8 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable
final FontConfiguration fc = FontConfiguration.create(skinParam, FontParam.NOTE, null);
final Sheet sheet = Parser
.build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam
.sheet(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
.createSheet(note);
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this, stroke);
opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, false, stroke);

View File

@ -180,7 +180,10 @@ class FtileRepeat extends AbstractFtile {
final Rainbow rainbow2 = incoming2.getRainbow(arrowColor);
conns.add(result.new ConnectionBackBackward2(rainbow2, backArrowLabel));
} else if (repeat.getSwimlaneIn() == null || repeat.getSwimlaneIn() == swimlaneOut) {
conns.add(result.new ConnectionBackSimple(incoming1.getRainbow(arrowColor), incomingText));
if (repeat.getSwimlaneIn() != null && repeat.getSwimlaneIn().isSmallerThanAllOthers(repeat.getSwimlanes()))
conns.add(result.new ConnectionBackSimple1(incoming1.getRainbow(arrowColor), incomingText));
else
conns.add(result.new ConnectionBackSimple2(incoming1.getRainbow(arrowColor), incomingText));
} else {
conns.add(result.new ConnectionBackComplex1(incoming1.getRainbow(arrowColor)));
}
@ -496,11 +499,83 @@ class FtileRepeat extends AbstractFtile {
}
class ConnectionBackSimple extends AbstractConnection implements ConnectionTranslatable {
class ConnectionBackSimple1 extends AbstractConnection implements ConnectionTranslatable {
private final Rainbow arrowColor;
private final TextBlock tbback;
public ConnectionBackSimple(Rainbow arrowColor, TextBlock tbback) {
public ConnectionBackSimple1(Rainbow arrowColor, TextBlock tbback) {
super(diamond2, repeat);
this.arrowColor = arrowColor;
this.tbback = tbback;
}
private XPoint2D getP1(final StringBounder stringBounder) {
return getTranslateDiamond2(stringBounder).getTranslated(new XPoint2D(0, 0));
}
private XPoint2D getP2(final StringBounder stringBounder) {
return getTranslateDiamond1(stringBounder).getTranslated(new XPoint2D(0, 0));
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToRight())
.emphasizeDirection(Direction.UP).withLabel(tbback, arrowHorizontalAlignment());
// final XDimension2D dimTotal = calculateDimensionInternal(stringBounder);
final XPoint2D p1 = getP1(stringBounder);
final XPoint2D p2 = getP2(stringBounder);
final XDimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
final XDimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double x1 = p1.getX();
final double y1 = p1.getY() + dimDiamond2.getHeight() / 2;
final double x2 = p2.getX();
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
snake.addPoint(x1, y1);
final double xmin = -Hexagon.hexagonHalfSize;
snake.addPoint(xmin, y1);
snake.addPoint(xmin, y2);
snake.addPoint(x2, y2);
ug.draw(snake);
}
@Override
public void drawTranslate(UGraphic ug, UTranslate translate1, UTranslate translate2) {
final StringBounder stringBounder = ug.getStringBounder();
final Snake snake = Snake.create(skinParam(), arrowColor, Arrows.asToLeft())
.emphasizeDirection(Direction.UP).withLabel(tbback, arrowHorizontalAlignment());
final XDimension2D dimRepeat = repeat.calculateDimension(stringBounder);
XPoint2D p1 = getP1(stringBounder);
XPoint2D p2 = getP2(stringBounder);
p1 = translate1.getTranslated(p1);
p2 = translate2.getTranslated(p2);
final XDimension2D dimDiamond1 = diamond1.calculateDimension(stringBounder);
final XDimension2D dimDiamond2 = diamond2.calculateDimension(stringBounder);
final double x1 = p1.getX();
final double y1 = p1.getY() + dimDiamond2.getHeight() / 2;
final double x2 = p2.getX();
final double y2 = p2.getY() + dimDiamond1.getHeight() / 2;
snake.addPoint(x1, y1);
final double xmax = p1.getX() + dimDiamond2.getWidth() / 2 + dimRepeat.getWidth() / 2
+ Hexagon.hexagonHalfSize;
snake.addPoint(xmax, y1);
snake.addPoint(xmax, y2);
snake.addPoint(x2, y2);
ug.draw(snake);
}
}
class ConnectionBackSimple2 extends AbstractConnection implements ConnectionTranslatable {
private final Rainbow arrowColor;
private final TextBlock tbback;
public ConnectionBackSimple2(Rainbow arrowColor, TextBlock tbback) {
super(diamond2, repeat);
this.arrowColor = arrowColor;
this.tbback = tbback;

View File

@ -1,116 +0,0 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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.activitydiagram3.ftile.vcompact;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import net.sourceforge.plantuml.activitydiagram3.ftile.AbstractFtile;
import net.sourceforge.plantuml.activitydiagram3.ftile.Ftile;
import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.graphic.StringBounder;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.UTranslate;
class FtileSplit1 extends AbstractFtile {
private final List<Ftile> forks = new ArrayList<>();
public FtileSplit1(List<Ftile> forks) {
super(forks.get(0).skinParam());
for (Ftile ftile : forks) {
this.forks.add(ftile);
}
}
public Swimlane getSwimlaneIn() {
return forks.get(0).getSwimlaneIn();
}
public Swimlane getSwimlaneOut() {
return null;
// return getSwimlaneIn();
}
public Set<Swimlane> getSwimlanes() {
return mergeSwimlanes(forks);
}
public static Set<Swimlane> mergeSwimlanes(List<Ftile> tiles) {
final Set<Swimlane> result = new HashSet<>();
for (Ftile tile : tiles) {
result.addAll(tile.getSwimlanes());
}
return Collections.unmodifiableSet(result);
}
public void drawU(UGraphic ug) {
final StringBounder stringBounder = ug.getStringBounder();
for (Ftile ftile : forks) {
ug.apply(getTranslateFor(ftile, stringBounder)).draw(ftile);
}
}
@Override
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
double height = 0;
double width = 0;
for (Ftile ftile : forks) {
final XDimension2D dim = ftile.calculateDimension(stringBounder);
if (dim.getWidth() > width) {
width = dim.getWidth();
}
if (dim.getHeight() > height) {
height = dim.getHeight();
}
}
final XDimension2D dimTotal = new XDimension2D(width, height);
return new FtileGeometry(dimTotal, dimTotal.getWidth() / 2, 0, dimTotal.getHeight());
}
public UTranslate getTranslateFor(Ftile searched, StringBounder stringBounder) {
final XDimension2D dim = searched.calculateDimension(stringBounder);
final double xpos = calculateDimension(stringBounder).getWidth() - dim.getWidth();
return UTranslate.dx(xpos / 2);
}
}

View File

@ -166,9 +166,9 @@ class FtileSwitch extends AbstractFtile {
private FtileGeometry calculateDimensionInternal(StringBounder stringBounder) {
XDimension2D result = new XDimension2D(0, 0);
for (Ftile couple : tiles)
result = XDimension2D.mergeLR(result, couple.calculateDimension(stringBounder));
result = result.mergeLR(couple.calculateDimension(stringBounder));
result = XDimension2D.delta(result, xSeparation * (tiles.size() - 1), 100);
result = result.delta(xSeparation * (tiles.size() - 1), 100);
return new FtileGeometry(result, result.getWidth() / 2, 0);
}

View File

@ -52,7 +52,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.awt.geom.XPoint2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -146,7 +145,7 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null,
false, null);
final Sheet sheet = Parser.build(fc, align, skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final Sheet sheet = skinParam.sheet(fc, align, CreoleMode.FULL).createSheet(note.getDisplay());
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this, stroke);
opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, withLink, stroke);

View File

@ -47,7 +47,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -116,8 +115,8 @@ public class FtileWithNotes extends AbstractFtile {
final LineBreakStrategy wrapWidth = style.wrapWidth();
final UStroke stroke = style.getStroke();
final Sheet sheet = Parser
.build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam
.sheet(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
.createSheet(note.getDisplay());
final SheetBlock1 sheet1 = new SheetBlock1(sheet, wrapWidth, skinParam.getPadding());
final SheetBlock2 sheet2 = new SheetBlock2(sheet1, new Stencil() {

View File

@ -53,7 +53,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondInsi
import net.sourceforge.plantuml.activitydiagram3.ftile.vertical.FtileDiamondSquare;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -237,8 +236,9 @@ public class ConditionalBuilder {
private Ftile getShape1(boolean eastWest, TextBlock tb1, TextBlock tb2) {
final Display labelTest = branch1.getLabelTest();
final Sheet sheet = Parser.build(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT),
skinParam, CreoleMode.FULL).createSheet(labelTest);
final Sheet sheet = skinParam
.sheet(fontTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
.createSheet(labelTest);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, diamondLineBreak, skinParam.getPadding());
final UStroke thickness = tile1

View File

@ -145,7 +145,7 @@ public class FtileIfNude extends FtileDimensionMemoize {
final double innerMargin = widthInner(stringBounder);
final double width = dim1.getLeft() + innerMargin + (dim2.getWidth() - dim2.getLeft());
final XDimension2D dim12 = XDimension2D.mergeLR(dim1, dim2);
final XDimension2D dim12 = dim1.mergeLR(dim2);
return new FtileGeometry(width, dim12.getHeight(), dim1.getLeft() + innerMargin / 2, 0);
}

View File

@ -127,9 +127,9 @@ public class FtileSwitchNude extends FtileDimensionMemoize {
protected FtileGeometry calculateDimensionInternalSlow(StringBounder stringBounder) {
XDimension2D result = new XDimension2D(0, 0);
for (Ftile couple : tiles)
result = XDimension2D.mergeLR(result, couple.calculateDimension(stringBounder));
result = result.mergeLR(couple.calculateDimension(stringBounder));
result = XDimension2D.delta(result, xSeparation * (tiles.size() - 1), 100);
result = result.delta(xSeparation * (tiles.size() - 1), 100);
return new FtileGeometry(result, result.getWidth() / 2, 0);
}

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -149,8 +148,7 @@ public class FtileBox extends AbstractFtile {
this.boxStyle = boxStyle;
this.swimlane = swimlane;
this.inRendering = LinkRendering
.create(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.inRendering = LinkRendering.create(Rainbow.build(styleArrow, getIHtmlColorSet()));
Colors specBack = null;
if (skinParam instanceof SkinParamColors)
specBack = ((SkinParamColors) skinParam).getColors();
@ -170,8 +168,7 @@ public class FtileBox extends AbstractFtile {
final LineBreakStrategy wrapWidth = style.wrapWidth();
this.minimumWidth = style.value(PName.MinimumWidth).asDouble();
final Sheet sheet = Parser
.build(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam.sheet(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), CreoleMode.FULL)
.createSheet(label);
this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), new MyStencil(),
new UStroke(1));
@ -222,9 +219,8 @@ public class FtileBox extends AbstractFtile {
@Override
protected FtileGeometry calculateDimensionFtile(StringBounder stringBounder) {
XDimension2D dimRaw = tb.calculateDimension(stringBounder);
dimRaw = XDimension2D.delta(dimRaw, padding.getLeft() + padding.getRight(),
padding.getBottom() + padding.getTop());
dimRaw = XDimension2D.atLeast(dimRaw, minimumWidth, 0);
dimRaw = dimRaw.delta(padding.getLeft() + padding.getRight(), padding.getBottom() + padding.getTop());
dimRaw = dimRaw.atLeast(minimumWidth, 0);
return new FtileGeometry(dimRaw.getWidth() + boxStyle.getShield(), dimRaw.getHeight(), dimRaw.getWidth() / 2, 0,
dimRaw.getHeight());
}

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -155,8 +154,7 @@ public class FtileBox2 extends AbstractFtile {
this.boxStyle = boxStyle;
this.swimlane = swimlane;
this.inRendering = LinkRendering
.create(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.inRendering = LinkRendering.create(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
@ -172,8 +170,7 @@ public class FtileBox2 extends AbstractFtile {
this.minimumWidth = style.value(PName.MinimumWidth).asDouble();
final Sheet sheet = Parser
.build(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam.sheet(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), CreoleMode.FULL)
.createSheet(label);
this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), new MyStencil(),
new UStroke(1));
@ -235,9 +232,9 @@ public class FtileBox2 extends AbstractFtile {
private XDimension2D getDimRaw(StringBounder stringBounder) {
XDimension2D dimRaw = tb.calculateDimension(stringBounder);
dimRaw = XDimension2D.delta(dimRaw, padding.getLeft() + padding.getRight() + boxStyle.getShield(),
dimRaw = dimRaw.delta(padding.getLeft() + padding.getRight() + boxStyle.getShield(),
padding.getBottom() + padding.getTop());
dimRaw = XDimension2D.atLeast(dimRaw, minimumWidth, 0);
dimRaw = dimRaw.atLeast(minimumWidth, 0);
return dimRaw;
}

View File

@ -50,7 +50,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -154,8 +153,7 @@ public class FtileBoxOld extends AbstractFtile {
this.boxStyle = boxStyle;
this.swimlane = swimlane;
this.inRendering = LinkRendering
.create(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.inRendering = LinkRendering.create(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
final FontConfiguration fc = style.getFontConfiguration(getIHtmlColorSet());
@ -168,7 +166,7 @@ public class FtileBoxOld extends AbstractFtile {
// final HorizontalAlignment alignment =
// skinParam.getDefaultTextAlignment(horizontalAlignment);
final Sheet sheet = Parser.build(fc, horizontalAlignment, skinParam, CreoleMode.FULL).createSheet(label);
final Sheet sheet = skinParam.sheet(fc, horizontalAlignment, CreoleMode.FULL).createSheet(label);
// this.tb = new SheetBlock1(sheet, wrapWidth, 0, this.padding.getLeft(), this.padding.getRight());
// this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, 0, this.padding.getLeft(), this.padding.getRight()),
// new MyStencil(), new UStroke(1));
@ -233,7 +231,7 @@ public class FtileBoxOld extends AbstractFtile {
XDimension2D dimRaw = tb.calculateDimension(stringBounder);
// dimRaw = Dimension2DDouble.delta(dimRaw, padding.getLeft() + padding.getRight(),
// padding.getBottom() + padding.getTop());
dimRaw = XDimension2D.atLeast(dimRaw, minimumWidth, 0);
dimRaw = dimRaw.atLeast(minimumWidth, 0);
return new FtileGeometry(dimRaw.getWidth() + boxStyle.getShield(), dimRaw.getHeight(), dimRaw.getWidth() / 2, 0,
dimRaw.getHeight());
}

View File

@ -109,9 +109,8 @@ public class FtileDiamondInside extends FtileDiamondWIP {
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
dim = new XDimension2D(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
} else {
dim = XDimension2D.delta(
XDimension2D.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
Hexagon.hexagonHalfSize * 2, 0);
dim = dimLabel.atLeast(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2)
.delta(Hexagon.hexagonHalfSize * 2, 0);
}
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
}

View File

@ -104,9 +104,8 @@ public class FtileDiamondInside2 extends FtileDiamondWIP {
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
dim = new XDimension2D(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
} else {
dim = XDimension2D.delta(
XDimension2D.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
Hexagon.hexagonHalfSize * 2, 0);
dim = dimLabel.atLeast(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2)
.delta(Hexagon.hexagonHalfSize * 2, 0);
}
return new FtileGeometry(dim, dim.getWidth() / 2, 0, dim.getHeight());
}

View File

@ -117,7 +117,7 @@ public class FtileDiamondSquare extends FtileDiamondWIP {
return new XDimension2D(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
XDimension2D result = dimLabel;
result = XDimension2D.delta(result, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
result = result.delta(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
return result;
}

View File

@ -61,11 +61,18 @@ abstract class FtileDiamondWIP extends AbstractFtile implements Styleable {
protected final TextBlock north;
protected final TextBlock south;
protected final TextBlock west;
protected final TextBlock east;
protected /* final */ TextBlock west;
protected /* final */ TextBlock east;
protected final double shadowing;
public void swapEastWest() {
final TextBlock tmp = this.west;
this.west = this.east;
this.east = tmp;
}
final public StyleSignatureBasic getStyleSignature() {
return StyleSignatureBasic.of(SName.root, SName.element, SName.activityDiagram, SName.activity, SName.diamond);
}

View File

@ -77,7 +77,7 @@ public class GtileAssembly extends GtileTopDown {
final XDimension2D raw = super.calculateDimension(stringBounder);
final double textBlockWidth = textBlock.calculateDimension(stringBounder).getWidth();
final double pos1 = tile1.getCoord(GPoint.SOUTH_HOOK).compose(getPos1()).getDx();
return XDimension2D.atLeast(raw, pos1 + textBlockWidth, 0);
return raw.atLeast(pos1 + textBlockWidth, 0);
}
protected final TextBlock getTextBlock(Display display) {

View File

@ -44,7 +44,6 @@ import net.sourceforge.plantuml.activitydiagram3.ftile.FtileGeometry;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -133,8 +132,7 @@ public class GtileBox extends AbstractGtile {
this.style = style;
this.boxStyle = boxStyle;
this.inRendering = LinkRendering
.create(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.inRendering = LinkRendering.create(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
final FontConfiguration fc = style.getFontConfiguration(getIHtmlColorSet());
@ -146,8 +144,7 @@ public class GtileBox extends AbstractGtile {
final LineBreakStrategy wrapWidth = style.wrapWidth();
this.minimumWidth = style.value(PName.MinimumWidth).asDouble();
final Sheet sheet = Parser
.build(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam.sheet(fc, skinParam.getDefaultTextAlignment(horizontalAlignment), CreoleMode.FULL)
.createSheet(label);
this.tb = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), new MyStencil(),
new UStroke(1));
@ -199,9 +196,8 @@ public class GtileBox extends AbstractGtile {
@Override
public final XDimension2D calculateDimension(StringBounder stringBounder) {
XDimension2D dimRaw = tb.calculateDimension(stringBounder);
dimRaw = XDimension2D.delta(dimRaw, padding.getLeft() + padding.getRight(),
padding.getBottom() + padding.getTop());
dimRaw = XDimension2D.atLeast(dimRaw, minimumWidth, 0);
dimRaw = dimRaw.delta(padding.getLeft() + padding.getRight(), padding.getBottom() + padding.getTop());
dimRaw = dimRaw.atLeast(minimumWidth, 0);
return new FtileGeometry(dimRaw.getWidth() + boxStyle.getShield(), dimRaw.getHeight(), dimRaw.getWidth() / 2, 0,
dimRaw.getHeight());
}

View File

@ -133,7 +133,7 @@ public class GtileGroup extends AbstractGtileRoot {
@Override
public XDimension2D calculateDimension(StringBounder stringBounder) {
final XDimension2D orig = inner.calculateDimension(stringBounder);
return XDimension2D.delta(orig, 18, suppHeight(stringBounder));
return orig.delta(18, suppHeight(stringBounder));
}
private double suppHeight(StringBounder stringBounder) {

View File

@ -101,9 +101,8 @@ public class GtileHexagonInside extends AbstractGtile {
if (dimLabel.getWidth() == 0 || dimLabel.getHeight() == 0) {
dim = new XDimension2D(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2);
} else {
dim = XDimension2D.delta(
XDimension2D.atLeast(dimLabel, Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2),
Hexagon.hexagonHalfSize * 2, 0);
dim = dimLabel.atLeast(Hexagon.hexagonHalfSize * 2, Hexagon.hexagonHalfSize * 2)
.delta(Hexagon.hexagonHalfSize * 2, 0);
}
return dim;
}

View File

@ -87,7 +87,7 @@ public class GtileIfAlone extends GtileTopDown3 {
@Override
public XDimension2D calculateDimension(StringBounder stringBounder) {
return XDimension2D.delta(super.calculateDimension(stringBounder), SUPP_WIDTH, 0);
return super.calculateDimension(stringBounder).delta(SUPP_WIDTH, 0);
}
@Override

View File

@ -162,7 +162,7 @@ public class GtileIfHexagon extends GtileColumns {
if (branches.size() == 2) {
final XDimension2D shape1Dim = shape1.calculateDimension(stringBounder);
final double shape1max = this.positionShape1.getDx() + shape1Dim.getWidth();
return XDimension2D.atLeast(rawDim, shape1max, 0);
return rawDim.atLeast(shape1max, 0);
}
// return MathUtils.max(rawDim, shape1Dim);
@ -173,7 +173,7 @@ public class GtileIfHexagon extends GtileColumns {
final double height2 = shape2.calculateDimension(stringBounder).getHeight();
final XDimension2D nude = super.calculateDimension(stringBounder);
// +30 to be done only when branches.size()==1 ?
return XDimension2D.delta(nude, 0, height2 + 30);
return nude.delta(0, height2 + 30);
}
final public StyleSignatureBasic getDefaultStyleDefinitionActivity() {

View File

@ -95,7 +95,7 @@ public class GtileRepeat extends GtileTopDown3 {
@Override
public XDimension2D calculateDimension(StringBounder stringBounder) {
return XDimension2D.delta(super.calculateDimension(stringBounder), SUPP_WIDTH, 0);
return super.calculateDimension(stringBounder).delta(SUPP_WIDTH, 0);
}
@Override

View File

@ -90,7 +90,7 @@ public class GtileSplit extends GtileColumns {
@Override
public XDimension2D calculateDimension(StringBounder stringBounder) {
return XDimension2D.delta(super.calculateDimension(stringBounder), 0, 0);
return super.calculateDimension(stringBounder).delta(0, 0);
}
// @Override

View File

@ -73,7 +73,7 @@ public class GtileWithMargin extends AbstractGtileRoot implements Gtile {
@Override
public XDimension2D calculateDimension(StringBounder stringBounder) {
final XDimension2D result = orig.calculateDimension(stringBounder);
return XDimension2D.delta(result, east, north + south);
return result.delta(east, north + south);
}
private UTranslate getTranslate() {

View File

@ -44,7 +44,6 @@ import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -117,7 +116,7 @@ public class GtileWithNoteOpale extends AbstractGtile implements Stencil, Stylea
final HorizontalAlignment align = skinParam.getHorizontalAlignment(AlignmentParam.noteTextAlignment, null,
false, null);
final Sheet sheet = Parser.build(fc, align, skinParam, CreoleMode.FULL).createSheet(note.getDisplay());
final Sheet sheet = skinParam.sheet(fc, align, CreoleMode.FULL).createSheet(note.getDisplay());
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this,
new UStroke(1));
this.opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, withLink, stroke);

View File

@ -44,7 +44,6 @@ import net.sourceforge.plantuml.activitydiagram3.PositionedNote;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.awt.geom.XDimension2D;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -116,8 +115,8 @@ public class GtileWithNotes extends AbstractGtile {
final LineBreakStrategy wrapWidth = style.wrapWidth();
final UStroke stroke = style.getStroke();
final Sheet sheet = Parser
.build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam
.sheet(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
.createSheet(note.getDisplay());
final SheetBlock1 sheet1 = new SheetBlock1(sheet, wrapWidth, skinParam.getPadding());
final SheetBlock2 sheet2 = new SheetBlock2(sheet1, new Stencil() {

View File

@ -40,7 +40,6 @@ import net.sourceforge.plantuml.LineBreakStrategy;
import net.sourceforge.plantuml.activitydiagram3.ftile.Hexagon;
import net.sourceforge.plantuml.activitydiagram3.ftile.Swimlane;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.creole.Parser;
import net.sourceforge.plantuml.creole.Sheet;
import net.sourceforge.plantuml.creole.SheetBlock1;
import net.sourceforge.plantuml.creole.SheetBlock2;
@ -68,8 +67,8 @@ public class Gtiles {
: color;
final FontConfiguration fcTest = style.getFontConfiguration(skinParam.getIHtmlColorSet());
final Sheet sheet = Parser
.build(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
final Sheet sheet = skinParam
.sheet(fcTest, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), CreoleMode.FULL)
.createSheet(label);
final SheetBlock1 sheetBlock1 = new SheetBlock1(sheet, LineBreakStrategy.NONE, skinParam.getPadding());
final TextBlock tbTest = new SheetBlock2(sheetBlock1, Hexagon.asStencil(sheetBlock1), new UStroke());

View File

@ -69,54 +69,44 @@ public class XDimension2D {
return width;
}
public static XDimension2D delta(XDimension2D dim, double delta) {
return delta(dim, delta, delta);
public XDimension2D delta(double delta) {
return this.delta(delta, delta);
}
public XDimension2D withWidth(double newWidth) {
return new XDimension2D(newWidth, height);
}
public static XDimension2D delta(XDimension2D dim, double deltaWidth, double deltaHeight) {
public XDimension2D delta(double deltaWidth, double deltaHeight) {
if (deltaHeight == 0 && deltaWidth == 0)
return dim;
return this;
return new XDimension2D(dim.getWidth() + deltaWidth, dim.getHeight() + deltaHeight);
return new XDimension2D(getWidth() + deltaWidth, getHeight() + deltaHeight);
}
public static XDimension2D mergeTB(XDimension2D top, XDimension2D bottom) {
final double width = Math.max(top.getWidth(), bottom.getWidth());
final double height = top.getHeight() + bottom.getHeight();
public XDimension2D mergeTB(XDimension2D bottom) {
final double width = Math.max(this.getWidth(), bottom.getWidth());
final double height = this.getHeight() + bottom.getHeight();
return new XDimension2D(width, height);
}
public static XDimension2D mergeTB(XDimension2D a, XDimension2D b, XDimension2D c) {
final double width = MathUtils.max(a.getWidth(), b.getWidth(), c.getWidth());
final double height = a.getHeight() + b.getHeight() + c.getHeight();
public XDimension2D mergeTB(XDimension2D b, XDimension2D c) {
final double width = MathUtils.max(this.getWidth(), b.getWidth(), c.getWidth());
final double height = this.getHeight() + b.getHeight() + c.getHeight();
return new XDimension2D(width, height);
}
public static XDimension2D mergeLR(XDimension2D left, XDimension2D right) {
final double height = Math.max(left.getHeight(), right.getHeight());
final double width = left.getWidth() + right.getWidth();
public XDimension2D mergeLR(XDimension2D right) {
final double height = Math.max(this.getHeight(), right.getHeight());
final double width = this.getWidth() + right.getWidth();
return new XDimension2D(width, height);
}
public static XDimension2D mergeLayoutT12B3(XDimension2D top1, XDimension2D top2, XDimension2D bottom) {
final double width = MathUtils.max(top1.getWidth(), top2.getWidth(), bottom.getWidth());
final double height = top1.getHeight() + top2.getHeight() + bottom.getHeight();
return new XDimension2D(width, height);
}
public static XDimension2D max(XDimension2D dim1, XDimension2D dim2) {
return atLeast(dim1, dim2.getWidth(), dim2.getHeight());
}
public static XDimension2D atLeast(XDimension2D dim, double minWidth, double minHeight) {
double h = dim.getHeight();
double w = dim.getWidth();
public XDimension2D atLeast(double minWidth, double minHeight) {
double h = getHeight();
double w = getWidth();
if (w > minWidth && h > minHeight)
return dim;
return this;
if (h < minHeight)
h = minHeight;
@ -131,4 +121,14 @@ public class XDimension2D {
return new XDimension2D(dimension.getWidth(), dimension.getHeight());
}
public static XDimension2D mergeLayoutT12B3(XDimension2D top1, XDimension2D top2, XDimension2D bottom) {
final double width = MathUtils.max(top1.getWidth(), top2.getWidth(), bottom.getWidth());
final double height = top1.getHeight() + top2.getHeight() + bottom.getHeight();
return new XDimension2D(width, height);
}
public static XDimension2D max(XDimension2D dim1, XDimension2D dim2) {
return dim1.atLeast(dim2.getWidth(), dim2.getHeight());
}
}

View File

@ -0,0 +1,100 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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.baraye;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Plasma {
private String separator;
private final Quark root;
private final Map<List<String>, Quark> quarks = new HashMap<>();
public Plasma(String separator) {
final List<String> empty = Collections.emptyList();
this.root = ensurePresent(empty);
this.separator = separator;
}
public Quark root() {
return root;
}
public final String getSeparator() {
return separator;
}
public final void setSeparator(String separator) {
this.separator = separator;
}
public Quark parse(Quark root, String full) {
final List<String> result = root.getSignature();
while (true) {
int idx = full.indexOf(separator);
if (idx == -1) {
result.add(full);
return ensurePresent(result);
}
if (idx > 0) {
result.add(full.substring(0, idx));
ensurePresent(result);
}
full = full.substring(idx + separator.length());
}
}
Quark ensurePresent(List<String> result) {
Quark quark = quarks.get(result);
if (quark == null) {
quark = new Quark(this, result);
quarks.put(result, quark);
}
return quark;
}
public Collection<Quark> quarks() {
return Collections.unmodifiableCollection(quarks.values());
}
}

View File

@ -0,0 +1,143 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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.baraye;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.plantuml.cucadiagram.Code;
public class Quark implements Code {
private final Plasma plasma;
private final List<String> parts;
private Object data;
Quark(Plasma plasma, List<String> parts) {
this.plasma = plasma;
this.parts = new ArrayList<String>(parts);
}
public Quark getParent() {
if (parts.size() == 0)
return null;
return plasma.ensurePresent(parts.subList(0, parts.size() - 1));
}
@Override
public String toString() {
return parts.toString();
}
public List<String> getSignature() {
return new ArrayList<>(parts);
}
public boolean containsLarge(Quark other) {
return other.parts.size() > this.parts.size() && other.parts.subList(0, this.parts.size()).equals(this.parts);
}
// @Override
// public boolean equals(Object obj) {
// final Quark other = (Quark) obj;
// if (this.plasma != other.plasma)
// throw new IllegalArgumentException();
// return this.parts.equals(other.parts);
// }
//
// @Override
// public int hashCode() {
// return parts.hashCode();
// }
public boolean startsWith(Quark other) {
if (other.parts.size() > this.parts.size())
return false;
for (int i = 0; i < other.parts.size(); i++)
if (other.parts.get(i).equals(this.parts.get(i)) == false)
return false;
return true;
}
public String toString(String sep) {
if (sep == null)
sep = ".";
final StringBuilder sb = new StringBuilder();
for (String s : parts) {
if (sb.length() > 0)
sb.append(sep);
sb.append(s);
}
return sb.toString();
}
public String getName() {
if (parts.size() == 0)
return "";
return parts.get(parts.size() - 1);
}
public boolean isRoot() {
return parts.size() == 0;
}
// public int size() {
// return parts.size();
// }
public final Plasma getPlasma() {
return plasma;
}
public final Object getData() {
return data;
}
public final void setData(Object data) {
this.data = data;
}
@Override
public Code eventuallyRemoveStartingAndEndingDoubleQuote(String format) {
throw new UnsupportedOperationException();
}
}

View File

@ -33,7 +33,7 @@
*
*
*/
package net.sourceforge.plantuml.cucadiagram;
package net.sourceforge.plantuml.baraye.a;
import java.io.IOException;
import java.io.OutputStream;
@ -58,8 +58,27 @@ import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.creole.CreoleMode;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CodeImpl;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityGender;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkConstraint;
import net.sourceforge.plantuml.cucadiagram.Magma;
import net.sourceforge.plantuml.cucadiagram.MagmaList;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramTxtMaker;
import net.sourceforge.plantuml.cucadiagram.entity.EntityFactory;
import net.sourceforge.plantuml.cucadiagram.entity.IEntityFactory;
import net.sourceforge.plantuml.elk.CucaDiagramFileMakerElk;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphml.CucaDiagramGraphmlMaker;
@ -73,7 +92,7 @@ import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek;
import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker;
import net.sourceforge.plantuml.xmlsc.StateDiagramScxmlMaker;
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower {
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower, ICucaDiagram {
static private final boolean G1972 = false;
@ -101,10 +120,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return this.V1972() && this.getUmlDiagramType() == UmlDiagramType.CLASS;
}
public Set<SuperGroup> getAllSuperGroups() {
return entityFactory.getAllSuperGroups();
}
private final List<HideOrShow2> hides2 = new ArrayList<>();
private final List<HideOrShow2> removed = new ArrayList<>();
protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
@ -499,10 +514,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return entityFactory.getRootGroup();
}
public SuperGroup getRootSuperGroup() {
return entityFactory.getRootSuperGroup();
}
public final Collection<ILeaf> getLeafsvalues() {
return entityFactory.leafs2();
}
@ -607,8 +618,6 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
throw new UnsupportedOperationException();
}
entityFactory.buildSuperGroups();
final CucaDiagramFileMaker maker;
if (this.isUseElk())
maker = new CucaDiagramFileMakerElk(this, fileFormatOption.getDefaultStringBounder(getSkinParam()));
@ -838,6 +847,10 @@ public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy,
return lastEntity;
}
final public IEntityFactory getIEntityFactory() {
return entityFactory;
}
final public EntityFactory getEntityFactory() {
return entityFactory;
}

View File

@ -33,7 +33,7 @@
*
*
*/
package net.sourceforge.plantuml.cucadiagram.entity;
package net.sourceforge.plantuml.baraye.a;
import java.util.ArrayList;
import java.util.Collection;
@ -54,36 +54,32 @@ import net.sourceforge.plantuml.cucadiagram.BodierJSon;
import net.sourceforge.plantuml.cucadiagram.BodierMap;
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.SuperGroup;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.entity.IEntityFactory;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.skin.VisibilityModifier;
public final class EntityFactory {
public final class EntityFactory implements IEntityFactory {
private final Map<String, ILeaf> leafsByCode;
private final Map<String, IGroup> groupsByCode;
/* private */final Map<Ident, ILeaf> leafs2 = new LinkedHashMap<Ident, ILeaf>();
/* private */final Map<Ident, IGroup> groups2 = new LinkedHashMap<Ident, IGroup>();
/* private */public final Map<Ident, ILeaf> leafs2 = new LinkedHashMap<Ident, ILeaf>();
/* private */public final Map<Ident, IGroup> groups2 = new LinkedHashMap<Ident, IGroup>();
private final List<Link> links = new ArrayList<>();
private int rawLayout;
private final IGroup rootGroup = new GroupRoot(this);
private final SuperGroup rootSuperGroup = new SuperGroup(rootGroup);
private final List<HideOrShow2> hides2;
private final List<HideOrShow2> removed;
@ -95,30 +91,10 @@ public final class EntityFactory {
return emptyGroupsAsNode.get(g);
}
public SuperGroup getRootSuperGroup() {
return rootSuperGroup;
}
private Set<SuperGroup> superGroups = null;
final Map<IGroup, SuperGroup> groupToSuper = new LinkedHashMap<IGroup, SuperGroup>();
public Set<SuperGroup> getAllSuperGroups() {
return Collections.unmodifiableSet(superGroups);
}
public void buildSuperGroups() {
superGroups = new HashSet<>();
for (IGroup g : groups2.values()) {
final SuperGroup sg = new SuperGroup(g);
superGroups.add(sg);
groupToSuper.put(g, sg);
}
}
public ILeaf createLeafForEmptyGroup(IGroup g, ISkinParam skinParam) {
final ILeaf folder = this.createLeaf(g.getIdent(), g.getCode(), g.getDisplay(), LeafType.EMPTY_PACKAGE,
g.getParentContainer(), null, this.namespaceSeparator.getNamespaceSeparator());
((EntityImpl) folder).setOriginalGroup(g);
((EntityImp) folder).setOriginalGroup(g);
final USymbol symbol = g.getUSymbol();
folder.setUSymbol(symbol);
folder.setStereotype(g.getStereotype());
@ -128,17 +104,6 @@ public final class EntityFactory {
for (Stereotag tag : g.stereotags())
folder.addStereotag(tag);
// if (UseStyle.useBetaStyle()) {
// // System.err.println("Backcolor ?");
// } else {
// if (g.getColors().getColor(ColorType.BACK) == null) {
// final ColorParam param = symbol == null ? ColorParam.packageBackground : symbol.getColorParamBack();
// final HColor c1 = skinParam.getHtmlColor(param, g.getStereotype(), false);
// folder.setSpecificColorTOBEREMOVED(ColorType.BACK, c1 == null ? skinParam.getBackgroundColor() : c1);
// } else {
// folder.setSpecificColorTOBEREMOVED(ColorType.BACK, g.getColors().getColor(ColorType.BACK));
// }
// }
emptyGroupsAsNode.put(g, folder);
return folder;
}
@ -173,7 +138,7 @@ public final class EntityFactory {
if (link.contains(parent))
return null;
((EntityImpl) g).setIntricated(true);
((EntityImp) g).setIntricated(true);
hiddenBecauseOfIntrication.add(parent.getIdent());
return g;
}
@ -207,6 +172,14 @@ public final class EntityFactory {
return hidden;
}
public boolean isRemoved(Stereotype stereotype) {
boolean result = false;
for (HideOrShow2 hide : removed)
result = hide.apply(result, stereotype);
return result;
}
public boolean isRemoved(ILeaf leaf) {
final IEntity other = isNoteWithSingleLinkAttachedTo(leaf);
if (other instanceof ILeaf)
@ -255,7 +228,7 @@ public final class EntityFactory {
else
bodier = BodyFactory.createLeaf(entityType, hides);
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, entityType,
final EntityImp result = new EntityImp(ident, code, this, bodier, parentContainer, entityType,
namespaceSeparator, rawLayout);
bodier.setLeaf(result);
result.setDisplay(display);
@ -270,7 +243,7 @@ public final class EntityFactory {
return ent.getValue();
final Bodier bodier = BodyFactory.createGroup(hides);
final EntityImpl result = new EntityImpl(ident, code, this, bodier, parentContainer, groupType, namespace,
final EntityImp result = new EntityImp(ident, code, this, bodier, parentContainer, groupType, namespace,
namespaceSeparator, rawLayout);
if (Display.isNull(display) == false)
result.setDisplay(display);
@ -300,7 +273,7 @@ public final class EntityFactory {
getParentContainer(ident, null);
}
void removeGroup(String name) {
public /* private */ void removeGroup(String name) {
if (namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final IEntity removed = Objects.requireNonNull(groupsByCode.remove(name));
@ -310,7 +283,7 @@ public final class EntityFactory {
}
}
void removeGroup(Ident ident) {
public /* private */ void removeGroup(Ident ident) {
Objects.requireNonNull(groups2.remove(Objects.requireNonNull(ident)));
}
@ -320,7 +293,7 @@ public final class EntityFactory {
// throw new IllegalArgumentException();
}
void removeLeaf(String name) {
public /* private */ void removeLeaf(String name) {
if (namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final IEntity removed = Objects.requireNonNull(leafsByCode.remove(Objects.requireNonNull(name)));
@ -330,7 +303,7 @@ public final class EntityFactory {
}
}
void removeLeaf(Ident ident) {
public /* private */ void removeLeaf(Ident ident) {
final IEntity removed = leafs2.remove(Objects.requireNonNull(ident));
if (removed == null) {
System.err.println("leafs2=" + leafs2.keySet());
@ -350,7 +323,7 @@ public final class EntityFactory {
if (namespaceSeparator.V1972())
throw new UnsupportedOperationException();
final ILeaf leaf = leafsByCode.get(name);
((EntityImpl) leaf).muteToGroup(namespace, type, parent);
((EntityImp) leaf).muteToGroup(namespace, type, parent);
final IGroup result = (IGroup) leaf;
removeLeaf(name);
return result;
@ -364,7 +337,7 @@ public final class EntityFactory {
leaf = getLeafVerySmart(ident);
else
leaf = leafs2.get(ident);
((EntityImpl) leaf).muteToGroup(namespace, type, parent);
((EntityImp) leaf).muteToGroup(namespace, type, parent);
final IGroup result = (IGroup) leaf;
removeLeaf1972(leaf);
return result;

View File

@ -34,7 +34,7 @@
* Contribution: Miguel Esteves
*
*/
package net.sourceforge.plantuml.cucadiagram.entity;
package net.sourceforge.plantuml.baraye.a;
import java.util.ArrayList;
import java.util.Collection;
@ -58,7 +58,6 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
import net.sourceforge.plantuml.cucadiagram.CucaNote;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositioned;
@ -66,8 +65,6 @@ import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.GroupRoot;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -94,7 +91,7 @@ import net.sourceforge.plantuml.svek.image.EntityImageStateCommon;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.color.HColor;
final public class EntityImpl implements ILeaf, IGroup {
final public class EntityImp implements ILeaf, IGroup {
private final EntityFactory entityFactory;
@ -161,7 +158,7 @@ final public class EntityImpl implements ILeaf, IGroup {
}
// Back to Entity
private EntityImpl(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
private EntityImp(Ident ident, EntityFactory entityFactory, Code code, Bodier bodier, IGroup parentContainer,
String namespaceSeparator, int rawLayout) {
this.ident = Objects.requireNonNull(ident);
this.uid = StringUtils.getUid("cl", entityFactory.getDiagram().getUniqueSequence());
@ -175,8 +172,8 @@ final public class EntityImpl implements ILeaf, IGroup {
this.rawLayout = rawLayout;
}
EntityImpl(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
LeafType leafType, String namespaceSeparator, int rawLayout) {
public EntityImp(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier,
IGroup parentContainer, LeafType leafType, String namespaceSeparator, int rawLayout) {
this(Objects.requireNonNull(ident), entityFactory, code, bodier, parentContainer, namespaceSeparator,
rawLayout);
// System.err.println("ID for leaf=" + code + " " + ident);
@ -184,7 +181,7 @@ final public class EntityImpl implements ILeaf, IGroup {
this.leafType = leafType;
}
EntityImpl(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
public EntityImp(Ident ident, Code code, EntityFactory entityFactory, Bodier bodier, IGroup parentContainer,
GroupType groupType, Code namespace, String namespaceSeparator, int rawLayout) {
this(Objects.requireNonNull(ident), entityFactory, code, bodier, parentContainer, namespaceSeparator,
rawLayout);
@ -429,7 +426,7 @@ final public class EntityImpl implements ILeaf, IGroup {
throw new UnsupportedOperationException();
for (ILeaf ent : getLeafsDirect())
((EntityImpl) ent).parentContainer = dest;
((EntityImp) ent).parentContainer = dest;
for (IGroup g : dest.getChildren())
// ((EntityImpl) g).parentContainer = dest;
@ -439,7 +436,7 @@ final public class EntityImpl implements ILeaf, IGroup {
if (g == dest)
continue;
((EntityImpl) g).parentContainer = dest;
((EntityImp) g).parentContainer = dest;
}
}
@ -468,8 +465,8 @@ final public class EntityImpl implements ILeaf, IGroup {
entityFactory.leafs2.remove(ident);
ident = ident.move(firstIdent, destIdent);
// System.err.println(" to ident2=" + ident);
((EntityImpl) ent).ident = ident;
((EntityImpl) ent).code = ident;
((EntityImp) ent).ident = ident;
((EntityImp) ent).code = ident;
entityFactory.leafs2.put(ident, ent);
}
}
@ -486,8 +483,8 @@ final public class EntityImpl implements ILeaf, IGroup {
entityFactory.groups2.remove(ident);
ident = ident.move(firstIdent, destIdent);
// System.err.println(" to ident2=" + ident);
((EntityImpl) ent).ident = ident;
((EntityImpl) ent).code = ident;
((EntityImp) ent).ident = ident;
((EntityImp) ent).code = ident;
entityFactory.groups2.put(ident, ent);
// System.err.println("-->groups2=" + entityFactory.groups2());
}
@ -574,7 +571,7 @@ final public class EntityImpl implements ILeaf, IGroup {
this.leafType = leafType;
}
void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
public /* private */ void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
checkNotGroup();
if (parentContainer.isGroup() == false)
throw new IllegalArgumentException();
@ -619,11 +616,11 @@ final public class EntityImpl implements ILeaf, IGroup {
return false;
for (ILeaf leaf : getLeafsDirect())
if (((EntityImpl) leaf).isHiddenInternal() == false)
if (((EntityImp) leaf).isHiddenInternal() == false)
return false;
for (IGroup g : getChildren())
if (((EntityImpl) g).isHiddenInternal() == false)
if (((EntityImp) g).isHiddenInternal() == false)
return false;
return true;
@ -647,11 +644,11 @@ final public class EntityImpl implements ILeaf, IGroup {
return false;
for (ILeaf leaf : getLeafsDirect())
if (((EntityImpl) leaf).isRemovedInternal() == false)
if (((EntityImp) leaf).isRemovedInternal() == false)
return false;
for (IGroup g : getChildren())
if (((EntityImpl) g).isRemovedInternal() == false)
if (((EntityImp) g).isRemovedInternal() == false)
return false;
return true;

View File

@ -33,7 +33,7 @@
* Contribution: Miguel Esteves
*
*/
package net.sourceforge.plantuml.cucadiagram;
package net.sourceforge.plantuml.baraye.a;
import java.util.List;
import java.util.Map;
@ -46,6 +46,16 @@ import net.sourceforge.plantuml.Removeable;
import net.sourceforge.plantuml.SpecificBackcolorable;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaNote;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.Colors;

View File

@ -33,11 +33,15 @@
*
*
*/
package net.sourceforge.plantuml.cucadiagram;
package net.sourceforge.plantuml.baraye.a;
import java.util.Collection;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.DisplayPositioned;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.PackageStyle;

View File

@ -33,10 +33,11 @@
*
*
*/
package net.sourceforge.plantuml.cucadiagram;
package net.sourceforge.plantuml.baraye.a;
import java.util.Collection;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.skin.VisibilityModifier;
@ -45,8 +46,6 @@ import net.sourceforge.plantuml.svek.Margins;
public interface ILeaf extends IEntity {
public EntityPosition getEntityPosition();
public void setContainer(IGroup container);
public Margins getMargins();

View File

@ -0,0 +1,940 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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.baraye.b;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import net.sourceforge.plantuml.BackSlash;
import net.sourceforge.plantuml.FileFormat;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.api.ImageDataSimple;
import net.sourceforge.plantuml.baraye.a.EntityFactory;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.baraye.a.ILeaf;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CodeImpl;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityGender;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.GroupHierarchy;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkConstraint;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.PortionShower;
import net.sourceforge.plantuml.cucadiagram.dot.CucaDiagramTxtMaker;
import net.sourceforge.plantuml.cucadiagram.entity.IEntityFactory;
import net.sourceforge.plantuml.elk.CucaDiagramFileMakerElk;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphml.CucaDiagramGraphmlMaker;
import net.sourceforge.plantuml.sdot.CucaDiagramFileMakerSmetana;
import net.sourceforge.plantuml.security.SecurityUtils;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.svek.CucaDiagramFileMaker;
import net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek;
import net.sourceforge.plantuml.xmi.CucaDiagramXmiMaker;
public abstract class CucaDiagram extends UmlDiagram implements GroupHierarchy, PortionShower, ICucaDiagram {
static private final boolean G1972 = false;
// private String namespaceSeparator = ".";
// private String namespaceSeparator1 = GO1972 ? "::" : ".";
private String namespaceSeparator = null;
private boolean namespaceSeparatorHasBeenSet = false;
public final boolean V1972() {
return false;
}
public final boolean mergeIntricated() {
if (getNamespaceSeparator() == null) {
return false;
}
return this.V1972() && this.getUmlDiagramType() == UmlDiagramType.CLASS;
}
private final List<HideOrShow2> hides2 = new ArrayList<>();
private final List<HideOrShow2> removed = new ArrayList<>();
protected final ZEntityFactory entityFactory = new ZEntityFactory(hides2, removed, this);
// protected final EntityFactory entityFactory = new EntityFactory(hides2, removed, this);
// protected final EntityFactory entityFactory = null;
// private IGroup currentGroup = entityFactory.getRootGroup();
private List<Ident> stacks2 = new ArrayList<>();
private List<IGroup> stacks = new ArrayList<>();
private boolean visibilityModifierPresent;
public abstract IEntity getOrCreateLeaf(Ident ident, Code code, LeafType type, USymbol symbol);
public Ident cleanIdent(Ident ident) {
return ident;
}
public CucaDiagram(UmlSource source, UmlDiagramType type, Map<String, String> orig) {
super(source, type, orig);
this.stacks2.add(Ident.empty());
}
private Ident getLastID() {
if (stacks2.size() == 0) {
// Thread.dumpStack();
return Ident.empty();
// throw new IllegalArgumentException();
}
return this.stacks2.get(stacks2.size() - 1);
}
final public void setNamespaceSeparator(String namespaceSeparator) {
this.namespaceSeparatorHasBeenSet = true;
this.namespaceSeparator = namespaceSeparator;
}
final public String getNamespaceSeparator() {
if (namespaceSeparatorHasBeenSet == false)
return V1972() ? "::" : ".";
return namespaceSeparator;
}
@Override
public boolean hasUrl() {
// for (IEntity entity : getGroups(true))
// if (entity.hasUrl())
// return true;
//
// for (IEntity entity : entityFactory.leafs())
// if (entity.hasUrl())
// return true;
//
// for (Link link : getLinks())
// if (link.hasUrl())
// return true;
return false;
}
final public void setLastEntity(ILeaf foo) {
this.lastEntity = foo;
}
final protected ILeaf getOrCreateLeafDefault(Ident idNewLong, Code code, LeafType type, USymbol symbol) {
Objects.requireNonNull(idNewLong);
Objects.requireNonNull(type);
throw new UnsupportedOperationException();
// ILeaf result;
// if (this.V1972())
// result = entityFactory.getLeafStrict(idNewLong);
// else
// result = entityFactory.getLeaf(code);
//
// if (result == null) {
// result = createLeafInternal(idNewLong, code, Display.getWithNewlines(code), type, symbol);
// result.setUSymbol(symbol);
// }
//
// if (result.getLeafType() == LeafType.CLASS && type == LeafType.OBJECT)
// if (result.muteToType(type, symbol) == false)
// return null;
//
// this.lastEntity = result;
// return result;
}
public ILeaf createLeaf(Ident idNewLong, Code code, Display display, LeafType type, USymbol symbol) {
Objects.requireNonNull(idNewLong);
throw new UnsupportedOperationException();
// if (entityFactory.getLeafStrict(idNewLong) != null) {
// return null;
// }
// return createLeafInternal(idNewLong, code, display, type, symbol);
}
final protected ILeaf createLeafInternal(Ident newIdent, Code code, Display display, LeafType type,
USymbol symbol) {
Objects.requireNonNull(newIdent);
throw new UnsupportedOperationException();
// if (Display.isNull(display))
// display = Display.getWithNewlines(code).withCreoleMode(CreoleMode.SIMPLE_LINE);
//
// final ILeaf leaf = entityFactory.createLeaf(newIdent, code, display, type, getCurrentGroup(), getHides(),
// getNamespaceSeparator());
// entityFactory.addLeaf(leaf);
// this.lastEntity = leaf;
// leaf.setUSymbol(symbol);
// return leaf;
}
final public Ident buildLeafIdent(String id) {
return getLastID().add(id, getNamespaceSeparator());
}
final public Ident buildLeafIdentSpecial(String id) {
return buildFullyQualified(id);
}
private Ident buildLeafIdentSpecialUnused(String id) {
// if (namespaceSeparator != null) {
// if (id.contains(namespaceSeparator)) {
return Ident.empty().add(id, ".");
// }
// }
// return getLastID().add(id, namespaceSeparator);
}
final public Ident buildFullyQualified(String id) {
throw new UnsupportedOperationException();
// return entityFactory.buildFullyQualified(getLastID(), Ident.empty().add(id, getNamespaceSeparator()));
}
final public Code buildCode(String s) {
if (this.V1972())
throw new UnsupportedOperationException();
return CodeImpl.of(s);
}
public boolean leafExist(Code code) {
throw new UnsupportedOperationException();
// if (this.V1972())
// throw new UnsupportedOperationException();
// return entityFactory.getLeaf(code) != null;
}
public boolean leafExistSmart(Ident ident) {
throw new UnsupportedOperationException();
// return entityFactory.getLeafSmart(ident) != null;
}
public boolean leafExistStrict(Ident ident) {
throw new UnsupportedOperationException();
// return entityFactory.getLeafStrict(ident) != null;
}
final public Collection<IGroup> getChildrenGroups(IGroup parent) {
if (this.V1972())
return getChildrenGroupsIdent1972(parent);
final Collection<IGroup> result = new ArrayList<>();
for (IGroup gg : getGroups(false))
if (gg.getParentContainer() == parent)
result.add(gg);
return Collections.unmodifiableCollection(result);
}
private Collection<IGroup> getChildrenGroupsIdent1972(IGroup parent) {
throw new UnsupportedOperationException();
// final Collection<IGroup> result = new ArrayList<>();
// for (IGroup gg : entityFactory.groups2())
// if (gg.getIdent().parent().equals(parent.getIdent()))
// result.add(gg);
//
// return Collections.unmodifiableCollection(result);
}
final public void gotoGroup(Ident ident, Code code, Display display, GroupType type, IGroup parent,
NamespaceStrategy strategy) {
if (this.V1972()) {
gotoGroupInternalWithNamespace(ident, code, display, code, type, parent);
return;
}
if (strategy == NamespaceStrategy.MULTIPLE) {
if (getNamespaceSeparator() != null)
code = getFullyQualifiedCode1972(code);
gotoGroupInternalWithNamespace(ident, code, display, code, type, parent);
} else if (strategy == NamespaceStrategy.SINGLE) {
final Ident newIdLong = buildLeafIdentSpecial(ident.toString(this.getNamespaceSeparator()));
gotoGroupExternal(newIdLong, code, display, null, type, parent);
stacks2.add(newIdLong);
} else {
throw new IllegalArgumentException();
}
}
protected final String getNamespace1972(Code fullyCode, String separator) {
throw new UnsupportedOperationException();
// String name = fullyCode.getName();
// Objects.requireNonNull(separator);
// do {
// final int x = name.lastIndexOf(separator);
// if (x == -1)
// return null;
//
// name = name.substring(0, x);
// } while (entityFactory.getLeaf(buildCode(name)) != null);
// return name;
}
private void gotoGroupInternalWithNamespace(Ident idNewLong, Code code, Display display, Code namespaceNew,
GroupType type, IGroup parent) {
throw new UnsupportedOperationException();
// this.stacks.add(currentGroup);
// this.stacks2.add(idNewLong);
//
// if (this.V1972()) {
// gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
// return;
// }
// if (getNamespaceSeparator() == null) {
// gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
// return;
// }
//
// final String namespaceCurrent = getNamespace1972(code, getNamespaceSeparator());
// if (namespaceCurrent == null) {
// gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
// return;
// }
// final IGroup realParent = entityFactory.getGroup(buildCode(namespaceCurrent));
// if (realParent == null) {
// gotoGroupInternal(idNewLong, code, display, namespaceNew, type, parent);
// return;
// }
// display = Display.create(idNewLong.getLast());
// IGroup result = entityFactory.createGroup(idNewLong, code, display, namespaceNew, type, realParent, getHides(),
// getNamespaceSeparator());
//
// entityFactory.addGroup(result);
// currentGroup = result;
}
public void endGroup() {
throw new UnsupportedOperationException();
// if (stacks2.size() > 0) {
// // Thread.dumpStack();
// stacks2.remove(stacks2.size() - 1);
// }
// if (EntityUtils.groupRoot(currentGroup)) {
// Log.error("No parent group");
// return;
// }
// if (stacks.size() > 0)
// currentGroup = stacks.remove(stacks.size() - 1);
// else
// currentGroup = currentGroup.getParentContainer();
}
private void gotoGroupInternal(Ident idNewLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) {
throw new UnsupportedOperationException();
// if (this.V1972()) {
// gotoGroupInternal1972(idNewLong, code, display, namespace, type, parent);
// return;
// }
//
// IGroup result = entityFactory.getGroup(code);
// if (result != null) {
// currentGroup = result;
// return;
// }
// if (entityFactory.getLeafStrict(idNewLong) != null) {
// result = entityFactory.muteToGroup(code.getName(), namespace, type, parent);
// result.setDisplay(display);
// } else {
// result = entityFactory.createGroup(idNewLong, code, display, namespace, type, parent, getHides(),
// getNamespaceSeparator());
// }
// entityFactory.addGroup(result);
// currentGroup = result;
}
private void gotoGroupInternal1972(Ident idNewLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) {
throw new UnsupportedOperationException();
// IGroup result = entityFactory.getGroupStrict(idNewLong);
// if (result != null) {
// currentGroup = result;
// return;
// }
// final boolean mutation;
// if (getNamespaceSeparator() == null)
// mutation = entityFactory.getLeafVerySmart(idNewLong) != null;
// else
// mutation = entityFactory.getLeafStrict(idNewLong) != null;
// if (mutation) {
// result = entityFactory.muteToGroup1972(idNewLong, namespace, type, parent);
// result.setDisplay(display);
// } else {
// result = entityFactory.createGroup(idNewLong, code, display, namespace, type, parent, getHides(),
// getNamespaceSeparator());
// }
// entityFactory.addGroup(result);
// currentGroup = result;
// stacks2.set(stacks2.size() - 1, result.getIdent());
}
final protected void gotoGroupExternal(Ident newIdLong, final Code code, Display display, final Code namespace,
GroupType type, IGroup parent) {
throw new UnsupportedOperationException();
// IGroup result = entityFactory.getGroup(code);
// if (result != null) {
// currentGroup = result;
// return;
// }
// if (entityFactory.getLeaf(code) != null) {
// result = entityFactory.muteToGroup(code.getName(), namespace, type, parent);
// result.setDisplay(display);
// } else {
// result = entityFactory.createGroup(newIdLong, code, display, namespace, type, parent, getHides(),
// getNamespaceSeparator());
// }
// entityFactory.addGroup(result);
// // entityFactory.thisIsNotArealGroup(newIdLong);
// currentGroup = result;
}
public final void gotoThisGroup(IGroup group) {
throw new UnsupportedOperationException();
// currentGroup = group;
}
final protected Code getFullyQualifiedCode1972(Code code) {
throw new UnsupportedOperationException();
// final String separator = Objects.requireNonNull(getNamespaceSeparator());
// final String full = code.getName();
// if (full.startsWith(separator))
// return buildCode(full.substring(separator.length()));
//
// if (full.contains(separator))
// return buildCode(full);
//
// if (EntityUtils.groupRoot(currentGroup))
// return buildCode(full);
//
// final Code namespace = currentGroup.getNamespace();
// if (namespace == null)
// return buildCode(full);
//
// return buildCode(namespace.getName() + separator + full);
}
public final IGroup getCurrentGroup() {
throw new UnsupportedOperationException();
// return currentGroup;
}
public final IGroup getGroup(Code code) {
throw new UnsupportedOperationException();
// final IGroup p = entityFactory.getGroup(code);
// return Objects.requireNonNull(p);
}
public final IGroup getGroupStrict(Ident ident) {
throw new UnsupportedOperationException();
// if (!this.V1972())
// throw new UnsupportedOperationException();
// final IGroup p = entityFactory.getGroupStrict(ident);
// return Objects.requireNonNull(p);
}
public final IGroup getGroupVerySmart(Ident ident) {
throw new UnsupportedOperationException();
// if (!this.V1972())
// throw new UnsupportedOperationException();
// final IGroup p = entityFactory.getGroupVerySmart(ident);
// return Objects.requireNonNull(p);
}
public final boolean isGroup(Code code) {
throw new UnsupportedOperationException();
// if (this.V1972())
// return isGroupStrict((Ident) code);
// return leafExist(code) == false && entityFactory.getGroup(code) != null;
}
public final boolean isGroupStrict(Ident ident) {
throw new UnsupportedOperationException();
// if (!this.V1972())
// throw new UnsupportedOperationException();
// return leafExistStrict(ident) == false && entityFactory.getGroupStrict(ident) != null;
}
public final boolean isGroupVerySmart(Ident ident) {
throw new UnsupportedOperationException();
// if (!this.V1972())
// throw new UnsupportedOperationException();
// return leafExistSmart(ident) == false && entityFactory.getGroupVerySmart(ident) != null;
}
public final Collection<IGroup> getGroups(boolean withRootGroup) {
throw new UnsupportedOperationException();
// if (withRootGroup == false)
// return entityFactory.groups();
//
// final Collection<IGroup> result = new ArrayList<>();
// result.add(getRootGroup());
// result.addAll(entityFactory.groups());
// return Collections.unmodifiableCollection(result);
}
public IGroup getRootGroup() {
throw new UnsupportedOperationException();
// return entityFactory.getRootGroup();
}
public final Collection<ILeaf> getLeafsvalues() {
throw new UnsupportedOperationException();
// return entityFactory.leafs2();
}
public final int getLeafssize() {
return getLeafsvalues().size();
}
public final ILeaf getLeaf(Code code) {
throw new UnsupportedOperationException();
// return entityFactory.getLeaf(code);
}
public final ILeaf getLeafStrict(Ident ident) {
throw new UnsupportedOperationException();
// return entityFactory.getLeafStrict(ident);
}
public final ILeaf getLeafSmart(Ident ident) {
throw new UnsupportedOperationException();
// return entityFactory.getLeafSmart(ident);
}
public /* final */ ILeaf getLeafVerySmart(Ident ident) {
throw new UnsupportedOperationException();
// return entityFactory.getLeafVerySmart(ident);
}
final public void addLink(Link link) {
entityFactory.addLink(link);
}
final protected void removeLink(Link link) {
entityFactory.removeLink(link);
}
final public List<Link> getLinks() {
return entityFactory.getLinks();
}
abstract protected List<String> getDotStrings();
final public String[] getDotStringSkek() {
final List<String> result = new ArrayList<>();
for (String s : getDotStrings())
if (s.startsWith("nodesep") || s.startsWith("ranksep") || s.startsWith("layout"))
result.add(s);
String aspect = getPragma().getValue("aspect");
if (aspect != null) {
aspect = aspect.replace(',', '.');
result.add("aspect=" + aspect + ";");
}
final String ratio = getPragma().getValue("ratio");
if (ratio != null)
result.add("ratio=" + ratio + ";");
return result.toArray(new String[result.size()]);
}
private void createFilesGraphml(OutputStream suggestedFile) throws IOException {
final CucaDiagramGraphmlMaker maker = new CucaDiagramGraphmlMaker(this);
maker.createFiles(suggestedFile);
}
private void createFilesXmi(OutputStream suggestedFile, FileFormat fileFormat) throws IOException {
final CucaDiagramXmiMaker maker = new CucaDiagramXmiMaker(this, fileFormat);
maker.createFiles(suggestedFile);
}
private void createFilesScxml(OutputStream suggestedFile) throws IOException {
// final StateDiagramScxmlMaker maker = new StateDiagramScxmlMaker((StateDiagram) this);
// maker.createFiles(suggestedFile);
throw new UnsupportedOperationException();
}
@Override
protected ImageData exportDiagramInternal(OutputStream os, int index, FileFormatOption fileFormatOption)
throws IOException {
final FileFormat fileFormat = fileFormatOption.getFileFormat();
if (fileFormat == FileFormat.ATXT || fileFormat == FileFormat.UTXT) {
try {
createFilesTxt(os, index, fileFormat);
} catch (Throwable t) {
t.printStackTrace(SecurityUtils.createPrintStream(os));
}
return ImageDataSimple.ok();
}
if (fileFormat == FileFormat.GRAPHML) {
createFilesGraphml(os);
return ImageDataSimple.ok();
}
if (fileFormat.name().startsWith("XMI")) {
createFilesXmi(os, fileFormat);
return ImageDataSimple.ok();
}
if (fileFormat == FileFormat.SCXML) {
createFilesScxml(os);
return ImageDataSimple.ok();
}
if (getUmlDiagramType() == UmlDiagramType.COMPOSITE) {
throw new UnsupportedOperationException();
}
final CucaDiagramFileMaker maker;
if (this.isUseElk())
maker = new CucaDiagramFileMakerElk(this, fileFormatOption.getDefaultStringBounder(getSkinParam()));
else if (this.isUseSmetana())
maker = new CucaDiagramFileMakerSmetana(this, fileFormatOption.getDefaultStringBounder(getSkinParam()));
else
maker = new CucaDiagramFileMakerSvek(this);
final ImageData result = maker.createFile(os, getDotStrings(), fileFormatOption);
if (result == null)
return ImageDataSimple.error();
this.warningOrError = result.getWarningOrError();
return result;
}
private String warningOrError;
@Override
public String getWarningOrError() {
final String generalWarningOrError = super.getWarningOrError();
if (warningOrError == null)
return generalWarningOrError;
if (generalWarningOrError == null)
return warningOrError;
return generalWarningOrError + BackSlash.NEWLINE + warningOrError;
}
private void createFilesTxt(OutputStream os, int index, FileFormat fileFormat) throws IOException {
final CucaDiagramTxtMaker maker = new CucaDiagramTxtMaker(this, fileFormat);
maker.createFiles(os, index);
}
public boolean isAutarkic(IGroup g) {
if (g.getGroupType() == GroupType.PACKAGE)
return false;
if (g.getGroupType() == GroupType.INNER_ACTIVITY)
return true;
if (g.getGroupType() == GroupType.CONCURRENT_ACTIVITY)
return true;
if (g.getGroupType() == GroupType.CONCURRENT_STATE)
return true;
if (getChildrenGroups(g).size() > 0)
return false;
for (Link link : getLinks())
if (EntityUtils.isPureInnerLink3(g, link) == false)
return false;
for (ILeaf leaf : g.getLeafsDirect())
if (leaf.getEntityPosition() != EntityPosition.NORMAL)
return false;
return true;
}
private static boolean isNumber(String s) {
return s.matches("[+-]?(\\.?\\d+|\\d+\\.\\d*)");
}
public void resetPragmaLabel() {
getPragma().undefine("labeldistance");
getPragma().undefine("labelangle");
}
public String getLabeldistance() {
if (getPragma().isDefine("labeldistance")) {
final String s = getPragma().getValue("labeldistance");
if (isNumber(s))
return s;
}
if (getPragma().isDefine("defaultlabeldistance")) {
final String s = getPragma().getValue("defaultlabeldistance");
if (isNumber(s))
return s;
}
// Default in dot 1.0
return "1.7";
}
public String getLabelangle() {
if (getPragma().isDefine("labelangle")) {
final String s = getPragma().getValue("labelangle");
if (isNumber(s))
return s;
}
if (getPragma().isDefine("defaultlabelangle")) {
final String s = getPragma().getValue("defaultlabelangle");
if (isNumber(s))
return s;
}
// Default in dot -25
return "25";
}
final public boolean isEmpty(IGroup gToTest) {
for (IEntity gg : getGroups(false)) {
if (gg == gToTest)
continue;
if (gg.getParentContainer() == gToTest)
return false;
}
return gToTest.size() == 0;
}
public final boolean isVisibilityModifierPresent() {
return visibilityModifierPresent;
}
public final void setVisibilityModifierPresent(boolean visibilityModifierPresent) {
this.visibilityModifierPresent = visibilityModifierPresent;
}
public final boolean showPortion(EntityPortion portion, IEntity entity) {
if (getSkinParam().strictUmlStyle() && portion == EntityPortion.CIRCLED_CHARACTER)
return false;
boolean result = true;
for (HideOrShow cmd : hideOrShows)
if (cmd.portion == portion && cmd.gender.contains(entity))
result = cmd.show;
return result;
}
public final void hideOrShow(EntityGender gender, EntityPortion portions, boolean show) {
for (EntityPortion portion : portions.asSet())
this.hideOrShows.add(new HideOrShow(gender, portion, show));
}
public void hideOrShow(Set<VisibilityModifier> visibilities, boolean show) {
if (show)
hides.removeAll(visibilities);
else
hides.addAll(visibilities);
}
public void hideOrShow2(String what, boolean show) {
this.hides2.add(new HideOrShow2(what, show));
}
public void removeOrRestore(String what, boolean show) {
this.removed.add(new HideOrShow2(what, show));
}
private final List<HideOrShow> hideOrShows = new ArrayList<>();
private final Set<VisibilityModifier> hides = new HashSet<>();
static class HideOrShow {
private final EntityGender gender;
private final EntityPortion portion;
private final boolean show;
public HideOrShow(EntityGender gender, EntityPortion portion, boolean show) {
this.gender = gender;
this.portion = portion;
this.show = show;
}
}
public final Set<VisibilityModifier> getHides() {
return Collections.unmodifiableSet(hides);
}
final public boolean isStandalone(IEntity ent) {
for (final Link link : getLinks())
if (link.getEntity1() == ent || link.getEntity2() == ent)
return false;
return true;
}
final public boolean isStandaloneForArgo(IEntity ent) {
for (final Link link : getLinks()) {
if (link.isHidden() || link.isInvis())
continue;
if (link.getEntity1() == ent || link.getEntity2() == ent)
return false;
}
return true;
}
final public Link getLastLink() {
final List<Link> links = getLinks();
for (int i = links.size() - 1; i >= 0; i--) {
final Link link = links.get(i);
if (link.getEntity1().getLeafType() != LeafType.NOTE && link.getEntity2().getLeafType() != LeafType.NOTE)
return link;
}
return null;
}
final public List<Link> getTwoLastLinks() {
final List<Link> result = new ArrayList<>();
final List<Link> links = getLinks();
for (int i = links.size() - 1; i >= 0; i--) {
final Link link = links.get(i);
if (link.getEntity1().getLeafType() != LeafType.NOTE && link.getEntity2().getLeafType() != LeafType.NOTE) {
result.add(link);
if (result.size() == 2)
return Collections.unmodifiableList(result);
}
}
return null;
}
private ILeaf lastEntity = null;
final public ILeaf getLastEntity() {
return lastEntity;
}
final public IEntityFactory getIEntityFactory() {
return entityFactory;
}
final public EntityFactory getEntityFactory() {
throw new UnsupportedOperationException();
// return entityFactory;
}
public void applySingleStrategy() {
// final MagmaList magmaList = new MagmaList();
//
// for (IGroup g : getGroups(true)) {
// final List<ILeaf> standalones = new ArrayList<>();
//
// for (ILeaf ent : g.getLeafsDirect())
// if (isStandalone(ent))
// standalones.add(ent);
//
// if (standalones.size() < 3)
// continue;
//
// final Magma magma = new Magma(this, standalones);
// magma.putInSquare();
// magmaList.add(magma);
// }
//
// for (IGroup g : getGroups(true)) {
// final MagmaList magmas = magmaList.getMagmas(g);
// if (magmas.size() < 3)
// continue;
//
// magmas.putInSquare();
// }
}
public boolean isHideEmptyDescriptionForState() {
return false;
}
protected void incRawLayout() {
entityFactory.incRawLayout();
}
public CommandExecutionResult constraintOnLinks(Link link1, Link link2, Display display) {
final LinkConstraint linkConstraint = new LinkConstraint(link1, link2, display);
link1.setLinkConstraint(linkConstraint);
link2.setLinkConstraint(linkConstraint);
return CommandExecutionResult.ok();
}
@Override
public ClockwiseTopRightBottomLeft getDefaultMargins() {
// Strange numbers here for backwards compatibility
return ClockwiseTopRightBottomLeft.topRightBottomLeft(0, 5, 5, 0);
}
private final AtomicInteger cpt = new AtomicInteger(1);
public int getUniqueSequence() {
return cpt.addAndGet(1);
}
public String getUniqueSequence(String prefix) {
return prefix + getUniqueSequence();
}
}

View File

@ -0,0 +1,896 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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
* Contribution: Hisashi Miyashita
* Contribution: Miguel Esteves
*
*/
package net.sourceforge.plantuml.baraye.b;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.Guillemet;
import net.sourceforge.plantuml.Hideable;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.LineConfigurable;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Removeable;
import net.sourceforge.plantuml.SpecificBackcolorable;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaNote;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.DisplayPositioned;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.TextBlock;
import net.sourceforge.plantuml.graphic.TextBlockEmpty;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.USymbols;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.Kal;
import net.sourceforge.plantuml.svek.Margins;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svek.SingleStrategy;
import net.sourceforge.plantuml.svek.image.EntityImageStateCommon;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.color.HColor;
final public class EntityImp
implements SpecificBackcolorable, Hideable, Removeable, LineConfigurable, ILeaf, IGroup {
private final ZEntityFactory entityFactory;
private Quark quark;
private Url url;
private final Bodier bodier;
private final String uid;
private Display display = Display.empty();
private DisplayPositioned legend = null;
private LeafType leafType;
private Stereotype stereotype;
private Stereostyles stereostyles = Stereostyles.NONE;
private String generic;
private GroupType groupType;
// Other
private Margins margins = Margins.NONE;
private final Collection<String> portShortNames = new HashSet<>();
private int xposition;
private IEntityImage svekImage;
private USymbol symbol;
private final int rawLayout;
private char concurrentSeparator;
private LineLocation codeLine;
private Set<Stereotag> tags = new LinkedHashSet<>();
private final List<CucaNote> notesTop = new ArrayList<>();
private final List<CucaNote> notesBottom = new ArrayList<>();
// @Override
public void addNote(Display note, Position position, Colors colors) {
if (position == Position.TOP)
notesTop.add(CucaNote.build(note, position, colors));
else if (position == Position.BOTTOM)
notesBottom.add(CucaNote.build(note, position, colors));
}
// @Override
public List<CucaNote> getNotes(Position position) {
if (position == Position.TOP)
return Collections.unmodifiableList(notesTop);
if (position == Position.BOTTOM)
return Collections.unmodifiableList(notesBottom);
throw new IllegalArgumentException();
}
public void addStereotag(Stereotag tag) {
this.tags.add(tag);
}
public Set<Stereotag> stereotags() {
return Collections.unmodifiableSet(tags);
}
// Back to Entity
private EntityImp(Quark quark, ZEntityFactory entityFactory, Bodier bodier, int rawLayout) {
this.quark = Objects.requireNonNull(quark);
this.uid = StringUtils.getUid("cl", entityFactory.getDiagram().getUniqueSequence());
this.entityFactory = entityFactory;
this.bodier = bodier;
this.rawLayout = rawLayout;
}
EntityImp(Quark quark, ZEntityFactory entityFactory, Bodier bodier, LeafType leafType, int rawLayout) {
this(Objects.requireNonNull(quark), entityFactory, bodier, rawLayout);
// System.err.println("ID for leaf=" + code + " " + ident);
// ident.checkSameAs(code, namespaceSeparator);
this.leafType = leafType;
}
EntityImp(Quark quark, ZEntityFactory entityFactory, Bodier bodier, GroupType groupType, int rawLayout) {
this(Objects.requireNonNull(quark), entityFactory, bodier, rawLayout);
// System.err.println("ID for group=" + code + " " + ident);
this.groupType = groupType;
}
public LeafType getLeafType() {
return leafType;
}
public boolean muteToType(LeafType newType, USymbol newSymbol) {
checkNotGroup();
Objects.requireNonNull(newType);
if (leafType != LeafType.STILL_UNKNOWN) {
if (newType == this.leafType)
return true;
if (leafType != LeafType.ANNOTATION && leafType != LeafType.ABSTRACT_CLASS && leafType != LeafType.CLASS
&& leafType != LeafType.ENUM && leafType != LeafType.INTERFACE) {
return false;
// throw new IllegalArgumentException("type=" + leafType);
}
if (newType != LeafType.ANNOTATION && newType != LeafType.ABSTRACT_CLASS && newType != LeafType.CLASS
&& newType != LeafType.ENUM && newType != LeafType.INTERFACE && newType != LeafType.OBJECT) {
return false;
// throw new IllegalArgumentException("newtype=" + newType);
}
}
if (leafType == LeafType.CLASS && newType == LeafType.OBJECT)
bodier.muteClassToObject();
this.leafType = newType;
this.symbol = newSymbol;
return true;
}
public Quark getQuark() {
return quark;
}
public String getCodeGetName() {
return getQuark().getName();
}
public Display getDisplay() {
// if (intricated)
// return entityFactory.getIntricatedDisplay(ident);
return display;
}
public void setDisplay(Display display) {
this.display = display;
}
public String getUid() {
return uid;
}
public Stereotype getStereotype() {
return stereotype;
}
public final void setStereotype(Stereotype stereotype) {
this.stereotype = stereotype;
}
// public final IGroup getParentContainer() {
// return entityFactory.getParentContainer(ident, parentContainer);
// // Objects.requireNonNull(parentContainer);
// // return parentContainer;
// }
@Override
public String toString() {
return quark.toString() + " " + display + "(" + leafType + ")[" + groupType + "] " + getUid();
}
public final Url getUrl99() {
return url;
}
public boolean hasUrl() {
if (Display.isNull(display) == false && display.hasUrl())
return true;
if (bodier.hasUrl())
return true;
return url != null;
}
public final void addUrl(Url url) {
this.url = url;
}
public final Margins getMargins() {
checkNotGroup();
return margins;
}
public final void ensureMargins(Margins newMargins) {
// checkNotGroup();
this.margins = this.margins.merge(newMargins);
}
public int getXposition() {
checkNotGroup();
return xposition;
}
public void setXposition(int pos) {
checkNotGroup();
xposition = pos;
}
public final IEntityImage getSvekImage() {
checkNotGroup();
return svekImage;
}
public final void setSvekImage(IEntityImage svekImage) {
checkNotGroup();
this.svekImage = svekImage;
}
public final void setGeneric(String generic) {
checkNotGroup();
this.generic = generic;
}
public final String getGeneric() {
checkNotGroup();
return generic;
}
public Bodier getBodier() {
return bodier;
}
public EntityPosition getEntityPosition() {
// if (leafType == LeafType.PORT)
// return EntityPosition.PORT;
if (leafType == LeafType.PORTIN)
return EntityPosition.PORTIN;
if (leafType == LeafType.PORTOUT)
return EntityPosition.PORTOUT;
if (leafType != LeafType.STATE)
return EntityPosition.NORMAL;
if (quark.isRoot())
return EntityPosition.NORMAL;
final Stereotype stereotype = getStereotype();
if (stereotype == null)
return EntityPosition.NORMAL;
return EntityPosition.fromStereotype(stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
}
// ----------
private void checkGroup() {
if (isGroup() == false)
throw new UnsupportedOperationException();
}
private void checkNotGroup() {
if (isGroup())
throw new UnsupportedOperationException();
}
// public boolean containsLeafRecurse(ILeaf leaf) {
// if (Objects.requireNonNull(leaf).isGroup())
// throw new IllegalArgumentException();
//
// checkGroup();
// if (leaf.getParentContainer() == this)
// return true;
//
// for (IGroup child : getChildren())
// if (child.containsLeafRecurse(leaf))
// return true;
//
// return false;
// }
// public Collection<ILeaf> getLeafsDirect() {
// checkGroup();
// final List<ILeaf> result = new ArrayList<>();
// for (ILeaf ent : entityFactory.leafs()) {
// if (ent.isGroup())
// throw new IllegalStateException();
//
// if (ent.getParentContainer() == this)
// result.add(ent);
//
// }
// return Collections.unmodifiableCollection(result);
// }
// public Collection<IGroup> getChildren() {
// checkGroup();
// final Collection<IGroup> result = new ArrayList<>();
// for (IGroup g : entityFactory.groups())
// if (g != this && g.getParentContainer() == this)
// result.add(g);
//
// return Collections.unmodifiableCollection(result);
// }
// public void moveEntitiesTo(IGroup dest) {
// if (entityFactory.namespaceSeparator.V1972()) {
// moveEntitiesTo1972(dest);
// return;
// }
// checkGroup();
// if (dest.isGroup() == false)
// throw new UnsupportedOperationException();
//
// for (ILeaf ent : getLeafsDirect())
// ((ZEntityImpl) ent).parentContainer = dest;
//
// for (IGroup g : dest.getChildren())
// // ((EntityImpl) g).parentContainer = dest;
// throw new IllegalStateException();
//
// for (IGroup g : getChildren()) {
// if (g == dest)
// continue;
//
// ((ZEntityImpl) g).parentContainer = dest;
// }
//
// }
// private void moveEntitiesTo1972(IGroup dest) {
// checkGroup();
// if (dest.isGroup() == false)
// throw new UnsupportedOperationException();
//
// // System.err.println("moveEntitiesTo1972::before1::groups2=" +
// // entityFactory.groups2());
// final Ident firstIdent = getIdent();
// final Ident destIdent = dest.getIdent();
// // System.err.println("moveEntitiesTo1972::this=" + firstIdent);
// // System.err.println("moveEntitiesTo1972::dest=" + destIdent);
// if (destIdent.startsWith(firstIdent) == false)
// throw new UnsupportedOperationException();
//
// // System.err.println("moveEntitiesTo1972::before2::groups2=" +
// // entityFactory.groups2());
// for (ILeaf ent : new ArrayList<>(entityFactory.leafs2())) {
// Ident ident = ent.getIdent();
// if (ident.equals(firstIdent) == false && ident.startsWith(firstIdent)
// && ident.startsWith(destIdent) == false) {
// // System.err.print("moving leaf ident1=" + ident);
// entityFactory.leafs2.remove(ident);
// ident = ident.move(firstIdent, destIdent);
// // System.err.println(" to ident2=" + ident);
// ((ZEntityImpl) ent).ident = ident;
// ((ZEntityImpl) ent).code = ident;
// entityFactory.leafs2.put(ident, ent);
// }
// }
// // System.err.println("moveEntitiesTo1972::before3::groups2=" +
// // entityFactory.groups2());
// for (IGroup ent : new ArrayList<>(entityFactory.groups2())) {
// Ident ident = ent.getIdent();
// // System.err.println("found=" + ident + " " + ident.startsWith(firstIdent) + "
// // "
// // + ident.startsWith(destIdent));
// if (ident.equals(firstIdent) == false && ident.startsWith(firstIdent)
// && ident.startsWith(destIdent) == false) {
// // System.err.print("moving gr ident1=" + ident);
// entityFactory.groups2.remove(ident);
// ident = ident.move(firstIdent, destIdent);
// // System.err.println(" to ident2=" + ident);
// ((ZEntityImpl) ent).ident = ident;
// ((ZEntityImpl) ent).code = ident;
// entityFactory.groups2.put(ident, ent);
// // System.err.println("-->groups2=" + entityFactory.groups2());
// }
// }
// // System.err.println("moveEntitiesTo1972::after::groups2=" +
// // entityFactory.groups2());
// // for (IGroup g : dest.getChildren()) {
// // // ((EntityImpl) g).parentContainer = dest;
// // throw new IllegalStateException();
// // }
// //
// // for (IGroup g : getChildren()) {
// // if (g == dest) {
// // continue;
// // }
// // ((EntityImpl) g).parentContainer = dest;
// // }
//
// }
// public int size() {
// checkGroup();
// return getLeafsDirect().size();
// }
public GroupType getGroupType() {
checkGroup();
return groupType;
}
// public Code getNamespace() {
// checkGroup();
// return namespace;
// }
public PackageStyle getPackageStyle() {
checkGroup();
if (stereotype == null)
return null;
return stereotype.getPackageStyle();
}
public boolean isGroup() {
if (groupType != null && leafType != null)
throw new IllegalStateException();
assert groupType == null || leafType == null;
if (groupType != null)
return true;
if (leafType != null)
return false;
throw new IllegalStateException();
}
// ---- other
public void overrideImage(IEntityImage img, LeafType leafType) {
checkGroup();
this.svekImage = img;
this.url = null;
for (final Link link : new ArrayList<>(entityFactory.getLinks()))
if (EntityUtils.isPureInnerLink12(this, link))
entityFactory.removeLink(link);
// if (entityFactory.namespaceSeparator.V1972()) {
// entityFactory.removeGroup(getIdent());
// for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
// if (this != ent && getIdent().equals(ent.getIdent().parent()))
// entityFactory.removeLeaf(ent.getIdent());
//
// } else {
// entityFactory.removeGroup(getCodeGetName());
// for (ILeaf ent : new ArrayList<>(entityFactory.leafs()))
// if (this != ent && this == ent.getParentContainer())
// entityFactory.removeLeaf(ent.getCodeGetName());
// }
//
// entityFactory.addLeaf(this);
// this.groupType = null;
// this.leafType = leafType;
throw new UnsupportedOperationException("to be finished");
}
// void muteToGroup(Code namespaceNew, GroupType groupType, IGroup parentContainer) {
// checkNotGroup();
// if (parentContainer.isGroup() == false)
// throw new IllegalArgumentException();
//
// this.namespace = namespaceNew;
// this.groupType = groupType;
// this.leafType = null;
// this.parentContainer = parentContainer;
// }
public USymbol getUSymbol() {
if (getLeafType() == LeafType.CIRCLE)
return USymbols.INTERFACE;
// if (symbol != null && stereotype != null && stereotype.getSprite() != null) {
// return symbol.withStereoAlignment(HorizontalAlignment.RIGHT);
// }
return symbol;
}
public void setUSymbol(USymbol symbol) {
this.symbol = symbol;
}
public SingleStrategy getSingleStrategy() {
return SingleStrategy.SQUARE;
}
public boolean isHidden() {
return false;
// if (parentContainer != null && parentContainer.isHidden())
// return true;
//
// return isHiddenInternal();
}
// private boolean isHiddenInternal() {
// if (isGroup()) {
// if (entityFactory.isHidden(this))
// return true;
//
// if (getLeafsDirect().size() == 0)
// return false;
//
// for (ILeaf leaf : getLeafsDirect())
// if (((ZEntityImpl) leaf).isHiddenInternal() == false)
// return false;
//
// for (IGroup g : getChildren())
// if (((ZEntityImpl) g).isHiddenInternal() == false)
// return false;
//
// return true;
// }
// return entityFactory.isHidden(this);
// }
public boolean isRemoved() {
return false;
// if (parentContainer != null && parentContainer.isRemoved())
// return true;
//
// return isRemovedInternal();
}
// private boolean isRemovedInternal() {
// if (isGroup()) {
// if (entityFactory.isRemoved(this))
// return true;
//
// if (getLeafsDirect().size() == 0 && getChildren().size() == 0)
// return false;
//
// for (ILeaf leaf : getLeafsDirect())
// if (((ZEntityImpl) leaf).isRemovedInternal() == false)
// return false;
//
// for (IGroup g : getChildren())
// if (((ZEntityImpl) g).isRemovedInternal() == false)
// return false;
//
// return true;
// }
// return entityFactory.isRemoved(this);
// }
public boolean isAloneAndUnlinked() {
return false;
// if (isGroup())
// return false;
//
// for (Link link : entityFactory.getLinks())
// if (link.contains(this)) {
// final ILeaf other = (ILeaf) link.getOther(this);
// final boolean removed = entityFactory.isRemovedIgnoreUnlinked(other);
// if (removed == false && link.getType().isInvisible() == false)
// return false;
// }
//
// return true;
}
private FontParam getTitleFontParam() {
return getGroupType() == GroupType.STATE ? FontParam.STATE : FontParam.PACKAGE;
}
public FontConfiguration getFontConfigurationForTitle(final ISkinParam skinParam) {
final FontParam fontParam = getTitleFontParam();
final HColor fontHtmlColor = skinParam.getFontHtmlColor(getStereotype(), fontParam, FontParam.PACKAGE);
final UFont font = skinParam.getFont(getStereotype(), true, fontParam, FontParam.PACKAGE);
final FontConfiguration fontConfiguration = FontConfiguration.create(font, fontHtmlColor,
skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize());
return fontConfiguration;
}
public final int getRawLayout() {
return rawLayout;
}
public char getConcurrentSeparator() {
return concurrentSeparator;
}
public void setConcurrentSeparator(char separator) {
this.concurrentSeparator = separator;
}
private Neighborhood neighborhood;
public void setNeighborhood(Neighborhood neighborhood) {
this.neighborhood = neighborhood;
}
public Neighborhood getNeighborhood() {
return neighborhood;
}
private final Map<String, Display> tips = new LinkedHashMap<String, Display>();
public void putTip(String member, Display display) {
tips.put(member, display);
}
public Map<String, Display> getTips() {
return Collections.unmodifiableMap(tips);
}
private Colors colors = Colors.empty();
public Colors getColors() {
return colors;
}
public void setColors(Colors colors) {
this.colors = colors;
}
public void setSpecificColorTOBEREMOVED(ColorType type, HColor color) {
if (color != null)
this.colors = colors.add(type, color);
}
public Collection<String> getPortShortNames() {
checkNotGroup();
return Collections.unmodifiableCollection(portShortNames);
}
public void addPortShortName(String portShortName) {
portShortNames.add(portShortName);
}
private VisibilityModifier visibility;
public void setVisibilityModifier(VisibilityModifier visibility) {
this.visibility = visibility;
}
public VisibilityModifier getVisibilityModifier() {
return visibility;
}
public void setLegend(DisplayPositioned legend) {
checkGroup();
this.legend = legend;
}
public DisplayPositioned getLegend() {
return legend;
}
// private boolean intricated;
//
// public void setIntricated(boolean intricated) {
// this.intricated = intricated;
// }
// private IGroup originalGroup;
//
// public void setOriginalGroup(IGroup originalGroup) {
// this.originalGroup = originalGroup;
// this.legend = originalGroup.getLegend();
// }
public IGroup getOriginalGroup() {
throw new UnsupportedOperationException();
// return originalGroup;
}
private boolean together;
public void setThisIsTogether() {
this.together = true;
}
public String getCodeLine() {
if (this.codeLine == null)
return null;
return "" + this.codeLine.getPosition();
}
public void setCodeLine(LineLocation codeLine) {
this.codeLine = codeLine;
}
// @Override
public void setStereostyle(String stereo) {
this.stereostyles = Stereostyles.build(stereo);
}
// @Override
public Stereostyles getStereostyles() {
return stereostyles;
}
private final Map<Direction, List<Kal>> kals = new EnumMap<>(Direction.class);
public void addKal(Kal kal) {
final Direction position = kal.getPosition();
List<Kal> list = kals.get(position);
if (list == null) {
list = new ArrayList<>();
kals.put(position, list);
}
list.add(kal);
}
public List<Kal> getKals(Direction position) {
final List<Kal> result = kals.get(position);
if (result == null)
return Collections.emptyList();
return Collections.unmodifiableList(result);
}
public ICucaDiagram getDiagram() {
return entityFactory.getDiagram();
}
private boolean isStatic;
// @Override
public void setStatic(boolean isStatic) {
this.isStatic = isStatic;
}
// @Override
public boolean isStatic() {
return isStatic;
}
// For group
public TextBlock getStateHeader(ISkinParam skinParam) {
checkGroup();
final Style style = EntityImageStateCommon.getStyleStateHeader(this, skinParam);
final List<CharSequence> details = getBodier().getRawBody();
if (details.size() == 0)
return new TextBlockEmpty();
if (style == null)
throw new IllegalArgumentException();
final FontConfiguration fontConfiguration = FontConfiguration.create(skinParam, style);
Display display = null;
for (CharSequence s : details)
if (display == null)
display = Display.getWithNewlines(s.toString());
else
display = display.addAll(Display.getWithNewlines(s.toString()));
return display.create(fontConfiguration, HorizontalAlignment.LEFT, skinParam);
}
@Override
public Code getCode() {
return quark;
}
@Override
public Ident getIdent() {
throw new UnsupportedOperationException();
}
@Override
public IGroup getParentContainer() {
return (IGroup) quark.getParent().getData();
}
@Override
public void setContainer(IGroup container) {
throw new UnsupportedOperationException();
}
@Override
public boolean containsLeafRecurse(ILeaf entity) {
throw new UnsupportedOperationException();
}
@Override
public Collection<ILeaf> getLeafsDirect() {
throw new UnsupportedOperationException();
}
@Override
public Collection<IGroup> getChildren() {
throw new UnsupportedOperationException();
}
@Override
public void moveEntitiesTo(IGroup dest) {
throw new UnsupportedOperationException();
}
@Override
public int size() {
throw new UnsupportedOperationException();
}
@Override
public Code getNamespace() {
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,126 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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
* Contribution: Miguel Esteves
*
*/
package net.sourceforge.plantuml.baraye.b;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.sourceforge.plantuml.Hideable;
import net.sourceforge.plantuml.LineConfigurable;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Removeable;
import net.sourceforge.plantuml.SpecificBackcolorable;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.command.Position;
import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.CucaNote;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityPosition;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereostyles;
import net.sourceforge.plantuml.cucadiagram.Stereotag;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.graphic.color.Colors;
public interface IEntity extends SpecificBackcolorable, Hideable, Removeable, LineConfigurable {
public Code getCode();
public String getCodeGetName();
public Ident getIdent();
public USymbol getUSymbol();
public void setUSymbol(USymbol symbol);
public LeafType getLeafType();
public Display getDisplay();
public IGroup getParentContainer();
public void setDisplay(Display display);
public String getUid();
public Url getUrl99();
public Stereotype getStereotype();
public void setStereotype(Stereotype stereotype);
public Bodier getBodier();
public void addUrl(Url url);
public boolean isGroup();
public boolean hasUrl();
public int getRawLayout();
public void putTip(String member, Display display);
public Map<String, Display> getTips();
public void addStereotag(Stereotag tag);
public Set<Stereotag> stereotags();
public boolean isAloneAndUnlinked();
public void setThisIsTogether();
public String getCodeLine();
public void setCodeLine(LineLocation codeLine);
public void setStereostyle(String stereo);
public Stereostyles getStereostyles();
public void addNote(Display note, Position position, Colors colors);
public EntityPosition getEntityPosition();
public List<CucaNote> getNotes(Position position);
}

View File

@ -0,0 +1,82 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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.baraye.b;
import java.util.Collection;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.DisplayPositioned;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.graphic.FontConfiguration;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.PackageStyle;
import net.sourceforge.plantuml.svek.SingleStrategy;
public interface IGroup extends IEntity {
public boolean containsLeafRecurse(ILeaf entity);
public Collection<ILeaf> getLeafsDirect();
public Collection<IGroup> getChildren();
public void moveEntitiesTo(IGroup dest);
public int size();
public GroupType getGroupType();
public Code getNamespace();
public PackageStyle getPackageStyle();
public void overrideImage(IEntityImage img, LeafType state);
public SingleStrategy getSingleStrategy();
public FontConfiguration getFontConfigurationForTitle(ISkinParam skinParam);
public char getConcurrentSeparator();
public void setConcurrentSeparator(char separator);
public void setLegend(DisplayPositioned legend);
public DisplayPositioned getLegend();
}

View File

@ -0,0 +1,83 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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.baraye.b;
import java.util.Collection;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.dot.Neighborhood;
import net.sourceforge.plantuml.graphic.USymbol;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.svek.IEntityImage;
import net.sourceforge.plantuml.svek.Margins;
public interface ILeaf extends IEntity {
public void setContainer(IGroup container);
public Margins getMargins();
public int getXposition();
public void setXposition(int pos);
public IEntityImage getSvekImage();
public String getGeneric();
public boolean muteToType(LeafType newType, USymbol newSymbol);
public void setGeneric(String generic);
public void setSvekImage(IEntityImage svekImage);
public void setNeighborhood(Neighborhood neighborhood);
public Neighborhood getNeighborhood();
public Collection<String> getPortShortNames();
public void addPortShortName(String portShortName);
public void setVisibilityModifier(VisibilityModifier visibility);
public VisibilityModifier getVisibilityModifier();
public void setStatic(boolean isStatic);
public boolean isStatic();
}

View File

@ -0,0 +1,501 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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.baraye.b;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.baraye.Plasma;
import net.sourceforge.plantuml.baraye.Quark;
import net.sourceforge.plantuml.baraye.a.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Bodier;
import net.sourceforge.plantuml.cucadiagram.BodierJSon;
import net.sourceforge.plantuml.cucadiagram.BodierMap;
import net.sourceforge.plantuml.cucadiagram.BodyFactory;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.HideOrShow2;
import net.sourceforge.plantuml.cucadiagram.ICucaDiagram;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.entity.IEntityFactory;
import net.sourceforge.plantuml.skin.VisibilityModifier;
public final class ZEntityFactory implements IEntityFactory {
private final List<Link> links = new ArrayList<>();
private int rawLayout;
private final Plasma plasma;
private final List<HideOrShow2> hides2;
private final List<HideOrShow2> removed;
/* private */ final public ICucaDiagram namespaceSeparator;
// private final boolean mergeIntricated;
// private Map<IGroup, ILeaf> emptyGroupsAsNode = new HashMap<IGroup, ILeaf>();
public ILeaf getLeafForEmptyGroup(IGroup g) {
// return emptyGroupsAsNode.get(g);
throw new UnsupportedOperationException();
}
public ILeaf createLeafForEmptyGroup(IGroup g, ISkinParam skinParam) {
throw new UnsupportedOperationException();
// final ILeaf folder = this.createLeaf(g.getIdent(), g.getCode(), g.getDisplay(), LeafType.EMPTY_PACKAGE,
// g.getParentContainer(), null, this.namespaceSeparator.getNamespaceSeparator());
// ((ZEntityImpl) folder).setOriginalGroup(g);
// final USymbol symbol = g.getUSymbol();
// folder.setUSymbol(symbol);
// folder.setStereotype(g.getStereotype());
// folder.setColors(g.getColors());
// if (g.getUrl99() != null)
// folder.addUrl(g.getUrl99());
// for (Stereotag tag : g.stereotags())
// folder.addStereotag(tag);
//
// emptyGroupsAsNode.put(g, folder);
// return folder;
}
//
// public Display getIntricatedDisplay(Ident ident) {
// final Set<Ident> known = new HashSet<>(groups2.keySet());
// known.removeAll(hiddenBecauseOfIntrication);
// String sep = namespaceSeparator.getNamespaceSeparator();
// if (sep == null)
// sep = ".";
//
// for (int check = ident.size() - 1; check > 0; check--)
// if (known.contains(ident.getPrefix(check)))
// // if (hiddenBecauseOfIntrication.contains(ident.getPrefix(check)) == false)
// return Display.getWithNewlines(ident.getSuffix(check).toString(sep))
// .withCreoleMode(CreoleMode.SIMPLE_LINE);
//
// return Display.getWithNewlines(ident.toString(sep)).withCreoleMode(CreoleMode.SIMPLE_LINE);
// }
//
// private final Collection<Ident> hiddenBecauseOfIntrication = new ArrayList<>();
//
public IGroup isIntricated(IGroup parent) {
// final int leafs = parent.getLeafsDirect().size();
// final Collection<IGroup> children = parent.getChildren();
// if (leafs == 0 && children.size() == 1) {
// final IGroup g = children.iterator().next();
// if (g.getLeafsDirect().size() == 0 && g.getChildren().size() == 0 && g.getGroupType() == GroupType.PACKAGE)
// return null;
//
// for (Link link : this.getLinks())
// if (link.contains(parent))
// return null;
//
// ((ZEntityImpl) g).setIntricated(true);
// hiddenBecauseOfIntrication.add(parent.getIdent());
// return g;
// }
// return null;
throw new UnsupportedOperationException();
}
public ZEntityFactory(List<HideOrShow2> hides2, List<HideOrShow2> removed, ICucaDiagram namespaceSeparator) {
this.hides2 = hides2;
this.removed = removed;
this.namespaceSeparator = namespaceSeparator;
// this.plasma = new Plasma(namespaceSeparator.getNamespaceSeparator());
this.plasma = new Plasma(".");
}
public boolean isHidden(EntityImp leaf) {
return false;
// final IEntity other = isNoteWithSingleLinkAttachedTo(leaf);
// if (other instanceof ILeaf)
// return isHidden((ILeaf) other);
//
// boolean hidden = false;
// for (HideOrShow2 hide : hides2)
// hidden = hide.apply(hidden, leaf);
//
// return hidden;
}
public boolean isRemoved(Stereotype stereotype) {
boolean result = false;
for (HideOrShow2 hide : removed)
result = hide.apply(result, stereotype);
return result;
}
public boolean isRemoved(EntityImp leaf) {
return false;
// final IEntity other = isNoteWithSingleLinkAttachedTo(leaf);
// if (other instanceof ILeaf)
// return isRemoved((ILeaf) other);
//
// boolean result = false;
// for (HideOrShow2 hide : removed)
// result = hide.apply(result, leaf);
//
// return result;
}
// private IEntity isNoteWithSingleLinkAttachedTo(ILeaf leaf) {
// if (leaf.getLeafType() != LeafType.NOTE)
// return null;
// IEntity result = null;
// for (Link link : this.getLinks()) {
// if (link.getType().isInvisible())
// continue;
// if (link.contains(leaf)) {
// if (result != null)
// return result;
// result = link.getOther(leaf);
// }
// }
// return result;
//
// }
// public boolean isRemovedIgnoreUnlinked(ILeaf leaf) {
// boolean result = false;
// for (HideOrShow2 hide : removed)
// if (hide.isAboutUnlinked() == false)
// result = hide.apply(result, leaf);
//
// return result;
// }
public EntityImp createLeaf(Quark quark, Display display, LeafType entityType, Set<VisibilityModifier> hides,
String namespaceSeparator) {
final Bodier bodier;
if (Objects.requireNonNull(entityType) == LeafType.MAP)
bodier = new BodierMap();
else if (Objects.requireNonNull(entityType) == LeafType.JSON)
bodier = new BodierJSon();
else
bodier = BodyFactory.createLeaf(entityType, hides);
final EntityImp result = new EntityImp(quark, this, bodier, entityType, rawLayout);
// bodier.setLeaf(result);
result.setDisplay(display);
return result;
}
public EntityImp createGroup(Quark quark, Display display, GroupType groupType, Set<VisibilityModifier> hides,
String namespaceSeparator) {
Objects.requireNonNull(groupType);
if (quark.getData() != null)
return (EntityImp) quark.getData();
// for (Entry<Ident, IGroup> ent : groups2.entrySet())
// if (ent.getKey().equals(ident))
// return ent.getValue();
final Bodier bodier = BodyFactory.createGroup(hides);
final EntityImp result = new EntityImp(quark, this, bodier, groupType, rawLayout);
if (Display.isNull(display) == false)
result.setDisplay(display);
return result;
}
public void addLeaf(ILeaf entity) {
// if (namespaceSeparator.V1972() == false)
// leafsByCode.put(entity.getCodeGetName(), entity);
// leafs2.put(entity.getIdent(), entity);
// if (namespaceSeparator.V1972())
// ensureParentIsCreated(entity.getIdent());
throw new UnsupportedOperationException();
}
//
// public void addGroup(IGroup group) {
// if (namespaceSeparator.V1972() == false)
// groupsByCode.put(group.getCodeGetName(), group);
// groups2.put(group.getIdent(), group);
// if (namespaceSeparator.V1972())
// ensureParentIsCreated(group.getIdent());
// }
//
// private void ensureParentIsCreated(Ident ident) {
// if (groups2.get(ident.parent()) != null)
// return;
// getParentContainer(ident, null);
// }
// void removeGroup(String name) {
// if (namespaceSeparator.V1972())
// throw new UnsupportedOperationException();
// final IEntity removed = Objects.requireNonNull(groupsByCode.remove(name));
// final IEntity removed2 = groups2.remove(removed.getIdent());
// if (removed != removed2) {
// bigError();
// }
// }
//
// void removeGroup(Ident ident) {
// Objects.requireNonNull(groups2.remove(Objects.requireNonNull(ident)));
// }
//
public static void bigError() {
// Thread.dumpStack();
// System.exit(0);
throw new IllegalArgumentException();
}
// void removeLeaf(String name) {
// if (namespaceSeparator.V1972())
// throw new UnsupportedOperationException();
// final IEntity removed = Objects.requireNonNull(leafsByCode.remove(Objects.requireNonNull(name)));
// final IEntity removed2 = leafs2.remove(removed.getIdent());
// if (removed != removed2) {
// bigError();
// }
// }
//
// void removeLeaf(Ident ident) {
// final IEntity removed = leafs2.remove(Objects.requireNonNull(ident));
// if (removed == null) {
// System.err.println("leafs2=" + leafs2.keySet());
// throw new IllegalArgumentException(ident.toString());
// }
// }
//
// private void removeLeaf1972(ILeaf leaf) {
// final boolean removed = leafs2.values().remove(leaf);
// if (removed == false) {
// System.err.println("leafs2=" + leafs2.keySet());
// throw new IllegalArgumentException(leaf.toString());
// }
// }
//
// public IGroup muteToGroup(String name, Code namespace, GroupType type, IGroup parent) {
// if (namespaceSeparator.V1972())
// throw new UnsupportedOperationException();
// final ILeaf leaf = leafsByCode.get(name);
// ((ZEntityImpl) leaf).muteToGroup(namespace, type, parent);
// final IGroup result = (IGroup) leaf;
// removeLeaf(name);
// return result;
// }
// public IGroup muteToGroup1972(Ident ident, Code namespace, GroupType type, IGroup parent) {
// if (!namespaceSeparator.V1972())
// throw new UnsupportedOperationException();
// final ILeaf leaf;
// if (namespaceSeparator.getNamespaceSeparator() == null)
// leaf = getLeafVerySmart(ident);
// else
// leaf = leafs2.get(ident);
// ((ZEntityImpl) leaf).muteToGroup(namespace, type, parent);
// final IGroup result = (IGroup) leaf;
// removeLeaf1972(leaf);
// return result;
// }
public IGroup getRootGroup() {
throw new UnsupportedOperationException();
// return rootGroup;
}
public final ILeaf getLeafStrict(Ident ident) {
throw new UnsupportedOperationException();
// return leafs2.get(ident);
}
//
// public final ILeaf getLeafSmart(Ident ident) {
// if (!namespaceSeparator.V1972())
// throw new UnsupportedOperationException();
// final ILeaf result = leafs2.get(ident);
// if (result == null && ident.size() == 1)
// for (Entry<Ident, ILeaf> ent : leafs2.entrySet())
// if (ent.getKey().getLast().equals(ident.getLast()))
// return ent.getValue();
//
// return result;
// }
//
// public final ILeaf getLeafVerySmart(Ident ident) {
// if (!namespaceSeparator.V1972())
// throw new UnsupportedOperationException();
// final ILeaf result = leafs2.get(ident);
// if (result == null)
// for (Entry<Ident, ILeaf> ent : leafs2.entrySet())
// if (ent.getKey().getLast().equals(ident.getLast()))
// return ent.getValue();
//
// return result;
// }
//
// public Ident buildFullyQualified(Ident currentPath, Ident id) {
// if (currentPath.equals(id) == false)
// if (leafs2.containsKey(id) || groups2.containsKey(id))
// return id;
//
// if (id.size() > 1)
// return id;
//
// return currentPath.add(id);
// }
//
// public final IGroup getGroupStrict(Ident ident) {
// if (namespaceSeparator.getNamespaceSeparator() == null)
// return getGroupVerySmart(ident);
//
// final IGroup result = groups2.get(ident);
// return result;
// }
//
// public final IGroup getGroupVerySmart(Ident ident) {
// final IGroup result = groups2.get(ident);
// if (result == null)
// for (Entry<Ident, IGroup> ent : groups2.entrySet())
// if (ent.getKey().getLast().equals(ident.getLast()))
// return ent.getValue();
//
// return result;
// }
//
// public final ILeaf getLeaf(Code code) {
// if (namespaceSeparator.V1972())
// throw new UnsupportedOperationException();
// final ILeaf result = leafsByCode.get(code.getName());
// if (result != null && result != leafs2.get(result.getIdent()))
// bigError();
//
// return result;
// }
//
// public final IGroup getGroup(Code code) {
// if (namespaceSeparator.V1972())
// throw new UnsupportedOperationException();
// final IGroup result = groupsByCode.get(code.getName());
// if (result != null && result != groups2.get(result.getIdent()))
// bigError();
//
// return result;
// }
public final Collection<ILeaf> leafs() {
// if (namespaceSeparator.V1972())
// return leafs2();
// final Collection<ILeaf> result = Collections.unmodifiableCollection(leafsByCode.values());
// if (new ArrayList<>(result).equals(new ArrayList<>(leafs2())) == false)
// bigError();
//
// return result;
throw new UnsupportedOperationException();
}
public final Collection<IGroup> groups() {
// if (namespaceSeparator.V1972())
// return groups2();
// final Collection<IGroup> result = Collections.unmodifiableCollection(groupsByCode.values());
// if (new ArrayList<>(result).equals(new ArrayList<>(groups2())) == false)
// bigError();
//
// return result;
throw new UnsupportedOperationException();
}
//
// public final Collection<IGroup> groups2() {
// final Collection<IGroup> result = Collections.unmodifiableCollection(groups2.values());
// return Collections.unmodifiableCollection(result);
// }
//
// public final Collection<ILeaf> leafs2() {
// final Collection<ILeaf> result = Collections.unmodifiableCollection(leafs2.values());
// return Collections.unmodifiableCollection(result);
// }
public void incRawLayout() {
rawLayout++;
}
public final List<Link> getLinks() {
return Collections.unmodifiableList(links);
}
public void addLink(Link link) {
if (link.isSingle() && containsSimilarLink(link))
return;
links.add(link);
}
private boolean containsSimilarLink(Link other) {
for (Link link : links)
if (other.sameConnections(link))
return true;
return false;
}
public void removeLink(Link link) {
final boolean ok = links.remove(link);
if (ok == false)
throw new IllegalArgumentException();
}
// public IGroup getParentContainer(Ident ident, IGroup parentContainer) {
// if (namespaceSeparator.V1972()) {
// final Ident parent = ident.parent();
// if (parent.isRoot())
// return this.rootGroup;
//
// IGroup result = getGroupStrict(parent);
// if (result != null)
// return result;
//
// final Display display = Display.getWithNewlines(parent.getName());
// result = createGroup(parent, parent, display, null, GroupType.PACKAGE, null,
// Collections.<VisibilityModifier>emptySet(), namespaceSeparator.getNamespaceSeparator());
// addGroup(result);
// return result;
// }
// return Objects.requireNonNull(parentContainer);
// }
public ICucaDiagram getDiagram() {
return namespaceSeparator;
}
}

View File

@ -42,9 +42,9 @@ import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.core.DiagramDescription;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public abstract class AbstractEntityDiagram extends CucaDiagram {

View File

@ -42,6 +42,8 @@ import java.util.Objects;
import net.sourceforge.plantuml.FileFormatOption;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.baraye.a.ILeaf;
import net.sourceforge.plantuml.core.ImageData;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.creole.CreoleMode;
@ -49,8 +51,6 @@ import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -44,7 +45,6 @@ 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.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.skin.VisibilityModifier;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.ILeaf;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -52,7 +53,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;

View File

@ -41,6 +41,8 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.ILeaf;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -55,8 +57,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.ILeaf;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -128,9 +128,11 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
new RegexOptional(new RegexConcat(new RegexLeaf("##"),
new RegexLeaf("LINECOLOR", "(?:\\[(dotted|dashed|bold)\\])?(\\w+)?"))), //
new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(),
new RegexLeaf("EXTENDS", "(extends)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
new RegexLeaf("EXTENDS",
"(extends)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
new RegexOptional(new RegexConcat(RegexLeaf.spaceOneOrMore(),
new RegexLeaf("IMPLEMENTS", "(implements)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
new RegexLeaf("IMPLEMENTS",
"(implements)[%s]+(" + CommandCreateClassMultilines.CODES + "|[%g]([^%g]+)[%g])"))), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("\\{"), //
RegexLeaf.spaceZeroOrMore(), //
@ -219,9 +221,9 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
typeLink = typeLink.goDashed();
final LinkArg linkArg = LinkArg.noDisplay(2);
final Link link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), cl2, entity, typeLink,
linkArg.withQuantifier(null, null).withDistanceAngle(diagram.getLabeldistance(),
diagram.getLabelangle()));
final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(),
cl2, entity, typeLink, linkArg.withQuantifier(null, null)
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
diagram.addLink(link);
}
}

View File

@ -42,6 +42,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -52,7 +53,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;

View File

@ -36,13 +36,13 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
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<CucaDiagram> {

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -50,7 +51,6 @@ import net.sourceforge.plantuml.cucadiagram.EntityGender;
import net.sourceforge.plantuml.cucadiagram.EntityGenderUtils;
import net.sourceforge.plantuml.cucadiagram.EntityPortion;
import net.sourceforge.plantuml.cucadiagram.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.descdiagram.DescriptionDiagram;

View File

@ -36,13 +36,13 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
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 CommandHideShowSpecificClass extends SingleLineCommand2<CucaDiagram> {

View File

@ -43,6 +43,7 @@ import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.RegexConcat;
@ -52,7 +53,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
@ -240,7 +240,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
.withQuantifier(labels.getFirstLabel(), labels.getSecondLabel())
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()).withKal(kal1, kal2);
Link link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2, linkType, linkArg);
Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2,
linkType, linkArg);
if (arg.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
final Url url = urlBuilder.getUrl(arg.get("URL", 0));
@ -378,9 +379,9 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
final String firstLabel = arg.get("FIRST_LABEL", 0);
final String secondLabel = arg.get("SECOND_LABEL", 0);
final LinkArg linkArg = LinkArg.build(labelLink, queue, diagram.getSkinParam().classAttributeIconSize() > 0);
final Link link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2, linkType,
linkArg.withQuantifier(firstLabel, secondLabel).withDistanceAngle(diagram.getLabeldistance(),
diagram.getLabelangle()));
final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
cl2, linkType, linkArg.withQuantifier(firstLabel, secondLabel)
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
diagram.resetPragmaLabel();

View File

@ -0,0 +1,765 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2023, 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
* Contribution : Hisashi Miyashita
*
*
*/
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.Direction;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
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.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
import net.sourceforge.plantuml.cucadiagram.LinkType;
import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement;
import net.sourceforge.plantuml.descdiagram.command.Labels;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.objectdiagram.AbstractClassOrObjectDiagram;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
final public class CommandLinkClass2 extends SingleLineCommand2<AbstractClassOrObjectDiagram> {
private static final String SINGLE = "[.\\\\]{0,2}[%pLN_]+(?:[.\\\\]{1,2}[%pLN_]+)*";
private static final String SINGLE_GUILLEMENT = "[%g][.\\\\]{0,2}[%pLN_]+(?:[.\\\\]{1,2}[%pLN_]+)*[%g]";
private static final String SINGLE2 = "(?:" + SINGLE + "|" + SINGLE_GUILLEMENT + ")";
private static final String COUPLE = "\\([%s]*(" + SINGLE2 + ")[%s]*,[%s]*(" + SINGLE2 + ")[%s]*\\)";
public CommandLinkClass2(UmlDiagramType umlDiagramType) {
super(getRegexConcat(umlDiagramType));
}
static private RegexConcat getRegexConcat(UmlDiagramType umlDiagramType) {
return RegexConcat.build(CommandLinkClass2.class.getName() + umlDiagramType, RegexLeaf.start(), //
new RegexOptional( //
new RegexConcat( //
new RegexLeaf("HEADER", "@([\\d.]+)"), //
RegexLeaf.spaceOneOrMore() //
)), new RegexOr( //
new RegexLeaf("ENT1", getClassIdentifier()), //
new RegexLeaf("COUPLE1", COUPLE)), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexConcat( //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("[\\[]"), //
new RegexLeaf("QUALIFIER1", "([^\\[\\]]+)"), //
new RegexLeaf("[\\]]"), //
RegexLeaf.spaceOneOrMore() //
)), //
new RegexOptional(new RegexLeaf("FIRST_LABEL", "[%g]([^%g]+)[%g]")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexConcat(
//
new RegexLeaf("ARROW_HEAD1",
"((?<=[%s])+[ox]|[)#\\[<*+^}]|\\<_|\\<\\|[\\:\\|]|[<\\[]\\||\\}o|\\}\\||\\|o|\\|\\|)?"), //
new RegexLeaf("ARROW_BODY1", "([-=.]+)"), //
new RegexLeaf("ARROW_STYLE1", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_DIRECTION", "(left|right|up|down|le?|ri?|up?|do?)?"), //
new RegexOptional(new RegexLeaf("INSIDE", "(0|\\(0\\)|\\(0|0\\))(?=[-=.~])")), //
new RegexLeaf("ARROW_STYLE2", "(?:\\[(" + CommandLinkElement.LINE_STYLE + ")\\])?"), //
new RegexLeaf("ARROW_BODY2", "([-=.]*)"), //
new RegexLeaf("ARROW_HEAD2",
"([ox][%s]+|:\\>\\>?|_\\>|[(#\\]>*+^\\{]|[\\|\\:]\\|\\>|\\|[>\\]]|o\\{|\\|\\{|o\\||\\|\\|)?")), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional(new RegexLeaf("SECOND_LABEL", "[%g]([^%g]+)[%g]")), //
new RegexOptional(new RegexConcat( //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("[\\[]"), //
new RegexLeaf("QUALIFIER2", "([^\\[\\]]+)"), //
new RegexLeaf("[\\]]"), //
RegexLeaf.spaceOneOrMore() //
)), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOr( //
new RegexLeaf("ENT2", getClassIdentifier()), //
new RegexLeaf("COUPLE2", COUPLE)), //
RegexLeaf.spaceZeroOrMore(), //
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexOptional( //
new RegexConcat( //
new RegexLeaf(":"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("LABEL_LINK", "(.+)") //
)), RegexLeaf.end());
}
private static ColorParser color() {
return ColorParser.simpleColor(ColorType.LINE);
}
private static String getClassIdentifier() {
return "(" + getSeparator() + "?[%pLN_$]+(?:" + getSeparator() + "[%pLN_$]+)*|[%g][^%g]+[%g])";
}
public static String getSeparator() {
return "(?:\\.|::|\\\\|\\\\\\\\)";
}
@Override
protected CommandExecutionResult executeArg(AbstractClassOrObjectDiagram diagram, LineLocation location,
RegexResult arg) throws NoSuchColorException {
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
if (ent1String == null && ent2String == null)
return executeArgSpecial3(diagram, arg);
if (ent1String == null)
return executeArgSpecial1(diagram, arg);
if (ent2String == null)
return executeArgSpecial2(diagram, arg);
Ident ident1 = diagram.buildLeafIdentSpecial(ent1String);
Ident ident2 = diagram.buildLeafIdentSpecial(ent2String);
Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(ent1String);
Code code2 = diagram.V1972() ? ident2 : diagram.buildCode(ent2String);
if (isGroupButNotTheCurrentGroup(diagram, code1, ident1)
&& isGroupButNotTheCurrentGroup(diagram, code2, ident2)) {
return executePackageLink(diagram, arg);
}
String port1 = null;
String port2 = null;
if (diagram.V1972()) {
if ("::".equals(diagram.getNamespaceSeparator())) {
if (removeMemberPartIdentSpecial(diagram, ident1) != null) {
port1 = ident1.getLast();
ident1 = removeMemberPartIdentSpecial(diagram, ident1);
code1 = ident1;
}
if (removeMemberPartIdentSpecial(diagram, ident2) != null) {
port2 = ident2.getLast();
ident2 = removeMemberPartIdentSpecial(diagram, ident2);
code2 = ident1;
}
} else {
if (removeMemberPartIdent(diagram, ident1) != null) {
port1 = ident1.getPortMember();
ident1 = removeMemberPartIdent(diagram, ident1);
code1 = ident1;
}
if (removeMemberPartIdent(diagram, ident2) != null) {
port2 = ident2.getPortMember();
ident2 = removeMemberPartIdent(diagram, ident2);
code2 = ident2;
}
}
} else {
if (removeMemberPartLegacy1972(diagram, ident1) != null) {
port1 = ident1.getPortMember();
code1 = removeMemberPartLegacy1972(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (removeMemberPartLegacy1972(diagram, ident2) != null) {
port2 = ident2.getPortMember();
code2 = removeMemberPartLegacy1972(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
}
final IEntity cl1 = getFoo1(diagram, code1, ident1, ident1pure);
final IEntity cl2 = getFoo1(diagram, code2, ident2, ident2pure);
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
final int queue;
if (dir == Direction.LEFT || dir == Direction.RIGHT)
queue = 1;
else
queue = getQueueLength(arg);
final Labels labels = new Labels(arg);
final String kal1 = arg.get("QUALIFIER1", 0);
final String kal2 = arg.get("QUALIFIER2", 0);
final LinkArg linkArg = LinkArg
.build(labels.getDisplay(), queue, diagram.getSkinParam().classAttributeIconSize() > 0)
.withQuantifier(labels.getFirstLabel(), labels.getSecondLabel())
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()).withKal(kal1, kal2);
Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2,
linkType, linkArg);
if (arg.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), UrlMode.STRICT);
final Url url = urlBuilder.getUrl(arg.get("URL", 0));
link.setUrl(url);
}
link.setPortMembers(port1, port2);
if (dir == Direction.LEFT || dir == Direction.UP)
link = link.getInv();
link.setLinkArrow(labels.getLinkArrow());
link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
link.setCodeLine(location);
addLink(diagram, link, arg.get("HEADER", 0));
return CommandExecutionResult.ok();
}
private IEntity getFoo1(AbstractClassOrObjectDiagram diagram, Code code, Ident ident, Ident pure) {
if (isGroupButNotTheCurrentGroup(diagram, code, ident)) {
if (diagram.V1972())
return diagram.getGroupVerySmart(ident);
// final Code tap = ident.toCode(diagram);
// return diagram.getGroupStrict(ident);
return diagram.getGroupVerySmart(ident);
}
if (diagram.V1972()) {
final IEntity result = pure.size() == 1 ? diagram.getLeafVerySmart(ident) : diagram.getLeafStrict(ident);
if (result != null)
return result;
}
return diagram.getOrCreateLeaf(ident, code, null, null);
}
private boolean isGroupButNotTheCurrentGroup(AbstractClassOrObjectDiagram diagram, Code code, Ident ident) {
if (diagram.V1972()) {
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
return false;
return diagram.isGroupVerySmart(ident);
} else {
if (diagram.getCurrentGroup().getCodeGetName().equals(code.getName()))
return false;
if (diagram.isGroupStrict(ident))
return true;
return diagram.isGroup(code);
}
}
private Ident removeMemberPartIdentSpecial(AbstractClassOrObjectDiagram diagram, Ident ident) {
if (diagram.leafExistSmart(ident))
return null;
final Ident before = ident.parent();
if (before == null)
return null;
if (diagram.leafExistSmart(before) == false)
return null;
return before;
}
private Ident removeMemberPartIdent(AbstractClassOrObjectDiagram diagram, Ident ident) {
if (diagram.leafExistSmart(ident))
return null;
final Ident before = ident.removeMemberPart();
if (before == null)
return null;
if (diagram.leafExistSmart(before) == false)
return null;
return before;
}
private Code removeMemberPartLegacy1972(AbstractClassOrObjectDiagram diagram, Ident ident) {
if (diagram.leafExist(ident))
return null;
final Ident before = ident.removeMemberPart();
if (before == null)
return null;
final Code code = before.toCode(diagram);
if (diagram.leafExist(code) == false)
return null;
return code;
}
private void addLink(AbstractClassOrObjectDiagram diagram, Link link, String weight) {
diagram.addLink(link);
if (weight == null) {
// final LinkType type = link.getType();
// --|> highest
// --*, -->, --o normal
// ..*, ..>, ..o lowest
// if (type.isDashed() == false) {
// if (type.contains(LinkDecor.EXTENDS)) {
// link.setWeight(3);
// }
// if (type.contains(LinkDecor.ARROW) ||
// type.contains(LinkDecor.COMPOSITION)
// || type.contains(LinkDecor.AGREGATION)) {
// link.setWeight(2);
// }
// }
} else {
link.setWeight(Double.parseDouble(weight));
}
}
private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg)
throws NoSuchColorException {
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
Ident ident1 = diagram.buildLeafIdentSpecial(ent1String);
Ident ident2 = diagram.buildLeafIdentSpecial(ent2String);
Ident ident1pure = Ident.empty().add(ent1String, diagram.getNamespaceSeparator());
Ident ident2pure = Ident.empty().add(ent2String, diagram.getNamespaceSeparator());
Code code1 = diagram.V1972() ? ident1 : diagram.buildCode(ent1String);
Code code2 = diagram.V1972() ? ident2 : diagram.buildCode(ent2String);
if (diagram.V1972()) {
throw new UnsupportedOperationException("to be finished...");
} else {
if (removeMemberPartLegacy1972(diagram, ident1) != null) {
code1 = removeMemberPartLegacy1972(diagram, ident1);
ident1 = ident1.removeMemberPart();
}
if (removeMemberPartLegacy1972(diagram, ident2) != null) {
code2 = removeMemberPartLegacy1972(diagram, ident2);
ident2 = ident2.removeMemberPart();
}
}
final IEntity cl1 = getFoo1(diagram, code1, ident1, ident1pure);
final IEntity cl2 = getFoo1(diagram, code2, ident2, ident2pure);
// final IEntity cl1 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent1String))
// : diagram.getGroup(diagram.buildCode(ent1String));
// final IEntity cl2 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent2String))
// : diagram.getGroup(diagram.buildCode(ent2String));
final LinkType linkType = getLinkType(arg);
final Direction dir = getDirection(arg);
final int queue;
if (dir == Direction.LEFT || dir == Direction.RIGHT)
queue = 1;
else
queue = getQueueLength(arg);
final Display labelLink = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final String firstLabel = arg.get("FIRST_LABEL", 0);
final String secondLabel = arg.get("SECOND_LABEL", 0);
final LinkArg linkArg = LinkArg.build(labelLink, queue, diagram.getSkinParam().classAttributeIconSize() > 0);
final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
cl2, linkType, linkArg.withQuantifier(firstLabel, secondLabel)
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
diagram.resetPragmaLabel();
link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
addLink(diagram, link, arg.get("HEADER", 0));
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident1(diagram, arg);
final String name1A = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 0));
final String name1B = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("COUPLE1", 1));
final Code clName1A = diagram.buildCode(name1A);
final Code clName1B = diagram.buildCode(name1B);
if (diagram.leafExist(clName1A) == false)
return CommandExecutionResult.error("No class " + clName1A);
if (diagram.leafExist(clName1B) == false)
return CommandExecutionResult.error("No class " + clName1B);
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final Code ent2 = diagram.buildCode(idShort);
final IEntity cl2 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent2, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(1, name1A, name1B, cl2, linkType, label);
if (result == false)
return CommandExecutionResult.error("Cannot have more than 2 assocications");
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident1(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final Ident ident1A = diagram.buildLeafIdent(name1A);
final Ident ident1B = diagram.buildLeafIdent(name1B);
if (diagram.leafExistSmart(ident1A) == false)
return CommandExecutionResult.error("No class " + ident1A.getName());
if (diagram.leafExistSmart(ident1B) == false)
return CommandExecutionResult.error("No class " + ident1B.getName());
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final Ident ident2 = diagram.buildLeafIdent(idShort);
final IEntity cl2 = diagram.getOrCreateLeaf(ident2, ident2, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(1, name1A, name1B, cl2, linkType, label);
if (result == false)
return CommandExecutionResult.error("Cannot have more than 2 assocications");
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Ident ident2A = diagram.buildLeafIdent(name2A);
final Ident ident2B = diagram.buildLeafIdent(name2B);
if (diagram.leafExistSmart(ident2A) == false)
return CommandExecutionResult.error("No class " + ident2A.getName());
if (diagram.leafExistSmart(ident2B) == false)
return CommandExecutionResult.error("No class " + ident2B.getName());
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final Ident ident1 = diagram.buildLeafIdent(idShort);
final IEntity cl1 = diagram.getOrCreateLeaf(ident1, ident1, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(2, name2A, name2B, cl1, linkType, label);
if (result == false)
return CommandExecutionResult.error("Cannot have more than 2 assocications");
return CommandExecutionResult.ok();
}
private CommandExecutionResult executeArgSpecial1972Ident3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Ident ident1A = diagram.buildLeafIdent(name1A);
final Ident ident1B = diagram.buildLeafIdent(name1B);
final Ident ident2A = diagram.buildLeafIdent(name2A);
final Ident ident2B = diagram.buildLeafIdent(name2B);
if (diagram.leafExistSmart(ident1A) == false)
return CommandExecutionResult.error("No class " + ident1A.getName());
if (diagram.leafExistSmart(ident1B) == false)
return CommandExecutionResult.error("No class " + ident1B.getName());
if (diagram.leafExistSmart(ident2A) == false)
return CommandExecutionResult.error("No class " + ident2A.getName());
if (diagram.leafExistSmart(ident2B) == false)
return CommandExecutionResult.error("No class " + ident2B.getName());
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
return diagram.associationClass(name1A, name1B, name2A, name2B, linkType, label);
}
private CommandExecutionResult executeArgSpecial3(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident3(diagram, arg);
final String name1A = arg.get("COUPLE1", 0);
final String name1B = arg.get("COUPLE1", 1);
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Code clName1A = diagram.buildCode(name1A);
final Code clName1B = diagram.buildCode(name1B);
final Code clName2A = diagram.buildCode(name2A);
final Code clName2B = diagram.buildCode(name2B);
if (diagram.leafExist(clName1A) == false)
return CommandExecutionResult.error("No class " + clName1A);
if (diagram.leafExist(clName1B) == false)
return CommandExecutionResult.error("No class " + clName1B);
if (diagram.leafExist(clName2A) == false)
return CommandExecutionResult.error("No class " + clName2A);
if (diagram.leafExist(clName2B) == false)
return CommandExecutionResult.error("No class " + clName2B);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
return diagram.associationClass(name1A, name1B, name2A, name2B, linkType, label);
}
private CommandExecutionResult executeArgSpecial2(AbstractClassOrObjectDiagram diagram, RegexResult arg) {
if (diagram.V1972())
return executeArgSpecial1972Ident2(diagram, arg);
final String name2A = arg.get("COUPLE2", 0);
final String name2B = arg.get("COUPLE2", 1);
final Code clName2A = diagram.buildCode(name2A);
final Code clName2B = diagram.buildCode(name2B);
if (diagram.leafExist(clName2A) == false)
return CommandExecutionResult.error("No class " + clName2A);
if (diagram.leafExist(clName2B) == false)
return CommandExecutionResult.error("No class " + clName2B);
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final Code ent1 = diagram.buildCode(idShort);
final IEntity cl1 = diagram.getOrCreateLeaf(diagram.buildLeafIdent(idShort), ent1, null, null);
final LinkType linkType = getLinkType(arg);
final Display label = Display.getWithNewlines(arg.get("LABEL_LINK", 0));
final boolean result = diagram.associationClass(2, name2A, name2B, cl1, linkType, label);
if (result == false)
return CommandExecutionResult.error("Cannot have more than 2 assocications");
return CommandExecutionResult.ok();
}
private LinkDecor getDecors1(String s) {
if (s == null) {
return LinkDecor.NONE;
}
s = StringUtils.trin(s);
if ("<|".equals(s))
return LinkDecor.EXTENDS;
if ("<|:".equals(s))
return LinkDecor.DEFINEDBY;
if ("<||".equals(s))
return LinkDecor.REDEFINES;
if ("}".equals(s))
return LinkDecor.CROWFOOT;
if ("}o".equals(s))
return LinkDecor.CIRCLE_CROWFOOT;
if ("}|".equals(s))
return LinkDecor.LINE_CROWFOOT;
if ("|o".equals(s))
return LinkDecor.CIRCLE_LINE;
if ("||".equals(s))
return LinkDecor.DOUBLE_LINE;
if ("<".equals(s))
return LinkDecor.ARROW;
if ("^".equals(s))
return LinkDecor.EXTENDS;
if ("+".equals(s))
return LinkDecor.PLUS;
if ("o".equals(s))
return LinkDecor.AGREGATION;
if ("x".equals(s))
return LinkDecor.NOT_NAVIGABLE;
if ("*".equals(s))
return LinkDecor.COMPOSITION;
if ("#".equals(s))
return LinkDecor.SQUARE;
if (")".equals(s))
return LinkDecor.PARENTHESIS;
return LinkDecor.NONE;
}
private LinkDecor getDecors2(String s) {
if (s == null)
return LinkDecor.NONE;
s = StringUtils.trin(s);
if ("|>".equals(s))
return LinkDecor.EXTENDS;
if (":|>".equals(s))
return LinkDecor.DEFINEDBY;
if ("||>".equals(s))
return LinkDecor.REDEFINES;
if (">".equals(s))
return LinkDecor.ARROW;
if ("{".equals(s))
return LinkDecor.CROWFOOT;
if ("o{".equals(s))
return LinkDecor.CIRCLE_CROWFOOT;
if ("|{".equals(s))
return LinkDecor.LINE_CROWFOOT;
if ("o|".equals(s))
return LinkDecor.CIRCLE_LINE;
if ("||".equals(s))
return LinkDecor.DOUBLE_LINE;
if ("^".equals(s))
return LinkDecor.EXTENDS;
if ("+".equals(s))
return LinkDecor.PLUS;
if ("o".equals(s))
return LinkDecor.AGREGATION;
if ("x".equals(s))
return LinkDecor.NOT_NAVIGABLE;
if ("*".equals(s))
return LinkDecor.COMPOSITION;
if ("#".equals(s))
return LinkDecor.SQUARE;
if ("(".equals(s))
return LinkDecor.PARENTHESIS;
return LinkDecor.NONE;
}
private LinkType getLinkType(RegexResult arg) {
final LinkDecor decors1 = getDecors1(getArrowHead1(arg));
final LinkDecor decors2 = getDecors2(getArrowHead2(arg));
LinkType result = new LinkType(decors2, decors1);
if (arg.get("ARROW_BODY1", 0).contains(".") || arg.get("ARROW_BODY2", 0).contains("."))
result = result.goDashed();
final String middle = arg.get("INSIDE", 0);
if ("0".equals(middle))
result = result.withMiddleCircle();
else if ("0)".equals(middle))
result = result.withMiddleCircleCircled1();
else if ("(0".equals(middle))
result = result.withMiddleCircleCircled2();
else if ("(0)".equals(middle))
result = result.withMiddleCircleCircled();
return result;
}
private int getQueueLength(RegexResult arg) {
String s = getFullArrow(arg);
s = s.replaceAll("[^-.=]", "");
return s.length();
}
private Direction getDirection(RegexResult arg) {
// final LinkDecor decors1 = getDecors1(getArrowHead1(arg));
// final LinkDecor decors2 = getDecors2(getArrowHead2(arg));
String s = getFullArrow(arg);
s = s.replaceAll("[^-.=\\w]", "");
if (s.startsWith("o"))
s = s.substring(1);
if (s.endsWith("o"))
s = s.substring(0, s.length() - 1);
Direction result = StringUtils.getQueueDirection(s);
// if (isInversed(decors1, decors2) && s.matches(".*\\w.*")) {
// result = result.getInv();
// }
return result;
}
private String getArrowHead1(RegexResult arg) {
return getArrowHead(arg, "ARROW_HEAD1");
}
private String getArrowHead2(RegexResult arg) {
return getArrowHead(arg, "ARROW_HEAD2");
}
private String getArrowHead(RegexResult arg, final String key) {
return notNull(arg.get(key, 0));
}
private String getFullArrow(RegexResult arg) {
return getArrowHead1(arg) + notNull(arg.get("ARROW_BODY1", 0)) + notNull(arg.get("ARROW_DIRECTION", 0))
+ notNull(arg.get("ARROW_BODY2", 0)) + getArrowHead2(arg);
}
public static String notNull(String s) {
if (s == null)
return "";
return s;
}
}

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.Matcher2;
@ -50,7 +51,6 @@ import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -189,9 +189,9 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
}
final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(labelLink), length,
diagram.getSkinParam().classAttributeIconSize() > 0);
final Link link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2, linkType,
linkArg.withQuantifier(firstLabel, secondLabel).withDistanceAngle(diagram.getLabeldistance(),
diagram.getLabelangle()));
final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
cl2, linkType, linkArg.withQuantifier(firstLabel, secondLabel)
.withDistanceAngle(diagram.getLabeldistance(), diagram.getLabelangle()));
diagram.resetPragmaLabel();
addLink(diagram, link, arg.get("HEADER", 0));

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -43,7 +44,6 @@ import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.CucaDiagram;
public class CommandNamespaceSeparator extends SingleLineCommand2<CucaDiagram> {

View File

@ -36,13 +36,13 @@
package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
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 CommandRemoveRestore extends SingleLineCommand2<CucaDiagram> {

View File

@ -37,6 +37,7 @@ package net.sourceforge.plantuml.classdiagram.command;
import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -45,7 +46,6 @@ 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.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -48,7 +49,6 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
public class CommandUrl extends SingleLineCommand2<AbstractEntityDiagram> {

View File

@ -36,13 +36,13 @@
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
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.EntityUtils;
import net.sourceforge.plantuml.cucadiagram.IGroup;
public class CommandEndPackage extends SingleLineCommand2<AbstractEntityDiagram> {

View File

@ -39,6 +39,8 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
@ -47,8 +49,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;

View File

@ -39,6 +39,8 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
@ -47,8 +49,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;

View File

@ -39,6 +39,8 @@ import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.classdiagram.ClassDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
@ -47,8 +49,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotype;

View File

@ -40,6 +40,8 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -50,8 +52,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.cucadiagram.Stereotag;

View File

@ -37,6 +37,8 @@ package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
@ -46,8 +48,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
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.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;
import net.sourceforge.plantuml.graphic.color.ColorType;

View File

@ -39,6 +39,7 @@ import java.util.List;
import java.util.Map;
import net.sourceforge.plantuml.AbstractPSystem;
import net.sourceforge.plantuml.EmbeddedDiagram;
import net.sourceforge.plantuml.ErrorUml;
import net.sourceforge.plantuml.ErrorUmlType;
import net.sourceforge.plantuml.LineLocation;
@ -190,18 +191,25 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
return null;
}
private BlocLines addOneSingleLineManageEmbedded2(IteratorCounter2 it, BlocLines lines) {
private static BlocLines addOneSingleLineManageEmbedded2(IteratorCounter2 it, BlocLines lines) {
final StringLocated linetoBeAdded = it.next();
lines = lines.add(linetoBeAdded);
if (linetoBeAdded.getTrimmed().getString().equals("{{")) {
if (EmbeddedDiagram.getEmbeddedType(linetoBeAdded.getTrimmed().getString()) != null) {
int nested = 1;
while (it.hasNext()) {
final StringLocated s = it.next();
lines = lines.add(s);
if (s.getTrimmed().getString().equals("}}"))
return lines;
if (EmbeddedDiagram.getEmbeddedType(s.getTrimmed().getString()) != null)
// if (s.getTrimmed().getString().startsWith(EmbeddedDiagram.EMBEDDED_START))
nested++;
else if (s.getTrimmed().getString().equals(EmbeddedDiagram.EMBEDDED_END)) {
nested--;
if (nested == 0)
return lines;
}
}
}
return lines;
}

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.command.note;
import java.util.List;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
@ -45,7 +46,6 @@ import net.sourceforge.plantuml.command.regex.IRegex;
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;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.graphic.color.ColorParser;
import net.sourceforge.plantuml.graphic.color.ColorType;

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.command.note;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.BlocLines;
@ -50,7 +51,6 @@ 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.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Stereotag;

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.activitydiagram.ActivityDiagram;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -55,7 +56,6 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -152,8 +152,8 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
note.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(s));
note.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
IEntity activity = diagram.getLastEntityConsulted();
if (activity == null) {
@ -168,17 +168,17 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).goDashed();
if (position == Position.RIGHT) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), activity, note, type,
LinkArg.noDisplay(1));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), activity, note,
type, LinkArg.noDisplay(1));
} else if (position == Position.LEFT) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), note, activity, type,
LinkArg.noDisplay(1));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), note, activity,
type, LinkArg.noDisplay(1));
} else if (position == Position.BOTTOM) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), activity, note, type,
LinkArg.noDisplay(2));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), activity, note,
type, LinkArg.noDisplay(2));
} else if (position == Position.TOP) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), note, activity, type,
LinkArg.noDisplay(2));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), note, activity,
type, LinkArg.noDisplay(2));
} else {
throw new IllegalArgumentException();
}

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.classdiagram.command.CommandCreateClassMultilines;
import net.sourceforge.plantuml.command.BlocLines;
@ -57,7 +58,6 @@ import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexOr;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -272,15 +272,19 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).goDashed();
if (position == Position.RIGHT) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), cl1, note, type, LinkArg.noDisplay(1));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1, note,
type, LinkArg.noDisplay(1));
link.setHorizontalSolitary(true);
} else if (position == Position.LEFT) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), note, cl1, type, LinkArg.noDisplay(1));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), note, cl1,
type, LinkArg.noDisplay(1));
link.setHorizontalSolitary(true);
} else if (position == Position.BOTTOM) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), cl1, note, type, LinkArg.noDisplay(2));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1, note,
type, LinkArg.noDisplay(2));
} else if (position == Position.TOP) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), note, cl1, type, LinkArg.noDisplay(2));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), note, cl1,
type, LinkArg.noDisplay(2));
} else {
throw new IllegalArgumentException();
}

View File

@ -40,6 +40,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.CucaDiagram;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.Command;
import net.sourceforge.plantuml.command.CommandExecutionResult;
@ -52,7 +53,6 @@ import net.sourceforge.plantuml.command.regex.IRegex;
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;
import net.sourceforge.plantuml.cucadiagram.CucaNote;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.graphic.color.ColorParser;

View File

@ -39,6 +39,7 @@ import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlMode;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.command.BlocLines;
import net.sourceforge.plantuml.command.Command;
@ -52,7 +53,6 @@ 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.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.cucadiagram.Link;
@ -166,11 +166,11 @@ public final class CommandFactoryTipOnEntity implements SingleMultiFactoryComman
final LinkType type = new LinkType(LinkDecor.NONE, LinkDecor.NONE).getInvisible();
final Link link;
if (position == Position.RIGHT) {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), cl1, (IEntity) tips, type,
LinkArg.noDisplay(1));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
(IEntity) tips, type, LinkArg.noDisplay(1));
} else {
link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), (IEntity) tips, cl1, type,
LinkArg.noDisplay(1));
link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(),
(IEntity) tips, cl1, type, LinkArg.noDisplay(1));
}
diagram.addLink(link);
}

View File

@ -39,10 +39,10 @@ import java.util.Map;
import java.util.Objects;
import net.sourceforge.plantuml.UmlDiagramType;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.classdiagram.AbstractEntityDiagram;
import net.sourceforge.plantuml.core.UmlSource;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.LeafType;
import net.sourceforge.plantuml.graphic.USymbol;

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.compositediagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -46,7 +47,6 @@ import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.compositediagram.CompositeDiagram;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
public class CommandCreateBlock extends SingleLineCommand2<CompositeDiagram> {

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.compositediagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.IGroup;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -47,7 +48,6 @@ import net.sourceforge.plantuml.compositediagram.CompositeDiagram;
import net.sourceforge.plantuml.cucadiagram.Code;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.GroupType;
import net.sourceforge.plantuml.cucadiagram.IGroup;
import net.sourceforge.plantuml.cucadiagram.Ident;
import net.sourceforge.plantuml.cucadiagram.NamespaceStrategy;

View File

@ -36,6 +36,7 @@
package net.sourceforge.plantuml.compositediagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -43,7 +44,6 @@ 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.compositediagram.CompositeDiagram;
import net.sourceforge.plantuml.cucadiagram.IEntity;
public class CommandEndPackageBlock extends SingleLineCommand2<CompositeDiagram> {

View File

@ -35,6 +35,7 @@
package net.sourceforge.plantuml.compositediagram.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.baraye.a.IEntity;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.command.regex.IRegex;
@ -44,7 +45,6 @@ import net.sourceforge.plantuml.command.regex.RegexOptional;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.compositediagram.CompositeDiagram;
import net.sourceforge.plantuml.cucadiagram.Display;
import net.sourceforge.plantuml.cucadiagram.IEntity;
import net.sourceforge.plantuml.cucadiagram.Link;
import net.sourceforge.plantuml.cucadiagram.LinkArg;
import net.sourceforge.plantuml.cucadiagram.LinkDecor;
@ -95,7 +95,8 @@ public class CommandLinkBlock extends SingleLineCommand2<CompositeDiagram> {
final LinkArg linkArg = LinkArg.build(Display.getWithNewlines(arg.get("DISPLAY", 0)), queue.length(),
diagram.getSkinParam().classAttributeIconSize() > 0);
final Link link = new Link(diagram.getSkinParam().getCurrentStyleBuilder(), cl1, cl2, linkType, linkArg);
final Link link = new Link(diagram.getIEntityFactory(), diagram.getSkinParam().getCurrentStyleBuilder(), cl1,
cl2, linkType, linkArg);
diagram.addLink(link);
return CommandExecutionResult.ok();
}

Some files were not shown because too many files have changed in this diff Show More