X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.app.ui%2Fsrc%2Forg%2Fargeo%2Fapp%2Fui%2FSuiteApp.java;h=a8b9b2e26901c966a4ead4d6b8b4b3ed026516ba;hb=f1b87af2e0de38f1f49ab8fe68f9988018914811;hp=9ad2673fc1216d79746a5de580c2a6b7f56dc359;hpb=e43d6397b40323e6d23ac52500d022cc2dc622f1;p=gpl%2Fargeo-suite.git diff --git a/org.argeo.app.ui/src/org/argeo/app/ui/SuiteApp.java b/org.argeo.app.ui/src/org/argeo/app/ui/SuiteApp.java index 9ad2673..a8b9b2e 100644 --- a/org.argeo.app.ui/src/org/argeo/app/ui/SuiteApp.java +++ b/org.argeo.app.ui/src/org/argeo/app/ui/SuiteApp.java @@ -2,7 +2,6 @@ package org.argeo.app.ui; import static org.argeo.api.cms.ux.CmsView.CMS_VIEW_UID_PROPERTY; -import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -210,6 +209,7 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber { if (cmsView.isAnonymous() && publicBasePath == null) {// internal app, must login ui.logout(); + ui.setLoginScreen(true); if (headerUiProvider != null) refreshPart(headerUiProvider, ui.getHeader(), context); ui.refreshBelowHeader(false); @@ -221,6 +221,12 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber { } else { if (LOGIN.equals(state)) state = null; + if (ui.isLoginScreen()) { +// if (state == null) +// state = ui.getPostLoginState(); + ui.setLoginScreen(false); +// ui.setPostLoginState(null); + } CmsSession cmsSession = cmsView.getCmsSession(); if (ui.getUserDirNode() == null) { // FIXME NPE on CMSSession when logging in from anonymous @@ -424,6 +430,11 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber { return; } SuiteUi suiteUi = (SuiteUi) cmsUi; + if (suiteUi.isLoginScreen()) { +// suiteUi.setPostLoginState(state); + return; + } + Content node = stateToNode(suiteUi, state); if (node == null) { suiteUi.getCmsView().navigateTo(HOME_STATE); @@ -552,7 +563,7 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber { } } } catch (Exception e) { - CmsFeedback.error("Cannot handle event " + event, e); + CmsFeedback.error("Cannot handle event " + topic + " " + event, e); // log.error("Cannot handle event " + event, e); } }); @@ -659,27 +670,39 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber { } } +// public void addLayer(SuiteLayer layer, Map properties) { +// if (!properties.containsKey(Constants.SERVICE_PID)) +// throw new IllegalArgumentException("A layer must have an ID"); +// String pid = (String) properties.get(Constants.SERVICE_PID); +// List types = properties.containsKey(EntityConstants.TYPE) +// ? LangUtils.toStringList(properties.get(EntityConstants.TYPE)) +// : new ArrayList<>(); +// if (types.isEmpty()) { +// RankedObject.putIfHigherRank(layersByPid, pid, layer, properties); +// } else { +// if (layersByPid.containsKey(pid)) { +// RankedObject current = layersByPid.get(pid); +// List currentTypes = current.getProperties().containsKey(EntityConstants.TYPE) +// ? LangUtils.toStringList(current.getProperties().get(EntityConstants.TYPE)) +// : new ArrayList<>(); +// if (!types.containsAll(currentTypes)) { +// throw new IllegalArgumentException("Higher-ranked layer " + pid + " contains only types " + types +// + ", while it must override all " + currentTypes); +// } +// } +// RankedObject.putIfHigherRank(layersByPid, pid, layer, properties); +// for (String type : types) +// RankedObject.putIfHigherRank(layersByType, type, layer, properties); +// } +// } + public void addLayer(SuiteLayer layer, Map properties) { - if (!properties.containsKey(Constants.SERVICE_PID)) - throw new IllegalArgumentException("A layer must have an ID"); - String pid = (String) properties.get(Constants.SERVICE_PID); - List types = properties.containsKey(EntityConstants.TYPE) - ? LangUtils.toStringList(properties.get(EntityConstants.TYPE)) - : new ArrayList<>(); - if (types.isEmpty()) { - RankedObject.putIfHigherRank(layersByPid, pid, layer, properties); - } else { - if (layersByPid.containsKey(pid)) { - RankedObject current = layersByPid.get(pid); - List currentTypes = current.getProperties().containsKey(EntityConstants.TYPE) - ? LangUtils.toStringList(current.getProperties().get(EntityConstants.TYPE)) - : new ArrayList<>(); - if (!types.containsAll(currentTypes)) { - throw new IllegalArgumentException("Higher-ranked layer " + pid + " contains only types " + types - + ", while it must override all " + currentTypes); - } - } + if (properties.containsKey(Constants.SERVICE_PID)) { + String pid = (String) properties.get(Constants.SERVICE_PID); RankedObject.putIfHigherRank(layersByPid, pid, layer, properties); + } + if (properties.containsKey(EntityConstants.TYPE)) { + List types = LangUtils.toStringList(properties.get(EntityConstants.TYPE)); for (String type : types) RankedObject.putIfHigherRank(layersByType, type, layer, properties); }