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 7faf54f..523cd43 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 @@ -1,5 +1,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client; +import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Set; @@ -231,10 +233,20 @@ public class GeoportalDataViewer implements EntryPoint { "//cdnjs.cloudflare.com/ajax/libs/nanogallery2/3.0.5/jquery.nanogallery2.min.js") .setWindow(ScriptInjector.TOP_WINDOW).inject(); + if (result.getAvailableCollections() == null + || result.getAvailableCollections().size() == 0) { + RootPanel.get(APP_DIV).remove(loaderApp); + Window.alert("No available collection in this context"); + RootPanel.get(APP_DIV).add(getGeneralErrorPanel()); + return; + } + GWT.log("Loading collections, count " + result.getAvailableCollections().size()); - mainPanel.setAvailableCollections(result.getAvailableCollections().values(), - paramGeonaItemType); + ArrayList listColl = new ArrayList(); + listColl.addAll(result.getAvailableCollections().values()); + Collections.sort(listColl); + mainPanel.setAvailableCollections(listColl, paramGeonaItemType); if (paramGeonaItemID != null) { if (paramGeonaItemType == null) { @@ -592,17 +604,17 @@ public class GeoportalDataViewer implements EntryPoint { @Override public void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent) { GWT.log("ShowPopupOnCentroidEvent: " + showPopupOnCentroiEvent); - - //Showing popup after clicking on map + + // Showing popup after clicking on map if (showPopupOnCentroiEvent.getProfileID() != null && showPopupOnCentroiEvent.getProjectID() != null) { Coordinate transfCoord = MapUtils .geoJSONTToBBoxCenter(showPopupOnCentroiEvent.getSpatialReference(), null, null); performWFSQueryOnCentroid(showPopupOnCentroiEvent.getProjectID(), transfCoord.getX(), transfCoord.getY()); - - //Showing popup after locate on Map - }else if(showPopupOnCentroiEvent.getProjectView()!=null) { + + // Showing popup after locate on Map + } else if (showPopupOnCentroiEvent.getProjectView() != null) { layerManager.showPopupInfoForCentroidLayer(showPopupOnCentroiEvent.getProjectView()); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java index 9ada671..ed89854 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.java @@ -187,6 +187,14 @@ public class GeonaDataViewMainPanel extends Composite { navListSearch.addItem(PLACEHOLDER_SELECT_SEARCH_IN, PLACEHOLDER_SELECT_SEARCH_IN); navListSearch.getElement().getFirstChildElement().setAttribute("disabled", "disabled"); + +// List listUCDs = new ArrayList(); +// +// for (ItemFieldsResponse itemFieldsResponse : itemFieldsReponse) { +// listUCDs.add(itemFieldsResponse.getUseCaseDescriptorDV()); +// } +// +// Collections.sort(listUCDs); for (final ItemFieldsResponse itemFieldResp : itemFieldsReponse) { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.ui.xml index 9208321..24aa44d 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataviewer/client/ui/GeonaDataViewMainPanel.ui.xml @@ -52,7 +52,7 @@ + addStyleNames="open-collection-style"> { -public class GCubeCollection implements Serializable { - - /** + /** * */ private static final long serialVersionUID = -3915546050671671465L; - + private UseCaseDescriptorDV ucd; - private List indexes; - - public GCubeCollection() { + private List indexes; + + public GCubeCollection() { } - + public UseCaseDescriptorDV getUcd() { return ucd; } - - public List getIndexes() { + + public List getIndexes() { return indexes; } - - - public void setUcd(UseCaseDescriptorDV ucd) { + + public void setUcd(UseCaseDescriptorDV ucd) { this.ucd = ucd; } - - public void setIndexes(List indexes) { + + public void setIndexes(List indexes) { this.indexes = indexes; } @@ -42,6 +39,24 @@ public class GCubeCollection implements Serializable { public String toString() { return "GCubeCollection [ucd=" + ucd + ", indexes=" + indexes + "]"; } - - + + @Override + public int compareTo(GCubeCollection o) { + + if (this == null || this.ucd == null) + return 1; + + if (o == null || o.getUcd() == null) + return -1; + + if (this.ucd.getName() == null) + return 1; + + if (o.getUcd().getName() == null) + return -1; + + return this.getUcd().getName().compareTo(o.getUcd().getName()); + + } + } diff --git a/src/main/webapp/GeoportalDataViewer.css b/src/main/webapp/GeoportalDataViewer.css index 78893b9..07aff81 100644 --- a/src/main/webapp/GeoportalDataViewer.css +++ b/src/main/webapp/GeoportalDataViewer.css @@ -771,6 +771,19 @@ RESPONSIVE } /* OPEN COLLECTION UI */ +.open-collection-style { + padding-left: 10px; + padding-right: 10px; +} + +.open-collection-style > div { + border: 1px solid #ccc !important; + border-radius: 5px; + padding: 10px; + margin-bottom: 10px; + margin-top: 5px; +} + .layer-style-panel { margin-left: 25px; font-size: 13px;