use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PlayOnLinux.
the class ApplicationsFeaturePanelSkin method createContent.
/**
* {@inheritDoc}
*/
@Override
public ObjectExpression<Node> createContent() {
/*
* initialising the application lists by:
* 1. sorting the applications by their name
* 2. filtering them
*/
final FilteredList<ApplicationDTO> filteredApplications = ConcatenatedList.create(new MappedList<>(getControl().getCategories().filtered(category -> category.getType() == CategoryDTO.CategoryType.INSTALLERS), CategoryDTO::getApplications)).sorted(Comparator.comparing(ApplicationDTO::getName)).filtered(getControl()::filterApplication);
filteredApplications.predicateProperty().bind(Bindings.createObjectBinding(() -> getControl()::filterApplication, getControl().searchTermProperty(), getControl().fuzzySearchRatioProperty(), getControl().operatingSystemProperty(), getControl().filterCategoryProperty(), getControl().containAllOSCompatibleApplicationsProperty(), getControl().containCommercialApplicationsProperty(), getControl().containRequiresPatchApplicationsProperty(), getControl().containTestingApplicationsProperty()));
final ObservableList<ListWidgetElement<ApplicationDTO>> listWidgetEntries = new MappedList<>(filteredApplications, ListWidgetElement::create);
final CombinedListWidget<ApplicationDTO> combinedListWidget = new CombinedListWidget<>(listWidgetEntries, this.selectedListWidget);
// bind direction: controller property -> skin property
getControl().selectedApplicationProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
combinedListWidget.select(newValue);
} else {
combinedListWidget.deselect();
}
});
// bind direction: skin property -> controller properties
combinedListWidget.selectedElementProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
final ApplicationDTO selectedItem = newValue.getItem();
getControl().setSelectedApplication(selectedItem);
getControl().setOpenedDetailsPanel(new ApplicationInformation(selectedItem));
} else {
getControl().setSelectedApplication(null);
getControl().setOpenedDetailsPanel(new None());
}
});
return new SimpleObjectProperty<>(combinedListWidget);
}
use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanel method closeDetailsPanel.
/**
* {@inheritDoc}
*/
@Override
public void closeDetailsPanel() {
// deselect the currently selected container
setSelectedContainer(null);
// close the details panel
setOpenedDetailsPanel(new None());
}
use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PlayOnLinux.
the class LibraryFeaturePanel method closeDetailsPanel.
/**
* {@inheritDoc}
*/
@Override
public void closeDetailsPanel() {
// deselect the currently selected shortcut
setSelectedShortcut(null);
// close the details panel
setOpenedDetailsPanel(new None());
}
use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PlayOnLinux.
the class LibraryFeaturePanelSkin method createCombinedListWidget.
private CombinedListWidget<ShortcutDTO> createCombinedListWidget() {
final FilteredList<ShortcutDTO> filteredShortcuts = ConcatenatedList.create(new MappedList<>(getControl().getCategories().sorted(Comparator.comparing(ShortcutCategoryDTO::getName)), ShortcutCategoryDTO::getShortcuts)).filtered(getControl().getFilter()::filter);
filteredShortcuts.predicateProperty().bind(Bindings.createObjectBinding(() -> getControl().getFilter()::filter, getControl().getFilter().searchTermProperty(), getControl().getFilter().selectedShortcutCategoryProperty()));
final SortedList<ShortcutDTO> sortedShortcuts = filteredShortcuts.sorted(Comparator.comparing(shortcut -> shortcut.getInfo().getName()));
final ObservableList<ListWidgetElement<ShortcutDTO>> listWidgetEntries = new MappedList<>(sortedShortcuts, ListWidgetElement::create);
final CombinedListWidget<ShortcutDTO> combinedListWidget = new CombinedListWidget<>(listWidgetEntries, this.selectedListWidget);
// bind direction: controller property -> skin property
getControl().selectedShortcutProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
combinedListWidget.select(newValue);
} else {
combinedListWidget.deselect();
}
});
// bind direction: skin property -> controller properties
combinedListWidget.selectedElementProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
final ShortcutDTO selectedItem = newValue.getItem();
final MouseEvent event = newValue.getEvent();
getControl().setSelectedShortcut(selectedItem);
getControl().setOpenedDetailsPanel(new ShortcutInformation(selectedItem));
if (event.getClickCount() == 2) {
getControl().runShortcut(selectedItem);
}
} else {
getControl().setSelectedShortcut(null);
getControl().setOpenedDetailsPanel(new None());
}
});
return combinedListWidget;
}
use of org.phoenicis.javafx.components.common.panelstates.None in project POL-POM-5 by PlayOnLinux.
the class InstallationsFeaturePanel method closeDetailsPanel.
/**
* {@inheritDoc}
*/
@Override
public void closeDetailsPanel() {
// deselect the currently selected installation
setSelectedInstallation(null);
// close the details panel
setOpenedDetailsPanel(new None());
}
Aggregations