Search in sources :

Example 1 with InstallationSidebar

use of org.phoenicis.javafx.components.installation.control.InstallationSidebar in project POL-POM-5 by PlayOnLinux.

the class InstallationsFeaturePanelSkin method createSidebar.

/**
 * {@inheritDoc}
 */
@Override
public ObjectExpression<SidebarBase<?, ?, ?>> createSidebar() {
    final SortedList<InstallationCategoryDTO> sortedCategories = getControl().getInstallationCategories().sorted(Comparator.comparing(InstallationCategoryDTO::getName));
    final InstallationSidebar sidebar = new InstallationSidebar(getControl().getFilter(), sortedCategories, this.selectedListWidget);
    // set the default selection
    sidebar.setSelectedListWidget(Optional.ofNullable(getControl().getJavaFxSettingsManager()).map(JavaFxSettingsManager::getInstallationsListType).orElse(ListWidgetType.ICONS_LIST));
    // save changes to the list widget selection to the hard drive
    sidebar.selectedListWidgetProperty().addListener((observable, oldValue, newValue) -> {
        final JavaFxSettingsManager javaFxSettingsManager = getControl().getJavaFxSettingsManager();
        if (newValue != null) {
            javaFxSettingsManager.setInstallationsListType(newValue);
            javaFxSettingsManager.save();
        }
    });
    return new SimpleObjectProperty<>(sidebar);
}
Also used : SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) InstallationSidebar(org.phoenicis.javafx.components.installation.control.InstallationSidebar) JavaFxSettingsManager(org.phoenicis.javafx.settings.JavaFxSettingsManager) InstallationCategoryDTO(org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO)

Aggregations

SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 InstallationSidebar (org.phoenicis.javafx.components.installation.control.InstallationSidebar)1 JavaFxSettingsManager (org.phoenicis.javafx.settings.JavaFxSettingsManager)1 InstallationCategoryDTO (org.phoenicis.javafx.views.mainwindow.installations.dto.InstallationCategoryDTO)1