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

3.0.0

- prepare new release
- begin to change styling of lists
parent 13796bd7
No related branches found
No related tags found
1 merge request!133.0.1
Showing with 153 additions and 78 deletions
...@@ -13,18 +13,18 @@ rel InnerRelationDumpNode.DumpNode <-> DumpNode.ContainerOfRelationInner* ; ...@@ -13,18 +13,18 @@ rel InnerRelationDumpNode.DumpNode <-> DumpNode.ContainerOfRelationInner* ;
abstract DumpChildNode ::= <Label> <Computed:boolean> ; abstract DumpChildNode ::= <Label> <Computed:boolean> ;
DumpNormalChildNode : DumpChildNode ::= <LineColor> <TextColor> ; DumpNormalChildNode : DumpChildNode ::= <LineColor> <TextColor> ;
rel DumpNormalChildNode.DumpNode <-> DumpNode.ContainerOfNormalChild? ; rel DumpNormalChildNode.DumpNode <-> DumpNode.ContainerOfNormalChild? ;
DumpListChildNode : DumpChildNode ::= InnerDumpNode* ; DumpListChildNode : DumpChildNode ::= InnerDumpNode* <Name> ;
abstract DumpToken ::= <Label> <Computed:boolean> ; abstract DumpToken ::= <Label> <Computed:boolean> ;
DumpReferenceToken : DumpToken ; DumpReferenceToken : DumpToken ;
rel DumpReferenceToken.Value -> DumpNode ; rel DumpReferenceToken.Value -> DumpNode ;
DumpReferenceListToken : DumpToken ::= InnerRelationDumpNode* ; DumpReferenceListToken : DumpToken ::= InnerRelationDumpNode* <Name> ;
DumpValueToken : DumpToken ::= <Value:Object> ; DumpValueToken : DumpToken ::= <Value:Object> ;
abstract DumpRelation ::= <Label> <Bidirectional:boolean> ; abstract DumpRelation ::= <Label> <Bidirectional:boolean> ;
DumpNormalRelation : DumpRelation ::= <LineColor> <TextColor> ; DumpNormalRelation : DumpRelation ::= <LineColor> <TextColor> ;
rel DumpNormalRelation.DumpNode -> DumpNode ; rel DumpNormalRelation.DumpNode -> DumpNode ;
DumpListRelation : DumpRelation ::= InnerRelationDumpNode* ; DumpListRelation : DumpRelation ::= InnerRelationDumpNode* <Name> ;
// type of NTA // type of NTA
InvisiblePath ::= InnerRelationDumpNode* ; InvisiblePath ::= InnerRelationDumpNode* ;
......
...@@ -12,7 +12,7 @@ aspect Frontend { ...@@ -12,7 +12,7 @@ aspect Frontend {
@FunctionalInterface @FunctionalInterface
public interface RelationStyleDefinition<ASTNODE> { public interface RelationStyleDefinition<ASTNODE> {
void style(ASTNODE source, ASTNODE target, RelationStyle style); void style(ASTNODE source, ASTNODE target, boolean isComputed, boolean isContainment, RelationStyle style);
} }
public void NodeStyle.useSimpleLabel() { public void NodeStyle.useSimpleLabel() {
......
...@@ -10,6 +10,10 @@ aspect Navigation { ...@@ -10,6 +10,10 @@ aspect Navigation {
// --- buildConfig --- // --- buildConfig ---
inh BuildConfig DumpNode.buildConfig(); inh BuildConfig DumpNode.buildConfig();
inh BuildConfig PrintConfig.buildConfig(); inh BuildConfig PrintConfig.buildConfig();
inh BuildConfig InnerDumpNode.buildConfig();
inh BuildConfig InnerRelationDumpNode.buildConfig();
inh BuildConfig DumpChildNode.buildConfig();
inh BuildConfig DumpRelation.buildConfig();
eq DumpAst.getChild().buildConfig() = getBuildConfig(); eq DumpAst.getChild().buildConfig() = getBuildConfig();
// --- printConfig --- // --- printConfig ---
......
aspect Printing { aspect Printing {
// --- outerNodeName ---
inh String InnerDumpNode.outerNodeName();
inh String InnerRelationDumpNode.outerNodeName();
inh String DumpChildNode.outerNodeName();
inh String DumpRelation.outerNodeName();
inh String DumpToken.outerNodeName();
inh String DumpReferenceToken.outerNodeName();
eq DumpNode.getChild().outerNodeName() = name();
// --- innerNodeName ---
syn String InnerDumpNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null;
syn String InnerRelationDumpNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null;
syn String DumpNormalChildNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null;
syn String DumpNormalRelation.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null;
syn String DumpReferenceToken.innerNodeName() = getValue().name();
// --- name --- // --- name ---
syn String DumpNode.name() = getName(); // might change in the future syn String DumpNode.name() = getName(); // might change in the future
// --- label ---
syn String DumpChildNode.label() = getLabel() + (getComputed() ? "()" : "");
syn String DumpRelation.label() = getLabel();
syn String DumpToken.label() = getLabel() + (getComputed() ? "()" : "");
syn String DumpNode.label() = getLabel();
inh String InnerDumpNode.label();
inh String InnerRelationDumpNode.label();
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) {
return originalIndex != 0 ? originalIndex : inheritedIndex;
}
// --- bothVisible ---
boolean ASTNode.bothVisible(DumpNode one, DumpNode two) {
return one != null && two != null && !one.getInvisible() && !two.getInvisible();
}
syn boolean InnerDumpNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode());
syn boolean InnerRelationDumpNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode());
syn boolean DumpNormalChildNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode());
syn boolean DumpNormalRelation.bothVisible() = bothVisible(containingDumpNode(), getDumpNode());
} }
aspect Debugging { aspect Debugging {
......
...@@ -27,6 +27,54 @@ aspect TemplateContext { ...@@ -27,6 +27,54 @@ aspect TemplateContext {
return false; return false;
} }
// --- outerNodeName ---
inh String InnerDumpNode.outerNodeName();
inh String InnerRelationDumpNode.outerNodeName();
inh String DumpChildNode.outerNodeName();
inh String DumpRelation.outerNodeName();
inh String DumpToken.outerNodeName();
inh String DumpReferenceToken.outerNodeName();
eq DumpNode.getChild().outerNodeName() = name();
// --- innerNodeName ---
syn String InnerDumpNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null;
syn String InnerRelationDumpNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null;
syn String DumpNormalChildNode.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null;
syn String DumpNormalRelation.innerNodeName() = getDumpNode() != null ? getDumpNode().name() : null;
syn String DumpReferenceToken.innerNodeName() = getValue().name();
// --- label ---
syn String DumpChildNode.label() = getLabel() + (getComputed() ? "()" : "");
syn String DumpRelation.label() = getLabel();
syn String DumpToken.label() = getLabel() + (getComputed() ? "()" : "");
syn String DumpNode.label() = getLabel();
inh String InnerDumpNode.label();
inh String InnerRelationDumpNode.label();
eq DumpListChildNode.getInnerDumpNode(int index).label() {
InnerDumpNode inner = getInnerDumpNode(index);
return
(inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]");
}
eq DumpListRelation.getInnerRelationDumpNode(int index).label() {
InnerRelationDumpNode inner = getInnerRelationDumpNode(index);
return (inner.isComputed() ? " " : inner.getLabel()) +
(inner.getDumpNode().isEmpty() ? "" : "[" + chooseIndex(inner.getOriginalIndex(), index) + "]");
}
eq DumpReferenceListToken.getInnerRelationDumpNode(int index).label() = "[" + index + "]";
eq InvisiblePath.getInnerRelationDumpNode(int index).label() = null;
protected int ASTNode.chooseIndex(int originalIndex, int inheritedIndex) {
return originalIndex != 0 ? originalIndex : inheritedIndex;
}
// --- bothVisible ---
boolean ASTNode.bothVisible(DumpNode one, DumpNode two) {
return one != null && two != null && !one.getInvisible() && !two.getInvisible();
}
syn boolean InnerDumpNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode());
syn boolean InnerRelationDumpNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode());
syn boolean DumpNormalChildNode.bothVisible() = bothVisible(containingDumpNode(), getDumpNode());
syn boolean DumpNormalRelation.bothVisible() = bothVisible(containingDumpNode(), getDumpNode());
// --- NTA: InvisiblePath --- // --- NTA: InvisiblePath ---
syn InvisiblePath DumpNode.getInvisiblePath() { syn InvisiblePath DumpNode.getInvisiblePath() {
InvisiblePath result = new InvisiblePath(); InvisiblePath result = new InvisiblePath();
......
...@@ -62,7 +62,6 @@ aspect ToYaml { ...@@ -62,7 +62,6 @@ aspect ToYaml {
result.put("Name", getName()); result.put("Name", getName());
if (!fromRelation) { if (!fromRelation) {
result.put("Computed", getComputed()); result.put("Computed", getComputed());
result.put("Label", getLabel());
result.put("BackgroundColor", getBackgroundColor()); result.put("BackgroundColor", getBackgroundColor());
result.put("TextColor", getTextColor()); result.put("TextColor", getTextColor());
result.put("Invisible", getInvisible()); result.put("Invisible", getInvisible());
...@@ -73,6 +72,7 @@ aspect ToYaml { ...@@ -73,6 +72,7 @@ aspect ToYaml {
result.put("isNull", isNull()); result.put("isNull", isNull());
result.put("isEmpty", isEmpty()); result.put("isEmpty", isEmpty());
result.put("isAstNode", isAstNode()); result.put("isAstNode", isAstNode());
result.put("label", label());
result.put("labelAndTextColor", labelAndTextColor()); result.put("labelAndTextColor", labelAndTextColor());
result.put("stereotypeList", stereotypeList()); result.put("stereotypeList", stereotypeList());
addYamledList(result, "myChildren", myChildren(), true); addYamledList(result, "myChildren", myChildren(), true);
...@@ -89,9 +89,10 @@ aspect ToYaml { ...@@ -89,9 +89,10 @@ aspect ToYaml {
syn MappingElement DumpChildNode.toYaml(boolean fromRelation) { syn MappingElement DumpChildNode.toYaml(boolean fromRelation) {
MappingElement result = new MappingElement(); MappingElement result = new MappingElement();
// tokens // tokens
result.put("Label", getLabel());
result.put("Computed", getComputed()); result.put("Computed", getComputed());
// attributes // attributes
result.put("label", label()); result.put("label", label());
result.put("isList", isList()); result.put("isList", isList());
...@@ -102,9 +103,11 @@ aspect ToYaml { ...@@ -102,9 +103,11 @@ aspect ToYaml {
syn MappingElement DumpNormalChildNode.toYaml(boolean fromRelation) { syn MappingElement DumpNormalChildNode.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation); MappingElement result = super.toYaml(fromRelation);
// tokens // tokens
result.put("LineColor", getLineColor()); result.put("LineColor", getLineColor());
result.put("TextColor", getTextColor()); result.put("TextColor", getTextColor());
// attributes // attributes
result.put("bothVisible", bothVisible()); result.put("bothVisible", bothVisible());
result.put("innerNodeName", innerNodeName()); result.put("innerNodeName", innerNodeName());
...@@ -114,6 +117,10 @@ aspect ToYaml { ...@@ -114,6 +117,10 @@ aspect ToYaml {
syn MappingElement DumpListChildNode.toYaml(boolean fromRelation) { syn MappingElement DumpListChildNode.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation); MappingElement result = super.toYaml(fromRelation);
// tokens
result.put("Name", getName());
// children // children
addYamledList(result, "InnerDumpNodes", getInnerDumpNodeList(), fromRelation); addYamledList(result, "InnerDumpNodes", getInnerDumpNodeList(), fromRelation);
return result; return result;
...@@ -121,9 +128,10 @@ aspect ToYaml { ...@@ -121,9 +128,10 @@ aspect ToYaml {
syn MappingElement DumpToken.toYaml(boolean fromRelation) { syn MappingElement DumpToken.toYaml(boolean fromRelation) {
MappingElement result = new MappingElement(); MappingElement result = new MappingElement();
// tokens // tokens
result.put("Label", getLabel());
result.put("Computed", getComputed()); result.put("Computed", getComputed());
// attributes // attributes
result.put("isList", isList()); result.put("isList", isList());
result.put("label", label()); result.put("label", label());
...@@ -133,6 +141,7 @@ aspect ToYaml { ...@@ -133,6 +141,7 @@ aspect ToYaml {
syn MappingElement DumpValueToken.toYaml(boolean fromRelation) { syn MappingElement DumpValueToken.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation); MappingElement result = super.toYaml(fromRelation);
// tokens // tokens
result.put("Value", getValue().toString()); result.put("Value", getValue().toString());
return result; return result;
...@@ -140,6 +149,7 @@ aspect ToYaml { ...@@ -140,6 +149,7 @@ aspect ToYaml {
syn MappingElement DumpReferenceToken.toYaml(boolean fromRelation) { syn MappingElement DumpReferenceToken.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation); MappingElement result = super.toYaml(fromRelation);
// attributes // attributes
result.put("innerNodeName", innerNodeName()); result.put("innerNodeName", innerNodeName());
result.put("innerNotNullOrEmpty", innerNotNullOrEmpty()); result.put("innerNotNullOrEmpty", innerNotNullOrEmpty());
...@@ -150,6 +160,9 @@ aspect ToYaml { ...@@ -150,6 +160,9 @@ aspect ToYaml {
syn MappingElement DumpReferenceListToken.toYaml(boolean fromRelation) { syn MappingElement DumpReferenceListToken.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation); MappingElement result = super.toYaml(fromRelation);
// tokens
result.put("Name", getName());
// children // children
addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation); addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation);
...@@ -160,9 +173,10 @@ aspect ToYaml { ...@@ -160,9 +173,10 @@ aspect ToYaml {
syn MappingElement DumpRelation.toYaml(boolean fromRelation) { syn MappingElement DumpRelation.toYaml(boolean fromRelation) {
MappingElement result = new MappingElement(); MappingElement result = new MappingElement();
// tokens // tokens
result.put("Label", getLabel());
result.put("Bidirectional", getBidirectional()); result.put("Bidirectional", getBidirectional());
// attributes // attributes
result.put("isList", isList()); result.put("isList", isList());
result.put("label", label()); result.put("label", label());
...@@ -172,9 +186,11 @@ aspect ToYaml { ...@@ -172,9 +186,11 @@ aspect ToYaml {
syn MappingElement DumpNormalRelation.toYaml(boolean fromRelation) { syn MappingElement DumpNormalRelation.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation); MappingElement result = super.toYaml(fromRelation);
// tokens // tokens
result.put("LineColor", getLineColor()); result.put("LineColor", getLineColor());
result.put("TextColor", getTextColor()); result.put("TextColor", getTextColor());
// attributes // attributes
result.put("bothVisible", bothVisible()); result.put("bothVisible", bothVisible());
result.put("innerNodeName", innerNodeName()); result.put("innerNodeName", innerNodeName());
...@@ -185,6 +201,10 @@ aspect ToYaml { ...@@ -185,6 +201,10 @@ aspect ToYaml {
syn MappingElement DumpListRelation.toYaml(boolean fromRelation) { syn MappingElement DumpListRelation.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation); MappingElement result = super.toYaml(fromRelation);
// tokens
result.put("Name", getName());
// children // children
addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation); addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation);
return result; return result;
...@@ -192,9 +212,11 @@ aspect ToYaml { ...@@ -192,9 +212,11 @@ aspect ToYaml {
syn MappingElement InnerDumpNode.toYaml(boolean fromRelation) { syn MappingElement InnerDumpNode.toYaml(boolean fromRelation) {
MappingElement result = new MappingElement(); MappingElement result = new MappingElement();
// tokens // tokens
result.put("LineColor", getLineColor()); result.put("LineColor", getLineColor());
result.put("TextColor", getTextColor()); result.put("TextColor", getTextColor());
// attributes // attributes
result.put("bothVisible", bothVisible()); result.put("bothVisible", bothVisible());
result.put("innerNodeName", innerNodeName()); result.put("innerNodeName", innerNodeName());
...@@ -206,9 +228,11 @@ aspect ToYaml { ...@@ -206,9 +228,11 @@ aspect ToYaml {
syn MappingElement InnerRelationDumpNode.toYaml(boolean fromRelation) { syn MappingElement InnerRelationDumpNode.toYaml(boolean fromRelation) {
MappingElement result = new MappingElement(); MappingElement result = new MappingElement();
// tokens // tokens
result.put("LineColor", getLineColor()); result.put("LineColor", getLineColor());
result.put("TextColor", getTextColor()); result.put("TextColor", getTextColor());
// attributes // attributes
result.put("bothVisible", bothVisible()); result.put("bothVisible", bothVisible());
result.put("innerNodeName", innerNodeName()); result.put("innerNodeName", innerNodeName());
...@@ -221,6 +245,7 @@ aspect ToYaml { ...@@ -221,6 +245,7 @@ aspect ToYaml {
syn MappingElement InvisiblePath.toYaml(boolean fromRelation) { syn MappingElement InvisiblePath.toYaml(boolean fromRelation) {
MappingElement result = super.toYaml(fromRelation); MappingElement result = super.toYaml(fromRelation);
// children // children
addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation); addYamledList(result, "InnerRelationDumpNode", getInnerRelationDumpNodeList(), fromRelation);
return result; return result;
......
...@@ -99,7 +99,7 @@ aspect Transform { ...@@ -99,7 +99,7 @@ aspect Transform {
} else { } else {
node = new DumpNode(); node = new DumpNode();
node.setObject(obj); node.setObject(obj);
node.setName("node" + (tti.nodeCounter++)); node.setName(tti.nextName());
node.setComputed(options.computed); node.setComputed(options.computed);
tti.transformed.put(obj, node); tti.transformed.put(obj, node);
this.addDumpNode(node); this.addDumpNode(node);
...@@ -190,6 +190,7 @@ aspect Transform { ...@@ -190,6 +190,7 @@ aspect Transform {
listChild.setComputed(false); listChild.setComputed(false);
String childName = containmentMethod.getName(); String childName = containmentMethod.getName();
listChild.setLabel(childName); listChild.setLabel(childName);
listChild.setName(tti.nextName());
node.addDumpChildNode(listChild); node.addDumpChildNode(listChild);
int index = -1; int index = -1;
...@@ -252,6 +253,8 @@ aspect Transform { ...@@ -252,6 +253,8 @@ aspect Transform {
boolean computed = otherMethod.asListChildMethod().isNTAListChildMethod(); boolean computed = otherMethod.asListChildMethod().isNTAListChildMethod();
listChild.setComputed(computed); listChild.setComputed(computed);
listChild.setLabel(childName); listChild.setLabel(childName);
listChild.setName(tti.nextName());
boolean notAddedYet = true; boolean notAddedYet = true;
for (Object target : targetList) { for (Object target : targetList) {
DumpNode targetNode = transform(tti, target, options.asNormal(false).computed(computed)); DumpNode targetNode = transform(tti, target, options.asNormal(false).computed(computed));
...@@ -296,6 +299,7 @@ aspect Transform { ...@@ -296,6 +299,7 @@ aspect Transform {
Iterable<?> targetList = (Iterable<?>) otherMethod.getMethod().invoke(obj); Iterable<?> targetList = (Iterable<?>) otherMethod.getMethod().invoke(obj);
DumpListRelation listRelation = new DumpListRelation(); DumpListRelation listRelation = new DumpListRelation();
listRelation.setLabel(otherMethod.getName()); listRelation.setLabel(otherMethod.getName());
listRelation.setName(tti.nextName());
node.addDumpRelation(listRelation); node.addDumpRelation(listRelation);
int index = -1; int index = -1;
...@@ -348,6 +352,7 @@ aspect Transform { ...@@ -348,6 +352,7 @@ aspect Transform {
} }
if (atLeastOneASTNode) { if (atLeastOneASTNode) {
DumpReferenceListToken listToken = new DumpReferenceListToken(); DumpReferenceListToken listToken = new DumpReferenceListToken();
listToken.setName(tti.nextName());
nodes.forEach(element -> { nodes.forEach(element -> {
listToken.addInnerRelationDumpNode(new InnerRelationDumpNode().setDumpNode(element)); listToken.addInnerRelationDumpNode(new InnerRelationDumpNode().setDumpNode(element));
}); });
...@@ -370,6 +375,7 @@ aspect Transform { ...@@ -370,6 +375,7 @@ aspect Transform {
token.setLabel(otherMethod.getName()); token.setLabel(otherMethod.getName());
token.setComputed(otherMethod.asTokenMethod().isAttributeMethod()); token.setComputed(otherMethod.asTokenMethod().isAttributeMethod());
node.addDumpToken(token); node.addDumpToken(token);
// TODO apply style
} }
} }
return true; return true;
...@@ -406,34 +412,40 @@ aspect Transform { ...@@ -406,34 +412,40 @@ aspect Transform {
// === RelationStyle === // === RelationStyle ===
interface RelationStylable<SELF> { interface RelationStylable<SELF> {
default RelationStyle createDefaultStyle() { // more methods in TransformPlus.jadd
return new RelationStyle().setLabel(initialLabel());
} // tokens
default void applyStyle(RelationStyleDefinition relationStyleDefinition) {
RelationStyle style = createDefaultStyle();
relationStyleDefinition.style(containingDumpNode().getObject(), getDumpNode().getObject(), style);
setLabel(style.getLabel());
setTextColor(style.getTextColor());
setLineColor(style.getLineColor());
}
String initialLabel();
DumpNode containingDumpNode();
DumpNode getDumpNode();
SELF setLabel(String name); SELF setLabel(String name);
SELF setTextColor(String textColor); SELF setTextColor(String textColor);
SELF setLineColor(String lineColor); SELF setLineColor(String lineColor);
// attributes
BuildConfig buildConfig();
boolean isComputed();
boolean isContainment();
String initialLabel();
DumpNode containingDumpNode();
DumpNode getDumpNode();
} }
DumpNormalChildNode implements RelationStylable<DumpNormalChildNode>; DumpNormalChildNode implements RelationStylable<DumpNormalChildNode>;
syn String DumpNormalChildNode.initialLabel() = getLabel(); syn String DumpNormalChildNode.initialLabel() = getLabel();
syn boolean DumpNormalChildNode.isComputed() = getComputed();
syn boolean DumpNormalChildNode.isContainment() = true;
InnerDumpNode implements RelationStylable<InnerDumpNode>; InnerDumpNode implements RelationStylable<InnerDumpNode>;
syn String InnerDumpNode.initialLabel() = containingDumpListChildNode().getLabel(); syn String InnerDumpNode.initialLabel() = containingDumpListChildNode().getLabel();
syn boolean InnerDumpNode.isComputed() = containingDumpListChildNode().getComputed();
syn boolean InnerDumpNode.isContainment() = true;
DumpNormalRelation implements RelationStylable<DumpNormalRelation>; DumpNormalRelation implements RelationStylable<DumpNormalRelation>;
syn String DumpNormalRelation.initialLabel() = getLabel(); syn String DumpNormalRelation.initialLabel() = getLabel();
syn boolean DumpNormalRelation.isComputed() = false;
syn boolean DumpNormalRelation.isContainment() = false;
InnerRelationDumpNode implements RelationStylable<InnerRelationDumpNode>; InnerRelationDumpNode implements RelationStylable<InnerRelationDumpNode>;
syn String InnerRelationDumpNode.initialLabel() = containingDumpListRelation().getLabel(); syn String InnerRelationDumpNode.initialLabel() = containingDumpListRelation().getLabel();
syn boolean InnerRelationDumpNode.isComputed() = containingDumpListRelation() == null;
syn boolean InnerRelationDumpNode.isContainment() = false;
private void DumpAst.applyStyle(RelationStylable<?> stylable) { private void DumpAst.applyStyle(RelationStylable<?> stylable) {
stylable.applyStyle(getPrintConfig().getRelationStyleDefinition()); stylable.applyStyle(getPrintConfig().getRelationStyleDefinition());
...@@ -450,5 +462,9 @@ aspect Transform { ...@@ -450,5 +462,9 @@ aspect Transform {
java.util.Map<Object, DumpNode> transformed = new java.util.HashMap<>(); java.util.Map<Object, DumpNode> transformed = new java.util.HashMap<>();
java.util.Map<DumpNode, Boolean> relationTargetsUnprocessed = new java.util.HashMap<>(); java.util.Map<DumpNode, Boolean> relationTargetsUnprocessed = new java.util.HashMap<>();
int nodeCounter = 0; int nodeCounter = 0;
String nextName() {
return "node" + (nodeCounter++);
}
} }
} }
// more stuff from Transform that is not correctly handled by the IntelliJ plugin
aspect Transform {
interface RelationStylable<SELF> {
default RelationStyle createDefaultStyle() {
return new RelationStyle()
.setLabel(initialLabel())
.setTextColor(isComputed() ? buildConfig().getStyleInformation().getComputedColor() : "")
.setTextColor(isComputed() ? buildConfig().getStyleInformation().getComputedColor() : "");
}
default void applyStyle(RelationStyleDefinition relationStyleDefinition) {
RelationStyle style = createDefaultStyle();
relationStyleDefinition.style(containingDumpNode().getObject(), getDumpNode().getObject(),
isComputed(), isContainment(), style);
setLabel(style.getLabel());
setTextColor(style.getTextColor());
setLineColor(style.getLineColor());
}
}
}
...@@ -39,7 +39,7 @@ public class DumpBuilder { ...@@ -39,7 +39,7 @@ public class DumpBuilder {
dumpAst.getPrintConfig().setScale(1); dumpAst.getPrintConfig().setScale(1);
dumpAst.getPrintConfig().setVersion(readVersion()); dumpAst.getPrintConfig().setVersion(readVersion());
dumpAst.getPrintConfig().setNodeStyleDefinition((node, style) -> {}); dumpAst.getPrintConfig().setNodeStyleDefinition((node, style) -> {});
dumpAst.getPrintConfig().setRelationStyleDefinition((sourceNode, targetNode, style) -> {}); dumpAst.getPrintConfig().setRelationStyleDefinition((sourceNode, targetNode, isComputed, isContainment, style) -> {});
} }
private DumpBuilder thisWithResetBuilt() { private DumpBuilder thisWithResetBuilt() {
......
...@@ -41,30 +41,34 @@ object "{{{labelAndTextColor}}}" as {{{Name}}} {{{stereotypeList}}} {{#Backgroun ...@@ -41,30 +41,34 @@ object "{{{labelAndTextColor}}}" as {{{Name}}} {{{stereotypeList}}} {{#Backgroun
{{#DumpTokens}} {{#DumpTokens}}
{{^Invisible}} {{^Invisible}}
{{#isList}} {{#isList}}
circle " " as {{{Name}}}
{{{outerNodeName}}} .-[norank{{#Computed}},#{{{computedColor}}}{{/Computed}}]-> {{{Name}}}{{#label}} : {{{label}}}{{/label}}
{{#InnerRelationDumpNode}} {{#InnerRelationDumpNode}}
{{#bothVisible}} {{#bothVisible}}
{{{outerNodeName}}} .[#black{{#Computed}},#{{{computedColor}}}{{/Computed}}{{#innerNotNullOrEmpty}},norank{{/innerNotNullOrEmpty}}].> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} {{{Name}}} .[#black{{#Computed}},#{{{computedColor}}}{{/Computed}}{{#innerNotNullOrEmpty}},norank{{/innerNotNullOrEmpty}}].> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}}
{{/bothVisible}} {{/bothVisible}}
{{/InnerRelationDumpNode}} {{/InnerRelationDumpNode}}
{{/isList}} {{/isList}}
{{^isList}} {{^isList}}
{{^isDumpValueToken}} {{^isDumpValueToken}}
{{{outerNodeName}}} .[#black{{#Computed}},#{{{computedColor}}}{{/Computed}}{{#innerNotNullOrEmpty}},norank{{/innerNotNullOrEmpty}}].> {{{innerNodeName}}} : {{{label}}} {{{outerNodeName}}} .[#black{{#Computed}},#{{{computedColor}}}{{/Computed}}{{#innerNotNullOrEmpty}},norank{{/innerNotNullOrEmpty}}].> {{{innerNodeName}}}{{#label}} : {{{label}}}{{/label}}
{{/isDumpValueToken}} {{/isDumpValueToken}}
{{/isList}} {{/isList}}
{{/Invisible}} {{/Invisible}}
{{/DumpTokens}} {{/DumpTokens}}
{{#DumpChildNodes}} {{#DumpChildNodes}}
{{#isList}} {{#isList}}
circle " " as {{{Name}}}
{{{outerNodeName}}} *-{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{Name}}} {{#label}} : {{{label}}}{{/label}}
{{#InnerDumpNodes}} {{#InnerDumpNodes}}
{{#bothVisible}} {{#bothVisible}}
{{{outerNodeName}}} *-{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} {{{Name}}} -{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}}
{{/bothVisible}} {{/bothVisible}}
{{/InnerDumpNodes}} {{/InnerDumpNodes}}
{{/isList}} {{/isList}}
{{^isList}} {{^isList}}
{{#bothVisible}} {{#bothVisible}}
{{{outerNodeName}}} *-{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} {{{outerNodeName}}} *-{{#Computed}}[#{{{computedColor}}}]{{/Computed}}- {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}}
{{/bothVisible}} {{/bothVisible}}
{{/isList}} {{/isList}}
{{/DumpChildNodes}} {{/DumpChildNodes}}
...@@ -72,13 +76,13 @@ object "{{{labelAndTextColor}}}" as {{{Name}}} {{{stereotypeList}}} {{#Backgroun ...@@ -72,13 +76,13 @@ object "{{{labelAndTextColor}}}" as {{{Name}}} {{{stereotypeList}}} {{#Backgroun
{{#isList}} {{#isList}}
{{#InnerRelationDumpNode}} {{#InnerRelationDumpNode}}
{{#bothVisible}} {{#bothVisible}}
{{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}-{{#innerNotNullOrEmpty}}[norank]{{/innerNotNullOrEmpty}}-> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} {{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}-{{#innerNotNullOrEmpty}}[norank]{{/innerNotNullOrEmpty}}-> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}}
{{/bothVisible}} {{/bothVisible}}
{{/InnerRelationDumpNode}} {{/InnerRelationDumpNode}}
{{/isList}} {{/isList}}
{{^isList}} {{^isList}}
{{#bothVisible}} {{#bothVisible}}
{{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}-{{#innerNotNullOrEmpty}}[norank]{{/innerNotNullOrEmpty}}-> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}} : {{{label}}} {{{outerNodeName}}} {{#Bidirectional}}<{{/Bidirectional}}-{{#innerNotNullOrEmpty}}[norank]{{/innerNotNullOrEmpty}}-> {{{innerNodeName}}} {{#needRelationStyling}}{{>RelationStyle}}{{/needRelationStyling}}{{#label}} : {{{label}}}{{/label}}
{{/bothVisible}} {{/bothVisible}}
{{/isList}} {{/isList}}
{{/DumpRelations}} {{/DumpRelations}}
......
...@@ -73,7 +73,11 @@ public class FeatureTestMain { ...@@ -73,7 +73,11 @@ public class FeatureTestMain {
} }
}) })
.skinParam(SkinParamBooleanSetting.Shadowing, false) .skinParam(SkinParamBooleanSetting.Shadowing, false)
.relationStyle((source, target, style) -> { .relationStyle((source, target, isComputed, isContainment, style) -> {
System.out.println(style.getLabel() + ", computed: " + isComputed + ", containment: " + isContainment);
if (isContainment && target != null && style.getLabel().equals(target.getClass().getSimpleName())) {
style.setLabel("");
}
if (style.getLabel().equals("ManyA")) { if (style.getLabel().equals("ManyA")) {
style.setLabel("ManyA of " + ((Nameable) source).getName()); style.setLabel("ManyA of " + ((Nameable) source).getName());
} else if (style.getLabel().equals("OneA") || style.getLabel().equals("MaybeC?")) { } else if (style.getLabel().equals("OneA") || style.getLabel().equals("MaybeC?")) {
...@@ -85,6 +89,9 @@ public class FeatureTestMain { ...@@ -85,6 +89,9 @@ public class FeatureTestMain {
if (node.isA()) { if (node.isA()) {
style.setBackgroundColor("yellow"); style.setBackgroundColor("yellow");
} }
if (node instanceof B && ((B) node).getOtherValue().startsWith("#")) {
style.setBackgroundColor(((B) node).getOtherValue().substring(1));
}
style.setLabel(node.getClass().getSimpleName() + ASTNode.counter++); style.setLabel(node.getClass().getSimpleName() + ASTNode.counter++);
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment