use of org.phoenicis.javafx.components.library.panelstates.ShortcutCreation in project POL-POM-5 by PlayOnLinux.
the class LibraryFeaturePanelSkin method createSidebar.
/**
* {@inheritDoc}
*/
@Override
public ObjectExpression<SidebarBase<?, ?, ?>> createSidebar() {
final SortedList<ShortcutCategoryDTO> sortedCategories = getControl().getCategories().sorted(Comparator.comparing(ShortcutCategoryDTO::getName));
final LibrarySidebar sidebar = new LibrarySidebar(getControl().getFilter(), sortedCategories, this.selectedListWidget);
sidebar.applicationNameProperty().bind(getControl().applicationNameProperty());
sidebar.javaFxSettingsManagerProperty().bind(getControl().javaFxSettingsManagerProperty());
sidebar.setOnCreateShortcut(() -> {
// deselect the currently selected shortcut
getControl().setSelectedShortcut(null);
// open the shortcut creation details panel
getControl().setOpenedDetailsPanel(new ShortcutCreation());
});
sidebar.setOnOpenConsole(getControl()::openConsole);
// set the default selection
sidebar.setSelectedListWidget(Optional.ofNullable(getControl().getJavaFxSettingsManager()).map(JavaFxSettingsManager::getLibraryListType).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.setLibraryListType(newValue);
javaFxSettingsManager.save();
}
});
return new SimpleObjectProperty<>(sidebar);
}
Aggregations