Search in sources :

Example 11 with InstallationDTO

use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project POL-POM-5 by PlayOnLinux.

the class InstallationsUtils method mergeCategories.

private static InstallationCategoryDTO mergeCategories(InstallationCategoryDTO leftCategory, InstallationCategoryDTO rightCategory) {
    final Map<String, InstallationDTO> leftInstallations = createSortedMap(leftCategory.getInstallations(), InstallationDTO::getId);
    final Map<String, InstallationDTO> rightInstallations = createSortedMap(rightCategory.getInstallations(), InstallationDTO::getId);
    final SortedMap<String, InstallationDTO> mergedInstallations = new TreeMap<>(rightInstallations);
    for (Map.Entry<String, InstallationDTO> entry : leftInstallations.entrySet()) {
        final InstallationDTO application = entry.getValue();
        if (mergedInstallations.containsKey(entry.getKey())) {
            LOGGER.error(String.format("Installation %s exists already!", entry.getKey()));
        } else {
            mergedInstallations.put(entry.getKey(), application);
        }
    }
    final List<InstallationDTO> installations = mergedInstallations.values().stream().sorted(InstallationDTO.nameComparator()).collect(Collectors.toList());
    return new InstallationCategoryDTO.Builder().withId(leftCategory.getId()).withName(leftCategory.getName()).withInstallations(installations).withIcon(leftCategory.getIcon()).build();
}
Also used : InstallationDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO) InstallationCategoryDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO)

Example 12 with InstallationDTO

use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project POL-POM-5 by PhoenicisOrg.

the class InstallationsFeaturePanelSkin method createInstallationDetailsPanel.

private DetailsPanel createInstallationDetailsPanel(Installation action) {
    final InstallationDTO installation = action.getInstallation();
    final DetailsPanel detailsPanel = new DetailsPanel();
    detailsPanel.setTitle(installation.getName());
    detailsPanel.setContent(installation.getNode());
    detailsPanel.setOnClose(getControl()::closeDetailsPanel);
    detailsPanel.prefWidthProperty().bind(getControl().widthProperty().divide(3));
    return detailsPanel;
}
Also used : InstallationDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO) OpenDetailsPanel(org.phoenicis.javafx.components.common.panelstates.OpenDetailsPanel) DetailsPanel(org.phoenicis.javafx.components.common.control.DetailsPanel)

Example 13 with InstallationDTO

use of org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO in project POL-POM-5 by PhoenicisOrg.

the class InstallationsUtils method mergeCategories.

private static InstallationCategoryDTO mergeCategories(InstallationCategoryDTO leftCategory, InstallationCategoryDTO rightCategory) {
    final Map<String, InstallationDTO> leftInstallations = createSortedMap(leftCategory.getInstallations(), InstallationDTO::getId);
    final Map<String, InstallationDTO> rightInstallations = createSortedMap(rightCategory.getInstallations(), InstallationDTO::getId);
    final SortedMap<String, InstallationDTO> mergedInstallations = new TreeMap<>(rightInstallations);
    for (Map.Entry<String, InstallationDTO> entry : leftInstallations.entrySet()) {
        final InstallationDTO application = entry.getValue();
        if (mergedInstallations.containsKey(entry.getKey())) {
            LOGGER.error(String.format("Installation %s exists already!", entry.getKey()));
        } else {
            mergedInstallations.put(entry.getKey(), application);
        }
    }
    final List<InstallationDTO> installations = mergedInstallations.values().stream().sorted(InstallationDTO.nameComparator()).collect(Collectors.toList());
    return new InstallationCategoryDTO.Builder().withId(leftCategory.getId()).withName(leftCategory.getName()).withInstallations(installations).withIcon(leftCategory.getIcon()).build();
}
Also used : InstallationDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO) InstallationCategoryDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO)

Aggregations

InstallationDTO (org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationDTO)13 InstallationCategoryDTO (org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO)8 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)4 MappedList (org.phoenicis.javafx.collections.MappedList)4 Date (java.util.Date)3 Platform (javafx.application.Platform)2 Bindings (javafx.beans.binding.Bindings)2 IntegerBinding (javafx.beans.binding.IntegerBinding)2 Scene (javafx.scene.Scene)2 Tab (javafx.scene.control.Tab)2 TabPane (javafx.scene.control.TabPane)2 Image (javafx.scene.image.Image)2 Stage (javafx.stage.Stage)2 Localisation.tr (org.phoenicis.configuration.localisation.Localisation.tr)2 JavaFXApplication (org.phoenicis.javafx.JavaFXApplication)2 ConcatenatedList (org.phoenicis.javafx.collections.ConcatenatedList)2 ApplicationsFeaturePanel (org.phoenicis.javafx.components.application.control.ApplicationsFeaturePanel)2 DetailsPanel (org.phoenicis.javafx.components.common.control.DetailsPanel)2 TabIndicator (org.phoenicis.javafx.components.common.control.TabIndicator)2 None (org.phoenicis.javafx.components.common.panelstates.None)2