Skip to content
Snippets Groups Projects
Commit 88264e06 authored by René Schöne's avatar René Schöne
Browse files

3.0.0

- prepare new release
- coherent styling of nodes and relation labels
parent 99fb204c
Branches
No related tags found
1 merge request!133.0.1
......@@ -30,6 +30,16 @@ aspect Navigation {
eq DumpNode.getDumpToken().containingDumpNode() = this;
eq DumpNode.getInvisiblePath().containingDumpNode() = this;
// --- containingDumpListChildNode ---
inh DumpListChildNode InnerDumpNode.containingDumpListChildNode();
eq DumpListChildNode.getInnerDumpNode().containingDumpListChildNode() = this;
// --- containingDumpListRelation ---
inh DumpListRelation InnerRelationDumpNode.containingDumpListRelation();
eq DumpListRelation.getInnerRelationDumpNode().containingDumpListRelation() = this;
eq DumpReferenceListToken.getInnerRelationDumpNode().containingDumpListRelation() = null;
eq InvisiblePath.getInnerRelationDumpNode().containingDumpListRelation() = null;
// --- container ---
syn DumpNode DumpNode.container() {
if (getContainerOfNormalChild() != null) {
......
......@@ -25,14 +25,16 @@ aspect Printing {
syn String DumpNode.label() = getLabel();
inh String InnerDumpNode.label();
inh String InnerRelationDumpNode.label();
eq DumpListChildNode.getInnerDumpNode(int index).label() = label() +
(getInnerDumpNode(index).getDumpNode().isEmpty() ?
"" :
"[" + chooseIndex(getInnerDumpNode(index).getOriginalIndex(), index) + "]");
eq DumpListRelation.getInnerRelationDumpNode(int index).label() = label() +
(getInnerRelationDumpNode(index).getDumpNode().isEmpty() ?
"" :
"[" + chooseIndex(getInnerRelationDumpNode(index).getOriginalIndex(), index) + "]");
eq DumpListChildNode.getInnerDumpNode(int index).label() {
InnerDumpNode inner = getInnerDumpNode(index);
return inner.getLabel() +
(inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]");
}
eq DumpListRelation.getInnerRelationDumpNode(int index).label() {
InnerRelationDumpNode inner = getInnerRelationDumpNode(index);
return inner.getLabel() +
(inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]");
}
eq DumpReferenceListToken.getInnerRelationDumpNode(int index).label() = label() + "[" + index + "]";
eq InvisiblePath.getInnerRelationDumpNode(int index).label() = null;
protected int ASTNode.chooseIndex(int originalIndex, int inheritedIndex) {
......
......@@ -97,6 +97,8 @@ public class DumpBuilder {
dumpAst.setPrintConfig(new PrintConfig());
dumpAst.getPrintConfig().setScale(1);
dumpAst.getPrintConfig().setVersion(readVersion());
dumpAst.getPrintConfig().setNodeStyleDefinition((node, style) -> {});
dumpAst.getPrintConfig().setRelationStyleDefinition((sourceNode, targetNode, context, style) -> {});
}
private DumpBuilder thisWithResetBuilt() {
......
......@@ -72,7 +72,19 @@ public class FeatureTestMain {
}
})
.skinParam(SkinParamBooleanSetting.Shadowing, false)
.setNameMethod(node -> node.getClass().getSimpleName() + ASTNode.counter++);
.relationStyle((source, target, context, style) -> {
if (context.equals("ManyA")) {
style.setLabel("ManyA of " + ((Nameable) source).getName());
} else if (context.equals("OneA") || context.equals("MaybeC")) {
style.setTextColor("red");
}
})
.<ASTNode<?>>nodeStyle((node, style) -> {
if (node.isA()) {
style.setBackgroundColor("yellow");
}
style.setLabel(node.getClass().getSimpleName() + ASTNode.counter++);
});
builder.dumpAsYaml(pathToYaml, true);
builder.dumpAsPNG(pathToPng);
......
......@@ -285,7 +285,7 @@ public class TestSimple {
Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root,
builder -> builder.<ASTNode<?>>setNameMethod(n -> n.isA() ? "A" : "Not A"));
builder -> builder.<ASTNode<?>>nodeStyle((node, style) -> style.setLabel(node.isA() ? "A" : "Not A")));
DumpNode actualRoot = TestUtils.findByName(nodes, ROOT_NAME);
assertEquals("Not A", actualRoot.getLabel());
......@@ -298,7 +298,7 @@ public class TestSimple {
Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root,
builder -> builder.<ASTNode<?>>setTextColorMethod(n -> n.isA() ? "red" : ""));
builder -> builder.<ASTNode<?>>nodeStyle((node, style) -> style.setTextColor(node.isA() ? "red" : "")));
DumpNode actualRoot = TestUtils.findByName(nodes, ROOT_NAME);
assertEquals("", actualRoot.getTextColor());
......@@ -311,7 +311,7 @@ public class TestSimple {
Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root,
builder -> builder.<ASTNode<?>>setBackgroundColorMethod(n -> n.isA() ? "green" : ""));
builder -> builder.<ASTNode<?>>nodeStyle((node, style) -> style.setBackgroundColor(node.isA() ? "green" : "")));
DumpNode actualRoot = TestUtils.findByName(nodes, ROOT_NAME);
assertEquals("", actualRoot.getBackgroundColor());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment