Skip to content

Commit

Permalink
Bump PlantUML version to 1.2022.14.
Browse files Browse the repository at this point in the history
Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
  • Loading branch information
sjoerdtalsma committed Dec 30, 2022
1 parent a254211 commit 64ea72f
Show file tree
Hide file tree
Showing 447 changed files with 7,913 additions and 2,786 deletions.
161 changes: 87 additions & 74 deletions src/plantuml-asl/src/net/sourceforge/plantuml/EmbeddedDiagram.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
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.Neutron;
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;
Expand All @@ -54,18 +56,90 @@
import net.sourceforge.plantuml.ugraphic.UImageSvg;
import net.sourceforge.plantuml.ugraphic.UShape;

class EmbeddedDiagramDraw extends AbstractTextBlock implements Line, Atom {
private BufferedImage image;
private final ISkinSimple skinParam;
private final List<StringLocated> as2;
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);

public List<Atom> splitInTwo(StringBounder stringBounder, double width) {
return Arrays.asList((Atom) this);
}

EmbeddedDiagramDraw(ISkinSimple skinParam, List<StringLocated> as2) {
private final List<StringLocated> list;
private final ISkinSimple skinParam;
private BufferedImage image;

private EmbeddedDiagram(ISkinSimple skinParam, List<StringLocated> system) {
this.list = system;
this.skinParam = skinParam;
this.as2 = as2;
}

public static EmbeddedDiagram from(ISkinSimple skinParam, List<String> strings) {
return new EmbeddedDiagram(skinParam, BlockUml.convert(strings));
}

public double getStartingAltitude(StringBounder stringBounder) {
Expand Down Expand Up @@ -132,75 +206,14 @@ public HorizontalAlignment getHorizontalAlignment() {
}

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());
@Override
public List<Neutron> getNeutrons() {
return Arrays.asList(Neutron.create(this));
}

}
8 changes: 4 additions & 4 deletions src/plantuml-asl/src/net/sourceforge/plantuml/FileFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,11 @@ public boolean equalsMetadata(String currentMetadata, SFile existingFile) {
if (svg == null)
return false;

final String currentSignature = SvgGraphics.getMD5Hex(currentMetadata);
final int idx = svg.lastIndexOf(SvgGraphics.MD5_HEADER);
final String currentSignature = SvgGraphics.getMetadataHex(currentMetadata);
final int idx = svg.lastIndexOf(SvgGraphics.META_HEADER);
if (idx != -1) {
final String part = svg.substring(idx + SvgGraphics.MD5_HEADER.length());
return part.startsWith(currentSignature);
final String part = svg.substring(idx + SvgGraphics.META_HEADER.length());
return part.startsWith(currentSignature + "]");
}

}
Expand Down
8 changes: 6 additions & 2 deletions src/plantuml-asl/src/net/sourceforge/plantuml/FileSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ public SFile getCurrentDir() {
}

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();

Expand Down
3 changes: 3 additions & 0 deletions src/plantuml-asl/src/net/sourceforge/plantuml/ISkinParam.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import java.util.Collection;

import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
import net.sourceforge.plantuml.cucadiagram.Rankdir;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
Expand Down Expand Up @@ -187,4 +188,6 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir
public LengthAdjust getlengthAdjust();

public double getParamSameClassWidth();

public Arrows arrows();
}
10 changes: 10 additions & 0 deletions src/plantuml-asl/src/net/sourceforge/plantuml/ISkinSimple.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@

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 {
Expand All @@ -54,4 +58,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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class LineBreakStrategy {
public LineBreakStrategy(String value) {
this.value = value;
}

@Override
public String toString() {
return value;
Expand All @@ -50,9 +50,9 @@ public boolean isAuto() {
}

public double getMaxWidth() {
if (value != null && value.matches("-?\\d+")) {
if (value != null && value.matches("-?\\d+"))
return Double.parseDouble(value);
}

return 0;
}

Expand Down
Loading

0 comments on commit 64ea72f

Please sign in to comment.