Improve Argeo Knowledge app.
authorMathieu Baudier <mbaudier@argeo.org>
Sat, 17 Jun 2023 05:05:05 +0000 (07:05 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Sat, 17 Jun 2023 05:05:05 +0000 (07:05 +0200)
12 files changed:
org.argeo.product.knowledge/OSGI-INF/leadPane.xml
org.argeo.product.knowledge/OSGI-INF/spaceEntryArea.xml [new file with mode: 0644]
org.argeo.product.knowledge/OSGI-INF/structureLayer.xml [new file with mode: 0644]
org.argeo.product.knowledge/OSGI-INF/swtArgeoApp.xml
org.argeo.product.knowledge/OSGI-INF/termsEntryArea.xml
org.argeo.product.knowledge/OSGI-INF/termsLayer.xml
org.argeo.product.knowledge/bnd.bnd
org.argeo.product.knowledge/config/spaceEntryArea.properties [new file with mode: 0644]
org.argeo.product.knowledge/config/structureLayer.properties [new file with mode: 0644]
org.argeo.product.knowledge/config/termsLayer.properties
swt/org.argeo.app.swt/src/org/argeo/app/swt/space/SpaceEntryArea.java [new file with mode: 0644]
swt/org.argeo.app.swt/src/org/argeo/app/swt/terms/TermsEntryArea.java

index 968b65a316c7970bb706596992b08e86d7a22b5a..81a880c83b40184fd3c8603bb148a5ac003bcc2d 100644 (file)
@@ -6,7 +6,8 @@
    </service>
    <property name="service.ranking" type="Integer" value="-1000"/>
    <properties entry="config/leadPane.properties"/>
-   <property name="defaultLayers" type="String">argeo.product.knowledge.termsLayer
+   <property name="defaultLayers" type="String">argeo.product.knowledge.structureLayer
+argeo.product.knowledge.termsLayer
    </property>
    <reference bind="addLayer" cardinality="1..n" interface="org.argeo.app.swt.ux.SwtAppLayer" name="SuiteLayer" policy="dynamic" unbind="removeLayer"/>
 </scr:component>
diff --git a/org.argeo.product.knowledge/OSGI-INF/spaceEntryArea.xml b/org.argeo.product.knowledge/OSGI-INF/spaceEntryArea.xml
new file mode 100644 (file)
index 0000000..34f9278
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="argeo.product.knowledge.spaceEntryArea">
+   <implementation class="org.argeo.app.swt.space.SpaceEntryArea"/>
+   <service>
+      <provide interface="org.argeo.cms.swt.acr.SwtUiProvider"/>
+   </service>
+   <property name="service.ranking" type="Integer" value="-1000"/>
+   <properties entry="config/spaceEntryArea.properties"/>
+</scr:component>
diff --git a/org.argeo.product.knowledge/OSGI-INF/structureLayer.xml b/org.argeo.product.knowledge/OSGI-INF/structureLayer.xml
new file mode 100644 (file)
index 0000000..68753f6
--- /dev/null
@@ -0,0 +1,10 @@
+<?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">
+   <implementation class="org.argeo.app.swt.ux.DefaultEditionLayer"/>
+   <service>
+      <provide interface="org.argeo.app.swt.ux.SwtAppLayer"/>
+   </service>
+   <property name="service.ranking" type="Integer" value="-1000"/>
+   <properties entry="config/structureLayer.properties"/>
+   <reference bind="setEntryArea" cardinality="1..1" interface="org.argeo.cms.swt.acr.SwtUiProvider" name="CmsUiProvider" policy="dynamic" target="(service.pid=argeo.product.knowledge.spaceEntryArea)"/>
+</scr:component>
index a278899ea94c207175f2a0f3cdbf4935532739cb..1d9358215b66500f7c8d0b7ed3a47c12f8f4ae95 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" activate="start" deactivate="stop" name="org.argeo.product.knowledge.swtArgeoApp">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" activate="start" deactivate="stop" name="argeo.product.knowledge.swtArgeoApp">
    <implementation class="org.argeo.app.swt.ux.SwtArgeoApp"/>
    <service>
       <provide interface="org.argeo.api.cms.CmsApp"/>
index 404ebc36260f30afdbcc4c750661793ed21b27c4..07b259d795b9dc15372e0703b3b18a8595c3bd23 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="Terms Entry Area">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="argeo.product.knowledge.termsEntryArea">
    <implementation class="org.argeo.app.swt.terms.TermsEntryArea"/>
    <service>
       <provide interface="org.argeo.cms.swt.acr.SwtUiProvider"/>
index 3fec7efbaaa5d7f11b21b6194dc85325da219f71..5849ebc14cd9f410b4ec9e51d68ff5636c883327 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="Terms Layer">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="argeo.product.knowledge.termsLayer">
    <implementation class="org.argeo.app.swt.ux.DefaultEditionLayer"/>
    <service>
       <provide interface="org.argeo.app.swt.ux.SwtAppLayer"/>
index a91678c765ae3a22f37159e81fe0faa9d2a759c4..c3754ceb952255783591a027076b869aa713f208 100644 (file)
@@ -1,11 +1,15 @@
 Service-Component:\
 OSGI-INF/swtArgeoApp.xml,\
 OSGI-INF/leadPane.xml,\
+OSGI-INF/spaceEntryArea.xml,\
+OSGI-INF/structureLayer.xml,\
 OSGI-INF/termsEntryArea.xml,\
 OSGI-INF/termsLayer.xml,\
 
 Import-Package:\
+org.argeo.app.api,\
 org.argeo.cms.swt.acr,\
 org.argeo.app.swt.ux,\
 org.argeo.app.swt.terms,\
+org.argeo.app.swt.space,\
 *
\ No newline at end of file
diff --git a/org.argeo.product.knowledge/config/spaceEntryArea.properties b/org.argeo.product.knowledge/config/spaceEntryArea.properties
new file mode 100644 (file)
index 0000000..09bbf25
--- /dev/null
@@ -0,0 +1 @@
+service.pid=argeo.product.knowledge.spaceEntryArea
diff --git a/org.argeo.product.knowledge/config/structureLayer.properties b/org.argeo.product.knowledge/config/structureLayer.properties
new file mode 100644 (file)
index 0000000..14b9f6b
--- /dev/null
@@ -0,0 +1,6 @@
+service.pid=argeo.product.knowledge.structureLayer
+
+title=Structure
+icon=folder
+
+#entity.type=entity:space
\ No newline at end of file
index be7abcc9ccd082edc123d138b8014999255dfe8b..e6b9a094de9c3b907698ba46fb6adad58e3802f6 100644 (file)
@@ -3,4 +3,4 @@ service.pid=argeo.product.knowledge.termsLayer
 title=Terms
 icon=dashboard
 
-entity.type=entity:terms,entity:term
\ No newline at end of file
+entity.type=entity:terms,entity:term,entity:typologies
\ No newline at end of file
diff --git a/swt/org.argeo.app.swt/src/org/argeo/app/swt/space/SpaceEntryArea.java b/swt/org.argeo.app.swt/src/org/argeo/app/swt/space/SpaceEntryArea.java
new file mode 100644 (file)
index 0000000..2c28a79
--- /dev/null
@@ -0,0 +1,59 @@
+package org.argeo.app.swt.space;
+
+import java.net.URI;
+import java.util.List;
+
+import org.argeo.api.acr.Content;
+import org.argeo.api.acr.NamespaceUtils;
+import org.argeo.api.acr.spi.ProvidedContent;
+import org.argeo.api.cms.ux.CmsView;
+import org.argeo.app.api.EntityType;
+import org.argeo.cms.swt.CmsSwtUtils;
+import org.argeo.cms.swt.acr.SwtUiProvider;
+import org.argeo.cms.swt.widgets.SwtTreeView;
+import org.argeo.cms.ux.acr.ContentHierarchicalPart;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/** Entry area for managing the typologies. */
+public class SpaceEntryArea implements SwtUiProvider {
+       @Override
+       public Control createUiPart(Composite parent, Content content) {
+               CmsView cmsView = CmsSwtUtils.getCmsView(parent);
+
+               parent.setLayout(new GridLayout());
+
+               ContentHierarchicalPart contentPart = new ContentHierarchicalPart() {
+
+                       @Override
+                       public List<Content> getChildren(Content parent) {
+                               if (parent != null)
+                                       return super.getChildren(parent);
+                               List<Content> res = ((ProvidedContent) content).getSession().search((bs) -> {
+                                       bs.from(URI.create("/sys")).where((f) -> f.isContentClass(EntityType.space));
+                               }).filter((c) -> noSpaceParent((ProvidedContent) c)).toList();
+                               return res;
+                       }
+
+               };
+               contentPart.addColumn((c) -> NamespaceUtils.toPrefixedName(c.getName()));
+//             contentPart.setInput(content);
+
+               SwtTreeView<Content> view = new SwtTreeView<>(parent, 0, contentPart);
+               view.setLayoutData(CmsSwtUtils.fillAll());
+
+               contentPart.setInput(null);
+               return view;
+
+       }
+
+       private static boolean noSpaceParent(ProvidedContent content) {
+               if (content.isRoot() || !content.isParentAccessible())// end condition
+                       return true;
+               ProvidedContent parent = (ProvidedContent) content.getParent();
+               if (parent.hasContentClass(EntityType.space))
+                       return false;
+               return noSpaceParent(parent);
+       }
+}
index 7ae2531f413f048712f65cfb7aea6d7240c173e6..912c43f100951f92bf9d4b8a9033a6f2ba40c054 100644 (file)
@@ -48,7 +48,7 @@ public class TermsEntryArea implements SwtUiProvider {
 
                };
                contentPart.addColumn((c) -> NamespaceUtils.toPrefixedName(c.getName()));
-               contentPart.setInput(rootContent);
+//             contentPart.setInput(rootContent);
 
                SwtTreeView<Content> view = new SwtTreeView<>(parent, 0, contentPart);
                view.setLayoutData(CmsSwtUtils.fillAll());