Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import java.util.List;
import java.util.Set;

class RouteDiagramLayoutEngine {
public class RouteDiagramLayoutEngine {

static final int SCALE = 2;
static final int NODE_WIDTH = 180 * SCALE;
Expand All @@ -33,16 +33,16 @@ class RouteDiagramLayoutEngine {
private static final Set<String> BRANCHING_EIPS = Set.of(
"choice", "multicast", "doTry", "loadBalance", "recipientList");

static class NodeInfo {
String type;
String code;
int level;
public static class NodeInfo {
public String type;
public String code;
public int level;
}

static class RouteInfo {
String routeId;
String source;
List<NodeInfo> nodes = new ArrayList<>();
public static class RouteInfo {
public String routeId;
public String source;
public List<NodeInfo> nodes = new ArrayList<>();
}

static class TreeNode {
Expand All @@ -69,13 +69,13 @@ static class LayoutNode {
int mergeCx;
}

static class LayoutRoute {
String routeId;
String source;
int labelY;
int maxX;
int maxY;
List<LayoutNode> nodes = new ArrayList<>();
public static class LayoutRoute {
public String routeId;
public String source;
public int labelY;
public int maxX;
public int maxY;
public List<LayoutNode> nodes = new ArrayList<>();
}

static TreeNode buildTree(List<NodeInfo> nodes) {
Expand Down Expand Up @@ -126,7 +126,7 @@ static String cleanLabel(String code) {
return code.replaceFirst("^\\.", "");
}

LayoutRoute layoutRoute(RouteInfo route, int startY) {
public LayoutRoute layoutRoute(RouteInfo route, int startY) {
LayoutRoute lr = new LayoutRoute();
lr.routeId = route.routeId;
lr.source = route.source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import static org.apache.camel.dsl.jbang.core.commands.action.RouteDiagramLayoutEngine.SCALE;
import static org.apache.camel.dsl.jbang.core.commands.action.RouteDiagramLayoutEngine.V_GAP;

class RouteDiagramRenderer {
public class RouteDiagramRenderer {

private static final int ARC = 14 * SCALE;
private static final int FONT_SIZE_LABEL = 13 * SCALE;
Expand Down Expand Up @@ -67,7 +67,7 @@ class RouteDiagramRenderer {
"light", LIGHT_COLORS,
"transparent", TRANSPARENT_COLORS);

static class DiagramColors {
public static class DiagramColors {
private Color bg;
private Color text;
private Color arrow;
Expand All @@ -80,7 +80,7 @@ static class DiagramColors {
private Color nodeTransform;
private Color nodeProcessor;

static DiagramColors parse(String spec) {
public static DiagramColors parse(String spec) {
String resolved = COLOR_PRESETS.getOrDefault(spec, spec);
Map<String, String> map = new HashMap<>();
for (String entry : DARK_COLORS.split(":")) {
Expand Down Expand Up @@ -173,7 +173,7 @@ Color getNodeProcessor() {
}
}

BufferedImage renderDiagram(List<LayoutRoute> layoutRoutes, int totalHeight, DiagramColors colors) {
public BufferedImage renderDiagram(List<LayoutRoute> layoutRoutes, int totalHeight, DiagramColors colors) {
int imgWidth = layoutRoutes.stream().mapToInt(lr -> lr.maxX).max().orElse(400) + PADDING;
int imgHeight = totalHeight + PADDING;

Expand Down Expand Up @@ -371,7 +371,7 @@ private Color getNodeColor(String type, DiagramColors colors) {
};
}

void printTextDiagram(List<RouteInfo> routes, Printer printer) {
public void printTextDiagram(List<RouteInfo> routes, Printer printer) {
for (RouteInfo route : routes) {
printer.println();
String header = "Route: " + route.routeId;
Expand Down
5 changes: 5 additions & 0 deletions dsl/camel-jbang/camel-jbang-plugin-tui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
<artifactId>tamboui-jline3-backend</artifactId>
<version>${tamboui-version}</version>
</dependency>
<dependency>
<groupId>dev.tamboui</groupId>
<artifactId>tamboui-image</artifactId>
<version>${tamboui-version}</version>
</dependency>
</dependencies>

</project>
Loading
Loading