Skip to content

Commit 43adb9a

Browse files
committed
Bump PlantUML version to 1.2022.14.
Signed-off-by: Sjoerd Talsma <[email protected]>
1 parent d318a22 commit 43adb9a

File tree

447 files changed

+7913
-2786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

447 files changed

+7913
-2786
lines changed

src/plantuml-asl/src/net/sourceforge/plantuml/EmbeddedDiagram.java

Lines changed: 87 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@
3333
import java.awt.image.BufferedImage;
3434
import java.io.ByteArrayOutputStream;
3535
import java.io.IOException;
36+
import java.util.ArrayList;
3637
import java.util.Arrays;
38+
import java.util.Iterator;
3739
import java.util.List;
3840

3941
import net.sourceforge.plantuml.awt.geom.XDimension2D;
4042
import net.sourceforge.plantuml.core.Diagram;
43+
import net.sourceforge.plantuml.creole.Neutron;
4144
import net.sourceforge.plantuml.creole.atom.Atom;
42-
import net.sourceforge.plantuml.cucadiagram.Display;
4345
import net.sourceforge.plantuml.graphic.AbstractTextBlock;
4446
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
4547
import net.sourceforge.plantuml.graphic.Line;
@@ -54,18 +56,90 @@
5456
import net.sourceforge.plantuml.ugraphic.UImageSvg;
5557
import net.sourceforge.plantuml.ugraphic.UShape;
5658

57-
class EmbeddedDiagramDraw extends AbstractTextBlock implements Line, Atom {
58-
private BufferedImage image;
59-
private final ISkinSimple skinParam;
60-
private final List<StringLocated> as2;
59+
public class EmbeddedDiagram extends AbstractTextBlock implements Line, Atom {
60+
61+
public static final String EMBEDDED_START = "{{";
62+
public static final String EMBEDDED_END = "}}";
63+
64+
public static String getEmbeddedType(CharSequence cs) {
65+
if (cs == null)
66+
return null;
67+
68+
final String s = StringUtils.trin(cs.toString());
69+
if (s.startsWith(EMBEDDED_START) == false)
70+
return null;
71+
72+
if (s.equals(EMBEDDED_START))
73+
return "uml";
74+
75+
if (s.equals(EMBEDDED_START))
76+
return "uml";
77+
78+
if (s.equals(EMBEDDED_START + "uml"))
79+
return "uml";
80+
81+
if (s.equals(EMBEDDED_START + "wbs"))
82+
return "wbs";
83+
84+
if (s.equals(EMBEDDED_START + "mindmap"))
85+
return "mindmap";
86+
87+
if (s.equals(EMBEDDED_START + "gantt"))
88+
return "gantt";
89+
90+
if (s.equals(EMBEDDED_START + "json"))
91+
return "json";
92+
93+
if (s.equals(EMBEDDED_START + "yaml"))
94+
return "yaml";
95+
96+
if (s.equals(EMBEDDED_START + "wire"))
97+
return "wire";
98+
99+
if (s.equals(EMBEDDED_START + "creole"))
100+
return "creole";
101+
102+
if (s.equals(EMBEDDED_START + "board"))
103+
return "board";
104+
105+
if (s.equals(EMBEDDED_START + "ebnf"))
106+
return "ebnf";
107+
108+
return null;
109+
}
110+
111+
public static EmbeddedDiagram createAndSkip(String type, Iterator<CharSequence> it, ISkinSimple skinParam) {
112+
final List<String> result = new ArrayList<String>();
113+
result.add("@start" + type);
114+
int nested = 1;
115+
while (it.hasNext()) {
116+
final CharSequence s2 = it.next();
117+
if (EmbeddedDiagram.getEmbeddedType(StringUtils.trinNoTrace(s2)) != null)
118+
// if (StringUtils.trinNoTrace(s2).startsWith(EmbeddedDiagram.EMBEDDED_START))
119+
nested++;
120+
else if (StringUtils.trinNoTrace(s2).equals(EmbeddedDiagram.EMBEDDED_END)) {
121+
nested--;
122+
if (nested == 0)
123+
break;
124+
}
125+
result.add(s2.toString());
126+
}
127+
result.add("@end" + type);
128+
return EmbeddedDiagram.from(skinParam, result);
61129

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

66-
EmbeddedDiagramDraw(ISkinSimple skinParam, List<StringLocated> as2) {
132+
private final List<StringLocated> list;
133+
private final ISkinSimple skinParam;
134+
private BufferedImage image;
135+
136+
private EmbeddedDiagram(ISkinSimple skinParam, List<StringLocated> system) {
137+
this.list = system;
67138
this.skinParam = skinParam;
68-
this.as2 = as2;
139+
}
140+
141+
public static EmbeddedDiagram from(ISkinSimple skinParam, List<String> strings) {
142+
return new EmbeddedDiagram(skinParam, BlockUml.convert(strings));
69143
}
70144

71145
public double getStartingAltitude(StringBounder stringBounder) {
@@ -132,75 +206,14 @@ public HorizontalAlignment getHorizontalAlignment() {
132206
}
133207

134208
private Diagram getSystem() throws IOException, InterruptedException {
135-
final BlockUml blockUml = new BlockUml(as2, Defines.createEmpty(), skinParam, null, null);
209+
final BlockUml blockUml = new BlockUml(list, Defines.createEmpty(), skinParam, null, null);
136210
return blockUml.getDiagram();
137211

138212
}
139-
}
140-
141-
public class EmbeddedDiagram implements CharSequence {
142-
143-
public static String getEmbeddedType(CharSequence s) {
144-
if (s == null)
145-
return null;
146-
147-
s = StringUtils.trin(s.toString());
148-
if (s.equals("{{"))
149-
return "uml";
150-
151-
if (s.equals("{{uml"))
152-
return "uml";
153-
154-
if (s.equals("{{wbs"))
155-
return "wbs";
156-
157-
if (s.equals("{{mindmap"))
158-
return "mindmap";
159-
160-
if (s.equals("{{gantt"))
161-
return "gantt";
162-
163-
if (s.equals("{{json"))
164-
return "json";
165-
166-
if (s.equals("{{yaml"))
167-
return "yaml";
168-
169-
if (s.equals("{{wire"))
170-
return "wire";
171-
172-
if (s.equals("{{creole"))
173-
return "creole";
174-
175-
if (s.equals("{{board"))
176-
return "board";
177-
178-
if (s.equals("{{ebnf"))
179-
return "ebnf";
180-
181-
return null;
182-
}
183-
184-
private final Display system;
185-
186-
public EmbeddedDiagram(Display system) {
187-
this.system = system;
188-
}
189-
190-
public int length() {
191-
return toString().length();
192-
}
193-
194-
public char charAt(int index) {
195-
return toString().charAt(index);
196-
}
197-
198-
public CharSequence subSequence(int start, int end) {
199-
return toString().subSequence(start, end);
200-
}
201213

202-
public EmbeddedDiagramDraw asDraw(ISkinSimple skinParam) {
203-
return new EmbeddedDiagramDraw(skinParam, system.as2());
214+
@Override
215+
public List<Neutron> getNeutrons() {
216+
return Arrays.asList(Neutron.create(this));
204217
}
205218

206219
}

src/plantuml-asl/src/net/sourceforge/plantuml/FileFormat.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,11 @@ public boolean equalsMetadata(String currentMetadata, SFile existingFile) {
288288
if (svg == null)
289289
return false;
290290

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

298298
}

src/plantuml-asl/src/net/sourceforge/plantuml/FileSystem.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,17 @@ public SFile getCurrentDir() {
6767
}
6868

6969
public SFile getFile(String nameOrPath) throws IOException {
70-
if (isAbsolute(nameOrPath))
71-
return new SFile(nameOrPath).getCanonicalFile();
70+
if (isAbsolute(nameOrPath)) {
71+
final SFile result = new SFile(nameOrPath);
72+
Log.info("Trying " + result.getAbsolutePath());
73+
return result.getCanonicalFile();
74+
}
7275

7376
final SFile dir = getCurrentDir();
7477
SFile filecurrent = null;
7578
if (dir != null) {
7679
filecurrent = dir.getAbsoluteFile().file(nameOrPath);
80+
Log.info("Current dir is " + dir.getAbsolutePath() + " so trying " + filecurrent.getAbsolutePath());
7781
if (filecurrent.exists())
7882
return filecurrent.getCanonicalFile();
7983

src/plantuml-asl/src/net/sourceforge/plantuml/ISkinParam.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
import java.util.Collection;
3434

35+
import net.sourceforge.plantuml.activitydiagram3.ftile.Arrows;
3536
import net.sourceforge.plantuml.cucadiagram.Rankdir;
3637
import net.sourceforge.plantuml.cucadiagram.Stereotype;
3738
import net.sourceforge.plantuml.cucadiagram.dot.DotSplines;
@@ -187,4 +188,6 @@ public HorizontalAlignment getHorizontalAlignment(AlignmentParam param, ArrowDir
187188
public LengthAdjust getlengthAdjust();
188189

189190
public double getParamSameClassWidth();
191+
192+
public Arrows arrows();
190193
}

src/plantuml-asl/src/net/sourceforge/plantuml/ISkinSimple.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232

3333
import java.util.Map;
3434

35+
import net.sourceforge.plantuml.creole.CreoleMode;
36+
import net.sourceforge.plantuml.creole.SheetBuilder;
37+
import net.sourceforge.plantuml.graphic.FontConfiguration;
38+
import net.sourceforge.plantuml.graphic.HorizontalAlignment;
3539
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
3640

3741
public interface ISkinSimple extends SpriteContainer {
@@ -54,4 +58,10 @@ public interface ISkinSimple extends SpriteContainer {
5458

5559
public void copyAllFrom(Map<String, String> other);
5660

61+
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
62+
CreoleMode creoleMode);
63+
64+
public SheetBuilder sheet(FontConfiguration fontConfiguration, HorizontalAlignment horizontalAlignment,
65+
CreoleMode creoleMode, FontConfiguration stereo);
66+
5767
}

src/plantuml-asl/src/net/sourceforge/plantuml/LineBreakStrategy.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class LineBreakStrategy {
3939
public LineBreakStrategy(String value) {
4040
this.value = value;
4141
}
42-
42+
4343
@Override
4444
public String toString() {
4545
return value;
@@ -50,9 +50,9 @@ public boolean isAuto() {
5050
}
5151

5252
public double getMaxWidth() {
53-
if (value != null && value.matches("-?\\d+")) {
53+
if (value != null && value.matches("-?\\d+"))
5454
return Double.parseDouble(value);
55-
}
55+
5656
return 0;
5757
}
5858

0 commit comments

Comments
 (0)