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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations