Improve scripted theming
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 9 Dec 2018 10:19:14 +0000 (11:19 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 9 Dec 2018 10:19:14 +0000 (11:19 +0100)
org.argeo.cms.ui/src/org/argeo/cms/script/Branding.java
org.argeo.cms.ui/src/org/argeo/cms/script/Theme.java

index 2a99191d27b5793bc12b05faf52553eeca247521..39b5b531ec284d63aa959163765973117288caa3 100644 (file)
@@ -2,8 +2,6 @@ package org.argeo.cms.script;
 
 import java.util.Map;
 
-import org.eclipse.rap.rwt.client.WebClient;
-
 public interface Branding {
        public void applyBranding(Map<String, String> properties);
 
index 3fa4bc451edae6b324603c5a0dadf5840a1e6bbe..c256a69209233bb9a07e4a6cca50f722c37ff2ae 100644 (file)
@@ -18,6 +18,7 @@ import org.apache.commons.logging.LogFactory;
 import org.argeo.cms.CmsException;
 import org.argeo.cms.util.BundleResourceLoader;
 import org.argeo.cms.util.ThemeUtils;
+import org.eclipse.rap.rwt.RWT;
 import org.eclipse.rap.rwt.application.Application;
 import org.eclipse.rap.rwt.service.ResourceLoader;
 import org.osgi.framework.Bundle;
@@ -26,7 +27,7 @@ import org.osgi.framework.BundleContext;
 public class Theme {
        private final static Log log = LogFactory.getLog(Theme.class);
 
-       private final String themeId;
+       private String themeId;
        private Map<String, ResourceLoader> css = new HashMap<>();
        private Map<String, ResourceLoader> resources = new HashMap<>();
 
@@ -44,14 +45,14 @@ public class Theme {
                Bundle themeBundle;
                if (symbolicName == null) {
                        themeBundle = bundleContext.getBundle();
-                       basePath = "/theme/internal/";
-                       cssPath = basePath;
+//                     basePath = "/theme/";
+//                     cssPath = basePath;
                } else {
                        themeBundle = ThemeUtils.findThemeBundle(bundleContext, symbolicName);
-                       basePath = "/";
-                       cssPath = "/rap/";
                }
-               this.themeId = themeBundle.getSymbolicName();
+               basePath = "/";
+               cssPath = "/rap/";
+               this.themeId = RWT.DEFAULT_THEME_ID;
                addStyleSheets(themeBundle, new BundleResourceLoader(themeBundle));
                BundleResourceLoader themeBRL = new BundleResourceLoader(themeBundle);
                addResources(themeBRL, "*.png");
@@ -165,6 +166,10 @@ public class Theme {
                return themeId;
        }
 
+       public void setThemeId(String themeId) {
+               this.themeId = themeId;
+       }
+
        public String getBasePath() {
                return basePath;
        }