Search in sources :

Example 11 with ColumnConstraintsWithPercentage

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

the class WinePrefixContainerInputTab method populate.

private void populate() {
    final VBox inputPane = new VBox();
    final Text title = new TextWithStyle(tr("Input settings"), TITLE_CSS_CLASS);
    inputPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    inputPane.getChildren().add(title);
    final GridPane inputContentPane = new GridPane();
    inputContentPane.getStyleClass().add("grid");
    final ComboBox<MouseWarpOverride> mouseWarpOverrideComboBox = new ComboBox<>();
    mouseWarpOverrideComboBox.setValue(container.getMouseWarpOverride());
    addItems(mouseWarpOverrideComboBox, MouseWarpOverride.class);
    inputContentPane.add(new TextWithStyle(tr("Mouse Warp Override"), CAPTION_TITLE_CSS_CLASS), 0, 0);
    inputContentPane.add(mouseWarpOverrideComboBox, 1, 0);
    inputContentPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
    inputPane.getChildren().addAll(inputContentPane);
    this.setContent(inputPane);
    lockableElements.add(mouseWarpOverrideComboBox);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) GridPane(javafx.scene.layout.GridPane) ComboBox(javafx.scene.control.ComboBox) MouseWarpOverride(org.phoenicis.containers.wine.parameters.MouseWarpOverride) Text(javafx.scene.text.Text) VBox(javafx.scene.layout.VBox)

Example 12 with ColumnConstraintsWithPercentage

use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage 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 13 with ColumnConstraintsWithPercentage

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

the class LibraryPanel method setShortcutDTO.

public void setShortcutDTO(ShortcutDTO shortcutDTO) {
    this.setTitle(shortcutDTO.getName());
    this.getChildren().clear();
    final VBox vBox = new VBox();
    Label description = new Label(shortcutDTO.getDescription());
    description.setWrapText(true);
    final GridPane gridPane = new GridPane();
    gridPane.getStyleClass().add("grid");
    try {
        LOGGER.info("Reading shortcut: {}", shortcutDTO.getScript());
        final Map<String, Object> shortcutProperties = objectMapper.readValue(shortcutDTO.getScript(), new TypeReference<Map<String, Object>>() {
        });
        int i = 0;
        for (String shortcutKey : shortcutProperties.keySet()) {
            final Label keyLabel = new Label(tr(unCamelize(shortcutKey)) + ":");
            keyLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
            GridPane.setValignment(keyLabel, VPos.TOP);
            gridPane.add(keyLabel, 0, i);
            final Label valueLabel = new Label(shortcutProperties.get(shortcutKey).toString());
            valueLabel.setWrapText(true);
            gridPane.add(valueLabel, 1, i);
            i++;
        }
    } catch (IOException e) {
        LOGGER.warn("Could not parse shortcut script JSON", e);
    }
    gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
    Region spacer = new Region();
    spacer.setPrefHeight(40);
    HBox buttons = new HBox();
    buttons.setAlignment(Pos.CENTER);
    Button runButton = new Button(tr("Run"));
    runButton.getStyleClass().addAll("shortcutButton", "runButton");
    runButton.setOnMouseClicked(event -> onShortcutRun.accept(shortcutDTO));
    Button stopButton = new Button(tr("Close"));
    stopButton.getStyleClass().addAll("shortcutButton", "stopButton");
    stopButton.setOnMouseClicked(event -> onShortcutStop.accept(shortcutDTO));
    Button uninstallButton = new Button(tr("Uninstall"));
    uninstallButton.getStyleClass().addAll("shortcutButton", "uninstallButton");
    uninstallButton.setOnMouseClicked(event -> onShortcutUninstall.accept(shortcutDTO));
    buttons.getChildren().addAll(runButton, stopButton, uninstallButton);
    vBox.getChildren().addAll(description, gridPane, spacer, buttons);
    this.setCenter(vBox);
}
Also used : HBox(javafx.scene.layout.HBox) GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) IOException(java.io.IOException) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) Button(javafx.scene.control.Button) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox) Map(java.util.Map)

Example 14 with ColumnConstraintsWithPercentage

use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PhoenicisOrg.

the class WinePrefixContainerInputTab method populate.

private void populate() {
    final VBox inputPane = new VBox();
    final Text title = new TextWithStyle(tr("Input settings"), TITLE_CSS_CLASS);
    inputPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    inputPane.getChildren().add(title);
    final GridPane inputContentPane = new GridPane();
    inputContentPane.getStyleClass().add("grid");
    final ComboBox<MouseWarpOverride> mouseWarpOverrideComboBox = new ComboBox<>();
    mouseWarpOverrideComboBox.setValue(container.getMouseWarpOverride());
    addItems(mouseWarpOverrideComboBox, MouseWarpOverride.class);
    inputContentPane.add(new TextWithStyle(tr("Mouse Warp Override"), CAPTION_TITLE_CSS_CLASS), 0, 0);
    inputContentPane.add(mouseWarpOverrideComboBox, 1, 0);
    inputContentPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
    inputPane.getChildren().addAll(inputContentPane);
    this.setContent(inputPane);
    lockableElements.add(mouseWarpOverrideComboBox);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) GridPane(javafx.scene.layout.GridPane) MouseWarpOverride(org.phoenicis.containers.wine.parameters.MouseWarpOverride) ComboBox(javafx.scene.control.ComboBox) Text(javafx.scene.text.Text) VBox(javafx.scene.layout.VBox)

Example 15 with ColumnConstraintsWithPercentage

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

the class ShortcutCreationPanelSkin method initialise.

/**
 * {@inheritDoc}
 */
@Override
public void initialise() {
    final GridPane gridPane = new GridPane();
    gridPane.getStyleClass().add("shortcut-information-grid");
    ColumnConstraints labelConstraints = new ColumnConstraintsWithPercentage(30);
    ColumnConstraints valueConstraints = new ColumnConstraintsWithPercentage(70);
    gridPane.getColumnConstraints().addAll(labelConstraints, valueConstraints);
    // add name input
    final TextField name = addName(gridPane);
    final Tooltip nameErrorTooltip = new Tooltip(tr("Please specify a name!"));
    // add category input
    final TextField category = addCategory(gridPane);
    final Tooltip categoryErrorTooltip = new Tooltip(tr("Please specify a category!"));
    // add description input
    final TextArea description = addDescription(gridPane);
    // add miniature input
    final TextField miniature = addMiniature(gridPane);
    final Tooltip miniatureErrorTooltip = new Tooltip(tr("Please specify a valid miniature!"));
    // add executable input
    final TextField executable = addExecutable(gridPane);
    final Tooltip executableErrorTooltip = new Tooltip(tr("Please specify a valid executable!"));
    // add create button
    final Button createButton = new Button(tr("Create"));
    createButton.setOnMouseClicked(event -> {
        boolean error = false;
        if (StringUtils.isEmpty(name.getText())) {
            name.pseudoClassStateChanged(errorClass, true);
            name.setTooltip(nameErrorTooltip);
            error = true;
        }
        if (StringUtils.isEmpty(category.getText())) {
            category.pseudoClassStateChanged(errorClass, true);
            category.setTooltip(categoryErrorTooltip);
            error = true;
        }
        URI miniatureUri = null;
        // but if a miniature is given, it must exist
        if (StringUtils.isNotEmpty(miniature.getText())) {
            File miniatureFile = new File(miniature.getText());
            if (miniatureFile.exists()) {
                miniatureUri = miniatureFile.toURI();
            } else {
                miniature.pseudoClassStateChanged(errorClass, true);
                miniature.setTooltip(miniatureErrorTooltip);
                error = true;
            }
        }
        File executableFile = new File(executable.getText());
        if (!executableFile.exists()) {
            executable.pseudoClassStateChanged(errorClass, true);
            executable.setTooltip(executableErrorTooltip);
            error = true;
        }
        if (!error) {
            final ShortcutCreationDTO newShortcut = new ShortcutCreationDTO.Builder().withName(name.getText()).withCategory(category.getText()).withDescription(description.getText()).withMiniature(miniatureUri).withExecutable(executableFile).build();
            getControl().getOnCreateShortcut().accept(newShortcut);
        }
    });
    final VBox container = new VBox(gridPane, createButton);
    container.getStyleClass().addAll("library-details-panel-content", "create-shortcut-panel-content");
    getChildren().setAll(container);
}
Also used : ShortcutCreationDTO(org.phoenicis.library.dto.ShortcutCreationDTO) URI(java.net.URI) ColumnConstraintsWithPercentage(org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage) File(java.io.File)

Aggregations

ColumnConstraintsWithPercentage (org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage)18 GridPane (javafx.scene.layout.GridPane)14 ColumnConstraints (javafx.scene.layout.ColumnConstraints)8 VBox (javafx.scene.layout.VBox)8 Label (javafx.scene.control.Label)7 File (java.io.File)5 Button (javafx.scene.control.Button)5 Text (javafx.scene.text.Text)5 TextWithStyle (org.phoenicis.javafx.views.common.TextWithStyle)5 URI (java.net.URI)4 ArrayList (java.util.ArrayList)4 Observable (javafx.beans.Observable)4 ShortcutCreationDTO (org.phoenicis.library.dto.ShortcutCreationDTO)4 IOException (java.io.IOException)3 Map (java.util.Map)3 ComboBox (javafx.scene.control.ComboBox)3 Region (javafx.scene.layout.Region)3 FileChooser (javafx.stage.FileChooser)3 MouseWarpOverride (org.phoenicis.containers.wine.parameters.MouseWarpOverride)3 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2