From 8967184d3ce2eca04268d07000d47352fa7a47ca Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 31 Aug 2023 15:17:21 +0200 Subject: [PATCH] Optimized the UI for screen size 1200x1200 --- .settings/org.eclipse.wst.common.component | 30 +++++++---- .../client/LayerManager.java | 2 +- .../client/gis/OpenLayerMap.java | 6 +-- .../OverlayCustomLayerPanel.java | 2 +- .../layercollection/LayerCollectionPanel.java | 2 +- .../GeoportalDataViewerServiceImpl.java | 11 ++-- .../server/gis/GisMakers.java | 4 +- .../server/gis/WMSUrlValidator.java | 50 ++++++++--------- .../shared/gis/LayerItem.java | 25 +++++---- .../gis/wms/GeoInformationForWMSRequest.java | 54 ++++++++++--------- src/main/webapp/GeoportalDataViewer.css | 17 ++++-- 11 files changed, 115 insertions(+), 88 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 4c84f49..1335b0d 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -1,5 +1,6 @@ - + + @@ -89,7 +90,8 @@ - + + @@ -179,7 +181,8 @@ - + + @@ -269,7 +272,8 @@ - + + @@ -359,7 +363,8 @@ - + + @@ -449,7 +454,11 @@ - + + uses + + + @@ -539,7 +548,8 @@ - + + @@ -629,7 +639,8 @@ - + + @@ -719,7 +730,8 @@ - + + diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java index f947034..e1b02ac 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/LayerManager.java @@ -515,7 +515,7 @@ public class LayerManager { GWT.log("Parsed WMS Request returned: " + geoInfoWMS); LayerItem layerItem = toLayerItem(featureType, layerTitle, geoInfoWMS.getLayerName(), - geoInfoWMS.getWmsRequest(), geoInfoWMS.getBaseWmsServiceHost(), true, isBase, + geoInfoWMS.getWmsRequest(), geoInfoWMS.getServiceEndPoint(), true, isBase, displayInLayerSwitcher, (ArrayList) geoInfoWMS.getStyles().getGeoStyles(), geoInfoWMS.getWmsRequest(), false, geoInfoWMS.getMapWMSNoStandard(), geoInfoWMS.isNcWMS(), UUID, geoInfoWMS.getZAxis(), minResolution, maxResolution); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/OpenLayerMap.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/OpenLayerMap.java index 985ae26..5d7890f 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/OpenLayerMap.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/gis/OpenLayerMap.java @@ -439,7 +439,7 @@ public abstract class OpenLayerMap { imageWMSParams.setLayers(layerItem.getName()); ImageWmsOptions imageWMSOptions = OLFactory.createOptions(); - imageWMSOptions.setUrl(layerItem.getMapServerHost()); + imageWMSOptions.setUrl(layerItem.getMapServerEndpoint()); imageWMSOptions.setParams(imageWMSParams); // imageWMSOptions.setRatio(1.5f); @@ -544,7 +544,7 @@ public abstract class OpenLayerMap { imageWMSParams.setLayers(layerItem.getName()); ImageWmsOptions imageWMSOptions = OLFactory.createOptions(); - imageWMSOptions.setUrl(layerItem.getMapServerHost()); + imageWMSOptions.setUrl(layerItem.getMapServerEndpoint()); imageWMSOptions.setParams(imageWMSParams); // imageWMSOptions.setRatio(1.5f); @@ -595,7 +595,7 @@ public abstract class OpenLayerMap { imageWMSParams.setLayers(layerItem.getName()); ImageWmsOptions imageWMSOptions = OLFactory.createOptions(); - imageWMSOptions.setUrl(layerItem.getMapServerHost()); + imageWMSOptions.setUrl(layerItem.getMapServerEndpoint()); imageWMSOptions.setParams(imageWMSParams); // imageWMSOptions.setRatio(1.5f); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/customoverlays/OverlayCustomLayerPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/customoverlays/OverlayCustomLayerPanel.java index 55e3e17..7b257ff 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/customoverlays/OverlayCustomLayerPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/customoverlays/OverlayCustomLayerPanel.java @@ -219,7 +219,7 @@ public class OverlayCustomLayerPanel extends Composite { flow.add(new HTMLPanel("Legend for: " + theLayerName)); final HorizontalPanel hpLegend = new HorizontalPanel(); - String url = geoInformation.getBaseWmsServiceHost() + "?service=WMS&" + "version=" + String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version=" + URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer=" + theLayerName; diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.java index 033f0d8..a73c33e 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/layercollection/LayerCollectionPanel.java @@ -271,7 +271,7 @@ public class LayerCollectionPanel extends Composite { flow.add(new HTMLPanel("Legend for: " + theLayerName)); final HorizontalPanel hpLegend = new HorizontalPanel(); - String url = geoInformation.getBaseWmsServiceHost() + "?service=WMS&" + "version=" + String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version=" + URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer=" + theLayerName; 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 ae212eb..b991f8b 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 @@ -65,6 +65,7 @@ import org.gcube.application.geoportalcommon.shared.geoportal.ucd.HandlerDeclara import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV; import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView; import org.gcube.application.geoportalcommon.shared.gis.BoundsMap; +import org.gcube.application.geoportalcommon.util.StringUtil; import org.gcube.application.geoportalcommon.util.URLParserUtil; import org.gcube.application.geoportaldatamapper.GcubeProfilesPerUCDIdCache; import org.gcube.application.geoportaldatamapper.Geoportal_JSON_Mapper; @@ -262,7 +263,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception { try { WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName); - String wmsServiceHost = validator.getWmsServiceHost(); + String wmsServiceServiceEndpoint = validator.getWmsServiceEndPoint(); String validWMSRequest = validator.parseWMSRequest(true, true); layerName = validator.getLayerName(); String versionWms = validator.getValueOfParsedWMSParameter(WmsParameters.VERSION); @@ -289,7 +290,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme ? new ZAxis(layerZAxis.getUnits(), layerZAxis.isPositive(), layerZAxis.getValues()) : null; - return new GeoInformationForWMSRequest(wmsServiceHost, validWMSRequest, layerName, versionWms, crs, + return new GeoInformationForWMSRequest(wmsServiceServiceEndpoint, validWMSRequest, layerName, versionWms, crs, mapWmsNotStandard, styles, styles.isNcWms(), zAxis); } catch (Exception e) { String msg = "An error occurred during wms request validation for layer: " + layerName; @@ -705,7 +706,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme GCubeSDILayer indexLayer = index.getLayer(); HashMap ogcLinks = indexLayer.getOgcLinks(); String wmsLink = ogcLinks.get("wms"); - LOG.info("wms link is {}", wmsLink); + LOG.info("wms link is {}", StringUtil.ellipsize(wmsLink, 150)); int lastCharOfthePath = wmsLink.indexOf("?"); String wmsPath = wmsLink.substring(0, lastCharOfthePath); for (GeoServerPlatformInfoDV geoserver : indexLayer.getPlatformInfos()) { @@ -715,7 +716,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme LOG.debug("purged wmsPath from the 'workspace' is {}", wmsPath); wmsLink = wmsPath + wmsLink.substring(lastCharOfthePath, wmsLink.length()); ogcLinks.put("wms", wmsLink); - LOG.info("wms link without {} is {}", geoserver.getWorkspace(), wmsLink); + LOG.info("wms link without {} is {}", geoserver.getWorkspace(), StringUtil.ellipsize(wmsLink, 150)); } } return index; @@ -863,7 +864,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme */ @Override protected void onBeforeRequestDeserialized(String serializedRequest) { - LOG.info("onBeforeRequestDeserialized called"); + LOG.debug("onBeforeRequestDeserialized called"); String scope = ""; try { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/GisMakers.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/GisMakers.java index 3a3c5d5..2603c09 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/GisMakers.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/GisMakers.java @@ -61,8 +61,8 @@ public class GisMakers { public static String buildWFSFeatureQuery(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat) { - String link = layerItem.getMapServerHost(); - LOG.debug("Map server host URL: " + link); + String link = layerItem.getMapServerEndpoint(); + LOG.debug("Map server endpoint: " + link); LOG.debug("CQL filter is: " + layerItem.getCqlFilter()); LOG.debug("MAX FEATURES: " + maxFeatures); LOG.debug("BBOX: " + mapBBOX); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/WMSUrlValidator.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/WMSUrlValidator.java index 27b7925..2ac6ab0 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/WMSUrlValidator.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/server/gis/WMSUrlValidator.java @@ -24,7 +24,7 @@ public class WMSUrlValidator { private static final String OWS = "ows"; private HashMap parametersValue = new HashMap(); private String wmsRequestURI; - private String wmsServiceHost; + private String wmsServiceEndPoint; private String layerName; private String wmsNoStandardParameters = ""; @@ -48,34 +48,29 @@ public class WMSUrlValidator { throw new Exception("WMS request is null or empty"); this.wmsRequestURI = wmsRequest.trim(); - boolean isOwsService = GeoWmsServiceUtility.isOWSSerice(this.wmsRequestURI); - WebMapServerHost webMapServerHost; - - // IS WMS? - if (GeoWmsServiceUtility.isWMSService(wmsRequestURI)) { - LOG.trace("found " + GeoWmsServiceUtility.SERVICE_WMS + " in wms request: " + wmsRequestURI); - webMapServerHost = getWebMapServerHost(wmsRequestURI); - } else - throw new Exception("WMS service not found for layer: " + inputLayerName); // VALIDATION WMS - String baseWmsService = webMapServerHost.getHost(); - // IS OWS OR WMS? - this.wmsServiceHost = appendWmsServiceToBaseUrl(wmsRequest.substring(0, wmsRequest.indexOf("?")), isOwsService); - this.layerName = inputLayerName; - + int endpointLastCharIndex = wmsRequest.lastIndexOf("?"); + // No '?' char found + if (endpointLastCharIndex == -1) { + LOG.info("Char '?' not found, setting last index the end of the URI"); + endpointLastCharIndex = wmsRequest.length(); + } + String readWMSServiceEndpoint = wmsRequest.substring(0, endpointLastCharIndex); + this.wmsServiceEndPoint = readWMSServiceEndpoint; try { // VALIDATE WMS SERVICE FOR WEB MAP SERVER - if (!HttpRequestUtil.urlExists(this.wmsServiceHost, true)) { - LOG.info("baseWmsServiceUrl: " + wmsServiceHost - + " is not a geoserver, setting as input base wms server: " + baseWmsService); - this.wmsServiceHost = baseWmsService; + if (!HttpRequestUtil.urlExists(this.wmsServiceEndPoint, true)) { + LOG.warn("baseWmsServiceUrl: " + wmsServiceEndPoint + " is not valid URL!!"); + this.wmsServiceEndPoint = readWMSServiceEndpoint; + } } catch (Exception e) { - LOG.error("error on validating geoserver wms service: " + e); - LOG.info("setting baseWmsService as input base wms server: " + baseWmsService); - this.wmsServiceHost = baseWmsService; + LOG.error("Error on validating the endpoint: " + this.wmsServiceEndPoint, e); + boolean isOwsService = GeoWmsServiceUtility.isOWSSerice(this.wmsRequestURI); + LOG.info("Retrying by appending suffix WMS or WFS..."); + this.wmsServiceEndPoint = appendWmsServiceToBaseUrl(readWMSServiceEndpoint, isOwsService); } // VALIDATION FOR THREDDS - FIND LAYER NAME INTO WMS PATH @@ -86,7 +81,8 @@ public class WMSUrlValidator { throw new Exception("Layer name is null or empty"); } - + + LOG.info("WMSURLValidator found endpoint: " + wmsServiceEndPoint); parametersValue.put(WmsParameters.LAYERS.getParameter(), this.layerName); } @@ -230,13 +226,13 @@ public class WMSUrlValidator { } /** - * Gets the wms service host. + * Gets the wms service end point. * - * @return the wms service host + * @return the wms service end point */ - public String getWmsServiceHost() { + public String getWmsServiceEndPoint() { - return wmsServiceHost; + return wmsServiceEndPoint; } /** diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/LayerItem.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/LayerItem.java index 37c2e1d..befdc6c 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/LayerItem.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/LayerItem.java @@ -36,7 +36,7 @@ public class LayerItem implements Serializable, Cloneable { private String url; /** The base map server URL. */ - private String mapServerHost; + private String mapServerEndpoint; /** The style. */ private String style; @@ -774,21 +774,21 @@ public class LayerItem implements Serializable, Cloneable { } /** - * Gets the map server host. + * Gets the map server endpoint. * - * @return the map server host + * @return the map server endpoint */ - public String getMapServerHost() { - return mapServerHost; + public String getMapServerEndpoint() { + return mapServerEndpoint; } /** * Sets the map server host. * - * @param mapServerHost the new map server host + * @param mapServerEndpoint the new map server host */ - public void setMapServerHost(String mapServerHost) { - this.mapServerHost = mapServerHost; + public void setMapServerHost(String mapServerEndpoint) { + this.mapServerEndpoint = mapServerEndpoint; } /** @@ -881,6 +881,11 @@ public class LayerItem implements Serializable, Cloneable { return maxResolution; } + /** + * To string. + * + * @return the string + */ @Override public String toString() { StringBuilder builder = new StringBuilder(); @@ -890,8 +895,8 @@ public class LayerItem implements Serializable, Cloneable { builder.append(title); builder.append(", url="); builder.append(url); - builder.append(", mapServerHost="); - builder.append(mapServerHost); + builder.append(", mapServerEndpoint="); + builder.append(mapServerEndpoint); builder.append(", style="); builder.append(style); builder.append(", isTrasparent="); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/wms/GeoInformationForWMSRequest.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/wms/GeoInformationForWMSRequest.java index a6c0b45..59e38bf 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/wms/GeoInformationForWMSRequest.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/shared/gis/wms/GeoInformationForWMSRequest.java @@ -8,15 +8,14 @@ import java.util.HashMap; * * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * - * Oct 27, 2020 + * Oct 27, 2020 */ public class GeoInformationForWMSRequest implements Serializable { /** The Constant serialVersionUID. */ private static final long serialVersionUID = -6846636281073641003L; - /** The base wms service host. */ - private String baseWmsServiceHost; + private String serviceEndPoint; /** The wms request. */ private String wmsRequest; @@ -53,20 +52,19 @@ public class GeoInformationForWMSRequest implements Serializable { /** * Instantiates a new geo information for wms request. * - * @param baseWmsServiceHost the base wms service host - * @param wmsRequest the wms request - * @param layerName the layer name - * @param versionWms the version wms - * @param crs the crs - * @param mapWmsNoStandard the map wms not standard - * @param styles the layer styles - * @param isNcWMS the is nc WMS - * @param zAxis the z axis + * @param serviceEndPoint the base wms service host + * @param wmsRequest the wms request + * @param layerName the layer name + * @param versionWms the version wms + * @param crs the crs + * @param mapWmsNoStandard the map wms not standard + * @param styles the layer styles + * @param isNcWMS the is nc WMS + * @param zAxis the z axis */ - public GeoInformationForWMSRequest(String baseWmsServiceHost, String wmsRequest, String layerName, - String versionWms, String crs, HashMap mapWmsNoStandard, Styles styles, boolean isNcWMS, - ZAxis zAxis) { - this.baseWmsServiceHost = baseWmsServiceHost; + public GeoInformationForWMSRequest(String serviceEndPoint, String wmsRequest, String layerName, String versionWms, + String crs, HashMap mapWmsNoStandard, Styles styles, boolean isNcWMS, ZAxis zAxis) { + this.serviceEndPoint = serviceEndPoint; this.wmsRequest = wmsRequest; this.layerName = layerName; this.versionWMS = versionWms; @@ -98,13 +96,21 @@ public class GeoInformationForWMSRequest implements Serializable { } /** - * Gets the base wms service host. + * Gets the service end point. * - * @return the baseWmsServiceHost + * @return the service end point */ - public String getBaseWmsServiceHost() { + public String getServiceEndPoint() { + return serviceEndPoint; + } - return baseWmsServiceHost; + /** + * Sets the service end point. + * + * @param serviceEndPoint the new service end point + */ + public void setServiceEndPoint(String serviceEndPoint) { + this.serviceEndPoint = serviceEndPoint; } /** @@ -180,11 +186,11 @@ public class GeoInformationForWMSRequest implements Serializable { /** * Sets the base wms service host. * - * @param baseWmsServiceHost the baseWmsServiceHost to set + * @param baseWmsServiceHost the new base wms service host */ public void setBaseWmsServiceHost(String baseWmsServiceHost) { - this.baseWmsServiceHost = baseWmsServiceHost; + this.serviceEndPoint = baseWmsServiceHost; } /** @@ -271,8 +277,8 @@ public class GeoInformationForWMSRequest implements Serializable { public String toString() { StringBuilder builder = new StringBuilder(); - builder.append("GeoInformationForWMSRequest [baseWmsServiceHost="); - builder.append(baseWmsServiceHost); + builder.append("GeoInformationForWMSRequest [serviceEndPoint="); + builder.append(serviceEndPoint); builder.append(", wmsRequest="); builder.append(wmsRequest); builder.append(", layerName="); diff --git a/src/main/webapp/GeoportalDataViewer.css b/src/main/webapp/GeoportalDataViewer.css index e3921ce..4518b9b 100644 --- a/src/main/webapp/GeoportalDataViewer.css +++ b/src/main/webapp/GeoportalDataViewer.css @@ -877,10 +877,14 @@ RESPONSIVE .dand-layer { width: 336px; } - .search-facility { - width: 100%; - } .thePopDataTable { + + } + .search-facility { + max-width: 680px; + } + .search-field { + width: 97%; } .ol-popup { min-width: 220px; @@ -889,6 +893,9 @@ RESPONSIVE .thePopDataTable tr:last-of-type { display: none; } + .layer-panel { + width: 355px; + } } @media all and (max-width: 1024px) { #timeline-data { @@ -900,8 +907,8 @@ RESPONSIVE width: 400px; } .search-facility { - width: 250px; - max-width: 300px; + /*width: 250px; + max-width: 300px;*/ } .inner-toolbar { /*width: 100px;*/