Close #2757: 更新 MultiFileItem (#2758)

This commit is contained in:
Glavo 2024-02-07 22:37:56 +08:00 committed by GitHub
parent 7de07319d9
commit 20fe5430dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,7 +40,7 @@ import java.util.Optional;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class MultiFileItem<T> extends VBox { public final class MultiFileItem<T> extends VBox {
private final ObjectProperty<T> selectedData = new SimpleObjectProperty<>(this, "selectedData"); private final ObjectProperty<T> selectedData = new SimpleObjectProperty<>(this, "selectedData");
private final ObjectProperty<T> fallbackData = new SimpleObjectProperty<>(this, "fallbackData"); private final ObjectProperty<T> fallbackData = new SimpleObjectProperty<>(this, "fallbackData");
@ -176,8 +176,8 @@ public class MultiFileItem<T> extends VBox {
} }
} }
public static class StringOption<T> extends Option<T> { public static final class StringOption<T> extends Option<T> {
private JFXTextField customField = new JFXTextField(); private final JFXTextField customField = new JFXTextField();
public StringOption(String title, T data) { public StringOption(String title, T data) {
super(title, data); super(title, data);
@ -196,7 +196,7 @@ public class MultiFileItem<T> extends VBox {
} }
public StringOption<T> bindBidirectional(Property<String> property) { public StringOption<T> bindBidirectional(Property<String> property) {
customField.textProperty().bindBidirectional(property); FXUtils.bindString(customField, property);
return this; return this;
} }
@ -230,8 +230,8 @@ public class MultiFileItem<T> extends VBox {
} }
} }
public static class FileOption<T> extends Option<T> { public static final class FileOption<T> extends Option<T> {
private FileSelector selector = new FileSelector(); private final FileSelector selector = new FileSelector();
public FileOption(String title, T data) { public FileOption(String title, T data) {
super(title, data); super(title, data);