Working read-only DocBook
authorMathieu Baudier <mbaudier@argeo.org>
Sat, 17 Jun 2023 10:51:05 +0000 (12:51 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Sat, 17 Jun 2023 10:51:05 +0000 (12:51 +0200)
org.argeo.product.knowledge/OSGI-INF/structureLayer.xml
org.argeo.product.knowledge/OSGI-INF/termsLayer.xml
swt/org.argeo.app.swt/src/org/argeo/app/swt/ux/DefaultEditionLayer.java
swt/org.argeo.app.swt/src/org/argeo/app/swt/ux/SwtAppUi.java
swt/org.argeo.app.ui/OSGI-INF/contentLayer.xml
swt/org.argeo.app.ui/OSGI-INF/leadPane.xml

index 68753f69ebb494a34c23bd106e30217dd31fd9a6..5d77e201e2e923414cd23cb7b37c3e8635cbdccb 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="argeo.product.knowledge.structureLayer">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="init" deactivate="destroy" name="argeo.product.knowledge.structureLayer">
    <implementation class="org.argeo.app.swt.ux.DefaultEditionLayer"/>
    <service>
       <provide interface="org.argeo.app.swt.ux.SwtAppLayer"/>
index 5849ebc14cd9f410b4ec9e51d68ff5636c883327..c3e88822b3e842f7068190e1f844b845aacff48e 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="argeo.product.knowledge.termsLayer">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="init" deactivate="destroy" name="argeo.product.knowledge.termsLayer">
    <implementation class="org.argeo.app.swt.ux.DefaultEditionLayer"/>
    <service>
       <provide interface="org.argeo.app.swt.ux.SwtAppLayer"/>
index fd5dca7238c8483290e3ddd320a9a1219c732951..109dd22d4ffe88188887ff25369b3eea7688ff52 100644 (file)
@@ -3,6 +3,7 @@ package org.argeo.app.swt.ux;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import org.argeo.api.acr.Content;
 import org.argeo.app.ux.SuiteIcon;
@@ -130,6 +131,7 @@ public class DefaultEditionLayer implements SwtAppLayer {
        public void init(BundleContext bundleContext, Map<String, Object> properties) {
                String pid = (String) properties.get(Constants.SERVICE_PID);
                id = pid;
+               Objects.requireNonNull(id, "Layer id must be set.");
 
                weights = LangUtils.toStringList(properties.get(Property.weights.name()));
                startMaximized = properties.containsKey(Property.startMaximized.name())
index f5ad2572e7a1f46b10ba0c11c9a71238e6e18d03..9654a8ed81c67a8ee68e5e7c8565b7e773161c09 100644 (file)
@@ -153,6 +153,11 @@ public class SwtAppUi extends CmsSwtUi implements AppUi {
        }
 
        public void addLayer(String id, SwtAppLayer layer) {
+               if (!id.equals(layer.getId())) {
+                       log.error("Layer id as key '" + id + "' is not consistent with layer id '" + layer.getId()
+                                       + "', ignoring...");
+                       return;
+               }
                layers.put(id, layer);
        }
 
index 9a550f4445b99e3bef238168167b7da742eab47e..37622b82dca930035a3e4a3e25ba33cf16d768cf 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="Content Layer">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="init" deactivate="destroy" name="Content Layer">
    <implementation class="org.argeo.app.swt.ux.DefaultEditionLayer"/>
    <service>
       <provide interface="org.argeo.app.swt.ux.SwtAppLayer"/>
index 57a746863ba45222300aa9bea6a00b746db675f8..9c0df65b595826fdf441317aacf7e7cae83400e2 100644 (file)
@@ -8,6 +8,7 @@
    <properties entry="config/leadPane.properties"/>
    <property name="defaultLayers" type="String">argeo.suite.ui.dashboardLayer
 argeo.library.ui.contentLayer
+argeo.product.knowledge.structureLayer
 argeo.people.ui.peopleLayer
 argeo.geo.ui.mapLayer
    </property>