From bebe3064ee154437aedaf2f8fb6beb02e623df31 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 12 Dec 2025 11:21:39 +0100 Subject: [PATCH] hide paging if there is only one event --- .../notification/NotificationController.java | 14 ++++++++-- src/main/resources/fxml/notification.fxml | 26 +++++++++++-------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/notification/NotificationController.java b/src/main/java/org/cryptomator/ui/notification/NotificationController.java index d538409bd..0fc24621c 100644 --- a/src/main/java/org/cryptomator/ui/notification/NotificationController.java +++ b/src/main/java/org/cryptomator/ui/notification/NotificationController.java @@ -13,7 +13,6 @@ import javafx.beans.property.SimpleListProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; -import javafx.beans.value.ObservableBooleanValue; import javafx.beans.value.ObservableStringValue; import javafx.beans.value.ObservableValue; import javafx.fxml.FXML; @@ -31,6 +30,7 @@ public class NotificationController implements FxController { private final IntegerProperty selectionIndex; private final ObservableStringValue paging; private final ObjectProperty selectedEvent; + private final ObservableValue singleEvent; private final StringProperty vaultName; private final StringProperty message; private final StringProperty description; @@ -43,6 +43,7 @@ public class NotificationController implements FxController { this.events = new SimpleListProperty<>(notificationManager.getEventsRequiringNotification()); this.selectionIndex = new SimpleIntegerProperty(-1); this.selectedEvent = new SimpleObjectProperty<>(); + this.singleEvent = events.sizeProperty().map(size -> size.intValue() == 1); this.paging = Bindings.createStringBinding(() -> selectionIndex.get() + 1 + "/" + events.size(), selectionIndex, events); this.vaultName = new SimpleStringProperty(); this.message = new SimpleStringProperty(); @@ -104,7 +105,7 @@ public class NotificationController implements FxController { if (events.isEmpty()) { close(); //no more events } else if (events.size() == i) { - selectionIndex.set(i-1); //triggers event update + selectionIndex.set(i - 1); //triggers event update } else { selectedEvent.set(events.get(i)); } @@ -141,6 +142,7 @@ public class NotificationController implements FxController { public String getVaultName() { return vaultName.get(); } + public ObservableValue messageProperty() { return message; } @@ -173,4 +175,12 @@ public class NotificationController implements FxController { return paging.get(); } + public ObservableValue singleEventProperty() { + return singleEvent; + } + + public boolean isSingleEvent() { + return singleEvent.getValue(); + } + } diff --git a/src/main/resources/fxml/notification.fxml b/src/main/resources/fxml/notification.fxml index 2b0b9431b..4a38afd3b 100644 --- a/src/main/resources/fxml/notification.fxml +++ b/src/main/resources/fxml/notification.fxml @@ -27,17 +27,19 @@