Skip to content

Commit

Permalink
[prmr#524] Fixed the JetUML taskbar window flashing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthusWQZ committed Feb 14, 2024

Verified

This commit was signed with the committer’s verified signature.
folke Folke Lemaitre
1 parent 29f4b50 commit 5d22587
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 10 additions & 1 deletion src/org/jetuml/gui/NotificationService.java
Original file line number Diff line number Diff line change
@@ -48,6 +48,10 @@ public final class NotificationService
*/
private Stage aMainStage;
private final List<Notification> aNotifications = new ArrayList<>();
// Dead notifications are notifications that reached the end of their lifespan and should be
// removed. We store them in a separate list so that we can close them all at once when
// the window is maximized, to prevent having the JetUML taskbar window flashing. - See Issue #524
private final List<Notification> aDeadNotifications = new ArrayList<>();

private NotificationService() {}

@@ -120,10 +124,15 @@ public void spawnNotification(Notification pNotification)
{
return;
}
aDeadNotifications.forEach(Notification::close);
aDeadNotifications.clear();

aNotifications.add(pNotification);

pNotification.show(() -> aNotifications.remove(pNotification));
pNotification.show(() -> {
aNotifications.remove(pNotification);
aDeadNotifications.add(pNotification);
});
updateNotificationPosition();
}

5 changes: 1 addition & 4 deletions src/org/jetuml/gui/ToastNotification.java
Original file line number Diff line number Diff line change
@@ -144,10 +144,7 @@ public void show(Runnable pCleanUpCallback)

fadeOutTimeline.getKeyFrames().add(fadeOutKey);
// We close the stage and execute the callback at the end of the fadeout animation
fadeOutTimeline.setOnFinished(actionEvent1 -> {
aStage.close();
pCleanUpCallback.run();
});
fadeOutTimeline.setOnFinished(actionEvent1 -> pCleanUpCallback.run());

Timer notificationTimer = new Timer();
TimerTask lifespan = new TimerTask()

0 comments on commit 5d22587

Please sign in to comment.