From 7cfb63ed488896588b94b88d8b9a1fef59790dba Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Wed, 10 Dec 2025 12:34:09 +0100 Subject: [PATCH] cleanup in NotificationController --- .../notification/NotificationController.java | 36 ++++++++----------- src/main/resources/fxml/notification.fxml | 7 ++-- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/notification/NotificationController.java b/src/main/java/org/cryptomator/ui/notification/NotificationController.java index 47a807070..156227e4f 100644 --- a/src/main/java/org/cryptomator/ui/notification/NotificationController.java +++ b/src/main/java/org/cryptomator/ui/notification/NotificationController.java @@ -81,7 +81,7 @@ public class NotificationController implements FxController { @FXML - public void processEvent() { + public void processSelectedEvent() { try { var ev = selectedEvent.get(); switch (ev.actualEvent()) { @@ -90,17 +90,19 @@ public class NotificationController implements FxController { } //normally nothing } } finally { - //remove processed event - int i = selectionIndex.get(); - events.remove(i); - if (events.isEmpty()) { - close(); //no more events - } else if (events.size() == i) { - i = i - 1; - selectionIndex.set(i); //triggers event update - } else { - selectedEvent.set(events.get(i)); - } + removeSelectedEvent(); + } + } + + private void removeSelectedEvent() { + int i = selectionIndex.get(); + events.remove(i); + if (events.isEmpty()) { + close(); //no more events + } else if (events.size() == i) { + selectionIndex.set(i-1); //triggers event update + } else { + selectedEvent.set(events.get(i)); } } @@ -144,7 +146,7 @@ public class NotificationController implements FxController { return description.get(); } - public ObservableValue actionTextProperty() { + public StringProperty actionTextProperty() { return actionText; } @@ -152,14 +154,6 @@ public class NotificationController implements FxController { return Objects.requireNonNullElse(actionText.get(), ""); } - public ObservableBooleanValue buttonVisibleProperty() { - return actionText.isEmpty().not(); - } - - public boolean isButtonVisible() { - return actionText.get() != null && !actionText.get().isBlank(); - } - public ObservableStringValue pagingProperty() { return paging; } diff --git a/src/main/resources/fxml/notification.fxml b/src/main/resources/fxml/notification.fxml index 646441e56..b21524d94 100644 --- a/src/main/resources/fxml/notification.fxml +++ b/src/main/resources/fxml/notification.fxml @@ -13,7 +13,7 @@ @@ -35,15 +35,14 @@
-
-