From: Mathieu Baudier Date: Tue, 27 Oct 2020 08:13:22 +0000 (+0100) Subject: Improve CMS App. X-Git-Tag: argeo-commons-2.1.89~52 X-Git-Url: http://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=commitdiff_plain;h=fea7cd546f9c04c00f961918919dd6307c32cc8e Improve CMS App. --- diff --git a/org.argeo.cms.ui.rap/src/org/argeo/cms/web/CmsWebApp.java b/org.argeo.cms.ui.rap/src/org/argeo/cms/web/CmsWebApp.java index a4088eedc..ca26c5830 100644 --- a/org.argeo.cms.ui.rap/src/org/argeo/cms/web/CmsWebApp.java +++ b/org.argeo.cms.ui.rap/src/org/argeo/cms/web/CmsWebApp.java @@ -86,15 +86,17 @@ public class CmsWebApp implements ApplicationConfiguration, ExceptionHandler, Cm // if (themeId != null) // log.warn("Theme id " + themeId + " was specified but it was not found, using default RWT theme."); } - application.addEntryPoint("/" + uiName, () -> { + String entryPointName = !uiName.equals("") ? "/" + uiName : "/"; + application.addEntryPoint(entryPointName, () -> { CmsWebEntryPoint entryPoint = new CmsWebEntryPoint(this, uiName); entryPoint.setEventAdmin(eventAdmin); return entryPoint; }, properties); if (log.isDebugEnabled()) - log.info("Added web entry point /" + (contextName != null ? contextName : "") + "/" + uiName); + log.info("Added web entry point " + (contextName != null ? "/" + contextName : "") + entryPointName); } - log.debug("Published CMS web app /" + (contextName != null ? contextName : "")); + if (log.isDebugEnabled()) + log.debug("Published CMS web app /" + (contextName != null ? contextName : "")); } // private void registerIfAllThemesAvailable() { diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/AbstractCmsApp.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/AbstractCmsApp.java index 98f9adfa0..2ecc65841 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/AbstractCmsApp.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/AbstractCmsApp.java @@ -5,7 +5,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import javax.jcr.Repository; @@ -19,12 +18,6 @@ public abstract class AbstractCmsApp implements CmsApp { private Repository repository; - @Override - public Set getUiNames() { - // TODO Auto-generated method stub - return null; - } - protected abstract String getThemeId(String uiName); @Override diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/util/BundleCmsTheme.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/util/BundleCmsTheme.java index a4749fbab..c86ba3601 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/util/BundleCmsTheme.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/util/BundleCmsTheme.java @@ -135,28 +135,30 @@ public class BundleCmsTheme extends AbstractCmsTheme { Set addCss(Bundle themeBundle, String path) { Set paths = new TreeSet<>(); - Enumeration themeResources = themeBundle.findEntries(path, "*.css", true); - if (themeResources == null) - return paths; - while (themeResources.hasMoreElements()) { - String resource = themeResources.nextElement().getPath(); - // remove first '/' so that RWT registers it - resource = resource.substring(1); - if (!resource.endsWith("/")) { - paths.add(resource); - } - } // common CSS Enumeration commonResources = themeBundle.findEntries(styleCssPath, "*.css", true); - if (commonResources == null) - return paths; - while (commonResources.hasMoreElements()) { - String resource = commonResources.nextElement().getPath(); - // remove first '/' so that RWT registers it - resource = resource.substring(1); - if (!resource.endsWith("/")) { - paths.add(resource); + if (commonResources != null) { + while (commonResources.hasMoreElements()) { + String resource = commonResources.nextElement().getPath(); + // remove first '/' so that RWT registers it + resource = resource.substring(1); + if (!resource.endsWith("/")) { + paths.add(resource); + } + } + } + + // specific CSS + Enumeration themeResources = themeBundle.findEntries(path, "*.css", true); + if (themeResources != null) { + while (themeResources.hasMoreElements()) { + String resource = themeResources.nextElement().getPath(); + // remove first '/' so that RWT registers it + resource = resource.substring(1); + if (!resource.endsWith("/")) { + paths.add(resource); + } } } return paths; @@ -277,4 +279,14 @@ public class BundleCmsTheme extends AbstractCmsTheme { return themeBundle; } + @Override + public int hashCode() { + return themeId.hashCode(); + } + + @Override + public String toString() { + return "Bundle CMS Theme " + themeId; + } + }