This commit is contained in:
crschnick 2024-10-31 17:55:04 +00:00
parent 7c40e7384a
commit 52e48b79f8
6 changed files with 23 additions and 23 deletions

View file

@ -313,8 +313,10 @@ public final class BrowserFileListComp extends SimpleComp {
.filter(browserAction -> browserAction.getShortcut().match(event)) .filter(browserAction -> browserAction.getShortcut().match(event))
.findAny(); .findAny();
action.ifPresent(browserAction -> { action.ifPresent(browserAction -> {
// Prevent concurrent modification by creating copy on platform thread
var selectionCopy = new ArrayList<>(selected);
ThreadHelper.runFailableAsync(() -> { ThreadHelper.runFailableAsync(() -> {
browserAction.execute(fileList.getFileSystemModel(), selected); browserAction.execute(fileList.getFileSystemModel(), selectionCopy);
}); });
event.consume(); event.consume();
}); });

View file

@ -122,7 +122,7 @@ public class BrowserSessionComp extends SimpleComp {
AnchorPane.setRightAnchor(struc.get(), 0.0); AnchorPane.setRightAnchor(struc.get(), 0.0);
}) })
.styleClass("tab-loading-indicator"); .styleClass("tab-loading-indicator");
var loadingStack = new AnchorComp(List.of(tabs, loadingIndicator)); var loadingStack = new AnchorComp(List.of(tabs));
var splitPane = new SideSplitPaneComp(vertical, loadingStack) var splitPane = new SideSplitPaneComp(vertical, loadingStack)
.withInitialWidth(AppLayoutModel.get().getSavedState().getBrowserConnectionsWidth()) .withInitialWidth(AppLayoutModel.get().getSavedState().getBrowserConnectionsWidth())
.withOnDividerChange(d -> { .withOnDividerChange(d -> {
@ -148,18 +148,7 @@ public class BrowserSessionComp extends SimpleComp {
} }
}); });
}); });
splitPane.styleClass("browser");
var topBackground = Comp.hspacer().styleClass("top-spacer"); return splitPane.createRegion();
var stack = new StackComp(List.of(topBackground, splitPane));
stack.apply(struc -> {
struc.get().setAlignment(Pos.TOP_CENTER);
var spacer = (Region) struc.get().lookup(".top-spacer");
spacer.prefHeightProperty().bind(tabs.getHeaderHeight());
spacer.minHeightProperty().bind(spacer.prefHeightProperty());
spacer.maxHeightProperty().bind(spacer.prefHeightProperty());
});
var r = stack.createRegion();
r.getStyleClass().add("browser");
return r;
} }
} }

View file

@ -6,6 +6,7 @@ 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;
import io.xpipe.app.fxcomps.impl.PrettyImageHelper; import io.xpipe.app.fxcomps.impl.PrettyImageHelper;
import io.xpipe.app.fxcomps.impl.StackComp;
import io.xpipe.app.fxcomps.impl.TooltipAugment; import io.xpipe.app.fxcomps.impl.TooltipAugment;
import io.xpipe.app.fxcomps.util.LabelGraphic; import io.xpipe.app.fxcomps.util.LabelGraphic;
import io.xpipe.app.fxcomps.util.PlatformThread; import io.xpipe.app.fxcomps.util.PlatformThread;
@ -56,7 +57,18 @@ public class BrowserSessionTabsComp extends SimpleComp {
} }
public Region createSimple() { public Region createSimple() {
return createTabPane(); var tabs = createTabPane();
var topBackground = Comp.hspacer().styleClass("top-spacer").createRegion();
leftPadding.subscribe(number -> {
StackPane.setMargin(topBackground, new Insets(0, 0, 0, -number.doubleValue()));
});
var stack = new StackPane(topBackground, tabs);
stack.setAlignment(Pos.TOP_CENTER);
topBackground.prefHeightProperty().bind(headerHeight);
topBackground.minHeightProperty().bind(topBackground.prefHeightProperty());
topBackground.maxHeightProperty().bind(topBackground.prefHeightProperty());
topBackground.prefWidthProperty().bind(tabs.widthProperty());
return stack;
} }
private TabPane createTabPane() { private TabPane createTabPane() {
@ -69,9 +81,6 @@ public class BrowserSessionTabsComp extends SimpleComp {
Styles.toggleStyleClass(tabs, TabPane.STYLE_CLASS_FLOATING); Styles.toggleStyleClass(tabs, TabPane.STYLE_CLASS_FLOATING);
toggleStyleClass(tabs, DENSE); toggleStyleClass(tabs, DENSE);
var dummy = new Tab();
tabs.getTabs().add(dummy);
tabs.skinProperty().subscribe(newValue -> { tabs.skinProperty().subscribe(newValue -> {
if (newValue != null) { if (newValue != null) {
Platform.runLater(() -> { Platform.runLater(() -> {
@ -100,8 +109,6 @@ public class BrowserSessionTabsComp extends SimpleComp {
.bind(Bindings.createObjectBinding( .bind(Bindings.createObjectBinding(
() -> new Insets(2, 0, 4, -leftPadding.get() + 2), leftPadding)); () -> new Insets(2, 0, 4, -leftPadding.get() + 2), leftPadding));
headerHeight.bind(headerArea.heightProperty()); headerHeight.bind(headerArea.heightProperty());
tabs.getTabs().remove(dummy);
}); });
} }
}); });

View file

@ -60,7 +60,8 @@ public class ShellStoreFormat {
String[] states; String[] states;
public String format() { public String format() {
var lic = licensedFeature != null ? "[" + licensedFeature.getDescriptionSuffix().orElse(null) + "+]" : null; var licenseReq = licensedFeature != null ? licensedFeature.getDescriptionSuffix().orElse(null) : null;
var lic = licenseReq != null ? "[" + licenseReq + "+]" : null;
var name = this.name; var name = this.name;
var state = getStates() != null ? Arrays.stream(getStates()).filter(s -> s != null).map(s -> "[" + s + "]").collect(Collectors.joining(" ")) : null; var state = getStates() != null ? Arrays.stream(getStates()).filter(s -> s != null).map(s -> "[" + s + "]").collect(Collectors.joining(" ")) : null;
if (state != null && state.isEmpty()) { if (state != null && state.isEmpty()) {

View file

@ -232,7 +232,7 @@
-fx-background-insets: 0, 7 0 0 0; -fx-background-insets: 0, 7 0 0 0;
-fx-border-width: 1; -fx-border-width: 1;
-fx-border-color: -color-border-default; -fx-border-color: -color-border-default;
-fx-background-color: -color-foreground-base, -color-foreground-base; -fx-background-color: -color-foreground-base, -color-bg-default;
} }
.browser .browser-content-container { .browser .browser-content-container {

View file

@ -403,3 +403,4 @@ addHypervisor=Add hypervisor
serialConsole=Serial console serialConsole=Serial console
interactiveTerminal=Interactive terminal interactiveTerminal=Interactive terminal
editDomain=Edit domain editDomain=Edit domain
libvirt=libvirt domains