Author HTML and typed suggestion bindings in the IntelliJ designer
This commit is contained in:
@@ -469,7 +469,7 @@ public final class DesignerPane extends BorderPane implements AutoCloseable {
|
||||
values -> {
|
||||
bindings.setExpanded(true);
|
||||
directBindingTab.getTabPane().getSelectionModel().select(directBindingTab);
|
||||
bindingEditor.newBinding(values);
|
||||
bindingEditor.editProperty(values);
|
||||
});
|
||||
var formPane = new TitledPane("Form controls", formEditor);
|
||||
formPane.setExpanded(false);
|
||||
|
||||
@@ -43,6 +43,13 @@ final class FormDocument {
|
||||
record Edit(String source, List<Replacement> changes, String selectId) {}
|
||||
|
||||
record Field(String name, String type, String fallback, boolean editable) {
|
||||
boolean bindable() {
|
||||
return type.equals("ObservableList<String>")
|
||||
|| editable
|
||||
&& !name.equals("dismissText")
|
||||
&& Set.of("Integer", "String", "Boolean", "Number", "CSS", "Insets").contains(type);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
@@ -335,8 +342,12 @@ final class FormDocument {
|
||||
field(fields, "initialValue", "Constructor integer", "0");
|
||||
field(fields, "number", "Integer", "initialValue");
|
||||
}
|
||||
if (item.type().equals("AutoCompleteTextField"))
|
||||
if (item.type().equals("AutoCompleteTextField")) {
|
||||
field(fields, "suggestions", "String list", "");
|
||||
fields.put(
|
||||
"suggestionsSource",
|
||||
new Field("suggestionsSource", "ObservableList<String>", "fixed suggestions", false));
|
||||
}
|
||||
if (item.type().equals("TagChip")) {
|
||||
field(fields, "removable", "Boolean", "false");
|
||||
field(fields, "onRemove", "Event handler", "");
|
||||
@@ -351,6 +362,7 @@ final class FormDocument {
|
||||
if (Set.of("Label", "Button", "CheckBox", "TextArea").contains(item.type()))
|
||||
field(fields, "wrapText", "Boolean", "false");
|
||||
if (item.type().equals("HtmlViewer")) {
|
||||
field(fields, "html", "String", "");
|
||||
field(fields, "mediaButtonVisible", "Boolean", "true");
|
||||
field(fields, "mediaLoadText", "String", "Load external media");
|
||||
field(fields, "mediaReloadText", "String", "Reload external media");
|
||||
|
||||
@@ -103,11 +103,7 @@ final class FormEditor extends VBox {
|
||||
message.setText("Select a control with an fx:id and a property.");
|
||||
return;
|
||||
}
|
||||
if (!property.editable()
|
||||
|| !(java.util.Set.of(
|
||||
"Integer", "String", "Boolean", "Number", "CSS", "Insets")
|
||||
.contains(property.type()))
|
||||
|| property.name().equals("dismissText")) {
|
||||
if (!property.bindable()) {
|
||||
message.setText(
|
||||
"This setting has no writable JavaFX property for DirectBinding.");
|
||||
return;
|
||||
@@ -185,7 +181,9 @@ final class FormEditor extends VBox {
|
||||
+ " · default "
|
||||
+ (f.fallback().isEmpty() ? "(empty)" : f.fallback())
|
||||
+ " · "
|
||||
+ (f.editable() ? "editable" : "read only"));
|
||||
+ (f.type().equals("ObservableList<String>")
|
||||
? "bind to a model list"
|
||||
: f.editable() ? "editable" : "read only"));
|
||||
value.setEditable(f.editable());
|
||||
value.setText(form.value(item, f));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user