X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=rap%2Forg.argeo.cms.ui.rap%2Fsrc%2Forg%2Fargeo%2Fcms%2Fweb%2FWebThemeUtils.java;fp=rap%2Forg.argeo.cms.ui.rap%2Fsrc%2Forg%2Fargeo%2Fcms%2Fweb%2FWebThemeUtils.java;h=a28b13fc6ce322cfd97936fe3cf2bde8ef9f7be1;hb=f9efbe5228615951dd8482a4582aa24e00c10ce5;hp=0000000000000000000000000000000000000000;hpb=af817c9bebfa3187f9a64c3e6aadb933dac148c8;p=lgpl%2Fargeo-commons.git diff --git a/rap/org.argeo.cms.ui.rap/src/org/argeo/cms/web/WebThemeUtils.java b/rap/org.argeo.cms.ui.rap/src/org/argeo/cms/web/WebThemeUtils.java new file mode 100644 index 000000000..a28b13fc6 --- /dev/null +++ b/rap/org.argeo.cms.ui.rap/src/org/argeo/cms/web/WebThemeUtils.java @@ -0,0 +1,29 @@ +package org.argeo.cms.web; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.argeo.api.cms.CmsTheme; +import org.eclipse.rap.rwt.application.Application; +import org.eclipse.rap.rwt.service.ResourceLoader; + +/** Web specific utilities around theming. */ +public class WebThemeUtils { + private final static Log log = LogFactory.getLog(WebThemeUtils.class); + + public static void apply(Application application, CmsTheme theme) { + ResourceLoader resourceLoader = new CmsThemeResourceLoader(theme); + resources: for (String path : theme.getImagesPaths()) { + if (path.startsWith("target/")) + continue resources; // skip maven output + application.addResource(path, resourceLoader); + if (log.isTraceEnabled()) + log.trace("Theme " + theme.getThemeId() + ": added resource " + path); + } + for (String path : theme.getRapCssPaths()) { + application.addStyleSheet(theme.getThemeId(), path, resourceLoader); + if (log.isDebugEnabled()) + log.debug("Theme " + theme.getThemeId() + ": added RAP CSS " + path); + } + } + +}