use of org.phoenicis.javafx.views.common.TextWithStyle 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.TextWithStyle in project POL-POM-5 by PlayOnLinux.
the class WinePrefixContainerWineToolsTab method wineToolCaption.
private Text wineToolCaption(String caption) {
final Text text = new TextWithStyle(caption, "wineToolCaption");
GridPane.setHalignment(text, HPos.CENTER);
GridPane.setValignment(text, VPos.CENTER);
lockableElements.add(text);
return text;
}
use of org.phoenicis.javafx.views.common.TextWithStyle in project POL-POM-5 by PhoenicisOrg.
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++;
}
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.getStyleClass().add("engineSpacer");
VBox.setVgrow(spacer, Priority.NEVER);
HBox buttonBox = new HBox();
buttonBox.getStyleClass().add("engineButtons");
buttonBox.getChildren().addAll(installButton, deleteButton);
Region progressSpacer = new Region();
progressSpacer.getStyleClass().add("engineSpacer");
VBox.setVgrow(progressSpacer, Priority.NEVER);
this.setCenter(new VBox(informationContentPane, spacer, buttonBox, progressSpacer));
}
use of org.phoenicis.javafx.views.common.TextWithStyle in project phoenicis by PhoenicisOrg.
the class RepositoriesPanel method populateRepositoryGrid.
private void populateRepositoryGrid() {
this.title = new TextWithStyle(tr("Repositories Settings"), "title");
this.repositoryGrid = new GridPane();
this.repositoryGrid.getStyleClass().add("grid");
this.repositoryText = new TextWithStyle(tr("Repository:"), "captionTitle");
this.repositoryLayout = new VBox();
this.repositoryLayout.setSpacing(5);
this.repositoryListView = new ListView<>(repositories);
this.repositoryListView.setPrefHeight(0);
this.repositoryListView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
this.repositoryListView.setEditable(true);
this.repositoryListView.setCellFactory(param -> new DragableRepositoryListCell((repositoryUrl, toIndex) -> {
this.repositoryManager.moveRepository(repositoryUrl, toIndex.intValue());
this.save();
}));
this.repositoryButtonLayout = new HBox();
this.repositoryButtonLayout.setSpacing(5);
this.addButton = new Button();
this.addButton.setText(tr("Add"));
this.addButton.setOnAction((ActionEvent event) -> {
AddRepositoryDialog dialog = new AddRepositoryDialog();
dialog.initOwner(this.getParent().getScene().getWindow());
Optional<RepositoryLocation<? extends Repository>> successResult = dialog.showAndWait();
successResult.ifPresent(repositoryLocation -> {
repositories.add(repositoryLocation);
this.save();
repositoryManager.addRepositories(0, repositoryLocation);
});
});
this.removeButton = new Button();
this.removeButton.setText(tr("Remove"));
this.removeButton.setOnAction((ActionEvent event) -> {
RepositoryLocation<? extends Repository>[] toRemove = repositoryListView.getSelectionModel().getSelectedItems().toArray(new RepositoryLocation[0]);
repositories.removeAll(toRemove);
this.save();
repositoryManager.removeRepositories(toRemove);
});
this.repositoryButtonLayout.getChildren().addAll(addButton, removeButton);
this.repositoryLayout.getChildren().addAll(repositoryListView, repositoryButtonLayout);
VBox.setVgrow(repositoryListView, Priority.ALWAYS);
this.repositoryGrid.add(repositoryText, 0, 0);
this.repositoryGrid.add(repositoryLayout, 1, 0);
GridPane.setHgrow(repositoryLayout, Priority.ALWAYS);
GridPane.setVgrow(repositoryLayout, Priority.ALWAYS);
GridPane.setValignment(repositoryText, VPos.TOP);
}
use of org.phoenicis.javafx.views.common.TextWithStyle in project phoenicis by PhoenicisOrg.
the class WinePrefixContainerDisplayTab method populate.
private void populate() {
final VBox displayPane = new VBox();
final Text title = new TextWithStyle(tr("Display settings"), TITLE_CSS_CLASS);
displayPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
displayPane.getChildren().add(title);
final GridPane displayContentPane = new GridPane();
displayContentPane.getStyleClass().add("grid");
final ComboBox<UseGLSL> glslComboBox = new ComboBox<>();
glslComboBox.setMaxWidth(Double.MAX_VALUE);
glslComboBox.setValue(container.getUseGlslValue());
glslComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(glslComboBox, UseGLSL.class);
displayContentPane.add(new TextWithStyle(tr("GLSL support"), CAPTION_TITLE_CSS_CLASS), 0, 0);
displayContentPane.add(glslComboBox, 1, 0);
final ComboBox<DirectDrawRenderer> directDrawRendererComboBox = new ComboBox<>();
directDrawRendererComboBox.setMaxWidth(Double.MAX_VALUE);
directDrawRendererComboBox.setValue(container.getDirectDrawRenderer());
directDrawRendererComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(directDrawRendererComboBox, DirectDrawRenderer.class);
displayContentPane.add(new TextWithStyle(tr("Direct Draw Renderer"), CAPTION_TITLE_CSS_CLASS), 0, 1);
displayContentPane.add(directDrawRendererComboBox, 1, 1);
final ComboBox<VideoMemorySize> videoMemorySizeComboBox = new ComboBox<>();
videoMemorySizeComboBox.setMaxWidth(Double.MAX_VALUE);
videoMemorySizeComboBox.setValue(container.getVideoMemorySize());
videoMemorySizeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItemsVideoMemorySize(videoMemorySizeComboBox);
displayContentPane.add(new TextWithStyle(tr("Video memory size"), CAPTION_TITLE_CSS_CLASS), 0, 2);
displayContentPane.add(videoMemorySizeComboBox, 1, 2);
final ComboBox<OffscreenRenderingMode> offscreenRenderingModeComboBox = new ComboBox<>();
offscreenRenderingModeComboBox.setMaxWidth(Double.MAX_VALUE);
offscreenRenderingModeComboBox.setValue(container.getOffscreenRenderingMode());
offscreenRenderingModeComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(offscreenRenderingModeComboBox, OffscreenRenderingMode.class);
displayContentPane.add(new TextWithStyle(tr("Offscreen rendering mode"), CAPTION_TITLE_CSS_CLASS), 0, 3);
displayContentPane.add(offscreenRenderingModeComboBox, 1, 3);
final ComboBox<RenderTargetModeLock> renderTargetModeLockComboBox = new ComboBox<>();
renderTargetModeLockComboBox.setMaxWidth(Double.MAX_VALUE);
renderTargetModeLockComboBox.setValue(container.getRenderTargetModeLock());
renderTargetModeLockComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(renderTargetModeLockComboBox, RenderTargetModeLock.class);
displayContentPane.add(new TextWithStyle(tr("Render target lock mode"), CAPTION_TITLE_CSS_CLASS), 0, 4);
displayContentPane.add(renderTargetModeLockComboBox, 1, 4);
final ComboBox<Multisampling> multisamplingComboBox = new ComboBox<>();
multisamplingComboBox.setMaxWidth(Double.MAX_VALUE);
multisamplingComboBox.setValue(container.getMultisampling());
multisamplingComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(multisamplingComboBox, Multisampling.class);
displayContentPane.add(new TextWithStyle(tr("Multisampling"), CAPTION_TITLE_CSS_CLASS), 0, 5);
displayContentPane.add(multisamplingComboBox, 1, 5);
final ComboBox<StrictDrawOrdering> strictDrawOrderingComboBox = new ComboBox<>();
strictDrawOrderingComboBox.setMaxWidth(Double.MAX_VALUE);
strictDrawOrderingComboBox.setValue(container.getStrictDrawOrdering());
strictDrawOrderingComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(strictDrawOrderingComboBox, StrictDrawOrdering.class);
displayContentPane.add(new TextWithStyle(tr("Strict Draw Ordering"), CAPTION_TITLE_CSS_CLASS), 0, 6);
displayContentPane.add(strictDrawOrderingComboBox, 1, 6);
final ComboBox<AlwaysOffscreen> alwaysOffscreenComboBox = new ComboBox<>();
alwaysOffscreenComboBox.setMaxWidth(Double.MAX_VALUE);
alwaysOffscreenComboBox.setValue(container.getAlwaysOffscreen());
alwaysOffscreenComboBox.valueProperty().addListener((observable, oldValue, newValue) -> this.changeSettings(newValue));
addItems(alwaysOffscreenComboBox, AlwaysOffscreen.class);
displayContentPane.add(new TextWithStyle(tr("Always Offscreen"), CAPTION_TITLE_CSS_CLASS), 0, 7);
displayContentPane.add(alwaysOffscreenComboBox, 1, 7);
Region spacer = new Region();
GridPane.setHgrow(spacer, Priority.ALWAYS);
displayContentPane.add(spacer, 2, 0);
displayPane.getChildren().addAll(displayContentPane);
this.setContent(displayPane);
lockableElements.addAll(Arrays.asList(glslComboBox, directDrawRendererComboBox, offscreenRenderingModeComboBox, renderTargetModeLockComboBox, multisamplingComboBox, strictDrawOrderingComboBox, alwaysOffscreenComboBox, videoMemorySizeComboBox));
}
Aggregations