Search in sources :

Example 1 with ErrorMessage

use of org.phoenicis.javafx.views.common.ErrorMessage in project POL-POM-5 by PlayOnLinux.

the class WinePrefixContainerDisplayTab method changeSettings.

private void changeSettings(RegistryParameter newValue) {
    this.lockAll();
    winePrefixContainerController.changeSetting(container, newValue, this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage(tr("Error"), e).show()));
}
Also used : ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage)

Example 2 with ErrorMessage

use of org.phoenicis.javafx.views.common.ErrorMessage in project POL-POM-5 by PlayOnLinux.

the class AppPanel method refreshScripts.

/**
     * Refreshes the shown scripts.
     * When this method is called it begins by clearing the <code>scriptGrid</code>.
     * Afterwards this method refills it.
     */
private void refreshScripts() {
    scriptGrid.getChildren().clear();
    for (int i = 0; i < filteredScripts.size(); i++) {
        ScriptDTO script = filteredScripts.get(i);
        Label scriptName = new Label(script.getScriptName());
        if (settingsManager.isViewScriptSource()) {
            final Tooltip tooltip = new Tooltip(tr("Source: {0}", script.getScriptSource()));
            Tooltip.install(scriptName, tooltip);
        }
        Button installButton = new Button(tr("Install"));
        installButton.setOnMouseClicked(evt -> {
            try {
                onScriptInstall.accept(script);
            } catch (IllegalArgumentException e) {
                LOGGER.error("Failed to get script", e);
                new ErrorMessage(tr("Error while trying to download the installer"), e).show();
            }
        });
        scriptGrid.addRow(i, scriptName, installButton);
        GridPane.setHgrow(scriptName, Priority.ALWAYS);
    }
}
Also used : ScriptDTO(org.phoenicis.repository.dto.ScriptDTO) Button(javafx.scene.control.Button) Tooltip(javafx.scene.control.Tooltip) Label(javafx.scene.control.Label) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage)

Example 3 with ErrorMessage

use of org.phoenicis.javafx.views.common.ErrorMessage in project POL-POM-5 by PlayOnLinux.

the class WinePrefixContainerToolsTab method populate.

private void populate() {
    final VBox toolsPane = new VBox();
    final Text title = new TextWithStyle(tr("Tools"), TITLE_CSS_CLASS);
    toolsPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    toolsPane.getChildren().add(title);
    final GridPane toolsContentPane = new GridPane();
    toolsContentPane.getStyleClass().add("grid");
    Button openTerminal = new Button(tr("Open a terminal"));
    openTerminal.getStyleClass().addAll("wineToolButton", "openTerminal");
    openTerminal.setOnMouseClicked(e -> {
        this.lockAll();
        winePrefixContainerController.openTerminalInPrefix(container);
        this.unlockAll();
    });
    GridPane.setHalignment(openTerminal, HPos.CENTER);
    this.lockableElements.add(openTerminal);
    toolsContentPane.add(openTerminal, 0, 0);
    toolsContentPane.add(wineToolCaption(tr("Open a terminal")), 0, 1);
    Button createShortcut = new Button();
    createShortcut.getStyleClass().addAll("wineToolButton", "openTerminal");
    createShortcut.setOnMouseClicked(event -> {
        this.lockAll();
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle(tr("Choose executable"));
        File file = fileChooser.showOpenDialog(this.getContent().getScene().getWindow());
        if (file != null) {
            winePrefixContainerController.createShortcut(container, file.getName(), file.getName(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
        }
        this.unlockAll();
    });
    GridPane.setHalignment(createShortcut, HPos.CENTER);
    this.lockableElements.add(createShortcut);
    toolsContentPane.add(createShortcut, 1, 0);
    toolsContentPane.add(wineToolCaption(tr("Create shortcut")), 1, 1);
    Button runExecutable = new Button();
    runExecutable.getStyleClass().addAll("wineToolButton", "runExecutable");
    runExecutable.setOnMouseClicked(event -> {
        this.lockAll();
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle(tr("Choose executable"));
        File file = fileChooser.showOpenDialog(this.getContent().getScene().getWindow());
        if (file != null) {
            winePrefixContainerController.runInPrefix(container, file.getAbsolutePath(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
        }
    });
    GridPane.setHalignment(runExecutable, HPos.CENTER);
    this.lockableElements.add(runExecutable);
    toolsContentPane.add(runExecutable, 2, 0);
    toolsContentPane.add(wineToolCaption(tr("Run executable")), 2, 1);
    toolsPane.getChildren().addAll(toolsContentPane);
    toolsContentPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25));
    this.setContent(toolsPane);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) GridPane(javafx.scene.layout.GridPane) Button(javafx.scene.control.Button) FileChooser(javafx.stage.FileChooser) Text(javafx.scene.text.Text) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage) VBox(javafx.scene.layout.VBox) File(java.io.File)

Example 4 with ErrorMessage

use of org.phoenicis.javafx.views.common.ErrorMessage in project POL-POM-5 by PlayOnLinux.

the class WinePrefixContainerWineToolsTab method populate.

private void populate() {
    final VBox toolsPane = new VBox();
    final Text title = new TextWithStyle(tr("Wine tools"), TITLE_CSS_CLASS);
    toolsPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    toolsPane.getChildren().add(title);
    final GridPane toolsContentPane = new GridPane();
    toolsContentPane.getStyleClass().add("grid");
    Button configureWine = new Button(tr("Configure Wine"));
    configureWine.getStyleClass().addAll("wineToolButton", "configureWine");
    configureWine.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "winecfg", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(configureWine, HPos.CENTER);
    Button registryEditor = new Button(tr("Registry Editor"));
    registryEditor.getStyleClass().addAll("wineToolButton", "registryEditor");
    registryEditor.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "regedit", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(registryEditor, HPos.CENTER);
    Button rebootWindows = new Button(tr("Windows reboot"));
    rebootWindows.getStyleClass().addAll("wineToolButton", "rebootWindows");
    rebootWindows.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "wineboot", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(rebootWindows, HPos.CENTER);
    Button repairVirtualDrive = new Button(tr("Repair virtual drive"));
    repairVirtualDrive.getStyleClass().addAll("wineToolButton", "repairVirtualDrive");
    repairVirtualDrive.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.repairPrefix(container, this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(repairVirtualDrive, HPos.CENTER);
    Button commandPrompt = new Button(tr("Command prompt"));
    commandPrompt.getStyleClass().addAll("wineToolButton", "commandPrompt");
    commandPrompt.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "wineconsole", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(commandPrompt, HPos.CENTER);
    Button taskManager = new Button(tr("Task manager"));
    taskManager.getStyleClass().addAll("wineToolButton", "taskManager");
    taskManager.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "taskmgr", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(taskManager, HPos.CENTER);
    Button killProcesses = new Button(tr("Kill processes"));
    killProcesses.getStyleClass().addAll("wineToolButton", "killProcesses");
    killProcesses.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.killProcesses(container, this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(killProcesses, HPos.CENTER);
    Button uninstallWine = new Button(tr("Wine uninstaller"));
    uninstallWine.getStyleClass().addAll("wineToolButton", "uninstallWine");
    uninstallWine.setOnMouseClicked(event -> {
        this.lockAll();
        winePrefixContainerController.runInPrefix(container, "uninstaller", this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
    });
    GridPane.setHalignment(uninstallWine, HPos.CENTER);
    this.lockableElements.addAll(Arrays.asList(configureWine, registryEditor, rebootWindows, repairVirtualDrive, commandPrompt, taskManager, uninstallWine));
    toolsContentPane.add(configureWine, 0, 0);
    toolsContentPane.add(wineToolCaption(tr("Configure Wine")), 0, 1);
    toolsContentPane.add(registryEditor, 1, 0);
    toolsContentPane.add(wineToolCaption(tr("Registry Editor")), 1, 1);
    toolsContentPane.add(rebootWindows, 2, 0);
    toolsContentPane.add(wineToolCaption(tr("Windows reboot")), 2, 1);
    toolsContentPane.add(repairVirtualDrive, 3, 0);
    toolsContentPane.add(wineToolCaption(tr("Repair virtual drive")), 3, 1);
    toolsContentPane.add(commandPrompt, 0, 3);
    toolsContentPane.add(wineToolCaption(tr("Command prompt")), 0, 4);
    toolsContentPane.add(taskManager, 1, 3);
    toolsContentPane.add(wineToolCaption(tr("Task manager")), 1, 4);
    toolsContentPane.add(killProcesses, 2, 3);
    toolsContentPane.add(wineToolCaption(tr("Kill processes")), 2, 4);
    toolsContentPane.add(uninstallWine, 3, 3);
    toolsContentPane.add(wineToolCaption(tr("Wine uninstaller")), 3, 4);
    toolsPane.getChildren().addAll(toolsContentPane);
    toolsContentPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25), new ColumnConstraintsWithPercentage(25));
    this.setContent(toolsPane);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) GridPane(javafx.scene.layout.GridPane) Button(javafx.scene.control.Button) Text(javafx.scene.text.Text) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage) VBox(javafx.scene.layout.VBox)

Example 5 with ErrorMessage

use of org.phoenicis.javafx.views.common.ErrorMessage in project POL-POM-5 by PlayOnLinux.

the class EnginePanel method populateContent.

private void populateContent() {
    final GridPane informationContentPane = new GridPane();
    informationContentPane.getStyleClass().add("grid");
    informationContentPane.add(new TextWithStyle(tr("Version:"), CAPTION_TITLE_CSS_CLASS), 0, 0);
    Label name = new Label(engineDTO.getVersion());
    name.setWrapText(true);
    informationContentPane.add(name, 1, 0);
    int rowIdx = 1;
    for (Map.Entry<String, String> userData : engineDTO.getUserData().entrySet()) {
        informationContentPane.add(new TextWithStyle(userData.getKey(), CAPTION_TITLE_CSS_CLASS), 0, rowIdx);
        Label path = new Label(userData.getValue());
        path.setWrapText(true);
        informationContentPane.add(path, 1, rowIdx);
        rowIdx++;
    }
    informationContentPane.setHgap(20);
    informationContentPane.setVgap(10);
    Button installButton = new Button(tr("Install"));
    installButton.setOnMouseClicked(evt -> {
        try {
            onEngineInstall.accept(engineDTO);
        } catch (IllegalArgumentException e) {
            LOGGER.error("Failed to get engine", e);
            new ErrorMessage(tr("Error while trying to install the engine"), e).show();
        }
    });
    Button deleteButton = new Button(tr("Delete"));
    deleteButton.setOnMouseClicked(evt -> {
        try {
            onEngineDelete.accept(engineDTO);
        } catch (IllegalArgumentException e) {
            LOGGER.error("Failed to get engine", e);
            new ErrorMessage(tr("Error while trying to delete the engine"), e).show();
        }
    });
    Region spacer = new Region();
    spacer.setPrefHeight(30);
    VBox.setVgrow(spacer, Priority.NEVER);
    HBox buttonBox = new HBox();
    buttonBox.setSpacing(10);
    buttonBox.getChildren().addAll(installButton, deleteButton);
    Region progressSpacer = new Region();
    progressSpacer.setPrefHeight(30);
    VBox.setVgrow(progressSpacer, Priority.NEVER);
    this.setCenter(new VBox(informationContentPane, spacer, buttonBox, progressSpacer));
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) Label(javafx.scene.control.Label) Button(javafx.scene.control.Button) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage) Map(java.util.Map)

Aggregations

ErrorMessage (org.phoenicis.javafx.views.common.ErrorMessage)5 Button (javafx.scene.control.Button)4 TextWithStyle (org.phoenicis.javafx.views.common.TextWithStyle)3 Label (javafx.scene.control.Label)2 GridPane (javafx.scene.layout.GridPane)2 VBox (javafx.scene.layout.VBox)2 Text (javafx.scene.text.Text)2 ColumnConstraintsWithPercentage (org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage)2 File (java.io.File)1 Map (java.util.Map)1 Tooltip (javafx.scene.control.Tooltip)1 FileChooser (javafx.stage.FileChooser)1 ScriptDTO (org.phoenicis.repository.dto.ScriptDTO)1