In progress #22518
This commit is contained in:
parent
50ac34dddb
commit
5daa568c44
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<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>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
@ -35,5 +35,5 @@
|
||||||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</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>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
eclipse.preferences.version=1
|
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
|
warSrcDir=src/main/webapp
|
||||||
warSrcDirIsOutput=false
|
warSrcDirIsOutput=false
|
||||||
|
|
|
@ -1,41 +1,54 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
<?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="/target/m2e-wtp/web-resources"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
<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="/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/java"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<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="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"/>
|
<property name="context-root" value="geoportal-data-viewer-app"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</wb-module>
|
</wb-module>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project-modules>
|
</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).
|
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
|
## [v2.1.0-SNAPSHOT] - 2021-11-10
|
||||||
|
|
||||||
#### Enhancements
|
#### Enhancements
|
||||||
|
|
||||||
|
- [#22518] Added the search for name facility
|
||||||
- [#22027] Integrated with MapBox Satellite
|
- [#22027] Integrated with MapBox Satellite
|
||||||
- Added link "Open Project" in the pop-up of WFS details
|
- Added link "Open Project" in the pop-up of WFS details
|
||||||
- Moved to gwt-ol3 v8.1.0-gwt2_9
|
- Moved to gwt-ol3 v8.1.0-gwt2_9
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -14,7 +14,7 @@
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>geoportal-data-viewer-app</artifactId>
|
<artifactId>geoportal-data-viewer-app</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
<name>GeoPortal Data Viewer App</name>
|
<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>
|
<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,16 @@
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.client;
|
package org.gcube.portlets.user.geoportaldataviewer.client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
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.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.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
@ -100,6 +105,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
private HTML attributionDiv = new HTML();
|
private HTML attributionDiv = new HTML();
|
||||||
|
|
||||||
private static List<BaseMapLayer> listBaseMapLayers = null;
|
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.
|
* This is the entry point method.
|
||||||
|
@ -120,8 +129,49 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(loaderApp);
|
RootPanel.get(APP_DIV).add(loaderApp);
|
||||||
|
|
||||||
mainPanel = new GeonaDataViewMainPanel(applicationBus, getClientHeight());
|
GeoportalDataViewerServiceAsync.Util.getInstance().listOfFieldsForSearching(new AsyncCallback<List<ItemField>>() {
|
||||||
RootPanel.get(APP_DIV).add(mainPanel);
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
Window.alert(caught.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<ItemField> result) {
|
||||||
|
|
||||||
|
for (ItemField itemField : result) {
|
||||||
|
if(itemField.isDisplayIntoTable()) {
|
||||||
|
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(),searchByFields,sortByFields,initialSortFilter);
|
||||||
|
RootPanel.get(APP_DIV).add(mainPanel);
|
||||||
|
|
||||||
|
initApplication();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initApplication() {
|
||||||
|
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
@ -176,11 +226,10 @@ public class GeoportalDataViewer implements EntryPoint {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
RootPanel.get(APP_DIV).add(attributionDiv);
|
RootPanel.get(APP_DIV).add(attributionDiv);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<BaseMapLayer> getListBaseMapLayers() {
|
public static List<BaseMapLayer> getListBaseMapLayers() {
|
||||||
|
|
|
@ -67,6 +67,10 @@ public class GeoportalDataViewerConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum RECORD_TYPE {
|
||||||
|
CONCESSIONE
|
||||||
|
}
|
||||||
|
|
||||||
public static final double ITALY_CENTER_LONG = 12.45;
|
public static final double ITALY_CENTER_LONG = 12.45;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
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.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
|
@ -127,5 +130,25 @@ public interface GeoportalDataViewerService extends RemoteService {
|
||||||
|
|
||||||
List<BaseMapLayer> getListBaseLayers();
|
List<BaseMapLayer> getListBaseLayers();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of fields for searching.
|
||||||
|
*
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
|
List<ItemField> listOfFieldsForSearching();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
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.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.LayerConcessioneDV;
|
||||||
|
@ -61,4 +64,9 @@ public interface GeoportalDataViewerServiceAsync {
|
||||||
|
|
||||||
void getListBaseLayers(AsyncCallback<List<BaseMapLayer>> 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 targetId the target id
|
||||||
* @param layerManagerBus the layer manager bus
|
* @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) {
|
public OLMapManager(String targetId, HandlerManager layerManagerBus, BaseMapLayer baseMapLayer) {
|
||||||
this.targetId = targetId;
|
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);
|
GeoQuery select = toDataPointQuery(coordinate, true);
|
||||||
layerManagerBus.fireEvent(new QueryDataEvent(select, toExt, null, true, MapEventType.MOUSE_CLICK));
|
layerManagerBus.fireEvent(new QueryDataEvent(select, toExt, null, true, MapEventType.MOUSE_CLICK));
|
||||||
|
|
||||||
|
@ -140,7 +141,7 @@ public class OLMapManager {
|
||||||
/**
|
/**
|
||||||
* To data point query.
|
* To data point query.
|
||||||
*
|
*
|
||||||
* @param coordinate the coordinate
|
* @param coordinate the coordinate
|
||||||
* @param manualClick the manual click
|
* @param manualClick the manual click
|
||||||
* @return the geo query
|
* @return the geo query
|
||||||
*/
|
*/
|
||||||
|
@ -157,12 +158,12 @@ public class OLMapManager {
|
||||||
// ratio - mapPixelWeight : bboxWeight = 20px : geoRectangleWidth
|
// ratio - mapPixelWeight : bboxWeight = 20px : geoRectangleWidth
|
||||||
// where 10px is the pixel diameter dimension of the clicked point
|
// where 10px is the pixel diameter dimension of the clicked point
|
||||||
double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX());
|
double bboxWidth = Math.abs(olMap.getExtent().getLowerLeftX() - olMap.getExtent().getUpperRightX());
|
||||||
|
|
||||||
double geoWidth = 0;
|
double geoWidth = 0;
|
||||||
// adding a tolerance in case of manual click
|
// adding a tolerance in case of manual click
|
||||||
if (manualClick) {
|
if (manualClick) {
|
||||||
// adding a tolerance for clicking
|
// adding a tolerance for clicking
|
||||||
//geoWidth = (bboxWidth / w) * (14 / 2);
|
// geoWidth = (bboxWidth / w) * (14 / 2);
|
||||||
geoWidth = (bboxWidth / w) * (16 / 2);
|
geoWidth = (bboxWidth / w) * (16 / 2);
|
||||||
} else {
|
} else {
|
||||||
// data point selection for coordinate loaded from concessione
|
// data point selection for coordinate loaded from concessione
|
||||||
|
@ -211,7 +212,7 @@ public class OLMapManager {
|
||||||
GWT.log("the distance is: " + dist);
|
GWT.log("the distance is: " + dist);
|
||||||
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
if (dist > 5000 || startExt.containsExtent(endExt)) {
|
||||||
GeoQuery select = toDataBoxQuery(dragEndExtent);
|
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));
|
layerManagerBus.fireEvent(new QueryDataEvent(select, endExt, null, false, mapEventType));
|
||||||
}
|
}
|
||||||
} else if (zoomStart != null && zoomEnd != null) {
|
} else if (zoomStart != null && zoomEnd != null) {
|
||||||
|
|
|
@ -16,7 +16,6 @@ public class OverlayLayerManager {
|
||||||
|
|
||||||
public OverlayLayerManager(HandlerManager applicationBus) {
|
public OverlayLayerManager(HandlerManager applicationBus) {
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
//fp.addStyleName("layers-panel");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addLayerItem(LayerObject lo) {
|
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);
|
||||||
|
}
|
|
@ -3,6 +3,8 @@ package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
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.ConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
|
||||||
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
|
||||||
|
@ -87,9 +89,15 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
Button linkLayers;
|
Button linkLayers;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
DropdownButton searchFacilityButton;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
ScrollPanel overlayLayersPanel;
|
ScrollPanel overlayLayersPanel;
|
||||||
|
|
||||||
|
@UiField
|
||||||
|
ScrollPanel searchFacilityPanel;
|
||||||
|
|
||||||
@UiField
|
@UiField
|
||||||
HTMLPanel panelAttribution;
|
HTMLPanel panelAttribution;
|
||||||
|
@ -109,6 +117,8 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
|
|
||||||
private HandlerManager applicationBus;
|
private HandlerManager applicationBus;
|
||||||
|
|
||||||
|
private SearchFacilityUI searchFacility;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new geona data view main panel.
|
* Instantiates a new geona data view main panel.
|
||||||
|
@ -116,7 +126,8 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
* @param applicationBus the application bus
|
* @param applicationBus the application bus
|
||||||
* @param mapHeight the map height
|
* @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));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.applicationBus = applicationBus;
|
this.applicationBus = applicationBus;
|
||||||
mapPanel = new MapPanel(mapHeight + "px");
|
mapPanel = new MapPanel(mapHeight + "px");
|
||||||
|
@ -142,6 +153,8 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
|
||||||
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
|
||||||
|
|
||||||
|
searchFacility = new SearchFacilityUI(applicationBus, sortByFields, searchForFields, initialSortFilter);
|
||||||
|
searchFacilityPanel.add(searchFacility);
|
||||||
// layersDDB.setToggle(true);
|
// layersDDB.setToggle(true);
|
||||||
bindEvents();
|
bindEvents();
|
||||||
|
|
||||||
|
@ -163,7 +176,17 @@ public class GeonaDataViewMainPanel extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
searchFacilityButton.addDomHandler(new ClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(ClickEvent event) {
|
||||||
|
//event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
}
|
||||||
|
}, ClickEvent.getType());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,12 +35,14 @@
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK" title="Select the Map" text="Map" ui:field="linkMap">
|
<b:DropdownButton type="LINK"
|
||||||
|
title="Select the Map" text="Map" ui:field="linkMap">
|
||||||
<g:HTMLPanel ui:field="panelBaseLayers">
|
<g:HTMLPanel ui:field="panelBaseLayers">
|
||||||
</g:HTMLPanel>
|
</g:HTMLPanel>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
<b:DropdownButton type="LINK"
|
<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:Nav>
|
||||||
<b:Button type="LINK" ui:field="extentToItaly"
|
<b:Button type="LINK" ui:field="extentToItaly"
|
||||||
text="Italy" title="Center to Italy"></b:Button>
|
text="Italy" title="Center to Italy"></b:Button>
|
||||||
|
@ -50,6 +52,10 @@
|
||||||
text="World" title="Center to World"></b:Button>
|
text="World" title="Center to World"></b:Button>
|
||||||
</b:Nav>
|
</b:Nav>
|
||||||
</b:DropdownButton>
|
</b:DropdownButton>
|
||||||
|
<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" text="Query"
|
<b:DropdownButton type="LINK" text="Query"
|
||||||
visible="false">
|
visible="false">
|
||||||
<!-- <b:ButtonGroup toggle="checkbox" ui:field="buttonGroup"> -->
|
<!-- <b:ButtonGroup toggle="checkbox" ui:field="buttonGroup"> -->
|
||||||
|
|
|
@ -0,0 +1,369 @@
|
||||||
|
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
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.ORDER;
|
||||||
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.RECORD_TYPE;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.events.GetListOfRecordsEvent;
|
||||||
|
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
|
||||||
|
|
||||||
|
import com.github.gwtbootstrap.client.ui.Button;
|
||||||
|
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.ButtonType;
|
||||||
|
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;
|
||||||
|
|
||||||
|
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 = " - ";
|
||||||
|
|
||||||
|
interface SearchFacilityPanelUiBinder extends UiBinder<Widget, SearchFacilityUI> {
|
||||||
|
}
|
||||||
|
|
||||||
|
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("130px");
|
||||||
|
listBoxSearchFor.setWidth("130px");
|
||||||
|
|
||||||
|
bindEvents();
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
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) {
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for (ItemField record_FIELD : searchForFields) {
|
||||||
|
listBoxSearchFor.addItem(record_FIELD.getDisplayName());
|
||||||
|
}
|
||||||
|
|
||||||
|
listBoxSearchFor.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChange(ChangeEvent event) {
|
||||||
|
|
||||||
|
// alertSearchFor.setText(listBoxSearchFor.getSelectedValue());
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// navShowOnMap.addClickHandler(new ClickHandler() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onClick(ClickEvent event) {
|
||||||
|
// List<ConcessioneDV> listConcessioni = null;
|
||||||
|
// if (grpw != null && grpw.getSelectItems() != null) {
|
||||||
|
// listConcessioni = grpw.getSelectItems();
|
||||||
|
// }
|
||||||
|
// appManagerBus
|
||||||
|
// .fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.VIEW_ON_MAP));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
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("");
|
||||||
|
appManagerBus.fireEvent(new GetListOfRecordsEvent(RECORD_TYPE.CONCESSIONE, getCurrentSortFilter()));
|
||||||
|
resetSearch.setVisible(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void searchConcessioni() {
|
||||||
|
|
||||||
|
SearchingFilter filter = getCurrentSortFilter();
|
||||||
|
|
||||||
|
GeoportalDataViewerServiceAsync.Util.getInstance().getListConcessioni(0, 30, filter, false,
|
||||||
|
new AsyncCallback<ResultSetPaginatedData>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// showLoading(false);
|
||||||
|
// Window.alert(caught.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ResultSetPaginatedData 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 = 0;
|
||||||
|
ft.setWidget(0, i, new HTML("Name"));
|
||||||
|
|
||||||
|
String selValue = listBoxSearchFor.getSelectedValue().toLowerCase();
|
||||||
|
|
||||||
|
boolean addIntroduction = false;
|
||||||
|
if(selValue.startsWith("name")) {
|
||||||
|
ft.setWidget(0, ++i, new HTML("Introduction"));
|
||||||
|
addIntroduction = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean addStaff = false;
|
||||||
|
if(selValue.startsWith("staff")) {
|
||||||
|
ft.setWidget(0, ++i, new HTML("Staff"));
|
||||||
|
addStaff = true;
|
||||||
|
}
|
||||||
|
boolean addParole = false;
|
||||||
|
if(selValue.startsWith("parola")) {
|
||||||
|
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;
|
||||||
|
ft.setWidget(i, ++j, new HTML(concessione.getNome()));
|
||||||
|
if(addIntroduction)
|
||||||
|
ft.setWidget(i, ++j, new HTML(StringUtil.ellipsize(concessione.getIntroduzione(), 100)));
|
||||||
|
|
||||||
|
if(addStaff) {
|
||||||
|
ft.setWidget(i, ++j, new HTML(toDisplayList(concessione.getAuthors())));
|
||||||
|
}
|
||||||
|
|
||||||
|
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 authors the authors
|
||||||
|
* @return the string
|
||||||
|
*/
|
||||||
|
private String toDisplayList(List<String> listValues) {
|
||||||
|
String toDisplay = "";
|
||||||
|
if (listValues == null)
|
||||||
|
return toDisplay;
|
||||||
|
|
||||||
|
for (String author : listValues) {
|
||||||
|
toDisplay += author + "; ";
|
||||||
|
}
|
||||||
|
return toDisplay;
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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>();
|
||||||
|
|
||||||
|
String searchForField = "";
|
||||||
|
|
||||||
|
for (ItemField recordField : searchForFields) {
|
||||||
|
if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
|
||||||
|
searchForField = recordField.getJsonFields().get(0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
searchInto.put(searchForField, searchText);
|
||||||
|
searchingFilter.setSearchInto(searchInto);
|
||||||
|
}
|
||||||
|
return searchingFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SearchingFilter getCurrentSortFilter() {
|
||||||
|
currentSortFilter = builtSearchingFilter();
|
||||||
|
GWT.log("currentSortFilter: " + currentSortFilter);
|
||||||
|
return currentSortFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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>
|
|
@ -16,9 +16,13 @@ import org.gcube.application.geoportal.common.model.legacy.UploadedImage;
|
||||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||||
import org.gcube.application.geoportalcommon.GeoNaDataViewerProfileReader;
|
import org.gcube.application.geoportalcommon.GeoNaDataViewerProfileReader;
|
||||||
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
import org.gcube.application.geoportalcommon.GeoportalCommon;
|
||||||
|
import org.gcube.application.geoportalcommon.MongoServiceCommon;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
import org.gcube.application.geoportalcommon.shared.GeoNaDataViewerProfile;
|
||||||
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
|
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.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.gis.BoundsMap;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.BaseConcessioneDV;
|
||||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||||
|
@ -667,6 +671,11 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the list base layers.
|
||||||
|
*
|
||||||
|
* @return the list base layers
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<BaseMapLayer> getListBaseLayers() {
|
public List<BaseMapLayer> getListBaseLayers() {
|
||||||
LOG.info("getListBaseLayers called");
|
LOG.info("getListBaseLayers called");
|
||||||
|
@ -678,5 +687,66 @@ public class GeoportalDataViewerServiceImpl extends RemoteServiceServlet impleme
|
||||||
return listBL;
|
return listBL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO THIS PART REQUIRES THE JSON MAPPING based on keys read from gCube Meta
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of fields for searching.
|
||||||
|
*
|
||||||
|
* @return the list
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ItemField> listOfFieldsForSearching() {
|
||||||
|
//GeoportalCommon gc = new GeoportalCommon();
|
||||||
|
//return gc.getGNADataConfig().getListItemFields();
|
||||||
|
|
||||||
|
List<ItemField> listItemFields = new ArrayList<ItemField>();
|
||||||
|
listItemFields.add(new ItemField("Name", Arrays.asList("nome"), true, true, true));
|
||||||
|
listItemFields.add(new ItemField("Staff", Arrays.asList("authors"), true, true, true));
|
||||||
|
listItemFields.add(new ItemField("Parola chiave", Arrays.asList("paroleChiaveLibere","paroleChiaveICCD"), true, true, true));
|
||||||
|
return listItemFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
|
// MongoServiceUtil serviceUtil = new MongoServiceUtil();
|
||||||
|
// MongoConcessioni clientMongo = serviceUtil.getInstanceMongoConcessioni();
|
||||||
|
|
||||||
|
// 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,16 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
package org.gcube.portlets.user.geoportaldataviewer.server.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
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.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.portal.PortalContext;
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
@ -40,6 +45,8 @@ public class SessionUtil {
|
||||||
private static final String URL_SHORTENER_SERVICE = "URL_SHORTENER_SERVICE";
|
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_BASE_MAPS_LAYERS = "LIST_BASE_MAPS_LAYERS";
|
||||||
|
|
||||||
|
private static final String LIST_OF_CONCESSIONI = "LIST_OF_CONCESSIONI_DATA_VIEWER";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is into portal.
|
* Checks if is into portal.
|
||||||
*
|
*
|
||||||
|
@ -197,4 +204,47 @@ public class SessionUtil {
|
||||||
}
|
}
|
||||||
return lstBML;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -450,4 +450,52 @@ body {
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************/
|
||||||
|
|
||||||
|
.search-facility {
|
||||||
|
width: 600px;
|
||||||
|
max-height: 700px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-textbox {
|
||||||
|
padding: 4px 14px !important;
|
||||||
|
margin-bottom: 0 !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) {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue