Skip to content
This repository was archived by the owner on Mar 28, 2026. It is now read-only.

Commit 6e9f8e7

Browse files
Adds back the original Big Bank example tests (and some special handling for sequence diagrams).
1 parent 9fd9660 commit 6e9f8e7

3 files changed

Lines changed: 1181 additions & 9 deletions

File tree

structurizr-export/src/main/java/com/structurizr/export/AbstractDiagramExporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public AbstractDiagramExporter() {
2222
}
2323

2424
public AbstractDiagramExporter(ColorScheme colorScheme) {
25-
this.colorScheme = colorScheme;
25+
this.colorScheme = colorScheme != null ? colorScheme : ColorScheme.Light;
2626
}
2727

2828
/**

structurizr-export/src/main/java/com/structurizr/export/plantuml/StructurizrPlantUMLExporter.java

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ protected void startDeploymentNodeBoundary(DeploymentView view, DeploymentNode d
267267
format(
268268
"rectangle \"%s\\n<size:%s>%s</size>%s\" <<%s>> as %s%s {",
269269
deploymentNode.getName() + (!"1".equals(deploymentNode.getInstances()) ? " (x" + deploymentNode.getInstances() + ")" : ""),
270-
calculateMetadataFontSize(findBoundaryStyle(view, deploymentNode).getFontSize()),
270+
calculateMetadataFontSize(findElementStyle(view, deploymentNode).getFontSize()),
271271
typeOf(view, deploymentNode, true),
272272
icon,
273273
classSelectorFor(elementStyle),
@@ -324,6 +324,15 @@ public Diagram export(DynamicView view) {
324324
@Override
325325
protected void writeElement(ModelView view, Element element, IndentingWriter writer) {
326326
ElementStyle elementStyle = findElementStyle(view, element);
327+
String sequenceDiagramShape = plantumlSequenceType(view, element);
328+
329+
if (renderAsSequenceDiagram(view)) {
330+
// actor and database require special treatment because the label sits outside the shape
331+
if ("actor".equals(sequenceDiagramShape) || "database".equals(sequenceDiagramShape)) {
332+
elementStyle.color(elementStyle.getStroke());
333+
}
334+
}
335+
327336
PlantUMLElementStyle plantUMLElementStyle = new PlantUMLElementStyle(
328337
elementStyle.getTag(),
329338
elementStyle.getShape(),
@@ -342,14 +351,14 @@ protected void writeElement(ModelView view, Element element, IndentingWriter wri
342351
int metadataFontSize = calculateMetadataFontSize(elementStyle.getFontSize());
343352

344353
if (renderAsSequenceDiagram(view)) {
345-
writer.writeLine(String.format("%s \"%s\\n<size:%s>%s</size>\" as %s <<%s>> %s",
346-
plantumlSequenceType(view, element),
354+
writer.writeLine(String.format("%s \"%s\\n<size:%s>%s</size>\" as %s <<%s>>",
355+
sequenceDiagramShape,
347356
element.getName(),
348357
metadataFontSize,
349358
typeOf(view, element, true),
350359
idOf(element),
351-
plantUMLElementStyle.getClassSelector(),
352-
elementStyle.getBackground()));
360+
plantUMLElementStyle.getClassSelector()
361+
));
353362
} else {
354363
String shape = plantUMLShapeOf(view, element);
355364
String name = element.getName();
@@ -556,7 +565,83 @@ private String classSelectorForBoundary(Element element) {
556565
}
557566

558567
private ElementStyle findBoundaryStyle(ModelView view, Element element) {
559-
return findElementStyle(view, element);
568+
String background = colorScheme == ColorScheme.Dark ? Styles.DEFAULT_BACKGROUND_DARK : Styles.DEFAULT_BACKGROUND_LIGHT;
569+
String stroke = colorScheme == ColorScheme.Dark ? Styles.DEFAULT_COLOR_DARK : Styles.DEFAULT_COLOR_LIGHT;
570+
int strokeWidth = DEFAULT_STROKE_WIDTH;
571+
Border border = Border.Dotted;
572+
String color = colorScheme == ColorScheme.Dark ? Styles.DEFAULT_COLOR_DARK : Styles.DEFAULT_COLOR_LIGHT;
573+
String icon = "";
574+
int fontSize = DEFAULT_FONT_SIZE;
575+
576+
String type = element instanceof SoftwareSystem ? "SoftwareSystem" : "Container";
577+
578+
ElementStyle style = new ElementStyle("");
579+
ElementStyle elementStyleForBoundary = findElementStyle(view, "Boundary:" + type);
580+
ElementStyle elementStyleForAllBoundaries = findElementStyle(view, "Boundary");
581+
ElementStyle elementStyleForElement = findElementStyle(view, element);
582+
583+
if (elementStyleForBoundary != null && !StringUtils.isNullOrEmpty(elementStyleForBoundary.getBackground())) {
584+
background = elementStyleForBoundary.getBackground();
585+
} else if (elementStyleForAllBoundaries != null && !StringUtils.isNullOrEmpty(elementStyleForAllBoundaries.getBackground())) {
586+
background = elementStyleForAllBoundaries.getBackground();
587+
}
588+
style.setBackground(background);
589+
590+
if (elementStyleForBoundary != null && !StringUtils.isNullOrEmpty(elementStyleForBoundary.getStroke())) {
591+
stroke = elementStyleForBoundary.getStroke();
592+
} else if (elementStyleForAllBoundaries != null && !StringUtils.isNullOrEmpty(elementStyleForAllBoundaries.getStroke())) {
593+
stroke = elementStyleForAllBoundaries.getStroke();
594+
} else if (!StringUtils.isNullOrEmpty(elementStyleForElement.getStroke())) {
595+
stroke = elementStyleForElement.getStroke();
596+
}
597+
style.setStroke(stroke);
598+
599+
if (elementStyleForBoundary != null && elementStyleForBoundary.getStrokeWidth() != null) {
600+
strokeWidth = elementStyleForBoundary.getStrokeWidth();
601+
} else if (elementStyleForAllBoundaries != null && elementStyleForAllBoundaries.getStrokeWidth() != null) {
602+
strokeWidth = elementStyleForAllBoundaries.getStrokeWidth();
603+
} else if (elementStyleForElement.getStrokeWidth() != null) {
604+
strokeWidth = elementStyleForElement.getStrokeWidth();
605+
}
606+
style.setStrokeWidth(strokeWidth);
607+
608+
if (elementStyleForBoundary != null && !StringUtils.isNullOrEmpty(elementStyleForBoundary.getColor())) {
609+
color = elementStyleForBoundary.getColor();
610+
} else if (elementStyleForAllBoundaries != null && !StringUtils.isNullOrEmpty(elementStyleForAllBoundaries.getColor())) {
611+
color = elementStyleForAllBoundaries.getColor();
612+
} else if (!StringUtils.isNullOrEmpty(elementStyleForElement.getColor())) {
613+
color = elementStyleForElement.getColor();
614+
}
615+
style.setColor(color);
616+
617+
if (elementStyleForBoundary != null && elementStyleForBoundary.getBorder() != null) {
618+
border = elementStyleForBoundary.getBorder();
619+
} else if (elementStyleForAllBoundaries != null && elementStyleForAllBoundaries.getBorder() != null) {
620+
border = elementStyleForAllBoundaries.getBorder();
621+
} else if (elementStyleForElement.getBorder() != null) {
622+
border = elementStyleForElement.getBorder();
623+
}
624+
style.setBorder(border);
625+
626+
if (elementStyleForBoundary != null && isSupportedIcon(elementStyleForBoundary.getIcon())) {
627+
icon = elementStyleForBoundary.getIcon();
628+
} else if (elementStyleForAllBoundaries != null && isSupportedIcon(elementStyleForAllBoundaries.getIcon())) {
629+
icon = elementStyleForAllBoundaries.getIcon();
630+
} else if (isSupportedIcon(elementStyleForElement.getIcon())) {
631+
icon = elementStyleForElement.getIcon();
632+
}
633+
style.setIcon(icon);
634+
635+
if (elementStyleForBoundary != null && elementStyleForBoundary.getFontSize() != null) {
636+
fontSize = elementStyleForBoundary.getFontSize();
637+
} else if (elementStyleForAllBoundaries != null && elementStyleForAllBoundaries.getFontSize() != null) {
638+
fontSize = elementStyleForAllBoundaries.getFontSize();
639+
} else if (elementStyleForElement.getFontSize() != null) {
640+
fontSize = elementStyleForElement.getFontSize();
641+
}
642+
style.setFontSize(fontSize);
643+
644+
return style;
560645
}
561646

562647
private String classSelectorForGroup(String group) {

0 commit comments

Comments
 (0)