use of org.phoenicis.javafx.collections.ConcatenatedList in project POL-POM-5 by PlayOnLinux.
the class EnginesView method createEngineSubCategoryTabs.
private ObservableList<Tab> createEngineSubCategoryTabs(EngineSidebar sidebar) {
// initialize the engines sub category panels
final MappedList<List<EngineSubCategoryPanel>, EngineCategoryDTO> engineSubCategoryPanelGroups = new MappedList<>(this.engineCategories, engineCategory -> engineCategory.getSubCategories().stream().map(engineSubCategory -> {
final EngineSubCategoryPanel engineSubCategoryPanel = new EngineSubCategoryPanel();
engineSubCategoryPanel.setEngineCategory(engineCategory);
engineSubCategoryPanel.setEngineSubCategory(engineSubCategory);
engineSubCategoryPanel.setEnginesPath(this.enginesPath);
engineSubCategoryPanel.setFilter(this.filter);
engineSubCategoryPanel.setEngine(this.engines.get(engineCategory.getName().toLowerCase()));
engineSubCategoryPanel.selectedListWidgetProperty().bind(sidebar.selectedListWidgetProperty());
engineSubCategoryPanel.setOnEngineSelect(this::showEngineDetails);
return engineSubCategoryPanel;
}).collect(Collectors.toList()));
final ConcatenatedList<EngineSubCategoryPanel> engineSubCategoryPanels = ConcatenatedList.create(engineSubCategoryPanelGroups);
final FilteredList<EngineSubCategoryPanel> filteredEngineSubCategoryPanels = engineSubCategoryPanels.sorted(Comparator.comparing(engineSubCategoryPanel -> engineSubCategoryPanel.getEngineSubCategory().getName())).filtered(this.filter::filter);
filteredEngineSubCategoryPanels.predicateProperty().bind(Bindings.createObjectBinding(() -> this.filter::filter, this.filter.searchTermProperty(), this.filter.showInstalledProperty(), this.filter.showNotInstalledProperty()));
// map the panels to tabs
return new MappedList<>(filteredEngineSubCategoryPanels, engineSubCategoryPanel -> new Tab(engineSubCategoryPanel.getEngineSubCategory().getDescription(), engineSubCategoryPanel));
}
use of org.phoenicis.javafx.collections.ConcatenatedList in project POL-POM-5 by PlayOnLinux.
the class MainWindow method createInstallationsTab.
private Tab createInstallationsTab(InstallationsFeaturePanel installationsFeaturePanel) {
final Tab installationsTab = new Tab(tr("Installations"), installationsFeaturePanel);
installationsTab.setClosable(false);
final ConcatenatedList<InstallationDTO> installations = ConcatenatedList.create(new MappedList<>(installationsFeaturePanel.getInstallationCategories(), InstallationCategoryDTO::getInstallations));
// a binding containing the number of currently active installations
final IntegerBinding openInstallations = Bindings.createIntegerBinding(installations::size, installations);
final TabIndicator indicator = new TabIndicator();
indicator.textProperty().bind(StringBindings.map(openInstallations, numberOfInstallations -> {
if (numberOfInstallations.intValue() < 10) {
return String.valueOf(numberOfInstallations);
} else {
return "+";
}
}));
// only show the tab indicator if at least one active installation exists
installationsTab.graphicProperty().bind(Bindings.when(Bindings.notEqual(openInstallations, 0)).then(indicator).otherwise(new SimpleObjectProperty<>()));
return installationsTab;
}
use of org.phoenicis.javafx.collections.ConcatenatedList in project POL-POM-5 by PhoenicisOrg.
the class MainWindow method createInstallationsTab.
private Tab createInstallationsTab(InstallationsFeaturePanel installationsFeaturePanel) {
final Tab installationsTab = new Tab(tr("Installations"), installationsFeaturePanel);
installationsTab.setClosable(false);
final ConcatenatedList<InstallationDTO> installations = ConcatenatedList.create(new MappedList<>(installationsFeaturePanel.getInstallationCategories(), InstallationCategoryDTO::getInstallations));
// a binding containing the number of currently active installations
final IntegerBinding openInstallations = Bindings.createIntegerBinding(installations::size, installations);
final TabIndicator indicator = new TabIndicator();
indicator.textProperty().bind(StringBindings.map(openInstallations, numberOfInstallations -> {
if (numberOfInstallations.intValue() < 10) {
return String.valueOf(numberOfInstallations);
} else {
return "+";
}
}));
// only show the tab indicator if at least one active installation exists
installationsTab.graphicProperty().bind(Bindings.when(Bindings.notEqual(openInstallations, 0)).then(indicator).otherwise(new SimpleObjectProperty<>()));
return installationsTab;
}
use of org.phoenicis.javafx.collections.ConcatenatedList in project POL-POM-5 by PhoenicisOrg.
the class EnginesView method createEngineSubCategoryTabs.
private ObservableList<Tab> createEngineSubCategoryTabs(EngineSidebar sidebar) {
// initialize the engines sub category panels
final MappedList<List<EngineSubCategoryPanel>, EngineCategoryDTO> engineSubCategoryPanelGroups = new MappedList<>(this.engineCategories, engineCategory -> engineCategory.getSubCategories().stream().map(engineSubCategory -> {
final EngineSubCategoryPanel engineSubCategoryPanel = new EngineSubCategoryPanel();
engineSubCategoryPanel.setEngineCategory(engineCategory);
engineSubCategoryPanel.setEngineSubCategory(engineSubCategory);
engineSubCategoryPanel.setEnginesPath(this.enginesPath);
engineSubCategoryPanel.setFilter(this.filter);
engineSubCategoryPanel.setEngine(this.engines.get(engineCategory.getName().toLowerCase()));
engineSubCategoryPanel.selectedListWidgetProperty().bind(sidebar.selectedListWidgetProperty());
engineSubCategoryPanel.setOnEngineSelect(this::showEngineDetails);
return engineSubCategoryPanel;
}).collect(Collectors.toList()));
final ConcatenatedList<EngineSubCategoryPanel> engineSubCategoryPanels = ConcatenatedList.create(engineSubCategoryPanelGroups);
final FilteredList<EngineSubCategoryPanel> filteredEngineSubCategoryPanels = engineSubCategoryPanels.sorted(Comparator.comparing(engineSubCategoryPanel -> engineSubCategoryPanel.getEngineSubCategory().getName())).filtered(this.filter::filter);
filteredEngineSubCategoryPanels.predicateProperty().bind(Bindings.createObjectBinding(() -> this.filter::filter, this.filter.searchTermProperty(), this.filter.showInstalledProperty(), this.filter.showNotInstalledProperty()));
// map the panels to tabs
return new MappedList<>(filteredEngineSubCategoryPanels, engineSubCategoryPanel -> new Tab(engineSubCategoryPanel.getEngineSubCategory().getDescription(), engineSubCategoryPanel));
}
Aggregations