Small fixes [stage]

This commit is contained in:
crschnick 2025-04-10 09:37:29 +00:00
parent ed87bbd0c5
commit b5f55fea57
7 changed files with 52 additions and 12 deletions

View file

@ -11,7 +11,9 @@ import io.xpipe.core.process.OsType;
import javafx.animation.*;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.Property;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.value.ObservableDoubleValue;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
@ -183,19 +185,35 @@ public class ModalOverlayComp extends SimpleComp {
}
if (newValue.getButtons().size() > 0) {
var max = new SimpleDoubleProperty();
var buttonBar = new HBox();
buttonBar.getStyleClass().add("button-bar");
buttonBar.setSpacing(10);
buttonBar.setAlignment(Pos.CENTER_RIGHT);
for (var o : newValue.getButtons()) {
var node = o instanceof ModalButton mb ? toButton(mb) : ((Comp<?>) o).createRegion();
if (o instanceof ModalButton) {
node.widthProperty().addListener((observable, oldValue, n) -> {
var d = Math.min(Math.max(n.doubleValue(), 70.0), 200.0);
if (d > max.get()) {
max.set(d);
}
});
}
node.minWidthProperty().bind(max);
buttonBar.getChildren().add(node);
if (o instanceof ModalButton) {
node.prefHeightProperty().bind(buttonBar.heightProperty());
}
}
content.getChildren().add(buttonBar);
AppFontSizes.base(buttonBar);
AppFontSizes.apply(buttonBar, sizes -> {
if (sizes.getBase().equals("10.5")) {
return sizes.getBase();
} else {
return sizes.getSm();
}
});
}
var modalBox = new ModalBox(pane, content) {

View file

@ -123,7 +123,7 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
.getAccentColor()
.desaturate()
.desaturate();
return new Background(new BackgroundFill(c, new CornerRadii(8), new Insets(14, 1, 14, 2)));
return new Background(new BackgroundFill(c, new CornerRadii(8), new Insets(16, 1, 14, 2)));
},
Platform.getPreferences().accentColorProperty());
var hoverBorder = Bindings.createObjectBinding(
@ -133,7 +133,7 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
.darker()
.desaturate()
.desaturate();
return new Background(new BackgroundFill(c, new CornerRadii(8), new Insets(14, 1, 14, 2)));
return new Background(new BackgroundFill(c, new CornerRadii(8), new Insets(16, 1, 14, 2)));
},
Platform.getPreferences().accentColorProperty());
var noneBorder = Bindings.createObjectBinding(
@ -147,7 +147,9 @@ public class SideMenuBarComp extends Comp<CompStructure<VBox>> {
new StackComp(List.of(indicator, b)).apply(struc -> struc.get().setAlignment(Pos.CENTER_RIGHT));
stack.apply(struc -> {
var indicatorRegion = (Region) struc.get().getChildren().getFirst();
var buttonRegion = (Region) struc.get().getChildren().get(1);
indicatorRegion.setMaxWidth(7);
indicatorRegion.prefHeightProperty().bind(buttonRegion.heightProperty());
indicatorRegion
.backgroundProperty()
.bind(Bindings.createObjectBinding(

View file

@ -96,6 +96,11 @@ public class StoreChoiceComp<T extends DataStore> extends SimpleComp {
&& (applicableCheck == null || applicableCheck.test(e.ref()));
};
var applicableMatch = StoreViewState.get().getCurrentTopLevelSection().anyMatches(applicable);
if (!applicableMatch) {
selectedCategory.set(initialCategory);
}
var applicableCount = StoreViewState.get().getAllEntries().getList().stream()
.filter(applicable)
.count();

View file

@ -7,8 +7,10 @@ import io.xpipe.app.util.*;
import javafx.beans.property.*;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Insets;
import javafx.scene.control.*;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
@ -76,7 +78,13 @@ public class StoreCreationComp extends ModalOverlayContentComp {
var sp = new ScrollPane(valSp);
sp.setFitToWidth(true);
layout.setCenter(sp);
var sep = new Separator();
sep.setPadding(new Insets(0, 0, 0, 0));
var vbox = new VBox(sp, sep);
VBox.setVgrow(sp, Priority.ALWAYS);
layout.setCenter(vbox);
model.getValidator()
.setValue(new ChainedValidator(List.of(
@ -89,7 +97,7 @@ public class StoreCreationComp extends ModalOverlayContentComp {
});
var sep = new Separator();
sep.getStyleClass().add("spacer");
sep.setPadding(new Insets(10, 0, 0, 0));
var top = new VBox(providerChoice.createRegion(), sep);
top.getStyleClass().add("top");
if (showProviders) {

View file

@ -4,8 +4,10 @@ import io.xpipe.app.comp.base.PrettyImageHelper;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.ext.DataStoreCreationCategory;
import io.xpipe.app.ext.DataStoreProviders;
import io.xpipe.app.util.PlatformThread;
import io.xpipe.app.util.ScanDialog;
import javafx.application.Platform;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuButton;
import javafx.scene.control.MenuItem;
@ -85,11 +87,16 @@ public class StoreCreationMenu {
return;
}
StoreCreationDialog.showCreation(
defaultProvider != null
? DataStoreProviders.byId(defaultProvider).orElseThrow()
: null,
category);
Platform.runLater(() -> {
StoreCreationDialog.showCreation(
defaultProvider != null
? DataStoreProviders.byId(defaultProvider).orElseThrow()
: null,
category);
});
// Fix weird JavaFX NPE
menu.hide();
event.consume();
});

View file

@ -279,7 +279,7 @@ public class StoreSection {
public boolean anyMatches(Predicate<StoreEntryWrapper> c) {
return c == null
|| c.test(wrapper)
|| (wrapper != null && c.test(wrapper))
|| allChildren.getList().stream().anyMatch(storeEntrySection -> storeEntrySection.anyMatches(c));
}
}

View file

@ -1 +1 @@
16.0-22
16.0-23