|
20 | 20 | import java.io.File;
|
21 | 21 | import java.io.FileWriter;
|
22 | 22 | import java.io.IOException;
|
23 |
| -import java.io.StringWriter; |
24 | 23 | import java.io.Writer;
|
25 | 24 | import java.lang.annotation.Annotation;
|
26 | 25 | import java.nio.file.Files;
|
|
50 | 49 | import org.springframework.util.MultiValueMap;
|
51 | 50 |
|
52 | 51 | import com.structurizr.Workspace;
|
53 |
| -import com.structurizr.export.Diagram; |
| 52 | +import com.structurizr.export.IndentingWriter; |
54 | 53 | import com.structurizr.export.plantuml.C4PlantUMLExporter;
|
55 |
| -import com.structurizr.io.plantuml.BasicPlantUMLWriter; |
56 |
| -import com.structurizr.io.plantuml.PlantUMLWriter; |
| 54 | +import com.structurizr.export.plantuml.StructurizrPlantUMLExporter; |
57 | 55 | import com.structurizr.model.Component;
|
58 | 56 | import com.structurizr.model.Container;
|
59 | 57 | import com.structurizr.model.Element;
|
@@ -487,26 +485,18 @@ private String render(ComponentView view, DiagramOptions options) {
|
487 | 485 |
|
488 | 486 | case C4:
|
489 | 487 |
|
490 |
| - C4PlantUMLExporter exporter = new C4PlantUMLExporter(); |
491 |
| - Diagram diagram = exporter.export(view); |
| 488 | + var c4PlantUmlExporter = new C4PlantUMLExporter(); |
| 489 | + var diagram = c4PlantUmlExporter.export(view); |
| 490 | + |
492 | 491 | return diagram.getDefinition();
|
493 | 492 |
|
494 | 493 | case UML:
|
495 | 494 | default:
|
496 | 495 |
|
497 |
| - Writer writer = new StringWriter(); |
498 |
| - PlantUMLWriter umlWriter = new BasicPlantUMLWriter() { |
499 |
| - |
500 |
| - @Override |
501 |
| - protected void writeContainerForContainer(ComponentView view, Writer writer, |
502 |
| - BiConsumer<ComponentView, Writer> packageContentWriter) throws IOException { |
503 |
| - packageContentWriter.accept(view, writer); |
504 |
| - } |
505 |
| - }; |
506 |
| - umlWriter.addSkinParam("componentStyle", "uml1"); |
507 |
| - umlWriter.write(view, writer); |
| 496 | + var plantUmlExporter = new CustomizedPlantUmlExporter(); |
| 497 | + plantUmlExporter.addSkinParam("componentStyle", "uml1"); |
508 | 498 |
|
509 |
| - return writer.toString(); |
| 499 | + return plantUmlExporter.export(view).getDefinition(); |
510 | 500 | }
|
511 | 501 | }
|
512 | 502 |
|
@@ -1173,4 +1163,18 @@ boolean hasOnlyFallbackGroup() {
|
1173 | 1163 | }
|
1174 | 1164 | }
|
1175 | 1165 | }
|
| 1166 | + |
| 1167 | + private static class CustomizedPlantUmlExporter extends StructurizrPlantUMLExporter { |
| 1168 | + |
| 1169 | + @Override |
| 1170 | + protected boolean includeTitle(ModelView view) { |
| 1171 | + return false; |
| 1172 | + }; |
| 1173 | + |
| 1174 | + @Override |
| 1175 | + protected void startContainerBoundary(ModelView view, Container container, IndentingWriter writer) {} |
| 1176 | + |
| 1177 | + @Override |
| 1178 | + protected void endContainerBoundary(ModelView view, IndentingWriter writer) {}; |
| 1179 | + }; |
1176 | 1180 | }
|
0 commit comments