use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage 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);
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project POL-POM-5 by PhoenicisOrg.
the class CreateShortcutPanel method populate.
/**
* populates the panel
*/
public void populate() {
final PseudoClass errorClass = PseudoClass.getPseudoClass("error");
final VBox vBox = new VBox();
GridPane gridPane = new GridPane();
gridPane.getStyleClass().add("grid");
gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
// name
Label nameLabel = new Label(tr("Name:"));
nameLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(nameLabel, VPos.TOP);
gridPane.add(nameLabel, 0, 0);
TextField name = new TextField();
gridPane.add(name, 1, 0);
Tooltip nameErrorTooltip = new Tooltip(tr("Please specify a name!"));
// category
Label categoryLabel = new Label(tr("Category:"));
categoryLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(categoryLabel, VPos.TOP);
gridPane.add(categoryLabel, 0, 1);
TextField category = new TextField();
gridPane.add(category, 1, 1);
Tooltip categoryErrorTooltip = new Tooltip(tr("Please specify a category!"));
// description
Label descriptionLabel = new Label(tr("Description:"));
descriptionLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(descriptionLabel, VPos.TOP);
gridPane.add(descriptionLabel, 0, 2);
TextArea description = new TextArea();
gridPane.add(description, 1, 2);
// miniature
Label miniatureLabel = new Label(tr("Miniature:"));
miniatureLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(miniatureLabel, VPos.TOP);
gridPane.add(miniatureLabel, 0, 3);
TextField miniature = new TextField();
Button openMiniatureBrowser = new Button(tr("Choose"));
openMiniatureBrowser.setOnAction(event -> {
FileChooser chooser = new FileChooser();
chooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(tr("Images"), "*.miniature, *.png"));
File newMiniature = chooser.showOpenDialog(null);
miniature.setText(newMiniature.toString());
});
HBox miniatureHbox = new HBox(miniature, openMiniatureBrowser);
HBox.setHgrow(miniature, Priority.ALWAYS);
gridPane.add(miniatureHbox, 1, 3);
Tooltip miniatureErrorTooltip = new Tooltip(tr("Please specify a valid miniature!"));
// executable
Label executableLabel = new Label(tr("Executable:"));
executableLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(executableLabel, VPos.TOP);
gridPane.add(executableLabel, 0, 4);
TextField executable = new TextField();
Button openExecutableBrowser = new Button(tr("Choose"));
openExecutableBrowser.setOnAction(event -> {
FileChooser chooser = new FileChooser();
File newMiniature = chooser.showOpenDialog(null);
executable.setText(newMiniature.toString());
});
HBox executableHbox = new HBox(executable, openExecutableBrowser);
HBox.setHgrow(executable, Priority.ALWAYS);
gridPane.add(executableHbox, 1, 4);
Tooltip executableErrorTooltip = new Tooltip(tr("Please specify a valid executable!"));
Region spacer = new Region();
spacer.getStyleClass().add("detailsButtonSpacer");
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) {
ShortcutCreationDTO newShortcut = new ShortcutCreationDTO.Builder().withName(name.getText()).withCategory(category.getText()).withDescription(description.getText()).withMiniature(miniatureUri).withExecutable(executableFile).build();
this.onCreateShortcut.accept(newShortcut);
}
});
vBox.getChildren().addAll(gridPane, spacer, createButton);
this.setCenter(vBox);
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project phoenicis by PhoenicisOrg.
the class CreateShortcutPanel method populate.
/**
* populates the panel
*/
public void populate() {
final PseudoClass errorClass = PseudoClass.getPseudoClass("error");
final VBox vBox = new VBox();
GridPane gridPane = new GridPane();
gridPane.getStyleClass().add("grid");
gridPane.getColumnConstraints().addAll(new ColumnConstraintsWithPercentage(30), new ColumnConstraintsWithPercentage(70));
// name
Label nameLabel = new Label(tr("Name:"));
nameLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(nameLabel, VPos.TOP);
gridPane.add(nameLabel, 0, 0);
TextField name = new TextField();
gridPane.add(name, 1, 0);
Tooltip nameErrorTooltip = new Tooltip(tr("Please specify a name!"));
// category
Label categoryLabel = new Label(tr("Category:"));
categoryLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(categoryLabel, VPos.TOP);
gridPane.add(categoryLabel, 0, 1);
TextField category = new TextField();
gridPane.add(category, 1, 1);
Tooltip categoryErrorTooltip = new Tooltip(tr("Please specify a category!"));
// description
Label descriptionLabel = new Label(tr("Description:"));
descriptionLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(descriptionLabel, VPos.TOP);
gridPane.add(descriptionLabel, 0, 2);
TextArea description = new TextArea();
gridPane.add(description, 1, 2);
// miniature
Label miniatureLabel = new Label(tr("Miniature:"));
miniatureLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(miniatureLabel, VPos.TOP);
gridPane.add(miniatureLabel, 0, 3);
TextField miniature = new TextField();
Button openMiniatureBrowser = new Button(tr("Choose"));
openMiniatureBrowser.setOnAction(event -> {
FileChooser chooser = new FileChooser();
chooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(tr("Images"), "*.miniature, *.png"));
File newMiniature = chooser.showOpenDialog(null);
miniature.setText(newMiniature.toString());
});
HBox miniatureHbox = new HBox(miniature, openMiniatureBrowser);
HBox.setHgrow(miniature, Priority.ALWAYS);
gridPane.add(miniatureHbox, 1, 3);
Tooltip miniatureErrorTooltip = new Tooltip(tr("Please specify a valid miniature!"));
// executable
Label executableLabel = new Label(tr("Executable:"));
executableLabel.getStyleClass().add(CAPTION_TITLE_CSS_CLASS);
GridPane.setValignment(executableLabel, VPos.TOP);
gridPane.add(executableLabel, 0, 4);
TextField executable = new TextField();
Button openExecutableBrowser = new Button(tr("Choose"));
openExecutableBrowser.setOnAction(event -> {
FileChooser chooser = new FileChooser();
File newMiniature = chooser.showOpenDialog(null);
executable.setText(newMiniature.toString());
});
HBox executableHbox = new HBox(executable, openExecutableBrowser);
HBox.setHgrow(executable, Priority.ALWAYS);
gridPane.add(executableHbox, 1, 4);
Tooltip executableErrorTooltip = new Tooltip(tr("Please specify a valid executable!"));
Region spacer = new Region();
spacer.getStyleClass().add("detailsButtonSpacer");
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) {
ShortcutCreationDTO newShortcut = new ShortcutCreationDTO.Builder().withName(name.getText()).withCategory(category.getText()).withDescription(description.getText()).withMiniature(miniatureUri).withExecutable(executableFile).build();
this.onCreateShortcut.accept(newShortcut);
}
});
vBox.getChildren().addAll(gridPane, spacer, createButton);
this.setCenter(vBox);
}
use of org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage in project phoenicis 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 ShortcutInformationPanelSkin method createPropertiesGrid.
/**
* Creates a new {@link GridPane} containing the properties of the selected shortcut
*
* @return a new {@link GridPane} containing the properties of the selected shortcut
*/
private GridPane createPropertiesGrid() {
final GridPane propertiesGrid = new GridPane();
propertiesGrid.getStyleClass().add("grid");
ColumnConstraints titleColumn = new ColumnConstraintsWithPercentage(30);
ColumnConstraints valueColumn = new ColumnConstraintsWithPercentage(70);
propertiesGrid.getColumnConstraints().addAll(titleColumn, valueColumn);
// ensure that changes to the shortcutProperties map result in updates to the GridPane
shortcutProperties.addListener((Observable invalidation) -> updateProperties(propertiesGrid));
// initialize the properties grid correctly
updateProperties(propertiesGrid);
return propertiesGrid;
}
Aggregations