Small fixes

This commit is contained in:
crschnick 2024-06-21 01:07:48 +00:00
parent 33302fb75d
commit 5e90f169b1
5 changed files with 20 additions and 13 deletions

View file

@ -115,6 +115,7 @@ public class BrowserChooserComp extends SimpleComp {
var splitPane = new SideSplitPaneComp(bookmarksList, stack) var splitPane = new SideSplitPaneComp(bookmarksList, stack)
.withInitialWidth(AppLayoutModel.get().getSavedState().getBrowserConnectionsWidth()) .withInitialWidth(AppLayoutModel.get().getSavedState().getBrowserConnectionsWidth())
.withOnDividerChange(AppLayoutModel.get().getSavedState()::setBrowserConnectionsWidth) .withOnDividerChange(AppLayoutModel.get().getSavedState()::setBrowserConnectionsWidth)
.styleClass("background")
.apply(struc -> { .apply(struc -> {
struc.getLeft().setMinWidth(200); struc.getLeft().setMinWidth(200);
struc.getLeft().setMaxWidth(500); struc.getLeft().setMaxWidth(500);

View file

@ -71,6 +71,10 @@ public class StoreSection {
var explicitOrderComp = Comparator.<StoreSection>comparingInt(new ToIntFunction<>() { var explicitOrderComp = Comparator.<StoreSection>comparingInt(new ToIntFunction<>() {
@Override @Override
public int applyAsInt(StoreSection value) { public int applyAsInt(StoreSection value) {
if (!value.getWrapper().getEntry().getValidity().isUsable()) {
return 1;
}
var explicit = value.getWrapper().getEntry().getExplicitOrder(); var explicit = value.getWrapper().getEntry().getExplicitOrder();
if (explicit == null) { if (explicit == null) {
return 0; return 0;
@ -82,20 +86,22 @@ public class StoreSection {
}; };
} }
}); });
var usableComp = Comparator.<StoreSection>comparingInt( var comp = explicitOrderComp;
value -> value.getWrapper().getEntry().getValidity().isUsable() ? -1 : 1);
var comp = explicitOrderComp.thenComparing(usableComp);
var mappedSortMode = BindingsHelper.flatMap( var mappedSortMode = BindingsHelper.flatMap(
category, category,
storeCategoryWrapper -> storeCategoryWrapper != null ? storeCategoryWrapper.getSortMode() : null); storeCategoryWrapper -> storeCategoryWrapper != null ? storeCategoryWrapper.getSortMode() : null);
return list.sorted( return list.sorted(
(o1, o2) -> { (o1, o2) -> {
var r = comp.compare(o1, o2);
if (r != 0) {
return r;
}
var current = mappedSortMode.getValue(); var current = mappedSortMode.getValue();
if (current != null) { if (current != null) {
return comp.thenComparing(current.comparator()) return current.comparator().compare(current.representative(o1), current.representative(o2));
.compare(current.representative(o1), current.representative(o2));
} else { } else {
return comp.compare(o1, o2); return 0;
} }
}, },
mappedSortMode, mappedSortMode,

View file

@ -145,7 +145,7 @@ public class StoreSectionMiniComp extends Comp<CompStructure<VBox>> {
.hgrow(); .hgrow();
list.add(new HorizontalComp(List.of(content)) list.add(new HorizontalComp(List.of(content))
.styleClass("content") .styleClass("children-content")
.apply(struc -> struc.get().setFillHeight(true)) .apply(struc -> struc.get().setFillHeight(true))
.hide(Bindings.or( .hide(Bindings.or(
Bindings.not(expanded), Bindings.not(expanded),

View file

@ -1,4 +1,4 @@
.store-mini-list-comp > * > * > .content { .store-mini-list-comp > * > * > .children-content {
-fx-spacing: 0.5em; -fx-spacing: 0.5em;
} }
@ -65,15 +65,15 @@
-fx-border-insets: 0px; -fx-border-insets: 0px;
} }
.store-section-mini-comp > .content { .store-section-mini-comp > .children-content {
-fx-padding: 5px 0 5px 15px; -fx-padding: 5px 0 5px 15px;
} }
.store-section-mini-comp:root > .content { .store-section-mini-comp:root > .children-content {
-fx-padding: 0.5em 1em 0.5em 1em; -fx-padding: 0.5em 1em 0.5em 1em;
} }
.store-section-mini-comp.condensed:root > .content { .store-section-mini-comp.condensed:root > .children-content {
-fx-padding: 0; -fx-padding: 0;
} }
@ -118,7 +118,7 @@
-fx-border-color: -color-border-default; -fx-border-color: -color-border-default;
} }
.store-section-mini-comp .list-box-view-comp .content { .store-section-mini-comp .list-box-view-comp .children-content {
-fx-spacing: 0.4em; -fx-spacing: 0.4em;
} }

View file

@ -1,3 +1,3 @@
.toggle-switch-comp:hover > .thumb-area, .root:key-navigation .toggle-switch-comp:focused > .thumb-area { .toggle-switch-comp:hover > .thumb-area, .root:key-navigation .toggle-switch-comp:focused > .thumb-area {
-fx-background-color: -color-neutral-muted; -fx-background-color: -color-neutral-emphasis;
} }