Search in sources :

Example 1 with EngineVersionDTO

use of org.phoenicis.engines.dto.EngineVersionDTO in project POL-POM-5 by PlayOnLinux.

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("Wine version:"), CAPTION_TITLE_CSS_CLASS), 0, 2);
    Label version = new Label(container.getVersion());
    version.setWrapText(true);
    informationContentPane.add(version, 1, 2);
    informationContentPane.add(new TextWithStyle(tr("Wine architecture:"), CAPTION_TITLE_CSS_CLASS), 0, 3);
    Label architecture = new Label(container.getArchitecture());
    architecture.setWrapText(true);
    informationContentPane.add(architecture, 1, 3);
    informationContentPane.add(new TextWithStyle(tr("Wine distribution:"), CAPTION_TITLE_CSS_CLASS), 0, 4);
    Label distribution = new Label(container.getDistribution());
    distribution.setWrapText(true);
    informationContentPane.add(distribution, 1, 4);
    Region spacer = new Region();
    spacer.setPrefHeight(20);
    VBox.setVgrow(spacer, Priority.NEVER);
    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 : Button(javafx.scene.control.Button) Label(javafx.scene.control.Label) TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) FXCollections(javafx.collections.FXCollections) Localisation.tr(org.phoenicis.configuration.localisation.Localisation.tr) StringConverter(javafx.util.StringConverter) VBox(javafx.scene.layout.VBox) EngineVersionDTO(org.phoenicis.engines.dto.EngineVersionDTO) Text(javafx.scene.text.Text) Consumer(java.util.function.Consumer) Priority(javafx.scene.layout.Priority) List(java.util.List) Region(javafx.scene.layout.Region) ComboBox(javafx.scene.control.ComboBox) Tab(javafx.scene.control.Tab) WinePrefixContainerDTO(org.phoenicis.containers.dto.WinePrefixContainerDTO) GridPane(javafx.scene.layout.GridPane) TextWithStyle(org.phoenicis.javafx.views.common.TextWithStyle) GridPane(javafx.scene.layout.GridPane) ComboBox(javafx.scene.control.ComboBox) Label(javafx.scene.control.Label) Text(javafx.scene.text.Text) EngineVersionDTO(org.phoenicis.engines.dto.EngineVersionDTO) Button(javafx.scene.control.Button) Region(javafx.scene.layout.Region) VBox(javafx.scene.layout.VBox)

Example 2 with EngineVersionDTO

use of org.phoenicis.engines.dto.EngineVersionDTO in project POL-POM-5 by PlayOnLinux.

the class EngineSubCategoryPanelSkin method createListWidget.

/**
 * Creates a new {@link CombinedListWidget} object containing all {@link EngineVersionDTO} objects in the given
 * {@link ObservableList filteredEngineVersions}
 *
 * @param filteredEngineVersions An {@link ObservableList} containing all to be shown {@link EngineVersionDTO}
 *            objects
 * @return A new {@link CombinedListWidget} object containing all {@link EngineVersionDTO} objects in the given
 *         {@link ObservableList filteredEngineVersions}
 */
private CombinedListWidget<EngineVersionDTO> createListWidget(ObservableList<EngineVersionDTO> filteredEngineVersions) {
    final ObservableList<ListWidgetElement<EngineVersionDTO>> listWidgetEntries = new MappedList<>(filteredEngineVersions, engineVersion -> ListWidgetElement.create(engineVersion, Files.exists(Paths.get(getControl().getEnginesPath(), getControl().getEngineCategory().getName().toLowerCase(), getControl().getEngineSubCategory().getName(), engineVersion.getVersion()))));
    final CombinedListWidget<EngineVersionDTO> listWidget = new CombinedListWidget<>(listWidgetEntries);
    listWidget.selectedListWidgetProperty().bind(getControl().selectedListWidgetProperty());
    listWidget.selectedElementProperty().addListener((observable, oldValue, newValue) -> {
        if (newValue != null) {
            final EngineVersionDTO engineItem = newValue.getItem();
            Map<String, String> userData = new HashMap<>();
            userData.put("Mono", engineItem.getMonoFile());
            userData.put("Gecko", engineItem.getGeckoFile());
            EngineDTO engineDTO = new EngineDTO.Builder().withCategory(getControl().getEngineCategory().getName()).withSubCategory(getControl().getEngineSubCategory().getName()).withVersion(engineItem.getVersion()).withUserData(userData).build();
            Optional.ofNullable(getControl().getOnEngineSelect()).ifPresent(onEngineSelect -> onEngineSelect.accept(engineDTO, getControl().getEngine()));
        }
    });
    return listWidget;
}
Also used : MappedList(org.phoenicis.javafx.collections.MappedList) CombinedListWidget(org.phoenicis.javafx.components.common.widgets.control.CombinedListWidget) EngineDTO(org.phoenicis.engines.dto.EngineDTO) EngineVersionDTO(org.phoenicis.engines.dto.EngineVersionDTO) HashMap(java.util.HashMap) ListWidgetElement(org.phoenicis.javafx.components.common.widgets.utils.ListWidgetElement)

Example 3 with EngineVersionDTO

use of org.phoenicis.engines.dto.EngineVersionDTO in project POL-POM-5 by PlayOnLinux.

the class EngineSubCategoryPanelSkin method createFilteredEngineVersions.

/**
 * Creates a {@link FilteredList} object of the engine versions by applying the {@link EnginesFilter} known to the
 * control
 *
 * @return A filtered list of the engine versions
 */
private ObservableList<EngineVersionDTO> createFilteredEngineVersions() {
    final EnginesFilter filter = getControl().getFilter();
    final EngineCategoryDTO engineCategory = getControl().getEngineCategory();
    final EngineSubCategoryDTO engineSubCategory = getControl().getEngineSubCategory();
    final FilteredList<EngineVersionDTO> filteredEngineVersions = FXCollections.observableArrayList(engineSubCategory.getPackages()).sorted(EngineSubCategoryDTO.comparator().reversed()).filtered(filter.createFilter(engineCategory, engineSubCategory));
    filteredEngineVersions.predicateProperty().bind(Bindings.createObjectBinding(() -> filter.createFilter(engineCategory, engineSubCategory), filter.searchTermProperty(), filter.selectedEngineCategoryProperty(), filter.showInstalledProperty(), filter.showNotInstalledProperty()));
    return filteredEngineVersions;
}
Also used : EngineCategoryDTO(org.phoenicis.engines.dto.EngineCategoryDTO) EngineVersionDTO(org.phoenicis.engines.dto.EngineVersionDTO) EnginesFilter(org.phoenicis.javafx.views.mainwindow.engines.EnginesFilter) EngineSubCategoryDTO(org.phoenicis.engines.dto.EngineSubCategoryDTO)

Aggregations

EngineVersionDTO (org.phoenicis.engines.dto.EngineVersionDTO)3 HashMap (java.util.HashMap)1 List (java.util.List)1 Consumer (java.util.function.Consumer)1 FXCollections (javafx.collections.FXCollections)1 Button (javafx.scene.control.Button)1 ComboBox (javafx.scene.control.ComboBox)1 Label (javafx.scene.control.Label)1 Tab (javafx.scene.control.Tab)1 GridPane (javafx.scene.layout.GridPane)1 Priority (javafx.scene.layout.Priority)1 Region (javafx.scene.layout.Region)1 VBox (javafx.scene.layout.VBox)1 Text (javafx.scene.text.Text)1 StringConverter (javafx.util.StringConverter)1 Localisation.tr (org.phoenicis.configuration.localisation.Localisation.tr)1 WinePrefixContainerDTO (org.phoenicis.containers.dto.WinePrefixContainerDTO)1 EngineCategoryDTO (org.phoenicis.engines.dto.EngineCategoryDTO)1 EngineDTO (org.phoenicis.engines.dto.EngineDTO)1 EngineSubCategoryDTO (org.phoenicis.engines.dto.EngineSubCategoryDTO)1