transition enricher
This commit is contained in:
@@ -240,7 +240,7 @@ public class AstTransitionParser {
|
||||
t.setEvent(Event.of(QuotedExpression.of(resolved).toStringWithoutQuotes()));
|
||||
}
|
||||
}
|
||||
case "guard" -> {
|
||||
case "guard", "guardExpression" -> {
|
||||
Expression resolved = resolveArg((Expression) args.get(0), argsMap);
|
||||
parseGuard(resolved, t, cu, context);
|
||||
}
|
||||
@@ -248,6 +248,10 @@ public class AstTransitionParser {
|
||||
Expression resolved = resolveArg((Expression) args.get(0), argsMap);
|
||||
parseAction(resolved, t, cu, context);
|
||||
}
|
||||
case "timer", "timerOnce" -> {
|
||||
Expression resolved = resolveArg((Expression) args.get(0), argsMap);
|
||||
t.setEvent(Event.of(methodName + "(" + resolved.toString() + ")", methodName + "(" + resolved.toString() + ")"));
|
||||
}
|
||||
}
|
||||
}
|
||||
return t;
|
||||
|
||||
@@ -116,23 +116,19 @@ public class PlantUml implements StateMachineExporter {
|
||||
|
||||
sb.append(" <<").append(styleClass).append(">>");
|
||||
|
||||
if (t.getEvent() != null) {
|
||||
String eventStr = options.formatEvent(t.getEvent());
|
||||
if (eventStr != null && !eventStr.isBlank()) {
|
||||
sb.append(" <<e_").append(normalize(eventStr)).append(">>");
|
||||
}
|
||||
}
|
||||
|
||||
String label = buildLabel(t, options);
|
||||
if (options.isEmbedIdentifiers()) {
|
||||
String eventStr = t.getEvent() != null ? options.formatEvent(t.getEvent()) : null;
|
||||
String linkId = eventStr != null && !eventStr.isBlank() ? "link_" + normalize(source) + "__" + normalize(eventStr) : "link_anon_" + normalize(source) + "_" + normalize(target);
|
||||
// Force a label even if empty to ensure the link group exists in SVG
|
||||
String displayLabel = label.isEmpty() ? " " : label;
|
||||
// Brackets [...] in the label break PlantUML link syntax [[url label]],
|
||||
// so we strip them for the interactive identification label.
|
||||
String safeLabel = displayLabel.replaceAll("[\\[\\]]", "");
|
||||
sb.append(" : ").append("[[#").append(linkId).append(" ").append(safeLabel).append("]]");
|
||||
|
||||
sb.append(" : [[#").append(linkId).append(" ");
|
||||
if (!label.isEmpty()) {
|
||||
sb.append(label);
|
||||
} else {
|
||||
sb.append("<U+00A0>");
|
||||
}
|
||||
sb.append("]]");
|
||||
} else if (!label.isEmpty()) {
|
||||
sb.append(" : ").append(label);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user