diff --git a/pom.xml b/pom.xml
index 25453a32c..df348e2bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -136,6 +136,7 @@
net/sourceforge/plantuml/dedication/*.png
net/sourceforge/plantuml/math/*.js
net/sourceforge/plantuml/windowsdot/*.dat
+ net/sourceforge/plantuml/utils/*.txt
diff --git a/skin/plantuml.skin b/skin/plantuml.skin
index 3f23c79b1..ccdb68f17 100644
--- a/skin/plantuml.skin
+++ b/skin/plantuml.skin
@@ -323,7 +323,10 @@ usecase {
HorizontalAlignment center
}
-yamlDiagram {
+yamlDiagram,jsonDiagram {
+ BackGroundColor white
+ FontColor black
+ LineColor black
arrow {
LineThickness 1
LineStyle 3;3
@@ -333,25 +336,9 @@ yamlDiagram {
RoundCorner 10
separator {
LineThickness 1
- LineColor #A80036
}
- highlight {
- BackGroundColor #ccff02
- }
- }
-}
-
-jsonDiagram {
- arrow {
- LineThickness 1
- LineStyle 3;3
- }
- node {
- LineThickness 1.5
- RoundCorner 10
- separator {
- LineThickness 1
- LineColor #A80036
+ header {
+ FontStyle bold
}
highlight {
BackGroundColor #ccff02
diff --git a/src/net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java b/src/net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java
index 8fc11a36c..bd12d2e38 100644
--- a/src/net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java
+++ b/src/net/sourceforge/plantuml/jsondiagram/SmetanaForJson.java
@@ -109,16 +109,22 @@ public class SmetanaForJson {
this.ug = ug;
}
- private UGraphic getUgFor(SName name) {
- return getStyle(name).applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(), skinParam.getThemeStyle());
- }
-
private SName getDiagramType() {
return skinParam.getUmlDiagramType() == UmlDiagramType.YAML ? SName.yamlDiagram : SName.jsonDiagram;
}
- private Style getStyle(SName name) {
- return StyleSignature.of(SName.root, SName.element, getDiagramType(), name)
+ private Style getStyleArrow() {
+ return StyleSignature.of(SName.root, SName.element, getDiagramType(), SName.arrow)
+ .getMergedStyle(skinParam.getCurrentStyleBuilder());
+ }
+
+ private Style getStyleNode() {
+ return StyleSignature.of(SName.root, SName.element, getDiagramType(), SName.node)
+ .getMergedStyle(skinParam.getCurrentStyleBuilder());
+ }
+
+ private Style getStyleNodeHeader() {
+ return StyleSignature.of(SName.root, SName.element, getDiagramType(), SName.header, SName.node)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
}
@@ -127,9 +133,14 @@ public class SmetanaForJson {
.getMergedStyle(skinParam.getCurrentStyleBuilder());
}
+ private Style getStyleNodeHeaderHighlight() {
+ return StyleSignature.of(SName.root, SName.element, getDiagramType(), SName.header, SName.node, SName.highlight)
+ .getMergedStyle(skinParam.getCurrentStyleBuilder());
+ }
+
private ST_Agnode_s manageOneNode(JsonValue current, List highlighted) {
- final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted, getStyle(SName.node),
- getStyleNodeHighlight());
+ final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted, getStyleNode(),
+ getStyleNodeHighlight(), getStyleNodeHeader(), getStyleNodeHeaderHighlight());
final ST_Agnode_s node1 = createNode(block.calculateDimension(stringBounder), block.size(), current.isArray(),
(int) block.getWidthColA(stringBounder), (int) block.getWidthColB(stringBounder));
nodes.add(new InternalNode(block, node1));
@@ -171,16 +182,20 @@ public class SmetanaForJson {
xMirror = new Mirror(max);
for (InternalNode node : nodes) {
- node.block.drawU(getUgFor(SName.node).apply(getPosition(node.node)));
+ node.block.drawU(
+ getStyleNode().applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(), skinParam.getThemeStyle())
+ .apply(getPosition(node.node)));
}
- final HColor color = getStyle(SName.arrow).value(PName.LineColor).asColor(skinParam.getThemeStyle(),
+ final HColor color = getStyleArrow().value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
for (ST_Agedge_s edge : edges) {
final JsonCurve curve = getCurve(edge, 13);
- // curve.drawCurve(color, getUgFor(SName.arrow).apply(new UStroke(3, 3, 1)));
- curve.drawCurve(color, getUgFor(SName.arrow));
- curve.drawSpot(getUgFor(SName.arrow).apply(color.bg()));
+ curve.drawCurve(color, getStyleArrow().applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(),
+ skinParam.getThemeStyle()));
+ curve.drawSpot(
+ getStyleArrow().applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(), skinParam.getThemeStyle())
+ .apply(color.bg()));
}
}
diff --git a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
index a06142390..e7107e261 100644
--- a/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
+++ b/src/net/sourceforge/plantuml/jsondiagram/TextBlockJson.java
@@ -70,8 +70,10 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
private final List lines = new ArrayList<>();
- private final Style style;
- private final Style styleHightlight;
+ private final Style styleNode;
+ private final Style styleNodeHightlight;
+ private final Style styleNodeHeader;
+ private final Style styleNodeHeaderHighlight;
private final ISkinParam skinParam;
private double totalWidth;
private final JsonValue root;
@@ -93,24 +95,26 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
double getHeightOfRow(StringBounder stringBounder) {
final double height = b1.calculateDimension(stringBounder).getHeight();
- if (b2 == null) {
+ if (b2 == null)
return height;
- }
+
return Math.max(height, b2.calculateDimension(stringBounder).getHeight());
}
}
private HColor getBackColor() {
- return styleHightlight.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
+ return styleNodeHightlight.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
}
- public TextBlockJson(ISkinParam skinParam, JsonValue root, List allHighlighteds, Style style,
- Style styleHightlight) {
- this.styleHightlight = styleHightlight;
+ TextBlockJson(ISkinParam skinParam, JsonValue root, List allHighlighteds, Style styleNode,
+ Style styleNodeHightlight, Style styleNodeHeader, Style styleNodeHeaderHighlight) {
this.skinParam = skinParam;
- this.style = style;
+ this.styleNode = styleNode;
+ this.styleNodeHeaderHighlight = styleNodeHeaderHighlight;
+ this.styleNodeHightlight = styleNodeHightlight;
+ this.styleNodeHeader = styleNodeHeader;
this.root = root;
if (root instanceof JsonObject)
for (Member member : (JsonObject) root) {
@@ -118,104 +122,105 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
final String value = getShortString(member.getValue());
final boolean highlighted = isHighlighted(key, allHighlighteds);
- final TextBlock block1 = getTextBlock(getRightStyle(highlighted), key);
- final TextBlock block2 = getTextBlock(getRightStyle(highlighted), value);
+ final TextBlock block1 = getTextBlock(getStyleToUse(true, highlighted), key);
+ final TextBlock block2 = getTextBlock(getStyleToUse(false, highlighted), value);
this.lines.add(new Line(block1, block2, highlighted));
}
if (root instanceof JsonArray) {
int i = 0;
for (JsonValue value : (JsonArray) root) {
final boolean highlighted = isHighlighted("" + i, allHighlighteds);
- final TextBlock block2 = getTextBlock(getRightStyle(highlighted), getShortString(value));
+ final TextBlock block2 = getTextBlock(getStyleToUse(false, highlighted), getShortString(value));
this.lines.add(new Line(block2, highlighted));
i++;
}
}
}
- private Style getRightStyle(boolean highlighted) {
- if (highlighted) {
- return styleHightlight;
- }
- return style;
+ private Style getStyleToUse(boolean header, boolean highlighted) {
+ if (header && highlighted)
+ return styleNodeHeaderHighlight;
+
+ if (highlighted)
+ return styleNodeHightlight;
+
+ if (header)
+ return styleNodeHeader;
+
+ return styleNode;
}
private boolean isHighlighted(String key, List highlighted) {
- for (String tmp : highlighted) {
- if (tmp.trim().equals("\"" + key + "\"")) {
+ for (String tmp : highlighted)
+ if (tmp.trim().equals("\"" + key + "\""))
return true;
- }
- }
+
return false;
}
public int size() {
int size = 0;
- if (root instanceof JsonObject) {
+ if (root instanceof JsonObject)
for (Member member : (JsonObject) root)
size++;
- }
- if (root instanceof JsonArray) {
+
+ if (root instanceof JsonArray)
for (JsonValue value : (JsonArray) root)
size++;
- }
+
return size;
}
private String getShortString(JsonValue value) {
- if (value.isString()) {
+ if (value.isString())
return value.asString();
- }
- if (value.isNull()) {
+
+ if (value.isNull())
return "";
- // return " null";
- }
- if (value.isNumber()) {
+ // return " null";
+
+ if (value.isNumber())
return value.toString();
- }
- if (value.isBoolean()) {
- if (value.isTrue()) {
+
+ if (value.isBoolean())
+ if (value.isTrue())
return " true";
- } else {
+ else
return " false";
- }
- }
+
return " ";
}
public List children() {
final List result = new ArrayList<>();
- if (root instanceof JsonObject) {
+ if (root instanceof JsonObject)
for (Member member : (JsonObject) root) {
final JsonValue value = member.getValue();
- if (value instanceof JsonObject || value instanceof JsonArray) {
+ if (value instanceof JsonObject || value instanceof JsonArray)
result.add(value);
- } else {
+ else
result.add(null);
- }
}
- }
- if (root instanceof JsonArray) {
- for (JsonValue value : (JsonArray) root) {
- if (value instanceof JsonObject || value instanceof JsonArray) {
+
+ if (root instanceof JsonArray)
+ for (JsonValue value : (JsonArray) root)
+ if (value instanceof JsonObject || value instanceof JsonArray)
result.add(value);
- } else {
+ else
result.add(null);
- }
- }
- }
+
return Collections.unmodifiableList(result);
}
public List keys() {
final List result = new ArrayList<>();
- if (root instanceof JsonObject) {
+ if (root instanceof JsonObject)
for (Member member : (JsonObject) root) {
final String key = member.getName();
result.add(key);
}
- }
+
if (root instanceof JsonArray) {
int i = 0;
for (JsonValue value : (JsonArray) root) {
@@ -233,19 +238,18 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
public double getWidthColA(StringBounder stringBounder) {
double width = 0;
- for (Line line : lines) {
+ for (Line line : lines)
width = Math.max(width, line.b1.calculateDimension(stringBounder).getWidth());
- }
+
return width;
}
public double getWidthColB(StringBounder stringBounder) {
double width = 0;
- for (Line line : lines) {
- if (line.b2 != null) {
+ for (Line line : lines)
+ if (line.b2 != null)
width = Math.max(width, line.b2.calculateDimension(stringBounder).getWidth());
- }
- }
+
return width;
}
@@ -258,7 +262,7 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
final double widthColB = getWidthColB(stringBounder);
double y = 0;
- final UGraphic ugNode = style.applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(),
+ final UGraphic ugNode = styleNode.applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(),
skinParam.getThemeStyle());
for (Line line : lines) {
final double heightOfRow = line.getHeightOfRow(stringBounder);
@@ -269,13 +273,13 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
if (trueWidth == 0)
trueWidth = 30;
- final double round = style.value(PName.RoundCorner).asDouble();
+ final double round = styleNode.value(PName.RoundCorner).asDouble();
final URectangle fullNodeRectangle = new URectangle(trueWidth, y).rounded(round);
- final HColor backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
+ final HColor backColor = styleNode.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
ugNode.apply(backColor.bg()).apply(backColor).draw(fullNodeRectangle);
- final Style styleSeparator = style.getSignature().add(SName.separator)
+ final Style styleSeparator = styleNode.getSignature().add(SName.separator)
.getMergedStyle(skinParam.getCurrentStyleBuilder());
final UGraphic ugSeparator = styleSeparator.applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(),
skinParam.getThemeStyle());
@@ -292,7 +296,7 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
if (y > 0)
ugline.draw(ULine.hline(trueWidth));
- final HorizontalAlignment horizontalAlignment = style.getHorizontalAlignment();
+ final HorizontalAlignment horizontalAlignment = styleNode.getHorizontalAlignment();
horizontalAlignment.draw(ugline, line.b1, 0, widthColA);
if (line.b2 != null) {
@@ -309,9 +313,9 @@ public class TextBlockJson extends AbstractTextBlock implements TextBlockBackcol
private double getTotalHeight(StringBounder stringBounder) {
double height = 0;
- for (Line line : lines) {
+ for (Line line : lines)
height += line.getHeightOfRow(stringBounder);
- }
+
return height;
}
diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java
index c7cb07ff0..e97fa58bf 100644
--- a/src/net/sourceforge/plantuml/version/Version.java
+++ b/src/net/sourceforge/plantuml/version/Version.java
@@ -80,7 +80,7 @@ public class Version {
}
public static int beta() {
- final int beta = 8;
+ final int beta = 9;
return beta;
}