Discover Table compatibility and declared Row alignment

This commit is contained in:
2026-11-13 15:33:40 +01:00
parent 3417788194
commit 5462f480a4
26 changed files with 1086 additions and 76 deletions
@@ -210,38 +210,57 @@ public final class DesignerWorkflow implements AutoCloseable {
String direction,
String control,
String property) {
return execute(
last,
List.of(document),
worker -> {
var result =
worker.request(
Operation.BINDINGS,
Map.of(document.document().toString(), document.revision()),
0,
0,
PreviewMessages.encode(
Map.of(
"fxml",
document.text(),
"path",
path,
"direction",
direction,
"control",
control,
"property",
property,
"resource",
worker.resource(document.document()))),
Duration.ofSeconds(15));
try (var current =
host.documents().open(document.document()).toCompletableFuture().get()) {
if (current.snapshot().toCompletableFuture().get().revision() != document.revision())
throw new CancellationException("Draft changed during discovery");
}
return BindingMetadata.decode(PreviewMessages.decode(result.payload()));
});
return host.documents()
.snapshots()
.thenCompose(
known -> {
var captured = new LinkedHashMap<URI, DocumentSnapshot>();
known.stream()
.filter(
d ->
d.document().toString().endsWith(".fxml")
&& Path.of(d.document()).startsWith(reactor)
&& !Path.of(d.document())
.startsWith(reactor.resolve(".neitzel-fx-designer")))
.forEach(d -> captured.put(d.document(), d));
captured.put(document.document(), document);
var revisions = new LinkedHashMap<String, Long>();
captured.values().forEach(d -> revisions.put(d.document().toString(), d.revision()));
return execute(
last,
List.copyOf(captured.values()),
worker -> {
var result =
worker.request(
Operation.BINDINGS,
revisions,
0,
0,
PreviewMessages.encode(
Map.of(
"fxml",
document.text(),
"path",
path,
"direction",
direction,
"control",
control,
"property",
property,
"resource",
worker.resource(document.document()))),
Duration.ofSeconds(15));
for (var draft : captured.values())
try (var current =
host.documents().open(draft.document()).toCompletableFuture().get()) {
if (current.snapshot().toCompletableFuture().get().revision()
!= draft.revision())
throw new CancellationException("Draft changed during discovery");
}
return BindingMetadata.decode(PreviewMessages.decode(result.payload()));
});
});
}
public CompletionStage<List<Example>> discover(boolean lastSuccessful) {
@@ -108,7 +108,7 @@ public final class PreviewWorker implements AutoCloseable {
id,
process.pid(),
token,
Set.of("discover-v1", "render-rgba-v1", "layout-v1", "interactive-v1", "bindings-v4"),
Set.of("discover-v1", "render-rgba-v1", "layout-v1", "interactive-v1", "bindings-v5"),
config.requiredCapabilities());
}
drain(process.getInputStream(), log);