Small browser appearance improvements

This commit is contained in:
crschnick 2024-01-17 20:58:33 +00:00
parent ff2e5e67c4
commit aa7c04d5ba
7 changed files with 45 additions and 14 deletions

View file

@ -39,6 +39,7 @@ public class BrowserBreadcrumbBar extends SimpleComp {
Callback<Breadcrumbs.BreadCrumbItem<String>, ? extends Node> dividerFactory) {
var breadcrumbs = new Breadcrumbs<String>();
breadcrumbs.setMinWidth(0);
SimpleChangeListener.apply(PlatformThread.sync(model.getCurrentPath()), val -> {
if (val == null) {
breadcrumbs.setSelectedCrumb(null);

View file

@ -114,12 +114,12 @@ public class BrowserComp extends SimpleComp {
});
var spacer = new Spacer(Orientation.HORIZONTAL);
var button = new Button("Select");
button.setPadding(new Insets(5, 10, 5, 10));
button.setOnAction(event -> model.finishChooser());
button.setDefaultButton(true);
var bottomBar = new HBox(selectedLabel, selected, spacer, button);
HBox.setHgrow(selected, Priority.ALWAYS);
bottomBar.setAlignment(Pos.CENTER);
bottomBar.setPadding(new Insets(15));
bottomBar.getStyleClass().add("chooser-bar");
var layout = new VBox(r, bottomBar);

View file

@ -66,6 +66,10 @@ public class BrowserFilterComp extends Comp<BrowserFilterComp.Structure> {
}
});
var box = new HBox(text, button);
box.getStyleClass().add("browser-filter");
box.setAlignment(Pos.CENTER);
text.setPrefWidth(0);
text.setFocusTraversable(false);
button.getStyleClass().add(Styles.FLAT);
@ -84,9 +88,6 @@ public class BrowserFilterComp extends Comp<BrowserFilterComp.Structure> {
}
});
button.prefHeightProperty().bind(text.heightProperty());
var box = new HBox(text, button);
box.setAlignment(Pos.CENTER);
return new Structure(box, (TextField) text, button);
}

View file

@ -115,13 +115,16 @@ public class BrowserNavBar extends SimpleComp {
.augment(new SimpleCompStructure<>(historyButton));
var breadcrumbs = new BrowserBreadcrumbBar(model).grow(false, true);
var stack = new StackComp(List.of(pathBar, breadcrumbs))
.apply(struc -> struc.get().setAlignment(Pos.CENTER_LEFT))
.hgrow()
.apply(struc -> {
var t = struc.get().getChildren().get(0);
var b = struc.get().getChildren().get(1);
b.setOnMouseClicked(event -> {
t.requestFocus();
event.consume();
});
b.visibleProperty()
.bind(Bindings.createBooleanBinding(
() -> {

View file

@ -12,13 +12,14 @@ import io.xpipe.app.fxcomps.impl.VerticalComp;
import io.xpipe.app.fxcomps.util.BindingsHelper;
import io.xpipe.app.fxcomps.util.Shortcuts;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.MenuButton;
import javafx.scene.control.ToolBar;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyCombination;
import javafx.scene.input.MouseButton;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
@ -62,14 +63,17 @@ public class OpenFileSystemComp extends SimpleComp {
var filter = new BrowserFilterComp(model, model.getFilter()).createStructure();
Shortcuts.addShortcut(filter.toggleButton(), new KeyCodeCombination(KeyCode.F, KeyCombination.SHORTCUT_DOWN));
var topBar = new ToolBar();
topBar.getItems()
var topBar = new HBox();
topBar.setAlignment(Pos.CENTER);
topBar.getStyleClass().add("top-bar");
topBar.getChildren()
.setAll(
overview,
backBtn,
forthBtn,
new Spacer(10),
new BrowserNavBar(model).createRegion(),
new BrowserNavBar(model).hgrow().createRegion(),
new Spacer(5),
filter.get(),
refreshBtn,
terminalBtn,

View file

@ -45,7 +45,7 @@ public class StandaloneFileBrowser {
var comp = new BrowserComp(model)
.apply(struc -> struc.get().setPrefSize(1200, 700))
.apply(struc -> AppFont.normal(struc.get()));
var window = AppWindowHelper.sideWindow(AppI18n.get("openFileTitle"), stage -> comp, true, null);
var window = AppWindowHelper.sideWindow(AppI18n.get("openFileTitle"), stage -> comp, false, null);
model.setOnFinish(fileStores -> {
file.accept(fileStores.size() > 0 ? fileStores.get(0) : null);
window.close();

View file

@ -115,12 +115,34 @@
-fx-shape: null;
}
.browser .tool-bar {
.browser .top-bar {
-fx-border-width: 1 0 1 0;
-fx-border-color: -color-border-default;
-fx-border-color: -color-border-default;
-fx-padding: 5px 10px ;
}
.browser .top-bar > .button {
-fx-background-insets: 0;
-fx-background-color: 0;
}
.browser .top-bar > .menu-button {
-fx-background-insets: 0;
-fx-background-color: 0;
}
.browser .top-bar > .button:hover {
-fx-background-color: -color-accent-subtle;
}
.browser .top-bar > .menu-button:hover {
-fx-background-color: -color-accent-subtle;
}
.browser .top-bar .browser-filter .button:hover {
-fx-background-color: -color-accent-subtle;
}
.browser .status-bar {
-fx-border-width: 1 0 0 0;
-fx-border-color: -color-border-default;
@ -198,8 +220,8 @@
.chooser-bar {
-fx-border-color: -color-border-default;
-fx-border-width: 0.1em 0 0 0;
-fx-padding: 1em;
-fx-border-width: 1 0 0 0;
-fx-padding: 0.4em 0.7em;
-fx-background-color: -color-neutral-muted;
}