]> git.argeo.org Git - lgpl/argeo-commons.git/blob - swt/rap/org.argeo.cms.swt.rap/src/org/argeo/cms/web/WebThemeUtils.java
Merge tag 'v2.3.27' into testing
[lgpl/argeo-commons.git] / swt / rap / org.argeo.cms.swt.rap / src / org / argeo / cms / web / WebThemeUtils.java
1 package org.argeo.cms.web;
2
3 import org.argeo.api.cms.CmsLog;
4 import org.argeo.api.cms.ux.CmsTheme;
5 import org.eclipse.rap.rwt.application.Application;
6 import org.eclipse.rap.rwt.service.ResourceLoader;
7
8 /** Web specific utilities around theming. */
9 public class WebThemeUtils {
10 private final static CmsLog log = CmsLog.getLog(WebThemeUtils.class);
11
12 public static void apply(Application application, CmsTheme theme) {
13 ResourceLoader resourceLoader = new CmsThemeResourceLoader(theme);
14 resources: for (String path : theme.getImagesPaths()) {
15 if (path.startsWith("target/"))
16 continue resources; // skip maven output
17 application.addResource(path, resourceLoader);
18 if (log.isTraceEnabled())
19 log.trace("Theme " + theme.getThemeId() + ": added resource " + path);
20 }
21 for (String path : theme.getRapCssPaths()) {
22 application.addStyleSheet(theme.getThemeId(), path, resourceLoader);
23 if (log.isDebugEnabled())
24 log.debug("Theme " + theme.getThemeId() + ": added RAP CSS " + path);
25 }
26 }
27
28 }