From 0d09664471edab1033c304198d09b099d74bb3a7 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Sun, 2 May 2021 11:15:22 +0200 Subject: [PATCH] Improve default app. --- .../OSGI-INF/l10n/bundle.properties | 2 +- .../src/org/argeo/suite/ui/SuiteUi.java | 10 +++++----- .../OSGI-INF/l10n/bundle.properties | 1 + .../org.argeo.geo.ui/config/mapLayer.properties | 4 +++- .../org/argeo/support/openlayers/OverviewMap.java | 12 +++--------- .../OSGI-INF/l10n/bundle.properties | 1 + .../config/documentsLayer.properties | 6 ++++-- .../documents/ui/DocumentsFolderUiProvider.java | 13 ++++++++++++- .../OSGI-INF/l10n/bundle.properties | 1 + 9 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 environment/org.argeo.geo.ui/OSGI-INF/l10n/bundle.properties create mode 100644 library/org.argeo.documents.ui/OSGI-INF/l10n/bundle.properties create mode 100644 people/org.argeo.people.ui/OSGI-INF/l10n/bundle.properties diff --git a/core/org.argeo.suite.ui/OSGI-INF/l10n/bundle.properties b/core/org.argeo.suite.ui/OSGI-INF/l10n/bundle.properties index 3d08155..5716780 100644 --- a/core/org.argeo.suite.ui/OSGI-INF/l10n/bundle.properties +++ b/core/org.argeo.suite.ui/OSGI-INF/l10n/bundle.properties @@ -1,5 +1,5 @@ dashboard=dashboard -people=contacts +#people=contacts documents=documents locations=locations recentItems=recent items diff --git a/core/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java b/core/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java index 816c658..ca2d9c3 100644 --- a/core/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java +++ b/core/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java @@ -32,7 +32,7 @@ class SuiteUi extends Composite { private Composite dynamicArea; private Session sysSession; -// private Session homeSession; + private Session homeSession; private Node userDir; private Map layers = new HashMap<>(); @@ -205,11 +205,11 @@ class SuiteUi extends Composite { // synchronized void initSessions(Repository repository, String userDirPath) throws RepositoryException { this.sysSession = repository.login(); -// this.homeSession = repository.login(NodeConstants.HOME_WORKSPACE); + this.homeSession = repository.login(NodeConstants.HOME_WORKSPACE); userDir = sysSession.getNode(userDirPath); addDisposeListener((e) -> { Jcr.logout(sysSession); -// Jcr.logout(homeSession); + Jcr.logout(homeSession); }); } @@ -226,8 +226,8 @@ class SuiteUi extends Composite { return sysSession; if (NodeConstants.SYS_WORKSPACE.equals(workspaceName)) return sysSession; -// else if (NodeConstants.HOME_WORKSPACE.equals(workspaceName)) -// return homeSession; + else if (NodeConstants.HOME_WORKSPACE.equals(workspaceName)) + return homeSession; else throw new IllegalArgumentException("Unknown workspace " + workspaceName); } diff --git a/environment/org.argeo.geo.ui/OSGI-INF/l10n/bundle.properties b/environment/org.argeo.geo.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..3ded5eb --- /dev/null +++ b/environment/org.argeo.geo.ui/OSGI-INF/l10n/bundle.properties @@ -0,0 +1 @@ +map=map diff --git a/environment/org.argeo.geo.ui/config/mapLayer.properties b/environment/org.argeo.geo.ui/config/mapLayer.properties index 2931c2d..37bf3c7 100644 --- a/environment/org.argeo.geo.ui/config/mapLayer.properties +++ b/environment/org.argeo.geo.ui/config/mapLayer.properties @@ -1,4 +1,6 @@ service.pid=argeo.geo.ui.mapLayer title=%map -icon=map \ No newline at end of file +icon=map + +entity.type=entity:geopoint diff --git a/environment/org.argeo.geo.ui/src/org/argeo/support/openlayers/OverviewMap.java b/environment/org.argeo.geo.ui/src/org/argeo/support/openlayers/OverviewMap.java index 33e888f..8ecdc1c 100644 --- a/environment/org.argeo.geo.ui/src/org/argeo/support/openlayers/OverviewMap.java +++ b/environment/org.argeo.geo.ui/src/org/argeo/support/openlayers/OverviewMap.java @@ -9,10 +9,7 @@ import javax.jcr.observation.EventIterator; import javax.jcr.observation.EventListener; import javax.jcr.query.Query; -import org.argeo.api.NodeConstants; -import org.argeo.cms.auth.CurrentUser; import org.argeo.cms.ui.CmsUiProvider; -import org.argeo.cms.ui.CmsView; import org.argeo.cms.ui.util.CmsUiUtils; import org.argeo.entity.EntityType; import org.argeo.jcr.JcrException; @@ -45,8 +42,8 @@ public class OverviewMap implements CmsUiProvider { } }); } - }, Event.PROPERTY_CHANGED | Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED, - "/", true, null, nodeTypes, false); + }, Event.PROPERTY_CHANGED | Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED, "/", true, null, + nodeTypes, false); } catch (RepositoryException e) { throw new IllegalStateException("Cannot add JCR observer", e); } @@ -56,11 +53,8 @@ public class OverviewMap implements CmsUiProvider { protected void refreshUi(Composite parent, Node context) throws RepositoryException { CmsUiUtils.clear(parent); - boolean coworker = CmsView.getCmsView(parent).doAs(() -> CurrentUser.isInRole(NodeConstants.ROLE_USER_ADMIN)); Query query = context.getSession().getWorkspace().getQueryManager() - .createQuery("SELECT * FROM [" + EntityType.local.get() + "] WHERE [entity:type]='" - + EntityType.geopoint.get() + "'", - Query.JCR_SQL2); + .createQuery("SELECT * FROM [" + EntityType.geopoint.get() + "]", Query.JCR_SQL2); List geoPoints = JcrUtils.nodeIteratorToList(query.execute().getNodes()); OpenLayersMap apafMap = new OpenLayersMap(parent, SWT.NONE, getClass().getResource("map-osm.html")); apafMap.setLayoutData(CmsUiUtils.fillAll()); diff --git a/library/org.argeo.documents.ui/OSGI-INF/l10n/bundle.properties b/library/org.argeo.documents.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..8015421 --- /dev/null +++ b/library/org.argeo.documents.ui/OSGI-INF/l10n/bundle.properties @@ -0,0 +1 @@ +content=content diff --git a/library/org.argeo.documents.ui/config/documentsLayer.properties b/library/org.argeo.documents.ui/config/documentsLayer.properties index 1c62222..78382a6 100644 --- a/library/org.argeo.documents.ui/config/documentsLayer.properties +++ b/library/org.argeo.documents.ui/config/documentsLayer.properties @@ -1,4 +1,6 @@ service.pid=argeo.documents.ui.documentsLayer -title=Documents -icon=documents \ No newline at end of file +title=%content +icon=documents + +entity.type=nt:folder diff --git a/library/org.argeo.documents.ui/src/org/argeo/documents/ui/DocumentsFolderUiProvider.java b/library/org.argeo.documents.ui/src/org/argeo/documents/ui/DocumentsFolderUiProvider.java index 2210b9f..e525a9e 100644 --- a/library/org.argeo.documents.ui/src/org/argeo/documents/ui/DocumentsFolderUiProvider.java +++ b/library/org.argeo.documents.ui/src/org/argeo/documents/ui/DocumentsFolderUiProvider.java @@ -1,5 +1,6 @@ package org.argeo.documents.ui; +import java.nio.file.Path; import java.nio.file.spi.FileSystemProvider; import javax.jcr.Node; @@ -9,6 +10,8 @@ import org.argeo.cms.fs.CmsFsUtils; import org.argeo.cms.ui.CmsUiProvider; import org.argeo.cms.ui.CmsView; import org.argeo.cms.ui.util.CmsUiUtils; +import org.argeo.jcr.Jcr; +import org.argeo.suite.ui.SuiteEvent; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -20,7 +23,15 @@ public class DocumentsFolderUiProvider implements CmsUiProvider { @Override public Control createUi(Composite parent, Node context) throws RepositoryException { CmsView cmsView = CmsView.getCmsView(parent); - DocumentsFolderComposite dfc = new DocumentsFolderComposite(parent, SWT.NONE, context); + DocumentsFolderComposite dfc = new DocumentsFolderComposite(parent, SWT.NONE, context) { + + @Override + protected void externalNavigateTo(Path path) { + Node folderNode = cmsView.doAs(() -> CmsFsUtils.getNode(Jcr.getSession(context).getRepository(), path)); + parent.addDisposeListener((e1) -> Jcr.logout(folderNode)); + cmsView.sendEvent(SuiteEvent.openNewPart.topic(), SuiteEvent.eventProperties(folderNode)); + } + }; dfc.setLayoutData(CmsUiUtils.fillAll()); dfc.populate(cmsView.doAs(() -> CmsFsUtils.getPath(nodeFileSystemProvider, context))); return dfc; diff --git a/people/org.argeo.people.ui/OSGI-INF/l10n/bundle.properties b/people/org.argeo.people.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 0000000..e619de4 --- /dev/null +++ b/people/org.argeo.people.ui/OSGI-INF/l10n/bundle.properties @@ -0,0 +1 @@ +people=people -- 2.30.2