Search in sources :

Example 6 with ImmediateNotification

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

the class MapVaultController method onLoadMoreButtonClicked.

public void onLoadMoreButtonClicked() {
    moreButton.setVisible(false);
    loadingLabel.setVisible(true);
    currentSupplier.get().thenAccept(maps -> {
        appendSearchResult(maps, searchResultPane);
        enterSearchResultState();
    }).exceptionally(e -> {
        notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("vault.replays.searchError"), Severity.ERROR, e, Collections.singletonList(new DismissAction(i18n))));
        enterShowroomState();
        return null;
    });
}
Also used : Button(javafx.scene.control.Button) StageStyle(javafx.stage.StageStyle) UiService(com.faforever.client.theme.UiService) LoggerFactory(org.slf4j.LoggerFactory) NavigateEvent(com.faforever.client.main.event.NavigateEvent) WindowController(com.faforever.client.fx.WindowController) ScrollPane(javafx.scene.control.ScrollPane) Path(java.nio.file.Path) SearchableProperties(com.faforever.client.query.SearchableProperties) Pane(javafx.scene.layout.Pane) MethodHandles(java.lang.invoke.MethodHandles) AbstractViewController(com.faforever.client.fx.AbstractViewController) DismissAction(com.faforever.client.notification.DismissAction) Collectors(java.util.stream.Collectors) Platform(javafx.application.Platform) List(java.util.List) FlowPane(javafx.scene.layout.FlowPane) AnchorPane(javafx.scene.layout.AnchorPane) ObservableList(javafx.collections.ObservableList) PreferencesService(com.faforever.client.preferences.PreferencesService) SearchController(com.faforever.client.vault.search.SearchController) SearchConfig(com.faforever.client.vault.search.SearchController.SearchConfig) MapUploadedEvent(com.faforever.client.map.event.MapUploadedEvent) CompletableFuture(java.util.concurrent.CompletableFuture) Supplier(java.util.function.Supplier) Iterators(com.google.common.collect.Iterators) Scope(org.springframework.context.annotation.Scope) EventBus(com.google.common.eventbus.EventBus) Inject(javax.inject.Inject) NotificationService(com.faforever.client.notification.NotificationService) Subscribe(com.google.common.eventbus.Subscribe) DirectoryChooser(javafx.stage.DirectoryChooser) SortConfig(com.faforever.client.vault.search.SearchController.SortConfig) ObjectProperty(javafx.beans.property.ObjectProperty) Modality(javafx.stage.Modality) Logger(org.slf4j.Logger) JavaFxUtil(com.faforever.client.fx.JavaFxUtil) Node(javafx.scene.Node) CLOSE(com.faforever.client.fx.WindowController.WindowButtonType.CLOSE) ShowLadderMapsEvent(com.faforever.client.main.event.ShowLadderMapsEvent) File(java.io.File) Component(org.springframework.stereotype.Component) Stage(javafx.stage.Stage) Severity(com.faforever.client.notification.Severity) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) ImmediateNotification(com.faforever.client.notification.ImmediateNotification) I18n(com.faforever.client.i18n.I18n) ConfigurableBeanFactory(org.springframework.beans.factory.config.ConfigurableBeanFactory) Collections(java.util.Collections) ImmediateNotification(com.faforever.client.notification.ImmediateNotification) DismissAction(com.faforever.client.notification.DismissAction)

Example 7 with ImmediateNotification

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

the class ModDetailController method onUninstallButtonClicked.

public void onUninstallButtonClicked() {
    progressBar.progressProperty().unbind();
    progressBar.setProgress(-1);
    uninstallButton.setVisible(false);
    modService.uninstallMod(modVersion).exceptionally(throwable -> {
        notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("modVault.couldNotDeleteMod", modVersion.getDisplayName(), throwable.getLocalizedMessage()), Severity.ERROR, throwable, singletonList(new ReportAction(i18n, reportingService, throwable))));
        return null;
    });
}
Also used : ImmediateNotification(com.faforever.client.notification.ImmediateNotification) ReportAction(com.faforever.client.notification.ReportAction)

Example 8 with ImmediateNotification

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

the class MapDetailController method onUninstallButtonClicked.

public void onUninstallButtonClicked() {
    progressBar.progressProperty().unbind();
    progressBar.setProgress(-1);
    uninstallButton.setVisible(false);
    mapService.uninstallMap(map).thenRun(() -> setInstalled(false)).exceptionally(throwable -> {
        notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("mapVault.couldNotDeleteMap", map.getDisplayName(), throwable.getLocalizedMessage()), Severity.ERROR, throwable, singletonList(new ReportAction(i18n, reportingService, throwable))));
        setInstalled(true);
        return null;
    });
}
Also used : ImmediateNotification(com.faforever.client.notification.ImmediateNotification) ReportAction(com.faforever.client.notification.ReportAction)

Example 9 with ImmediateNotification

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

the class ModVaultController method displayModsFromSupplier.

private void displayModsFromSupplier(Supplier<CompletableFuture<List<ModVersion>>> modsSupplier) {
    this.currentSupplier = modsSupplier;
    modsSupplier.get().thenAccept(this::displayMods).exceptionally(e -> {
        notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("vault.replays.searchError"), Severity.ERROR, e, Collections.singletonList(new DismissAction(i18n))));
        enterShowroomState();
        return null;
    });
}
Also used : ImmediateNotification(com.faforever.client.notification.ImmediateNotification) DismissAction(com.faforever.client.notification.DismissAction)

Example 10 with ImmediateNotification

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

the class ModVaultController method onRefreshButtonClicked.

public void onRefreshButtonClicked() {
    modService.evictCache();
    switch(state) {
        case SHOWROOM:
            displayShowroomMods();
            break;
        case SEARCH_RESULT:
            currentPage--;
            currentSupplier.get().thenAccept(this::displayMods).exceptionally(e -> {
                notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("vault.mods.searchError"), Severity.ERROR, e, Collections.singletonList(new DismissAction(i18n))));
                enterShowroomState();
                return null;
            });
            break;
        default:
    }
}
Also used : ImmediateNotification(com.faforever.client.notification.ImmediateNotification) DismissAction(com.faforever.client.notification.DismissAction)

Aggregations

ImmediateNotification (com.faforever.client.notification.ImmediateNotification)22 DismissAction (com.faforever.client.notification.DismissAction)12 ReportAction (com.faforever.client.notification.ReportAction)12 I18n (com.faforever.client.i18n.I18n)7 NotificationService (com.faforever.client.notification.NotificationService)7 Severity (com.faforever.client.notification.Severity)7 EventBus (com.google.common.eventbus.EventBus)6 MethodHandles (java.lang.invoke.MethodHandles)6 Path (java.nio.file.Path)6 Inject (javax.inject.Inject)6 Logger (org.slf4j.Logger)6 LoggerFactory (org.slf4j.LoggerFactory)6 PreferencesService (com.faforever.client.preferences.PreferencesService)5 List (java.util.List)5 Component (org.springframework.stereotype.Component)5 JavaFxUtil (com.faforever.client.fx.JavaFxUtil)4 NavigateEvent (com.faforever.client.main.event.NavigateEvent)4 Action (com.faforever.client.notification.Action)4 Subscribe (com.google.common.eventbus.Subscribe)4 IOException (java.io.IOException)4