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);
}
Aggregations