use of org.phoenicis.repository.dto.CategoryDTO in project POL-POM-5 by PlayOnLinux.
the class EngineToolsManager method fetchAvailableEngineTools.
/**
* Fetches the available engine tools
*
* @param repositoryDTO The repository containing the engine tools
* @param callback The callback taking the fetched engine tools
*/
public void fetchAvailableEngineTools(RepositoryDTO repositoryDTO, Consumer<Map<String, ApplicationDTO>> callback) {
// get engine CategoryDTOs
List<CategoryDTO> categoryDTOS = new ArrayList<>();
for (TypeDTO typeDTO : repositoryDTO.getTypes()) {
if (typeDTO.getId().equals("engines")) {
categoryDTOS = typeDTO.getCategories();
}
}
Map<String, ApplicationDTO> tools = new HashMap<>();
for (CategoryDTO engine : categoryDTOS) {
for (ApplicationDTO applicationDTO : engine.getApplications()) {
if (applicationDTO.getId().equals(engine.getId() + ".tools")) {
tools.put(engine.getId().replaceAll("^.*\\.", ""), applicationDTO);
}
}
}
callback.accept(tools);
}
use of org.phoenicis.repository.dto.CategoryDTO in project POL-POM-5 by PlayOnLinux.
the class VerbsManager method fetchAvailableVerbs.
/**
* Fetches the available Verbs
*
* @param repositoryDTO
* @param callback
*/
public void fetchAvailableVerbs(RepositoryDTO repositoryDTO, Consumer<Map<String, ApplicationDTO>> callback) {
Map<String, ApplicationDTO> verbs = new HashMap<>();
// get engine CategoryDTOs
List<CategoryDTO> categoryDTOS = new ArrayList<>();
for (TypeDTO typeDTO : repositoryDTO.getTypes()) {
if (typeDTO.getId().equals("engines")) {
categoryDTOS = typeDTO.getCategories();
}
}
for (CategoryDTO engine : categoryDTOS) {
for (ApplicationDTO applicationDTO : engine.getApplications()) {
if (applicationDTO.getId().equals(engine.getId() + ".verbs")) {
verbs.put(engine.getId().replaceAll("^.*\\.", ""), applicationDTO);
}
}
}
callback.accept(verbs);
}
use of org.phoenicis.repository.dto.CategoryDTO in project POL-POM-5 by PlayOnLinux.
the class ApplicationsFeaturePanelSkin method createSidebar.
/**
* {@inheritDoc}
*/
@Override
public ObjectExpression<SidebarBase<?, ?, ?>> createSidebar() {
/*
* initialize the category lists by:
* 1. filtering by installer categories
* 2. sorting the remaining categories by their name
*/
final SortedList<CategoryDTO> sortedCategories = getControl().getCategories().filtered(category -> category.getType() == CategoryDTO.CategoryType.INSTALLERS).sorted(Comparator.comparing(CategoryDTO::getName));
final ApplicationSidebar sidebar = new ApplicationSidebar(sortedCategories, this.selectedListWidget);
sidebar.operatingSystemProperty().bind(getControl().operatingSystemProperty());
sidebar.fuzzySearchRatioProperty().bind(getControl().fuzzySearchRatioProperty());
getControl().searchTermProperty().bind(sidebar.searchTermProperty());
getControl().filterCategoryProperty().bind(sidebar.selectedItemProperty());
getControl().containCommercialApplicationsProperty().bind(sidebar.containCommercialApplicationsProperty());
getControl().containRequiresPatchApplicationsProperty().bind(sidebar.containRequiresPatchApplicationsProperty());
getControl().containTestingApplicationsProperty().bind(sidebar.containTestingApplicationsProperty());
getControl().containAllOSCompatibleApplicationsProperty().bind(sidebar.containAllOSCompatibleApplicationsProperty());
// set the default selection
sidebar.setSelectedListWidget(Optional.ofNullable(getControl().getJavaFxSettingsManager()).map(JavaFxSettingsManager::getAppsListType).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.setAppsListType(newValue);
javaFxSettingsManager.save();
}
});
return new SimpleObjectProperty<>(sidebar);
}
use of org.phoenicis.repository.dto.CategoryDTO in project POL-POM-5 by PhoenicisOrg.
the class EngineToolsManager method fetchAvailableEngineTools.
/**
* Fetches the available engine tools
*
* @param repositoryDTO The repository containing the engine tools
* @param callback The callback taking the fetched engine tools
*/
public void fetchAvailableEngineTools(RepositoryDTO repositoryDTO, Consumer<Map<String, ApplicationDTO>> callback) {
// get engine CategoryDTOs
List<CategoryDTO> categoryDTOS = new ArrayList<>();
for (TypeDTO typeDTO : repositoryDTO.getTypes()) {
if (typeDTO.getId().equals("engines")) {
categoryDTOS = typeDTO.getCategories();
}
}
Map<String, ApplicationDTO> tools = new HashMap<>();
for (CategoryDTO engine : categoryDTOS) {
for (ApplicationDTO applicationDTO : engine.getApplications()) {
if (applicationDTO.getId().equals(engine.getId() + ".tools")) {
tools.put(engine.getId().replaceAll("^.*\\.", ""), applicationDTO);
}
}
}
callback.accept(tools);
}
use of org.phoenicis.repository.dto.CategoryDTO in project POL-POM-5 by PhoenicisOrg.
the class ApplicationSidebarSkin method createSidebarToggleGroup.
private ApplicationSidebarToggleGroup createSidebarToggleGroup() {
final FilteredList<CategoryDTO> filteredCategories = getControl().getItems().filtered(getControl()::filterCategory);
filteredCategories.predicateProperty().bind(Bindings.createObjectBinding(() -> getControl()::filterCategory, getControl().searchTermProperty(), getControl().fuzzySearchRatioProperty(), getControl().operatingSystemProperty(), getControl().containAllOSCompatibleApplicationsProperty(), getControl().containCommercialApplicationsProperty(), getControl().containRequiresPatchApplicationsProperty(), getControl().containTestingApplicationsProperty()));
final ApplicationSidebarToggleGroup applicationSidebarToggleGroup = new ApplicationSidebarToggleGroup(filteredCategories);
applicationSidebarToggleGroup.setTitle(tr("Categories"));
getControl().selectedItemProperty().bind(applicationSidebarToggleGroup.selectedElementProperty());
return applicationSidebarToggleGroup;
}
Aggregations