use of org.phoenicis.javafx.views.common.TextWithStyle 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));
}
use of org.phoenicis.javafx.views.common.TextWithStyle in project POL-POM-5 by PlayOnLinux.
the class UserInterfacePanel method populate.
private void populate() {
this.title = new TextWithStyle(tr("User Interface Settings"), "title");
this.themeGrid = new GridPane();
this.themeGrid.getStyleClass().add("grid");
this.themeGrid.setHgap(20);
this.themeGrid.setVgap(10);
// Change Theme
this.themeTitle = new TextWithStyle(tr("Theme:"), "captionTitle");
this.themes = new ComboBox<>();
this.themes.getItems().setAll(Themes.all());
this.themes.setValue(Themes.fromShortName(settingsManager.getTheme()).orElse(Themes.DEFAULT));
this.themes.setOnAction(event -> {
this.handleThemeChange();
this.save();
});
// View Script Sources
this.showScriptSource = new CheckBox();
this.showScriptSource.setSelected(settingsManager.isViewScriptSource());
this.showScriptSource.setOnAction(event -> this.save());
this.showScriptDescription = new Label(tr("Select, if you want to view the source repository of the scripts"));
// Scale UI
this.scale = new Slider(8, 16, settingsManager.getScale());
this.scaleDescription = new Label(tr("Scale the user interface."));
this.scale.valueProperty().addListener((observableValue, oldValue, newValue) -> {
this.pause.setOnFinished(event -> {
getScene().getRoot().setStyle(String.format("-fx-font-size: %.2fpt;", newValue));
this.save();
});
this.pause.playFromStart();
});
this.themeGrid.add(themeTitle, 0, 0);
this.themeGrid.add(themes, 1, 0);
this.themeGrid.add(showScriptSource, 0, 1);
this.themeGrid.add(showScriptDescription, 1, 1);
this.themeGrid.add(scale, 0, 2);
this.themeGrid.add(scaleDescription, 1, 2);
}
use of org.phoenicis.javafx.views.common.TextWithStyle in project POL-POM-5 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 POL-POM-5 by PhoenicisOrg.
the class UserInterfacePanel method populate.
private void populate() {
this.title = new TextWithStyle(tr("User Interface Settings"), "title");
this.themeGrid = new GridPane();
this.themeGrid.getStyleClass().add("grid");
this.themeGrid.setHgap(20);
this.themeGrid.setVgap(10);
// Change Theme
this.themeTitle = new TextWithStyle(tr("Theme:"), "captionTitle");
this.themes = new ComboBox<>();
this.themes.getItems().setAll(Themes.all());
this.themes.setValue(Themes.fromShortName(javaFxSettingsManager.getTheme()).orElse(Themes.DEFAULT));
this.themes.setOnAction(event -> {
this.handleThemeChange();
this.save();
});
// View Script Sources
this.showScriptSource = new CheckBox();
this.showScriptSource.setSelected(javaFxSettingsManager.isViewScriptSource());
this.showScriptSource.setOnAction(event -> this.save());
this.showScriptDescription = new Label(tr("Select, if you want to view the source repository of the scripts"));
// Scale UI
this.scale = new Slider(8, 16, javaFxSettingsManager.getScale());
this.scaleDescription = new Label(tr("Scale the user interface."));
this.scale.valueProperty().addListener((observableValue, oldValue, newValue) -> {
this.pause.setOnFinished(event -> {
getScene().getRoot().setStyle(String.format("-fx-font-size: %.2fpt;", newValue));
this.save();
});
this.pause.playFromStart();
});
// restore default
ToggleButton restoreDefault = new ToggleButton(tr("Restore defaults (requires restart)"));
restoreDefault.setOnAction(event -> {
this.javaFxSettingsManager.restoreDefault();
});
this.themeGrid.add(themeTitle, 0, 0);
this.themeGrid.add(themes, 1, 0);
this.themeGrid.add(showScriptSource, 0, 1);
this.themeGrid.add(showScriptDescription, 1, 1);
this.themeGrid.add(scale, 0, 2);
this.themeGrid.add(scaleDescription, 1, 2);
this.themeGrid.add(restoreDefault, 0, 3);
}
use of org.phoenicis.javafx.views.common.TextWithStyle in project POL-POM-5 by PhoenicisOrg.
the class AboutPanel method populate.
private void populate() {
this.title = new TextWithStyle(tr("About"), "title");
this.aboutGrid = new GridPane();
this.aboutGrid.getStyleClass().add("grid");
this.aboutGrid.setHgap(20);
this.aboutGrid.setVgap(10);
this.nameDescription = new TextWithStyle(tr("Name:"), "captionTitle");
this.nameLabel = new Label(buildInformation.getApplicationName());
this.versionDescription = new TextWithStyle(tr("Version:"), "captionTitle");
this.versionLabel = new Label(buildInformation.getApplicationVersion());
this.gitRevisionDescription = new TextWithStyle(tr("Git Revision:"), "captionTitle");
this.gitRevisionHyperlink = new Hyperlink(buildInformation.getApplicationGitRevision());
this.gitRevisionHyperlink.setOnAction(event -> {
try {
URI uri = new URI("https://github.com/PhoenicisOrg/POL-POM-5/commit/" + buildInformation.getApplicationGitRevision());
opener.open(uri);
} catch (URISyntaxException e) {
e.printStackTrace();
}
});
this.buildTimestampDescription = new TextWithStyle(tr("Build Timestamp:"), "captionTitle");
this.buildTimestampLabel = new Label(buildInformation.getApplicationBuildTimestamp());
this.aboutGrid.add(nameDescription, 0, 0);
this.aboutGrid.add(nameLabel, 1, 0);
this.aboutGrid.add(versionDescription, 0, 1);
this.aboutGrid.add(versionLabel, 1, 1);
this.aboutGrid.add(gitRevisionDescription, 0, 2);
this.aboutGrid.add(gitRevisionHyperlink, 1, 2);
this.aboutGrid.add(buildTimestampDescription, 0, 3);
this.aboutGrid.add(buildTimestampLabel, 1, 3);
}
Aggregations