Author HTML and typed suggestion bindings in the IntelliJ designer

This commit is contained in:
2026-11-24 21:02:58 +01:00
parent f9c3de2d2b
commit 33e8f8f9f0
12 changed files with 264 additions and 25 deletions
@@ -49,6 +49,14 @@ class ViewModelComputedTest {
throw new AssertionError("reserved invoked");
}
public ReadOnlyListProperty<String> tagsProperty() {
throw new AssertionError("property invoked");
}
public ObjectProperty<javafx.collections.ObservableList<Integer>> numbersProperty() {
throw new AssertionError("property invoked");
}
public ReadOnlyStringProperty readOnlyProperty() {
throw new AssertionError("readonly invoked");
}
@@ -237,6 +245,30 @@ class ViewModelComputedTest {
assertNull(System.getProperty(key));
}
@Test
void listTargetsCheckTheDeclaredElementTypeForDiscoveryAndValidation() throws Exception {
for (String path : List.of("tags", "numbers")) {
String document =
xml(
Controller.class,
direct(path).replace("property='text'", "property='suggestionsSource'"))
.replace(
"javafx.scene.control.TextField", "de.neitzel.fx.control.AutoCompleteTextField")
.replace("<TextField", "<AutoCompleteTextField")
.replace("</TextField>", "</AutoCompleteTextField>");
var result = BindingDiscovery.inspect(document, path, "view", getClass().getClassLoader());
var target =
result.targets().stream()
.filter(t -> t.property().equals("suggestionsSource"))
.findFirst()
.orElseThrow();
boolean matching = path.equals("tags");
assertEquals(matching ? "COMPATIBLE" : "INCOMPATIBLE", target.status());
assertEquals(
!matching, result.problems().stream().anyMatch(p -> p.severity().equals("ERROR")));
}
}
@Test
void replacementDoesNotInheritModelAttributesOrDottedTraversal() throws Exception {
var result = inspect(xml(ReplacementController.class, direct("home.name")));