Search in sources :

Example 1 with NavigationItem

use of com.faforever.client.main.event.NavigationItem in project downlords-faf-client by FAForever.

the class MainController method onNavigateEvent.

@Subscribe
public void onNavigateEvent(NavigateEvent navigateEvent) {
    NavigationItem item = navigateEvent.getItem();
    AbstractViewController<?> controller = getView(item);
    displayView(controller, navigateEvent);
    mainNavigation.getToggles().stream().filter(toggle -> toggle.getUserData() == navigateEvent.getItem()).findFirst().ifPresent(toggle -> toggle.setSelected(true));
    currentItem = item;
    preferencesService.getPreferences().getMainWindow().setLastView(item.name());
    preferencesService.storeInBackground();
}
Also used : NavigationItem(com.faforever.client.main.event.NavigationItem) Subscribe(com.google.common.eventbus.Subscribe)

Example 2 with NavigationItem

use of com.faforever.client.main.event.NavigationItem 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));
}
Also used : NavigationItem(com.faforever.client.main.event.NavigationItem) WindowPrefs(com.faforever.client.preferences.WindowPrefs) NavigateEvent(com.faforever.client.main.event.NavigateEvent)

Aggregations

NavigationItem (com.faforever.client.main.event.NavigationItem)2 NavigateEvent (com.faforever.client.main.event.NavigateEvent)1 WindowPrefs (com.faforever.client.preferences.WindowPrefs)1 Subscribe (com.google.common.eventbus.Subscribe)1