use of org.phoenicis.javafx.components.container.control.ContainerSidebar in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanelSkin method createSidebar.
/**
* {@inheritDoc}
*/
@Override
public ObjectExpression<SidebarBase<?, ?, ?>> createSidebar() {
/*
* initialize the container categories by sorting them
*/
final SortedList<ContainerCategoryDTO> sortedCategories = getControl().getCategories().sorted(Comparator.comparing(ContainerCategoryDTO::getName));
final ContainerSidebar sidebar = new ContainerSidebar(getControl().getFilter(), sortedCategories, this.selectedListWidget);
// set the default selection
sidebar.setSelectedListWidget(Optional.ofNullable(getControl().getJavaFxSettingsManager()).map(JavaFxSettingsManager::getContainersListType).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.setContainersListType(newValue);
javaFxSettingsManager.save();
}
});
return new SimpleObjectProperty<>(sidebar);
}
Aggregations