Search in sources :

Example 1 with Severity

use of com.faforever.client.notification.Severity in project downlords-faf-client by FAForever.

the class MainController method updateNotificationsButton.

/**
 * Updates the number displayed in the notifications button and sets its CSS pseudo class based on the highest
 * notification {@code Severity} of all current notifications.
 */
private void updateNotificationsButton(Collection<? extends PersistentNotification> notifications) {
    JavaFxUtil.assertApplicationThread();
    int size = notifications.size();
    notificationsBadge.setVisible(size != 0);
    notificationsBadge.setText(i18n.number(size));
    Severity highestSeverity = notifications.stream().map(PersistentNotification::getSeverity).max(Enum::compareTo).orElse(null);
    notificationsBadge.pseudoClassStateChanged(NOTIFICATION_INFO_PSEUDO_CLASS, highestSeverity == Severity.INFO);
    notificationsBadge.pseudoClassStateChanged(NOTIFICATION_WARN_PSEUDO_CLASS, highestSeverity == Severity.WARN);
    notificationsBadge.pseudoClassStateChanged(NOTIFICATION_ERROR_PSEUDO_CLASS, highestSeverity == Severity.ERROR);
}
Also used : Severity(com.faforever.client.notification.Severity) PersistentNotification(com.faforever.client.notification.PersistentNotification)

Aggregations

PersistentNotification (com.faforever.client.notification.PersistentNotification)1 Severity (com.faforever.client.notification.Severity)1