feature_22518 #5
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/geoportal-data-viewer-app-2.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/geoportal-data-viewer-app-2.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -35,5 +35,5 @@
|
|||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/geoportal-data-viewer-app-2.2.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
eclipse.preferences.version=1
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.1.0-SNAPSHOT
|
||||
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-2.2.0-SNAPSHOT
|
||||
warSrcDir=src/main/webapp
|
||||
warSrcDirIsOutput=false
|
||||
|
|
|
@ -1,41 +1,54 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-viewer-app-2.1.0-SNAPSHOT">
|
||||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-viewer-app-2.2.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||
|
||||
<dependent-module archiveName="geoportal-data-common-1.3.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<property name="context-root" value="geoportal-data-viewer-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</project-modules>
|
||||
|
|
|
@ -5,10 +5,17 @@ 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).
|
||||
|
||||
|
||||
## [v2.2.0-SNAPSHOT] - 2021-12-07
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#22518] Added the search for fields facility
|
||||
|
||||
## [v2.1.0-SNAPSHOT] - 2021-11-10
|
||||
|
||||
#### Enhancements
|
||||
|
||||
- [#22518] Added the search for name facility
|
||||
- [#22027] Integrated with MapBox Satellite
|
||||
- Added link "Open Project" in the pop-up of WFS details
|
||||
- Moved to gwt-ol3 v8.1.0-gwt2_9
|
||||
|
|
2
pom.xml
|
@ -14,7 +14,7 @@
|
|||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>2.1.0-SNAPSHOT</version>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
<name>GeoPortal Data Viewer App</name>
|
||||
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface</description>
|
||||
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
|
@ -24,8 +30,12 @@ import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetai
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEventHandler;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
|
||||
|
@ -52,6 +62,7 @@ import com.google.gwt.user.client.ui.HTML;
|
|||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
import ol.Coordinate;
|
||||
import ol.layer.Image;
|
||||
|
||||
/**
|
||||
* Entry point classes define <code>onModuleLoad()</code>.
|
||||
|
@ -89,7 +100,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
private String paramGeonaItemID;
|
||||
|
||||
private GeoNaDataViewerProfile geonaDataViewerProfile;
|
||||
private GNADataViewerConfigProfile geonaDataViewerProfile;
|
||||
|
||||
private OLMapManager olMapMng = null;
|
||||
|
||||
|
@ -100,6 +111,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
private HTML attributionDiv = new HTML();
|
||||
|
||||
private static List<BaseMapLayer> listBaseMapLayers = null;
|
||||
|
||||
private List<ItemField> displayFields = new ArrayList<ItemField>();
|
||||
private List<ItemField> sortByFields = new ArrayList<ItemField>();
|
||||
private List<ItemField> searchByFields = new ArrayList<ItemField>();
|
||||
|
||||
/**
|
||||
* This is the entry point method.
|
||||
|
@ -120,8 +135,50 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
RootPanel.get(APP_DIV).add(loaderApp);
|
||||
|
||||
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
|
||||
RootPanel.get(APP_DIV).add(mainPanel);
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().listOfFieldsForSearching(new AsyncCallback<List<ItemField>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert(caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<ItemField> result) {
|
||||
GWT.log("Loaded item fields: "+result);
|
||||
|
||||
for (ItemField itemField : result) {
|
||||
if(itemField.isDisplayAsResult()) {
|
||||
displayFields.add(itemField);
|
||||
}
|
||||
|
||||
if(itemField.isSearchable()) {
|
||||
searchByFields.add(itemField);
|
||||
}
|
||||
|
||||
if(itemField.isSortable()) {
|
||||
sortByFields.add(itemField);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GWT.log("List display fields: "+result);
|
||||
SearchingFilter initialSortFilter = new SearchingFilter();
|
||||
initialSortFilter.setOrder(ORDER.ASC);
|
||||
initialSortFilter.setOrderByFields(Arrays.asList(new ItemField("Name", Arrays.asList("name"), true, true, true)));
|
||||
|
||||
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight(),sortByFields,searchByFields,initialSortFilter);
|
||||
RootPanel.get(APP_DIV).add(mainPanel);
|
||||
|
||||
initApplication();
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void initApplication() {
|
||||
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
|
@ -176,11 +233,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
bindEvents();
|
||||
|
||||
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||
|
||||
}
|
||||
|
||||
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||
|
@ -194,7 +250,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
@Override
|
||||
public void execute() {
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance()
|
||||
.getGeoNaDataViewProfile(new AsyncCallback<GeoNaDataViewerProfile>() {
|
||||
.getGeoNaDataViewProfile(new AsyncCallback<GNADataViewerConfigProfile>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
@ -203,7 +259,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(GeoNaDataViewerProfile profile) {
|
||||
public void onSuccess(GNADataViewerConfigProfile profile) {
|
||||
geonaDataViewerProfile = profile;
|
||||
GWT.log("Profile: " + geonaDataViewerProfile);
|
||||
Iterator<String> it;
|
||||
|
@ -332,7 +388,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
public void run() {
|
||||
attempt++;
|
||||
GWT.log("waiting get record: " + attempt);
|
||||
RecordDV record = mainPanel.getDisplyedRecord();
|
||||
RecordDV record = mainPanel.getDisplayedRecord();
|
||||
if (record != null) {
|
||||
this.cancel();
|
||||
GWT.log("cancelled timer");
|
||||
|
@ -378,7 +434,7 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
@Override
|
||||
public void onZoomOut(ZoomOutOverMinimumEvent zoomOutEvent) {
|
||||
|
||||
if (mainPanel.getDisplyedRecord() == null && !olMapMng.isQueryPointActive()) {
|
||||
if (mainPanel.getDisplayedRecord() == null && !olMapMng.isQueryPointActive()) {
|
||||
olMapMng.hidePopInfo();
|
||||
layerManager.removeAllDetailLayers();
|
||||
|
||||
|
@ -469,6 +525,52 @@ public class GeoportalDataViewer implements EntryPoint {
|
|||
|
||||
}
|
||||
});
|
||||
|
||||
applicationBus.addHandler(ShowPopupOnCentroiEvent.TYPE, new ShowPopupOnCentroiEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent) {
|
||||
|
||||
if(showPopupOnCentroiEvent.getRecord()!=null)
|
||||
performWFSQueryOnCentroid(showPopupOnCentroiEvent.getRecord());
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
applicationBus.addHandler(SearchPerformedEvent.TYPE, new SearchPerformedEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onSearchDone(SearchPerformedEvent searchPerformedEvent) {
|
||||
|
||||
if(searchPerformedEvent!=null) {
|
||||
|
||||
|
||||
|
||||
LinkedHashMap<String, Image> wmsMap = olMapMng.getOLMap().getWmsLayerMap();
|
||||
String firstWMSKey = wmsMap.keySet().iterator().next();
|
||||
List<ConcessioneDV> result = searchPerformedEvent.getData();
|
||||
|
||||
if(result!=null && result.size()>0) {
|
||||
String cqlFilter = "product_id IN(";
|
||||
for (ConcessioneDV concessioneDV : result) {
|
||||
cqlFilter+="'"+concessioneDV.getItemId()+"',";
|
||||
}
|
||||
cqlFilter = cqlFilter.substring(0,cqlFilter.length()-1)+")";
|
||||
|
||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, cqlFilter);
|
||||
}else {
|
||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
||||
}
|
||||
|
||||
if(searchPerformedEvent.isSearchReset()) {
|
||||
olMapMng.getOLMap().setCQLFilterToWMSLayer(firstWMSKey, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,10 @@ public class GeoportalDataViewerConstants {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public enum RECORD_TYPE {
|
||||
CONCESSIONE
|
||||
}
|
||||
|
||||
public static final double ITALY_CENTER_LONG = 12.45;
|
||||
|
||||
|
|
|
@ -2,8 +2,11 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||
|
@ -80,16 +83,16 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
* @return the geo na data view profile
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception;
|
||||
GNADataViewerConfigProfile getGeoNaDataViewProfile() throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the uploaded images for id.
|
||||
*
|
||||
* @param itemType the item type
|
||||
* @param itemId the item id
|
||||
* @param itemType the item type
|
||||
* @param itemId the item id
|
||||
* @param maxImages the max images
|
||||
* @return the uploaded images for id
|
||||
* @throws Exception
|
||||
* @throws Exception
|
||||
*/
|
||||
List<UploadedImageDV> getUploadedImagesForId(String itemType, String itemId, Integer maxImages) throws Exception;
|
||||
|
||||
|
@ -105,8 +108,8 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
/**
|
||||
* Gets the layers for id.
|
||||
*
|
||||
* @param itemType the item type
|
||||
* @param itemId the item id
|
||||
* @param itemType the item type
|
||||
* @param itemId the item id
|
||||
* @return the layers for id
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
|
@ -127,5 +130,25 @@ public interface GeoportalDataViewerService extends RemoteService {
|
|||
|
||||
List<BaseMapLayer> getListBaseLayers();
|
||||
|
||||
/**
|
||||
* List of fields for searching.
|
||||
*
|
||||
* @return the list
|
||||
* @throws Exception
|
||||
*/
|
||||
List<ItemField> listOfFieldsForSearching() throws Exception;
|
||||
|
||||
/**
|
||||
* Gets the list concessioni.
|
||||
*
|
||||
* @param start the start
|
||||
* @param limit the limit
|
||||
* @param filter the filter
|
||||
* @param reloadFromService the reload from service
|
||||
* @return the list concessioni
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
||||
boolean reloadFromService) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,8 +2,11 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||
|
@ -37,8 +40,8 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
|
||||
void parseWmsRequest(String wmsRequest, String layerName, AsyncCallback<GeoInformationForWMSRequest> callback);
|
||||
|
||||
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature, double zoomLevel,
|
||||
AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||
void getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX, int maxWFSFeature,
|
||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||
|
||||
void getConcessioneForId(String mongoId, AsyncCallback<ConcessioneDV> callback);
|
||||
|
||||
|
@ -46,19 +49,23 @@ public interface GeoportalDataViewerServiceAsync {
|
|||
|
||||
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
|
||||
|
||||
void getGeoNaDataViewProfile(AsyncCallback<GeoNaDataViewerProfile> callback);
|
||||
void getGeoNaDataViewProfile(AsyncCallback<GNADataViewerConfigProfile> callback);
|
||||
|
||||
void getUploadedImagesForId(String itemType, String itemId, Integer maxImages,
|
||||
AsyncCallback<List<UploadedImageDV>> callback);
|
||||
|
||||
void getPublicLinksFor(GeoNaItemRef item, AsyncCallback<GeoNaItemRef> asyncCallback);
|
||||
|
||||
void getLayersForId(String itemType, String itemId,
|
||||
AsyncCallback<List<LayerConcessioneDV>> asyncCallback);
|
||||
void getLayersForId(String itemType, String itemId, AsyncCallback<List<LayerConcessioneDV>> asyncCallback);
|
||||
|
||||
void getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName, BoundsMap selectBBOX, int maxWFSFeature,
|
||||
double zoomLevel, AsyncCallback<List<GeoNaSpatialQueryResult>> callback);
|
||||
|
||||
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> callback);
|
||||
|
||||
void listOfFieldsForSearching(AsyncCallback<List<ItemField>> callback);
|
||||
|
||||
void getListConcessioni(Integer start, Integer limit, SearchingFilter filter, boolean reloadFromService,
|
||||
AsyncCallback<ResultSetPaginatedData> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public class OLMapManager {
|
|||
*
|
||||
* @param targetId the target id
|
||||
* @param layerManagerBus the layer manager bus
|
||||
* @param baseMapLayer the base map layer
|
||||
* @param baseMapLayer the base map layer
|
||||
*/
|
||||
public OLMapManager(String targetId, HandlerManager layerManagerBus, BaseMapLayer baseMapLayer) {
|
||||
this.targetId = targetId;
|
||||
|
@ -75,7 +75,8 @@ public class OLMapManager {
|
|||
//
|
||||
// }
|
||||
|
||||
ExtentWrapped toExt = new ExtentWrapped(coordinate.getX(), coordinate.getY(), coordinate.getX(), coordinate.getY());
|
||||
ExtentWrapped toExt = new ExtentWrapped(coordinate.getX(), coordinate.getY(), coordinate.getX(),
|
||||
coordinate.getY());
|
||||
GeoQuery select = toDataPointQuery(coordinate, true);
|
||||
layerManagerBus.fireEvent(new QueryDataEvent(select, toExt, null, true, MapEventType.MOUSE_CLICK));
|
||||
|
||||
|
@ -140,7 +141,7 @@ public class OLMapManager {
|
|||
/**
|
||||
* To data point query.
|
||||
*
|
||||
* @param coordinate the coordinate
|
||||
* @param coordinate the coordinate
|
||||
* @param manualClick the manual click
|
||||
* @return the geo query
|
||||
*/
|
||||
|
@ -157,12 +158,12 @@ public class OLMapManager {
|
|||
// ratio - mapPixelWeight : bboxWeight = 20px : geoRectangleWidth
|
||||
// where 10px is the pixel diameter dimension of the clicked point
|
||||
double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX());
|
||||
|
||||
|
||||
double geoWidth = 0;
|
||||
// adding a tolerance in case of manual click
|
||||
if (manualClick) {
|
||||
// adding a tolerance for clicking
|
||||
//geoWidth = (bboxWidth / w) * (14 / 2);
|
||||
// geoWidth = (bboxWidth / w) * (14 / 2);
|
||||
geoWidth = (bboxWidth / w) * (16 / 2);
|
||||
} else {
|
||||
// data point selection for coordinate loaded from concessione
|
||||
|
@ -211,7 +212,7 @@ public class OLMapManager {
|
|||
GWT.log("the distance is: " + dist);
|
||||
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
||||
GeoQuery select = toDataBoxQuery(dragEndExtent);
|
||||
//TODO THE AUTOMATICALLY SHOWING POP-UP ACCORDING TO ZOOM IS BUGGY
|
||||
// TODO THE AUTOMATICALLY SHOWING POP-UP ACCORDING TO ZOOM IS BUGGY
|
||||
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt, null, false, mapEventType));
|
||||
}
|
||||
} else if (zoomStart != null && zoomEnd != null) {
|
||||
|
|
|
@ -16,7 +16,6 @@ public class OverlayLayerManager {
|
|||
|
||||
public OverlayLayerManager(HandlerManager applicationBus) {
|
||||
this.applicationBus = applicationBus;
|
||||
//fp.addStyleName("layers-panel");
|
||||
}
|
||||
|
||||
void addLayerItem(LayerObject lo) {
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.RECORD_TYPE;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class GetListOfRecordsEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Dec 7, 2021
|
||||
*/
|
||||
public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler> {
|
||||
|
||||
/** The type. */
|
||||
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
|
||||
private RECORD_TYPE recordType;
|
||||
private SearchingFilter sortFilter;
|
||||
|
||||
/**
|
||||
* Instantiates a new cancel upload event.
|
||||
*
|
||||
* @param recordType the record type
|
||||
* @param sortFilter the sort filter
|
||||
*/
|
||||
public GetListOfRecordsEvent(RECORD_TYPE recordType, SearchingFilter sortFilter) {
|
||||
this.recordType = recordType;
|
||||
this.sortFilter = sortFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<GetListOfRecordsEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(GetListOfRecordsEventHandler handler) {
|
||||
handler.onGetList(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the record type.
|
||||
*
|
||||
* @return the record type
|
||||
*/
|
||||
public RECORD_TYPE getRecordType() {
|
||||
return recordType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sort filter.
|
||||
*
|
||||
* @return the sort filter
|
||||
*/
|
||||
public SearchingFilter getSortFilter() {
|
||||
return sortFilter;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface GetListOfRecordsEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Aug 4, 2021
|
||||
*/
|
||||
public interface GetListOfRecordsEventHandler extends EventHandler {
|
||||
|
||||
|
||||
/**
|
||||
* On get list.
|
||||
*
|
||||
* @param getListOfRecordsEvent the get list of records event
|
||||
*/
|
||||
void onGetList(GetListOfRecordsEvent getListOfRecordsEvent);
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class SearchPerformedEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Dec 14, 2021
|
||||
*/
|
||||
public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler> {
|
||||
public static Type<SearchPerformedEventHandler> TYPE = new Type<SearchPerformedEventHandler>();
|
||||
private List<ConcessioneDV> data;
|
||||
private boolean searchReset;
|
||||
|
||||
/**
|
||||
* Instantiates a new search performed event.
|
||||
*
|
||||
* @param data the data
|
||||
* @param searchReset the search reset
|
||||
*/
|
||||
public SearchPerformedEvent(List<ConcessioneDV> data, boolean searchReset) {
|
||||
this.data = data;
|
||||
this.searchReset = searchReset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<SearchPerformedEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(SearchPerformedEventHandler handler) {
|
||||
handler.onSearchDone(this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data.
|
||||
*
|
||||
* @return the data
|
||||
*/
|
||||
public List<ConcessioneDV> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is search reset.
|
||||
*
|
||||
* @return true, if is search reset
|
||||
*/
|
||||
public boolean isSearchReset() {
|
||||
return searchReset;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
/**
|
||||
* The Interface SearchPerformedEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Dec 14, 2021
|
||||
*/
|
||||
public interface SearchPerformedEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On search done.
|
||||
*
|
||||
* @param searchPerformedEvent the search performed event
|
||||
*/
|
||||
void onSearchDone(SearchPerformedEvent searchPerformedEvent);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
|
||||
/**
|
||||
* The Class ShowDetailsEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jul 30, 2021
|
||||
*/
|
||||
public class ShowPopupOnCentroiEvent extends GwtEvent<ShowPopupOnCentroiEventHandler> {
|
||||
public static Type<ShowPopupOnCentroiEventHandler> TYPE = new Type<ShowPopupOnCentroiEventHandler>();
|
||||
private RecordDV record;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new show details event.
|
||||
*
|
||||
* @param geonaItemType the geona item type
|
||||
* @param geonaMongoID the geona mongo ID
|
||||
* @param itemName the item name
|
||||
* @param featureRow the feature row
|
||||
*/
|
||||
public ShowPopupOnCentroiEvent(RecordDV record) {
|
||||
this.record = record;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the associated type.
|
||||
*
|
||||
* @return the associated type
|
||||
*/
|
||||
@Override
|
||||
public Type<ShowPopupOnCentroiEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch.
|
||||
*
|
||||
* @param handler the handler
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ShowPopupOnCentroiEventHandler handler) {
|
||||
handler.onShowPopup(this);
|
||||
|
||||
}
|
||||
|
||||
public RecordDV getRecord() {
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.events;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Interface ShowPopupOnCentroiEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Dec 10, 2021
|
||||
*/
|
||||
public interface ShowPopupOnCentroiEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On show popup.
|
||||
*
|
||||
* @param showPopupOnCentroiEvent the show popup on centroi event
|
||||
*/
|
||||
void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent);
|
||||
}
|
|
@ -395,9 +395,11 @@ public abstract class OpenLayerMap {
|
|||
if (layer == null) {
|
||||
ImageWmsParams imageWMSParams = OLFactory.createOptions();
|
||||
imageWMSParams.setLayers(layerItem.getName());
|
||||
//imageWMSParams.set("CQL_FILTER", "product_id IN('6165b07202ad3d60e1d26f42','6166ff8002ad3d60e1d26fb7')");
|
||||
|
||||
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
|
||||
imageWMSOptions.setUrl(layerItem.getMapServerHost());
|
||||
|
||||
imageWMSOptions.setParams(imageWMSParams);
|
||||
// imageWMSOptions.setRatio(1.5f);
|
||||
|
||||
|
@ -405,6 +407,7 @@ public abstract class OpenLayerMap {
|
|||
LayerOptions layerOptions = OLFactory.createOptions();
|
||||
layerOptions.setSource(imageWMSSource);
|
||||
|
||||
|
||||
// Settings MIN and MAX Resolution
|
||||
if (layerItem.getMinResolution() != null) {
|
||||
layerOptions.setMinResolution(layerItem.getMinResolution());
|
||||
|
@ -414,6 +417,7 @@ public abstract class OpenLayerMap {
|
|||
}
|
||||
|
||||
Image wmsLayer = new Image(layerOptions);
|
||||
|
||||
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_WMS)+wmsLayerMap.size()+1;
|
||||
wmsLayer.setZIndex(zIndex);
|
||||
// visibleLayerItems
|
||||
|
@ -428,6 +432,33 @@ public abstract class OpenLayerMap {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public void setCQLFilterToWMSLayer(String key, String cqlFilterExpression) {
|
||||
|
||||
GWT.log("Getting key: "+key);
|
||||
|
||||
GWT.log("Setting CQL FILTER: "+cqlFilterExpression);
|
||||
Image wmsLayer = wmsLayerMap.get(key);
|
||||
|
||||
GWT.log("WMS layer is: "+wmsLayer);
|
||||
|
||||
//map.removeLayer(wmsLayer);
|
||||
|
||||
ImageWms imageWMSSource = wmsLayer.getSource();
|
||||
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
|
||||
|
||||
if (cqlFilterExpression == null) {
|
||||
imageWMSParams.delete("CQL_FILTER");
|
||||
} else {
|
||||
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
|
||||
}
|
||||
|
||||
imageWMSSource.updateParams(imageWMSParams);
|
||||
wmsLayer.setSource(imageWMSSource);
|
||||
|
||||
//map.addLayer(wmsLayer);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the WMS detail layer.
|
||||
|
|
|
@ -6,23 +6,26 @@ import com.google.gwt.resources.client.CssResource;
|
|||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
public interface GNAImages extends ClientBundle {
|
||||
|
||||
|
||||
/** Get access to the css resource during gwt compilation */
|
||||
@Source("baseIcons.css")
|
||||
CssResource css();
|
||||
|
||||
public static final GNAImages ICONS = GWT.create(GNAImages.class);
|
||||
|
||||
/** Our sample image icon. Makes the image resource for the gwt-compiler's css composer accessible */
|
||||
@Source("map.png")
|
||||
ImageResource map();
|
||||
|
||||
@Source("preset_location.png")
|
||||
ImageResource preset_location();
|
||||
|
||||
@Source("layers.png")
|
||||
ImageResource layers();
|
||||
|
||||
|
||||
/**
|
||||
* Our sample image icon. Makes the image resource for the gwt-compiler's css
|
||||
* composer accessible
|
||||
*/
|
||||
@Source("map.png")
|
||||
ImageResource map();
|
||||
|
||||
@Source("preset_location.png")
|
||||
ImageResource preset_location();
|
||||
|
||||
@Source("layers.png")
|
||||
ImageResource layers();
|
||||
|
||||
@Source("loading.gif")
|
||||
ImageResource loading();
|
||||
|
||||
|
@ -38,4 +41,10 @@ public interface GNAImages extends ClientBundle {
|
|||
@Source("world.png")
|
||||
ImageResource worldIcon();
|
||||
|
||||
@Source("layer_visible.png")
|
||||
ImageResource layerVisible();
|
||||
|
||||
@Source("layer_invisible.png")
|
||||
ImageResource layerInvisible();
|
||||
|
||||
}
|
||||
|
|
|
@ -22,4 +22,4 @@
|
|||
vertical-align: middle;
|
||||
width: 17px !important;
|
||||
height: 17px !important;
|
||||
}
|
||||
}
|
||||
|
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 650 B |
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 810 B |
After Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 500 B After Width: | Height: | Size: 693 B |
After Width: | Height: | Size: 500 B |
After Width: | Height: | Size: 744 B |
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 599 B |
|
@ -3,6 +3,8 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||
|
@ -21,6 +23,8 @@ import com.github.gwtbootstrap.client.ui.NavLink;
|
|||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
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.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
|
@ -87,9 +91,15 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
@UiField
|
||||
Button linkLayers;
|
||||
|
||||
@UiField
|
||||
DropdownButton searchFacilityButton;
|
||||
|
||||
@UiField
|
||||
ScrollPanel overlayLayersPanel;
|
||||
|
||||
@UiField
|
||||
ScrollPanel searchFacilityPanel;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelAttribution;
|
||||
|
@ -109,6 +119,8 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
|
||||
private HandlerManager applicationBus;
|
||||
|
||||
private SearchFacilityUI searchFacility;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new geona data view main panel.
|
||||
|
@ -116,7 +128,8 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
* @param applicationBus the application bus
|
||||
* @param mapHeight the map height
|
||||
*/
|
||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight) {
|
||||
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight, List<ItemField> sortByFields,
|
||||
List<ItemField> searchForFields, SearchingFilter initialSortFilter) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.applicationBus = applicationBus;
|
||||
mapPanel = new MapPanel(mapHeight + "px");
|
||||
|
@ -142,6 +155,20 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||
|
||||
searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
||||
searchFacility.setSearchButton(searchFacilityButton);
|
||||
searchFacilityButton.setIcon(IconType.SEARCH);
|
||||
searchFacilityPanel.add(searchFacility);
|
||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
searchFacilityPanel.getElement().getParentElement().getStyle().setOpacity(0.9);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// layersDDB.setToggle(true);
|
||||
bindEvents();
|
||||
|
||||
|
@ -163,7 +190,17 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
searchFacilityButton.addDomHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
//event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
}
|
||||
}, ClickEvent.getType());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -295,7 +332,7 @@ public class GeonaDataViewMainPanel extends Composite {
|
|||
*
|
||||
* @return the displyed record
|
||||
*/
|
||||
public RecordDV getDisplyedRecord() {
|
||||
public RecordDV getDisplayedRecord() {
|
||||
return detailsPanel.getDisplayedRecord();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,19 @@
|
|||
</g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK" title="Select the Map" text="Map" ui:field="linkMap">
|
||||
<b:DropdownButton type="LINK" text="Search"
|
||||
ui:field="searchFacilityButton">
|
||||
<g:ScrollPanel ui:field="searchFacilityPanel"
|
||||
addStyleNames="search-facility"></g:ScrollPanel>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK"
|
||||
title="Select the Map" text="Map" ui:field="linkMap">
|
||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||
</g:HTMLPanel>
|
||||
</b:DropdownButton>
|
||||
<b:DropdownButton type="LINK"
|
||||
title="Center Map to Location" text="Preset Location" ui:field="linkPresetLocation">
|
||||
title="Center Map to Location" text="Preset Location"
|
||||
ui:field="linkPresetLocation">
|
||||
<b:Nav>
|
||||
<b:Button type="LINK" ui:field="extentToItaly"
|
||||
text="Italy" title="Center to Italy"></b:Button>
|
||||
|
|
|
@ -0,0 +1,498 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.LOGICAL_OP;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
|
||||
import org.gcube.application.geoportalcommon.shared.WhereClause;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.SearchPerformedEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowPopupOnCentroiEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Alert;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.DropdownButton;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.NavLink;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
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;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyPressEvent;
|
||||
import com.google.gwt.event.dom.client.KeyPressHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
/**
|
||||
* The Class SearchFacilityUI.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Dec 14, 2021
|
||||
*/
|
||||
public class SearchFacilityUI extends Composite {
|
||||
|
||||
private static SearchFacilityPanelUiBinder uiBinder = GWT.create(SearchFacilityPanelUiBinder.class);
|
||||
|
||||
protected static final int MIN_LENGHT_SERCHING_STRING = 3;
|
||||
|
||||
@UiField
|
||||
ListBox listBoxSortBy;
|
||||
|
||||
@UiField
|
||||
ListBox listBoxSearchFor;
|
||||
|
||||
@UiField
|
||||
TextBox searchField;
|
||||
|
||||
@UiField
|
||||
NavLink sortByToogle;
|
||||
|
||||
@UiField
|
||||
Button resetSearch;
|
||||
|
||||
@UiField
|
||||
HTMLPanel panelResults;
|
||||
|
||||
@UiField
|
||||
HorizontalPanel toogleSortBy;
|
||||
|
||||
private List<ItemField> searchForFields;
|
||||
|
||||
private List<ItemField> sortByFields;
|
||||
|
||||
private SearchingFilter currentSortFilter;
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
||||
private static final String LABEL_FILTER_SEPARATOR = " - ";
|
||||
|
||||
private ResultSetPaginatedData latestResult;
|
||||
|
||||
private DropdownButton searchFacilityButton;
|
||||
|
||||
/**
|
||||
* The Interface SearchFacilityPanelUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Dec 14, 2021
|
||||
*/
|
||||
interface SearchFacilityPanelUiBinder extends UiBinder<Widget, SearchFacilityUI> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new search facility UI.
|
||||
*
|
||||
* @param appManagerBus the app manager bus
|
||||
* @param sortByFields the sort by fields
|
||||
* @param searchForFields the search for fields
|
||||
* @param initialSortFilter the initial sort filter
|
||||
*/
|
||||
public SearchFacilityUI(HandlerManager appManagerBus, List<ItemField> sortByFields, List<ItemField> searchForFields,
|
||||
SearchingFilter initialSortFilter) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.searchForFields = searchForFields;
|
||||
this.currentSortFilter = initialSortFilter;
|
||||
this.sortByFields = sortByFields;
|
||||
this.appManagerBus = appManagerBus;
|
||||
|
||||
resetSearch.setType(ButtonType.LINK);
|
||||
|
||||
listBoxSortBy.setWidth("180px");
|
||||
listBoxSearchFor.setWidth("140px");
|
||||
|
||||
bindEvents();
|
||||
}
|
||||
|
||||
/**
|
||||
* To label filter.
|
||||
*
|
||||
* @param itemField the item field
|
||||
* @param direction the direction
|
||||
* @return the string
|
||||
*/
|
||||
private String toLabelFilter(ItemField itemField, ORDER direction) {
|
||||
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
|
||||
return labelFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind events.
|
||||
*/
|
||||
private void bindEvents() {
|
||||
|
||||
for (ItemField record_FIELD : sortByFields) {
|
||||
if(record_FIELD.isSortable()) {
|
||||
String labelASC = toLabelFilter(record_FIELD, ORDER.ASC);
|
||||
String labelDESC = toLabelFilter(record_FIELD, ORDER.DESC);
|
||||
listBoxSortBy.addItem(labelASC);
|
||||
listBoxSortBy.addItem(labelDESC);
|
||||
}
|
||||
}
|
||||
|
||||
listBoxSortBy.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
if(latestResult!=null && latestResult.getData().size()>0) {
|
||||
doSearchEvent();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
for (ItemField record_FIELD : searchForFields) {
|
||||
GWT.log("search for: "+record_FIELD);
|
||||
if(record_FIELD.isSearchable()) {
|
||||
listBoxSearchFor.addItem(record_FIELD.getDisplayName());
|
||||
}
|
||||
}
|
||||
|
||||
listBoxSearchFor.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
if (searchField.getText().length() >= MIN_LENGHT_SERCHING_STRING) {
|
||||
doSearchEvent();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
sortByToogle.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
if (toogleSortBy.isVisible())
|
||||
toogleSortBy.setVisible(false);
|
||||
else
|
||||
toogleSortBy.setVisible(true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
searchField.addKeyPressHandler(new KeyPressHandler() {
|
||||
|
||||
@Override
|
||||
public void onKeyPress(KeyPressEvent event) {
|
||||
if (com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER == event.getCharCode()) {
|
||||
GWT.log(searchField.getText());
|
||||
doSearchEvent();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
resetSearch.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
searchField.setText("");
|
||||
resetSearch.setVisible(false);
|
||||
panelResults.clear();
|
||||
latestResult = null;
|
||||
appManagerBus.fireEvent(new SearchPerformedEvent(null,true));
|
||||
setSearchEnabled(false);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void setSearchEnabled(boolean bool) {
|
||||
if(bool) {
|
||||
searchFacilityButton.getElement().addClassName("highlight-button");
|
||||
}
|
||||
else {
|
||||
searchFacilityButton.getElement().removeClassName("highlight-button");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search concessioni.
|
||||
*/
|
||||
private void searchConcessioni() {
|
||||
|
||||
SearchingFilter filter = getCurrentSortFilter();
|
||||
panelResults.clear();
|
||||
panelResults.add(new HTML("<hr>"));
|
||||
panelResults.add(new LoaderIcon("Searching..."));
|
||||
GeoportalDataViewerServiceAsync.Util.getInstance().getListConcessioni(0, 30, filter, false,
|
||||
new AsyncCallback<ResultSetPaginatedData>() {
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// showLoading(false);
|
||||
// Window.alert(caught.getMessage());
|
||||
panelResults.clear();
|
||||
panelResults.add(new HTML("<hr>"));
|
||||
Alert alert = new Alert("Error on searching. Please, refresh or change the search");
|
||||
alert.setType(AlertType.ERROR);
|
||||
alert.setClose(false);
|
||||
panelResults.add(alert);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(ResultSetPaginatedData result) {
|
||||
|
||||
appManagerBus.fireEvent(new SearchPerformedEvent(result.getData(),false));
|
||||
setSearchEnabled(true);
|
||||
latestResult = result;
|
||||
|
||||
panelResults.clear();
|
||||
panelResults.add(new HTML("<hr>"));
|
||||
|
||||
if (result.getData().size() == 0) {
|
||||
panelResults.add(new HTML("No result found"));
|
||||
return;
|
||||
}
|
||||
|
||||
FlexTable ft = new FlexTable();
|
||||
ft.getElement().setClassName("table-results");
|
||||
int i = 1;
|
||||
ft.setWidget(0, i, new HTML("Nome Progetto"));
|
||||
|
||||
String selValue = listBoxSearchFor.getSelectedValue().toLowerCase();
|
||||
|
||||
boolean addIntroduction = false;
|
||||
if(selValue.startsWith("proj") || selValue.startsWith("any")) {
|
||||
ft.setWidget(0, ++i, new HTML("Introduzione"));
|
||||
addIntroduction = true;
|
||||
}
|
||||
|
||||
boolean addStaff = false;
|
||||
if(selValue.startsWith("director")) {
|
||||
ft.setWidget(0, ++i, new HTML("Autori"));
|
||||
ft.setWidget(0, ++i, new HTML("Responsabile"));
|
||||
ft.setWidget(0, ++i, new HTML("Editore"));
|
||||
ft.setWidget(0, ++i, new HTML("Titolari"));
|
||||
ft.setWidget(0, ++i, new HTML("Contributore"));
|
||||
addStaff = true;
|
||||
}
|
||||
boolean addParole = false;
|
||||
if(selValue.startsWith("keyword")) {
|
||||
ft.setWidget(0, ++i, new HTML("Parole Libere"));
|
||||
ft.setWidget(0, ++i, new HTML("Parole Cronologia"));
|
||||
addParole = true;
|
||||
}
|
||||
|
||||
i = 1;
|
||||
for (ConcessioneDV concessione : result.getData()) {
|
||||
int j = -1;
|
||||
|
||||
NavLink locateOnMap = new NavLink("Show");
|
||||
locateOnMap.setTitle("Locate on the Map and show details");
|
||||
locateOnMap.setIcon(IconType.MAP_MARKER);
|
||||
|
||||
locateOnMap.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
GeoNaItemRef gir = new GeoNaItemRef(concessione.getItemId(), GeoportalDataViewerConstants.RECORD_TYPE.CONCESSIONE.toString());
|
||||
appManagerBus.fireEvent(new ShowDetailsEvent(gir, null, null));
|
||||
appManagerBus.fireEvent(new ShowPopupOnCentroiEvent(concessione));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ft.setWidget(i, ++j, locateOnMap);
|
||||
|
||||
|
||||
ft.setWidget(i, ++j, new HTML(concessione.getNome()));
|
||||
if(addIntroduction)
|
||||
ft.setWidget(i, ++j, new HTML(StringUtil.ellipsize(concessione.getIntroduzione(), 200)));
|
||||
|
||||
if(addStaff) {
|
||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getAuthors())));
|
||||
ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getResponsabile()))));
|
||||
ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getEditore()))));
|
||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getTitolari())));
|
||||
ft.setWidget(i, ++j, new HTML(toDisplayList(Arrays.asList(concessione.getContributore()))));
|
||||
}
|
||||
|
||||
if(addParole) {
|
||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getParoleChiaveLibere())));
|
||||
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getParoleChiaveICCD())));
|
||||
}
|
||||
|
||||
|
||||
// List<UploadedImageDV> listImg = concessione.getImmaginiRappresentative();
|
||||
// GWT.log(listImg.toString());
|
||||
// boolean imagePreviewFound = false;
|
||||
// if (listImg != null && listImg.size() > 0) {
|
||||
//
|
||||
// UploadedImageDV uImg = listImg.get(0);
|
||||
//
|
||||
// if (uImg != null && uImg.getListWsContent() != null
|
||||
// && uImg.getListWsContent().size() > 0) {
|
||||
// WorkspaceContentDV wsc = uImg.getListWsContent().get(0);
|
||||
// String image = "<img style=\"width:50px;height:50px;\" src='" + wsc.getLink()
|
||||
// + "' alt='" + wsc.getName() + "'>";
|
||||
// ft.setWidget(i, 2, new HTML(image));
|
||||
// imagePreviewFound = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (!imagePreviewFound) {
|
||||
// ft.setWidget(i, 2, new Image(GNAImages.ICONS.italyIcon()));
|
||||
// }
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
panelResults.add(ft);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* To display authors.
|
||||
*
|
||||
* @param listValues the list values
|
||||
* @return the string
|
||||
*/
|
||||
private String toDisplayList(List<String> listValues) {
|
||||
String toDisplay = "";
|
||||
if (listValues == null)
|
||||
return toDisplay;
|
||||
|
||||
for (String author : listValues) {
|
||||
toDisplay += author + "; ";
|
||||
}
|
||||
return toDisplay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do search event.
|
||||
*/
|
||||
private void doSearchEvent() {
|
||||
String searchText = searchField.getText();
|
||||
if (searchText.length() < MIN_LENGHT_SERCHING_STRING) {
|
||||
Window.alert("Please enter at least " + MIN_LENGHT_SERCHING_STRING + " characters");
|
||||
return;
|
||||
}
|
||||
|
||||
resetSearch.setVisible(true);
|
||||
// appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE,
|
||||
// getCurrentSortFilter()));
|
||||
|
||||
searchConcessioni();
|
||||
}
|
||||
|
||||
/**
|
||||
* To sort filter.
|
||||
*
|
||||
* @param labelFilter the label filter
|
||||
* @return the searching filter
|
||||
*/
|
||||
public SearchingFilter toSortFilter(String labelFilter) {
|
||||
GWT.log("toSortFilter for label " + labelFilter);
|
||||
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
|
||||
|
||||
SearchingFilter sortFilter = null;
|
||||
try {
|
||||
ItemField recordField = null;
|
||||
for (ItemField value : sortByFields) {
|
||||
if (array[0].equalsIgnoreCase(value.getDisplayName())) {
|
||||
recordField = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ORDER orderField = ORDER.valueOf(array[1]);
|
||||
sortFilter = new SearchingFilter(Arrays.asList(recordField), orderField);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
GWT.log("toSortFilter Got " + sortFilter);
|
||||
return sortFilter;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Built searching filter.
|
||||
*
|
||||
* @return the searching filter
|
||||
*/
|
||||
private SearchingFilter builtSearchingFilter() {
|
||||
SearchingFilter searchingFilter = toSortFilter(listBoxSortBy.getSelectedValue());
|
||||
String searchText = searchField.getText();
|
||||
if (searchText != null && !searchText.isEmpty()) {
|
||||
Map<String, Object> searchInto = new HashMap<String, Object>();
|
||||
|
||||
List<String> listOfSeachingFields = new ArrayList<String>();
|
||||
|
||||
for (ItemField recordField : searchForFields) {
|
||||
if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
|
||||
listOfSeachingFields = recordField.getJsonFields();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(listOfSeachingFields.size()==0) {
|
||||
listOfSeachingFields.add("nome");
|
||||
}
|
||||
for (String fieldname : listOfSeachingFields) {
|
||||
searchInto.put(fieldname, searchText);
|
||||
}
|
||||
|
||||
WhereClause where = new WhereClause();
|
||||
where.setSearchInto(searchInto);
|
||||
where.setOperator(LOGICAL_OP.OR);
|
||||
|
||||
//THIS CLAUSE IS ADDED IN ORDER TO SEARCH ONLY PUBLISHED PRODUCT (WITH SUCCESS)
|
||||
Map<String, Object> searchInto2 = new HashMap<String, Object>();
|
||||
searchInto2.put("report.status", "PASSED");
|
||||
WhereClause where2 = new WhereClause(LOGICAL_OP.AND, searchInto2);
|
||||
|
||||
searchingFilter.setConditions(Arrays.asList(where, where2));
|
||||
}
|
||||
return searchingFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current sort filter.
|
||||
*
|
||||
* @return the current sort filter
|
||||
*/
|
||||
public SearchingFilter getCurrentSortFilter() {
|
||||
currentSortFilter = builtSearchingFilter();
|
||||
GWT.log("currentSortFilter: " + currentSortFilter);
|
||||
return currentSortFilter;
|
||||
}
|
||||
|
||||
public void setSearchButton(DropdownButton searchFacilityButton) {
|
||||
this.searchFacilityButton = searchFacilityButton;
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
|
||||
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:c="urn:import:org.gcube.portlets.user.geoportaldataviewer.client.ui">
|
||||
<ui:style>
|
||||
.important {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.container-panel {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.add-margin-right {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.add-margin-right-23 {
|
||||
margin-right: 23px;
|
||||
}
|
||||
|
||||
.margin-top-5 {
|
||||
margin-top: 5px;
|
||||
}
|
||||
.font-size-12 {
|
||||
font-size: 12px;
|
||||
}
|
||||
</ui:style>
|
||||
<g:HTMLPanel addStyleNames="{style.container-panel}">
|
||||
<g:FlowPanel>
|
||||
<g:FlowPanel>
|
||||
<g:FlowPanel>
|
||||
<g:HorizontalPanel>
|
||||
<g:Label addStyleNames="{style.add-margin-right}">Search for: </g:Label>
|
||||
<b:ListBox title="Search for"
|
||||
ui:field="listBoxSearchFor"
|
||||
addStyleNames="{style.add-margin-right}">
|
||||
</b:ListBox>
|
||||
<b:TextBox ui:field="searchField"
|
||||
addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox>
|
||||
<b:Button icon="REMOVE_CIRCLE" ui:field="resetSearch"
|
||||
title="Reset the search" visible="false">Reset</b:Button>
|
||||
</g:HorizontalPanel>
|
||||
</g:FlowPanel>
|
||||
<g:FlowPanel>
|
||||
<b:NavLink ui:field="sortByToogle" addStyleNames="{style.font-size-12}">Sort Results</b:NavLink>
|
||||
<g:HorizontalPanel ui:field="toogleSortBy"
|
||||
addStyleNames="{style.margin-top-5}" visible="false">
|
||||
<g:Label addStyleNames="{style.add-margin-right-23}">Sort by: </g:Label>
|
||||
<b:ListBox ui:field="listBoxSortBy">
|
||||
</b:ListBox>
|
||||
</g:HorizontalPanel>
|
||||
</g:FlowPanel>
|
||||
</g:FlowPanel>
|
||||
<g:HTMLPanel ui:field="panelResults">
|
||||
</g:HTMLPanel>
|
||||
</g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -4,18 +4,20 @@ import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
|||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
|
||||
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.CheckBox;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.constants.IconType;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.DragLeaveEvent;
|
||||
import com.google.gwt.event.dom.client.DragLeaveHandler;
|
||||
import com.google.gwt.event.dom.client.DragOverEvent;
|
||||
|
@ -24,11 +26,11 @@ import com.google.gwt.event.dom.client.DragStartEvent;
|
|||
import com.google.gwt.event.dom.client.DragStartHandler;
|
||||
import com.google.gwt.event.dom.client.DropEvent;
|
||||
import com.google.gwt.event.dom.client.DropHandler;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.google.gwt.user.client.ui.SimplePanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
@ -38,25 +40,28 @@ public class DragDropLayer extends FlowPanel {
|
|||
private static DragDropLayer draggingTarget = null;
|
||||
final boolean droppable;
|
||||
private Label labelLayerName;
|
||||
private CheckBox checkBoxVisibility = new CheckBox();
|
||||
private Image imgLayerVisible = new Image(GNAImages.ICONS.layerVisible());
|
||||
private Image imgLayerInvisible = new Image(GNAImages.ICONS.layerInvisible());
|
||||
private Button draggableButton = new Button();
|
||||
private HandlerManager applicationBus;
|
||||
private LayerObject layerObject;
|
||||
private LayerItem layerItem;
|
||||
private boolean layerVisibility = true;
|
||||
private HTML buttonLayerVisibility = new HTML();
|
||||
|
||||
public DragDropLayer(HandlerManager applicationBus, LayerObject layerObject, boolean draggable, boolean droppable) {
|
||||
this.applicationBus = applicationBus;
|
||||
this.layerObject = layerObject;
|
||||
this.layerItem = layerObject.getLayerItem();
|
||||
|
||||
|
||||
String layerName = StringUtil.fullNameToLayerName(layerItem.getName(), ":");
|
||||
|
||||
|
||||
this.labelLayerName = new Label(layerName);
|
||||
this.labelLayerName.setTitle(layerItem.getName());
|
||||
this.labelLayerName.setType(LabelType.INFO);
|
||||
|
||||
|
||||
BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
|
||||
String nameConcessione = StringUtil.ellipsize(refConcessione.getNome(),40);
|
||||
String nameConcessione = StringUtil.ellipsize(refConcessione.getNome(), 40);
|
||||
com.google.gwt.user.client.ui.Label labelConcessione = new com.google.gwt.user.client.ui.Label(nameConcessione);
|
||||
labelConcessione.setTitle(refConcessione.getNome());
|
||||
|
||||
|
@ -79,33 +84,47 @@ public class DragDropLayer extends FlowPanel {
|
|||
}
|
||||
|
||||
RangeSlider rs = new RangeSlider(applicationBus, layerItem);
|
||||
rs.getElement().addClassName("range-slider ");
|
||||
rs.getElement().addClassName("range-slider");
|
||||
FlexTable ft = new FlexTable();
|
||||
ft.setWidget(0, 0, draggableButton);
|
||||
draggableButton.setTitle("Drag and Drop me up or down to change my position on the Map");
|
||||
checkBoxVisibility.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
checkBoxVisibility.setValue(true);
|
||||
|
||||
//labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
ft.setWidget(0, 1, checkBoxVisibility);
|
||||
imgLayerVisible.getElement().addClassName("layer-visibility-st");
|
||||
imgLayerInvisible.getElement().addClassName("layer-visibility-st");
|
||||
setLayerVisibilityButtonImage();
|
||||
|
||||
// labelLayerName.getElement().getStyle().setMarginLeft(10, Unit.PX);
|
||||
ft.setWidget(0, 1, buttonLayerVisibility);
|
||||
ft.setWidget(0, 2, labelConcessione);
|
||||
ft.setWidget(1, 2, labelLayerName);
|
||||
ft.setWidget(2, 2, new SimplePanel(rs));
|
||||
add(ft);
|
||||
draggableButton.setIcon(IconType.MOVE);
|
||||
|
||||
checkBoxVisibility.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||
buttonLayerVisibility.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layerItem);
|
||||
dae.setVisibility(checkBoxVisibility.getValue());
|
||||
public void onClick(ClickEvent event) {
|
||||
layerVisibility = !layerVisibility;
|
||||
setLayerVisibilityButtonImage();
|
||||
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY,
|
||||
layerItem);
|
||||
dae.setVisibility(layerVisibility);
|
||||
applicationBus.fireEvent(dae);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setLayerVisibilityButtonImage() {
|
||||
buttonLayerVisibility.getElement().removeAllChildren();
|
||||
if (layerVisibility) {
|
||||
buttonLayerVisibility.getElement().appendChild(imgLayerVisible.getElement());
|
||||
} else {
|
||||
buttonLayerVisibility.getElement().appendChild(imgLayerInvisible.getElement());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initDrag() {
|
||||
draggableButton.getElement().setDraggable(Element.DRAGGABLE_TRUE);
|
||||
|
||||
|
@ -156,9 +175,9 @@ public class DragDropLayer extends FlowPanel {
|
|||
source = dragging;
|
||||
int sourceIndex = tree.getWidgetIndex(source);
|
||||
int targetIndex = tree.getWidgetIndex(draggingTarget);
|
||||
|
||||
GWT.log("sourceIndex: " + sourceIndex+", sourceItem: "+dragging.getLayerItem().getName());
|
||||
GWT.log("targetIndex: " + targetIndex+", targetItem: "+draggingTarget.getLayerItem().getName());
|
||||
|
||||
GWT.log("sourceIndex: " + sourceIndex + ", sourceItem: " + dragging.getLayerItem().getName());
|
||||
GWT.log("targetIndex: " + targetIndex + ", targetItem: " + draggingTarget.getLayerItem().getName());
|
||||
if (sourceIndex != targetIndex && targetIndex >= 0) {
|
||||
tree.remove(source);
|
||||
target = tree;
|
||||
|
@ -168,8 +187,10 @@ public class DragDropLayer extends FlowPanel {
|
|||
// target.setState(true);
|
||||
DoActionOnDetailLayersEvent actionSwapLayers = new DoActionOnDetailLayersEvent(
|
||||
DO_LAYER_ACTION.SWAP, layerItem);
|
||||
SwapLayer swapLS = new DoActionOnDetailLayersEvent.SwapLayer(dragging.getLayerItem(), sourceIndex);
|
||||
SwapLayer swapLT = new DoActionOnDetailLayersEvent.SwapLayer(draggingTarget.getLayerItem(), targetIndex);
|
||||
SwapLayer swapLS = new DoActionOnDetailLayersEvent.SwapLayer(dragging.getLayerItem(),
|
||||
sourceIndex);
|
||||
SwapLayer swapLT = new DoActionOnDetailLayersEvent.SwapLayer(draggingTarget.getLayerItem(),
|
||||
targetIndex);
|
||||
actionSwapLayers.setSwapLayers(swapLS, swapLT);
|
||||
applicationBus.fireEvent(actionSwapLayers);
|
||||
}
|
||||
|
@ -179,7 +200,7 @@ public class DragDropLayer extends FlowPanel {
|
|||
}
|
||||
}, DropEvent.getType());
|
||||
}
|
||||
|
||||
|
||||
public LayerItem getLayerItem() {
|
||||
return layerItem;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class MapView extends Composite {
|
|||
@UiField
|
||||
HorizontalPanel coordinatePanel;
|
||||
|
||||
private LightOpenLayerMap lightOLSM;
|
||||
private LightOpenLayerMap lightOLM;
|
||||
|
||||
private HTML attributionDiv = null;
|
||||
|
||||
|
@ -92,14 +92,14 @@ public class MapView extends Composite {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
lightOLSM = new LightOpenLayerMap(theMapId);
|
||||
lightOLM = new LightOpenLayerMap(theMapId);
|
||||
setBaseLayers();
|
||||
|
||||
// EPSG_3857 LOCATION TO ITALY
|
||||
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
|
||||
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
|
||||
lightOLSM.setCenter(transformedCenterCoordinate);
|
||||
lightOLSM.setZoom(GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON);
|
||||
lightOLM.setCenter(transformedCenterCoordinate);
|
||||
lightOLM.setZoom(GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class MapView extends Composite {
|
|||
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
lightOLSM.changeBaseMap(baseMapLayer);
|
||||
lightOLM.changeBaseMap(baseMapLayer);
|
||||
setMapAttribution(baseMapLayer);
|
||||
}
|
||||
});
|
||||
|
@ -193,9 +193,9 @@ public class MapView extends Composite {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
if (lightOLSM != null) {
|
||||
lightOLSM.addPoint(coordinate, showCoordinateText, true);
|
||||
lightOLSM.getMap().getView().setCenter(coordinate);
|
||||
if (lightOLM != null) {
|
||||
lightOLM.addPoint(coordinate, showCoordinateText, true);
|
||||
lightOLM.getMap().getView().setCenter(coordinate);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -232,11 +232,11 @@ public class MapView extends Composite {
|
|||
null);
|
||||
}
|
||||
|
||||
lightOLSM.addWMSLayer(mapServerHost, layerName, theBBOX);
|
||||
lightOLM.addWMSLayer(mapServerHost, layerName, theBBOX);
|
||||
|
||||
if (ew != null) {
|
||||
|
||||
lightOLSM.getMap().getView().fit(ew);
|
||||
lightOLM.getMap().getView().fit(ew);
|
||||
|
||||
}
|
||||
|
||||
|
@ -245,8 +245,8 @@ public class MapView extends Composite {
|
|||
|
||||
}
|
||||
|
||||
public LightOpenLayerMap getLightOLSM() {
|
||||
return lightOLSM;
|
||||
public LightOpenLayerMap getLightOLM() {
|
||||
return lightOLM;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public class LayerConcessioneView extends Composite {
|
|||
}
|
||||
|
||||
// DOWNLOAD the OSM + layer by canvas
|
||||
downloadMap(mapView.getLightOLSM().getMap(), mapView.getPanelMapElementId(), htmlLinkId,
|
||||
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId,
|
||||
filename, mimeType);
|
||||
// mapExport(mapView.getLightOLSM().getMap(), mapView.getPanelMapElementId());
|
||||
}
|
||||
|
|
|
@ -14,11 +14,14 @@ import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
|||
import org.gcube.application.geoportal.common.model.legacy.LayerConcessione;
|
||||
import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||
import org.gcube.application.geoportalcommon.GeoNaDataViewerProfileReader;
|
||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
||||
import org.gcube.application.geoportalcommon.shared.ItemField;
|
||||
import org.gcube.application.geoportalcommon.shared.LayerItem;
|
||||
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
|
||||
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
|
||||
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
|
||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
|
@ -67,6 +70,27 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
|
||||
private static final String CACHE_IMAGE_PREVIEW_FOR_CONCESSIONE = "MAP_IMAGE_PREVIEW_FOR_CONCESSIONE";
|
||||
|
||||
/**
|
||||
* Gets the GNA data viewe config profile.
|
||||
*
|
||||
* @return the GNA data viewe config profile
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
private GNADataViewerConfigProfile getGNADataVieweConfigProfile() throws Exception {
|
||||
|
||||
GNADataViewerConfigProfile profile = SessionUtil.getGNADataViewerConfigProfile(getThreadLocalRequest());
|
||||
if (profile == null) {
|
||||
LOG.info(GNADataViewerConfigProfile.class.getSimpleName() + " is null, loading configurations from IS");
|
||||
//to be sure
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GeoportalCommon geoportalComm = new GeoportalCommon();
|
||||
profile = geoportalComm.readGNADataViewerConfig(null);
|
||||
} else {
|
||||
LOG.info(GNADataViewerConfigProfile.class.getSimpleName() + " read from session");
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the wms request.
|
||||
*
|
||||
|
@ -88,8 +112,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @return the geo information for WMS request
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName)
|
||||
throws Exception {
|
||||
public GeoInformationForWMSRequest loadGeoInfoForWmsRequest(String wmsLink, String layerName) throws Exception {
|
||||
try {
|
||||
WMSUrlValidator validator = new WMSUrlValidator(wmsLink, layerName);
|
||||
String wmsServiceHost = validator.getWmsServiceHost();
|
||||
|
@ -322,7 +345,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
if (layerPosizionamento != null) {
|
||||
if (!GeoNACheckAccessPolicy.isAccessible(layerPosizionamento.getPolicy(), userName)) {
|
||||
concessionDV.setPosizionamentoScavo(null);
|
||||
LOG.info("Posizionamento di Scavo is not accessible by current user: "+userName);
|
||||
LOG.info("Posizionamento di Scavo is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,8 +355,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
for (LayerConcessioneDV layerDV : listLayersDV) {
|
||||
if (GeoNACheckAccessPolicy.isAccessible(layerDV.getPolicy(), userName)) {
|
||||
accessibleListLayersDV.add(layerDV);
|
||||
}else {
|
||||
LOG.info("(Pianta) Layer "+layerDV.getLayerName()+" is not accessible by current user: "+userName);
|
||||
} else {
|
||||
LOG.info("(Pianta) Layer " + layerDV.getLayerName()
|
||||
+ " is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
concessionDV.setPianteFineScavo(accessibleListLayersDV);
|
||||
|
@ -343,7 +367,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
if (abstractRS != null) {
|
||||
if (!GeoNACheckAccessPolicy.isAccessible(abstractRS.getPolicy(), userName)) {
|
||||
concessionDV.setAbstractRelazioneScavo(null);
|
||||
LOG.info("Abstract relazione is not accessible by current user: "+userName);
|
||||
LOG.info("Abstract relazione is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,7 +375,7 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
if (relazioneScavo != null) {
|
||||
if (!GeoNACheckAccessPolicy.isAccessible(relazioneScavo.getPolicy(), userName)) {
|
||||
concessionDV.setRelazioneScavo(null);
|
||||
LOG.info("Relazione scavo is not accessible by current user: "+userName);
|
||||
LOG.info("Relazione scavo is not accessible by current user: " + userName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -364,8 +388,9 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
|
||||
if (GeoNACheckAccessPolicy.isAccessible(uploadedImageDV.getPolicy(), userName)) {
|
||||
accessibleListImages.add(uploadedImageDV);
|
||||
}else {
|
||||
LOG.info("Immagine "+uploadedImageDV.getTitolo()+" is not accessible by current user: "+userName);
|
||||
} else {
|
||||
LOG.info("Immagine " + uploadedImageDV.getTitolo()
|
||||
+ " is not accessible by current user: " + userName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -451,8 +476,8 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
throw new Exception("The input parameter layerType is null or empty");
|
||||
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GeoNaDataViewerProfileReader gdvp = new GeoNaDataViewerProfileReader("geoportal-data-viewer-app");
|
||||
GeoNaDataViewerProfile profile = gdvp.readProfileFromInfrastrucure();
|
||||
|
||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||
LOG.info("Read profile: " + profile);
|
||||
|
||||
String lowerLayerType = layerType.toLowerCase();
|
||||
|
@ -477,12 +502,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public GeoNaDataViewerProfile getGeoNaDataViewProfile() throws Exception {
|
||||
public GNADataViewerConfigProfile getGeoNaDataViewProfile() throws Exception {
|
||||
LOG.info("getGeoNaDataViewProfile called");
|
||||
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GeoportalCommon gc = new GeoportalCommon();
|
||||
org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile profile = gc.getGeoNaDataViewProfile(null);
|
||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||
LOG.info("Returning profile: " + profile);
|
||||
return profile;
|
||||
}
|
||||
|
@ -666,17 +690,73 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the list base layers.
|
||||
*
|
||||
* @return the list base layers
|
||||
*/
|
||||
@Override
|
||||
public List<BaseMapLayer> getListBaseLayers() {
|
||||
LOG.info("getListBaseLayers called");
|
||||
List<BaseMapLayer> listBL = new ArrayList<BaseMapLayer>();
|
||||
//Setting scope in the cuurent thread
|
||||
// Setting scope in the cuurent thread
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
listBL = SessionUtil.getGNABaseMaps(this.getThreadLocalRequest());
|
||||
LOG.info("getListBaseLayers returning "+listBL.size() +" base maps");
|
||||
LOG.info("getListBaseLayers returning " + listBL.size() + " base maps");
|
||||
return listBL;
|
||||
|
||||
}
|
||||
|
||||
// TODO THIS PART REQUIRES THE JSON MAPPING based on keys read from gCube Meta
|
||||
|
||||
/**
|
||||
* List of fields for searching.
|
||||
*
|
||||
* @return the list
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public List<ItemField> listOfFieldsForSearching() throws Exception {
|
||||
LOG.info("listOfFieldsForSearching called");
|
||||
SessionUtil.getCurrentContext(this.getThreadLocalRequest(), true);
|
||||
GNADataViewerConfigProfile profile = getGNADataVieweConfigProfile();
|
||||
return profile.getListItemFields();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list concessioni.
|
||||
*
|
||||
* @param start the start
|
||||
* @param limit the limit
|
||||
* @param filter the filter
|
||||
* @param reloadFromService the reload from service
|
||||
* @return the list concessioni
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@Override
|
||||
public ResultSetPaginatedData getListConcessioni(Integer start, Integer limit, SearchingFilter filter,
|
||||
boolean reloadFromService) throws Exception {
|
||||
LOG.info("getListConcessioni called wit start: " + start + ", limit: " + limit + ", filter: " + filter);
|
||||
|
||||
try {
|
||||
|
||||
SessionUtil.getCurrentContext(getThreadLocalRequest(), true);
|
||||
MongoServiceCommon serviceCommon = new MongoServiceCommon();
|
||||
// TODO MUST BE REPLACED BY COUNT
|
||||
List<Concessione> listOfConcessioni = SessionUtil.getListOfConcessioni(getThreadLocalRequest(),
|
||||
reloadFromService);
|
||||
int listConcessioniSize = listOfConcessioni.size();
|
||||
|
||||
ResultSetPaginatedData searchedData = serviceCommon.queryOnMongo(listConcessioniSize, start, limit, filter,
|
||||
"concessione");
|
||||
return searchedData;
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error on loading paginated and filtered list of concessioni: ", e);
|
||||
throw new Exception("Error occurred on loading list of Concessioni. Error: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,17 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.gcube.application.geoportal.common.model.legacy.Concessione;
|
||||
import org.gcube.application.geoportal.common.rest.MongoConcessioni;
|
||||
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
||||
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
|
||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.portal.PortalContext;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
|
@ -39,6 +45,8 @@ public class SessionUtil {
|
|||
|
||||
private static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
||||
private static final String LIST_BASE_MAPS_LAYERS = "LIST_BASE_MAPS_LAYERS";
|
||||
private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI_DATA_VIEWER";
|
||||
private static final String GNA_DATAVIEWER_CONFIG_PROFILE = "GNA_DATAVIEWER_CONFIG_PROFILE";
|
||||
|
||||
/**
|
||||
* Checks if is into portal.
|
||||
|
@ -197,4 +205,69 @@ public class SessionUtil {
|
|||
}
|
||||
return lstBML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of concessioni.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param reloadFromService the reload from service
|
||||
* @return the list of concessioni
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public static List<Concessione> getListOfConcessioni(HttpServletRequest httpServletRequest,
|
||||
boolean reloadFromService) throws Exception {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
List<Concessione> listOfConcessioni = (List<Concessione>) session.getAttribute(LIST_OF_CONCESSIONI);
|
||||
|
||||
// setting null to force reloading from service
|
||||
if (reloadFromService)
|
||||
listOfConcessioni = null;
|
||||
|
||||
if (listOfConcessioni == null) {
|
||||
listOfConcessioni = new ArrayList<Concessione>();
|
||||
LOG.info("Loading list of concessione from client mongo");
|
||||
SessionUtil.getCurrentContext(httpServletRequest, true);
|
||||
MongoServiceCommon serviceUtil = new MongoServiceCommon();
|
||||
MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||
|
||||
Iterator<Concessione> concessioni = clientMongo.getList();
|
||||
if (concessioni != null) {
|
||||
while (concessioni.hasNext()) {
|
||||
Concessione concessione = (Concessione) concessioni.next();
|
||||
listOfConcessioni.add(concessione);
|
||||
|
||||
}
|
||||
}
|
||||
// LOG.debug("Got list of concessioni from client mongo: " + listOfConcessioni);
|
||||
session.setAttribute(LIST_OF_CONCESSIONI, listOfConcessioni);
|
||||
LOG.info("Saved in session list of concessioni from client mongo with size: " + listOfConcessioni.size());
|
||||
} else
|
||||
LOG.info("list of concessioni presents in session, using it");
|
||||
|
||||
LOG.info("read list of concessioni with size: " + listOfConcessioni.size());
|
||||
return listOfConcessioni;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the GNA data viewer config profile.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @return the GNA data viewer config profile
|
||||
*/
|
||||
public static GNADataViewerConfigProfile getGNADataViewerConfigProfile(HttpServletRequest httpServletRequest) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
return (GNADataViewerConfigProfile) session.getAttribute(GNA_DATAVIEWER_CONFIG_PROFILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list item fields config.
|
||||
*
|
||||
* @param httpServletRequest the http servlet request
|
||||
* @param gNADVConfigProfile the g NADV config profile
|
||||
*/
|
||||
public static void setListItemFieldsConfig(HttpServletRequest httpServletRequest,
|
||||
GNADataViewerConfigProfile gNADVConfigProfile) {
|
||||
HttpSession session = httpServletRequest.getSession();
|
||||
session.setAttribute(GNA_DATAVIEWER_CONFIG_PROFILE, gNADVConfigProfile);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -450,4 +450,64 @@ body {
|
|||
top: 50%;
|
||||
left: 50%;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
|
||||
.search-facility {
|
||||
width: 600px;
|
||||
max-height: 700px;
|
||||
}
|
||||
|
||||
.search-textbox {
|
||||
padding: 4px 14px !important;
|
||||
margin-bottom: 0 !important;
|
||||
margin-left: 2px !important;
|
||||
margin-right: 2px !important;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif !important;
|
||||
font-size: 13px !important;
|
||||
font-weight: normal !important;
|
||||
-webkit-border-radius: 15px;
|
||||
-moz-border-radius: 15px;
|
||||
border-radius: 15px !important;
|
||||
width: 250px !important;
|
||||
}
|
||||
|
||||
.table-results {
|
||||
table-layout: fixed;
|
||||
/*width: 600px;*/
|
||||
}
|
||||
|
||||
.table-results td {
|
||||
padding: 5px;
|
||||
/* For Firefox */
|
||||
white-space: pre-wrap;
|
||||
/*word-break: break-all;*/
|
||||
/* For Chrome and IE */
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.table-results tr:nth-child(1) {
|
||||
font-weight: bolder;
|
||||
color: #333;
|
||||
font-style: italic
|
||||
}
|
||||
|
||||
.table-results tr {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.table-results td:nth-child(1) {
|
||||
}
|
||||
|
||||
.highlight-button {
|
||||
border: 2px solid #08c;
|
||||
border-radius: 4px;
|
||||
box-shadow: 2px 2px #08c;
|
||||
}
|
||||
.layer-visibility-st {
|
||||
padding-left: 7px;
|
||||
padding-right: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
package org.gcube.portlets.user.geoportaldataviewer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
|