From 744aebcf2c037665f2bf309e0f21221072a12bf9 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 8 Nov 2022 10:45:39 +0100 Subject: [PATCH] #23955 timeline facility first release --- .../client/GeoportalDataViewer.java | 29 +-- .../relation/TimelineManagerStatus.java | 60 ++++++ .../relation/TimelineRelationPanel.java | 28 ++- .../relation/TimelineRelationPanel.ui.xml | 21 +- src/main/webapp/GeoportalDataViewer.css | 38 +++- src/main/webapp/GeoportalDataViewer.html | 3 +- src/main/webapp/GeoportalDataViewer2.html | 191 ------------------ .../GeoPortalDataViewerAppPortlet_view.jsp | 9 +- 8 files changed, 140 insertions(+), 239 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineManagerStatus.java delete mode 100644 src/main/webapp/GeoportalDataViewer2.html diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java index fd61a90..10946c3 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/GeoportalDataViewer.java @@ -9,7 +9,6 @@ import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences; import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV; import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON; import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV; -import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV; import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView; import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION; @@ -48,7 +47,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils; import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap; import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages; import org.gcube.portlets.user.geoportaldataviewer.client.ui.GeonaDataViewMainPanel; -import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineRelationPanel; +import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineManagerStatus; import org.gcube.portlets.user.geoportaldataviewer.client.util.ControlledCallBack; import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon; import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection; @@ -126,6 +125,8 @@ public class GeoportalDataViewer implements EntryPoint { private static List listBaseMapLayers = null; private static ViewerStatus viewerStatus = new ViewerStatus(); + + private TimelineManagerStatus timelineMS = new TimelineManagerStatus(applicationBus); /** * This is the entry point method. @@ -146,7 +147,7 @@ public class GeoportalDataViewer implements EntryPoint { // RootPanel.get(APP_DIV).add(loaderApp); - hideTimelineProjectRelations(); + timelineMS.hideTimelineProjectRelations(); GeoportalDataViewerServiceAsync.Util.getInstance() .getConfigListOfFieldsForSearching(new AsyncCallback>() { @@ -395,12 +396,8 @@ public class GeoportalDataViewer implements EntryPoint { if (showDetailsEvent.isLoadTimelineRelationships() && relationships!= null && relationships.size() > 0) { GWT.log("LoadTimelineRelationships is true and the project has Relationships"); - showTimelineProjectRelations(result.getTheProjectDV()); + timelineMS.showTimelineProjectRelations(result.getTheProjectDV()); } -// else { -// hideTimelineProjectRelations(); -// } - } }); @@ -532,12 +529,12 @@ public class GeoportalDataViewer implements EntryPoint { switch (timelineProjectRelationsEvent.getEventType()) { case SHOW: { - showTimelineProjectRelations(timelineProjectRelationsEvent.getTheProjectDV()); + timelineMS.showTimelineProjectRelations(timelineProjectRelationsEvent.getTheProjectDV()); break; } case HIDE: default: { - hideTimelineProjectRelations(); + timelineMS.hideTimelineProjectRelations(); break; } } @@ -669,19 +666,7 @@ public class GeoportalDataViewer implements EntryPoint { // // }-*/; - private void showTimelineProjectRelations(ProjectDV theProject) { - GWT.log("Showing project relations for: " + theProject); - RootPanel.get(DIV_TIMELINE_DATA).clear(); - RootPanel.get(DIV_TIMELINE_DATA).setVisible(true); - TimelineRelationPanel timeline = new TimelineRelationPanel(applicationBus, theProject); - RootPanel.get(DIV_TIMELINE_DATA).add(timeline); - } - private void hideTimelineProjectRelations() { - GWT.log("hideTimelineProjectRelations"); - RootPanel.get(DIV_TIMELINE_DATA).setVisible(false); - RootPanel.get(DIV_TIMELINE_DATA).clear(); - } private void performWFSQueryOnCentroid(String projectID, Double centroidLong, Double centroidLat) { GWT.log("Perform performWFSQueryOnCentroid: " + projectID + " long: " + centroidLong + ", lat: " + centroidLat); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineManagerStatus.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineManagerStatus.java new file mode 100644 index 0000000..94e94a1 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineManagerStatus.java @@ -0,0 +1,60 @@ +package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation; + +import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV; +import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.shared.HandlerManager; +import com.google.gwt.user.client.ui.RootPanel; + +public class TimelineManagerStatus { + + private ProjectDV showingProject; + private HandlerManager applicationBus; + + public TimelineManagerStatus(HandlerManager applicationBus) { + this.applicationBus = applicationBus; + } + + protected TimelineRelationPanel getTimelineOf(ProjectDV theProject) { + + if (showingProject == null) { + GWT.log("Displaying new Timeline of " + theProject); + this.showingProject = theProject; + return new TimelineRelationPanel(applicationBus, theProject); + } else { + + boolean c1 = showingProject.getId().compareTo(theProject.getId()) == 0; + boolean c2 = showingProject.getProfileID().compareTo(theProject.getProfileID()) == 0; + + if (!c1 || !c2) { + GWT.log("Displaying Timeline of " + theProject); + this.showingProject = theProject; + return new TimelineRelationPanel(applicationBus, theProject); + } + + GWT.log("Skipping already displayed Timeline of " + theProject); + return null; + + } + + } + + public void showTimelineProjectRelations(ProjectDV theProject) { + GWT.log("Showing project relations for: " + theProject); + + TimelineRelationPanel timeline = getTimelineOf(theProject); + if (timeline != null) { + RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear(); + RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true); + RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).add(timeline); + } + } + + public void hideTimelineProjectRelations() { + GWT.log("hideTimelineProjectRelations"); + RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false); + RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear(); + } + +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineRelationPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineRelationPanel.java index e7c6b9c..4c6bba5 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineRelationPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineRelationPanel.java @@ -16,12 +16,15 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.dom.client.Style.TextAlign; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONParser; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.Anchor; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTMLPanel; @@ -35,7 +38,10 @@ public class TimelineRelationPanel extends Composite { ScrollPanel timelineContainer; @UiField - HTMLPanel timelineTitle; + HTMLPanel timelineHeader; + + @UiField + Anchor timelinePopupCloser; private LoaderIcon loaderData = new LoaderIcon("Loading data... please wait", new Image(GNAImages.ICONS.spinnerClock())); @@ -60,13 +66,29 @@ public class TimelineRelationPanel extends Composite { String html = ProjectUtil.toHMLCode(theProjectDV.getTheDocument()); HTML title = new HTML("Relationships of the Project" + "
" + html); - timelineTitle.add(title); + timelineHeader.add(title); + timelineContainer.getElement().setId("timeline-content"); + timelineHeader.getElement().setId("timeline-header"); loaderData.getElement().getStyle().setTextAlign(TextAlign.CENTER); timelineContainer.getElement().setId("visualization"); timelineContainer.add(loaderData); + + + timelinePopupCloser.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + + if(timelineContainer.isVisible()) + timelineContainer.setVisible(false); + else + timelineContainer.setVisible(true); + + } + }); Scheduler.get().scheduleDeferred(new ScheduledCommand() { @@ -94,7 +116,7 @@ public class TimelineRelationPanel extends Composite { Alert alert = new Alert(caught.getMessage()); alert.setType(AlertType.ERROR); alert.setClose(false); - timelineTitle.add(alert); + timelineHeader.add(alert); } }); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineRelationPanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineRelationPanel.ui.xml index da7fa19..6cbac00 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineRelationPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/relation/TimelineRelationPanel.ui.xml @@ -5,22 +5,13 @@ .important { font-weight: bold; } - - .timeline_title { - padding: 5px; - background-color: rgba(0, 60, 136, 0.7); - color: white; - } - - .timeline { - /*border: 1px solid lightgray;*/ - max-height: 400px; - } - - + + + + + addStyleNames="timeline-popup-content"> \ No newline at end of file diff --git a/src/main/webapp/GeoportalDataViewer.css b/src/main/webapp/GeoportalDataViewer.css index 7b44098..aa3f37f 100644 --- a/src/main/webapp/GeoportalDataViewer.css +++ b/src/main/webapp/GeoportalDataViewer.css @@ -598,4 +598,40 @@ body { left: 125px; bottom: 50px } -} \ No newline at end of file +} + +.timeline-popup { + +} + +.timeline-popup-header { + padding-top: 5px; + padding-left: 5px; + background-color: rgba(0, 60, 136, 0.7); + color: white; +} + +.timeline-popup-closer { + text-decoration: none; + position: absolute; + top: 2px; + right: 8px; +} + +.timeline-popup-closer:after { + content: "⚊"; + font-size: 16px; + color: white; +} + +.timeline-popup-closer a:active { + content: "⚊"; + font-size: 16px; + color: white; +} + + +.timeline-popup-content { + padding: 5px; + max-height: 400px; +} diff --git a/src/main/webapp/GeoportalDataViewer.html b/src/main/webapp/GeoportalDataViewer.html index 49e662e..cdc31da 100644 --- a/src/main/webapp/GeoportalDataViewer.html +++ b/src/main/webapp/GeoportalDataViewer.html @@ -98,8 +98,7 @@ var optionsTimeline = { // specify a template for the items template : templateHandlebars, - type : 'box', - dataAttributes : 'all' + type : 'box' }; diff --git a/src/main/webapp/GeoportalDataViewer2.html b/src/main/webapp/GeoportalDataViewer2.html deleted file mode 100644 index 17102e9..0000000 --- a/src/main/webapp/GeoportalDataViewer2.html +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GNA Data Viewer Application - - - - - - - - - - - - - - - - - - - - - -
-
- - - - diff --git a/src/main/webapp/WEB-INF/jsp/GeoPortalDataViewerAppPortlet_view.jsp b/src/main/webapp/WEB-INF/jsp/GeoPortalDataViewerAppPortlet_view.jsp index 3ea6b5e..481e08b 100644 --- a/src/main/webapp/WEB-INF/jsp/GeoPortalDataViewerAppPortlet_view.jsp +++ b/src/main/webapp/WEB-INF/jsp/GeoPortalDataViewerAppPortlet_view.jsp @@ -47,9 +47,9 @@