diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index c915f15..e0c70d8 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,8 @@ - + + + + @@ -27,7 +30,10 @@ - + + + + @@ -55,7 +61,10 @@ - + + + + @@ -83,7 +92,10 @@ - + + + + @@ -111,7 +123,10 @@ - + + + + @@ -139,7 +154,10 @@ - + + + + @@ -167,7 +185,10 @@ - + + + + @@ -195,7 +216,10 @@ - + + + + @@ -223,7 +247,10 @@ - + + + + @@ -251,7 +278,10 @@ - + + + + diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/gallery/ImagesSectionGallery.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/gallery/ImagesSectionGallery.java index 77a4248..1b76d50 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/gallery/ImagesSectionGallery.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/gallery/ImagesSectionGallery.java @@ -7,6 +7,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.materialization.in import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView; import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView; +import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONObject; @@ -147,24 +148,36 @@ public class ImagesSectionGallery { JSONValue meta = JSONParser.parseStrict(subdoc.getMetadataAsJSON()); for (FilesetDV image : subdoc.getListImages()) { - if (image.getListPayload() != null) { - for (PayloadDV payloadDV : image.getListPayload()) { - JSONObject json = new JSONObject(); - json.put("src", new JSONString(payloadDV.getLink())); - json.put("srct", new JSONString(payloadDV.getLink())); - json.put("downloadURL", new JSONString(payloadDV.getLink())); - json.put("title", new JSONString(getFirstValueOfJSON(meta))); - json.put("description", new JSONString(meta.toString())); - jsonArray.set(index, json); - index++; - } + try { + if (image.getListPayload() != null) { + for (PayloadDV payloadDV : image.getListPayload()) { + JSONObject json = new JSONObject(); + json.put("src", new JSONString(payloadDV.getLink())); + json.put("srct", new JSONString(payloadDV.getLink())); + json.put("downloadURL", new JSONString(payloadDV.getLink())); + try { + json.put("title", new JSONString(getFirstValueOfJSON(meta))); + } catch (Exception e) { + GWT.log("Error on reading the title from: " + meta); + json.put("title", new JSONString(meta.toString())); + } + json.put("description", new JSONString(meta.toString())); + jsonArray.set(jsonArray.size(), json); + index++; + } + } + } catch (Exception e) { + GWT.log("Error on adding the image to gallery from: " + image); } } + } - showGallery(jsonArray.getJavaScriptObject(), galleryDivId); + if(jsonArray.size()>0) { + showGallery(jsonArray.getJavaScriptObject(), galleryDivId); + } } /** diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/layers/LayersSectionViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/layers/LayersSectionViewer.java index 2811fd9..c2aac43 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/layers/LayersSectionViewer.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/layers/LayersSectionViewer.java @@ -12,8 +12,10 @@ import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.P import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView; import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil; +import com.github.gwtbootstrap.client.ui.Alert; import com.github.gwtbootstrap.client.ui.DropdownButton; import com.github.gwtbootstrap.client.ui.NavLink; +import com.github.gwtbootstrap.client.ui.constants.AlertType; import com.github.gwtbootstrap.client.ui.constants.ButtonType; import com.github.gwtbootstrap.client.ui.constants.IconType; import com.google.gwt.core.client.GWT; @@ -98,16 +100,30 @@ public class LayersSectionViewer extends Composite { GWT.log("mapServerHost: " + mapServerHost); BBOXDV bbox = layer.getBbox(); - GWT.log("bbox: " + bbox); - GWT.log("bbox keys: " + bbox.keySet()); - GWT.log("bbox values: " + bbox.values()); - GWT.log("minX: " + bbox.getMinX()); - GWT.log("minY: " + bbox.getMinY()); - GWT.log("maxX: " + bbox.getMaxX()); - GWT.log("maxY: " + bbox.getMaxY()); - BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), ""); - GWT.log("bounds: " + bounds); - mapView.addWMSLayer(mapServerHost, layerName, bounds); + + if(bbox!=null) { + + if(!GWT.isProdMode()) { + GWT.log("bbox: " + bbox); +// GWT.log("bbox keys: " + bbox.keySet()); +// GWT.log("bbox values: " + bbox.values()); + GWT.log("minX: " + bbox.getMinX()); + GWT.log("minY: " + bbox.getMinY()); + GWT.log("maxX: " + bbox.getMaxX()); + GWT.log("maxY: " + bbox.getMaxY()); + } + + BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), ""); + GWT.log("bounds: " + bounds); + mapView.addWMSLayer(mapServerHost, layerName, bounds); + }else { + Alert alert = new Alert(); + alert.setType(AlertType.ERROR); + alert.setText("No BBOX found for this layer"); + alert.setClose(false); + layerPanel.add(alert); + } + String htmlLinkId = mapView.getPanelMapElementId() + "-image-download"; @@ -156,14 +172,6 @@ public class LayersSectionViewer extends Composite { String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON()); layerPanel.add(new HTML(table)); } - // mapViewPanel.add(exportMapButton); - -// customTable.addNextKeyValue("Abstract", layerDV.getAbstractSection()); -// customTable.addNextKeyValue("Valutazione qualità", layerDV.getValutazioneQualita()); -// customTable.addNextKeyValue("Metodo raccolta dati", layerDV.getMetodoRaccoltaDati()); -// customTable.addNextKeyValue("Scala acquisizione dati", layerDV.getScalaAcquisizione()); -// customTable.addNextKeyValues("Autori", layerDV.getAuthors(), GeoportalDataViewerConstants.NEW_LINE_BR); -// layerPanel.add(customTable); } public static native void exportPDF(String layerURL) /*-{ diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/ProjectViewer.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/ProjectViewer.java index 69366dc..7a507af 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/ProjectViewer.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/cms/project/ProjectViewer.java @@ -190,6 +190,8 @@ public class ProjectViewer extends Composite { applicationBus.fireEvent(new AddLayerToMapEvent(theProjectView.getTheProjectDV())); } }); + + setAddLayersToMapVisible(false); GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback() { @@ -210,6 +212,11 @@ public class ProjectViewer extends Composite { SectionViewer sectionViewer = new SectionViewer(sectionView); pageViewDetails.add(sectionViewer); } + + if(sectionView.hasSpatialLayers()) { + setAddLayersToMapVisible(true); + } + } } 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 deleted file mode 100644 index 7e42b58..0000000 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/gallery/ImagesGallery.java +++ /dev/null @@ -1,166 +0,0 @@ -//package org.gcube.portlets.user.geoportaldataviewer.client.ui.gallery; -// -//import java.util.List; -// -//import org.gcube.application.geoportalcommon.shared.products.content.WorkspaceContentDV; -//import org.gcube.application.geoportalcommon.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.Random; -//import com.google.gwt.user.client.ui.HTMLPanel; -// -// -///** -// * The Class ImagesSectionGallery. -// * -// * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) -// * -// * Jul 21, 2021 -// */ -//public class ImagesGallery { -// -// private HTMLPanel galleryPanel; -// private List listImages; -// private String galleryDivId; -// -// /** -// * Show gallery. -// * -// * @param json_array_images the json array images -// */ -// private native void showGallery(JavaScriptObject json_array_images, String galleryDivId) /*-{ -// -// console.log("showing: " + json_array_images) -// var waitForJQuery = setInterval( -// function() { -// if (typeof $wnd.$ != 'undefined') { -// -// $wnd -// .$("#"+galleryDivId) -// .nanogallery2( -// { -// thumbnailHeight : '200 XS150 SM150', // RESPONSIVE THUMBNAIL HEIGHT: default=200px, XS resolution=150px, SM resolution=150px -// thumbnailWidth : '218 XS150 SM150', // RESPONSIVE THUMBNAIL WIDTH: auto -// thumbnailAlignment : 'left', -// thumbnailBorderHorizontal : 0, -// thumbnailBorderVertical : 0, -// thumbnailGutterWidth : '10 XS10 SM10', -// thumbnailGutterHeight : '10 XS10 SM10', -// -// // THUMBNAIL TOOLS & LABEL -// thumbnailLabel : { -// display : true, -// position : 'onBottom', -// align : 'left' -// }, -// thumbnailToolbarImage : { -// bottomLeft : 'display' -// }, -// // replace the default DISPLAY tool icon -// icons : { -// thumbnailDisplay : ' display' -// }, -// -// // DISPLAY ANIMATION -// galleryDisplayTransition : 'slideUp', -// galleryDisplayTransitionDuration : 1000, -// thumbnailDisplayTransition : 'scaleDown', -// thumbnailDisplayTransitionDuration : 300, -// thumbnailDisplayInterval : 50, -// -// // THUMBNAIL'S HOVER ANIMATION -// //thumbnailBuildInit2 : 'tools_font-size_1.5em|title_font-size_1.5em', -// thumbnailHoverEffect2 : 'imageScaleIn80|tools_opacity_0_1|tools_translateX_-30px_0px|title_opacity_1_0|title_translateX_0px_-30px', -// touchAnimation : true, -// touchAutoOpenDelay : 800, -// -// // GALLERY THEME -// galleryTheme : { -// thumbnail : { -// borderRadius : '2px !important', -// background : '#ffffff !important', -// titleShadow : 'none !important', -// titleColor : '#696969 !important', -// labelBackground : '#f3f3f3 !important' -// }, -// thumbnailIcon : { -// color : '#000', -// shadow : 'none' -// }, -// }, -// 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); -// -// }-*/; -// -// /** -// * Instantiates a new images gallery. -// * -// * @param immagini the immagini -// */ -// public ImagesGallery(List immagini) { -// this.galleryDivId = "nanogallery"+Random.nextInt()+Random.nextInt(); -// this.galleryPanel = new HTMLPanel("
"); -// this.listImages = immagini; -// } -// -// /** -// * Gets the gallery panel. -// * -// * @return the gallery panel -// */ -// public HTMLPanel getGalleryPanel() { -// return galleryPanel; -// } -// -// /** -// * Fill gallery. -// */ -// public void fillGallery() { -// -// JSONArray jsonArray = new JSONArray(); -// int index = 0; -// for (UploadedImageDV image : listImages) { -// if(image.getListWsContent()!=null) { -// for (WorkspaceContentDV imageContent : image.getListWsContent()) { -// JSONObject json = new JSONObject(); -// json.put("src", new JSONString(imageContent.getLink())); -// json.put("srct", new JSONString(imageContent.getLink())); -// List listAuthors = image.getResponsabili(); -// String txtAuthors = listAuthors.size()>1 ? "Authors: ": "Author: "; -// for (String author : listAuthors) { -// txtAuthors+= " "+author +","; -// } -// txtAuthors = txtAuthors.substring(0,txtAuthors.length()-2); -// String description = txtAuthors + ". ID Licenza: "+image.getLicenseID(); -// json.put("title", new JSONString(image.getDidascalia())); -// json.put("description", new JSONString(description)); -// json.put("downloadURL", new JSONString(imageContent.getLink())); -// jsonArray.set(index, json); -// index++; -// } -// } -// -// } -// showGallery(jsonArray.getJavaScriptObject(), galleryDivId); -// } -//} diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java index d493dd4..8db8c8f 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/GeoportalDataViewerServiceImpl.java @@ -889,6 +889,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme Geoportal_JSON_Mapper.prettyPrintProjectView(projectView); } + LOG.info("returning project view for id: " + projectView.getTheProjectDV().getId()); return projectView; diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/Geoportal_JSON_Mapper.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/Geoportal_JSON_Mapper.java index a4dd768..b3234c4 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/Geoportal_JSON_Mapper.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/Geoportal_JSON_Mapper.java @@ -490,9 +490,10 @@ public class Geoportal_JSON_Mapper { String jsonPath = null; try { jsonPath = String.format("%s.%s", JSON_$_POINTER, _BBOX); - BBOXDV bbox = JsonPath.using(config).parse(toSerializeJSONOBJ).read(jsonPath, BBOXDV.class); - gsdiLayer.setBbox(bbox); - LOG.debug(_BBOX + " is: " + bbox); + HashMap bbox = JsonPath.using(config).parse(toSerializeJSONOBJ).read(jsonPath, HashMap.class); + BBOXDV bboxDV = new BBOXDV(bbox); + gsdiLayer.setBbox(bboxDV); + LOG.debug(_BBOX + " is: " + bboxDV); } catch (Exception e) { LOG.warn(jsonPath + " error: ", e); } @@ -500,7 +501,7 @@ public class Geoportal_JSON_Mapper { jsonPath = String.format("%s.%s", JSON_$_POINTER, _OGC_LINKS); String jsonString = JsonPath.using(config).parse(toSerializeJSONOBJ).read(jsonPath).toString(); Gson gson = new Gson(); - HashMap map = gson.fromJson(jsonString, HashMap.class); + HashMap map = gson.fromJson(jsonString, HashMap.class); gsdiLayer.setOgcLinks(map); LOG.debug(_OGC_LINKS + " are: " + map); } catch (Exception e) { diff --git a/src/main/webapp/GeoportalDataViewer.css b/src/main/webapp/GeoportalDataViewer.css index 9d32e9f..bd896cf 100644 --- a/src/main/webapp/GeoportalDataViewer.css +++ b/src/main/webapp/GeoportalDataViewer.css @@ -624,18 +624,6 @@ body { RESPONSIVE ***/ -@media all and (max-width: 1919px) { - .details-panel { - width: 400px; - } -} - -@media all and (max-width: 1919px) { - .inner-toolbar { - width: 100px; - } -} - @media all and (max-width: 2350px) { #timeline-data { width: 700px; @@ -643,12 +631,16 @@ RESPONSIVE } } -@media all and (max-width: 1700px) { +@media all and (max-width: 2048px) { #timeline-data { - width: 400px; - left: 210px; + width: 600px; + left: 310px; bottom: 50px } + + .details-panel { + width: 600px; + } } @media all and (max-width: 1024px) { @@ -657,8 +649,14 @@ RESPONSIVE left: 140px; bottom: 50px } + .details-panel { + width: 400px; + } .search-facility { width: 250px; max-width: 300px; } + .inner-toolbar { + width: 100px; + } } diff --git a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GNABaseMaps.java b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GNABaseMaps.java index 0f27782..9c8f5c9 100644 --- a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GNABaseMaps.java +++ b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GNABaseMaps.java @@ -5,7 +5,6 @@ import java.util.List; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.portlets.user.geoportaldataviewer.server.GNABaseMapsResourceReader; import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer; -import org.junit.Test; public class GNABaseMaps { diff --git a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GeoportalViewer_Tests.java b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GeoportalViewer_Tests.java index 506531d..fb50c98 100644 --- a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GeoportalViewer_Tests.java +++ b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/GeoportalViewer_Tests.java @@ -25,8 +25,6 @@ import org.gcube.common.authorization.library.provider.SecurityTokenProvider; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.portlets.user.geoportaldataviewer.server.Geoportal_JSON_Mapper; import org.json.JSONObject; -import org.junit.Before; -import org.junit.Test; /** * The Class GeoportalViewer_Tests. diff --git a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/IAMClient.java b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/IAMClient.java index a8604d3..e8c0a81 100644 --- a/src/test/java/org/gcube/portlets/user/geoportaldataviewer/IAMClient.java +++ b/src/test/java/org/gcube/portlets/user/geoportaldataviewer/IAMClient.java @@ -4,7 +4,6 @@ import org.gcube.application.geoportal.common.model.legacy.Concessione; import org.gcube.common.scope.api.ScopeProvider; import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.IAMClientCredentialsReader; import org.gcube.portlets.user.geoportaldataviewer.server.mongoservice.accessidentity.IAMClientCredentials; -import org.junit.Test; public class IAMClient {