use of org.ambraproject.wombat.config.theme.ThemeSource in project wombat by PLOS.
the class SpringConfiguration method themeGraph.
@Bean
public ThemeGraph themeGraph(ServletContext servletContext, RuntimeConfiguration runtimeConfiguration) throws ThemeGraph.ThemeConfigurationException, IOException {
String path = "/WEB-INF/themes/";
InternalTheme root = new InternalTheme(".Root", ImmutableList.of(), servletContext, path + "root/");
InternalTheme desktop = new InternalTheme(".Desktop", ImmutableList.of(root), servletContext, path + "desktop/");
InternalTheme mobile = new InternalTheme(".Mobile", ImmutableList.of(root), servletContext, path + "mobile/");
Collection<InternalTheme> internalThemes = ImmutableList.of(root, desktop, mobile);
Collection<ThemeSource<?>> themeSources = runtimeConfiguration.getThemeSources();
Collection<ThemeBuilder<?>> themeBuilders = themeSources.stream().flatMap(ts -> ts.readThemes().stream()).collect(Collectors.toList());
return ThemeGraph.create(root, internalThemes, themeBuilders);
}
Aggregations