mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-09-30 00:56:56 +13:00
Fix connection choice filter focus
This commit is contained in:
parent
44945546f7
commit
e4d3eb2a3d
1 changed files with 10 additions and 19 deletions
|
@ -13,7 +13,6 @@ import io.xpipe.app.storage.DataStoreEntryRef;
|
|||
import io.xpipe.app.util.DataStoreCategoryChoiceComp;
|
||||
import io.xpipe.core.store.DataStore;
|
||||
import io.xpipe.core.store.ShellStore;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.Property;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
|
@ -106,18 +105,7 @@ public class DataStoreChoiceComp<T extends DataStore> extends SimpleComp {
|
|||
selectedCategory).styleClass(Styles.LEFT_PILL);
|
||||
var filter = new FilterComp(filterText)
|
||||
.styleClass(Styles.CENTER_PILL)
|
||||
.hgrow()
|
||||
.apply(struc -> {
|
||||
popover.setOnShowing(event -> {
|
||||
Platform.runLater(() -> {
|
||||
Platform.runLater(() -> {
|
||||
Platform.runLater(() -> {
|
||||
struc.getText().requestFocus();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
.hgrow();
|
||||
|
||||
var addButton = Comp.of(() -> {
|
||||
MenuButton m = new MenuButton(null, new FontIcon("mdi2p-plus-box-outline"));
|
||||
|
@ -132,6 +120,15 @@ public class DataStoreChoiceComp<T extends DataStore> extends SimpleComp {
|
|||
var top = new HorizontalComp(List.of(category, filter.hgrow(), addButton))
|
||||
.styleClass("top")
|
||||
.apply(struc -> struc.get().setFillHeight(true))
|
||||
.apply(struc -> {
|
||||
// Ugly solution to focus the text field
|
||||
// Somehow this does not work through the normal on shown listeners
|
||||
struc.get().getChildren().get(0).focusedProperty().addListener((observable, oldValue, newValue) -> {
|
||||
if (newValue) {
|
||||
((StackPane) struc.get().getChildren().get(1)).getChildren().get(1).requestFocus();
|
||||
}
|
||||
});
|
||||
})
|
||||
.createStructure().get();
|
||||
var r = section.vgrow().createRegion();
|
||||
var content = new VBox(top, r);
|
||||
|
@ -146,12 +143,6 @@ public class DataStoreChoiceComp<T extends DataStore> extends SimpleComp {
|
|||
popover.setHeaderAlwaysVisible(true);
|
||||
popover.setDetachable(true);
|
||||
popover.setTitle(AppI18n.get("selectConnection"));
|
||||
popover.setOnShowing(event -> {
|
||||
Platform.runLater(() -> {
|
||||
((StackPane) top.getChildren().get(1)).getChildren().get(1).requestFocus();
|
||||
});
|
||||
event.consume();
|
||||
});
|
||||
AppFont.small(popover.getContentNode());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue