Fix Javadoc issue
[gpl/argeo-suite.git] / org.argeo.app.ui / src / org / argeo / app / ui / SuiteApp.java
index 271010dbd32c226fd3efc996b8aacc0b75714bbb..a8b9b2e26901c966a4ead4d6b8b4b3ed026516ba 100644 (file)
@@ -209,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);
@@ -220,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
@@ -265,7 +272,7 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber {
                                setState(ui, state != null ? state : defaultLayerPid);
                        }
                } catch (Exception e) {
-                       CmsFeedback.show("Unexpected exception", e);
+                       CmsFeedback.error("Unexpected exception", e);
                }
        }
 
@@ -423,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);
@@ -551,7 +563,7 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber {
                                        }
                                }
                        } catch (Exception e) {
-                               CmsFeedback.show("Cannot handle event " + event, e);
+                               CmsFeedback.error("Cannot handle event " + topic + " " + event, e);
 //                             log.error("Cannot handle event " + event, e);
                        }
                });
@@ -631,8 +643,9 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber {
                }
                if (properties.containsKey(EntityConstants.TYPE)) {
                        List<String> types = LangUtils.toStringList(properties.get(EntityConstants.TYPE));
-                       for (String type : types)
+                       for (String type : types) {
                                RankedObject.putIfHigherRank(uiProvidersByType, type, uiProvider, properties);
+                       }
                }
        }
 
@@ -657,6 +670,32 @@ public class SuiteApp extends AbstractCmsApp implements CmsEventSubscriber {
                }
        }
 
+//     public void addLayer(SuiteLayer layer, Map<String, Object> 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<String> 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<SuiteLayer> current = layersByPid.get(pid);
+//                             List<String> 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<String, Object> properties) {
                if (properties.containsKey(Constants.SERVICE_PID)) {
                        String pid = (String) properties.get(Constants.SERVICE_PID);