Search in sources :

Example 21 with ErrorDialog

use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PlayOnLinux.

the class ApplicationInformationPanelSkin method updateScripts.

/**
 * Refreshes the shown scripts.
 * When this method is called it begins by clearing the <code>scriptGrid</code>.
 * Afterwards this method refills it.
 */
private void updateScripts(final GridPane scriptGrid) {
    scriptGrid.getChildren().clear();
    for (int i = 0; i < filteredScripts.size(); i++) {
        ScriptDTO script = filteredScripts.get(i);
        final Label scriptName = new Label(script.getScriptName());
        GridPane.setHgrow(scriptName, Priority.ALWAYS);
        if (getControl().isShowScriptSource()) {
            final Tooltip tooltip = new Tooltip(tr("Source: {0}", script.getScriptSource()));
            Tooltip.install(scriptName, tooltip);
        }
        final Button installButton = new Button(tr("Install"));
        installButton.setOnMouseClicked(evt -> {
            try {
                installScript(script);
            } catch (IllegalArgumentException e) {
                final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Error while trying to download the installer")).withException(e).build();
                errorDialog.showAndWait();
            }
        });
        OperatingSystem curOs = new OperatingSystemFetcher().fetchCurrentOperationSystem();
        Label lTesting = new Label();
        if (script.getTestingOperatingSystems().contains(curOs)) {
            lTesting.getStyleClass().add("testingIcon");
            lTesting.setTooltip(new Tooltip(tr("Testing")));
            lTesting.setMinSize(30, 30);
        }
        Label lCommercial = new Label();
        if (!script.isFree()) {
            lCommercial.getStyleClass().add("commercialIcon");
            lCommercial.setTooltip(new Tooltip(tr("Commercial")));
            lCommercial.setMinSize(30, 30);
        }
        Label lPatch = new Label();
        if (script.isRequiresPatch()) {
            lPatch.getStyleClass().add("patchIcon");
            lPatch.setTooltip(new Tooltip(tr("Patch required")));
            lPatch.setMinSize(30, 30);
        }
        Label lOs = new Label();
        if (!script.getCompatibleOperatingSystems().contains(curOs)) {
            lOs.getStyleClass().add("osIcon");
            lOs.setTooltip(new Tooltip(tr("All Operating Systems")));
            lOs.setMinSize(30, 30);
        }
        Label lSpace = new Label();
        lSpace.setPrefSize(30, 30);
        HBox iconBox = new HBox(lTesting, lCommercial, lPatch, lOs, lSpace);
        scriptGrid.addRow(i, scriptName, iconBox, installButton);
    }
}
Also used : OperatingSystem(org.phoenicis.entities.OperatingSystem) ScriptDTO(org.phoenicis.repository.dto.ScriptDTO) OperatingSystemFetcher(org.phoenicis.tools.system.OperatingSystemFetcher) Button(javafx.scene.control.Button) Tooltip(javafx.scene.control.Tooltip) Label(javafx.scene.control.Label) ErrorDialog(org.phoenicis.javafx.dialogs.ErrorDialog)

Example 22 with ErrorDialog

use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PlayOnLinux.

the class MainWindow method createContainersTab.

private Tab createContainersTab(ContainersFeaturePanel containers) {
    final Tab containersTab = new Tab(tr("Containers"), containers);
    containersTab.setClosable(false);
    containersTab.setOnSelectionChanged(event -> containers.getContainersManager().fetchContainers(containerCategories -> Platform.runLater(() -> {
        containers.getCategories().setAll(containerCategories);
        containers.setInitialized(true);
    }), e -> Platform.runLater(() -> {
        final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Loading containers failed.")).withException(e).withOwner(containers.getScene().getWindow()).build();
        errorDialog.showAndWait();
    })));
    return containersTab;
}
Also used : Scene(javafx.scene.Scene) LibraryFeaturePanel(org.phoenicis.javafx.components.library.control.LibraryFeaturePanel) TabIndicator(org.phoenicis.javafx.components.common.control.TabIndicator) IntegerBinding(javafx.beans.binding.IntegerBinding) StringBindings(org.phoenicis.javafx.utils.StringBindings) MappedList(org.phoenicis.javafx.collections.MappedList) Bindings(javafx.beans.binding.Bindings) ErrorDialog(org.phoenicis.javafx.dialogs.ErrorDialog) InstallationDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO) TabPane(javafx.scene.control.TabPane) JavaFXApplication(org.phoenicis.javafx.JavaFXApplication) ContainersFeaturePanel(org.phoenicis.javafx.components.container.control.ContainersFeaturePanel) InstallationsFeaturePanel(org.phoenicis.javafx.components.installation.control.InstallationsFeaturePanel) SettingsView(org.phoenicis.javafx.views.mainwindow.settings.SettingsView) ApplicationsFeaturePanel(org.phoenicis.javafx.components.application.control.ApplicationsFeaturePanel) InstallationCategoryDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) Platform(javafx.application.Platform) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager) Stage(javafx.stage.Stage) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Tab(javafx.scene.control.Tab) ThemeManager(org.phoenicis.javafx.themes.ThemeManager) ConcatenatedList(org.phoenicis.javafx.collections.ConcatenatedList) PhoenicisScene(org.phoenicis.javafx.views.common.PhoenicisScene) Image(javafx.scene.image.Image) EnginesView(org.phoenicis.javafx.views.mainwindow.engines.EnginesView) Tab(javafx.scene.control.Tab) ErrorDialog(org.phoenicis.javafx.dialogs.ErrorDialog)

Example 23 with ErrorDialog

use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PlayOnLinux.

the class LibraryController method showError.

private void showError(Exception e) {
    Platform.runLater(() -> {
        final ErrorDialog errorDialog = ErrorDialog.builder().withOwner(getView().getScene().getWindow()).withException(e).withMessage(tr("Unable to load library, please try again.")).build();
        errorDialog.showAndWait();
    });
}
Also used : ErrorDialog(org.phoenicis.javafx.dialogs.ErrorDialog)

Example 24 with ErrorDialog

use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PhoenicisOrg.

the class MainWindow method createContainersTab.

private Tab createContainersTab(ContainersFeaturePanel containers) {
    final Tab containersTab = new Tab(tr("Containers"), containers);
    containersTab.setClosable(false);
    containersTab.setOnSelectionChanged(event -> containers.getContainersManager().fetchContainers(containerCategories -> Platform.runLater(() -> {
        containers.getCategories().setAll(containerCategories);
        containers.setInitialized(true);
    }), e -> Platform.runLater(() -> {
        final ErrorDialog errorDialog = ErrorDialog.builder().withMessage(tr("Loading containers failed.")).withException(e).withOwner(containers.getScene().getWindow()).build();
        errorDialog.showAndWait();
    })));
    return containersTab;
}
Also used : Scene(javafx.scene.Scene) LibraryFeaturePanel(org.phoenicis.javafx.components.library.control.LibraryFeaturePanel) TabIndicator(org.phoenicis.javafx.components.common.control.TabIndicator) IntegerBinding(javafx.beans.binding.IntegerBinding) StringBindings(org.phoenicis.javafx.utils.StringBindings) MappedList(org.phoenicis.javafx.collections.MappedList) Bindings(javafx.beans.binding.Bindings) ErrorDialog(org.phoenicis.javafx.dialogs.ErrorDialog) InstallationDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO) TabPane(javafx.scene.control.TabPane) JavaFXApplication(org.phoenicis.javafx.JavaFXApplication) ContainersFeaturePanel(org.phoenicis.javafx.components.container.control.ContainersFeaturePanel) InstallationsFeaturePanel(org.phoenicis.javafx.components.installation.control.InstallationsFeaturePanel) SettingsView(org.phoenicis.javafx.views.mainwindow.settings.SettingsView) ApplicationsFeaturePanel(org.phoenicis.javafx.components.application.control.ApplicationsFeaturePanel) InstallationCategoryDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) Platform(javafx.application.Platform) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager) Stage(javafx.stage.Stage) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Tab(javafx.scene.control.Tab) ThemeManager(org.phoenicis.javafx.themes.ThemeManager) ConcatenatedList(org.phoenicis.javafx.collections.ConcatenatedList) PhoenicisScene(org.phoenicis.javafx.views.common.PhoenicisScene) Image(javafx.scene.image.Image) EnginesView(org.phoenicis.javafx.views.mainwindow.engines.EnginesView) Tab(javafx.scene.control.Tab) ErrorDialog(org.phoenicis.javafx.dialogs.ErrorDialog)

Example 25 with ErrorDialog

use of org.phoenicis.javafx.dialogs.ErrorDialog in project POL-POM-5 by PhoenicisOrg.

the class AppsController method showError.

private void showError(Exception e) {
    Platform.runLater(() -> {
        final ErrorDialog errorDialog = ErrorDialog.builder().withOwner(view.getScene().getWindow()).withException(e).withMessage(tr("Connecting to the repository failed.\nPlease check your connection and try again.")).build();
        errorDialog.showAndWait();
    });
}
Also used : ErrorDialog(org.phoenicis.javafx.dialogs.ErrorDialog)

Aggregations

ErrorDialog (org.phoenicis.javafx.dialogs.ErrorDialog)28 Platform (javafx.application.Platform)8 Button (javafx.scene.control.Button)8 Localisation.tr (org.phoenicis.configuration.localisation.Localisation.tr)8 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)6 ContainerDTO (org.phoenicis.containers.dto.ContainerDTO)6 JavaFxSettingsManager (org.phoenicis.javafx.settings.JavaFxSettingsManager)6 File (java.io.File)5 SimpleConfirmDialog (org.phoenicis.javafx.dialogs.SimpleConfirmDialog)5 IOException (java.io.IOException)4 Label (javafx.scene.control.Label)4 Tab (javafx.scene.control.Tab)4 EnginesManager (org.phoenicis.engines.EnginesManager)4 List (java.util.List)3 ObjectProperty (javafx.beans.property.ObjectProperty)3 FXCollections (javafx.collections.FXCollections)3 ObservableList (javafx.collections.ObservableList)3 HBox (javafx.scene.layout.HBox)3 Value (org.graalvm.polyglot.Value)3 FeaturePanel (org.phoenicis.javafx.components.common.control.FeaturePanel)3