use of org.phoenicis.repository.dto.CategoryDTO in project POL-POM-5 by PhoenicisOrg.
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 PhoenicisOrg.
the class AppsController method setDefaultCategoryIcons.
/**
* sets the default category icons from the repository for the sidebar buttons
*
* @param categories categories in repository
*/
private void setDefaultCategoryIcons(List<CategoryDTO> categories) {
Platform.runLater(() -> {
try {
StringBuilder cssBuilder = new StringBuilder();
for (CategoryDTO category : categories) {
cssBuilder.append("#" + ApplicationSidebarToggleGroupSkin.getToggleButtonId(category.getId()) + "{\n");
final String categoryIconPath = Optional.ofNullable(category.getIcon()).map(categoryIcon -> categoryIcon.toString()).orElse("/org/phoenicis/javafx/views/common/phoenicis.png");
cssBuilder.append(String.format("-fx-background-image: url('%s');\n", categoryIconPath));
cssBuilder.append("}\n");
}
String css = cssBuilder.toString();
Path temp = Files.createTempFile("defaultCategoryIcons", ".css").toAbsolutePath();
File tempFile = temp.toFile();
tempFile.deleteOnExit();
Files.write(temp, css.getBytes());
String defaultCategoryIconsCss = temp.toUri().toString();
this.themeManager.setDefaultCategoryIconsCss(defaultCategoryIconsCss);
} catch (IOException e) {
LOGGER.warn("Could not set default category icons.", e);
}
});
}
Aggregations