use of com.faforever.client.main.event.NavigateEvent in project downlords-faf-client by FAForever.
the class MainController method restoreLastView.
private void restoreLastView() {
final NavigationItem navigationItem;
if (preferencesService.getPreferences().getRememberLastTab()) {
final WindowPrefs mainWindowPrefs = preferencesService.getPreferences().getMainWindow();
navigationItem = Optional.ofNullable(NavigationItem.fromString(mainWindowPrefs.getLastView())).orElse(NavigationItem.NEWS);
} else {
navigationItem = NavigationItem.NEWS;
}
eventBus.post(new NavigateEvent(navigationItem));
}
use of com.faforever.client.main.event.NavigateEvent in project downlords-faf-client by FAForever.
the class LeaderboardController method onDisplay.
@Override
public void onDisplay(NavigateEvent navigateEvent) {
Assert.checkNullIllegalState(ratingType, "ratingType must not be null");
contentPane.setVisible(false);
leaderboardService.getEntries(ratingType).thenAccept(leaderboardEntryBeans -> {
ratingTable.setItems(observableList(leaderboardEntryBeans));
contentPane.setVisible(true);
}).exceptionally(throwable -> {
contentPane.setVisible(false);
logger.warn("Error while loading leaderboard entries", throwable);
notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("leaderboard.failedToLoad"), Severity.ERROR, throwable, Arrays.asList(new ReportAction(i18n, reportingService, throwable), new DismissAction(i18n))));
return null;
});
}
use of com.faforever.client.main.event.NavigateEvent in project downlords-faf-client by FAForever.
the class AbstractChatTabController method showNotificationIfNecessary.
protected void showNotificationIfNecessary(ChatMessage chatMessage) {
Stage stage = StageHolder.getStage();
if (stage.isFocused() && stage.isShowing()) {
return;
}
Player player = playerService.getPlayerForUsername(chatMessage.getUsername());
String identiconSource = player != null ? String.valueOf(player.getId()) : chatMessage.getUsername();
notificationService.addNotification(new TransientNotification(chatMessage.getUsername(), chatMessage.getMessage(), IdenticonUtil.createIdenticon(identiconSource), event -> {
eventBus.post(new NavigateEvent(NavigationItem.CHAT));
stage.toFront();
getRoot().getTabPane().getSelectionModel().select(getRoot());
}));
}
use of com.faforever.client.main.event.NavigateEvent in project downlords-faf-client by FAForever.
the class FriendOnlineNotifier method onUserOnline.
@Subscribe
public void onUserOnline(UserOnlineEvent event) {
String username = event.getUsername();
Player player = playerService.getPlayerForUsername(username);
if (player != null && player.getSocialStatus() == SocialStatus.FRIEND) {
audioService.playFriendOnlineSound();
notificationService.addNotification(new TransientNotification(i18n.get("friend.nowOnlineNotification.title", username), i18n.get("friend.nowOnlineNotification.action"), IdenticonUtil.createIdenticon(player.getId()), actionEvent -> {
eventBus.post(new NavigateEvent(NavigationItem.CHAT));
eventBus.post(new InitiatePrivateChatEvent(username));
}));
}
}
Aggregations