Browser style fixes

This commit is contained in:
crschnick 2024-05-11 13:17:36 +00:00
parent 37eb17ef0d
commit 2d38d62428
5 changed files with 44 additions and 10 deletions

View file

@ -33,6 +33,7 @@ public class BrowserFilterComp extends Comp<BrowserFilterComp.Structure> {
var expanded = new SimpleBooleanProperty();
var text = new TextFieldComp(filterString, false).createStructure().get();
var button = new Button();
button.minWidthProperty().bind(button.heightProperty());
button.setFocusTraversable(true);
InputHelper.onExactKeyCode(text, KeyCode.ESCAPE, true, keyEvent -> {
text.clear();

View file

@ -108,6 +108,7 @@ public class BrowserNavBar extends Comp<BrowserNavBar.Structure> {
var breadcrumbs = new BrowserBreadcrumbBar(model).grow(false, true);
var pathRegion = pathBar.createStructure().get();
homeButton.maxWidthProperty().bind(pathRegion.heightProperty());
var breadcrumbsRegion = breadcrumbs.createRegion();
breadcrumbsRegion.setOnMouseClicked(event -> {
pathRegion.requestFocus();
@ -127,14 +128,15 @@ public class BrowserNavBar extends Comp<BrowserNavBar.Structure> {
HBox.setHgrow(stack, Priority.ALWAYS);
var topBox = new HBox(homeButton, stack, historyButton);
homeButton.minHeightProperty().bind(stack.heightProperty());
homeButton.maxHeightProperty().bind(stack.heightProperty());
historyButton.minHeightProperty().bind(stack.heightProperty());
historyButton.maxHeightProperty().bind(stack.heightProperty());
topBox.setAlignment(Pos.CENTER);
homeButton.minHeightProperty().bind(pathRegion.heightProperty());
homeButton.maxHeightProperty().bind(pathRegion.heightProperty());
historyButton.minHeightProperty().bind(pathRegion.heightProperty());
historyButton.maxHeightProperty().bind(pathRegion.heightProperty());
topBox.setPickOnBounds(false);
HBox.setHgrow(topBox, Priority.ALWAYS);
return new Structure(topBox,pathRegion, historyButton);
return new Structure(topBox, pathRegion, historyButton);
}
public record Structure(HBox box, TextField textField, Button historyButton) implements CompStructure<HBox> {

View file

@ -68,8 +68,7 @@ public class OpenFileSystemComp extends SimpleComp {
// Don't handle key events for this button, we also have that available as a menu item
var terminalBtn = BrowserAction.byId("openTerminal", model, List.of()).toButton(new Region(), model, List.of());
var menuButton = new MenuButton(null, new FontIcon
("mdral-folder_open"));
var menuButton = new MenuButton(null, new FontIcon("mdral-folder_open"));
new ContextMenuAugment<>(
event -> event.getButton() == MouseButton.PRIMARY,
null,
@ -96,6 +95,12 @@ public class OpenFileSystemComp extends SimpleComp {
refreshBtn,
terminalBtn,
menuButton);
squaredSize(navBar.get(),overview,true);
squaredSize(navBar.get(),backBtn,true);
squaredSize(navBar.get(),forthBtn,true);
squaredSize(navBar.get(),refreshBtn,true);
squaredSize(navBar.get(),terminalBtn,true);
squaredSize(navBar.get(),menuButton,false);
var content = createFileListContent();
root.getChildren().addAll(topBar, content);
@ -129,6 +134,17 @@ public class OpenFileSystemComp extends SimpleComp {
return root;
}
private void squaredSize(Region ref, Region toResize, boolean width) {
if (width) {
toResize.minWidthProperty().bind(ref.heightProperty());
}
toResize.minHeightProperty().bind(ref.heightProperty());
if (width) {
toResize.maxWidthProperty().bind(ref.heightProperty());
}
toResize.maxHeightProperty().bind(ref.heightProperty());
}
private Region createFileListContent() {
var directoryView = new BrowserFileListComp(model.getFileList())
.apply(struc -> VBox.setVgrow(struc.get(), Priority.ALWAYS));

View file

@ -66,15 +66,16 @@
.browser .top-bar {
-fx-border-width: 1 0 1 0;
-fx-border-color: -color-border-default;
-fx-padding: 5px 10px;
-fx-padding: 9px 6px;
}
.browser .top-bar > .button {
.browser .top-bar > .button, .browser .browser-filter > .button {
-fx-background-insets: 0;
-fx-background-color: transparent;
}
.browser .top-bar > .menu-button {
-fx-padding: 0;
-fx-background-insets: 0;
-fx-background-color: transparent;
}
@ -125,6 +126,10 @@
-fx-background-color: -color-neutral-muted;
}
.browser .path-text, .browser .browser-filter .text-field {
-fx-padding: 6 12;
}
.browser .path-text:invisible {
-fx-text-fill: transparent;
}
@ -168,6 +173,15 @@
-fx-border-width: 0;
}
.table-view .column-header {
-fx-pref-height: 2em;
}
.table-view .column-header-background .label {
-fx-font-size: 0.9em;
-fx-font-weight: SEMIBOLD;
}
.browser .table-row-cell:empty {
-fx-opacity: 0.7;
}

View file

@ -1,8 +1,9 @@
/* For development
*:focused {
-fx-border-width: 1;
-fx-border-color: red;
}
*/
.store-layout .split-pane-divider {
-fx-background-color: transparent;