use of com.faforever.client.notification.TransientNotificationsController in project downlords-faf-client by FAForever.
the class MainController method initialize.
public void initialize() {
newsButton.setUserData(NavigationItem.NEWS);
chatButton.setUserData(NavigationItem.CHAT);
playButton.setUserData(NavigationItem.PLAY);
vaultButton.setUserData(NavigationItem.VAULT);
leaderboardsButton.setUserData(NavigationItem.LEADERBOARD);
unitsButton.setUserData(NavigationItem.UNITS);
eventBus.register(this);
windowController = uiService.loadFxml("theme/window.fxml");
PersistentNotificationsController persistentNotificationsController = uiService.loadFxml("theme/persistent_notifications.fxml");
persistentNotificationsPopup = new Popup();
persistentNotificationsPopup.getContent().setAll(persistentNotificationsController.getRoot());
persistentNotificationsPopup.setAnchorLocation(AnchorLocation.CONTENT_TOP_RIGHT);
persistentNotificationsPopup.setAutoFix(true);
persistentNotificationsPopup.setAutoHide(true);
TransientNotificationsController transientNotificationsController = uiService.loadFxml("theme/transient_notifications.fxml");
transientNotificationsPopup = new Popup();
transientNotificationsPopup.setAutoFix(true);
transientNotificationsPopup.getScene().getRoot().getStyleClass().add("transient-notification");
transientNotificationsPopup.getContent().setAll(transientNotificationsController.getRoot());
transientNotificationsController.getRoot().getChildren().addListener(new ToastDisplayer(transientNotificationsController));
updateNotificationsButton(Collections.emptyList());
notificationService.addPersistentNotificationListener(change -> runLater(() -> updateNotificationsButton(change.getSet())));
notificationService.addImmediateNotificationListener(notification -> runLater(() -> displayImmediateNotification(notification)));
notificationService.addTransientNotificationListener(notification -> runLater(() -> transientNotificationsController.addNotification(notification)));
gameService.addOnRankedMatchNotificationListener(this::onMatchmakerMessage);
// Always load chat immediately so messages or joined channels don't need to be cached until we display them.
getView(NavigationItem.CHAT);
}
Aggregations