Compare commits

..

8 Commits

164 changed files with 5512 additions and 13281 deletions

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/geoportal-data-viewer-app-3.6.0/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/geoportal-data-viewer-app-3.6.0/WEB-INF/classes"/>
</classpath>

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
/bin/
/target/

View File

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>geoportal-data-viewer-app-ws</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.gwtplugins.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.gwtplugins.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>com.gwtplugins.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

View File

@ -1,4 +0,0 @@
eclipse.preferences.version=1
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-viewer-app/target/geoportal-data-viewer-app-3.6.0
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
gwtSyncCodeServer=true

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,925 +0,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-3.6.0">
<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"/>
<dependent-module archiveName="geoportal-data-mapper-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-mapper/geoportal-data-mapper">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="uri-resolver-manager-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
<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>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<installed facet="com.gwtplugins.gwt.facet" version="1.0"/>
<installed facet="jst.jaxrs" version="2.0"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="3.0"/>
</faceted-project>

View File

@ -4,87 +4,10 @@
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).
## [v3.6.0]
- GUI optimization [#25461]
- Using the latest libraries version: gwt-ol.v8.4.1 (with openlayers.v6.6.1) and gwt.v2.10
- Showing basic statistics (i.e. "X project published") via 'countByPhase' method [#25598]
## [v3.0.0-SNAPSHOT] - 2022-08-09
## [v3.5.0]
- Supported the cross-filtering [#25074]
- Supported the grouped custom layers [#25110]
- Managed the (WMS) Layer Style facility [#25066]
## [v3.4.0] - 2023-05-11
- Integrated the geoportal-data-mapper component [#24978]
## [v3.3.1] - 2023-03-30
- Just including new dependencies
- Improved css
## [v3.3.0] - 2023-02-20
#### Fixes
- [#24632] Returning the public layer index if the private is missing
- [#24632] No temporal info shown if the temporal extent is missing
## [v3.2.1] - 2023-02-03
#### Fixes
- [#24432] Reverting serialization LinkedHashMap<String, String> to LinkedHashMap<String, Object>.
- Improved Alert UX in case of broken shared link
- Moved to gwt 2.9.0
## [v3.2.0] - 2023-01-31
#### Enhancements
- [#24506] Added facility: Locate/Highlight the Layer on the Map
## [v3.1.0] - 2023-01-12
#### Enhancements
- [#24300] Improved the GUI of the search functionality when multiple collections are available
- [#24404] Improved the handlers of events: Search, Locate
- Improved the user experience providing an animated map and zoom to layers facility
#### Fixes
- Reduced the BBOX when resolving a project by share link
- GNA Project binding with automatically adding of the layers to Map
- [#24390] Read the access policy from the fileset json section
- [#24432] Fixing serialization issue using LinkedHashMap<String, String> instead of LinkedHashMap<String, Object>
## [v3.0.0] - 2022-11-28
- [#23940] Passed to CMS-UCD
- [#23941] Implemented and integrated the DTO Project/Document per UCD config and gCube Metadata Profiles
- [#23953] Passed the 'Search facility' to CMS-UCD model
- [#23954] Passed the 'Details Panel facility' to CMS-UCD model
- [#23955] Implemented the Temporal facility to navigate temporal relations among (JSON) Projects
- [#24028] Passed the spatial dimension to CMS-Project model
- [#24136] Integrated the temporal dimension on the front-end side
- [#24195] Integrated the temporal query
## [v2.4.1-SNAPSHOT] - 2022-09-28
- [#23906] Tested building on jenkins with JDK_11
## [v2.4.0] - 2022-09-07
#### Enhancement
- [#23819] Adding layers to principal map belonging to more centroids with the same spatial position
## [v2.3.1] - 2022-08-29
#### Bug fixed
- [#23770] OpenLayers CDN URLs updated (github relative URL changed from "master/en/vX.Y.Z/" to "main/dist/en/vX.Y.Z/")
- Support for Use Case Descriptors
## [v2.3.0] - 2022-07-26

View File

@ -1,6 +1,6 @@
# GeoPortal Data Viewer App
The "Geoportal data-viewer" technology allows users to access and search for spatio-temporal documents through a web GIS which allows them to: (i) navigate and select the projects published in the system by "geographical map" (spatial dimension) , (ii) navigate and select the relationships between projects (evolution of over time) via "timeline" (temporal dimension), (iii) view metadata and resources (images, layers, etc. .) of documents via the "project view detail", (iv) export a view of the map with the layer of interest or add the layers of a project to the main map, (v) manage the order and overlapping of the layers, (vi) execute spatial queries on the layers and view the results, (vii) search through metadata or temporal dimension queries for the projects of interest, (vii) apply spatial filters for cross-layer.
The GeoPortal Data Viewer App is an application to access, discovery and navigate the GeoNa products by a Web-Map Interface
## Built With
@ -10,43 +10,13 @@ The "Geoportal data-viewer" technology allows users to access and search for spa
**Uses**
* GWT v.2.9.0. [GWT](http://www.gwtproject.org) is licensed under [Apache License 2.0](http://www.gwtproject.org/terms.html)
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* GWT-Bootstrap v.2.3.2.0. [GWT-Bootstrap](https://github.com/gwtbootstrap) is licensed under [[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* GWT-OpenLayers 3+ v.8.1.0-gwt2_9. [GWT-OL3](https://github.com/TDesjardins/gwt-ol)
* OpenLayers v.6.x [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
* NanoGallery v2.X [NanoGallery2](https://github.com/nanostudio-org/nanogallery2) is licensed under [GNU General Public License "gplv3"](https://www.gnu.org/licenses/gpl-3.0.html)
* Vis-Timeline v7.x [VisTimeline](https://github.com/visjs/vis-timeline) is licensed under [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0) and MIT
* Handlebarsjs v4.x [Handlebarsjs](https://handlebarsjs.com/) is licensed under MIT
## Architecture
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/82/GeoPortalDataViewer_Architecture.png" style="max-width:800px;" alt="GeoPortal Data-Viewer - Architecture" />
## Showcase
##### D4GNA instance of Geoportal D4Science
see at [Dataset per il Geoportale Nazionale per lArcheologia (D4GNA)](https://gna.d4science.org/)
**D4GNA Viewer - OSM**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/0/06/D4GNA_Viewer_OSM.png" style="max-width:800px;" alt="Data_Viewer_OSM" />
**D4GNA Viewer - MapBox**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/9/9c/D4GNA_Viewer_MapBox.png" style="max-width:800px;" alt="Data_Viewer_MapBox" />
**D4GNA Viewer - Discovering...**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/85/D4GNA_ERCIM_3.png" style="max-width:800px;" alt="D4GNA_ERCIM_3" />
<br />
<br />
<img src="https://gcube.wiki.gcube-system.org/images_gcube/9/9c/D4GNA_ERCIM_2.png" style="max-width:800px;" alt="D4GNA_ERCIM_2" />
* OpenLayers v.6.X. [OpenLayers](https://openlayers.org/) is licensed under [BSD 2-Clause "Simplified"](https://github.com/openlayers/openlayers/blob/main/LICENSE.md)
## Documentation
Geoportal Service Documentation is available at [gCube CMS Suite](https://geoportal.d4science.org/geoportal-service/docs/index.html)
User Guide (DRAFT ITA) is available at [Guida al DataViewer D4GNA (DRAFT-ITA)](https://gcube.wiki.gcube-system.org/images_gcube/b/b3/D4science_Guida_al_DataViewer_D4GNA_bozza.pdf)
N/A
## Change log

149
pom.xml
View File

@ -7,23 +7,21 @@
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.2.0</version>
<version>1.1.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-viewer-app</artifactId>
<packaging>war</packaging>
<version>3.6.0</version>
<version>3.0.0-SNAPSHOT</version>
<name>GeoPortal Data Viewer App</name>
<description>The GeoPortal Data Viewer App is an application to access, discovery and navigate the Geoportal projects/documents 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>
<properties>
<!-- Convenience property to set the GWT version -->
<gwt.version>2.10.0</gwt.version>
<gwt.version>2.8.2</gwt.version>
<gwt.compiler.style>PRETTY</gwt.compiler.style>
<gson.version>2.6.2</gson.version>
<gwt.ol.version>8.4.1</gwt.ol.version>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<!-- GWT 2.9 support 8, 9 and 11 -->
<maven.compiler.source>1.8</maven.compiler.source>
@ -56,7 +54,7 @@
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>3.7.0</version>
<version>3.6.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -65,6 +63,76 @@
<dependencies>
<!-- FORCING THESE DEPENDENCIES IN ORDER TO USE THE "OLD" CONCESSIONI CLIENT/MODEL -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>metadata-profile-discovery</artifactId>
<version>[1.0.0-SNAPSHOT, 1.1.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<!-- END FORCING -->
<!-- <dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-client</artifactId>
</dependency> -->
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.tdesjardins</groupId>
<artifactId>gwt-ol3</artifactId>
<!-- <version>8.1.0-gwt2_9</version> -->
<version>8.2.0-gwt2_8</version>
</dependency>
<dependency>
<groupId>org.gcube.spatial.data</groupId>
<artifactId>geo-utility</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-url-shortener</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>keycloak-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>org.projectlombok</groupId> -->
<!-- <artifactId>lombok</artifactId> -->
<!-- <version>1.14.8</version> -->
<!-- </dependency> -->
<!-- PROVIDED in GATEWAY -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
<!-- <scope>system</scope> -->
<!-- <systemPath>/Users/fabioisti/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar</systemPath> -->
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
@ -100,22 +168,7 @@
<artifactId>oidc-library</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.tdesjardins</groupId>
<artifactId>gwt-ol3</artifactId>
<version>${gwt.ol.version}</version>
</dependency>
<dependency>
<groupId>com.github.gwtbootstrap</groupId>
<artifactId>gwt-bootstrap</artifactId>
<version>2.3.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.spatial.data</groupId>
<artifactId>geo-utility</artifactId>
<version>[1.0.0,2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>ic-client</artifactId>
@ -136,79 +189,39 @@
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<!-- REQUIRED FOR JDK_11 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<scope>provided</scope>
</dependency>
<!-- END -->
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-mapper</artifactId>
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-common</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.7.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>keycloak-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<!-- <version>6.2.5</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<!-- <version>2.0</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<!-- <version>1.6.4</version> -->
<scope>provided</scope>
</dependency>
<!-- TEST -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -3,7 +3,6 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayersMapParameters;
import com.google.gwt.dom.client.Element;
import com.google.gwt.i18n.client.DateTimeFormat;
/**
@ -14,8 +13,6 @@ import com.google.gwt.i18n.client.DateTimeFormat;
* Nov 24, 2020
*/
public class GeoportalDataViewerConstants {
public static final int TABLET_WIDTH = 1601;
public static final String MAP_DIV = "map";
@ -28,43 +25,10 @@ public class GeoportalDataViewerConstants {
public static final String GET_ZOOM = OpenLayersMapParameters.OL_MAP_PARAM.zoom.name();
public static final String GET_CENTER_MAP_TO_LONG_LAT = OpenLayersMapParameters.OL_MAP_PARAM.centermap.name();
public static final Double INITIAL_LAYER_OPACITY = 0.8;
public static final int SEARCH_LIMIT_RESULTS_TO_MAXIMUM = 50;
public static final DateTimeFormat DATE_TIME_FORMAT = DateTimeFormat.getFormat("dd MMMM yyyy");
public static enum MapEventType {
MOUSE_CLICK, MAP_ZOOM_END, MOVE_END, ADDED_CENTROID_LAYER_TO_MAP
}
public static final String PROJECT_ID_KEY_FEATURE = "projectid";
public static enum GisToolbarFacilities {
COLLECTION("Collection", "Open the collections"),
MAP("Map", "Select the base Map"),
OVERLAY("Overlay", "Add overlay layers"),
SEARCH("Search", "Search in the collections"),
FILTER("Filter", "Apply spatial filtering"),
LAYERS("Layers", "Layers added to Map"),
PRESET_LOCATION("Preset Location", "Center the Map to Location");
String name;
String tooltip;
GisToolbarFacilities(String name, String tooltip) {
this.name = name;
this.tooltip = tooltip;
}
public String getName() {
return name;
}
public String getTooltip() {
return tooltip;
}
}
/**
* The Enum LayerType.
*
@ -103,6 +67,10 @@ public class GeoportalDataViewerConstants {
}
}
public enum RECORD_TYPE {
CONCESSIONE
}
public static final double ITALY_CENTER_LONG = 12.45;
@ -118,7 +86,7 @@ public class GeoportalDataViewerConstants {
* @param msg the msg
*/
public static native void printJs(String msg)/*-{
//console.log("js console: " + msg);
console.log("js console: " + msg);
}-*/;
/**
@ -127,7 +95,7 @@ public class GeoportalDataViewerConstants {
* @param msg the msg
*/
public static native void printJsObj(Object object)/*-{
//console.log("js obj: " + JSON.stringify(object, null, 4));
console.log("js obj: " + JSON.stringify(object, null, 4));
}-*/;
/**
@ -139,75 +107,4 @@ public class GeoportalDataViewerConstants {
return JSON.stringify(object);
}-*/;
/**
* Json to HTML.
*
* @param jsonTxt the json txt
* @return the string
*/
public static native String jsonToTableHTML(String jsonTxt)/*-{
try {
var jsonObj = JSON.parse(jsonTxt);
if (jsonObj.length == undefined)
jsonObj = [ jsonObj ]
//console.log(jsonObj.length)
// EXTRACT VALUE FOR HTML HEADER.
var col = [];
for (var i = 0; i < jsonObj.length; i++) {
for ( var key in jsonObj[i]) {
//console.log('key json' +key)
if (col.indexOf(key) === -1) {
col.push(key);
}
}
}
// CREATE DYNAMIC TABLE.
var table = document.createElement("table");
try {
table.classList.add("my-html-table");
} catch (e) {
console.log('invalid css add', e);
}
// ADD JSON DATA TO THE TABLE AS ROWS.
for (var i = 0; i < col.length; i++) {
tr = table.insertRow(-1);
var firstCell = tr.insertCell(-1);
//firstCell.style.cssText="font-weight: bold; text-align: center; vertical-align: middle;";
firstCell.innerHTML = col[i];
for (var j = 0; j < jsonObj.length; j++) {
var tabCell = tr.insertCell(-1);
var theValue = jsonObj[j][col[i]];
//console.log("the value: "+theValue);
if (theValue !== null
&& Object.prototype.toString.call(theValue) === '[object Array]') {
var formattedValueArray = "";
for (var k = 0; k < theValue.length; k++) {
var theValueArray = theValue[k];
//console.log(theValueArray);
formattedValueArray += theValueArray + "<br>";
}
tabCell.innerHTML = formattedValueArray;
} else {
tabCell.innerHTML = theValue;
}
}
}
return table.outerHTML;
} catch (e) {
console.log('invalid json', e);
return jsonTxt;
}
}-*/;
public static native void clickElement(Element elem) /*-{
elem.click();
}-*/;
}

View File

@ -1,25 +1,15 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.faults.ControlledError;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
@ -55,10 +45,18 @@ public interface GeoportalDataViewerService extends RemoteService {
* @param maxWFSFeature the max WFS feature
* @param zoomLevel the zoom level
* @return the data result
* @throws Exception the exception
*/
List<GeoNaSpatialQueryResult> getDataResult(List<LayerObject> layerObjects, String mapSrsName, BoundsMap mapBBOX,
int maxWFSFeature, double zoomLevel) throws Exception;
int maxWFSFeature, double zoomLevel);
// /**
// * Gets the concessione for id.
// *
// * @param mongoId the mongo id
// * @return the concessione for id
// * @throws Exception the exception
// */
// ConcessioneDV getConcessioneForId(String mongoId) throws Exception;
/**
* Gets the my login.
@ -67,6 +65,15 @@ public interface GeoportalDataViewerService extends RemoteService {
*/
String getMyLogin();
/**
* Gets the layer for type.
*
* @param layerType the layer type
* @return the layer for type
* @throws Exception the exception
*/
GeoInformationForWMSRequest getLayerForType(String layerType) throws Exception;
/**
* Gets the geo na data view profile.
*
@ -75,6 +82,17 @@ public interface GeoportalDataViewerService extends RemoteService {
*/
GNADataViewerConfigProfile getGeoNaDataViewProfile() throws Exception;
/**
* Gets the uploaded images for id.
*
* @param itemType the item type
* @param itemId the item id
* @param maxImages the max images
* @return the uploaded images for id
* @throws Exception
*/
List<UploadedImageDV> getUploadedImagesForId(String itemType, String itemId, Integer maxImages) throws Exception;
/**
* Gets the public links for.
*
@ -82,17 +100,17 @@ public interface GeoportalDataViewerService extends RemoteService {
* @return the public links for
* @throws Exception the exception
*/
GeoportalItemReferences getPublicLinksFor(GeoportalItemReferences item) throws Exception;
GeoNaItemRef getPublicLinksFor(GeoNaItemRef item) throws Exception;
/**
* Gets the layers for id.
*
* @param theProfileID the the profile ID
* @param theProductID the the product ID
* @return the layers for id
* @throws Exception the exception
*/
List<GCubeSDIViewerLayerDV> getLayersForId(String theProfileID, String theProductID) throws Exception;
// /**
// * Gets the layers for id.
// *
// * @param itemType the item type
// * @param itemId the item id
// * @return the layers for id
// * @throws Exception the exception
// */
// List<LayerConcessioneDV> getLayersForId(String itemType, String itemId) throws Exception;
/**
* Gets the WFS features.
@ -107,126 +125,9 @@ public interface GeoportalDataViewerService extends RemoteService {
List<GeoNaSpatialQueryResult> getWFSFeatures(List<LayerObject> layerObjects, String mapSrsName,
BoundsMap selectBBOX, int maxWFSFeature, double zoomLevel);
/**
* Gets the list base layers.
*
* @return the list base layers
*/
List<BaseMapLayer> getListBaseLayers();
/**
* List of fields for searching.
*
* @return the list
* @throws Exception the exception
*/
List<ItemFieldsResponse> getConfigListOfFieldsForSearching() throws Exception;
/**
* Gets the project view for id.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the project view for id
* @throws Exception the exception
*/
ProjectView getProjectViewForId(String profileID, String projectID) throws Exception;
/**
* Gets the list projects.
*
* @param theProfileID the the profile ID
* @param start the start
* @param limit the limit
* @param filter the filter
* @param reloadFromService the reload from service
* @return the list projects
* @throws Exception the exception
*/
ResultSetPaginatedDataIDs getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService) throws Exception;
/**
* NEW CODE HERE.
*
* @return the initial configuration
* @throws Exception the exception
*/
ViewerConfiguration getInitialConfiguration() throws Exception;
/**
* Gets the entry sets document for project ID.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param limit the limit
* @return the entry sets document for project ID
*/
LinkedHashMap<String, Object> getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit);
/**
* Gets the relationships for timeline.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the relationships for timeline
* @throws Exception the exception
*/
List<String> getRelationshipsForTimeline(String profileID, String projectID) throws Exception;
/**
* Gets the spatial reference.
*
* @param profileID the profile ID
* @param projectID the project ID
* @return the spatial reference
*/
GeoJSON getSpatialReference(String profileID, String projectID);
/**
* Gets the WFS request.
*
* @param layerItem the layer item
* @param mapSrsName the map srs name
* @param mapBBOX the map BBOX
* @param maxFeatures the max features. If 0 means all feature
* @param outputFormat the output format
* @return the WFS request
*/
String getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
String outputFormat);
/**
* Gets the WFS response.
*
* @param layerItem the layer item
* @param mapSrsName the map srs name
* @param mapBBOX the map BBOX
* @param maxFeatures the max features
* @param outputFormat the output format
* @return the WFS response
*/
String getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures,
String outputFormat);
/**
* Gets the avaiable custom grouped layers for UCD.
*
* @param theHandler the the handler
* @return the avaiable custom grouped layers for UCD
*/
Map<String, List<GroupedLayersDV<? extends LayerIDV>>> getAvaiableCustomGroupedLayersForUCD(
GEOPORTAL_DATA_HANDLER theHandler);
/**
* Gets the HTTP response for URL.
*
* @param url the url
* @return the HTTP response for URL
*/
String getHTTPResponseForURL(String url);
Integer getCountFor(String profileID, String phase, String status);
// Collections
ViewerConfiguration getInitialConfiguration(Map<String, List<String>> parameters) throws Exception, ControlledError;
}

View File

@ -1,25 +1,14 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.GEOPORTAL_DATA_HANDLER;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.application.geoportalcommon.shared.products.model.UploadedImageDV;
import org.gcube.portlets.user.geoportaldataviewer.shared.GeoNaSpatialQueryResult;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
@ -52,45 +41,22 @@ public interface GeoportalDataViewerServiceAsync {
void getMyLogin(AsyncCallback<String> callback);
void getLayerForType(String layerType, AsyncCallback<GeoInformationForWMSRequest> callback);
void getGeoNaDataViewProfile(AsyncCallback<GNADataViewerConfigProfile> callback);
void getPublicLinksFor(GeoportalItemReferences item, AsyncCallback<GeoportalItemReferences> asyncCallback);
void getUploadedImagesForId(String itemType, String itemId, Integer maxImages,
AsyncCallback<List<UploadedImageDV>> callback);
void getPublicLinksFor(GeoNaItemRef item, AsyncCallback<GeoNaItemRef> asyncCallback);
void getLayersForId(String theProfileID, String theProductID,
AsyncCallback<List<GCubeSDIViewerLayerDV>> 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 getConfigListOfFieldsForSearching(AsyncCallback<List<ItemFieldsResponse>> callback);
void getProjectViewForId(String profileID, String projectID, AsyncCallback<ProjectView> callback);
void getListProjects(String theProfileID, Integer start, Integer limit, SearchingFilter filter,
boolean reloadFromService, AsyncCallback<ResultSetPaginatedDataIDs> callback);
void getInitialConfiguration(AsyncCallback<ViewerConfiguration> callback);
void getEntrySetsDocumentForProjectID(String profileID, String projectID, int limit,
AsyncCallback<LinkedHashMap<String, Object>> callback);
void getRelationshipsForTimeline(String profileID, String projectID, AsyncCallback<List<String>> callback);
void getSpatialReference(String profileID, String projectID, AsyncCallback<GeoJSON> callback);
void getWFSRequest(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
AsyncCallback<String> callback);
void getWFSResponse(LayerItem layerItem, String mapSrsName, BoundsMap mapBBOX, int maxFeatures, String outputFormat,
AsyncCallback<String> callback);
void getAvaiableCustomGroupedLayersForUCD(GEOPORTAL_DATA_HANDLER theHandler,
AsyncCallback<Map<String, List<GroupedLayersDV<? extends LayerIDV>>>> callback);
void getHTTPResponseForURL(String url, AsyncCallback<String> callback);
void getCountFor(String profileID, String phase, String status, AsyncCallback<Integer> callback);
// PROJECTS SUPPORT
void getInitialConfiguration(Map<String, List<String>> parameters, AsyncCallback<ViewerConfiguration> callback);
}

View File

@ -3,7 +3,7 @@ package org.gcube.portlets.user.geoportaldataviewer.client;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MapEventType;
import org.gcube.portlets.user.geoportaldataviewer.client.events.QueryDataEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ZoomOutOverMinimumEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
@ -166,16 +166,15 @@ public class OLMapManager {
// geoWidth = (bboxWidth / w) * (14 / 2);
geoWidth = (bboxWidth / w) * (16 / 2);
} else {
// data point selection for coordinate loaded from the centroid
geoWidth = (bboxWidth / w) / 60;
GWT.log("geo width: "+geoWidth);
// data point selection for coordinate loaded from concessione
geoWidth = (bboxWidth / w) * (2);
}
double x1 = Math.min(lon + geoWidth, lon - geoWidth);
double x2 = Math.max(lon + geoWidth, lon - geoWidth);
double y1 = Math.min(lat + geoWidth, lat - geoWidth);
double y2 = Math.max(lat + geoWidth, lat - geoWidth);
//GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
// GWT.log("("+x1+","+y1+")("+x2+","+y2+")");
GeoQuery select = new GeoQuery(x1, y1, x2, y2, TYPE.POINT);
return select;

View File

@ -1,70 +1,36 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.FlowPanel;
public class OverlayLayerManager {
// private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
// private FlowPanel fp = new FlowPanel();
private FlowPanel clusterCollectionsMainPanel = new FlowPanel();
private HashMap<String, ArrayList<DragDropLayer>> mapCollectionsPerProfileID = new HashMap<String, ArrayList<DragDropLayer>>();
private HashMap<String, FlowPanel> mapCollectionsContainersPerProfileID = new HashMap<String, FlowPanel>();
private ArrayList<LayerObject> layers = new ArrayList<LayerObject>();
private FlowPanel fp = new FlowPanel();
private HandlerManager applicationBus;
public OverlayLayerManager(HandlerManager applicationBus) {
this.applicationBus = applicationBus;
}
public void addLayerItem(LayerObject lo) {
GWT.log("Adding LayerObject having project: "+lo.getProjectDV());
GWT.log("Adding LayerObject having project id: "+lo.getProjectDV().getId());
ArrayList<DragDropLayer> listDDLayers = mapCollectionsPerProfileID.get(lo.getProfileID());
if (listDDLayers == null) {
String collectionName = lo.getProjectDV() != null && lo.getProjectDV().getProfileName() != null
? lo.getProjectDV().getProfileName()
: lo.getProfileID();
Label labelCollectionName = new Label(collectionName);
labelCollectionName.setType(LabelType.WARNING);
clusterCollectionsMainPanel.add(labelCollectionName);
listDDLayers = new ArrayList<DragDropLayer>();
}
FlowPanel fp = new FlowPanel();
fp.getElement().getStyle().setMarginLeft(10, Unit.PX);
void addLayerItem(LayerObject lo) {
DragDropLayer dandd = new DragDropLayer(applicationBus, lo, true, true);
listDDLayers.add(dandd);
layers.add(lo);
fp.add(dandd);
mapCollectionsContainersPerProfileID.put(lo.getProfileID(), fp);
mapCollectionsPerProfileID.put(lo.getProfileID(), listDDLayers);
clusterCollectionsMainPanel.add(fp);
}
public void resetLayers() {
clusterCollectionsMainPanel.clear();
mapCollectionsContainersPerProfileID.clear();
mapCollectionsPerProfileID.clear();
layers.clear();
fp.clear();
}
public FlowPanel getPanel() {
return clusterCollectionsMainPanel;
return fp;
}
}

View File

@ -0,0 +1,84 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
class StartParameters {
public StartParameters(Map<String, List<String>> parameters) {
if (parameters == null || parameters.isEmpty())
GWT.log("!!!! NB : NO QUERY PARAMETERS");
else {
paramWmsRequest = getFirst(parameters, GeoportalDataViewerConstants.GET_WMS_PARAMETER);
paramLayerTitle = Window.Location.getParameter(GeoportalDataViewerConstants.GET_LAYER_TITLE);
paramGeonaItemType = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_TYPE);
paramGeonaItemID = Window.Location.getParameter(GeoportalDataViewerConstants.GET_GEONA_ITEM_ID);
}
}
// retro usage?
/** WMS Link -> Layer Name [optional]*/
public Map<String,String> toOpenLayers() {
return Collections.emptyMap();
}
public Set<String> toOpenCollections(){
return Collections.emptySet();
}
public Set<String> toOpenProjects(){
return Collections.emptySet();
}
private String getFirst(Map<String, List<String>> parameters, String key) {
List<String> values = parameters.get(key);
if (values != null && !values.isEmpty()) {
GWT.log("Param " + key + "Getting First value of : " + values);
return values.get(0);
} else return null;
}
/**
* The param wms request.
*/
private String paramWmsRequest;
/**
* The param UUID.
*/
// private String paramUUID;
private String paramGeonaItemType;
/**
* The param layer title.
*/
private String paramLayerTitle;
private String paramGeonaItemID;
public String getParamWmsRequest() {
return paramWmsRequest;
}
public String getParamGeonaItemType() {
return paramGeonaItemType;
}
public String getParamLayerTitle() {
return paramLayerTitle;
}
public String getParamGeonaItemID() {
return paramGeonaItemID;
}
}

View File

@ -1,18 +1,65 @@
package org.gcube.portlets.user.geoportaldataviewer.client;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.gcube.application.geoportalcommon.shared.GNADataViewerConfigProfile;
import org.gcube.portlets.user.geoportaldataviewer.shared.ViewerConfiguration;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
public class ViewerStatus {
private ViewerConfiguration viewerConfig;
private GNADataViewerConfigProfile geonaDataViewerProfile;
private ViewerConfiguration config;
// ucid -> index layer
private Map<String,List<LayerObject>> openedIndexes;
// ucid -> projectId -> layers
private Map<String,Map<String,List<LayerObject>>> openedProjects;
public void setConfig(ViewerConfiguration result) {
this.viewerConfig = result;
public GNADataViewerConfigProfile getGeonaDataViewerProfile() {
return geonaDataViewerProfile;
}
public void setGeonaDataViewerProfile(GNADataViewerConfigProfile geonaDataViewerProfile) {
this.geonaDataViewerProfile = geonaDataViewerProfile;
}
public ViewerConfiguration getConfig() {
return config;
}
public void setConfig(ViewerConfiguration config) {
this.config = config;
}
public Map<String, List<LayerObject>> getOpenedIndexes() {
return openedIndexes;
}
public ViewerConfiguration getViewerConfig() {
return viewerConfig;
public Map<String, Map<String,List<LayerObject>>> getOpenedProjects() {
return openedProjects;
}
public void addOpenedIndex(String ucid, LayerObject indexId) {
if(openedIndexes==null) openedIndexes=new HashMap<String, List<LayerObject>>();
if(!openedIndexes.containsKey(ucid)) openedIndexes.put(ucid, new ArrayList<LayerObject>());
openedIndexes.get(ucid).add(indexId);
}
public void addOpenedProjectLayer(String ucid, String projectId, LayerObject projectLayer) {
if(openedProjects==null) openedProjects=new HashMap<String, Map<String,List<LayerObject>>>();
if(!openedProjects.containsKey(ucid)) openedProjects.put(ucid, new HashMap<String, List<LayerObject>>());
Map<String,List<LayerObject>> map=openedProjects.get(ucid);
if(!map.containsKey(projectId)) map.put(ucid, new ArrayList<LayerObject>());
map.get(projectId).add(projectLayer);
}
}

View File

@ -1,69 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class AddedLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 18, 2020
*/
public class AddLayerToMapEvent extends GwtEvent<AddLayerToMapEventHandler> {
public static Type<AddLayerToMapEventHandler> TYPE = new Type<AddLayerToMapEventHandler>();
private ProjectDV theProjectDV;
private boolean notifyClashing;
/**
* Instantiates a new adds the layer to map event.
*
* @param theProjectDV the the project DV
* @param notifyClashing the notify clashing
*/
public AddLayerToMapEvent(ProjectDV theProjectDV, boolean notifyClashing) {
this.theProjectDV = theProjectDV;
this.notifyClashing = notifyClashing;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<AddLayerToMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(AddLayerToMapEventHandler handler) {
handler.onAddingLayerForProject(this);
}
/**
* Gets the the project DV.
*
* @return the the project DV
*/
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
/**
* Checks if is notify clashing.
*
* @return true, if is notify clashing
*/
public boolean isNotifyClashing() {
return notifyClashing;
}
}

View File

@ -1,21 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface AddLayerToMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
public interface AddLayerToMapEventHandler extends EventHandler {
/**
* On adding layer for project.
*
* @param addLayerToMapEvent the add layer to map event
*/
void onAddingLayerForProject(AddLayerToMapEvent addLayerToMapEvent);
}

View File

@ -1,72 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class AddedLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 18, 2020
*/
public class ApplyCQLToLayerOnMapEvent extends GwtEvent<ApplyCQLToLayerOnMapEventHandler> {
public static Type<ApplyCQLToLayerOnMapEventHandler> TYPE = new Type<ApplyCQLToLayerOnMapEventHandler>();
private IndexLayerDV theIndeLayer;
private String cqlFilterValue;
/**
* Instantiates a new apply CQL to layer map event.
*
* @param theIndeLayer the the inde layer
* @param cqlFilter the cql filter
*/
public ApplyCQLToLayerOnMapEvent(IndexLayerDV theIndeLayer, String cqlFilterValue) {
this.theIndeLayer = theIndeLayer;
this.cqlFilterValue = cqlFilterValue;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ApplyCQLToLayerOnMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ApplyCQLToLayerOnMapEventHandler handler) {
handler.onApplyCQL(this);
}
public IndexLayerDV getTheIndeLayer() {
return theIndeLayer;
}
public String getCqlFilterValue() {
return cqlFilterValue;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ApplyCQLToLayerOnMapEvent [theIndeLayer=");
builder.append(theIndeLayer);
builder.append(", cqlFilterValue=");
builder.append(cqlFilterValue);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ApplyCQLToLayerOnMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 31, 2023
*/
public interface ApplyCQLToLayerOnMapEventHandler extends EventHandler {
/**
* On apply CQL.
*
* @param applyCQLToLayerMapEvent the apply CQL to layer map event
*/
void onApplyCQL(ApplyCQLToLayerOnMapEvent applyCQLToLayerMapEvent);
}

View File

@ -1,52 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.GwtEvent;
import ol.Extent;
/**
* The Class FitMapToExtentEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 6, 2023
*/
public class FitMapToExtentEvent extends GwtEvent<FitMapToExtentEventHandler> {
public static Type<FitMapToExtentEventHandler> TYPE = new Type<FitMapToExtentEventHandler>();
private Extent extent;
/**
* Instantiates a new fit map to extent event.
*
* @param extent the extent
*/
public FitMapToExtentEvent(Extent extent) {
this.extent = extent;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<FitMapToExtentEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(FitMapToExtentEventHandler handler) {
handler.onFitToMap(this);
}
public Extent getExtent() {
return extent;
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface FitMapToExtentEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 6, 2023
*/
public interface FitMapToExtentEventHandler extends EventHandler {
/**
* On fit to map.
*
* @param fitMapToExtentEvent the fit map to extent event
*/
void onFitToMap(FitMapToExtentEvent fitMapToExtentEvent);
}

View File

@ -1,83 +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;
// }
//
//}
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;
}
}

View File

@ -1,22 +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);
//}
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);
}

View File

@ -1,92 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class OverlayCustomLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public class OverlayCustomLayerToMapEvent extends GwtEvent<OverlayCustomLayerToMapEventHandler> {
public static Type<OverlayCustomLayerToMapEventHandler> TYPE = new Type<OverlayCustomLayerToMapEventHandler>();
private LayerItem layerItem;
private ACTION_TYPE actionType;
private boolean enabled;
/**
* The Enum ACTION_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public enum ACTION_TYPE {
VISIBILITY
}
/**
* Instantiates a new overlay custom layer to map event.
*
* @param layerItem the layer item
* @param actionType the action type
* @param enabled the enabled
*/
public OverlayCustomLayerToMapEvent(LayerItem layerItem, ACTION_TYPE actionType, boolean enabled) {
this.layerItem = layerItem;
this.actionType = actionType;
this.enabled = enabled;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<OverlayCustomLayerToMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(OverlayCustomLayerToMapEventHandler handler) {
handler.onCustomOverlayLayerAction(this);
}
/**
* Gets the layer item.
*
* @return the layer item
*/
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the action type.
*
* @return the action type
*/
public ACTION_TYPE getActionType() {
return actionType;
}
/**
* Checks if is enabled.
*
* @return true, if is enabled
*/
public boolean isEnabled() {
return enabled;
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface OverlayCustomLayerToMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public interface OverlayCustomLayerToMapEventHandler extends EventHandler {
/**
* On custom overlay layer action.
*
* @param customOverLayerToMapEvent the custom over layer to map event
*/
void onCustomOverlayLayerAction(OverlayCustomLayerToMapEvent customOverLayerToMapEvent);
}

View File

@ -17,7 +17,7 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
public static Type<QueryDataEventHandler> TYPE = new Type<QueryDataEventHandler>();
private GeoQuery select;
private ExtentWrapped queryClickExtent;
private String productID;
private String mongoItemId;
private boolean onInit;
private MapEventType sourceMapEventType;
@ -26,15 +26,15 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
*
* @param select the select
* @param onFailureCenterTo the on failure center to
* @param productID the mongo item id
* @param mongoItemId the mongo item id
* @param onInit the on init
* @param mapEventType the map event type
*/
public QueryDataEvent(GeoQuery select, ExtentWrapped queryClickExtent, String productID, boolean onInit,
public QueryDataEvent(GeoQuery select, ExtentWrapped queryClickExtent, String mongoItemId, boolean onInit,
MapEventType mapEventType) {
this.select = select;
this.queryClickExtent = queryClickExtent;
this.productID = productID;
this.mongoItemId = mongoItemId;
this.onInit = onInit;
this.sourceMapEventType = mapEventType;
}
@ -49,8 +49,13 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
return TYPE;
}
public String getProductID() {
return productID;
/**
* Gets the mongo item id.
*
* @return the mongo item id
*/
public String getMongoItemId() {
return mongoItemId;
}
/**
@ -102,8 +107,8 @@ public class QueryDataEvent extends GwtEvent<QueryDataEventHandler> {
builder.append(select);
builder.append(", queryClickExtent=");
builder.append(queryClickExtent);
builder.append(", productID=");
builder.append(productID);
builder.append(", mongoItemId=");
builder.append(mongoItemId);
builder.append(", onInit=");
builder.append(onInit);
builder.append(", sourceMapEventType=");

View File

@ -1,209 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowDetailsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 14, 2022
*/
public class ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
public static Type<ShowDetailsEventHandler> TYPE = new Type<ShowDetailsEventHandler>();
private String layerObjectType;
private FeatureRow featureRow;
private String itemName;
private String profileID;
private String projectID;
private boolean loadTimelineRelationships;
private boolean isEventFromTimeline;
private EVENT_SOURCE sourceEvent;
/**
* The Enum EVENT_SOURCE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Dec 22, 2022
*/
public static enum EVENT_SOURCE {
LOCATE_ON_INIT, OPEN_DETAILS, OPEN_PROJECTS, LOCATE_SEARCHED, LOCATE_FROM_TIMELINE, GO_TO_LAYERS
}
/**
* Instantiates a new show details event.
*
* @param layerObjectType the layer object type
* @param profileID the profile ID
* @param projectID the project ID
* @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
*/
public ShowDetailsEvent(String layerObjectType, String profileID, String projectID, FeatureRow featureRow,
boolean loadTimelineRelationships, EVENT_SOURCE sourceEvent) {
this.layerObjectType = layerObjectType;
this.profileID = profileID;
this.projectID = projectID;
this.featureRow = featureRow;
this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
}
/**
* Instantiates a new show details event.
*
* @param gir the gir
* @param featureRow the feature row
* @param loadTimelineRelationships the load timeline relationships
* @param sourceEvent the source event
*/
public ShowDetailsEvent(GeoportalItemReferences gir, FeatureRow featureRow, boolean loadTimelineRelationships,
boolean goToLayers, EVENT_SOURCE sourceEvent) {
this.layerObjectType = gir.getLayerObjectType();
this.profileID = gir.getProfileID();
this.projectID = gir.getProjectID();
this.featureRow = featureRow;
this.loadTimelineRelationships = loadTimelineRelationships;
this.sourceEvent = sourceEvent;
}
/**
* Event from timeline.
*
* @param bool the bool
*/
public void setEventFromTimeline(boolean bool) {
this.isEventFromTimeline = bool;
}
/**
* Checks if is event from timeline.
*
* @return true, if is event from timeline
*/
public boolean isEventFromTimeline() {
return isEventFromTimeline;
}
/**
* Gets the source event.
*
* @return the source event
*/
public EVENT_SOURCE getSourceEvent() {
return sourceEvent;
}
/**
* Gets the type.
*
* @return the type
*/
public static Type<ShowDetailsEventHandler> getTYPE() {
return TYPE;
}
/**
* Gets the layer object type.
*
* @return the layer object type
*/
public String getLayerObjectType() {
return layerObjectType;
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the project ID.
*
* @return the project ID
*/
public String getProjectID() {
return projectID;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowDetailsEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowDetailsEventHandler handler) {
handler.onShowDetails(this);
}
/**
* Gets the feature row.
*
* @return the feature row
*/
public FeatureRow getFeatureRow() {
return featureRow;
}
/**
* Checks if is load timeline relationships.
*
* @return true, if is load timeline relationships
*/
public boolean isLoadTimelineRelationships() {
return loadTimelineRelationships;
}
/**
* Gets the geona item ref.
*
* @return the geona item ref
*/
public GeoportalItemReferences getGeonaItemRef() {
return new GeoportalItemReferences(projectID, profileID, layerObjectType);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowDetailsEvent [layerObjectType=");
builder.append(layerObjectType);
builder.append(", featureRow=");
builder.append(featureRow);
builder.append(", itemName=");
builder.append(itemName);
builder.append(", profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", loadTimelineRelationships=");
builder.append(loadTimelineRelationships);
builder.append(", isEventFromTimeline=");
builder.append(isEventFromTimeline);
builder.append(", sourceEvent=");
builder.append(sourceEvent);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,122 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ShowPopupOnCentroidEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 12, 2023
*/
public class ShowPopupOnCentroidEvent extends GwtEvent<ShowPopupOnCentroidEventHandler> {
public static Type<ShowPopupOnCentroidEventHandler> TYPE = new Type<ShowPopupOnCentroidEventHandler>();
private String profileID;
private String projectID;
private GeoJSON spatialReference;
private ProjectView projectView;
/**
* Instantiates a new show popup on centroid event.
*
* @param profileID the profile ID
* @param projectID the project ID
* @param spatialReference the spatial reference
*/
public ShowPopupOnCentroidEvent(String profileID, String projectID, GeoJSON spatialReference) {
this.profileID = profileID;
this.projectID = projectID;
this.spatialReference = spatialReference;
}
/**
* Instantiates a new show popup on centroid event.
*
* @param projectView the project view
*/
public ShowPopupOnCentroidEvent(ProjectView projectView) {
this.projectView = projectView;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowPopupOnCentroidEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowPopupOnCentroidEventHandler handler) {
handler.onShowPopup(this);
}
/**
* Gets the profile ID.
*
* @return the profile ID
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the project ID.
*
* @return the project ID
*/
public String getProjectID() {
return projectID;
}
/**
* Gets the spatial reference.
*
* @return the spatial reference
*/
public GeoJSON getSpatialReference() {
return spatialReference;
}
/**
* Gets the project view.
*
* @return the project view
*/
public ProjectView getProjectView() {
return projectView;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowPopupOnCentroidEvent [profileID=");
builder.append(profileID);
builder.append(", projectID=");
builder.append(projectID);
builder.append(", spatialReference=");
builder.append(spatialReference);
builder.append(", projectView=");
builder.append(projectView);
builder.append("]");
return builder.toString();
}
}

View File

@ -1,80 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class TimelineProjectRelationsEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public class TimelineProjectRelationsEvent extends GwtEvent<TimelineProjectRelationsEventHandler> {
public static Type<TimelineProjectRelationsEventHandler> TYPE = new Type<TimelineProjectRelationsEventHandler>();
private EVENT_TYPE eventType = EVENT_TYPE.HIDE; //default
private ProjectDV theProjectDV;
/**
* The Enum EVENT_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public enum EVENT_TYPE {
SHOW, HIDE
}
/**
* Instantiates a new timeline project relations event.
*
* @param theProjectDV the the project DV
* @param eventType the event type
*/
public TimelineProjectRelationsEvent(ProjectDV theProjectDV, EVENT_TYPE eventType) {
this.theProjectDV = theProjectDV;
this.eventType = eventType;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<TimelineProjectRelationsEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(TimelineProjectRelationsEventHandler handler) {
handler.onTimelineRelationEvent(this);
}
/**
* Gets the event type.
*
* @return the event type
*/
public EVENT_TYPE getEventType() {
return eventType;
}
/**
* Gets the the project DV.
*
* @return the the project DV
*/
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface TimelineProjectRelationsEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 3, 2022
*/
public interface TimelineProjectRelationsEventHandler extends EventHandler {
/**
* On timeline relation event.
*
* @param timelineProjectRelationsEvent the timeline project relations event
*/
void onTimelineRelationEvent(TimelineProjectRelationsEvent timelineProjectRelationsEvent);
}

View File

@ -1,134 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class UpdateLayerToMapEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2023
*/
public class UpdateLayerToMapEvent extends GwtEvent<UpdateLayerToMapEventHandler> {
public static Type<UpdateLayerToMapEventHandler> TYPE = new Type<UpdateLayerToMapEventHandler>();
private GCubeCollection collection;
private String layerName;
private REQUEST_PARAMETER operation;
private String value;
private LAYER_TYPE layerType;
/**
* The Enum REQUEST_PARAMETER.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2023
*/
public static enum REQUEST_PARAMETER {
STYLE
}
/**
* The Enum LAYER_TYPE.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2023
*/
public static enum LAYER_TYPE {
INDEX, DETAILS
}
/**
* Instantiates a new adds the layer to map event.
*
* @param collection the collection
* @param layerName the layer name
* @param type the type
*/
public UpdateLayerToMapEvent(GCubeCollection collection, String layerName, LAYER_TYPE type) {
this.collection = collection;
this.layerName = layerName;
this.layerType = type;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<UpdateLayerToMapEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Sets the operation.
*
* @param operation the operation
* @param value the value
*/
public void setOperation(REQUEST_PARAMETER operation, String value) {
this.operation = operation;
this.value = value;
}
/**
* Gets the value.
*
* @return the value
*/
public String getValue() {
return value;
}
/**
* Gets the layer type.
*
* @return the layer type
*/
public LAYER_TYPE getLayerType() {
return layerType;
}
/**
* Gets the operation.
*
* @return the operation
*/
public REQUEST_PARAMETER getOperation() {
return operation;
}
/**
* Gets the layer name.
*
* @return the layer name
*/
public String getLayerName() {
return layerName;
}
/**
* Gets the collection.
*
* @return the collection
*/
public GCubeCollection getCollection() {
return collection;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(UpdateLayerToMapEventHandler handler) {
handler.onUpdateLayer(this);
}
}

View File

@ -1,20 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface UpdateLayerToMapEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 15, 2023
*/
public interface UpdateLayerToMapEventHandler extends EventHandler {
/**
* On update layer.
*
* @param updateLayerToMapEvent the update layer to map event
*/
void onUpdateLayer(UpdateLayerToMapEvent updateLayerToMapEvent);
}

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.GwtEvent;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler;

View File

@ -1,7 +1,9 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import com.google.gwt.event.shared.GwtEvent;
/**
@ -13,20 +15,17 @@ import com.google.gwt.event.shared.GwtEvent;
*/
public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler> {
public static Type<SearchPerformedEventHandler> TYPE = new Type<SearchPerformedEventHandler>();
private List<String> listProjectIDs;
private List<ConcessioneDV> data;
private boolean searchReset;
private String profileID;
/**
* Instantiates a new search performed event.
*
* @param profileID the profile ID
* @param listProjectIds the list project ids
* @param searchReset the search reset
* @param data the data
* @param searchReset the search reset
*/
public SearchPerformedEvent(String profileID, List<String> listProjectIds, boolean searchReset) {
this.profileID = profileID;
this.listProjectIDs = listProjectIds;
public SearchPerformedEvent(List<ConcessioneDV> data, boolean searchReset) {
this.data = data;
this.searchReset = searchReset;
}
@ -52,21 +51,12 @@ public class SearchPerformedEvent extends GwtEvent<SearchPerformedEventHandler>
}
/**
* Gets the profile ID. It is equal to collectionID
* Gets the data.
*
* @return the profile ID
* @return the data
*/
public String getProfileID() {
return profileID;
}
/**
* Gets the list project Ids.
*
* @return the list project Ids
*/
public List<String> getListProjectIDs() {
return listProjectIDs;
public List<ConcessioneDV> getData() {
return data;
}
/**

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler;

View File

@ -0,0 +1,134 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wfs.FeatureRow;
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 ShowDetailsEvent extends GwtEvent<ShowDetailsEventHandler> {
public static Type<ShowDetailsEventHandler> TYPE = new Type<ShowDetailsEventHandler>();
private String geonaItemType;
private FeatureRow featureRow;
private String geonaMongoID;
private String itemName;
/**
* 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 ShowDetailsEvent(String geonaItemType, String geonaMongoID, String itemName, FeatureRow featureRow) {
this.geonaItemType = geonaItemType;
this.geonaMongoID = geonaMongoID;
this.itemName = itemName;
this.featureRow = featureRow;
}
/**
* Instantiates a new show details event.
*
* @param gir the gir
* @param itemName the item name
* @param featureRow the feature row
*/
public ShowDetailsEvent(GeoNaItemRef gir, String itemName, FeatureRow featureRow) {
this.geonaItemType = gir.getItemType();
this.geonaMongoID = gir.getItemId();
this.itemName = itemName;
this.featureRow = featureRow;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<ShowDetailsEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(ShowDetailsEventHandler handler) {
handler.onShowDetails(this);
}
/**
* Gets the geona item type.
*
* @return the geona item type
*/
public String getGeonaItemType() {
return geonaItemType;
}
/**
* Gets the feature row.
*
* @return the feature row
*/
public FeatureRow getFeatureRow() {
return featureRow;
}
/**
* Gets the geona mongo ID.
*
* @return the geona mongo ID
*/
public String getGeonaMongoID() {
return geonaMongoID;
}
/**
* Gets the item name.
*
* @return the item name
*/
public String getItemName() {
return itemName;
}
/**
* Sets the item name.
*
* @param itemName the new item name
*/
public void setItemName(String itemName) {
this.itemName = itemName;
}
/**
* Gets the geona item ref.
*
* @return the geona item ref
*/
public GeoNaItemRef getGeonaItemRef() {
return new GeoNaItemRef(geonaMongoID, geonaItemType);
}
}

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler;
@ -18,4 +18,5 @@ public interface ShowDetailsEventHandler extends EventHandler {
* @param showDetailsEvent the show details event
*/
void onShowDetails(ShowDetailsEvent showDetailsEvent);
}

View File

@ -0,0 +1,61 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
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;
}
}

View File

@ -1,20 +1,21 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ShowPopupOnCentroidEventHandler.
* The Interface ShowPopupOnCentroiEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 12, 2023
* Dec 10, 2021
*/
public interface ShowPopupOnCentroidEventHandler extends EventHandler {
public interface ShowPopupOnCentroiEventHandler extends EventHandler {
/**
* On show popup.
*
* @param showPopupOnCentroiEvent the show popup on centroi event
*/
void onShowPopup(ShowPopupOnCentroidEvent showPopupOnCentroiEvent);
void onShowPopup(ShowPopupOnCentroiEvent showPopupOnCentroiEvent);
}

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.GwtEvent;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.application;
import com.google.gwt.event.shared.EventHandler;

View File

@ -1,7 +1,9 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.GwtEvent.Type;
public class CloseCollectionEvent extends GwtEvent<CloseCollectionEventHandler> {
@ -16,8 +18,8 @@ public class CloseCollectionEvent extends GwtEvent<CloseCollectionEventHandler>
}
@Override
protected void dispatch(CloseCollectionEventHandler handler) {
handler.onCloseCollection(this);
protected void dispatch(CloseCollectionEventHandler h) {
}
public CloseCollectionEvent(String collectionId) {

View File

@ -4,6 +4,4 @@ import com.google.gwt.event.shared.EventHandler;
public interface CloseCollectionEventHandler extends EventHandler{
void onCloseCollection(CloseCollectionEvent closeCollectionEvent);
}

View File

@ -3,38 +3,27 @@ package org.gcube.portlets.user.geoportaldataviewer.client.events.collections;
import com.google.gwt.event.shared.GwtEvent;
public class OpenCollectionEvent extends GwtEvent<OpenCollectionEventHandler> {
private String collectionId = null;
public static Type<OpenCollectionEventHandler> TYPE = new Type<OpenCollectionEventHandler>();
public static Type<OpenCollectionEventHandler> TYPE = new Type<OpenCollectionEventHandler>();
@Override
public Type<OpenCollectionEventHandler> getAssociatedType() {
return TYPE;
}
/**
* Gets the associated type.
*
* @return the associated type
*/
@Override
public Type<OpenCollectionEventHandler> getAssociatedType() {
return TYPE;
@Override
protected void dispatch(OpenCollectionEventHandler h) {
h.onOpenCollection(this);
}
public OpenCollectionEvent(String collectionId) {
this.collectionId=collectionId;
}
/**
* Dispatch.
*
* @param handler the handler
*/
@Override
protected void dispatch(OpenCollectionEventHandler handler) {
handler.onOpenCollection(this);
}
public OpenCollectionEvent(String collectionId) {
this.collectionId = collectionId;
}
public String getCollectionId() {
public String getCollectionId() {
return collectionId;
}
}

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
import com.google.gwt.event.shared.EventHandler;

View File

@ -1,18 +1,18 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import com.google.gwt.event.shared.GwtEvent;
/**
* The Class ChangeMapLayerEvent.
* The Class ChangeBaseMapLayerEvent.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 12, 2021
*/
public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
public static Type<ChangeMapLayerEventHandler> TYPE = new Type<ChangeMapLayerEventHandler>();
public class ChangeBaseMapLayerEvent extends GwtEvent<ChangeBaseMapLayerEventHandler> {
public static Type<ChangeBaseMapLayerEventHandler> TYPE = new Type<ChangeBaseMapLayerEventHandler>();
private BaseMapLayer baseMapLayer;
/**
@ -20,7 +20,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
*
* @param baseMapLayer the base map layer
*/
public ChangeMapLayerEvent(BaseMapLayer baseMapLayer) {
public ChangeBaseMapLayerEvent(BaseMapLayer baseMapLayer) {
this.baseMapLayer = baseMapLayer;
}
@ -31,7 +31,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
* @return the associated type
*/
@Override
public Type<ChangeMapLayerEventHandler> getAssociatedType() {
public Type<ChangeBaseMapLayerEventHandler> getAssociatedType() {
return TYPE;
}
@ -41,7 +41,7 @@ public class ChangeMapLayerEvent extends GwtEvent<ChangeMapLayerEventHandler> {
* @param handler the handler
*/
@Override
protected void dispatch(ChangeMapLayerEventHandler handler) {
protected void dispatch(ChangeBaseMapLayerEventHandler handler) {
handler.onChangeBaseMapLayer(this);
}

View File

@ -1,20 +1,20 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
import com.google.gwt.event.shared.EventHandler;
/**
* The Interface ChangeMapLayerEventHandler.
* The Interface ChangeBaseMapLayerEventHandler.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 12, 2021
*/
public interface ChangeMapLayerEventHandler extends EventHandler {
public interface ChangeBaseMapLayerEventHandler extends EventHandler {
/**
* On change base map layer.
*
* @param changeMapLayerEvent the change map layer event
*/
void onChangeBaseMapLayer(ChangeMapLayerEvent changeMapLayerEvent);
void onChangeBaseMapLayer(ChangeBaseMapLayerEvent changeMapLayerEvent);
}

View File

@ -1,8 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd.DragDropLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerObject;
import com.google.gwt.event.shared.GwtEvent;
@ -24,7 +22,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
* Oct 12, 2021
*/
public static enum DO_LAYER_ACTION {
VISIBILITY, SWAP, OPACITY, LOCATE_LAYER
VISIBILITY, SWAP, OPACITY
}
private DO_LAYER_ACTION doAction;
@ -33,31 +31,29 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
private boolean visibility;
private SwapLayer sourceLayerSwap;
private SwapLayer targetLayerSwap;
private LayerObject layerObject;
private DragDropLayer sourceEventUI;
/**
* The Class SwapLayer.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Oct 15, 2021
* Oct 15, 2021
*/
public static class SwapLayer {
public static class SwapLayer{
private LayerItem layerItem;
private int position;
/**
* Instantiates a new swap layer.
*
* @param layerItem the layer item
* @param position the position
* @param position the position
*/
public SwapLayer(LayerItem layerItem, int position) {
public SwapLayer(LayerItem layerItem, int position){
this.layerItem = layerItem;
this.position = position;
}
/**
* Gets the layer item.
*
@ -66,7 +62,7 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
public LayerItem getLayerItem() {
return layerItem;
}
/**
* Gets the position.
*
@ -80,14 +76,11 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
/**
* Instantiates a new do action on detail layers event.
*
* @param action the action
* @param layerItem the layer item
* @param layerObject the layer object
* @param layerObject the layer object
* @param action the action
* @param layerItem the layer item
*/
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem, LayerObject layerObject) {
public DoActionOnDetailLayersEvent(DO_LAYER_ACTION action, LayerItem layerItem) {
this.layerItem = layerItem;
this.layerObject = layerObject;
this.doAction = action;
}
@ -142,24 +135,6 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
}
/**
* Gets the layer object.
*
* @return the layer object
*/
public LayerObject getLayerObject() {
return layerObject;
}
/**
* Sets the layer object.
*
* @param layerObject the new layer object
*/
public void setLayerObject(LayerObject layerObject) {
this.layerObject = layerObject;
}
/**
* Gets the do action.
*
@ -214,25 +189,6 @@ public class DoActionOnDetailLayersEvent extends GwtEvent<DoActionOnDetailLayers
return visibility;
}
/**
* Sets the UI event source.
*
* @param sourceEventUI the new UI event source
*/
public void setUIEventSource(DragDropLayer sourceEventUI) {
this.sourceEventUI = sourceEventUI;
}
/**
* Gets the source event UI.
*
* @return the source event UI
*/
public DragDropLayer getSourceEventUI() {
return sourceEventUI;
}
/**
* To string.
*

View File

@ -1,4 +1,4 @@
package org.gcube.portlets.user.geoportaldataviewer.client.events;
package org.gcube.portlets.user.geoportaldataviewer.client.events.layers;
import com.google.gwt.event.shared.EventHandler;

View File

@ -32,15 +32,15 @@ public class ExtentWrapped extends ol.Extent {
super(minX, minY, maxX, maxY);
}
// /**
// * @param coordinate coordinate to check.
// * @return true if the passed coordinate is contained or on the edge of the
// * extent.
// */
// @JsOverlay
// public final Coordinate getCenter() {
// return getCenter((ol.Extent) this);
// }
/**
* @param coordinate coordinate to check.
* @return true if the passed coordinate is contained or on the edge of the
* extent.
*/
@JsOverlay
public final Coordinate getCenter() {
return getCenter((ol.Extent) this);
}
@JsMethod(name = "getCenter", namespace = PACKAGE_EXTENT)
private static native Coordinate getCenter(Extent extent);

View File

@ -19,18 +19,17 @@ public class LayerOrder {
* Nov 12, 2021
*/
public static enum LAYER_TYPE {
BASE_MAP, CUSTOM_WMS_DETAIL, BASE_WMS, WMS_DETAIL, VECTOR
BASE_MAP, BASE_WMS, WMS_DETAIL, VECTOR
}
public static final HashMap<LAYER_TYPE, Integer> LAYER_OFFSET = new HashMap<LAYER_TYPE, Integer>(5);
static {
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0); //Base OL or MapBox
LAYER_OFFSET.put(LAYER_TYPE.CUSTOM_WMS_DETAIL, 70); //WMS custom Overlay. Es. Layer "Limiti Amministrativi"
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 210); // Index layers (i.e. centroids for UCD)
LAYER_OFFSET.put(LAYER_TYPE.WMS_DETAIL, 140); //Layer/s belonging to a Project (materialized layers. Ex. "Posizionamento Scavo")
LAYER_OFFSET.put(LAYER_TYPE.VECTOR, 320); //Vector layer to show other info. Ex. Pointer with coordinates (x,y) in the Light OL Map.
LAYER_OFFSET.put(LAYER_TYPE.BASE_MAP, 0);
LAYER_OFFSET.put(LAYER_TYPE.BASE_WMS, 70);
LAYER_OFFSET.put(LAYER_TYPE.WMS_DETAIL, 140);
LAYER_OFFSET.put(LAYER_TYPE.VECTOR, 210);
}
/**

View File

@ -166,7 +166,7 @@ public class LightOpenLayerMap {
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getListBaseMapLayers();
List<BaseMapLayer> listBaseMapLayers = GeoportalDataViewer.getStatus().getConfig().getBaseLayers();
BaseMapLayer bml = null;
if(listBaseMapLayers!=null)
bml = listBaseMapLayers.get(0);

View File

@ -1,12 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import com.google.gwt.core.client.GWT;
import ol.Collection;
import ol.Coordinate;
import ol.Extent;
import ol.control.Attribution;
import ol.control.Control;
import ol.control.FullScreen;
@ -15,58 +10,50 @@ import ol.control.ZoomSlider;
import ol.geom.LineString;
import ol.proj.Projection;
/**
* The Class MapUtils.
*
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
*
* Nov 12, 2020
* Nov 12, 2020
*/
public final class MapUtils {
/**
* Creates some default controls and adds it to the collection.
*
* @param controls collection with controls
*/
public static void addDefaultControls(final Collection<Control> controls) {
controls.push(new FullScreen());
controls.push(new ZoomSlider());
MousePosition mousePosition = new MousePosition();
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
controls.push(mousePosition);
/**
* Creates some default controls and adds it to the collection.
*
* @param controls collection with controls
*/
public static void addDefaultControls(final Collection<Control> controls) {
controls.push(new FullScreen());
controls.push(new ZoomSlider());
MousePosition mousePosition = new MousePosition();
mousePosition.setCoordinateFormat(Coordinate.createStringXY(5));
controls.push(mousePosition);
Attribution attribution = new Attribution();
attribution.setCollapsed(true);
controls.push(attribution);
// controls.push(new ZoomToExtent());
}
//controls.push(new ZoomToExtent());
}
/**
* Transform coordiante.
*
* @param centerCoordinate the center coordinate
* @param source the source
* @param target the target
* @param source the source
* @param target the target
* @return the coordinate
*/
public static Coordinate transformCoordiante(Coordinate centerCoordinate, String source, String target) {
return Projection.transform(centerCoordinate, source, target);
}
/**
* Transform extent.
*
* @param extent the extent
* @param source the source
* @param target the target
* @return the extent
*/
public static Extent transformExtent(Extent extent, String source, String target) {
return Projection.transformExtent(extent, source, target);
}
/**
* Distance between centroid.
@ -76,9 +63,10 @@ public final class MapUtils {
* @return the long
*/
public static long distanceBetweenCentroid(ExtentWrapped ex1, ExtentWrapped ex2) {
return distanceBetween(ex1.getCenter(), ex2.getCenter());
return distanceBetween(ex1.getCenter(),ex2.getCenter());
}
/**
* Distance between.
*
@ -96,43 +84,15 @@ public final class MapUtils {
// GWT.log("Line length is: "+ls);
return Math.round(ls.getLength() * 100) / 100;
}
/**
* Reverse coordinate.
*
* @param coord the coord
* @return the coordinate
*/
public static Coordinate reverseCoordinate(Coordinate coord) {
public static Coordinate reverseCoordinate(Coordinate coord){
return new Coordinate(coord.getY(), coord.getX());
}
/**
* Geo JSON to B box center.
*
* @param spatialReference the spatial reference
* @param transforFrom the transfor from
* @param transformTo the transform to
* @return the coordinate
*/
public static Coordinate geoJSONToBBOXCenter(GeoJSON spatialReference, String transforFrom, String transformTo) {
try {
if (spatialReference != null) {
ExtentWrapped ew = new ExtentWrapped(spatialReference.getBbox().getMinX(),
spatialReference.getBbox().getMinY(), spatialReference.getBbox().getMaxX(),
spatialReference.getBbox().getMaxY());
Coordinate center = ew.getCenter();
if (transforFrom != null && transformTo != null)
center = transformCoordiante(center, transforFrom, transformTo);
return center;
}
} catch (Exception e) {
GWT.log("geoJSONTToBBoxCenter error: " + e.getMessage());
}
return null;
}
}

View File

@ -1,15 +1,13 @@
package org.gcube.portlets.user.geoportaldataviewer.client.gis;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddedLayerToMapEvent.LAYER_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.util.WFSMakerUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.AddedLayerToMapEvent.LAYER_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
@ -37,10 +35,7 @@ import ol.Overlay;
import ol.OverlayOptions;
import ol.Size;
import ol.View;
import ol.ViewFitOptions;
import ol.ViewOptions;
import ol.animation.AnimationOptions;
import ol.color.Color;
import ol.event.EventListener;
import ol.geom.Geometry;
import ol.interaction.Draw;
@ -64,13 +59,9 @@ import ol.source.ImageWmsParams;
import ol.source.Osm;
import ol.source.Source;
import ol.source.Vector;
import ol.source.WmsServerType;
import ol.source.Xyz;
import ol.source.XyzOptions;
import ol.style.Fill;
import ol.style.FillOptions;
import ol.style.Stroke;
import ol.style.StrokeOptions;
import ol.style.Style;
/**
* The Class OpenLayerMap.
@ -81,29 +72,8 @@ import ol.style.Style;
*/
public abstract class OpenLayerMap {
public static final String CQL_FILTER_PARAMETER = WFSMakerUtil.CQL_FILTER_PARAMETER;
private static final int MAX_LENGHT_CQL_FOR_GET_REQUEST = 1600; // 1600 characters
public static final int SET_CENTER_ANIMATED_DURATION = 500;
public static final int ZOOM_ANIMATED_DURATION = 3000;
public static final int MAX_ZOOM = 21;
/**
* The Enum CQL_FACILITY_ORIGIN.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jun 6, 2023
*/
public static enum CQL_FACILITY_ORIGIN {
SEARCH, CROSS_FILTERING
}
public HashMap<CQL_FACILITY_ORIGIN, String> cqlFilterMap = new HashMap<CQL_FACILITY_ORIGIN, String>();
/**
* Click listener.
*
@ -167,26 +137,24 @@ public abstract class OpenLayerMap {
private LinkedHashMap<String, Image> wmsDetailsLayerMap;
private LinkedHashMap<String, Image> wmsGroupedCustomLayerMap;
private LinkedHashMap<String, Image> wmsLayerMap;
private LinkedHashMap<String, ol.layer.Vector> vectorLayersHighlighted = new LinkedHashMap<String, ol.layer.Vector>();
private Layer baseLayerTile;
private LayerOrder layerOrder = new LayerOrder();
/**
* Instantiates a new open layer OSM.
*
* @param divTargetId the div target id
* @param eventBus the event bus
* @param baseLayer the base layer
* @param eventBus the event bus
* @param baseLayer the base layer
*/
public OpenLayerMap(String divTargetId, HandlerManager eventBus, BaseMapLayer baseLayer) {
this.eventBus = eventBus;
// create a projection
projectionOptions.setCode(MAP_PROJECTION.EPSG_3857.getName());
projectionOptions.setUnits("m");
@ -205,7 +173,7 @@ public abstract class OpenLayerMap {
map = new Map(mapOptions);
// map.addLayer(baseLayerTile);
//map.addLayer(baseLayerTile);
// map.addLayer(tileDebugLayer);
// add some controls
@ -215,8 +183,8 @@ public abstract class OpenLayerMap {
// add some interactions
map.addInteraction(new KeyboardPan());
map.addInteraction(new KeyboardZoom());
// applying base map
//applying base map
changeBaseMap(baseLayer);
bindEvents();
@ -245,11 +213,11 @@ public abstract class OpenLayerMap {
XyzOptions xyzOptions = OLFactory.createOptions();
Osm osmSource = new Osm(xyzOptions);
osmSource.setUrl(baseLayer.getUrl());
// setAttributions is buggy
// osmSource.setAttributions(baseLayer.getAttribution());
//setAttributions is buggy
//osmSource.setAttributions(baseLayer.getAttribution());
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(osmSource);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP) + 1;
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
layerOptions.setZIndex(zIndex);
baseLayerTile = new Tile(layerOptions);
@ -259,15 +227,16 @@ public abstract class OpenLayerMap {
XyzOptions xyzOptions2 = OLFactory.createOptions();
Xyz xyz = new Xyz(xyzOptions2);
// setAttributions is buggy
// xyz.setAttributions(baseLayer.getAttribution());
//setAttributions is buggy
//xyz.setAttributions(baseLayer.getAttribution());
xyz.setUrl(baseLayer.getUrl());
LayerOptions layerOptions2 = OLFactory.createOptions();
layerOptions2.setSource(xyz);
zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP) + 1;
zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_MAP)+1;
layerOptions2.setZIndex(zIndex);
baseLayerTile = new Tile(layerOptions2);
break;
@ -332,13 +301,7 @@ public abstract class OpenLayerMap {
* @param centerCoordinate the new center
*/
public void setCenter(Coordinate centerCoordinate) {
AnimationOptions animations = new AnimationOptions();
animations.setCenter(centerCoordinate);
animations.setDuration(SET_CENTER_ANIMATED_DURATION);
view.animate(animations);
// view.setCenter(centerCoordinate);
view.setCenter(centerCoordinate);
}
/**
@ -347,11 +310,7 @@ public abstract class OpenLayerMap {
* @param zoom the new zoom
*/
public void setZoom(int zoom) {
AnimationOptions animations = new AnimationOptions();
animations.setDuration(ZOOM_ANIMATED_DURATION);
animations.setZoom(zoom);
view.animate(animations);
// view.setZoom(zoom);
view.setZoom(zoom);
}
/**
@ -367,7 +326,7 @@ public abstract class OpenLayerMap {
elPopup.getStyle().setVisibility(Visibility.VISIBLE);
if (popupOverlay == null) {
popupOverlay = addOverlay(elPopup);
addPopupCloserHandler(popupOverlay);
addPopupCloserHandelr(popupOverlay);
}
Element popContent = DOM.getElementById("popup-content");
popContent.setInnerHTML(html);
@ -385,11 +344,11 @@ public abstract class OpenLayerMap {
}
/**
* Adds the popup closer handler.
* Adds the popup closer handelr.
*
* @param popupOverlay the popup overlay
*/
private void addPopupCloserHandler(Overlay popupOverlay) {
private void addPopupCloserHandelr(Overlay popupOverlay) {
Element elPopupCloser = DOM.getElementById("popup-closer");
Event.sinkEvents(elPopupCloser, Event.ONCLICK);
Event.setEventListener(elPopupCloser, new com.google.gwt.user.client.EventListener() {
@ -437,17 +396,19 @@ 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.getMapServerEndpoint());
imageWMSOptions.setUrl(layerItem.getMapServerHost());
imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
// Settings MIN and MAX Resolution
if (layerItem.getMinResolution() != null) {
layerOptions.setMinResolution(layerItem.getMinResolution());
@ -457,8 +418,8 @@ public abstract class OpenLayerMap {
}
Image wmsLayer = new Image(layerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_WMS) + wmsLayerMap.size() + 1;
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.BASE_WMS)+wmsLayerMap.size()+1;
wmsLayer.setZIndex(zIndex);
// visibleLayerItems
@ -472,65 +433,22 @@ public abstract class OpenLayerMap {
}
}
/**
* Sets the CQL filter to WMS layer.
*
* @param origin the origin
* @param layerName the key
* @param newCQLFilterExpression the cql filter expression
* @return the new CQL Filter
*/
public String setCQLFilterToWMSLayer(CQL_FACILITY_ORIGIN origin, String layerName, String newCQLFilterExpression) {
GWT.log("Getting key (layerName): " + layerName);
GWT.log("Adding CQL FILTER: " + newCQLFilterExpression);
Image wmsLayer = wmsLayerMap.get(layerName);
GWT.log("WMS layer is: " + wmsLayer);
ImageWms imageWMSSource = wmsLayer.getSource();
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
// Setting new CQL filter for Origin
cqlFilterMap.put(origin, newCQLFilterExpression);
String setCQLFilter = "";
// Building new CQL filter
for (CQL_FACILITY_ORIGIN originKey : cqlFilterMap.keySet()) {
String originCQLFilter = cqlFilterMap.get(originKey);
if (originCQLFilter != null) {
if (setCQLFilter.isEmpty()) {
setCQLFilter = originCQLFilter;
} else {
setCQLFilter += " AND " + originCQLFilter;
}
}
}
if (setCQLFilter.isEmpty())
imageWMSParams.delete(CQL_FILTER_PARAMETER);
else
imageWMSParams.set(CQL_FILTER_PARAMETER, setCQLFilter);
imageWMSSource.updateParams(imageWMSParams);
wmsLayer.setSource(imageWMSSource);
wmsLayer.changed();
GWT.log("returning " + CQL_FILTER_PARAMETER + ": " + setCQLFilter);
return setCQLFilter;
}
/**
* Adds the WMS detail layer.
*
* @param layerItem the layer item
* @param initialOpacity the initial opacity
* @param layerItem the layer item
*/
public void addWMSDetailLayer(LayerItem layerItem, double initialOpacity) {
public synchronized void addWMSDetailLayer(LayerItem layerItem) {
GWT.log("Adding WMS Detail Layer on map "+layerItem);
if (wmsDetailsLayerMap == null)
wmsDetailsLayerMap = new LinkedHashMap<String, Image>();
@ -542,16 +460,21 @@ public abstract class OpenLayerMap {
GWT.log("The detail layer with key: " + key + " does not exist, creating and adding it to map");
ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
imageWMSOptions.setUrl(layerItem.getMapServerHost());
imageWMSOptions.setServerType(WmsServerType.GEOSERVER);
imageWMSOptions.setUrl(layerItem.getWmsLink().substring(0, layerItem.getWmsLink().lastIndexOf("?")));
imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
// Settings MIN and MAX Resolution
if (layerItem.getMinResolution() != null) {
layerOptions.setMinResolution(layerItem.getMinResolution());
@ -561,9 +484,8 @@ public abstract class OpenLayerMap {
}
Image wmsLayer = new Image(layerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL) + wmsDetailsLayerMap.size() + 1;
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.WMS_DETAIL)+wmsDetailsLayerMap.size() + 1;
wmsLayer.setZIndex(zIndex);
wmsLayer.setOpacity(initialOpacity);
map.addLayer(wmsLayer);
wmsDetailsLayerMap.put(key, wmsLayer);
@ -575,116 +497,55 @@ public abstract class OpenLayerMap {
}
/**
* Adds the custom WMS detail layer.
*
* @param layerItem the layer item
*/
public void addGroupedCustomWMSLayer(LayerItem layerItem) {
public void setCQLFilterToWMSLayer(String key, String cqlFilterExpression) {
if (wmsGroupedCustomLayerMap == null)
wmsGroupedCustomLayerMap = new LinkedHashMap<String, Image>();
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();
String key = layerItem.getName();
Image layer = wmsGroupedCustomLayerMap.get(key);
if (layer == null) {
GWT.log("The grouped custom layer with key: " + key + " does not exist, creating and adding it to map");
ImageWmsParams imageWMSParams = OLFactory.createOptions();
imageWMSParams.setLayers(layerItem.getName());
ImageWmsOptions imageWMSOptions = OLFactory.createOptions();
imageWMSOptions.setUrl(layerItem.getMapServerEndpoint());
imageWMSOptions.setParams(imageWMSParams);
// imageWMSOptions.setRatio(1.5f);
ImageWms imageWMSSource = new ImageWms(imageWMSOptions);
LayerOptions layerOptions = OLFactory.createOptions();
layerOptions.setSource(imageWMSSource);
// Settings MIN and MAX Resolution
if (layerItem.getMinResolution() != null) {
layerOptions.setMinResolution(layerItem.getMinResolution());
}
if (layerItem.getMaxResolution() != null) {
layerOptions.setMaxResolution(layerItem.getMaxResolution());
}
Image wmsLayer = new Image(layerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.CUSTOM_WMS_DETAIL) + wmsGroupedCustomLayerMap.size()
+ 1;
wmsLayer.setZIndex(zIndex);
map.addLayer(wmsLayer);
wmsGroupedCustomLayerMap.put(key, wmsLayer);
GWT.log("Added GroupedCustomWMSLayer for layer name: " + layerItem.getName());
eventBus.fireEvent(new AddedLayerToMapEvent(layerItem, LAYER_TYPE.OVERLAY));
if (cqlFilterExpression == null) {
imageWMSParams.delete("CQL_FILTER");
} else {
GWT.log("The WMS detail layer with key: " + key + " already exists, skipping");
imageWMSParams.set("CQL_FILTER", cqlFilterExpression);
}
imageWMSSource.updateParams(imageWMSParams);
wmsLayer.setSource(imageWMSSource);
//map.addLayer(wmsLayer);
}
/**
* Removes the all detail layers.
*
* @param layerName the layer name
*/
public void removeWMSLayer(String layerName) {
GWT.log("Removing layerName: " + layerName + " from map: " + wmsLayerMap);
// NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
if (wmsLayerMap == null)
return;
Image layer = wmsLayerMap.get(layerName);
if (layer != null) {
map.removeLayer(layer);
wmsLayerMap.remove(layerName);
GWT.log("Removed layerName: " + layerName + " from map: " + wmsLayerMap.keySet());
}
}
/**
* Removes the all detail layers.
*/
public void removeAllDetailLayers() {
if (wmsDetailsLayerMap == null)
return;
GWT.log("Removing wmsDetailsLayerMap: " + wmsDetailsLayerMap.keySet() + " from map");
for (String key : wmsDetailsLayerMap.keySet()) {
Image layer = wmsDetailsLayerMap.get(key);
map.removeLayer(layer);
}
wmsDetailsLayerMap.clear();
}
/**
* Removes the all layer features as highlight.
*/
public void removeAllLayerFeaturesAsHighlight() {
if (vectorLayersHighlighted == null)
return;
GWT.log("Removing vectorLayersHighlighted: " + vectorLayersHighlighted.keySet() + " from map");
for (String layerName : vectorLayersHighlighted.keySet()) {
removeLayerFeaturesAsHighlight(layerName);
}
vectorLayersHighlighted.clear();
}
// /**
// * Removes the all detail layers.
// */
// public void removeAllDetailLayers() {
//
// // NOT NEEDED ANYMORE.. I'M USING MIN/MAX LAYER RESOLUTION
//
// if (wmsDetailsLayerMap == null)
// return;
//
// GWT.log("Removing layers: " + wmsDetailsLayerMap.keySet() + " from map");
//
// for (String key : wmsDetailsLayerMap.keySet()) {
// Image layer = wmsDetailsLayerMap.get(key);
// map.removeLayer(layer);
// }
//
// wmsDetailsLayerMap.clear();
//
// }
/**
* Adds the vector.
@ -696,12 +557,12 @@ public abstract class OpenLayerMap {
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
vectorLayerOptions.setMap(map);
Style style = new Style();
FillOptions fillOptions = new FillOptions();
Color color = new Color(0, 0, 255, 1.0);
fillOptions.setColor(color);
Fill fill = new Fill(fillOptions);
style.setFill(fill);
// Style style = new Style();
// FillOptions fillOptions = new FillOptions();
// Color color = new Color(0, 0, 255, 1.0);
// fillOptions.setColor(color);
// Fill fill = new Fill(fillOptions);
// style.setFill(fill);
FeatureOptions featureOptions = new FeatureOptions();
featureOptions.setGeometry(geometry);
@ -710,105 +571,15 @@ public abstract class OpenLayerMap {
Vector vectorSource = OLFactory.createVectorSource();
vectorSource.addFeature(feature);
vectorLayerOptions.setSource(vectorSource);
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR) + 1000;
int zIndex = layerOrder.getOffset(LayerOrder.LAYER_TYPE.VECTOR)+1;
vector.setZIndex(zIndex);
map.addLayer(vector);
}
/**
* Adds the vector.
*
* @param layerItem the layer item
* @param features the features
* @param fitMapToFeaturesExtent the fit map to features extent
*/
public void addLayerFeaturesAsHighlight(LayerItem layerItem, Feature[] features, boolean fitMapToFeaturesExtent) {
removeLayerFeaturesAsHighlight(layerItem.getName());
Style style = new Style();
StrokeOptions strokeOptions = new StrokeOptions();
strokeOptions.setColor(new Color(255, 69, 0, 0.8));
strokeOptions.setWidth(5);
Stroke stroke = new Stroke(strokeOptions);
stroke.setWidth(2);
style.setStroke(stroke);
Vector vectorSource = OLFactory.createVectorSource();
EventListener<ol.events.Event> listenerE = new EventListener<ol.events.Event>() {
@Override
public void onEvent(ol.events.Event event) {
ol.Extent theExtent = vectorSource.getExtent();
// GWT.log(theExtent.toString());
map.getView().fit(theExtent);
}
};
if (fitMapToFeaturesExtent)
vectorSource.addChangeListener(listenerE);
vectorSource.addFeatures(features);
// GWT.log("features: " + features);
VectorLayerOptions vectorLayerOptions = new VectorLayerOptions();
vectorLayerOptions.setSource(vectorSource);
vectorLayerOptions.setStyle(style);
// GWT.log("vectorLayerOptions: " + vectorLayerOptions);
ol.layer.Vector vector = OLFactory.createVector(vectorLayerOptions);
// vector.setStyle(style);
vector.setVisible(true);
vector.setZIndex(5000);
vectorLayersHighlighted.put(layerItem.getName(), vector);
map.addLayer(vector);
}
/**
* Are layer features A as highlight.
*
* @param layerItem the layer item
* @return true, if successful
*/
public boolean areLayerFeaturesAsHighlight(LayerItem layerItem) {
return vectorLayersHighlighted.get(layerItem.getName()) != null;
}
/**
* Removes the layer features A as highlight.
*
* @param layerName the layer name
* @return true, if successful
*/
public boolean removeLayerFeaturesAsHighlight(String layerName) {
try {
ol.layer.Vector vl = vectorLayersHighlighted.get(layerName);
if (vl != null) {
map.removeLayer(vl);
vectorLayersHighlighted.remove(layerName);
return true;
}
} catch (Exception e) {
}
return false;
}
/**
* Adds the point vector source.
*
@ -1130,23 +901,6 @@ public abstract class OpenLayerMap {
layer.setVisible(visible);
}
public void setLayerStyleForIndex(String layerName, String value) {
GWT.log("Setting style " + value + " for " + layerName);
Image indexWmsLayer = wmsLayerMap.get(layerName);
GWT.log("WMS layer is: " + indexWmsLayer);
if (indexWmsLayer != null) {
ImageWms imageWMSSource = indexWmsLayer.getSource();
ImageWmsParams imageWMSParams = imageWMSSource.getParams();
imageWMSParams.set("STYLES", value);
imageWMSSource.updateParams(imageWMSParams);
indexWmsLayer.setSource(imageWMSSource);
indexWmsLayer.changed();
}
}
/**
* Sets the WMS detail layer opacity.
*
@ -1156,21 +910,7 @@ public abstract class OpenLayerMap {
public void setWMSDetailLayerOpacity(LayerItem layerItem, double opacity) {
String key = layerItem.getName();
Image layer = wmsDetailsLayerMap.get(key);
if (layer != null)
layer.setOpacity(opacity);
}
/**
* Sets the WMS detail layer visible.
*
* @param layerItem the layer item
* @param visible the visible
*/
public void setWMSGroupedCustomLayerVisible(LayerItem layerItem, boolean visible) {
String key = layerItem.getName();
Image layer = wmsGroupedCustomLayerMap.get(key);
if (layer != null)
layer.setVisible(visible);
layer.setOpacity(opacity);
}
/**
@ -1210,17 +950,4 @@ public abstract class OpenLayerMap {
return map.get((map.keySet().toArray())[index]);
}
/**
* Fit to extent.
*
* @param extent the extent
*/
public void fitToExtent(ol.Extent extent) {
ViewFitOptions opt = new ViewFitOptions();
opt.setMaxZoom(16);
opt.setDuration(SET_CENTER_ANIMATED_DURATION * 5);
map.getView().fit(extent, opt);
}
}

View File

@ -17,7 +17,7 @@ public interface GNAImages extends ClientBundle {
* Our sample image icon. Makes the image resource for the gwt-compiler's css
* composer accessible
*/
@Source("map1.png")
@Source("map.png")
ImageResource map();
@Source("preset_location.png")
@ -46,23 +46,5 @@ public interface GNAImages extends ClientBundle {
@Source("layer_invisible.png")
ImageResource layerInvisible();
@Source("locate.png")
ImageResource locate();
@Source("locate_none.png")
ImageResource locateNone();
@Source("spinner_earth.gif")
ImageResource spinnerEarth();
@Source("spinner_clock.gif")
ImageResource spinnerClock();
@Source("geoportal_error.png")
ImageResource geoportaServiceError();
@Source("warning_error.png")
ImageResource warningError();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 705 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -1,9 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectViewer;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.ClosedViewDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.products.concessioni.ConcessioneView;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
@ -32,7 +33,7 @@ public class DetailsPanel extends Composite {
@UiField
HTMLPanel detailsHTMLPanel;
private ProjectView displayedProject = null;
private RecordDV displayedRecord = null;
private HandlerManager applicationBus;
@ -62,15 +63,15 @@ public class DetailsPanel extends Composite {
}
public void showDetailsFor(ProjectView result, GeoportalItemReferences geonaItemRef) {
this.displayedProject = result;
public void showDetailsFor(ConcessioneDV cdv, GeoNaItemRef geonaItemRef) {
this.displayedRecord = cdv;
datailsContainerPanel.clear();
if(detailsHTMLPanel.getParent()!=null) {
detailsHTMLPanel.getParent().getElement().setScrollTop(0);
}
datailsContainerPanel.add(new ProjectViewer(applicationBus, geonaItemRef, result));
datailsContainerPanel.add(new ConcessioneView(geonaItemRef, cdv));
showPanelDetails();
}
@ -79,13 +80,13 @@ public class DetailsPanel extends Composite {
}
public void hidePanelDetails() {
this.displayedProject = null;
this.displayedRecord = null;
datailsContainerPanel.clear();
detailsHTMLPanel.setVisible(false);
}
public ProjectView getDisplayedProject() {
return displayedProject;
public RecordDV getDisplayedRecord() {
return displayedRecord;
}
}

View File

@ -8,23 +8,12 @@
}
.to-align-right{
position: absolute;
top: 50px;
top: 10px;
right: 10px;
}
.to-align-left {
position: absolute;
top: 5px;
color: white !important;
text-decoration: none !important;
}
.to-align-left :hover {
color: #F5F5F5;
}
</ui:style>
<g:HTMLPanel ui:field="detailsHTMLPanel" visible="false">
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-left}"></b:Button>
<b:Button ui:field="closeButton" addStyleNames="{style.to-align-right}"></b:Button>
<g:HTMLPanel ui:field="datailsContainerPanel"></g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,55 +1,30 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.application.geoportalcommon.shared.SearchingFilter.ORDER;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.ConfiguredLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ucd.UseCaseDescriptorDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.GisToolbarFacilities;
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.events.ChangeMapLayerEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.MapExtentToEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.application.MapExtentToEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.CloseCollectionEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.collections.OpenCollectionEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.ChangeBaseMapLayerEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.OpenLayerMap;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAIcons;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search.SearchFacilityUI;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.crossfiltering.CrossFilteringLayerPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.customoverlays.OverlayCustomLayerPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.layercollection.LayerCollectionPanel;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.ItemFieldsResponse;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.BaseMapLayer;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
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.Paragraph;
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.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.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.logical.shared.ValueChangeEvent;
@ -60,13 +35,10 @@ import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.LayoutPanel;
import com.google.gwt.user.client.ui.RadioButton;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
@ -80,10 +52,6 @@ import com.google.gwt.user.client.ui.Widget;
*/
public class GeonaDataViewMainPanel extends Composite {
private static final String PLACEHOLDER_SELECT_SEARCH_IN = "Select Collection...";
private static GeonaDataViewMainPanelUiBinder uiBinder = GWT.create(GeonaDataViewMainPanelUiBinder.class);
/**
@ -122,48 +90,37 @@ public class GeonaDataViewMainPanel extends Composite {
@UiField
Button linkLayers;
//TODO Search By Collection, postponed
// @UiField
// DropdownButton searchFacilityButton;
//
// @UiField
// ScrollPanel searchFacilityPanel;
//
@UiField
DropdownButton openCollectionDropDown;
@UiField
DropdownButton linkCustomOverlayLayers;
@UiField
DropdownButton linkCrossFilteringLayers;
@UiField
HTMLPanel panelCustomOverlayLayers;
@UiField
HTMLPanel panelCrossFilteringLayers;
@UiField
HTMLPanel openCollectionPanel;
@UiField
DropdownButton searchFacilityButton;
@UiField
ListBox navListSearch;
//@UiField
//ScrollPanel overlayLayersPanel;
RootPanel overlayLayersPanel = RootPanel.get(GeoportalDataViewer.DIV_LAYER_VIEW);
@UiField
ScrollPanel searchFacilityPanel;
ScrollPanel overlayLayersPanel;
@UiField
HTMLPanel panelAttribution;
@UiField
HTMLPanel panelBaseLayers;
@UiField
DropdownButton linkMap;
@UiField
DropdownButton linkPresetLocation;
@ -172,21 +129,22 @@ public class GeonaDataViewMainPanel extends Composite {
private OpenLayerMap map;
private HandlerManager applicationBus;
private HashMap<String, List<CheckBox>> mapCollectionCheckBoxes;
private SearchFacilityUI currentSearchFacility;
private HashMap<String, ItemFieldsResponse> mapItemFieldsForUCD = new HashMap<String, ItemFieldsResponse>();
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight,
List<ItemFieldsResponse> itemFieldsReponse) {
private SearchFacilityUI searchFacility;
/**
* Instantiates a new geona data view main panel.
*
* @param applicationBus the application bus
* @param mapHeight the map height
*/
public GeonaDataViewMainPanel(HandlerManager applicationBus, int mapHeight) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
mapPanel = new MapPanel(mapHeight + "px");
detailsPanel.setHeight(mapHeight + "px");
detailsPanel.setApplicationBus(applicationBus);
overlayLayersPanel.setVisible(false);
mainContainerPanel.add(mapPanel);
bindHandlers();
dataPointSelection.setIcon(IconType.SCREENSHOT);
@ -202,109 +160,40 @@ public class GeonaDataViewMainPanel extends Composite {
worldImg.getElement().getStyle().setPaddingLeft(20, Unit.PX);
extentToEarth.getElement().appendChild(worldImg.getElement());
extentToEarth.setWidth("140px");
// linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
linkMap.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
linkPresetLocation.setCustomIconStyle(GNAIcons.CustomIconType.PRESET_LOCATION.get());
linkLayers.setCustomIconStyle(GNAIcons.CustomIconType.LAYERS.get());
openCollectionDropDown.setIcon(IconType.COMPASS);
mapItemFieldsForUCD.clear();
SearchingFilter initialSortFilter = new SearchingFilter();
initialSortFilter.setOrder(ORDER.ASC);
navListSearch.addItem(PLACEHOLDER_SELECT_SEARCH_IN, PLACEHOLDER_SELECT_SEARCH_IN);
navListSearch.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
for (final ItemFieldsResponse itemFieldResp : itemFieldsReponse) {
UseCaseDescriptorDV ucd = itemFieldResp.getUseCaseDescriptorDV();
mapItemFieldsForUCD.put(ucd.getId(), itemFieldResp);
GWT.log("Added navLink for: " + ucd.getName());
navListSearch.addItem(ucd.getName(), ucd.getProfileID());
}
navListSearch.addChangeHandler(new ChangeHandler() {
private SearchFacilityUI currentSearchFacility;
@Override
public void onChange(ChangeEvent event) {
if (this.currentSearchFacility != null)
this.currentSearchFacility.resetCurrentSearch();
String ucdProfileID = navListSearch.getValue(navListSearch.getSelectedIndex());
GWT.log("UCD ProfileID selected: " + ucdProfileID);
if (ucdProfileID.compareTo(PLACEHOLDER_SELECT_SEARCH_IN) != 0) {
searchFacilityPanel.clear();
ItemFieldsResponse itemFieldResp = mapItemFieldsForUCD.get(ucdProfileID);
List<ItemFieldDV> result = itemFieldResp.getListItemFields();
List<ItemFieldDV> displayFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> searchByFields = new ArrayList<ItemFieldDV>();
List<ItemFieldDV> sortByFields = new ArrayList<ItemFieldDV>();
for (ItemFieldDV itemField : result) {
if (itemField.isDisplayAsResult()) {
displayFields.add(itemField);
}
if (itemField.isSearchable()) {
searchByFields.add(itemField);
}
if (itemField.isSortable()) {
sortByFields.add(itemField);
}
}
this.currentSearchFacility = new SearchFacilityUI(ucdProfileID, applicationBus, displayFields,
sortByFields, searchByFields, initialSortFilter);
searchFacilityPanel.add(currentSearchFacility);
currentSearchFacility.setSearchButton(searchFacilityButton);
}
}
});
searchFacilityButton.setIcon(IconType.SEARCH);
if (itemFieldsReponse.size() == 0) {
searchFacilityPanel.setVisible(false);
searchFacilityButton.setVisible(false);
}
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
searchFacilityPanel.getElement().getParentElement().addClassName("opacity-09");
panelCustomOverlayLayers.getElement().getParentElement().addClassName("opacity-09");
panelCrossFilteringLayers.getElement().getParentElement().addClassName("opacity-09");
}
});
openCollectionDropDown.setTitle(GisToolbarFacilities.COLLECTION.getTooltip());
linkCustomOverlayLayers.setTitle(GisToolbarFacilities.OVERLAY.getTooltip());
linkCrossFilteringLayers.setTitle(GisToolbarFacilities.FILTER.getTooltip());
searchFacilityButton.setTitle(GisToolbarFacilities.SEARCH.getTooltip());
linkLayers.setTitle(GisToolbarFacilities.LAYERS.getTooltip());
linkMap.setTitle(GisToolbarFacilities.MAP.getTooltip());
linkPresetLocation.setTitle(GisToolbarFacilities.PRESET_LOCATION.getTooltip());
openCollectionDropDown.setCustomIconStyle(GNAIcons.CustomIconType.MAP.get());
// TODO
GWT.log("!!! NB TODO : Search facility is skipped ");
// 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();
GWT.log("Main Panel Created");
}
/**
* Bind events.
*/
private void bindEvents() {
linkLayers.addClickHandler(new ClickHandler() {
@ -321,46 +210,19 @@ public class GeonaDataViewMainPanel extends Composite {
}
}
});
searchFacilityButton.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
openCollectionDropDown.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
linkCustomOverlayLayers.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
linkCrossFilteringLayers.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// event.preventDefault();
event.stopPropagation();
}
}, ClickEvent.getType());
// TODO Search
// searchFacilityButton.addDomHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// //event.preventDefault();
// event.stopPropagation();
//
// }
// }, ClickEvent.getType());
}
/**
@ -376,31 +238,7 @@ public class GeonaDataViewMainPanel extends Composite {
setOverlayPanelMaxHeight();
}
public void setPanelsWidth(int clientWidth) {
if(clientWidth<GeoportalDataViewerConstants.TABLET_WIDTH) {
openCollectionDropDown.setText("");
linkCustomOverlayLayers.setText("");
linkCrossFilteringLayers.setText("");
searchFacilityButton.setText("");
linkLayers.setText("");
linkPresetLocation.setText("");
linkMap.setText("");
}else {
openCollectionDropDown.setText(GisToolbarFacilities.COLLECTION.getName());
linkCustomOverlayLayers.setText(GisToolbarFacilities.OVERLAY.getName());
linkCrossFilteringLayers.setText(GisToolbarFacilities.FILTER.getName());
searchFacilityButton.setText(GisToolbarFacilities.SEARCH.getName());
linkLayers.setText(GisToolbarFacilities.LAYERS.getName());
linkMap.setText(GisToolbarFacilities.MAP.getName());
linkPresetLocation.setText(GisToolbarFacilities.PRESET_LOCATION.getName());
}
}
/**
* Sets the overlay panel max height.
*/
private void setOverlayPanelMaxHeight() {
String overlMH = mapPanel.getOffsetHeight() - 130 + "px";
@ -492,16 +330,19 @@ public class GeonaDataViewMainPanel extends Composite {
}
/**
* Show as details.
*
* @param result the result
* @param geonaItemRef the geona item ref
*/
public void showAsDetails(ProjectView result, GeoportalItemReferences geonaItemRef) {
detailsPanel.showDetailsFor(result, geonaItemRef);
}
// TODO Generic Open Details
// /**
// * Show as details.
// *
// * @param concessioneDV the concessione DV
// * @param geonaItemRef the geona item ref
// */
// public void showAsDetails(ConcessioneDV concessioneDV, GeoNaItemRef geonaItemRef) {
// detailsPanel.showDetailsFor(concessioneDV, geonaItemRef);
//
// }
/**
* Hide panel details.
@ -511,13 +352,16 @@ public class GeonaDataViewMainPanel extends Composite {
}
// TODO Check method
/**
* Gets the displayed record.
* Gets the displyed record.
*
* @return the displayed record
* @return the displyed record
*/
public ProjectView getDisplayedProject() {
return detailsPanel.getDisplayedProject();
public RecordDV getDisplayedRecord() {
return detailsPanel.getDisplayedRecord();
}
/**
@ -545,9 +389,6 @@ public class GeonaDataViewMainPanel extends Composite {
// layersDDBClickEvent();
}
/**
* Layers DDB click event.
*/
private void layersDDBClickEvent() {
linkLayers.fireEvent(new GwtEvent<ClickHandler>() {
@Override
@ -573,11 +414,6 @@ public class GeonaDataViewMainPanel extends Composite {
// layersDDBClickEvent();
}
/**
* Sets the map attribution.
*
* @param attribution the new map attribution
*/
public void setMapAttribution(String attribution) {
panelAttribution.clear();
Label label = new Label("Base Map Credits");
@ -585,202 +421,81 @@ public class GeonaDataViewMainPanel extends Composite {
panelAttribution.add(label);
panelAttribution.add(p);
}
/**
* Sets the base layers.
*
* @param listBaseLayers the new base layers
*/
public void setAvailableCollections(Collection<GCubeCollection> collection, String openCollectionID) {
public void setAvailableCollections(Collection<GCubeCollection> collection) {
GWT.log("Init Available collections menu");
if (collection == null || collection.isEmpty())
if(collection == null || collection.isEmpty())
GWT.log("!!! No Available collections");
mapCollectionCheckBoxes = new HashMap<String, List<CheckBox>>();
for (GCubeCollection coll : collection) {
GWT.log("Found available collection " + coll);
final String collectionID = coll.getUcd().getId(); // collectionID == UCD_Id
LayerCollectionPanel lcp = new LayerCollectionPanel(coll, applicationBus);
openCollectionPanel.add(lcp);
List<CheckBox> listCollections = mapCollectionCheckBoxes.get(collectionID);
if (listCollections == null)
listCollections = new ArrayList<CheckBox>();
listCollections.add(lcp.getCheckbox());
mapCollectionCheckBoxes.put(collectionID, listCollections);
// Opening All Collections if openCollectionID is null
if (openCollectionID == null) {
lcp.getCheckbox().setValue(true, true);
// String collectionID = checkbox.getId().replace("gcubeCollectionSelector_",
// "");
GWT.log("Opening the collection: " + collectionID);
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}
}
// Opening All Collections if openCollectionID is null
if (openCollectionID != null) {
List<CheckBox> listCheckBoxes = mapCollectionCheckBoxes.get(openCollectionID);
if (listCheckBoxes != null) {
for (CheckBox checkBox : listCheckBoxes) {
checkBox.setValue(true, true);
String collectionID = checkBox.getId().replace("gcubeCollectionSelector_", "");
GWT.log("Opening the input collection: " + collectionID);
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
for(GCubeCollection coll : collection) {
GWT.log("Found available collection "+coll);
String label = coll.getUcd().getName();
String id=coll.getUcd().getId();
CheckBox checkbox = new CheckBox(label);
checkbox.setId("gcubeCollectionSelector_"+id);
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
GWT.log("Collection selector flag changed to value : "+event.toDebugString());
String collectionID = ((CheckBox)event.getSource()).getId().replace("gcubeCollectionSelector_", "");
GWT.log("Collection ID is : "+collectionID);
if(event.getValue()) {
// OPEN COLLECTION
applicationBus.fireEvent(new OpenCollectionEvent(collectionID));
}else {
// CLOSE COLLECTION
applicationBus.fireEvent(new CloseCollectionEvent(collectionID));
}
}
}
});
openCollectionPanel.add(checkbox);
}
}
public void openCollectionMenu() {
GWT.log("openCollectionMenu");
GeoportalDataViewerConstants.clickElement(openCollectionDropDown.getElement().getFirstChildElement());
}
public void setBaseLayers(List<BaseMapLayer> listBaseLayers) {
if (listBaseLayers == null)
if(listBaseLayers==null)
return;
int i = 0;
for (BaseMapLayer baseMapLayer : listBaseLayers) {
RadioButton radio = new RadioButton("base-layer");
radio.setText(baseMapLayer.getName());
if (i == 0) {
if(i==0) {
radio.setValue(true, false);
}
radio.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
applicationBus.fireEvent(new ChangeMapLayerEvent(baseMapLayer));
applicationBus.fireEvent(new ChangeBaseMapLayerEvent(baseMapLayer));
}
});
SimplePanel sp = new SimplePanel(radio);
sp.getElement().addClassName("form-inline");
sp.getElement().addClassName("map-layers-radio");
panelBaseLayers.add(sp);
i++;
}
}
public void addOverlayLayers(GCubeCollection collection,
List<GroupedLayersDV<? extends LayerIDV>> listGroupedLayers) {
if (listGroupedLayers == null)
return;
com.github.gwtbootstrap.client.ui.Label collectionGroup = new com.github.gwtbootstrap.client.ui.Label(
collection.getUcd().getName());
collectionGroup.setType(LabelType.WARNING);
LayoutPanel lc = new LayoutPanel();
lc.add(collectionGroup);
panelCustomOverlayLayers.add(lc);
for (GroupedLayersDV gCustomLayerDV : listGroupedLayers) {
if (gCustomLayerDV.getListCustomLayers() != null) {
FlowPanel lcInner = new FlowPanel();
lcInner.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
com.github.gwtbootstrap.client.ui.Label labelGroup = new com.github.gwtbootstrap.client.ui.Label(
gCustomLayerDV.getName());
labelGroup.setType(LabelType.INFO);
String descr = gCustomLayerDV.getDescription() != null && !gCustomLayerDV.getDescription().isEmpty()
? gCustomLayerDV.getDescription()
: gCustomLayerDV.getName();
labelGroup.setTitle(descr);
lcInner.add(labelGroup);
if (descr.compareTo(gCustomLayerDV.getName()) != 0) {
HTML overlayGroupDescr = new HTML();
overlayGroupDescr.getElement().setClassName("overlay-panel-style-description");
overlayGroupDescr.setHTML(descr);
lcInner.add(overlayGroupDescr);
}
List<ConfiguredLayerDV> list = gCustomLayerDV.getListCustomLayers();
for (ConfiguredLayerDV customLayer : list) {
if (customLayer.isDisplay()) {
LayerItem layerItem = new LayerItem();
if (customLayer.getWMS_URL() != null) {
final String mapServerHost = URLUtil.getPathURL(customLayer.getWMS_URL());
GWT.log("mapServerHost: " + mapServerHost);
layerItem.setMapServerHost(mapServerHost);
layerItem.setBaseLayer(false);
layerItem.setName(customLayer.getName());
layerItem.setTitle(customLayer.getTitle());
layerItem.setWmsLink(customLayer.getWMS_URL());
// panelCustomOverlayLayers.add(new CrossFilteringLayerPanel(layerItem,
// applicationBus));
lcInner.add(new OverlayCustomLayerPanel(layerItem, applicationBus));
map.addGroupedCustomWMSLayer(layerItem);
}
}
}
panelCustomOverlayLayers.add(lcInner);
}
}
linkCustomOverlayLayers.setVisible(listGroupedLayers.size() > 0);
}
public void addCrossFilteringLayers(GCubeCollection collection,
List<GroupedLayersDV<? extends LayerIDV>> listGroupedLayers) {
if (listGroupedLayers == null)
return;
com.github.gwtbootstrap.client.ui.Label collectionGroup = new com.github.gwtbootstrap.client.ui.Label(
collection.getUcd().getName());
collectionGroup.setType(LabelType.WARNING);
LayoutPanel lc = new LayoutPanel();
lc.add(collectionGroup);
panelCrossFilteringLayers.add(lc);
for (GroupedLayersDV<? extends LayerIDV> groupedLayerDV : listGroupedLayers) {
FlowPanel lcInner = new FlowPanel();
lcInner.getElement().getStyle().setMarginLeft(5.0, Unit.PX);
com.github.gwtbootstrap.client.ui.Label labelGroup = new com.github.gwtbootstrap.client.ui.Label(
groupedLayerDV.getName());
labelGroup.setType(LabelType.INFO);
String descr = groupedLayerDV.getDescription() != null && !groupedLayerDV.getDescription().isEmpty()
? groupedLayerDV.getDescription()
: groupedLayerDV.getName();
labelGroup.setTitle(descr);
lcInner.add(labelGroup);
// panelCustomOverlayLayers.add(labelGroup);
if (descr.compareTo(groupedLayerDV.getName()) != 0) {
HTML overlayGroupDescr = new HTML();
overlayGroupDescr.getElement().setClassName("filter-panel-style-description");
overlayGroupDescr.setHTML(descr);
lcInner.add(overlayGroupDescr);
// panelCustomOverlayLayers.add(overlayGroupDescr);
}
CrossFilteringLayerPanel cfp = new CrossFilteringLayerPanel(collection, groupedLayerDV, applicationBus);
cfp.setFilterButton(linkCrossFilteringLayers);
lcInner.add(cfp);
panelCrossFilteringLayers.add(lcInner);
}
linkCrossFilteringLayers.setVisible(listGroupedLayers.size() > 0);
}
}

View File

@ -11,20 +11,6 @@
.font-weight-bold {
font-weight: bold;
}
.open-collection-style {
padding-left: 15px;
padding-right: 15px;
}
.margin-left-top-5 {
margin-left: 5px;
margin-top: 5px;
}
.margin-left-5 {
margin-left: 5px;
}
</ui:style>
<g:HTMLPanel ui:field="mainHTMLPanel">
<g:HTMLPanel ui:field="mainContainerPanel">
@ -49,39 +35,32 @@
</g:HTMLPanel>
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Collection"
<!-- <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="Open Collection"
ui:field="openCollectionDropDown">
<g:HTMLPanel ui:field="openCollectionPanel"
addStyleNames="open-collection-style">
<g:HTMLPanel ui:field="openCollectionPanel">
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Map" ui:field="linkMap" icon="GLOBE">
</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" visible="false" text="Overlay" ui:field="linkCustomOverlayLayers" icon="REORDER">
<g:HTMLPanel ui:field="panelCustomOverlayLayers" addStyleNames="overlay-panel-style">
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" visible="false" text="Filter" ui:field="linkCrossFilteringLayers" icon="FILTER">
<g:HTMLPanel ui:field="panelCrossFilteringLayers" addStyleNames="filter-panel-style">
</g:HTMLPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Search"
ui:field="searchFacilityButton">
<g:FlowPanel addStyleNames="search-field">
<g:HorizontalPanel>
<b:Label type="INFO">Search in </b:Label>
<b:ListBox title="Search in the Collection..."
ui:field="navListSearch">
</b:ListBox>
</g:HorizontalPanel>
</g:FlowPanel>
<g:ScrollPanel ui:field="searchFacilityPanel"
addStyleNames="search-facility"></g:ScrollPanel>
</b:DropdownButton>
<b:DropdownButton type="LINK" text="Preset Location"
ui:field="linkPresetLocation" addStyleNames="preset-location">
<b:DropdownButton type="LINK"
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>
@ -105,8 +84,8 @@
text="Remove Query" visible="false"></b:Button>
<b:Button type="LINK" text="Layers" ui:field="linkLayers">
</b:Button>
<!-- <g:ScrollPanel ui:field="overlayLayersPanel"
addStyleNames="layers-panel" visible="false"></g:ScrollPanel> -->
<g:ScrollPanel ui:field="overlayLayersPanel"
addStyleNames="layers-panel" visible="false"></g:ScrollPanel>
</g:HTMLPanel>
</g:HTMLPanel>
<c:DetailsPanel ui:field="detailsPanel"

View File

@ -0,0 +1,476 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.ResultSetPaginatedData;
import org.gcube.application.geoportalcommon.shared.SearchingFilter;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
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.google.gwt.core.client.GWT;
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.ui.Composite;
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("TODO..."));
//TODO
// 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
*/
//TODO
// 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() {
//TODO
//currentSortFilter = builtSearchingFilter();
GWT.log("currentSortFilter: " + currentSortFilter);
return currentSortFilter;
}
public void setSearchButton(DropdownButton searchFacilityButton) {
this.searchFacilityButton = searchFacilityButton;
}
}

View File

@ -20,10 +20,6 @@
margin-right: 23px;
}
.listBoxSearchForStyle {
margin-right: 5px;
}
.margin-top-5 {
margin-top: 5px;
}
@ -39,7 +35,7 @@
<g:Label addStyleNames="{style.add-margin-right}">Search for: </g:Label>
<b:ListBox title="Search for"
ui:field="listBoxSearchFor"
addStyleNames="{style.listBoxSearchForStyle}">
addStyleNames="{style.add-margin-right}">
</b:ListBox>
<b:TextBox ui:field="searchField"
addStyleNames="search-textbox" placeholder="type a text..."></b:TextBox>

View File

@ -1,227 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.layers;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import org.gcube.application.geoportalcommon.shared.gis.BoundsMap;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.DropdownButton;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style;
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.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import ol.Coordinate;
public class LayersSectionViewer extends Composite {
private static LayersSectionViewerUiBinder uiBinder = GWT.create(LayersSectionViewerUiBinder.class);
interface LayersSectionViewerUiBinder extends UiBinder<Widget, LayersSectionViewer> {
}
@UiField
HTMLPanel layerPanel;
@UiField
HTMLPanel mapViewPanel;
private static enum IMAGE_EXPORT_AS {
PNG, JPEG
};
int downloadAttempt = 0;
private GCubeSDIViewerLayerDV layer;
private SubDocumentView subDocumentView;
public LayersSectionViewer(GCubeSDIViewerLayerDV layer, SubDocumentView subDocumentView) {
initWidget(uiBinder.createAndBindUi(this));
GWT.log("Showing: " + layer);
this.layer = layer;
this.subDocumentView = subDocumentView;
String wmsLink = null;
try {
wmsLink = layer.getWMSLink();
} catch (Exception e) {
return;
}
if (wmsLink == null) {
GeoportalDataViewerConstants.printJs("Wms link is null");
return;
}
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
GWT.log("WMS LINK: " + wmsLink);
GWT.log("layerName: " + layerName);
DropdownButton exportMapButton = new DropdownButton("Export Map as...");
exportMapButton.setType(ButtonType.LINK);
exportMapButton.setIcon(IconType.DOWNLOAD_ALT);
exportMapButton.setTitle("Export the map view (OSM + layer) as an image...");
Style exportStyle = exportMapButton.getElement().getStyle();
// exportStyle.setWidth(100, Unit.PCT);
exportStyle.setMarginLeft(70, Unit.PCT);
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
mapViewPanel.add(mapView);
mapViewPanel.add(exportMapButton);
String mapServerHost = wmsLink.contains("?") ? wmsLink.substring(0, wmsLink.indexOf("?")) : wmsLink;
GWT.log("mapServerHost: " + mapServerHost);
BBOXDV bbox = layer.getBbox();
try {
if (bbox != null) {
if (!GWT.isProdMode()) {
GWT.log("bbox: " + bbox);
// GWT.log("bbox keys: " + bbox.keySet());
// GWT.log("bbox values: " + bbox.values());
GWT.log("minX: " + bbox.getMinX());
GWT.log("minY: " + bbox.getMinY());
GWT.log("maxX: " + bbox.getMaxX());
GWT.log("maxY: " + bbox.getMaxY());
}
BoundsMap bounds = new BoundsMap(bbox.getMinX(), bbox.getMinY(), bbox.getMaxX(), bbox.getMaxY(), "");
GWT.log("bounds: " + bounds);
mapView.addWMSLayer(mapServerHost, layerName, bounds);
} else {
Alert alert = new Alert();
alert.setType(AlertType.ERROR);
alert.setText("No BBOX found for this layer");
alert.setClose(false);
layerPanel.add(alert);
}
} catch (Exception e) {
Alert alert = new Alert();
alert.setType(AlertType.ERROR);
alert.setHTML("Error on adding the layer to Map. Please check its WMS link: <br/>"+layer.getWMSLink());
alert.getElement().getStyle().setProperty("wordBreak", "break-all");
alert.setClose(false);
layerPanel.add(alert);
}
String htmlLinkId = mapView.getPanelMapElementId() + "-image-download";
for (IMAGE_EXPORT_AS exportType : IMAGE_EXPORT_AS.values()) {
NavLink navLink = new NavLink(exportType.name());
String exportExt = exportType.name().toLowerCase();
String filename = layerName + "." + exportExt;
String mimeType = "image/" + exportExt;
final HTML htmlLink = new HTML("<a id=\"" + htmlLinkId + "\" download=\"" + filename + "\"></a>");
navLink.getElement().appendChild(htmlLink.getElement());
navLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
downloadAttempt++;
if (downloadAttempt > 3) {
Window.alert("LOOP");
return;
}
// DOWNLOAD the OSM + layer by canvas
downloadMap(mapView.getLightOLM().getMap(), mapView.getPanelMapElementId(), htmlLinkId, filename,
mimeType);
}
});
exportMapButton.add(navLink);
}
if (subDocumentView.getMetadataAsJSON() != null) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
layerPanel.add(new HTML(table));
}
}
public static native void exportPDF(String layerURL) /*-{
var image = new Image(layerURL);
var doc = new $wnd.jspdf.jsPDF();
doc.addImage(layerURL, 'PNG', 0, 0, image.width, image.height);
doc.save("map.pdf")
}-*/;
/**
* Prints the.
*
* @param msg the msg
*/
public static native void downloadMap(ol.Map map, String mapPanelId, String linkId, String filename,
String mimeType)/*-{
//console.log("map: " + map);
map.once('rendercomplete', function() {
var mapCanvas = $doc.createElement('canvas');
var size = map.getSize();
mapCanvas.width = size[0];
mapCanvas.height = size[1];
var mapContext = mapCanvas.getContext('2d');
var mapContainer = $doc.querySelector('#' + mapPanelId);
//console.log("mapContainer:" +JSON.stringify(mapContainer, null, 4));
Array.prototype.forEach.call(mapContainer
.querySelectorAll('.ol-layer canvas'), function(canvas) {
if (canvas.width > 0) {
var opacity = canvas.parentNode.style.opacity;
mapContext.globalAlpha = opacity === '' ? 1
: Number(opacity);
var transform = canvas.style.transform;
// Get the transform parameters from the style's transform matrix
var matrix = transform.match(/^matrix\(([^\(]*)\)$/)[1]
.split(',').map(Number);
// Apply the transform to the export map context
CanvasRenderingContext2D.prototype.setTransform.apply(
mapContext, matrix);
mapContext.drawImage(canvas, 0, 0);
}
});
if (navigator.msSaveBlob) {
// link download attribute does not work on MS browsers
navigator.msSaveBlob(mapCanvas.msToBlob(), filename);
} else {
var link = $doc.getElementById(linkId);
link.href = mapCanvas.toDataURL(mimeType);
link.click();
}
});
map.renderSync();
}-*/;
}

View File

@ -1,85 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
public class ProjectUtil {
public static <T extends DocumentDV> String toHMLCode(T document, String projectID) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
if (projectID != null) {
htmlCode += " (id: " + projectID + ")";
}
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(boolean showkey, T document, String projectID) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += showkey ? firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>"
: firstEntrySet.getValue();
}
if (projectID != null) {
htmlCode += " (id: " + projectID + ")";
}
return htmlCode;
}
public static <T extends DocumentDV> String toHMLCode(T document) {
String htmlCode = "";
if (document == null)
return htmlCode;
Entry<String, Object> firstEntrySet = document.getFirstEntryOfMap();
if (firstEntrySet != null) {
htmlCode += firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b>";
}
return htmlCode;
}
public static String toHTMLCode(TemporalReferenceDV tempRef) {
String htmlCode = "<span class='display-date'>";
if (tempRef != null) {
String dateToString = "";
if (tempRef.getStart() != null) {
dateToString += GeoportalDataViewerConstants.DATE_TIME_FORMAT.format(tempRef.getStart());
}
dateToString += " / ";
if (tempRef.getStart() != null) {
dateToString += GeoportalDataViewerConstants.DATE_TIME_FORMAT.format(tempRef.getEnd());
}
htmlCode += dateToString;
}
htmlCode += "</span>";
return htmlCode;
}
}

View File

@ -1,359 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.ProjectView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.AddLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.TimelineProjectRelationsEvent.EVENT_TYPE;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.ModalWindow;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs.DialogShareableLink;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.Location;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.ExtentMapUtil.PLACE;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.map.MapView;
import com.github.gwtbootstrap.client.ui.Button;
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.dom.client.UListElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
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.Random;
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.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
import ol.Coordinate;
/**
* The Class ProjectViewer.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
public class ProjectViewer extends Composite {
private static ProjectViewerUiBinder uiBinder = GWT.create(ProjectViewerUiBinder.class);
/**
* The Interface ProjectViewerUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Nov 9, 2022
*/
interface ProjectViewerUiBinder extends UiBinder<Widget, ProjectViewer> {
}
@UiField
HTMLPanel headerPanel;
@UiField
HTMLPanel pageViewDetails;
@UiField
HTMLPanel projectViewerMainPanel;
@UiField
HTMLPanel centroidPanel;
@UiField
HTMLPanel tableOfContentPanel;
@UiField
Button shareButton;
@UiField
Button expandButton;
@UiField
Button relationshipsButton;
@UiField
Button addLayersToMap;
@UiField
HTMLPanel toc_container;
@UiField
HTMLPanel toc_list_container;
@UiField
Button reduceToc;
@UiField
UListElement toc_list_anchors;
private ProjectView theProjectView;
private GeoportalItemReferences geoportalItemReferences;
private String myLogin;
private HandlerManager applicationBus;
private String projectViewerMainPanelID;
/**
* Instantiates a new project viewer.
*/
private ProjectViewer() {
initWidget(uiBinder.createAndBindUi(this));
pageViewDetails.getElement().addClassName("page-view-details");
projectViewerMainPanelID = "projectViewer-" + Random.nextInt();
projectViewerMainPanel.getElement().setId(projectViewerMainPanelID);
}
/**
* Instantiates a new project viewer.
*
* @param applicationBus the application bus
* @param geoportalItemRefs the geoportal item refs
* @param projectView the project view
*/
public ProjectViewer(HandlerManager applicationBus, GeoportalItemReferences geoportalItemRefs,
final ProjectView projectView) {
this();
GWT.log("Rendering " + projectView.getTheProjectDV().getId());
this.theProjectView = projectView;
this.geoportalItemReferences = geoportalItemRefs;
this.applicationBus = applicationBus;
final String theTitle = projectView.getTheProjectDV().getProfileName() != null
? projectView.getTheProjectDV().getProfileName()
: "Project ID: " + projectView.getTheProjectDV().getId();
headerPanel.add(new HTML(theTitle));
shareButton.setType(ButtonType.LINK);
shareButton.setIcon(IconType.SHARE);
shareButton.setTitle("Get a link to share with...");
shareButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
DialogShareableLink dg = new DialogShareableLink(geoportalItemReferences, null);
}
});
expandButton.setType(ButtonType.LINK);
expandButton.setIcon(IconType.EXPAND);
expandButton.setTitle("Show this view in new Window");
expandButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ProjectViewer cv = new ProjectViewer(applicationBus, geoportalItemReferences, theProjectView);
cv.setExpandViewButtonVisible(false);
cv.setRelationshipsButtonVisible(false);
cv.setAddLayersToMapVisible(false);
cv.setTocContentVisible(true);
int width = Window.getClientWidth() * 75 / 100;
int height = Window.getClientHeight() * 70 / 100;
String modalTitle = ProjectUtil.toHMLCode(false, theProjectView.getTheProjectDV().getTheDocument(),
theProjectView.getTheProjectDV().getId());
ModalWindow mw = new ModalWindow(modalTitle, width, height);
mw.add(cv);
mw.setCaller(ProjectViewer.this);
// mw.setWidth(900);
mw.show();
}
});
relationshipsButton.setType(ButtonType.LINK);
relationshipsButton.setIcon(IconType.LINK);
relationshipsButton.setTitle("Show Relationships of this Project");
List<RelationshipDV> relationships = projectView.getTheProjectDV().getRelationships();
if (relationships != null && relationships.size() > 0) {
relationshipsButton.setVisible(true);
} else {
relationshipsButton.setVisible(false);
}
relationshipsButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(
new TimelineProjectRelationsEvent(theProjectView.getTheProjectDV(), EVENT_TYPE.SHOW));
}
});
addLayersToMap.setType(ButtonType.LINK);
addLayersToMap.setIcon(IconType.MAP_MARKER);
addLayersToMap.setTitle("Add the layer/s of the Project to principal Map");
addLayersToMap.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(new AddLayerToMapEvent(theProjectView.getTheProjectDV(), true));
}
});
setAddLayersToMapVisible(false);
GeoportalDataViewerServiceAsync.Util.getInstance().getMyLogin(new AsyncCallback<String>() {
@Override
public void onSuccess(String result) {
myLogin = result;
addCentroidMap();
}
@Override
public void onFailure(Throwable caught) {
}
});
reduceToc.setType(ButtonType.LINK);
reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
toc_list_container.setVisible(false);
reduceToc.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
boolean visible = toc_list_container.isVisible();
setTocContentVisible(!visible);
// if (visible) {
// toc_list_container.setVisible(false);
// reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
// } else {
// toc_list_container.setVisible(true);
// reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
// }
}
});
for (SectionView sectionView : projectView.getListSections()) {
if (!sectionView.isEmpty()) {
SectionViewer sectionViewer = new SectionViewer(sectionView, projectViewerMainPanelID);
String sectionId = sectionView.getSectionTitle().replaceAll("[^A-Za-z0-9]", "-") + "_"
+ Random.nextInt();
String divTarget = "<div class='anchor-target' id='" + sectionId + "'></div>";
sectionViewer.getElement().insertFirst(new HTML(divTarget).getElement());
addAnchorToSection(sectionId, sectionView.getSectionTitle());
pageViewDetails.add(sectionViewer);
}
if (sectionView.hasSpatialLayers()) {
setAddLayersToMapVisible(true);
}
}
if (toc_list_anchors.getChildCount() > 0) {
tableOfContentPanel.setVisible(true);
}
}
private void addAnchorToSection(String id, String text) {
String htmlAnchor = "<a href='#" + id + "'>" + text + "</a>";
toc_list_anchors.appendChild(new HTML("<li>" + htmlAnchor + "</li>").getElement());
}
protected void setTocContentVisible(boolean bool) {
toc_list_container.setVisible(bool);
if (bool) {
reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
} else {
reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
}
}
/**
* Adds the centroid map.
*/
private void addCentroidMap() {
Location italyLocation = ExtentMapUtil.getLocation(PLACE.ITALY);
Coordinate transformedCenterCoordinate = italyLocation.getCoordinate(MAP_PROJECTION.EPSG_3857);
MapView mapView = new MapView(transformedCenterCoordinate,
GeoportalDataViewerConstants.LIGHT_MAP_ITALY_FIT_ZOOM_ON, "70%", "300px");
if (theProjectView != null && theProjectView.getTheProjectDV() != null) {
GeoJSON spatialReference = theProjectView.getTheProjectDV().getSpatialReference();
Coordinate transfCoord = MapUtils.geoJSONToBBOXCenter(spatialReference, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
if (transfCoord != null) {
boolean authenticatedUser = myLogin != null ? true : false;
mapView.addMarker(transfCoord, authenticatedUser);
centroidPanel.add(mapView);
}
} else if (theProjectView != null) {
GeoportalDataViewerConstants
.printJs("I cannot add centroid as maker one or both coordinates are null. Lat: " + theProjectView
+ ", Long:" + theProjectView);
}
}
/**
* Gets the project view.
*
* @return the project view
*/
public ProjectView getProjectView() {
return theProjectView;
}
/**
* Sets the expand view button visible.
*
* @param bool the new expand view button visible
*/
protected void setExpandViewButtonVisible(boolean bool) {
expandButton.setVisible(bool);
}
/**
* Sets the adds the layers to map visible.
*
* @param bool the new adds the layers to map visible
*/
protected void setAddLayersToMapVisible(boolean bool) {
addLayersToMap.setVisible(bool);
}
/**
* Sets the relationships button visible.
*
* @param bool the new relationships button visible
*/
protected void setRelationshipsButtonVisible(boolean bool) {
relationshipsButton.setVisible(bool);
}
}

View File

@ -1,66 +0,0 @@
<!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">
<ui:style>
.margin-left-10 {
margin-left: 10px;
}
.font-size-h1-22 h1 {
font-size: 22px;
}
.align-to-right {
right: 20px;
position: absolute;
top: 20px !important;
}
.the-title {
background-color: rgba(0, 60, 136, .7);
color: white;
padding: 10px 10px;
font-size: 14px;
padding-left: 40px;
}
.width-100 {
width: 100%;
}
.display-item-list {
display: inline-table;
}
</ui:style>
<g:HTMLPanel ui:field="projectViewerMainPanel">
<!-- <g:HTMLPanel ui:field="sharePanel" -->
<!-- addStyleNames="{style.align-to-right}"> -->
<!-- </g:HTMLPanel> -->
<g:HTMLPanel ui:field="headerPanel"
addStyleNames="{style.the-title}"></g:HTMLPanel>
<g:HTMLPanel ui:field="pageViewDetails">
<g:HorizontalPanel
addStyleNames="functionalities-style">
<b:Button ui:field="shareButton">Share</b:Button>
<b:Button ui:field="expandButton">Expand</b:Button>
<b:Button ui:field="relationshipsButton">Relationships</b:Button>
<b:Button ui:field="addLayersToMap">Add Layers to Map</b:Button>
</g:HorizontalPanel>
<g:HTMLPanel ui:field="centroidPanel"></g:HTMLPanel>
<g:HTMLPanel ui:field="tableOfContentPanel"
visible="false" addStyleNames="{style.display-item-list}">
<g:HTMLPanel ui:field="toc_container"
addStyleNames="toc_container">
<b:Button ui:field="reduceToc"
addStyleNames="toc_container_reduce_button"></b:Button>
<div class="toc_title">Contents</div>
<g:HTMLPanel ui:field="toc_list_container" addStyleNames="toc_list_container">
<ul ui:field="toc_list_anchors"></ul>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,163 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDIViewerLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.FilesetDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.PayloadDV;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SectionView;
import org.gcube.application.geoportalcommon.shared.geoportal.view.SubDocumentView;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.gallery.ImagesSectionGallery;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.layers.LayersSectionViewer;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.CustomFlexTable;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.PageHeader;
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.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class SectionViewer extends Composite {
private static SectionViewerUiBinder uiBinder = GWT.create(SectionViewerUiBinder.class);
interface SectionViewerUiBinder extends UiBinder<Widget, SectionViewer> {
}
private SectionView sectionView;
@UiField
HTMLPanel sectionPanelContainer;
@UiField
PageHeader sectionTitle;
public SectionViewer(SectionView sectionView, String topTargetId) {
initWidget(uiBinder.createAndBindUi(this));
this.sectionView = sectionView;
List<SubDocumentView> subDocuments = sectionView.getListSubDocuments();
sectionTitle.setTitle(sectionView.getSectionTitle());
sectionTitle.setText(sectionView.getSectionTitle());
if (subDocuments == null)
return;
Button goToTop = new Button("");
goToTop.setType(ButtonType.LINK);
goToTop.setIcon(IconType.DOUBLE_ANGLE_UP);
goToTop.setHref("#" + topTargetId);
goToTop.setTitle("Go to top");
goToTop.getElement().setClassName("go-top-right");
sectionTitle.add(goToTop);
boolean displayAsGallery = false;
try {
for (SubDocumentView subDocumentView : subDocuments) {
if (subDocumentView.getListImages() != null && subDocumentView.getListImages().size() > 0) {
GWT.log("Section with images: " + subDocumentView.getListImages());
displayAsGallery = true;
break;
}
}
boolean displayAsMapOfLayers = false;
for (SubDocumentView subDocumentView : subDocuments) {
if (subDocumentView.getListLayers() != null && subDocumentView.getListLayers().size() > 0) {
GWT.log("Section with layers: " + subDocumentView.getListImages());
displayAsMapOfLayers = true;
break;
}
}
// Displaying the whole section as a Gallery
if (displayAsGallery) {
GWT.log("displayAsGallery the: " + sectionView);
ImagesSectionGallery sectionGallery = new ImagesSectionGallery(sectionView);
sectionPanelContainer.add(sectionGallery.getGalleryPanel());
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
sectionGallery.fillGallery();
}
});
// Displaying the whole section as a Map of Layers
} else if (displayAsMapOfLayers) {
GWT.log("displayAsMapOfLayers the: " + sectionView);
for (SubDocumentView subDocumentView : subDocuments) {
// String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
// sectionPanelContainer.add(new HTML(table));
List<GCubeSDIViewerLayerDV> layers = subDocumentView.getListLayers();
if (layers != null) {
for (GCubeSDIViewerLayerDV gCubeLayer : layers) {
LayersSectionViewer layerSectionViewer = new LayersSectionViewer(gCubeLayer,
subDocumentView);
sectionPanelContainer.add(layerSectionViewer);
// showLinkToDownloadWsContent(fileset.getName(), fileset.getListPayload());
}
}
}
} else {
GWT.log("displaying default the: " + sectionView);
for (SubDocumentView subDocumentView : subDocuments) {
String table = GeoportalDataViewerConstants.jsonToTableHTML(subDocumentView.getMetadataAsJSON());
sectionPanelContainer.add(new HTML(table));
List<FilesetDV> files = subDocumentView.getListFiles();
if (files != null) {
for (FilesetDV fileset : files) {
showLinkToDownloadWsContent(fileset.getGcubeProfileFieldName(), fileset.getListPayload());
}
}
}
}
} catch (Exception e) {
GWT.log("Error on rendering the section: "+e.getMessage());
}
}
private void showLinkToDownloadWsContent(String title, List<PayloadDV> listPayloads) {
if (listPayloads != null) {
CustomFlexTable customTable = new CustomFlexTable();
int i = 0;
String fieldLabel = title;
for (PayloadDV payload : listPayloads) {
if (i > 0) {
fieldLabel = "";
}
String downloadLabel = "download";
if (payload.getName() != null) {
downloadLabel = payload.getName();
}
customTable.addNextKeyWidget(fieldLabel,
new HTML("<a href=\"" + payload.getLink() + "\">" + downloadLabel + "</a>"));
}
sectionPanelContainer.add(customTable);
}
}
}

View File

@ -1,39 +0,0 @@
<!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">
<ui:style>
.margin-left-10 {
margin-left: 10px;
}
.font-size-h1-22 h1 {
font-size: 22px;
margin-top: 5px;
}
.align-to-right {
right: 20px;
position: absolute;
}
.the-title h1 {
font-size: 28px;
}
.margin-bottom-10 {
margin-bottom: 10px;
}
.width-100 {
width: 100%;
}
</ui:style>
<g:HTMLPanel ui:field="sectionPanelContainer">
<g:HTMLPanel
addStyleNames="{style.margin-left-10}">
<b:PageHeader addStyleNames="{style.font-size-h1-22}" ui:field="sectionTitle"></b:PageHeader>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,50 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import com.github.gwtbootstrap.client.ui.Column;
import com.google.gwt.core.client.GWT;
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.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class RelationshipPanel extends Composite {
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, RelationshipPanel> {
}
@UiField
HTMLPanel rootRow;
@UiField
Column leftChildColumn;
@UiField
Column rightChildColumn;
private HandlerManager appManagerBus;
public RelationshipPanel(HandlerManager appManagerBus, ProjectDV fromProject, List<ProjectDV> relationships) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
String html = ProjectUtil.toHMLCode(false, fromProject.getTheDocument(), fromProject.getId());
rootRow.add(new HTML(html));
showRelationsOf(fromProject);
}
public void showRelationsOf(ProjectDV project) {
}
}

View File

@ -1,23 +0,0 @@
<!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">
<ui:style>
</ui:style>
<g:HTMLPanel>
<b:Row ui:field="rootRow">
<b:FlowPanel ui:field="rootPanel"></b:FlowPanel>
</b:Row>
<b:Row>
<b:Column size="4">
<b:FlowPanel ui:field="leftChildPanel"></b:FlowPanel>
</b:Column>
<b:Column size="4">
<b:FlowPanel ui:field="rightChildPanel"></b:FlowPanel>
</b:Column>
</b:Row>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,100 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewer;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.ui.RootPanel;
public class TimelineManagerStatus {
private HandlerManager applicationBus;
private TimelineStatus status;
public TimelineManagerStatus(HandlerManager applicationBus) {
this.applicationBus = applicationBus;
}
protected TimelineStatus getTimelineOf(ProjectDV theProject) {
if (status == null) {
status = new TimelineStatus(true, new TimelineRelationPanel(applicationBus, theProject), theProject);
GWT.log("Displaying new Timeline of " + status);
return status;
} else {
boolean c1 = status.getTheProjectDV().getId().compareTo(theProject.getId()) == 0;
boolean c2 = status.getTheProjectDV().getProfileID().compareTo(theProject.getProfileID()) == 0;
if (!c1 || !c2) {
GWT.log("Displaying Timeline of " + status);
status = new TimelineStatus(true, new TimelineRelationPanel(applicationBus, theProject), theProject);
return status;
}
status.statusChanged(false);
GWT.log("Skipping already displayed Timeline of " + status);
return status;
}
}
public void showTimelineProjectRelations(ProjectDV theProject, boolean showNotify) {
GWT.log("Showing project relations for: " + theProject);
TimelineStatus timelineStatus = getTimelineOf(theProject);
if (timelineStatus.isStatusChanged()) {
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).add(timelineStatus.getTimelineRP());
} else if (showNotify) {
GeoportalDataViewer.showPopover(RootPanel.get(GeoportalDataViewer.APP_NOTIFIER),
"Timeline from the selected project is already displayed", "Timeline displayed");
}
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(true);
timelineStatus.getTimelineRP().setTimelineContainerVisible(true);
}
public void hideTimelineProjectRelations() {
GWT.log("hideTimelineProjectRelations");
RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).setVisible(false);
// RootPanel.get(GeoportalDataViewer.DIV_TIMELINE_DATA).clear();
}
public class TimelineStatus {
public boolean statusChanged = false;
private TimelineRelationPanel timelineRP;
private ProjectDV theProjectDV;
public TimelineStatus(boolean statusChanged, TimelineRelationPanel timelineRP, ProjectDV theProjectDV) {
this.statusChanged = statusChanged;
this.timelineRP = timelineRP;
this.theProjectDV = theProjectDV;
}
public void statusChanged(boolean bool) {
this.statusChanged = bool;
}
public boolean isStatusChanged() {
return statusChanged;
}
public TimelineRelationPanel getTimelineRP() {
return timelineRP;
}
public ProjectDV getTheProjectDV() {
return theProjectDV;
}
}
}

View File

@ -1,196 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ShowDetailsEvent.EVENT_SOURCE;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
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.TextAlign;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
public class TimelineRelationPanel extends Composite {
@UiField
ScrollPanel timelineContainer;
@UiField
HTMLPanel timelineHeader;
@UiField
Anchor timelinePopupCloser;
private LoaderIcon loaderData = new LoaderIcon("Loading data... please wait",
new Image(GNAImages.ICONS.spinnerClock()));
private TimelineRelationPanel instance = this;
private String selectedTimelineProjectID;
private ProjectDV theProjectDV;
private HandlerManager applicationBus;
private static TimelineRelationPanelUiBinder uiBinder = GWT.create(TimelineRelationPanelUiBinder.class);
interface TimelineRelationPanelUiBinder extends UiBinder<Widget, TimelineRelationPanel> {
}
public TimelineRelationPanel(HandlerManager applicationBus, ProjectDV theProjectDV) {
initWidget(uiBinder.createAndBindUi(this));
this.theProjectDV = theProjectDV;
this.applicationBus = applicationBus;
String html = ProjectUtil.toHMLCode(theProjectDV.getTheDocument());
HTML title = new HTML("Relationships of the Project" + " <br>" + html);
timelineHeader.add(title);
timelineContainer.getElement().setId("timeline-content");
timelineHeader.getElement().setId("timeline-header");
loaderData.getElement().getStyle().setTextAlign(TextAlign.CENTER);
timelineContainer.getElement().setId("visualization");
timelineContainer.add(loaderData);
timelinePopupCloser.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if (timelineContainer.isVisible())
setTimelineContainerVisible(false);
else
setTimelineContainerVisible(true);
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
GeoportalDataViewerServiceAsync.Util.getInstance().getRelationshipsForTimeline(
theProjectDV.getProfileID(), theProjectDV.getId(), new AsyncCallback<List<String>>() {
@Override
public void onSuccess(List<String> result) {
timelineContainer.remove(loaderData);
JSONArray toJsonArr = new JSONArray();
for (int i = 0; i < result.size(); i++) {
toJsonArr.set(i, JSONParser.parseStrict(result.get(i)));
}
instanceTimeline(timelineContainer.getElement().getId(), toJsonArr, instance);
}
@Override
public void onFailure(Throwable caught) {
timelineContainer.remove(loaderData);
Alert alert = new Alert(caught.getMessage());
alert.setType(AlertType.ERROR);
alert.setClose(false);
timelineHeader.add(alert);
}
});
};
});
}
public void setTimelineContainerVisible(boolean bool) {
timelineContainer.setVisible(bool);
}
/*
* Called when a project (box) is clicked into Timeline
*/
private void setSelectedProject(String theComposedProjectID) {
this.selectedTimelineProjectID = theComposedProjectID;
//selectedTimelineProjectID is the couple ProfileID,ProjectID
GWT.log("selectedTimelineProjectID: " + selectedTimelineProjectID);
if (selectedTimelineProjectID == null || selectedTimelineProjectID.isEmpty())
return;
String[] references = this.selectedTimelineProjectID.split(",");
final String thePofileID = references[0];
final String theProjectID = references[1];
GeoportalItemReferences gir = new GeoportalItemReferences(theProjectID, thePofileID);
ShowDetailsEvent showDetailsEvent = new ShowDetailsEvent(gir, null, false, false,
EVENT_SOURCE.LOCATE_FROM_TIMELINE);
showDetailsEvent.setEventFromTimeline(true);
GWT.log("fireEvent: " + showDetailsEvent);
applicationBus.fireEvent(showDetailsEvent);
}
public String getSelectedProjectID() {
return selectedTimelineProjectID;
}
public static native String instanceTimeline(String idDivContainer, JSONArray jsonItems,
TimelineRelationPanel instance) /*-{
console.log('showing timeline');
//console.log('showTimeline_instanceTimeline for json items: '+jsonItems);
//console.log("showTimeline_template: " + $wnd.templateHandlebars);
// DOM element where the Timeline will be attached
var container = $doc.getElementById(idDivContainer);
//console.log("showTimeline_container: " + container);
var myArray = $wnd.JSON.parse(jsonItems);
//console.log("showTimeline_jsonItems: " + myArray);
var container = $doc.getElementById(idDivContainer);
// Create a DataSet (allows two way data-binding)
var items = new $wnd.vis.DataSet(myArray);
// Create a Timeline
var timeline = new $wnd.vis.Timeline(container, items,
$wnd.optionsTimeline);
timeline
.on(
'select',
function(properties, items) {
//console.log('selected: ' + $wnd.JSON.stringify(properties));
console.log('selected items: ' + properties.items);
instance.@org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation.TimelineRelationPanel::setSelectedProject(Ljava/lang/String;)(properties.items+'')
});
//timeline.redraw();
}-*/;
}

View File

@ -1,17 +0,0 @@
<!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">
<ui:style>
.important {
font-weight: bold;
}
</ui:style>
<g:HTMLPanel addStyleNames="timeline-popup">
<g:HTMLPanel ui:field="timelineHeader"
addStyleNames="timeline-popup-header">
<g:Anchor href="#" ui:field="timelinePopupCloser" addStyleNames="timeline-popup-closer"></g:Anchor>
</g:HTMLPanel>
<g:ScrollPanel ui:field="timelineContainer"
addStyleNames="timeline-popup-content"></g:ScrollPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,198 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.relation;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.ProjectDV;
import org.gcube.application.geoportalcommon.shared.geoportal.project.RelationshipDV;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.github.gwtbootstrap.client.ui.constants.IconSize;
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.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
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.ui.Composite;
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.HTMLPanel;
import com.google.gwt.user.client.ui.Widget;
public class ViewRelationshipPanel extends Composite {
private static ViewRelationshipPanelUiBinder uiBinder = GWT.create(ViewRelationshipPanelUiBinder.class);
interface ViewRelationshipPanelUiBinder extends UiBinder<Widget, ViewRelationshipPanel> {
}
private String profileID;
@UiField
HTMLPanel firstPanelContainer;
@UiField
HTMLPanel panelTitle;
@UiField
HTMLPanel secondPanelContainer;
@UiField
FlowPanel firstProjectPanelContainer;
@UiField
FlowPanel secondProjectPanelContainer;
@UiField
Button closeButton;
@UiField
Button buttonExpand;
private HashMap<Integer, ResultDocumentDV> selectedProjects = new HashMap<Integer, ResultDocumentDV>(2);
private HandlerManager appManagerBus;
private Map<String, ResultDocumentDV> mapOfTargetProjectForId = new HashMap<String, ResultDocumentDV>();
public ViewRelationshipPanel(HandlerManager appManagerBus, ProjectDV fromProject, boolean showExpand) {
initWidget(uiBinder.createAndBindUi(this));
this.appManagerBus = appManagerBus;
closeButton.setType(ButtonType.LINK);
closeButton.setIcon(IconType.REMOVE);
closeButton.setIconSize(IconSize.LARGE);
closeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
}
});
buttonExpand.setType(ButtonType.LINK);
buttonExpand.setIcon(IconType.EXPAND);
buttonExpand.setTitle("Show this view in new Window");
buttonExpand.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
Modal mw = new Modal(true, true);
mw.setTitle("Relationships");
int width = 0;
try {
width = Window.getClientWidth() * 75 / 100;
} catch (Exception e) {
// TODO: handle exception
}
if (width > 500)
mw.setWidth(width);
mw.add(new ViewRelationshipPanel(appManagerBus, fromProject, false));
mw.show();
}
});
if (!showExpand) {
buttonExpand.setVisible(false);
panelTitle.setVisible(false);
closeButton.setVisible(false);
}
showRelationsOf(fromProject);
}
public void showRelationsOf(ProjectDV project) {
firstProjectPanelContainer.clear();
secondProjectPanelContainer.clear();
Entry<String, Object> firstEntrySet = project.getTheDocument().getFirstEntryOfMap();
String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue() + "</b> (id: " + project.getId()
+ ")";
firstProjectPanelContainer.add(new HTML(htmlMsg));
HTML labelNoRelations = new HTML("No relationship/s found");
secondProjectPanelContainer.add(labelNoRelations);
if (project.getRelationships() != null && project.getRelationships().size() > 0) {
secondProjectPanelContainer.clear();
for (RelationshipDV relationDV : project.getRelationships()) {
final FlexTable flexTable = new FlexTable();
flexTable.getElement().addClassName("box-table-diplay-project");
Label label = new Label();
label.setType(LabelType.INFO);
label.setText(relationDV.getRelationshipName());
FlowPanel panelContainer = new FlowPanel();
Button deleteRelation = new Button("", IconType.SAVE);
deleteRelation.setTitle("Open this project");
deleteRelation.setType(ButtonType.LINK);
deleteRelation.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
ResultDocumentDV toProject = mapOfTargetProjectForId.get(relationDV.getTargetUCD());
// appManagerBus.fireEvent(
// new RelationActionHandlerEvent(project, relationDV.getRelationshipName(), toProject));
}
});
panelContainer.add(label);
panelContainer.add(deleteRelation);
flexTable.setWidget(0, 0, panelContainer);
// flexTable.setWidget(1, 0, new LoaderIcon("loading project.."));
// GeoportalDataEntryServiceAsync.Util.getInstance().getResultDocumentFoProjectByID(
// relationDV.getTargetUCD(), relationDV.getTargetID(), new AsyncCallback<ResultDocumentDV>() {
//
// @Override
// public void onFailure(Throwable caught) {
// flexTable.setWidget(1, 0, new HTML(caught.getMessage()));
//
// }
//
// @Override
// public void onSuccess(ResultDocumentDV result) {
// mapOfTargetProjectForId.put(relationDV.getTargetUCD(), result);
// Entry<String, Object> firstEntrySet = result.getFirstEntryOfMap();
// String htmlMsg = firstEntrySet.getKey() + ": <b>" + firstEntrySet.getValue()
// + "</b> (id: " + result.getId() + ")";
//
// flexTable.setWidget(1, 0, new HTML(htmlMsg));
//
// ReportTemplateToHTML rtth2 = new ReportTemplateToHTML("", result.getDocumentAsJSON(),
// false, false);
// rtth2.showAsJSON(false);
//
// flexTable.setWidget(2, 0, rtth2);
// }
// });
secondProjectPanelContainer.add(flexTable);
}
}
}
}

View File

@ -1,68 +0,0 @@
<!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">
<ui:style>
.view-rel-title {
font-size: 18px;
font-weight: bold;
text-align: center;
padding: 18px;
background: #eee;
}
.butt-create {
float: right;
margin-top: 10px;
}
.to-align-right {
position: absolute;
right: 5px;
}
.panel-style {
margin-top: 10px;
padding: 5px;
}
.panel-style table {
margin-top: 0px !important;
}
.panel-container-style {
padding-left: 10px;
padding-top: 5px;
}
.float-right {
float: right;
}
</ui:style>
<g:HTMLPanel>
<b:Button ui:field="closeButton"
addStyleNames="{style.to-align-right}"></b:Button>
<g:HTMLPanel ui:field="panelTitle"
addStyleNames="{style.view-rel-title}">View Relations</g:HTMLPanel>
<b:Button ui:field="buttonExpand"
addStyleNames="{style.float-right}">Expand</b:Button>
<g:HTMLPanel ui:field="firstPanelContainer"
addStyleNames="{style.panel-style}">
<g:FlowPanel>
<b:Label>From Project</b:Label>
</g:FlowPanel>
<g:FlowPanel ui:field="firstProjectPanelContainer"
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
</g:HTMLPanel>
<g:HTMLPanel ui:field="secondPanelContainer"
addStyleNames="{style.panel-style}">
<g:FlowPanel>
<b:Label>To Project/s</b:Label>
</g:FlowPanel>
<g:FlowPanel ui:field="secondProjectPanelContainer"
addStyleNames="{style.panel-container-style}"></g:FlowPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,551 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.search;
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.GeoportalItemReferences;
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.geoportal.DocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.ResultDocumentDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.ItemFieldDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ClosedViewDetailsEvent;
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.ShowDetailsEvent.EVENT_SOURCE;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.StringUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.ResultSetPaginatedDataIDs;
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;
public static final String DEFAULT_DOCUMENT_PROJECTION_NAME = "_theDocument";
@UiField
ListBox listBoxSortBy;
@UiField
ListBox listBoxSearchFor;
@UiField
TextBox searchField;
@UiField
NavLink sortByToogle;
@UiField
Button resetSearch;
@UiField
HTMLPanel panelResults;
@UiField
HorizontalPanel toogleSortBy;
private List<ItemFieldDV> searchForFields;
private List<ItemFieldDV> sortByFields;
private SearchingFilter currentSortFilter;
private HandlerManager appManagerBus;
private static final String LABEL_FILTER_SEPARATOR = " - ";
protected static final int MAX_TEXT_DIMENSION = 100;
protected static final int MAX_COLUMNS_RESULTS = 3;
private ResultSetPaginatedData latestResult;
private DropdownButton searchFacilityButton;
private String profileID;
private List<ItemFieldDV> displayByFields;
/**
* 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 profileID the profile ID
* @param appManagerBus the app manager bus
* @param displayByFields the display by fields
* @param sortByFields the sort by fields
* @param searchForFields the search for fields
* @param initialSortFilter the initial sort filter
*/
public SearchFacilityUI(String profileID, HandlerManager appManagerBus, List<ItemFieldDV> displayByFields,
List<ItemFieldDV> sortByFields, List<ItemFieldDV> searchForFields, SearchingFilter initialSortFilter) {
initWidget(uiBinder.createAndBindUi(this));
this.profileID = profileID;
this.displayByFields = displayByFields;
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(ItemFieldDV itemField, ORDER direction) {
String labelFilter = itemField.getDisplayName() + LABEL_FILTER_SEPARATOR + direction.name();
return labelFilter;
}
/**
* Bind events.
*/
private void bindEvents() {
for (ItemFieldDV 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 (ItemFieldDV 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) {
resetCurrentSearch();
}
});
}
/**
* Reset current search.
*/
public void resetCurrentSearch() {
searchField.setText("");
resetSearch.setVisible(false);
panelResults.clear();
latestResult = null;
appManagerBus.fireEvent(new SearchPerformedEvent(profileID, null, true));
setSearchEnabled(false);
}
/**
* Sets the search enabled.
*
* @param bool the new search enabled
*/
private void setSearchEnabled(boolean bool) {
if (bool) {
searchFacilityButton.getElement().addClassName("highlight-button");
} else {
searchFacilityButton.getElement().removeClassName("highlight-button");
}
}
/**
* Search concessioni.
*/
private void searchProjects() {
SearchingFilter filter = getCurrentSortFilter();
panelResults.clear();
panelResults.add(new HTML("<hr>"));
panelResults.add(new LoaderIcon("Searching..."));
GeoportalDataViewerServiceAsync.Util.getInstance().getListProjects(profileID, 0,
GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM, filter, false,
new AsyncCallback<ResultSetPaginatedDataIDs>() {
@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(ResultSetPaginatedDataIDs result) {
appManagerBus
.fireEvent(new SearchPerformedEvent(profileID, result.getResultSetProjectIDs(), 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;
}
int allItems = result.getResultSetProjectIDs().size();
int returnedItems = result.getData().size();
String message = "";
if (allItems > returnedItems) {
message = "Your query returns too many results (" + allItems
+ "). Please find below the top " + returnedItems + ".<br>";
} else if (returnedItems > 0) {
message = "Found " + returnedItems;
message += returnedItems > 0 ? " projects" : " project";
message += ".";
}
if (returnedItems > 0
&& returnedItems <= GeoportalDataViewerConstants.SEARCH_LIMIT_RESULTS_TO_MAXIMUM) {
message += "On the map you can see all the projects with a centroid matching the query";
}
HTML resultMessage = new HTML(message);
resultMessage.getElement().addClassName("search_result_msg");
panelResults.add(resultMessage);
FlexTable ft = new FlexTable();
ft.getElement().setClassName("table-results");
int i = 0;
// Table headers
for (ItemFieldDV itemField : displayByFields) {
if (i > MAX_COLUMNS_RESULTS) {
break;
}
i++;
String displayName = itemField.getDisplayName();
ft.setWidget(0, i, new HTML(displayName));
}
// From the Second row
i = 1;
for (DocumentDV documentDV : result.getData()) {
ResultDocumentDV resultDoc = (ResultDocumentDV) documentDV;
NavLink locateOnMap = new NavLink("Show");
locateOnMap.setTitle("Locate this project on Map and show details");
locateOnMap.setIcon(IconType.MAP_MARKER);
locateOnMap.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GeoportalItemReferences gir = new GeoportalItemReferences(resultDoc.getProjectID(),
profileID);
// here
appManagerBus.fireEvent(new ClosedViewDetailsEvent());
appManagerBus.fireEvent(
new ShowDetailsEvent(gir, null, true, true, EVENT_SOURCE.LOCATE_SEARCHED));
// appManagerBus.fireEvent(new ShowPopupOnCentroidEvent(profileID,
// resultDoc.getProjectID(), resultDoc.getSpatialReference()));
}
});
// First column
ft.setWidget(i, 0, locateOnMap);
int j = 0;
// Other columns
for (ItemFieldDV itemField : displayByFields) {
if (j > MAX_COLUMNS_RESULTS) {
break;
}
String firstJsonField = itemField.getJsonFields().get(0);
GWT.log("The json fields is: " + firstJsonField);
String key = firstJsonField.replace(DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
Object value = documentDV.getDocumentAsMap().get(key);
String objectToRender = "";
String toTitle = "";
if (value == null) {
objectToRender = "N.A.";
toTitle = objectToRender;
} else if (value instanceof ArrayList) {
ArrayList<Object> arrayValues = (ArrayList<Object>) value;
String toReturn = "<ul>";
String toDisplayTitle = "";
for (Object arrayValue : arrayValues) {
toReturn += "<li>" + arrayValue + "</li>";
toDisplayTitle += arrayValue + "; ";
}
toReturn += "</ul>";
GWT.log("Array returning: " + key + " is instance of: " + value.getClass()
+ " to return: " + toReturn);
toTitle = toDisplayTitle;
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
} else {
String valueStr = value.toString();
toTitle = valueStr;
objectToRender = StringUtil.ellipsize(valueStr, MAX_TEXT_DIMENSION);
}
GWT.log("The key is: " + key + " objectToRender is: " + objectToRender);
HTML htmlValue = new HTML(objectToRender);
htmlValue.setTitle(toTitle);
ft.setWidget(i, ++j, htmlValue);
}
i++;
}
panelResults.add(ft);
}
});
}
/**
* To display authors.
*
* @param listValues the list values
* @return the string
*/
private String toDisplayList(List<Object> listValues) {
String toDisplay = "";
if (listValues == null)
return toDisplay;
for (Object 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()));
searchProjects();
}
/**
* 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 {
ItemFieldDV recordField = null;
for (ItemFieldDV 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 (ItemFieldDV recordField : searchForFields) {
if (recordField.getDisplayName().equals(listBoxSearchFor.getSelectedValue())) {
listOfSeachingFields = recordField.getJsonFields();
continue;
}
}
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));
searchingFilter.setConditions(Arrays.asList(where));
}
return searchingFilter;
}
/**
* Gets the current sort filter.
*
* @return the current sort filter
*/
public SearchingFilter getCurrentSortFilter() {
currentSortFilter = builtSearchingFilter();
GWT.log("currentSortFilter: " + currentSortFilter);
return currentSortFilter;
}
/**
* Sets the search button.
*
* @param searchFacilityButton the new search button
*/
public void setSearchButton(DropdownButton searchFacilityButton) {
this.searchFacilityButton = searchFacilityButton;
}
}

View File

@ -1,672 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.crossfiltering;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import org.gcube.application.geoportalcommon.shared.geoportal.config.GroupedLayersDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.CrossFilteringLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.config.layers.LayerIDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.GCubeSDILayer;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.IndexLayerDV;
import org.gcube.application.geoportalcommon.shared.geoportal.materialization.innerobject.BBOXDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants.MAP_PROJECTION;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.ApplyCQLToLayerOnMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.FitMapToExtentEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.ExtentWrapped;
import org.gcube.portlets.user.geoportaldataviewer.client.gis.MapUtils;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.util.OLGeoJSONUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.WFSMakerUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.GCubeCollection;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import com.github.gwtbootstrap.client.ui.Alert;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.ControlLabel;
import com.github.gwtbootstrap.client.ui.Controls;
import com.github.gwtbootstrap.client.ui.DropdownButton;
import com.github.gwtbootstrap.client.ui.Fieldset;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.AlertType;
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.shared.HandlerManager;
import com.google.gwt.http.client.URL;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
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.Widget;
import jsinterop.base.JsPropertyMap;
import ol.Extent;
import ol.Feature;
import ol.source.Vector;
/**
* The Class CrossFilteringLayerPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public class CrossFilteringLayerPanel extends Composite {
private static final double BBOX_OFFESET_ON_FEATURES = 18000.0;
private static final String ITEM_LABEL = "centroid";
public static String COLORSCALERANGE = "COLORSCALERANGE";
@UiField
Fieldset fieldSet;
@UiField
HTMLPanel panelResults;
@UiField
Button buttonReset;
private CheckBox checkbox;
private GeoInformationForWMSRequest geoInformation;
private static CrossFilteringLayerPanelUiBinder uiBinder = GWT.create(CrossFilteringLayerPanelUiBinder.class);
private HandlerManager applicationBus;
private LayerItem layerItem;
private LinkedHashMap<Integer, List<? extends LayerIDV>> mapInnestedFiltering = new LinkedHashMap<Integer, List<? extends LayerIDV>>();
private LinkedHashMap<Integer, HashMap<String, SelectableItem>> mapInnestedFeatures = new LinkedHashMap<Integer, HashMap<String, SelectableItem>>();
private LinkedHashMap<Integer, List<ListBox>> mapInnestedListBoxes = new LinkedHashMap<Integer, List<ListBox>>();
private GroupedLayersDV<? extends LayerIDV> groupedLayersDV;
private GCubeCollection gCubeCollection;
private DropdownButton filterButton;
/**
* The Interface LayerCollectionPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 16, 2023
*/
interface CrossFilteringLayerPanelUiBinder extends UiBinder<Widget, CrossFilteringLayerPanel> {
}
/**
* Instantiates a new overlay custom layer panel.
*
* @param gCubeCollection the g cube collection
* @param groupedLayersDV the grouped layers DV
* @param applicationBus the application bus
*/
public CrossFilteringLayerPanel(GCubeCollection gCubeCollection,
GroupedLayersDV<? extends LayerIDV> groupedLayersDV, HandlerManager applicationBus) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
this.groupedLayersDV = groupedLayersDV;
this.gCubeCollection = gCubeCollection;
GWT.log("Building cross-filtering for: " + groupedLayersDV);
buttonReset.setType(ButtonType.LINK);
int level = 0;
// Building mapInnestedFiltering
recursivelyBuildSelectableLevels(level, groupedLayersDV.getListCustomLayers());
GWT.log("cross-filtering mapInnestedFiltering: " + mapInnestedFiltering);
for (Integer theLevel : mapInnestedFiltering.keySet()) {
addListBoxesLevelToPanel(theLevel, mapInnestedFiltering.get(theLevel));
}
fillSelectableLevel(level, null);
bindEvents();
}
/**
* Bind events.
*/
private void bindEvents() {
buttonReset.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
panelResults.clear();
for (int i = 1; i < mapInnestedListBoxes.size(); i++) {
resetListBoxLevel(i);
}
// Selecting the placeholder of the fist list box
List<ListBox> listBox = mapInnestedListBoxes.get(0);
listBox.get(0).setSelectedIndex(0);
// Resetting CQL filtering
applicationBus.fireEvent(new ApplyCQLToLayerOnMapEvent(gCubeCollection.getIndexes().get(0), null));
setFilterHighLighted(false);
}
});
}
/**
* Recursively build selectable levels.
*
* @param level the level
* @param layersIDV the layers IDV
*/
private void recursivelyBuildSelectableLevels(int level, List<? extends LayerIDV> layersIDV) {
if (layersIDV == null)
return;
mapInnestedFiltering.put(level, layersIDV);
for (LayerIDV layerIDV : layersIDV) {
if (layerIDV instanceof CrossFilteringLayerDV) {
CrossFilteringLayerDV crossFilteringLayer = (CrossFilteringLayerDV) layerIDV;
if (crossFilteringLayer.getRelated_to() != null) {
recursivelyBuildSelectableLevels(++level, crossFilteringLayer.getRelated_to());
}
}
}
}
/**
* Fill selectable level.
*
* @param level the level
* @param selectedItem the selected item
*/
private void fillSelectableLevel(int level, SelectableItem selectedItem) {
List<? extends LayerIDV> layersIDV = mapInnestedFiltering.get(level);
List<ListBox> listBoxes = mapInnestedListBoxes.get(level);
if (layersIDV == null)
return;
final HashMap<String, SelectableItem> mapSelectableFeatures = new HashMap<String, CrossFilteringLayerPanel.SelectableItem>();
LayerIDV layerIDV = layersIDV.get(0); // Expected one
if (layerIDV instanceof CrossFilteringLayerDV) {
CrossFilteringLayerDV crossFilteringLayer = (CrossFilteringLayerDV) layerIDV;
String wfsURL = crossFilteringLayer.getWFS_URL();
if (selectedItem != null) {
String cqlFilterValue = crossFilteringLayer.getTable_parent_key_field() + "=" + selectedItem.keyValue;
wfsURL += "&" + WFSMakerUtil.CQL_FILTER_PARAMETER + "=" + URL.encode(cqlFilterValue);
}
GWT.log("wfsURL request: " + wfsURL);
GeoportalDataViewerServiceAsync.Util.getInstance().getHTTPResponseForURL(wfsURL,
new AsyncCallback<String>() {
@Override
public void onSuccess(String response) {
GWT.log("wfsURL response: " + response);
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, response);
for (Feature feature : features) {
JsPropertyMap<Object> properties = feature.getProperties();
Object keyValue = properties.get(crossFilteringLayer.getTable_key_field());
Object itemField = properties.get(crossFilteringLayer.getTable_show_field());
Object parentKey = null;
if (crossFilteringLayer.getTable_parent_key_field() != null
&& !crossFilteringLayer.getTable_parent_key_field().isEmpty())
parentKey = properties.get(crossFilteringLayer.getTable_parent_key_field());
parentKey = parentKey == null ? "" : parentKey;
SelectableItem selectableItem = new SelectableItem(
crossFilteringLayer.getTable_key_field() + "", keyValue + "",
crossFilteringLayer.getTable_parent_key_field(), itemField + "",
crossFilteringLayer.getName(), crossFilteringLayer.getTable_geometry_name());
GWT.log("selectableItem: " + selectableItem);
String pathFeatureKey = pathFeatureKey(selectableItem);
mapSelectableFeatures.put(pathFeatureKey, selectableItem);
}
GWT.log("mapSelectableFeatures: " + mapSelectableFeatures);
mapInnestedFeatures.put(level, mapSelectableFeatures);
String placholder = placeholderLayer(layersIDV.get(0)); // Expected one
fillListBoxLevel(level, mapSelectableFeatures, listBoxes, placholder);
}
@Override
public void onFailure(Throwable caught) {
panelResults.clear();
HTML error = new HTML(
"Sorry, an issue is occurred on loading data for cross-filtering facility. Error is: "
+ caught.getMessage());
panelResults.add(error);
}
});
}
}
/**
* Path feature key.
*
* @param selectableItem the selectable item
* @return the string
*/
private String pathFeatureKey(SelectableItem selectableItem) {
return "root_" + selectableItem.parentKeyField + "_" + selectableItem.keyField + "_" + selectableItem.keyValue;
}
/**
* Placeholder layer.
*
* @param layersIDV the layers IDV
* @return the string
*/
private String placeholderLayer(LayerIDV layersIDV) {
String placeholder = "Select";
// if (layersIDV != null)
// placeholder += " " + layersIDV.getTitle();
placeholder += " ...";
return placeholder;
}
/**
* Adds the list boxes level to panel.
*
* @param level the level
* @param layersIDV the layers IDV
*/
private void addListBoxesLevelToPanel(int level, List<? extends LayerIDV> layersIDV) {
if (layersIDV == null)
return;
List<ListBox> listBoxes = new ArrayList<ListBox>(layersIDV.size());
for (LayerIDV layerIDV : layersIDV) {
ControlGroup cg = new ControlGroup();
ControlLabel cl = new ControlLabel(layerIDV.getTitle());
Controls controls = new Controls();
ListBox listBox = new ListBox();
String placeholder = placeholderLayer(layerIDV);
listBox.addItem(placeholder);
setEnabledBox(listBox, false);
listBoxes.add(listBox);
controls.add(listBox);
cg.add(cl);
cg.add(controls);
fieldSet.add(cg);
}
mapInnestedListBoxes.put(level, listBoxes);
}
/**
* Sets the enabled box.
*
* @param listBox the list box
* @param bool the bool
*/
public void setEnabledBox(ListBox listBox, boolean bool) {
listBox.setEnabled(bool);
}
/**
* Clear list box.
*
* @param listBox the list box
* @param bool the bool
*/
public void clearListBox(ListBox listBox, boolean bool) {
listBox.setEnabled(bool);
}
/**
* Reset list box level.
*
* @param level the level
*/
private void resetListBoxLevel(int level) {
List<ListBox> listBoxes = mapInnestedListBoxes.get(level);
if (listBoxes != null) {
for (ListBox listBox : listBoxes) {
listBox.clear();
setEnabledBox(listBox, false);
}
}
}
/**
* Fill list box level.
*
* @param level the level
* @param mapSelectableFeatures the map selectable features
* @param listBoxes the list boxes
* @param placeholder the placeholder
*/
private void fillListBoxLevel(int level, HashMap<String, SelectableItem> mapSelectableFeatures,
List<ListBox> listBoxes, String placeholder) {
// GWT.log("fillBox level: " + level + " map: " + mapSelectableFeatures);
if (mapSelectableFeatures == null)
return;
ListBox listBox = listBoxes.get(0); // Expected one
listBox.clear();
listBox.addItem(placeholder);
listBox.getElement().getFirstChildElement().setAttribute("disabled", "disabled");
for (String key : mapSelectableFeatures.keySet()) {
SelectableItem selItem = mapSelectableFeatures.get(key);
listBox.addItem(selItem.itemValue, key);
}
listBox.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
loadInnerLevel(level, listBox.getSelectedValue());
for (int i = level + 1; i < mapInnestedListBoxes.size(); i++) {
resetListBoxLevel(i);
}
String key = listBox.getSelectedValue();
SelectableItem selectableItem = mapSelectableFeatures.get(key);
buildCrossFilteringCQLAndFireEvent(selectableItem);
setFilterHighLighted(true);
}
});
setEnabledBox(listBox, true);
}
/**
* Builds the cross filtering CQL and fire event.
*
* @param selectableItem the selectable item
*/
private void buildCrossFilteringCQLAndFireEvent(SelectableItem selectableItem) {
String setCqlFilter = "INTERSECTS(geom,querySingle('" + selectableItem.layername + "','"
+ selectableItem.theGeometryName + "','" + selectableItem.keyField + "=''" + selectableItem.keyValue
+ "'''))";
// setCqlFilter = URL.encode(setCqlFilter);
GWT.log("CQL FILTER built: " + setCqlFilter);
IndexLayerDV indexLayer = gCubeCollection.getIndexes().get(0);
try {
GCubeSDILayer layer = indexLayer.getLayer();
String wmsLink = layer.getOgcLinks().get("wms");
String layerName = URLUtil.extractValueOfParameterFromURL("layers", wmsLink);
String serviceURL = URLUtil.getPathURL(wmsLink);
String toLServiceURL = serviceURL.toLowerCase();
if (toLServiceURL.endsWith("wms")) {
toLServiceURL = toLServiceURL.substring(0, toLServiceURL.length() - 3) + "ows";
}
String wfsCrossFilteringQuery = WFSMakerUtil.buildWFSRequest(toLServiceURL, layerName, 1000, "geom",
setCqlFilter);
GWT.log("wfsCrossFilteringQuery: " + wfsCrossFilteringQuery);
showCountResultsOfWFSCrossFiltering(wfsCrossFilteringQuery);
} catch (Exception e) {
// TODO: handle exception
}
applicationBus.fireEvent(new ApplyCQLToLayerOnMapEvent(indexLayer, setCqlFilter));
}
public void showCountResultsOfWFSCrossFiltering(String wfsQuery) {
panelResults.clear();
panelResults.add(new HTML("<hr>"));
panelResults.add(new LoaderIcon("Applying spatial filter..."));
GeoportalDataViewerServiceAsync.Util.getInstance().getHTTPResponseForURL(wfsQuery, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
panelResults.clear();
panelResults.add(new HTML("<hr>"));
Alert alert = new Alert("Error on returning number of items");
alert.setType(AlertType.ERROR);
alert.setClose(false);
panelResults.add(alert);
}
@Override
public void onSuccess(String response) {
Feature[] features = OLGeoJSONUtil.readGeoJsonFeatures(MAP_PROJECTION.EPSG_4326, response);
if (features != null) {
int dataCount = features.length;
panelResults.clear();
panelResults.add(new HTML("<hr>"));
FlexTable flexTable = new FlexTable();
String message = "";
if (dataCount <= 0) {
message = "No " + ITEM_LABEL + " found";
} else {
message = "Found " + dataCount;
message += dataCount > 1 ? " " + ITEM_LABEL + "s" : " " + ITEM_LABEL;
}
HTML resultMessage = new HTML();
resultMessage.getElement().addClassName("search_result_msg");
resultMessage.setHTML(message);
flexTable.setWidget(0, 0, resultMessage.asWidget());
panelResults.add(flexTable);
try {
if (features.length > 0) {
// Calculating Extend of the selected Features
Vector vector = new Vector();
vector.addFeatures(features);
Extent theExtent = vector.getExtent();
GWT.log("Extent from features is: " + theExtent);
theExtent = MapUtils.transformExtent(theExtent, MAP_PROJECTION.EPSG_4326.getName(),
MAP_PROJECTION.EPSG_3857.getName());
double bboxOffset = features.length>1?BBOX_OFFESET_ON_FEATURES:0;
final Extent transfExtent = new ExtentWrapped(theExtent.getLowerLeftX() - bboxOffset,
theExtent.getLowerLeftY() - bboxOffset, theExtent.getUpperRightX() + bboxOffset,
theExtent.getUpperRightY() + bboxOffset);
GWT.log("Zoom to selected - transf extent: " + transfExtent);
Button selectTo = new Button("Zoom to selected");
selectTo.setTitle("Zoom to select centroids...");
selectTo.setType(ButtonType.DEFAULT);
selectTo.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
applicationBus.fireEvent(new FitMapToExtentEvent(transfExtent));
}
});
flexTable.setWidget(1, 0, selectTo);
}
} catch (Exception e) {
// TODO: handle exception
}
}
}
});
}
public static final BBOXDV fromGeoJSON(double[] coords) {
BBOXDV toReturn = new BBOXDV();
toReturn.setMaxX(coords[0]);
toReturn.setMinY(coords[1]);
if (coords.length == 6) {
// 3D
toReturn.setMinZ(coords[2]);
toReturn.setMinX(coords[3]);
toReturn.setMaxY(coords[4]);
toReturn.setMaxZ(coords[5]);
} else {
toReturn.setMinX(coords[2]);
toReturn.setMaxY(coords[3]);
}
return toReturn;
}
/**
* Load inner level.
*
* @param level the level
* @param selectableItemValue the selectable item value
*/
private void loadInnerLevel(int level, String selectableItemValue) {
// GWT.log("selected level " + level + " selectableItemValue " +
// selectableItemValue);
HashMap<String, SelectableItem> mapSelectableItem = mapInnestedFeatures.get(level);
SelectableItem selectedItem = mapSelectableItem.get(selectableItemValue);
// GWT.log("selected selectableItem " + selectedItem);
int innerLevel = level + 1;
List<? extends LayerIDV> selectedLayers = mapInnestedFiltering.get(innerLevel);
// if layer filtering exists at this level
if (selectedLayers != null) {
List<ListBox> selectedListBoxes = mapInnestedListBoxes.get(innerLevel);
GWT.log("loading inner layers " + selectedLayers);
GWT.log("loading selectedListBoxes " + selectedListBoxes);
fillSelectableLevel(innerLevel, selectedItem);
}
}
/**
* Sets the filter high lighted.
*
* @param bool the new filter high lighted
*/
private void setFilterHighLighted(boolean bool) {
if (bool) {
filterButton.getElement().addClassName("highlight-button");
} else {
filterButton.getElement().removeClassName("highlight-button");
}
}
/**
* Sets the search button.
*
* @param searchFacilityButton the new search button
*/
public void setFilterButton(DropdownButton searchFacilityButton) {
this.filterButton = searchFacilityButton;
}
/**
* The Class SelectableItem.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 31, 2023
*/
public class SelectableItem {
protected String keyField;
protected String keyValue;
protected String parentKeyField;
protected String itemValue;
protected String layername;
protected String theGeometryName;
/**
* Instantiates a new selectable item.
*/
SelectableItem() {
}
/**
* Instantiates a new selectable item.
*
* @param keyField the key field
* @param keyValue the key value
* @param parentKeyField the parent key field
* @param itemValue the item value
* @param layername the layername
* @param theGeometryName the the geometry name
*/
public SelectableItem(String keyField, String keyValue, String parentKeyField, String itemValue,
String layername, String theGeometryName) {
super();
this.keyField = keyField;
this.keyValue = keyValue;
this.parentKeyField = parentKeyField;
this.itemValue = itemValue;
this.layername = layername;
this.theGeometryName = theGeometryName;
}
/**
* To string.
*
* @return the string
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SelectableItem [keyField=");
builder.append(keyField);
builder.append(", keyValue=");
builder.append(keyValue);
builder.append(", parentKeyField=");
builder.append(parentKeyField);
builder.append(", itemValue=");
builder.append(itemValue);
builder.append(", layername=");
builder.append(layername);
builder.append(", theGeometryName=");
builder.append(theGeometryName);
builder.append("]");
return builder.toString();
}
}
}

View File

@ -1,28 +0,0 @@
<!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">
<ui:style>
.important {
font-weight: bold;
}
.margin-left-10 {
margin-left: 10px;
}
</ui:style>
<g:HTMLPanel>
<g:ScrollPanel>
<g:HTMLPanel>
<b:Form ui:field="panelForm">
<b:Fieldset ui:field="fieldSet">
</b:Fieldset>
</b:Form>
<g:HTMLPanel ui:field="panelResults">
</g:HTMLPanel>
<b:Button icon="REMOVE_CIRCLE" ui:field="buttonReset"
title="Reset the filter">Reset</b:Button>
</g:HTMLPanel>
</g:ScrollPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,278 +0,0 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.customoverlays;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.events.OverlayCustomLayerToMapEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.util.URLUtil;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.wms.GeoInformationForWMSRequest;
import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.CheckBox;
import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.constants.ButtonType;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.FontWeight;
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.ErrorEvent;
import com.google.gwt.event.dom.client.ErrorHandler;
import com.google.gwt.event.dom.client.LoadEvent;
import com.google.gwt.event.dom.client.LoadHandler;
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.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.FlowPanel;
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.Image;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* The Class OverlayCustomLayerPanel.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* May 15, 2023
*/
public class OverlayCustomLayerPanel extends Composite {
public static String COLORSCALERANGE = "COLORSCALERANGE";
@UiField
HTMLPanel basePanel;
@UiField
HTMLPanel stylePanel;
@UiField
HTMLPanel styleListPanel;
@UiField
Button buttonLegend;
@UiField
ScrollPanel legendPanel;
private CheckBox checkbox;
private GeoInformationForWMSRequest geoInformation;
private static OverlayCustomLayerPanelUiBinder uiBinder = GWT.create(OverlayCustomLayerPanelUiBinder.class);
private ListBox listBoxStyles = new ListBox();
private HandlerManager applicationBus;
private LayerItem layerItem;
/**
* The Interface LayerCollectionPanelUiBinder.
*
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
*
* Jan 16, 2023
*/
interface OverlayCustomLayerPanelUiBinder extends UiBinder<Widget, OverlayCustomLayerPanel> {
}
/**
* Instantiates a new overlay custom layer panel.
*
* @param layerItem the layer item
* @param applicationBus the application bus
*/
public OverlayCustomLayerPanel(LayerItem layerItem, HandlerManager applicationBus) {
initWidget(uiBinder.createAndBindUi(this));
this.applicationBus = applicationBus;
this.layerItem = layerItem;
buttonLegend.setType(ButtonType.LINK);
legendPanel.setVisible(false);
GWT.log("Found available layerItem " + layerItem);
String label = layerItem.getTitle();
final String layerName = layerItem.getName();
checkbox = new CheckBox(label);
checkbox.setId("gcubeCustomLayerSelector_" + layerName);
checkbox.getElement().getStyle().setFontWeight(FontWeight.BOLD);
checkbox.setChecked(true);
checkbox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
@Override
public void onValueChange(ValueChangeEvent<Boolean> event) {
GWT.log("CustomLayer selector flag changed to value : " + event.toDebugString());
if (event.getValue()) {
// OPEN COLLECTION
applicationBus.fireEvent(new OverlayCustomLayerToMapEvent(layerItem, OverlayCustomLayerToMapEvent.ACTION_TYPE.VISIBILITY, true));
} else {
// CLOSE COLLECTION
legendPanel.clear();
legendPanel.setVisible(false);
applicationBus.fireEvent(new OverlayCustomLayerToMapEvent(layerItem, OverlayCustomLayerToMapEvent.ACTION_TYPE.VISIBILITY, false));
}
}
});
basePanel.add(checkbox);
final String wmsLink = layerItem.getWmsLink();
GeoportalDataViewerServiceAsync.Util.getInstance().parseWmsRequest(wmsLink, layerName,
new AsyncCallback<GeoInformationForWMSRequest>() {
@Override
public void onFailure(Throwable caught) {
Window.alert(caught.getMessage());
}
@Override
public void onSuccess(GeoInformationForWMSRequest geoInfoWMS) {
geoInformation = geoInfoWMS;
GWT.log("Parsed WMS Request returned: " + geoInfoWMS);
if (geoInfoWMS.getStyles() != null && geoInfoWMS.getStyles().getGeoStyles() != null) {
if (geoInfoWMS.getStyles().getGeoStyles().size() > 0) {
stylePanel.setVisible(true);
listBoxStyles.clear();
for (String styleName : geoInfoWMS.getStyles().getGeoStyles()) {
listBoxStyles.addItem(styleName, styleName);
}
styleListPanel.add(listBoxStyles);
}
}
listBoxStyles.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {
legendPanel.clear();
legendPanel.setVisible(false);
}
});
buttonLegend.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
GWT.log("is isToggle: " + buttonLegend.isToggle());
GWT.log("is isToggled: " + buttonLegend.isToggled());
if (legendPanel.isVisible()) {
legendPanel.clear();
legendPanel.setVisible(false);
} else {
legendPanel.setVisible(true);
loadLegend(wmsLink);
}
}
});
}
});
}
/**
* Gets the checkbox.
*
* @return the checkbox
*/
public CheckBox getCheckbox() {
return checkbox;
}
/**
* Load legend.
*
* @param wmsLink the wms link
*/
private void loadLegend(String wmsLink) {
legendPanel.clear();
String theLayerName = geoInformation.getLayerName();
final FlexTable flexTable = new FlexTable();
legendPanel.add(flexTable);
// Case no style found
if (listBoxStyles.getSelectedValue() == null) {
flexTable.setWidget(0, 0, new HTML("No style found"));
return;
}
FlowPanel flow = new FlowPanel();
flow.add(new HTMLPanel("Legend for: " + theLayerName));
final HorizontalPanel hpLegend = new HorizontalPanel();
String url = geoInformation.getServiceEndPoint() + "?service=WMS&" + "version="
+ URLUtil.getValueOfParameter("version", wmsLink) + "&" + "request=GetLegendGraphic&" + "layer="
+ theLayerName;
String styleName = null;
try {
styleName = listBoxStyles.getSelectedValue();
} catch (Exception e) {
}
styleName = styleName != null && !styleName.isEmpty() ? styleName : "";
if (!geoInformation.isNcWMS()) {
url += "&format=image/png" + "&STYLE=" + styleName
+ "&LEGEND_OPTIONS=forceRule:True;dx:0.2;dy:0.2;mx:0.2;my:0.2;fontStyle:bold;"
+ "borderColor:000000;border:true;fontColor:000000;fontSize:14";
} else {
int isNcWmsStyle = styleName.indexOf("/");
if (isNcWmsStyle != -1) {
styleName = styleName.substring(isNcWmsStyle + 1, styleName.length());
}
url += "&palette=" + styleName;
if (geoInformation.getMapWMSNoStandard() != null) {
for (String key : geoInformation.getMapWMSNoStandard().keySet()) { // ADDING COLORSCALERANGE?
if (key.compareToIgnoreCase(COLORSCALERANGE) == 0) {
url += "&" + key + "=" + geoInformation.getMapWMSNoStandard().get(key);
break;
}
}
}
}
GWT.log(url);
flexTable.setStyleName("layer-style-panel-table-legend");
flexTable.setWidget(0, 0, new Label("Legend"));
final Image legendImage = new Image(url);
legendImage.addLoadHandler(new LoadHandler() {
@Override
public void onLoad(LoadEvent event) {
}
});
legendImage.addErrorHandler(new ErrorHandler() {
@Override
public void onError(ErrorEvent event) {
GWT.log("ErrorEvent ");
flexTable.setWidget(0, 1, new HTML("Error on loading the style"));
}
});
hpLegend.add(legendImage);
flexTable.setWidget(0, 1, hpLegend);
}
}

View File

@ -1,29 +0,0 @@
<!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">
<ui:style>
.important {
font-weight: bold;
}
.margin-left-10 {
margin-left: 10px;
}
</ui:style>
<g:HTMLPanel addStyleNames="{style.margin-left-10}">
<g:HTMLPanel ui:field="basePanel">
</g:HTMLPanel>
<g:HTMLPanel ui:field="stylePanel" visible="false"
addStyleNames="layer-style-panel">
Layer Style
<g:HorizontalPanel>
<g:HTMLPanel ui:field="styleListPanel"></g:HTMLPanel>
<b:Button icon="BAR_CHART" ui:field="buttonLegend"
title="Show the Legend"></b:Button>
</g:HorizontalPanel>
<g:ScrollPanel ui:field="legendPanel"></g:ScrollPanel>
</g:HTMLPanel>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,16 +1,10 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import java.util.LinkedHashMap;
import org.gcube.application.geoportalcommon.shared.geoportal.geojson.GeoJSON;
import org.gcube.application.geoportalcommon.shared.geoportal.project.TemporalReferenceDV;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
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.application.geoportalcommon.shared.products.BaseConcessioneDV;
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.SwapLayer;
import org.gcube.portlets.user.geoportaldataviewer.client.resources.GNAImages;
import org.gcube.portlets.user.geoportaldataviewer.client.ui.cms.project.ProjectUtil;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
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;
@ -21,7 +15,6 @@ 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.FontWeight;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
@ -34,39 +27,25 @@ 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.shared.HandlerManager;
import com.google.gwt.user.client.rpc.AsyncCallback;
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.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
public class DragDropLayer extends FlowPanel {
private static final String _22PX = "22px";
private static DragDropLayer dragging = null;
private static DragDropLayer draggingTarget = null;
final boolean droppable;
private Label labelLayerName;
private Image imgLayerVisible = new Image(GNAImages.ICONS.layerVisible());
private Image imgLayerInvisible = new Image(GNAImages.ICONS.layerInvisible());
private Image imgLocate = new Image(GNAImages.ICONS.locate());
private Image imgLocateNone = new Image(GNAImages.ICONS.locateNone());
private boolean locateEnabled = false;
private HTML buttonLocate = new HTML();
private DragDropLayer INSTANCE = this;
private LoaderIcon loaderIcon = new LoaderIcon("Loading features", null);
private Button draggableButton = new Button();
private HandlerManager applicationBus;
private LayerObject layerObject;
private LayerItem layerItem;
private com.google.gwt.user.client.ui.Label labelProject;
private boolean layerVisibility = true;
private HTML buttonLayerVisibility = new HTML();
@ -74,59 +53,6 @@ public class DragDropLayer extends FlowPanel {
this.applicationBus = applicationBus;
this.layerObject = layerObject;
this.layerItem = layerObject.getLayerItem();
GWT.log("DragDropLayer for projectDV: " + layerObject.getProjectDV());
// Checking the spatial reference
if (layerObject.getProjectDV() != null && layerObject.getProjectDV().getSpatialReference() == null) {
GeoportalDataViewerServiceAsync.Util.getInstance().getSpatialReference(layerObject.getProfileID(),
layerObject.getProjectID(), new AsyncCallback<GeoJSON>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(GeoJSON result) {
if (result != null)
layerObject.getProjectDV().setSpatialReference(result);
}
});
}
String referProjectID = "Project ID: " + layerObject.getProjectDV().getId();
labelProject = new com.google.gwt.user.client.ui.Label("");
labelProject.setTitle(referProjectID);
GeoportalDataViewerServiceAsync.Util.getInstance().getEntrySetsDocumentForProjectID(
layerObject.getProjectDV().getProfileID(), layerObject.getProjectDV().getId(), 1,
new AsyncCallback<LinkedHashMap<String, Object>>() {
@Override
public void onSuccess(LinkedHashMap<String, Object> result) {
String realProjectName = "";
if (result != null) {
for (String key : result.keySet()) {
result.get(key);
//referProject = key + ": " + result.get(key);
realProjectName = result.get(key)+"";
break;
}
}
if (realProjectName != null && !realProjectName.isEmpty()) {
labelProject.setText(StringUtil.ellipsize(realProjectName, 40));
labelProject.setTitle(realProjectName);
}
}
@Override
public void onFailure(Throwable caught) {
labelProject.setTitle("Error on reading the project name");
}
});
String layerName = StringUtil.fullNameToLayerName(layerItem.getName(), ":");
@ -134,6 +60,13 @@ public class DragDropLayer extends FlowPanel {
this.labelLayerName.setTitle(layerItem.getName());
this.labelLayerName.setType(LabelType.INFO);
// TODO Manage Collection
// BaseConcessioneDV refConcessione = layerObject.getSourceConcessione();
String nameConcessione = StringUtil.ellipsize("TODO : UCD", 40);
com.google.gwt.user.client.ui.Label labelConcessione = new com.google.gwt.user.client.ui.Label(nameConcessione);
labelConcessione.setTitle("TODO : PROJECT");
getElement().getStyle().setMarginTop(5, Unit.PX);
getElement().getStyle().setMarginBottom(10, Unit.PX);
this.getElement().addClassName("dand-layer");
@ -154,57 +87,20 @@ public class DragDropLayer extends FlowPanel {
RangeSlider rs = new RangeSlider(applicationBus, layerItem);
rs.getElement().addClassName("range-slider");
// FlexTable ft = new FlexTable();
// ft.setWidget(0, 0, draggableButton);
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");
imgLayerVisible.getElement().addClassName("layer-visibility-st");
imgLayerInvisible.getElement().addClassName("layer-visibility-st");
imgLocate.setWidth(_22PX);
imgLocate.setHeight(_22PX);
imgLocateNone.setWidth(_22PX);
imgLocateNone.setHeight(_22PX);
imgLocate.getElement().addClassName("layer-visibility-st");
imgLocateNone.getElement().addClassName("layer-visibility-st");
setLocateEnabledButtonImage();
setLayerVisibilityButtonImage();
VerticalPanel vp = new VerticalPanel();
VerticalPanel vpInner = new VerticalPanel();
HorizontalPanel hp0 = new HorizontalPanel();
HorizontalPanel hpFunct = new HorizontalPanel();
vpInner.getElement().getStyle().setMarginLeft(47, Unit.PX);
hp0.add(draggableButton);
labelProject.getElement().getStyle().setMarginLeft(10, Unit.PX);
labelProject.getElement().getStyle().setFontWeight(FontWeight.BOLD);
hp0.add(labelProject);
hpFunct.add(buttonLayerVisibility);
hpFunct.add(buttonLocate);
hpFunct.add(loaderIcon);
setVisibleLoaderFeatures(false, null);
if(layerObject.getProjectDV().getTemporalReference()!=null) {
TemporalReferenceDV tempRef = layerObject.getProjectDV().getTemporalReference();
if(tempRef.getStart()!=null || tempRef.getEnd()!=null)
vpInner.add(new HTML(ProjectUtil.toHTMLCode(tempRef)));
}
vpInner.add(labelLayerName);
// vpInner.add(new SimplePanel(rs));
vp.add(hp0);
hpFunct.getElement().getStyle().setMarginTop(5, Unit.PX);
vpInner.add(hpFunct);
vpInner.add(new SimplePanel(rs));
vp.add(vpInner);
add(vp);
// add(ft);
// 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);
buttonLayerVisibility.addClickHandler(new ClickHandler() {
@ -213,48 +109,20 @@ public class DragDropLayer extends FlowPanel {
public void onClick(ClickEvent event) {
layerVisibility = !layerVisibility;
setLayerVisibilityButtonImage();
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY, layerItem,
layerObject);
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.VISIBILITY,
layerItem);
dae.setVisibility(layerVisibility);
applicationBus.fireEvent(dae);
}
});
buttonLocate.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
locateEnabled = !locateEnabled;
setLocateEnabledButtonImage();
DoActionOnDetailLayersEvent dae = new DoActionOnDetailLayersEvent(DO_LAYER_ACTION.LOCATE_LAYER,
layerItem, layerObject);
dae.setUIEventSource(INSTANCE);
setVisibleLoaderFeatures(true, null);
applicationBus.fireEvent(dae);
}
});
}
private void setLayerVisibilityButtonImage() {
buttonLayerVisibility.getElement().removeAllChildren();
if (layerVisibility) {
buttonLayerVisibility.getElement().appendChild(imgLayerVisible.getElement());
buttonLayerVisibility.setTitle("Hide the layer");
} else {
buttonLayerVisibility.getElement().appendChild(imgLayerInvisible.getElement());
buttonLayerVisibility.setTitle("Show the layer");
}
}
private void setLocateEnabledButtonImage() {
buttonLocate.getElement().removeAllChildren();
if (locateEnabled) {
buttonLocate.getElement().appendChild(imgLocate.getElement());
buttonLocate.setTitle("Unselect the layer features");
} else {
buttonLocate.getElement().appendChild(imgLocateNone.getElement());
buttonLocate.setTitle("Highlight the layer features");
}
}
@ -320,7 +188,7 @@ public class DragDropLayer extends FlowPanel {
tree.insert(source, targetIndex);
// target.setState(true);
DoActionOnDetailLayersEvent actionSwapLayers = new DoActionOnDetailLayersEvent(
DO_LAYER_ACTION.SWAP, layerItem, layerObject);
DO_LAYER_ACTION.SWAP, layerItem);
SwapLayer swapLS = new DoActionOnDetailLayersEvent.SwapLayer(dragging.getLayerItem(),
sourceIndex);
SwapLayer swapLT = new DoActionOnDetailLayersEvent.SwapLayer(draggingTarget.getLayerItem(),
@ -339,17 +207,4 @@ public class DragDropLayer extends FlowPanel {
return layerItem;
}
/**
* Sets the visible loader features.
*
* @param bool the bool
* @param msg the msg
*/
public void setVisibleLoaderFeatures(boolean bool, String msg) {
loaderIcon.setVisible(bool);
if(msg!=null)
loaderIcon.setText(msg);
}
}

View File

@ -1,8 +1,7 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dandd;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerConstants;
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.layers.DoActionOnDetailLayersEvent;
import org.gcube.portlets.user.geoportaldataviewer.client.events.layers.DoActionOnDetailLayersEvent.DO_LAYER_ACTION;
import org.gcube.portlets.user.geoportaldataviewer.shared.gis.LayerItem;
import com.google.gwt.core.client.GWT;
@ -39,8 +38,8 @@ public class RangeSlider extends Composite {
sliderId = "slider-" + Random.nextInt();
theSlider.addClassName("slider");
theSlider.setId(sliderId);
theSlider.setTitle("Set opacity of the layer");
theSlider.setPropertyObject("value", GeoportalDataViewerConstants.INITIAL_LAYER_OPACITY*100);
theSlider.setTitle("Set opacity of "+layer.getName());
bindEvents();
}
@ -55,11 +54,11 @@ public class RangeSlider extends Composite {
if (Event.ONMOUSEUP == event.getTypeInt()) {
GWT.log("Event.ONMOUSEUP");
DoActionOnDetailLayersEvent actionChangeOpacity = new DoActionOnDetailLayersEvent(
DO_LAYER_ACTION.OPACITY, layer, null);
DO_LAYER_ACTION.OPACITY, layer);
int value = Integer.parseInt((String) theSlider.getPropertyObject("value"));
// GWT.log("opacity int value: "+value);
double opacity = (double) ((double) value / 100);
GWT.log("opacity double value: " + opacity);
//GWT.log("opacity int value: "+value);
double opacity = (double) ((double) value/100);
GWT.log("opacity double value: "+opacity);
actionChangeOpacity.setOpacity(opacity);
applicationBus.fireEvent(actionChangeOpacity);
}

View File

@ -1,6 +1,6 @@
package org.gcube.portlets.user.geoportaldataviewer.client.ui.dialogs;
import org.gcube.application.geoportalcommon.shared.GeoportalItemReferences;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.PublicLink;
import org.gcube.portlets.user.geoportaldataviewer.client.GeoportalDataViewerServiceAsync;
import org.gcube.portlets.user.geoportaldataviewer.client.util.LoaderIcon;
@ -117,7 +117,7 @@ public class DialogShareableLink extends Composite {
// @UiField
// HTMLPanel panelFieldsContainer;
private GeoportalItemReferences geonItemRef;
private GeoNaItemRef geonItemRef;
private String fileVersion;
@ -149,7 +149,7 @@ public class DialogShareableLink extends Composite {
* @param item the item
* @param version the version
*/
public DialogShareableLink(GeoportalItemReferences item, String version) {
public DialogShareableLink(GeoNaItemRef item, String version) {
initWidget(uiBinder.createAndBindUi(this));
this.geonItemRef = item;
@ -396,7 +396,7 @@ public class DialogShareableLink extends Composite {
private native void copyToClipboard(String myDivId) /*-{
var copyText = $doc.getElementById(myDivId);
//console.log("text copied is :" + copyText.value);
console.log("text copied is :" + copyText.value);
copyText.select();
//For mobile devices
copyText.setSelectionRange(0, 99999);
@ -409,12 +409,12 @@ public class DialogShareableLink extends Composite {
*
* @param item the item
*/
private void loadAndShowPublicLinksForItem(GeoportalItemReferences item) {
private void loadAndShowPublicLinksForItem(GeoNaItemRef item) {
GeoportalDataViewerServiceAsync.Util.getInstance().getPublicLinksFor(item, new AsyncCallback<GeoportalItemReferences>() {
GeoportalDataViewerServiceAsync.Util.getInstance().getPublicLinksFor(item, new AsyncCallback<GeoNaItemRef>() {
@Override
public void onSuccess(GeoportalItemReferences itemReferences) {
public void onSuccess(GeoNaItemRef itemReferences) {
showLoadingIcon(false);
openPublicLink = itemReferences.getOpenLink();
restrictedPublicLink = itemReferences.getRestrictedLink();

Some files were not shown because too many files have changed in this diff Show More