From 8e9a001fde5ef0a727c2db34b2b8dbc781345ab0 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 5 Dec 2025 10:50:48 +0100 Subject: [PATCH] clean up Signed-off-by: Armin Schrenk --- .../notification/NotificationController.java | 49 ++++++++++--------- src/main/resources/fxml/notification.fxml | 4 +- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/notification/NotificationController.java b/src/main/java/org/cryptomator/ui/notification/NotificationController.java index 4cc4d10d1..8b9dd747d 100644 --- a/src/main/java/org/cryptomator/ui/notification/NotificationController.java +++ b/src/main/java/org/cryptomator/ui/notification/NotificationController.java @@ -67,36 +67,41 @@ public class NotificationController implements FxController { @FXML public void handleButtonAction() { - var ev = selectedEvent.get(); - switch (ev) { - default -> { - } //normally nothing - } - //executorService.submit(callback.action()); - int i = selectionIndex.get(); - notificationsProp.remove(i); //remove processed event - - if (notificationsProp.isEmpty()) { - close(); //no more events - } else if (notificationsProp.size() == i) { - i = i - 1; - selectionIndex.set(i); //triggers event update - } else { - selectedEvent.set(notificationsProp.get(i)); + try { + var ev = selectedEvent.get(); + switch (ev) { + //TODO: executorService.submit(callback.action()); + default -> { + } //normally nothing + } + } finally { + //remove processed event + int i = selectionIndex.get(); + notificationsProp.remove(i); + if (notificationsProp.isEmpty()) { + close(); //no more events + } else if (notificationsProp.size() == i) { + i = i - 1; + selectionIndex.set(i); //triggers event update + } else { + selectedEvent.set(notificationsProp.get(i)); + } } } - @FXML void previousNotification() { + @FXML + public void previousNotification() { int i = selectionIndex.get(); - if( i != 0) { - selectionIndex.set(i-1); + if (i != 0) { + selectionIndex.set(i - 1); } } - @FXML void nextNotification() { + @FXML + public void nextNotification() { int i = selectionIndex.get(); - if(i != notificationsProp.size() - 1){ - selectionIndex.set(i+1); + if (i != notificationsProp.size() - 1) { + selectionIndex.set(i + 1); } } diff --git a/src/main/resources/fxml/notification.fxml b/src/main/resources/fxml/notification.fxml index ab82b5755..cd65d3579 100644 --- a/src/main/resources/fxml/notification.fxml +++ b/src/main/resources/fxml/notification.fxml @@ -16,7 +16,7 @@ prefHeight="200.0" prefWidth="300.0" maxHeight="300.0" maxWidth="400.0" styleClass="notification-window"> - + @@ -34,7 +34,7 @@
- +