Update file host on file choice if needed

This commit is contained in:
crschnick 2024-05-10 04:44:11 +00:00
parent 63d9cce78e
commit 3363ad9f41

View file

@ -47,6 +47,19 @@ public class ContextualFileReferenceChoiceComp extends Comp<CompStructure<HBox>>
this.filePath = filePath;
}
public <T extends FileSystemStore> ContextualFileReferenceChoiceComp(
Property<DataStoreEntryRef<T>> fileSystem, Property<String> filePath) {
this.fileSystem = new SimpleObjectProperty<>();
fileSystem.subscribe(val -> {
this.fileSystem.setValue(val);
});
this.fileSystem.addListener((observable, oldValue, newValue) -> {
fileSystem.setValue(newValue.get().ref());
});
this.filePath = filePath;
}
@Override
public CompStructure<HBox> createBase() {
var fileNameComp = new TextFieldComp(filePath)