Various fixes

This commit is contained in:
crschnick 2024-06-27 05:03:38 +00:00
parent 9d4903e665
commit 99056e924c
7 changed files with 29 additions and 25 deletions

View file

@ -9,6 +9,7 @@ import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.fxcomps.impl.PrettyImageHelper; import io.xpipe.app.fxcomps.impl.PrettyImageHelper;
import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.fxcomps.util.PlatformThread;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
@ -63,8 +64,9 @@ public class BrowserSelectionListComp extends SimpleComp {
return l; return l;
}); });
}, },
false) true)
.styleClass("selected-file-list"); .styleClass("selected-file-list")
.hide(Bindings.isEmpty(list));
return c.createRegion(); return c.createRegion();
} }
} }

View file

@ -3,6 +3,7 @@ package io.xpipe.app.browser;
import io.xpipe.app.browser.file.BrowserFileTransferMode; import io.xpipe.app.browser.file.BrowserFileTransferMode;
import io.xpipe.app.browser.fs.OpenFileSystemModel; import io.xpipe.app.browser.fs.OpenFileSystemModel;
import io.xpipe.app.comp.base.LoadingOverlayComp; import io.xpipe.app.comp.base.LoadingOverlayComp;
import io.xpipe.app.core.AppFont;
import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppI18n;
import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.SimpleComp;
@ -10,16 +11,13 @@ import io.xpipe.app.fxcomps.augment.DragOverPseudoClassAugment;
import io.xpipe.app.fxcomps.impl.*; import io.xpipe.app.fxcomps.impl.*;
import io.xpipe.app.fxcomps.util.DerivedObservableList; import io.xpipe.app.fxcomps.util.DerivedObservableList;
import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.fxcomps.util.PlatformThread;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.input.Dragboard; import javafx.scene.input.Dragboard;
import javafx.scene.input.TransferMode; import javafx.scene.input.TransferMode;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import org.kordamp.ikonli.javafx.FontIcon; import org.kordamp.ikonli.javafx.FontIcon;
import java.io.File; import java.io.File;
@ -77,9 +75,8 @@ public class BrowserTransferComp extends SimpleComp {
var dragNotice = new LabelComp(syncAllDownloaded.flatMap( var dragNotice = new LabelComp(syncAllDownloaded.flatMap(
aBoolean -> aBoolean ? AppI18n.observable("dragLocalFiles") : AppI18n.observable("dragFiles"))) aBoolean -> aBoolean ? AppI18n.observable("dragLocalFiles") : AppI18n.observable("dragFiles")))
.apply(struc -> struc.get().setGraphic(new FontIcon("mdi2h-hand-left"))) .apply(struc -> struc.get().setGraphic(new FontIcon("mdi2h-hand-left")))
.hide(Bindings.isEmpty(syncItems)) .apply(struc -> AppFont.medium(struc.get()))
.grow(true, false) .hide(Bindings.isEmpty(syncItems));
.apply(struc -> struc.get().setPadding(new Insets(8)));
var downloadButton = new IconButtonComp("mdi2d-download", () -> { var downloadButton = new IconButtonComp("mdi2d-download", () -> {
model.download(); model.download();
@ -91,23 +88,15 @@ public class BrowserTransferComp extends SimpleComp {
model.clear(); model.clear();
}) })
.hide(Bindings.isEmpty(syncItems)); .hide(Bindings.isEmpty(syncItems));
var clearPane = Comp.derive(
new HorizontalComp(List.of(downloadButton, clearButton))
.apply(struc -> struc.get().setSpacing(10)),
button -> {
var p = new AnchorPane(button);
AnchorPane.setRightAnchor(button, 10.0);
AnchorPane.setTopAnchor(button, 10.0);
p.setPickOnBounds(false);
return p;
});
var listBox = new VerticalComp(List.of(list, dragNotice)) var bottom = new HorizontalComp(List.of(dragNotice, Comp.hspacer(), downloadButton, Comp.hspacer(4), clearButton));
var listBox = new VerticalComp(List.of(list, bottom))
.spacing(5)
.padding(new Insets(10, 10, 5, 10)) .padding(new Insets(10, 10, 5, 10))
.apply(struc -> struc.get().setMinHeight(200)) .apply(struc -> struc.get().setMinHeight(200))
.apply(struc -> struc.get().setMaxHeight(200)); .apply(struc -> struc.get().setMaxHeight(200));
var stack = LoadingOverlayComp.noProgress( var stack = LoadingOverlayComp.noProgress(
new StackComp(List.of(backgroundStack, listBox, clearPane)) new StackComp(List.of(backgroundStack, listBox))
.apply(DragOverPseudoClassAugment.create()) .apply(DragOverPseudoClassAugment.create())
.apply(struc -> { .apply(struc -> {
struc.get().setOnDragOver(event -> { struc.get().setOnDragOver(event -> {

View file

@ -366,7 +366,12 @@ public class StoreCreationComp extends DialogComp {
.description("connectionNameDescription") .description("connectionNameDescription")
.addString(name, false) .addString(name, false)
.nonNull(propVal) .nonNull(propVal)
.build(); .buildComp()
.onSceneAssign(struc -> {
if (staticDisplay) {
struc.get().requestFocus();
}
}).createRegion();
} }
private void commit(boolean validated) { private void commit(boolean validated) {
@ -391,9 +396,10 @@ public class StoreCreationComp extends DialogComp {
var providerChoice = new StoreProviderChoiceComp(filter, provider, staticDisplay); var providerChoice = new StoreProviderChoiceComp(filter, provider, staticDisplay);
if (staticDisplay) { if (staticDisplay) {
providerChoice.apply(struc -> struc.get().setDisable(true)); providerChoice.apply(struc -> struc.get().setDisable(true));
} else {
providerChoice.onSceneAssign(struc -> struc.get().requestFocus());
} }
providerChoice.apply(GrowAugment.create(true, false)); providerChoice.apply(GrowAugment.create(true, false));
providerChoice.onSceneAssign(struc -> struc.get().requestFocus());
provider.subscribe(n -> { provider.subscribe(n -> {
if (n != null) { if (n != null) {

View file

@ -228,6 +228,11 @@ public class DataStoreChoiceComp<T extends DataStore> extends SimpleComp {
icon.setPickOnBounds(false); icon.setPickOnBounds(false);
AppFont.header(icon); AppFont.header(icon);
var pane = new StackPane(r, icon); var pane = new StackPane(r, icon);
pane.focusedProperty().addListener((observable, oldValue, newValue) -> {
if (newValue) {
r.requestFocus();
}
});
StackPane.setMargin(icon, new Insets(10)); StackPane.setMargin(icon, new Insets(10));
pane.setPickOnBounds(false); pane.setPickOnBounds(false);
StackPane.setAlignment(icon, Pos.CENTER_RIGHT); StackPane.setAlignment(icon, Pos.CENTER_RIGHT);

View file

@ -4,7 +4,6 @@ import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.CompStructure; import io.xpipe.app.fxcomps.CompStructure;
import io.xpipe.app.fxcomps.SimpleCompStructure; import io.xpipe.app.fxcomps.SimpleCompStructure;
import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.fxcomps.util.PlatformThread;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
@ -24,6 +23,10 @@ public class VerticalComp extends Comp<CompStructure<VBox>> {
this.entries = PlatformThread.sync(entries); this.entries = PlatformThread.sync(entries);
} }
public Comp<CompStructure<VBox>> spacing(double spacing) {
return apply(struc -> struc.get().setSpacing(spacing));
}
@Override @Override
public CompStructure<VBox> createBase() { public CompStructure<VBox> createBase() {
VBox b = new VBox(); VBox b = new VBox();

View file

@ -16,7 +16,7 @@ public class FixedServiceStoreProvider extends AbstractServiceStoreProvider {
FixedServiceStore s = store.getStore().asNeeded(); FixedServiceStore s = store.getStore().asNeeded();
return DataStorage.get() return DataStorage.get()
.getOrCreateNewSyntheticEntry( .getOrCreateNewSyntheticEntry(
s.getHost().get(), s.getDisplayParent().get(),
"Services", "Services",
FixedServiceGroupStore.builder() FixedServiceGroupStore.builder()
.parent(s.getDisplayParent().get().ref()) .parent(s.getDisplayParent().get().ref())

View file

@ -67,7 +67,6 @@ open module io.xpipe.ext.base {
LaunchStoreAction, LaunchStoreAction,
XPipeUrlAction, XPipeUrlAction,
EditStoreAction, EditStoreAction,
DeleteChildrenStoreAction,
BrowseStoreAction, BrowseStoreAction,
ScanStoreAction; ScanStoreAction;
provides DataStoreProvider with provides DataStoreProvider with