Add shared source-preserving Repeat binding inspector

This commit is contained in:
2026-11-13 14:06:16 +01:00
parent 510ce35b60
commit 0300062fb6
10 changed files with 481 additions and 54 deletions
@@ -44,6 +44,7 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
String id = hit.getFxId();
if (bindingEditor != null) bindingEditor.selectControl(id);
if (computedEditor != null) computedEditor.selectControl(id);
if (repeatEditor != null) repeatEditor.selectControl(id);
if (id == null || !projection.components().containsKey(id)) return;
componentInspector.getChildren().add(new Label(projection.components().get(id) + " · " + id));
componentInspector
@@ -115,7 +116,7 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
private DesignerWorkflow interactiveWorkflow;
private DesignerWorkflow bindingWorkflow;
private BindingBrowser bindingBrowser;
private BindingEditor bindingEditor, computedEditor;
private BindingEditor bindingEditor, computedEditor, repeatEditor;
private String validatedSource, validatingSource;
private boolean validationPreview;
private java.util.List<de.neitzel.fxdesigner.protocol.BindingMetadata.Problem> bindingProblems =
@@ -200,6 +201,16 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
if (target != null) kit.editor().getSelection().select(target);
},
values -> validateBindings(values, false));
repeatEditor =
new BindingEditor(
BindingDocument.Kind.REPEAT,
this::editBinding,
id -> {
if (kit.editor().getFxomDocument() == null) return;
var target = new FXOMFxIdIndex(kit.editor().getFxomDocument()).lookup(id);
if (target != null) kit.editor().getSelection().select(target);
},
values -> validateBindings(values, false));
bindingBrowser =
new BindingBrowser(
this::discoverBindings,
@@ -348,8 +359,11 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
directBindingTab.setClosable(false);
var computedTab = new Tab("Computed bindings", computedEditor);
computedTab.setClosable(false);
var repeatTab = new Tab("Repeat bindings", repeatEditor);
repeatTab.setClosable(false);
var bindings =
new TitledPane("Bindings", new TabPane(directBindingTab, computedTab, discoveryTab));
new TitledPane(
"Bindings", new TabPane(directBindingTab, computedTab, repeatTab, discoveryTab));
bindings.setExpanded(false);
center.setBottom(new VBox(properties, bindings));
output.setEditable(false);
@@ -491,6 +505,7 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
draft = value;
bindingEditor.load(value.text(), value.writable());
computedEditor.load(value.text(), value.writable());
repeatEditor.load(value.text(), value.writable());
submittedSource = null;
commitSource();
return;
@@ -514,6 +529,7 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
draft = value;
bindingEditor.load(value.text(), value.writable());
computedEditor.load(value.text(), value.writable());
repeatEditor.load(value.text(), value.writable());
if (!source.getText().equals(value.text())) {
int anchor = source.getAnchor(), caret = source.getCaretPosition();
var edits =
@@ -686,7 +702,11 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
? "Remove " + intent.kind().element()
: (intent.index() == null ? "Create " : "Edit ") + intent.kind().element());
} catch (Exception error) {
(intent.kind() == BindingDocument.Kind.COMPUTED ? computedEditor : bindingEditor)
(intent.kind() == BindingDocument.Kind.REPEAT
? repeatEditor
: intent.kind() == BindingDocument.Kind.COMPUTED
? computedEditor
: bindingEditor)
.error(error.getMessage());
}
});
@@ -761,6 +781,14 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
: "Current successful build")
+ " · draft revision "
+ captured.revision());
repeatEditor.metadata(
metadata,
values,
(last
? "Explicit retained build (outdated)"
: "Current successful build")
+ " · draft revision "
+ captured.revision());
status.setText(
"Binding validation complete: "
+ metadata.problems().size()