diff --git a/dumpAst.base/src/main/jastadd/DumpAst.relast b/dumpAst.base/src/main/jastadd/DumpAst.relast index 572b8b95a027c1f73e8503d4d39b2c45ad0b1276..b1f95a23c5da6509d4f92f419d45126fc021087f 100644 --- a/dumpAst.base/src/main/jastadd/DumpAst.relast +++ b/dumpAst.base/src/main/jastadd/DumpAst.relast @@ -5,9 +5,9 @@ DumpNode ::= DumpChildNode* DumpToken* DumpRelation* <Name> <Label> <BackgroundColor> <TextColor> <Object:Object> <Invisible:boolean> <Computed:boolean> <ManualStereotypes> /InvisiblePath/ ; -InnerDumpNode ::= <OriginalIndex:int> <Label> <LineColor> <TextColor> ; //TODO remove colors (and label?) +InnerDumpNode ::= <OriginalIndex:int> <Label> <LineColor> <TextColor> ; rel InnerDumpNode.DumpNode <-> DumpNode.ContainerOfInner? ; -InnerRelationDumpNode ::= <OriginalIndex:int> <Label> <LineColor> <TextColor> ; //TODO remove colors (and label?) +InnerRelationDumpNode ::= <OriginalIndex:int> <Label> <LineColor> <TextColor> ; rel InnerRelationDumpNode.DumpNode <-> DumpNode.ContainerOfRelationInner* ; abstract DumpChildNode ::= <Label> <Computed:boolean> <LineColor> <TextColor> ; diff --git a/pages/docs/using.md b/pages/docs/using.md index f01ec77314b2cd245ca6e197dd0019852f99a2ca..01b1fef447a31c084e20479ca579f61002ae63ba 100644 --- a/pages/docs/using.md +++ b/pages/docs/using.md @@ -28,7 +28,7 @@ public class Main { return !contextName.equals("EndEffector"); }) .nodeStyle((node, style) -> { - style.useSimpleName(); // (4) + style.useSimpleLabel(); // (4) style.setBackgroundColor(node.size() > 30 ? "blue" : "white"); // (5) }) .relationStyle((source, target, isComputed, isContainment, style) -> { @@ -37,7 +37,7 @@ public class Main { } }) .skinParam(SkinParamBooleanSetting.Shadowing, false); // (7) - builder.dumpAsPng(Paths.get("featureTest.png")); // (8) + builder.dumpAsPNG(Paths.get("featureTest.png")); // (8) builder.dumpAsSVG(Paths.get("featureTest.svg")); // (9) OutputStream os = getMyOutputStream(); builder.dumpAsPNG(os); // (10) @@ -59,7 +59,7 @@ The steps in detail: - (4) and (5) [Optional] To style a node, the method `nodeStyle` is used. It accepts a lambda function, in which the style of every node can be customized by calling methods on the given `Style` object, e.g. setting the name (5) or background color (6). The default name is to use the class name along with the hashcode of the object (`node == null ? "null" : node.getClass().getSimpleName() + "@" + Integer.toHexString(node.hashCode())`). - (6) [Optional] To style a relation, the method `relationStyle` is used. It is used similar to `nodeStyle`, but is called with source and target node of a relation (containment and non-containment). Note, that (a) the default label can be retrieved with `style.getLabel()`, (b) `target` can be `null` for lists, (c) secondary connections from a list node to the target nodes use the style of the relation and use their index as label. - (7) [Optional] There are a few ways to style the output in general through [SkinParam](https://plantuml.com/de/skinparam). Not all of those parameters are supported; see `SkinParamBooleanSetting` and `SkinParamStringSetting`. -- (8), (9) and (10) To create an output image, use `dumpAsPng` for PNG (`dumpAsSVG` for SVG). Those methods do not return the builder object, as they produce an output. They potentially throw two kinds of exception: `IOException` (when the file could not be written) and `TransformationException` (when the AST could not be processed). As shown here, the builder object must be stored in a variable to create multiple outputs. Alternatively to a file, the result can be written to a given `OutputStream` (10). +- (8), (9) and (10) To create an output image, use `dumpAsPNG` for PNG (`dumpAsSVG` for SVG). Those methods do not return the builder object, as they produce an output. They potentially throw two kinds of exception: `IOException` (when the file could not be written) and `TransformationException` (when the AST could not be processed). As shown here, the builder object must be stored in a variable to create multiple outputs. Alternatively to a file, the result can be written to a given `OutputStream` (10). To summarise the required steps: Specify the AST to read in, configure the output, and write ("dump") the output. For more configuration options, please consult the [API Docs of DumpBuilder](../ragdoc/#/type/DumpBuilder) or check out [FeatureTestMain](https://git-st.inf.tu-dresden.de/jastadd/dumpAst/-/blob/main/dumpAst.prototyping/src/main/java/de/tudresden/inf/st/jastadd/featureTest/FeatureTestMain.java).