diff --git a/.settings/com.gwtplugins.gdt.eclipse.core.prefs b/.settings/com.gwtplugins.gdt.eclipse.core.prefs index 24ea67a..afbfdeb 100644 --- a/.settings/com.gwtplugins.gdt.eclipse.core.prefs +++ b/.settings/com.gwtplugins.gdt.eclipse.core.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 -lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.1.0 +lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-1.2.0-SNAPSHOT warSrcDir=src/main/webapp warSrcDirIsOutput=false diff --git a/CHANGELOG.md b/CHANGELOG.md index 13d7560..e67b547 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v1.2.0-SNAPSHOT] - 2021-07-19 + +#### Enhancements + +Moved to maven-portal-bom v.3.6.3 + ## [v1.1.0] - 2020-12-21 #### Enhancements diff --git a/pom.xml b/pom.xml index f5ae810..433770e 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.gcube.portlets.user geoportal-data-viewer-app war - 1.1.0 + 1.2.0-SNAPSHOT GeoPortal Data Viewer App The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface @@ -54,7 +54,7 @@ org.gcube.distribution maven-portal-bom - 3.6.0 + 3.6.3-SNAPSHOT pom import @@ -109,6 +109,16 @@ ${gwt.version} provided + + org.gcube.portal + oidc-library-portal + provided + + + org.gcube.common + oidc-library + provided + com.github.tdesjardins gwt-ol3 diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/GeoportalDataViewer.gwt.xml b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/GeoportalDataViewer.gwt.xml index 6a5dd72..a673605 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/GeoportalDataViewer.gwt.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/GeoportalDataViewer.gwt.xml @@ -11,8 +11,11 @@ - - + + + + 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 db328a7..cc6f6b8 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 @@ -24,6 +24,7 @@ import com.google.gwt.core.client.EntryPoint; 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.core.client.ScriptInjector; import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.event.logical.shared.ResizeHandler; import com.google.gwt.event.shared.HandlerManager; @@ -87,95 +88,108 @@ public class GeoportalDataViewer implements EntryPoint { mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight()); RootPanel.get(APP_DIV).add(mainPanel); - - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - - @Override - public void execute() { - - olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),layerManager.getLayerManagerBus()); - layerManager.setOlMap(olMapMng.getOLOSMMap()); - mainPanel.setMap(olMapMng.getOLOSMMap()); - updateSize(); - } - }); - - Window.addResizeHandler(new ResizeHandler() { - @Override - public void onResize(ResizeEvent event) { - updateSize(); - } - }); - - paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER); - paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE); - //paramUUID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER); - paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID); - paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE); - GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest); - GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType); - GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID); - //GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID); - GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle); - //VALIDATING THE LONG FORMAT FOR GID - try { - if(paramGeonaItemID!=null) - Long.parseLong(paramGeonaItemID); - }catch (Exception e) { - Window.alert("Bad format for parameter "+GeoportalDataViewerConstants.GET_GEONA_ITEM_ID+". It must be a Long"); - paramGeonaItemID = null; - } - - Scheduler.get().scheduleDeferred(new ScheduledCommand() { - + Timer t = new Timer() { + @Override - public void execute() { - GeoportalDataViewerServiceAsync.Util.getInstance().getGeoNaDataViewProfile(new AsyncCallback() { + public void run() { + Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override - public void onFailure(Throwable caught) { - Window.alert(caught.getMessage()); - - } - - @Override - public void onSuccess(GeoNaDataViewerProfile profile) { - geonaDataViewerProfile = profile; - GWT.log("Profile: "+geonaDataViewerProfile); - Iterator it; - String theItemType = paramGeonaItemType; - if(theItemType==null) { - it = geonaDataViewerProfile.getMapLayers().keySet().iterator(); - it.hasNext(); - theItemType= it.next(); - } - - LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType); - - if(layerItem==null) { - Window.alert("Not detected any layer with type: "+theItemType); - return; - } - - GWT.log("The layerItem is: "+layerItem); - layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false, null, true); - - if(paramGeonaItemID!=null) { - if(paramGeonaItemType==null) { - Window.alert("Missing parameter "+GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE +" (GeoNa Data Type) where to search the item id: "+paramGeonaItemID); - return; - } - GeoNaItemRef gir = new GeoNaItemRef(new Long(paramGeonaItemID), paramGeonaItemType); - applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null)); - } + public void execute() { + olMapMng = new OLMapManager(mainPanel.getMapPanel().getElement().getId(),layerManager.getLayerManagerBus()); + layerManager.setOlMap(olMapMng.getOLOSMMap()); + mainPanel.setMap(olMapMng.getOLOSMMap()); + updateSize(); + ScriptInjector.fromUrl("//cdn.jsdelivr.net/npm/nanogallery2@3/dist/jquery.nanogallery2.min.js") + .setWindow(ScriptInjector.TOP_WINDOW).inject(); } }); + + Window.addResizeHandler(new ResizeHandler() { + @Override + public void onResize(ResizeEvent event) { + updateSize(); + } + }); + + paramWmsRequest = Window.Location.getParameter(GeoportalDataViewerConstants.GET_WMS_PARAMETER); + paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE); + //paramUUID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_UUID_PARAMETER); + paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID); + paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE); + GWT.log(GeoportalDataViewerConstants.GET_WMS_PARAMETER + " = " + paramWmsRequest); + GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE + " = " + paramGeonaItemType); + GWT.log(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID + " = " + paramGeonaItemID); + //GWT.log(GeoportalDataViewerConstants.GET_UUID_PARAMETER + " = " + paramUUID); + GWT.log(GeoportalDataViewerConstants.GET_LAYER_TITLE + " = " + paramLayerTitle); + + //VALIDATING THE LONG FORMAT FOR GID + try { + if(paramGeonaItemID!=null) + Long.parseLong(paramGeonaItemID); + }catch (Exception e) { + Window.alert("Bad format for parameter "+GeoportalDataViewerConstants.GET_GEONA_ITEM_ID+". It must be a Long"); + paramGeonaItemID = null; + } + + Scheduler.get().scheduleDeferred(new ScheduledCommand() { + + @Override + public void execute() { + GeoportalDataViewerServiceAsync.Util.getInstance().getGeoNaDataViewProfile(new AsyncCallback() { + + @Override + public void onFailure(Throwable caught) { + Window.alert(caught.getMessage()); + + } + + @Override + public void onSuccess(GeoNaDataViewerProfile profile) { + geonaDataViewerProfile = profile; + GWT.log("Profile: "+geonaDataViewerProfile); + Iterator it; + String theItemType = paramGeonaItemType; + if(theItemType==null) { + it = geonaDataViewerProfile.getMapLayers().keySet().iterator(); + it.hasNext(); + theItemType= it.next(); + } + + LayerItem layerItem = geonaDataViewerProfile.getMapLayers().get(theItemType); + + if(layerItem==null) { + Window.alert("Not detected any layer with type: "+theItemType); + return; + } + + GWT.log("The layerItem is: "+layerItem); + layerManager.addLayer(theItemType, null, null, layerItem.getWmsLink(), false, false, null, true); + + if(paramGeonaItemID!=null) { + if(paramGeonaItemType==null) { + Window.alert("Missing parameter "+GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE +" (GeoNa Data Type) where to search the item id: "+paramGeonaItemID); + return; + } + GeoNaItemRef gir = new GeoNaItemRef(new Long(paramGeonaItemID), paramGeonaItemType); + applicationBus.fireEvent(new ShowDetailsEvent(gir, null, null)); + } + + } + }); + } + }); + + bindEvents(); + } - }); - - bindEvents(); + }; + + t.schedule(3000); + + } /** diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/gallery/ImagesGallery.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/gallery/ImagesGallery.java new file mode 100644 index 0000000..90254a3 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/gallery/ImagesGallery.java @@ -0,0 +1,92 @@ +package org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery; + +import java.util.List; + +import org.gcube.portlets.user.geoportaldataviewer.shared.products.content.WorkspaceContentDV; +import org.gcube.portlets.user.geoportaldataviewer.shared.products.model.UploadedImageDV; + +import com.google.gwt.core.client.JavaScriptObject; +import com.google.gwt.json.client.JSONArray; +import com.google.gwt.json.client.JSONObject; +import com.google.gwt.json.client.JSONString; +import com.google.gwt.user.client.ui.HTMLPanel; + +public class ImagesGallery { + + HTMLPanel galleryPanel = new HTMLPanel("
"); + private List listImages; + + private native void showGallery(JavaScriptObject json_array_images) /*-{ + + console.log("showing: " + json_array_images) + var waitForJQuery = setInterval( + function() { + if (typeof $wnd.$ != 'undefined') { + + $wnd + .$("#nanogallery") + .nanogallery2( + { + + thumbnailHeight : '200', + thumbnailWidth : 'auto', + thumbnailAlignment : 'fillWidth', + + thumbnailDisplayTransition : 'slideDown', + thumbnailDisplayTransitionDuration : 500, + thumbnailDisplayInterval : 30, + + // THUMBNAIL'S HOVER ANIMATION + thumbnailHoverEffect2 : 'imageScaleIn80', + touchAnimation : true, + touchAutoOpenDelay : 800, + viewerToolbar : { + display : true, + standard : 'minimizeButton, label', + minimized : 'minimizeButton, label, fullscreenButton, downloadButton' + }, + viewerTools : { + topLeft : 'pageCounter', + topRight : 'playPauseButton, zoomButton, fullscreenButton, downloadButton, closeButton' + }, + + // DEEP LINKING + locationHash : false, + items : json_array_images + }) + + clearInterval(waitForJQuery); + } + }, 200); + + }-*/; + + public ImagesGallery(List immagini) { + + this.listImages = immagini; + } + + public HTMLPanel getGalleryPanel() { + return galleryPanel; + } + + public void fillGallery() { + + JSONArray jsonArray = new JSONArray(); + int index = 0; + for (UploadedImageDV image : listImages) { + for (WorkspaceContentDV imageContent : image.getListWsContent()) { + JSONObject json = new JSONObject(); + json.put("src", new JSONString(imageContent.getLink())); + json.put("srct", new JSONString(imageContent.getLink())); + json.put("title", new JSONString(image.getDidascalia())); + //json.put("description", new JSONString(image.getDidascalia())); + json.put("downloadURL", new JSONString(imageContent.getLink())); + jsonArray.set(index, json); + index++; + } + + } + showGallery(jsonArray.getJavaScriptObject()); + } +} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/ConcessioneView.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/ConcessioneView.java index 19fa3f9..bfeca01 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/ConcessioneView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/products/concessioni/ConcessioneView.java @@ -8,6 +8,7 @@ import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerSer import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils; import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow; import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink; +import org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery.ImagesGallery; import org.gcube.portlets.user.geoportaldataviewer.client.ui.images.ThumbnailImageView; import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView; import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable; @@ -321,7 +322,12 @@ public class ConcessioneView extends Composite { List immagini = concessioneDV.getImmaginiRappresentative(); if (immagini != null && immagini.size() > 0) { imagesPanel.setVisible(true); - boolean addedImage = false; + + ImagesGallery gallery = new ImagesGallery(immagini); + imagesPanel.add(gallery.getGalleryPanel()); + gallery.fillGallery(); + + /*boolean addedImage = false; imagesPanel.add(thumbNails); for (UploadedImageDV uploadedImageDV : immagini) { @@ -339,7 +345,7 @@ public class ConcessioneView extends Composite { if(!addedImage) { imagesPanel.remove(thumbNails); - } + }*/ } } diff --git a/src/main/resources/org/gcube/portlets/user/geoportaldataviewer/GeoportalDataViewer.gwt.xml b/src/main/resources/org/gcube/portlets/user/geoportaldataviewer/GeoportalDataViewer.gwt.xml index 6a5dd72..a673605 100644 --- a/src/main/resources/org/gcube/portlets/user/geoportaldataviewer/GeoportalDataViewer.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/geoportaldataviewer/GeoportalDataViewer.gwt.xml @@ -11,8 +11,11 @@ - - + + + + diff --git a/src/main/webapp/GeoportalDataViewer.html b/src/main/webapp/GeoportalDataViewer.html index 38a20f0..de8e1b3 100644 --- a/src/main/webapp/GeoportalDataViewer.html +++ b/src/main/webapp/GeoportalDataViewer.html @@ -6,46 +6,56 @@ - - + + - - - - - - - - - - - Web Application Starter Project + + + + - - - - - - - + + - - - - - - + + + + +Web Application Starter Project - - + + + + + + + - - -
- + + + + + + + + + + + + +
+