Search in sources :

Example 26 with TextWithStyle

use of org.phoenicis.javafx.views.common.TextWithStyle in project phoenicis 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/phoenicis/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);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) Hyperlink(javafx.scene.control.Hyperlink)

Example 27 with TextWithStyle

use of org.phoenicis.javafx.views.common.TextWithStyle in project phoenicis 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);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) GridPane(javafx.scene.layout.GridPane)

Example 28 with TextWithStyle

use of org.phoenicis.javafx.views.common.TextWithStyle in project phoenicis by PhoenicisOrg.

the class WinePrefixContainerInformationTab method populate.

private void populate() {
    final VBox informationPane = new VBox();
    final Text title = new TextWithStyle(tr("Information"), TITLE_CSS_CLASS);
    informationPane.getStyleClass().add(CONFIGURATION_PANE_CSS_CLASS);
    informationPane.getChildren().add(title);
    final GridPane informationContentPane = new GridPane();
    informationContentPane.getStyleClass().add("grid");
    informationContentPane.add(new TextWithStyle(tr("Name:"), CAPTION_TITLE_CSS_CLASS), 0, 0);
    Label name = new Label(container.getName());
    name.setWrapText(true);
    informationContentPane.add(name, 1, 0);
    informationContentPane.add(new TextWithStyle(tr("Path:"), CAPTION_TITLE_CSS_CLASS), 0, 1);
    Label path = new Label(container.getPath());
    path.setWrapText(true);
    informationContentPane.add(path, 1, 1);
    informationContentPane.add(new TextWithStyle(tr("Installed shortcuts:"), CAPTION_TITLE_CSS_CLASS), 0, 2);
    Label installedShortcuts = new Label(container.getInstalledShortcuts().stream().map(shortcutDTO -> shortcutDTO.getInfo().getName()).collect(Collectors.joining("; ")));
    installedShortcuts.setWrapText(true);
    informationContentPane.add(installedShortcuts, 1, 2);
    informationContentPane.add(new TextWithStyle(tr("Wine version:"), CAPTION_TITLE_CSS_CLASS), 0, 3);
    Label version = new Label(container.getVersion());
    version.setWrapText(true);
    informationContentPane.add(version, 1, 3);
    informationContentPane.add(new TextWithStyle(tr("Wine architecture:"), CAPTION_TITLE_CSS_CLASS), 0, 4);
    Label architecture = new Label(container.getArchitecture());
    architecture.setWrapText(true);
    informationContentPane.add(architecture, 1, 4);
    informationContentPane.add(new TextWithStyle(tr("Wine distribution:"), CAPTION_TITLE_CSS_CLASS), 0, 5);
    Label distribution = new Label(container.getDistribution());
    distribution.setWrapText(true);
    informationContentPane.add(distribution, 1, 5);
    Region spacer = new Region();
    spacer.setPrefHeight(20);
    VBox.setVgrow(spacer, Priority.NEVER);
    // changing engine does not work currently
    // disabled combobox to avoid confusion of users
    /*ComboBox<EngineVersionDTO> changeEngineComboBox = new ComboBox<EngineVersionDTO>(
                FXCollections.observableList(engineVersions));
        changeEngineComboBox.setConverter(new StringConverter<EngineVersionDTO>() {
            @Override
            public String toString(EngineVersionDTO object) {
                return object.getVersion();
            }
        
            @Override
            public EngineVersionDTO fromString(String string) {
                return engineVersions.stream().filter(engineVersion -> engineVersion.getVersion().equals(string))
                        .findFirst().get();
            }
        });
        changeEngineComboBox.getSelectionModel().select(engineVersions.stream()
                .filter(engineVersion -> engineVersion.getVersion().equals(container.getVersion())).findFirst().get());*/
    Button deleteButton = new Button(tr("Delete container"));
    deleteButton.setOnMouseClicked(event -> this.onDeletePrefix.accept(container));
    informationPane.getChildren().addAll(informationContentPane, spacer, /*changeEngineComboBox,*/
    deleteButton);
    this.setContent(informationPane);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) GridPane(javafx.scene.layout.GridPane) Button(javafx.scene.control.Button) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) VBox(javafx.scene.layout.VBox)

Example 29 with TextWithStyle

use of org.phoenicis.javafx.views.common.TextWithStyle in project phoenicis by PhoenicisOrg.

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 TilePane toolsContentPane = new TilePane();
    toolsContentPane.setPrefColumns(3);
    toolsContentPane.getStyleClass().add("grid");
    Button runExecutable = new Button(tr("Run executable"));
    runExecutable.getStyleClass().addAll("toolButton", "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.runInContainer(container, file.getAbsolutePath(), this::unlockAll, e -> Platform.runLater(() -> new ErrorMessage("Error", e).show()));
        }
    });
    this.lockableElements.add(runExecutable);
    toolsContentPane.getChildren().add(runExecutable);
    toolsPane.getChildren().addAll(toolsContentPane);
    this.setContent(toolsPane);
}
Also used : TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) Button(javafx.scene.control.Button) TilePane(javafx.scene.layout.TilePane) FileChooser(javafx.stage.FileChooser) Text(javafx.scene.text.Text) ErrorMessage(org.phoenicis.javafx.views.common.ErrorMessage) VBox(javafx.scene.layout.VBox) File(java.io.File)

Aggregations

TextWithStyle (org.phoenicis.javafx.views.common.TextWithStyle)29 Text (javafx.scene.text.Text)20 GridPane (javafx.scene.layout.GridPane)17 VBox (javafx.scene.layout.VBox)15 Button (javafx.scene.control.Button)12 Label (javafx.scene.control.Label)10 ErrorMessage (org.phoenicis.javafx.views.common.ErrorMessage)9 ComboBox (javafx.scene.control.ComboBox)7 Region (javafx.scene.layout.Region)6 ColumnConstraintsWithPercentage (org.phoenicis.javafx.views.common.ColumnConstraintsWithPercentage)5 FXCollections (javafx.collections.FXCollections)4 TilePane (javafx.scene.layout.TilePane)4 Localisation.tr (org.phoenicis.configuration.localisation.Localisation.tr)4 File (java.io.File)3 URI (java.net.URI)3 URISyntaxException (java.net.URISyntaxException)3 Map (java.util.Map)3 Optional (java.util.Optional)3 Platform (javafx.application.Platform)3 ObservableList (javafx.collections.ObservableList)3