initial import

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/speciesdiscovery@70758 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-03-04 13:38:25 +00:00
parent 5653be108c
commit f06fafbe15
1291 changed files with 44580 additions and 0 deletions

35
.classpath Normal file
View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/species-discovery-3.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<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.6">
<attributes>
<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="output" path="target/species-discovery-3.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

59
.project Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>speciesdiscovery</name>
<comment>speciesdiscovery project</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
</natures>
</projectDescription>

15
.settings/.jsdtscope Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp" />
<classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER" />
<classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true" />
</attributes>
</classpathentry>
<classpathentry kind="con"
path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary" />
<classpathentry kind="output" path="" />
</classpath>

View File

@ -0,0 +1,3 @@
#Thu Jun 16 10:18:26 CEST 2011
eclipse.preferences.version=1
filesCopiedToWebInfLib=

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/home/backup-old-home/francesco-mangiacrapa/workspace/speciesdiscovery/target/species-discovery-3.0.0-SNAPSHOT
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

View File

@ -0,0 +1,5 @@
#Thu Jun 16 11:14:17 CEST 2011
eclipse.preferences.version=1
entryPointModules=
filesCopiedToWebInfLib=gwt-servlet.jar
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBWy13YXIgc3JjL21haW4vd2ViYXBwXV0+PC9leHRyYS1hcmdzPjx2bS1hcmdzPjwhW0NEQVRBWy1YbXg1MTJtXV0+PC92bS1hcmdzPjxlbnRyeS1wb2ludC1tb2R1bGU+Y29tLmNvbXBhbnkuU29tZU1vZHVsZTwvZW50cnktcG9pbnQtbW9kdWxlPjwvZ3d0LWNvbXBpbGUtc2V0dGluZ3M+

View File

@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="${module}">
<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="/src/main/java"/>
<dependent-module archiveName="gis-viewer-3.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gis-viewer/gis-viewer">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="gcube-gis-viewer-2.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/gcube-gis-viewer/gcube-gis-viewer">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
<property name="context-root" value="species-discovery"/>
</wb-module>
</project-modules>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="2.5"/>
</faceted-project>

View File

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

View File

@ -0,0 +1,9 @@
#Thu Sep 02 10:42:12 CEST 2010
activeProfiles=
eclipse.preferences.version=1
fullBuildGoals=process-test-resources
includeModules=false
resolveWorkspaceProjects=true
resourceFilterGoals=process-resources resources\:testResources
skipCompilerPlugin=true
version=1

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/speciesdiscovery/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/GwtTestSpeciesDiscovery.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.user.speciesdiscovery.client.GwtTestSpeciesDiscovery"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="speciesdiscovery"/>
</launchConfiguration>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gwt.eclipse.core.launch.gwtJUnit">
<stringAttribute key="com.google.gwt.eclipse.core.LOG_LEVEL" value="INFO"/>
<booleanAttribute key="com.google.gwt.eclipse.core.NOT_HEADLESS" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.OUT_DIR" value="www-test"/>
<booleanAttribute key="com.google.gwt.eclipse.core.STANDARDS_MODE" value="false"/>
<stringAttribute key="com.google.gwt.eclipse.core.STYLE" value="OBFUSCATED"/>
<stringAttribute key="com.google.gwt.eclipse.core.WEB_MODE" value="true"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/speciesdiscovery/src/test/java/org/gcube/portlets/user/speciesdiscovery/client/GwtTestSpeciesDiscovery.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.gcube.portlets.user.speciesdiscovery.client.GwtTestSpeciesDiscovery"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="speciesdiscovery"/>
</launchConfiguration>

2
distro/INSTALL Normal file
View File

@ -0,0 +1,2 @@
Use the respective war file of this component

7
distro/LICENSE Normal file
View File

@ -0,0 +1,7 @@
gCube System - License
------------------------------------------------------------
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
The software and documentation is provided by its authors/distributors "as is" and no expressed or
implied warranty is given for its use, quality or fitness for a particular case.

5
distro/MAINTAINERS Normal file
View File

@ -0,0 +1,5 @@
Mantainers
-------
* Federico De Faveri (federico.defaveri@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
* Francesco Mangiacrapa (francesco.mangiacrapa@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"

51
distro/README Normal file
View File

@ -0,0 +1,51 @@
The gCube System - Species Discovery
------------------------------------------------------------
This work is partially funded by the European Commission in the
context of the D4Science project (www.d4science.eu), under the 1st call of FP7 IST priority.
Authors
-------
* Federico De Faveri (federico.defaveri@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
* Francesco Mangiacrapa (francesco.mangiacrapa@isti.cnr.it), CNR Pisa,
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo".
Version and Release Date
------------------------
v. 3.0.0
Description
-----------
The Species Discovery lets the users discovery species information from the Species Service.
Download information
--------------------
Source code is available from SVN:
https://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/SpeciesDiscovery
Binaries can be downloaded from:
n/a
Documentation
-------------
Documentation is available on-line from the Projects Documentation Wiki:
https://gcube.wiki.gcube-system.org/gcube/index.php
Licensing
---------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

20
distro/changelog.xml Normal file
View File

@ -0,0 +1,20 @@
<ReleaseNotes>
<Changeset component="org.gcube.application.speciesmanagement.speciesdiscovery.2-3-0" date="17-01-2013">
<Change>Ticket #986: Species Occurrence jobs / Re-submit job and "info"</Change>
<Change>Ticket #1002: SPD portlet persistence refactoring</Change>
</Changeset>
<Changeset component="org.gcube.application.speciesmanagement.speciesdiscovery.2-2-0" date="30-11-2012">
<Change>Ticket #508: Implementation of requirements resulting from ticket #508</Change>
</Changeset>
<Changeset component="org.gcube.application.speciesmanagement.speciesdiscovery.2-0-0" date="13-09-2012">
<Change>Ticket #81: Implementation of requirements resulting from user feedback</Change>
<Change>Dynamic clustering of result set items</Change>
<Change>Revised the occurrence points visualization strategy through the GIS Viewer</Change>
</Changeset>
<Changeset component="org.gcube.application.speciesmanagement.speciesdiscovery.1-0-1" date="23-07-2012">
<Change>Fixed 447: Map generation fails in Species Discovery Portlet</Change>
</Changeset>
<Changeset component="org.gcube.application.speciesmanagement.speciesdiscovery.1-0-0" date="04-05-2012">
<Change>First release</Change>
</Changeset>
</ReleaseNotes>

48
distro/descriptor.xml Normal file
View File

@ -0,0 +1,48 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>INSTALL</include>
<include>MAINTAINERS</include>
<include>changelog.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
<fileSet>
<directory>target/apidocs</directory>
<outputDirectory>/${artifactId}/doc/api</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<fileMode>755</fileMode>
</fileSet>
</fileSets>
<files>
<file>
<source>${distroDirectory}/profile.xml</source>
<outputDirectory>./</outputDirectory>
<filtered>true</filtered>
</file>
<file>
<source>target/${build.finalName}.war</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
<file>
<source>${distroDirectory}/svnpath.txt</source>
<outputDirectory>/${artifactId}</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>

25
distro/profile.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>${description}</Description>
<Class>PortletUser</Class>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>target/${build.finalName}.war</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

1
distro/svnpath.txt Normal file
View File

@ -0,0 +1 @@
${scm.url}

381
pom.xml Normal file
View File

@ -0,0 +1,381 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<relativePath />
</parent>
<!-- USED FROM ECLIPSELINK -->
<repositories>
<repository>
<id>eclipselink</id>
<url>http://maven.research-infrastructures.eu:8081/nexus/content/repositories/eclipselink/</url>
</repository>
</repositories>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>species-discovery</artifactId>
<packaging>war</packaging>
<version>3.0.0-SNAPSHOT</version>
<name>gCube Species Discovery</name>
<description>
gCube Species Discovery Portlet lets the users discovery species information from the Species Service.
</description>
<scm>
<connection>scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</connection>
<developerConnection>scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</developerConnection>
<url>http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/${project.artifactId}</url>
</scm>
<properties>
<!-- Convenience property to set the GWT version -->
<gwtVersion>2.4.0</gwtVersion>
<distroDirectory>distro</distroDirectory>
<!-- GWT needs at least java 1.6 -->
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<!-- SPD service dependecies -->
<dependency>
<groupId>org.gcube.data.spd</groupId>
<artifactId>spd-client-library</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.data.spd</groupId>
<artifactId>spql-parser</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>csv4j</artifactId>
<version>[1.1.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.data.spd</groupId>
<artifactId>spd-model</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>discovery-client</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- Eclipselink dependencies -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.4.0</version>
</dependency>
<!-- Storage dependecies -->
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-wrapper</artifactId>
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-core</artifactId>
<version>[1.0.1-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- WSLT dependencies -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-light-tree</artifactId>
<version>[2.9.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<!-- GisViewer dependecies -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gis-viewer</artifactId>
<version>[3.0.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-gis-viewer</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>org.gwtopenmaps.openlayers</groupId>
<artifactId>gwt-openlayers-client</artifactId>
<version>0.6</version>
<scope>provided</scope>
</dependency>
<!-- GWT-LOG -->
<dependency>
<groupId>com.allen-sauer.gwt.log</groupId>
<artifactId>gwt-log</artifactId>
<version>3.1.7</version>
</dependency>
<!-- H2 Database -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.166</version>
<scope>provided</scope>
</dependency>
<!-- This dependency is needed and is need on TOP to use GWT UI BInder
without old Xerces version of gCore complaining -->
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwtVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sencha.gxt</groupId>
<artifactId>gxt</artifactId>
<version>2.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>gcf</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>gcube-widgets</artifactId>
<version>[1.4.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>custom-portal-handler</artifactId>
<version>[1.2.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.applicationsupportlayer</groupId>
<artifactId>aslcore</artifactId>
<version>[3.2.0-SNAPSHOT, 4.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portal</groupId>
<artifactId>social-networking-library</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>[6.0.0-SNAPSHOT, 7.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-resource-link-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>home-library</artifactId>
<version>[4.3.0-SNAPSHOT, 5.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>home-library-jcr</artifactId>
<version>[1.3.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<version>[1.3.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>6.0.6</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>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
<plugins>
<!-- GWT Maven Plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.4.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test</goal> -->
</goals>
</execution>
</executions>
<!-- Plugin configuration. There are many available options, see gwt-maven-plugin
documentation at codehaus.org -->
<configuration>
<runTarget>WorkspacePortlet.html</runTarget>
<hostedWebapp>${webappDirectory}</hostedWebapp>
</configuration>
</plugin>
<!-- Copy static web files before executing gwt:run -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
</executions>
<configuration>
<webappDirectory>${webappDirectory}</webappDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-profile</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target</outputDirectory>
<resources>
<resource>
<directory>${distroDirectory}</directory>
<filtering>true</filtering>
<includes>
<include>profile.xml</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="SPD_PERSISTENCE_FACTORY" transaction-type="RESOURCE_LOCAL">
<class>org.gcube.portlets.user.speciesdiscovery.shared.CommonName</class>
<class>org.gcube.portlets.user.speciesdiscovery.shared.Taxon</class>
<class>org.gcube.portlets.user.speciesdiscovery.shared.ResultRow</class>
<class>org.gcube.portlets.user.speciesdiscovery.shared.ItemParameter</class>
<class>org.gcube.portlets.user.speciesdiscovery.shared.Occurrence</class>
<class>org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyRow</class>
<class>org.gcube.portlets.user.speciesdiscovery.shared.OccurrencesJob</class>
<class>org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyJob</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.ddl-generation.output-mode"
value="database" />
</properties>
</persistence-unit>
</persistence>

View File

@ -0,0 +1,115 @@
package org.gcube.portlets.user.speciesdiscovery.client;
public final class ConstantsSpeciesDiscovery {
//USED IN MODEL CLASS
public static final String ID = "id";
public static final String NAME = "name";
public static final String ISLEAF = "isLeaf";
public static final String BASETAXONID = "BaseTaxonID";
public static final String BASETAXONNAME= "BaseTaxon";
public static final String COUNTOF = "CountOf";
public static final String RANK = "Rank";
// public static final String GROUPEDIDLIST = "GroupedIDList";
//USED IN CLASSIFICATION FILTER
public static final String BIOTACLASSID = "BiotaID";
public static final String BIOTACLASS = "Biota";
public static final String ANIMALIACLASSID = "AnimaliaID";
public static final String ANIMALIACLASS = "Animalia";
public static final String PLANTEACLASSID = "PlanteaID";
public static final String PLANTEACLASS = "Plantea";
public static final String UNKNOWN = "Unknown";
public static final String UNKNOWNID = "UnknownID";
//USED IN GRID
public static final String NORESULTS = "No results";
public static final String NONE = "None";
public static final String FILTER = "Filter: ";
public static final String REMOVEFILTERTOOLTIP = "Remove current filter";
public static final String VIEWDETAILS = "View Details (Only selected)";
public static final String SELECTALL = "Check All Rows";
public static final String DESELECTALL = "Uncheck All Rows";
//USED IN CLASSIFICATION FILTER
// public static final String[] MAIN_TAXONOMIC_RANK = new String[]{"kingdom", "phylum", "class", "order", "family", "genus", "species"};
public static final String GROUPBYRANK = "Group results by";
public static final String LOADINGSTYLE = "x-mask-loading";
public static final String SORTMESSAGE = "Sort filter in alphabetical order (from A to Z)";
public static final String REQUEST_DATA = "request data...";
//USED IN SEARCH BORDER LAYPUT PANEL
public final static int JOBPOLLINGMILLISECONDS = 20000;
//USED IN SEARCH FORM PANEL
protected static final String OCCURENCES = "Occurences";
protected static final String CLASSIFICATION = "Classification";
protected static final String COMMON_NAME = "Common name";
protected static final String SCIENTIFIC_NAME = "Scientific name";
//USED IN ADAVANCED FILTERT
public static final String AVAILABLEFILTERBOUND = "Bounds filters (lower-upper) are available with following plug-in";
public static final String AVAILABLEFILTERDATE = "Date filter (from-to) is available with following plug-in";
public static final String AVAILABLEDATASOURCES = "Occurence points and classification search are available with following plug-in";
//USED IN GISVIEWER
public static final String LME = "lme";
public static final String FAOAREA = "faoarea";
public static final String EEZALL = "eezall";
public static final String SST_AN_MEAN = "sstAnMean";
public static final String SALINITY_MEAN = "salinityMean";
public static final String PRIM_PROD_MEAN = "primProdMean";
public static final String ENVIRONMENTS = "environments";
public static final String DEPTH_MEAN_ANNUAL = "DepthMeanAnnual";
public static final String WORLD_BORDERS = "worldborders";
//ELAPSED TIME FORMATTER
public static final String TIME_ZONE_UTC = "UTC";
public static final String TIMEFORMAT_HH_MM_SS = "HH:mm:ss";
//USED IN SERVER/SHARED PACKAGE
public static final String NULL = "null";
public static final String UNDEFINED = "Undefined";
public static final String NOT_FOUND = "not found";
public static int LIMIT_ITEM_DETAILS = 100;
//USED IN VIEW DETAILSWINDOW
public static final String THE_MAX_NUMBER_OF_ITEMS_DISPLAYABLE_IS = "The max number of items displayable is ";
public static final String ROW_LIMIT_REACHED = "Row limit reached";
public static final String SAVE_OCCURENCES_POINTS_FROM_SELECTED_RESULTS = "Save occurences points from selected results.";
public static final String SAVES_IN_CSV_FILE_FORMAT = "Saves in CSV file format";
public static final String CSV = "CSV";
public static final String SAVES_IN_DARWIN_CORE_FILE_FORMAT = "Saves in Darwin Core file format";
public static final String DARWIN_CORE = "Darwin Core";
public static final String OPEN_MODELLER_BY_DATA_SOURCE = "openModeller CSV (by Data Source)";
public static final String OPEN_MODELLER = "openModeller CSV";
public static final String PLAIN_CSV_BY_DATA_SOURCE = "plain CSV (by Data Source)";
public static final String PLAIN_CSV = "plain CSV";
public static final String SAVE_OCCURRENCES = "Save Occurrences";
public static final String SHOW_IN_GIS_VIEWER = "Show in Gis Viewer";
// public static final String SAVES_IN_DARWIN_CORE_ARCHIVE_FORMAT = "Saves in Darwin Core Archive format";
// public static final String DARWIN_CORE_ARCHIVE = "Darwin Core Archive";
public static final String SAVE_TAXONOMY_ITEMS = "Save Taxonomy Items";
public final static String DETAILS = "Details";
public final static String OCCURRENCEPOINTS = "Occurrence points";
public final static int SCHEDULE_MILLIS_COUNT_OCCURRENCES = 2500;
public static final int PAGE_SIZE = 25;
public final static String DEFAULTLANGUAGE = "English";
public final static String BYSCIENTIFICNAME = "by scientific name";
public final static String SCIENTIFICNAME = "Scientific name";
public final static String BYCOMMONNAME = "by common name";
public static final String CAN_NO_BE_RE_SUBMITTED_UNTIL_IT_HAS_COMPLETED = "can no be re-submitted until it has completed!";
public static final String MESSAGE_CONFIRM_DELETE_JOB = "Are you sure you want to delete the job";
public static final String CONFIRM_DELETE = "Confirm delete";
public static final String ALERT = "Alert";
public static final String IS_NOT_COMPLETED = " is not completed!";
//USED IN TABLE FOR TAXONOMY ROW
public static final String SAVES_IN_DARWIN_CORE_ARCHIVE_FORMAT = "Saves in Darwin Core Archive format";
public static final String DARWIN_CORE_ARCHIVE = "Darwin Core Archive";
public static final String SAVES_TAXONOMY_CHILDREN_FROM_RESULT = "Saves taxonomy children from result.";
public static final String SAVE_TAXONOMY_CHILDREN = "Save Taxonomy Children";
}

View File

@ -0,0 +1,120 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.util.GridField;
import org.gcube.portlets.user.speciesdiscovery.client.util.OccurencesGridFields;
import org.gcube.portlets.user.speciesdiscovery.client.util.Util;
import org.gcube.portlets.user.speciesdiscovery.client.util.stream.DataSourceManager;
import org.gcube.portlets.user.speciesdiscovery.client.util.stream.StreamPagingLoader;
import org.gcube.portlets.user.speciesdiscovery.client.util.stream.StreamPagingToolBar;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.allen_sauer.gwt.log.client.Log;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.widget.Window;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.user.client.rpc.AsyncCallback;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class OccurrencesWindow extends Window {
protected static final String OCCURRENCE_POINTS = "Occurrence points";
protected static final int PAGE_SIZE = 20;
protected StreamPagingLoader loader;
protected int count = 0;
private DataSourceManager dataSourceManager;
public OccurrencesWindow()
{
setHeading(OCCURRENCE_POINTS);
setLayout(new FitLayout());
setModal(true);
setResizable(true);
setSize(1200, 500);
this.dataSourceManager = DataSourceManager.getInstance();
List<ColumnConfig> config = new ArrayList<ColumnConfig>();
for (GridField field:OccurencesGridFields.values()) config.add(Util.createColumnConfig(field, 150));
final ColumnModel cm = new ColumnModel(config);
initLoader();
Grid<ModelData> grid = new Grid<ModelData>(loader.getStore(), cm);
grid.setBorders(true);
StreamPagingToolBar toolBar = new StreamPagingToolBar();
toolBar.bind(loader);
setBottomComponent(toolBar);
add(grid);
}
protected void initLoader()
{
loader = new StreamPagingLoader(PAGE_SIZE);
loader.setDataSource(this.dataSourceManager.getDataSourceByResultType(SpeciesCapability.OCCURRENCESPOINTS));
}
public void loadOccurences()
{
Log.trace("Loading occurrences");
count = 0;
dataSourceManager.setExpectedOccurencePoints(count);
SpeciesDiscovery.taxonomySearchService.retrieveOccurencesFromSelection(new AsyncCallback<Integer>() {
@Override
public void onSuccess(Integer expectedPoints) {
Log.trace("Expected points: "+expectedPoints);
dataSourceManager.setExpectedOccurencePoints(expectedPoints);
count = expectedPoints;
loader.startLoading(true);
}
@Override
public void onFailure(Throwable caught) {
System.err.println("Error getting occurences");
}
});
}
/**
* {@inheritDoc}
*/
@Override
protected void onHide() {
super.onHide();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
loader.reset();
}
});
}
}

View File

@ -0,0 +1,161 @@
package org.gcube.portlets.user.speciesdiscovery.client;
import org.gcube.portlets.user.speciesdiscovery.client.event.LoadDataSourceEvent;
import org.gcube.portlets.user.speciesdiscovery.client.job.SpeciesJobPanel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import com.google.gwt.user.client.Timer;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SearchBorderLayoutPanel extends ContentPanel {
/**
* This is a singleton
*/
private static SearchBorderLayoutPanel instance;
private BorderLayoutData northData;
private BorderLayoutData centerData;
private BorderLayoutData westData;
private BorderLayoutData southData;
private final BorderLayout layout = new BorderLayout();
private static SearchController searchController;
private SpeciesSearchFormPanel speciesNorthPanel;
private SpeciesResultsPanelCardLayout speciesCenterPanel;
private SpeciesResultFilterAccordionPanel speciesWestPanel;
private SpeciesJobPanel speciesSouthPanel;
private final EventBus eventBus;
public static final int DEFAULTNORTHHEIGHT = 77;
public static synchronized SearchBorderLayoutPanel getInstance() {
if (instance == null)
instance = new SearchBorderLayoutPanel();
return instance;
}
private SearchBorderLayoutPanel() {
setLayout(layout);
setHeaderVisible(false);
eventBus = new SimpleEventBus();
searchController = new SearchController(eventBus, this);
speciesNorthPanel = new SpeciesSearchFormPanel(eventBus);
speciesSouthPanel = new SpeciesJobPanel(eventBus);
//TODO REMOVE searchController.getStreamPagingLoader()
speciesCenterPanel = new SpeciesResultsPanelCardLayout(eventBus, searchController.getStreamPagingLoader(), searchController);
northData = new BorderLayoutData(LayoutRegion.NORTH, DEFAULTNORTHHEIGHT);
northData.setCollapsible(false);
northData.setFloatable(false);
northData.setHideCollapseTool(true);
northData.setSplit(false);
westData = new BorderLayoutData(LayoutRegion.WEST, 250, 300, 350);
westData.setSplit(true);
westData.setCollapsible(true);
westData.setMargins(new Margins(0,0,0,0));
centerData = new BorderLayoutData(LayoutRegion.CENTER);
centerData.setMargins(new Margins(0));
southData = new BorderLayoutData(LayoutRegion.SOUTH, 34, 34, 34);
// southData = new BorderLayoutData(LayoutRegion.SOUTH, 150, 250, 250);
// southData.setSplit(true);
// southData.setCollapsible(true);
southData.setMargins(new Margins(0,0,0,0));
speciesWestPanel = new SpeciesResultFilterAccordionPanel(eventBus, searchController.getStreamPagingLoader());
// eventBus.fireEvent(new LoadDataSourceEvent()); //load Data source event is fired
add(speciesNorthPanel, northData);
add(speciesCenterPanel, centerData);
add(speciesWestPanel, westData);
add(speciesSouthPanel, southData);
initApplication();
}
private void initApplication(){
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
eventBus.fireEvent(new LoadDataSourceEvent()); //load Data source event is fired
SearchController.excecuteGetJobs(SearchResultType.TAXONOMY_ITEM, false);
SearchController.excecuteGetJobs(SearchResultType.OCCURRENCE_POINT, false);
pollSpeciesJobs(ConstantsSpeciesDiscovery.JOBPOLLINGMILLISECONDS);
}
});
}
public static void pollSpeciesJobs(int milliseconds){
Timer timer = new Timer() {
@Override
public void run()
{
SearchController.excecuteGetJobs(SearchResultType.TAXONOMY_ITEM, false);
SearchController.excecuteGetJobs(SearchResultType.OCCURRENCE_POINT, false);
}
};
timer.scheduleRepeating(milliseconds);
}
public void updateNorthSize(int height){
northData.setSize(height);
layout(true);
}
public SpeciesSearchFormPanel getSpeciesNorthPanel() {
return speciesNorthPanel;
}
public SpeciesResultsPanelCardLayout getSpeciesCenterPanel() {
return speciesCenterPanel;
}
public SpeciesResultFilterAccordionPanel getSpeciesWestPanel() {
return speciesWestPanel;
}
public SpeciesJobPanel getSpeciesSouthPanel() {
return speciesSouthPanel;
}
}

View File

@ -0,0 +1,95 @@
package org.gcube.portlets.user.speciesdiscovery.client;
import org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchService;
import org.gcube.portlets.user.speciesdiscovery.client.rpc.TaxonomySearchServiceAsync;
import com.allen_sauer.gwt.log.client.Log;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.google.gwt.core.client.EntryPoint;
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.event.logical.shared.ResizeEvent;
import com.google.gwt.event.logical.shared.ResizeHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.RootPanel;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class SpeciesDiscovery implements EntryPoint {
public static final String SPECIES_DISCOVERY_DIV = "SpeciesDiscovery";
public static TaxonomySearchServiceAsync taxonomySearchService = GWT.create(TaxonomySearchService.class);
protected ContentPanel mainPanel;
/**
* This is the entry point method.
*/
public void onModuleLoad() {
Log.setUncaughtExceptionHandler();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
onModuleLoad2();
Window.addResizeHandler(new ResizeHandler() {
@Override
public void onResize(ResizeEvent event) {
updateSize();
}
});
}
});
}
public void onModuleLoad2() {
RootPanel root = RootPanel.get(SPECIES_DISCOVERY_DIV);
createSearchPanel();
if (root!=null){
GWT.log("SPECIES_DISCOVERY_DIV div found, we are on portal");
updateSize();
root.add(mainPanel);
} else{
GWT.log("SPECIES_DISCOVERY_DIV div not found, we are out of the portal");
//mainPanel.setWidth("100%");
mainPanel.setHeight(600);
// mainPanel.setWidth(930);
RootPanel.get().add(mainPanel);
}
}
protected void createSearchPanel()
{
mainPanel = SearchBorderLayoutPanel.getInstance();
}
public void updateSize() {
GWT.log("Resizing");
RootPanel discovery = RootPanel.get(SPECIES_DISCOVERY_DIV);
int topBorder = discovery.getAbsoluteTop();
int leftBorder = discovery.getAbsoluteLeft();
int rightScrollBar = 17;
int rootHeight = Window.getClientHeight() - topBorder - 34;
int rootWidth = Window.getClientWidth() - 2* leftBorder - rightScrollBar;
GWT.log("new size "+rootWidth+"x"+rootHeight);
mainPanel.setPixelSize(rootWidth, rootHeight);
}
}

View File

@ -0,0 +1,41 @@
package org.gcube.portlets.user.speciesdiscovery.client;
import org.gcube.portlets.user.speciesdiscovery.client.filterresult.ResultFilterPanelManager;
import org.gcube.portlets.user.speciesdiscovery.client.util.stream.StreamPagingLoader;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.layout.AccordionLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.event.shared.EventBus;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SpeciesResultFilterAccordionPanel extends ContentPanel {
public final String headerFilterResultPanel = "Filter your results";
private ResultFilterPanelManager resultFilterManager = ResultFilterPanelManager.getInstance();
public SpeciesResultFilterAccordionPanel(EventBus eventBus, StreamPagingLoader streamPagingLoader) {
init();
resultFilterManager.bind(streamPagingLoader);
resultFilterManager.setEventBus(eventBus);
}
private void init() {
setHeaderVisible(true);
setHeading(headerFilterResultPanel);
setBodyBorder(false);
setLayout(new AccordionLayout());
// setIcon(Resources.ICONS.accordion());
for (ContentPanel panel : resultFilterManager.getListResultFilterPanel()) {
panel.setAnimCollapse(false);
panel.setLayout(new FitLayout());
add(panel);
}
}
}

View File

@ -0,0 +1,147 @@
package org.gcube.portlets.user.speciesdiscovery.client;
import org.gcube.portlets.user.speciesdiscovery.client.gridview.ResultRowResultsPanel;
import org.gcube.portlets.user.speciesdiscovery.client.gridview.TaxonomyRowResultsPanel;
import org.gcube.portlets.user.speciesdiscovery.client.util.stream.StreamPagingLoader;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.CardLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.Element;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SpeciesResultsPanelCardLayout extends LayoutContainer {
private CardLayout cardLayout = new CardLayout();
private static SpeciesResultsPanelCardLayout instance;
private ContentPanel activePanel = null;
private ResultRowResultsPanel resultRowPanel;
private TaxonomyRowResultsPanel taxonomyRowPanel;
private SpeciesCapability currentSelectedCapability;
public static SpeciesResultsPanelCardLayout getInstance() {
return instance;
}
public SpeciesResultsPanelCardLayout(final EventBus eventBus, StreamPagingLoader loader, SearchController searchController) {
this.resultRowPanel = new ResultRowResultsPanel(eventBus, loader,searchController);
this.taxonomyRowPanel = new TaxonomyRowResultsPanel(eventBus, loader);
}
@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
setLayout(new FitLayout());
ContentPanel cp = new ContentPanel();
cp.setHeaderVisible(false);
cp.setLayout(cardLayout);
cp.add(resultRowPanel);
cp.add(taxonomyRowPanel);
cardLayout.setActiveItem(resultRowPanel);
activePanel = resultRowPanel;
add(cp);
};
public void updateCurrentGridView(SpeciesCapability capability) {
this.currentSelectedCapability = capability;
switchGridPanel();
}
private void switchGridPanel(){
switch (currentSelectedCapability) {
case RESULTITEM:
activePanel = resultRowPanel;
resultRowPanel.resetStore();
cardLayout.setActiveItem(resultRowPanel);
break;
case TAXONOMYITEM:
activePanel = taxonomyRowPanel;
taxonomyRowPanel.resetStore();
cardLayout.setActiveItem(taxonomyRowPanel);
break;
}
}
public void activeToolBarButtons(boolean b) {
if(activePanel.equals(resultRowPanel))
resultRowPanel.activeToolBarButtons(b);
else if(activePanel.equals(taxonomyRowPanel))
taxonomyRowPanel.activeToolBarButtons(b);
}
public void setFilterActive(boolean b, String filterValue) {
if(activePanel.equals(resultRowPanel))
resultRowPanel.setFilterActive(b, filterValue);
else if(activePanel.equals(taxonomyRowPanel))
taxonomyRowPanel.setFilterActive(b, filterValue);
}
public void activeBtnShowOnlySelected(boolean b) {
if(activePanel.equals(resultRowPanel))
resultRowPanel.activeBtnShowOnlySelected(b);
else if(activePanel.equals(taxonomyRowPanel))
taxonomyRowPanel.activeBtnShowOnlySelected(b);
}
public TaxonomyRowResultsPanel getTaxonomyRowPanel() {
return taxonomyRowPanel;
}
public void setMaskGridPanel(boolean mask){
if(activePanel.equals(resultRowPanel)){
if(mask)
resultRowPanel.getClassicGridView().mask(ConstantsSpeciesDiscovery.REQUEST_DATA, ConstantsSpeciesDiscovery.LOADINGSTYLE);
else
resultRowPanel.getClassicGridView().unmask();
}
else if(activePanel.equals(taxonomyRowPanel)){
if(mask)
taxonomyRowPanel.getClassicGridView().mask(ConstantsSpeciesDiscovery.REQUEST_DATA, ConstantsSpeciesDiscovery.LOADINGSTYLE);
else
taxonomyRowPanel.getClassicGridView().unmask();
}
}
public ResultRowResultsPanel getResultRowPanel() {
return resultRowPanel;
}
}

View File

@ -0,0 +1,503 @@
package org.gcube.portlets.user.speciesdiscovery.client;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.advancedsearch.AdvancedSearchPanelManager;
import org.gcube.portlets.user.speciesdiscovery.client.event.CapabilitySelectedEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchCompleteEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchCompleteEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchStartedEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.SearchStartedEventHandler;
import org.gcube.portlets.user.speciesdiscovery.client.filterresult.ResultFilterPanelManager;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.client.window.HelpQueryWindow;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchType;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.extjs.gxt.ui.client.Style.VerticalAlignment;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.KeyListener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
import com.extjs.gxt.ui.client.widget.form.SimpleComboValue;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Button;
/**
*
* @author "Federico De Faveri defaveri@isti.cnr.it" - Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SpeciesSearchFormPanel extends ContentPanel {
protected static final String SEARCH = "Search";
protected Button buttSimpleSearch;
protected Button buttSimpleExample;
protected SimpleComboBox<String> searchType;
protected SimpleComboBox<String> searchTypeResults;
protected EventBus eventBus;
protected TextField<String> searchField;
private boolean isActiveAdvanced = false;
private HorizontalPanel hpAdvancedSearchLinks = new HorizontalPanel();
private final Html htmlLabelAdvs = new Html("Advanced Option");
private HorizontalPanel horizontalQueryPanel = new HorizontalPanel();
public static final int NORTHHEIGHT = 140;
private List<ToggleButton> tabItemList = new ArrayList<ToggleButton>();
private AdvancedSearchPanelManager advSearchPanelsManager = AdvancedSearchPanelManager.getInstance();
private final int DEFAULTLINKPANELTHEIGHT = 22;
public static enum SEARCHTYPE {SIMPLE, FULLTEXT};
public TextArea textArea = new TextArea();
private SEARCHTYPE currentSearchType = SEARCHTYPE.SIMPLE;
private com.extjs.gxt.ui.client.widget.button.Button buttSearchBy = new com.extjs.gxt.ui.client.widget.button.Button(SEARCHBYQUERY);
private final static String SEARCHBYQUERY = "Text query";
private final static String SEARCHBYSIMPLE = "Simple query";
private HorizontalPanel simpleSearchPanel = new HorizontalPanel();
private HorizontalPanel querySeachPanel = new HorizontalPanel();
protected Button buttQuerySearch;
protected Button buttQueryExample;
protected CheckBox checkValidateOccurrences = new CheckBox();
public SpeciesSearchFormPanel(EventBus eventBus) {
this.eventBus = eventBus;
bind();
horizontalQueryPanel.setStyleAttribute("margin-left", "10px");
horizontalQueryPanel.setStyleAttribute("margin-top", "15px");
htmlLabelAdvs.setStyleAttribute("font-size", "11px");
htmlLabelAdvs.setStyleAttribute("margin-left", "10px");
buttSearchBy.setStyleName("button-hyperlink");
buttSearchBy.setStyleAttribute("margin-top", "8px");
setLayout(new FlowLayout());
setFrame(false);
setHeaderVisible(false);
setBorders(false);
initComboSearchType();
initComboSearchTypeResult();
init();
switchSearchType(SEARCHTYPE.SIMPLE);
add(advSearchPanelsManager.getPanel());
}
private void initComboSearchType(){
searchType = new SimpleComboBox<String>();
searchType.add(Arrays.asList(new String[]{ConstantsSpeciesDiscovery.SCIENTIFIC_NAME, ConstantsSpeciesDiscovery.COMMON_NAME}));
searchType.setEditable(false);
searchType.setTriggerAction(TriggerAction.ALL);
searchType.setSimpleValue(ConstantsSpeciesDiscovery.SCIENTIFIC_NAME);
}
private void initComboSearchTypeResult(){
searchTypeResults = new SimpleComboBox<String>();
searchTypeResults.add(Arrays.asList(new String[]{SpeciesCapability.RESULTITEM.getName(), SpeciesCapability.TAXONOMYITEM.getName()}));
searchTypeResults.setEditable(false);
searchTypeResults.setTriggerAction(TriggerAction.ALL);
searchTypeResults.setSimpleValue(SpeciesCapability.RESULTITEM.getName());
searchTypeResults.addSelectionChangedListener(new SelectionChangedListener<SimpleComboValue<String>>() {
@Override
public void selectionChanged(SelectionChangedEvent<SimpleComboValue<String>> se) {
eventBus.fireEvent(new CapabilitySelectedEvent(getCapability(se.getSelectedItem().getValue())));
//TODO
}
});
}
//RETURN RESULT ITEM OR TAXOMONY ITEM
public SpeciesCapability getSelectedCapability(){
return getCapability(searchTypeResults.getValue().getValue());
}
private SpeciesCapability getCapability(String value){
if(value.compareTo(SpeciesCapability.TAXONOMYITEM.getName())==0)
return SpeciesCapability.TAXONOMYITEM;
else if(value.compareTo(SpeciesCapability.RESULTITEM.getName())==0)
return SpeciesCapability.RESULTITEM;
else if(value.compareTo(SpeciesCapability.NAMESMAPPING.getName())==0)
return SpeciesCapability.NAMESMAPPING;
else if(value.compareTo(SpeciesCapability.SYNONYMS.getName())==0)
return SpeciesCapability.SYNONYMS;
return SpeciesCapability.UNKNOWN;
}
public void switchSearchType(SEARCHTYPE searchType){
currentSearchType = searchType;
if(searchType.equals(SEARCHTYPE.SIMPLE)){
querySeachPanel.setVisible(false);
simpleSearchPanel.setVisible(true);
buttSearchBy.setText(SEARCHBYQUERY);
hpAdvancedSearchLinks.setEnabled(true);
}else if(searchType.equals(SEARCHTYPE.FULLTEXT)){
simpleSearchPanel.setVisible(false);
querySeachPanel.setVisible(true);
buttSearchBy.setText(SEARCHBYSIMPLE);
hpAdvancedSearchLinks.setEnabled(false);
activeAdvancedSearch(false);
}
}
protected void init()
{
horizontalQueryPanel.setBorders(false);
horizontalQueryPanel.setSize(935, 33);
searchTypeResults.setStyleAttribute("margin-right", "10px");
initSimpleSearchPanel();
initQuerySearchPanel();
createAdvancedSeachLinks();
horizontalQueryPanel.add(simpleSearchPanel);
horizontalQueryPanel.add(querySeachPanel);
buttSearchBy.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
if(currentSearchType.equals(SEARCHTYPE.SIMPLE))
switchSearchType(SEARCHTYPE.FULLTEXT);
else
switchSearchType(SEARCHTYPE.SIMPLE);
}
});
horizontalQueryPanel.add(buttSearchBy);
add(horizontalQueryPanel);
add(hpAdvancedSearchLinks);
}
private void initQuerySearchPanel() {
querySeachPanel.setSpacing(5);
buttQuerySearch = new Button(SEARCH);
buttQuerySearch.setStyleName("wizardButton");
buttQuerySearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
searchByQuery(textArea.getValue());
}
});
buttQueryExample = new Button("Example", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
textArea.setValue("'Carcharodon carcharias' as ScientificName in Obis, GBIF return * ");
}
});
buttQueryExample.setStyleName("wizardButton");
textArea.setSize(450, 37);
textArea.setEmptyText("Write a query");
textArea.setStyleAttribute("margin-right", "5px");
querySeachPanel.add(textArea);
com.extjs.gxt.ui.client.widget.button.Button buttQueryInfo = new com.extjs.gxt.ui.client.widget.button.Button();
buttQueryInfo.setStyleAttribute("margin-right", "15px");
buttQueryInfo.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getHelpIcon()));
buttQueryInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
new HelpQueryWindow();
}
});
querySeachPanel.add(buttQueryInfo);
querySeachPanel.add(buttQuerySearch);
querySeachPanel.add(buttQueryExample);
}
private void initSimpleSearchPanel() {
simpleSearchPanel.setSpacing(5);
simpleSearchPanel.add(searchTypeResults);
simpleSearchPanel.add(searchType);
searchField = new TextField<String>();
searchField.setStyleAttribute("margin-left", "10px");
searchField.setStyleAttribute("margin-right", "10px");
searchField.setEmptyText(SEARCH);
searchField.setWidth(300);
searchField.addKeyListener(new KeyListener(){
@Override
public void componentKeyPress(ComponentEvent event) {
if (event.getKeyCode()==KeyCodes.KEY_ENTER) search();
}
});
simpleSearchPanel.add(searchField);
checkValidateOccurrences.setBoxLabel("validate occurrences");
checkValidateOccurrences.setValueAttribute("validate occurrences");
checkValidateOccurrences.setStyleAttribute("margin-right", "10px");
// simpleSearchPanel.add(checkValidateOccurrences);
buttSimpleSearch = new Button(SEARCH);
buttSimpleSearch.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
search();
}
});
buttSimpleSearch.setStyleName("wizardButton");
simpleSearchPanel.add(buttSimpleSearch);
buttSimpleExample = new Button("Example", new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
searchField.setValue("Carcharodon carcharias");
}
});
buttSimpleExample.setStyleName("wizardButton");
simpleSearchPanel.add(buttSimpleExample);
}
public boolean getValueCheckValidateOcccurrences(){
return this.checkValidateOccurrences.getValue();
}
public void setValueCheckValidateOcccurrences(boolean bool){
this.checkValidateOccurrences.setValue(bool);
}
public void setVisibleCheckValidateOcccurrences(boolean bool){
this.checkValidateOccurrences.setVisible(bool);
}
public void activeButtonSearch(boolean bool){
buttSimpleSearch.setEnabled(bool);
}
private void createAdvancedSeachLinks() {
hpAdvancedSearchLinks.setVerticalAlign(VerticalAlignment.MIDDLE);
hpAdvancedSearchLinks.setStyleAttribute("marginLeft", "15px");
hpAdvancedSearchLinks.setStyleAttribute("marginRight", "15px");
hpAdvancedSearchLinks.setStyleAttribute("marginTop", "5px");
hpAdvancedSearchLinks.setStyleAttribute("border-bottom", "thin solid #99BBE8;");
hpAdvancedSearchLinks.setStyleAttribute("background-color", "#EFF5FB");
hpAdvancedSearchLinks.add(htmlLabelAdvs);
hpAdvancedSearchLinks.setHeight(DEFAULTLINKPANELTHEIGHT);
// imageArrowRight.setStyleAttribute("margin-top", "5px");
// imageArrowDown.setStyleAttribute("margin-top", "5px");
for(final String advPanel : advSearchPanelsManager.getListAdvancedSearchPanels()){
ToggleButton butt = new ToggleButton(advPanel);
butt.setToggleGroup("tab");
butt.setSize(100, -1);
butt.setStyleAttribute("marginLeft", "20px");
butt.setId(advPanel);
butt.setStyleName("button-hyperlink");
butt.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getArrowRight()));
tabItemList.add(butt);
butt.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
// isActiveAdvanced = !isActiveAdvanced;
ToggleButton butt = (ToggleButton) ce.getButton();
isActiveAdvanced = butt.isPressed();
advSearchPanelsManager.setActivePanel(advPanel);
activeAdvancedSearch(isActiveAdvanced);
changeStateIcons();
}
private void changeStateIcons() {
for(ToggleButton toggle : tabItemList){
if(toggle.isPressed()){
toggle.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getArrowDown()));
toggle.getElement().getStyle().setBackgroundColor("#D0DEF0");
}else{
toggle.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getArrowRight()));
toggle.getElement().getStyle().clearBackgroundColor();
// toggle.getElement().getStyle().setFontWeight(Style.FontWeight.NORMAL);
}
}
}
});
hpAdvancedSearchLinks.add(butt);
}
}
private void activeAdvancedSearch(boolean bool){
if(bool){
// htmlLabelAdvs.setHtml(messageAdvActive);
SearchBorderLayoutPanel.getInstance().updateNorthSize(NORTHHEIGHT);
}
else{
// htmlLabelAdvs.setHtml(messageAdvDeactive);
SearchBorderLayoutPanel.getInstance().updateNorthSize(SearchBorderLayoutPanel.DEFAULTNORTHHEIGHT);
}
}
protected void search()
{
String searchTerm = searchField.getValue();
if (searchTerm!=null && searchTerm.length()!=0) {
// if(isActiveAdvanced){
search(searchTerm,
advSearchPanelsManager.getUpperBoundLatitudeField().getValue(),
advSearchPanelsManager.getUpperBoundLongitudeField().getValue(),
advSearchPanelsManager.getLowerBoundLatitudeField().getValue(),
advSearchPanelsManager.getLowerBoundLongitudeField().getValue(),
advSearchPanelsManager.getFromDate().getValue(),
advSearchPanelsManager.getToDate().getValue(),
advSearchPanelsManager.getCheckedDataSources(),
ResultFilterPanelManager.getInstance().getGroupByRank(),
advSearchPanelsManager.getCurrentSelectedCapability());
// }else
// search(searchTerm,null,null,null,null,null,null);
}
else Info.display("No search term specified", "There is not search term specified");
}
protected void search(String searchTerm, Number upperBoundLongitude, Number upperBoundLatitude, Number lowerBoundLongitude, Number lowerBoundLatitude, Date fromDate, Date toDate, List<DataSourceModel> listDataSources, String groupRank, SpeciesCapability resultType)
{
mask("Searching...");
//searchButton.setEnabled(false);
SearchType type = null;
if (ConstantsSpeciesDiscovery.SCIENTIFIC_NAME.equals(searchType.getSimpleValue())) type = SearchType.BY_SCIENTIFIC_NAME;
if (ConstantsSpeciesDiscovery.COMMON_NAME.equals(searchType.getSimpleValue())) type = SearchType.BY_COMMON_NAME;
SearchEvent event = new SearchEvent(type, searchTerm, upperBoundLongitude, upperBoundLatitude, lowerBoundLongitude, lowerBoundLatitude, fromDate, toDate, listDataSources, groupRank, resultType);
eventBus.fireEvent(event);
}
protected void searchByQuery(String query)
{
if (query!=null && query.length()!=0) {
SearchEvent event = new SearchEvent(SearchType.BY_QUERY, query);
eventBus.fireEvent(event);
}
else
Info.display("No query specified", "There is not query specified");
}
protected void bind()
{
eventBus.addHandler(SearchStartedEvent.TYPE, new SearchStartedEventHandler() {
@Override
public void onSearchStarted(SearchStartedEvent event) {
unmask();
}
});
eventBus.addHandler(SearchCompleteEvent.TYPE, new SearchCompleteEventHandler() {
@Override
public void onSearchComplete(SearchCompleteEvent event) {
enableSearch();
}
});
}
protected void enableSearch()
{
buttSimpleSearch.setEnabled(true);
}
protected void disableSearch()
{
buttSimpleSearch.setEnabled(false);
}
}

View File

@ -0,0 +1,21 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface AdvancedSearchInterface {
//Bounds filter
public NumberField getUpperBoundLatitudeField();
public NumberField getUpperBoundLongitudeField();
public NumberField getLowerBoundLatitudeField();
public NumberField getLowerBoundLongitudeField();
//Date filter
public DateField getFromDate();
public DateField getToDate();
}

View File

@ -0,0 +1,24 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public enum AdvancedSearchPanelEnum {
BOUNDS("Bounds"), DATE("Date"), TYPE("Type"), REGION("Region"), DATASOURCE("Data Source"), CLASSIFICATION("Classification");
private String label;
AdvancedSearchPanelEnum() {
}
AdvancedSearchPanelEnum(String label) {
this.label = label;
}
public String getLabel() {
return label;
}
}

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import java.util.ArrayList;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import com.extjs.gxt.ui.client.widget.ContentPanel;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface AdvancedSearchPanelInterface {
public ContentPanel getPanel();
public String getName();
public void resetAdvancedFields();
public ArrayList<DataSourceModel> getAvailablePlugIn();
}

View File

@ -0,0 +1,225 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceCapability;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
import com.extjs.gxt.ui.client.widget.layout.CardLayout;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class AdvancedSearchPanelManager extends ContentPanel implements AdvancedSearchInterface{
private static AdvancedSearchPanelManager instance;
private BoundsFilter boundsFilter;
private DateFilter dateFilter;
private RegionFilter regionFilter;
private DataSourceFilter dataSourceFilter;
private List<String> listAdvacedPanels = new ArrayList<String>();
private CardLayout cardLayout = new CardLayout();
// private ClassificationFilter classificationFilter;
private HashMap<String,DataSourceModel> listDataSources;
private SpeciesCapability currentSelectedCapability;
public static synchronized AdvancedSearchPanelManager getInstance() {
if (instance == null)
instance = new AdvancedSearchPanelManager();
return instance;
}
private AdvancedSearchPanelManager(){
boundsFilter = new BoundsFilter();
dateFilter = new DateFilter();
regionFilter = new RegionFilter();
dataSourceFilter = new DataSourceFilter();
// classificationFilter = new ClassificationFilter();
init();
// listAdvacedPanels.add(classificationFilter.getName());
listAdvacedPanels.add(dataSourceFilter.getName());
listAdvacedPanels.add(boundsFilter.getName());
listAdvacedPanels.add(dateFilter.getName());
// listAdvacedPanels.add(regionFilter.getName());
}
private void init() {
setLayout(cardLayout);
setHeaderVisible(false);
setSize(925, 70);
setBodyBorder(false);
add(boundsFilter.getPanel());
add(dateFilter.getPanel());
add(dataSourceFilter.getPanel());
add(regionFilter.getPanel());
// add(classificationFilter.getPanel());
cardLayout.setActiveItem(boundsFilter.getPanel());
}
public List<String> getListAdvancedSearchPanels(){
return listAdvacedPanels;
}
public void setActivePanel(String name){
if(name.equals(AdvancedSearchPanelEnum.BOUNDS.getLabel()))
cardLayout.setActiveItem(boundsFilter.getPanel());
else if(name.equals(AdvancedSearchPanelEnum.DATE.getLabel()))
cardLayout.setActiveItem(dateFilter.getPanel());
else if(name.equals(AdvancedSearchPanelEnum.DATASOURCE.getLabel()))
cardLayout.setActiveItem(dataSourceFilter.getPanel());
else if(name.equals(AdvancedSearchPanelEnum.REGION.getLabel()))
cardLayout.setActiveItem(regionFilter.getPanel());
// else if(name.equals(AdvancedSearchPanelEnum.CLASSIFICATION.getLabel()))
// cardLayout.setActiveItem(classificationFilter.getPanel());
}
public ContentPanel getPanel(){
return this;
}
public NumberField getUpperBoundLatitudeField() {
return boundsFilter.getUpperBoundLatitudeField();
}
public NumberField getUpperBoundLongitudeField() {
return boundsFilter.getUpperBoundLongitudeField();
}
public NumberField getLowerBoundLatitudeField() {
return boundsFilter.getLowerBoundLatitudeField();
}
public NumberField getLowerBoundLongitudeField() {
return boundsFilter.getLowerBoundLongitudeField();
}
public DateField getFromDate() {
return dateFilter.getFromDate();
}
public DateField getToDate() {
return dateFilter.getToDate();
}
public void loadDataSource(List<DataSourceModel> result) {
dataSourceFilter.loadDataSource(result);
listDataSources = new HashMap<String, DataSourceModel>();
//fill hash
for(DataSourceModel dsm: result){
listDataSources.put(dsm.getId(), dsm);
}
setAvailableInfoAdvancedFilters(result);
}
private void setAvailableInfoAdvancedFilters(List<DataSourceModel> result) {
for(DataSourceModel dsm: result){
for (DataSourceCapability dsc : dsm.getListCapabilities()) {
ArrayList<SpeciesCapability> properties = dsc.getListFilters();
for (SpeciesCapability capabilityEnum : properties) {
// System.out.println("capability " + capabilityEnum.toString());
if(capabilityEnum.equals(SpeciesCapability.FROMDATE))
dateFilter.addAvailablePlugInfo(dsm, SpeciesCapability.FROMDATE);
else if(capabilityEnum.equals(SpeciesCapability.LOWERBOUND))
boundsFilter.addAvailablePlugInfo(dsm, SpeciesCapability.LOWERBOUND);
else if(capabilityEnum.equals(SpeciesCapability.TODATE))
dateFilter.addAvailablePlugInfo(dsm, SpeciesCapability.TODATE);
else if(capabilityEnum.equals(SpeciesCapability.UPPERBOUND))
boundsFilter.addAvailablePlugInfo(dsm, SpeciesCapability.UPPERBOUND);
}
}
}
}
public void setCurrentCapability(SpeciesCapability capability){
this.currentSelectedCapability = capability;
this.capabilityChange();
}
public void setVisibleAllPanel(boolean bool){
boundsFilter.getPanel().setVisible(bool);
dateFilter.getPanel().setVisible(bool);
dataSourceFilter.getPanel().setVisible(bool);
regionFilter.getPanel().setVisible(bool);
// classificationFilter.getPanel().setVisible(bool);
}
private void capabilityChange() {
// dataSourceFilter.disableAllCheck();
dataSourceFilter.enableCheckByCapability(this.currentSelectedCapability);
}
public List<DataSourceModel> getCheckedDataSources() {
return dataSourceFilter.getCheckedGroupList();
}
public HashMap<String, DataSourceModel> findDataSourceByCapability(SpeciesCapability capability) {
if(capability.getName().compareTo(SpeciesCapability.RESULTITEM.getName())==0){
return dataSourceFilter.getHashMapDataSourceOccurrences();
}
else if(capability.getName().compareTo(SpeciesCapability.TAXONOMYITEM.getName())==0){
return dataSourceFilter.getHashMapDataSourceClassification();
}
return null;
}
public DataSourceModel findDataSourceByCapabilityAndName(SpeciesCapability capability, String dataSourceName) {
HashMap<String, DataSourceModel> hashDataSource = findDataSourceByCapability(capability);
if(hashDataSource!=null)
return hashDataSource.get(dataSourceName);
return null;
}
public SpeciesCapability getCurrentSelectedCapability() {
return currentSelectedCapability;
}
// public String getGroupByRank(){
// return classificationFilter.getSelectedRank();
// }
}

View File

@ -0,0 +1,215 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import java.util.ArrayList;
import org.gcube.portlets.user.speciesdiscovery.client.ConstantsSpeciesDiscovery;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.form.MultiField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class BoundsFilter extends ColumnContainer implements AdvancedSearchPanelInterface {
private NumberField upperBoundLatitudeField;
private NumberField upperBoundLongitudeField;
private NumberField lowerBoundLatitudeField;
private NumberField lowerBoundLongitudeField;
private ArrayList<DataSourceModel> availablePlugin;
private ContentPanel boundsPanel = new ContentPanel();
private Button btnResetAllFilters = new Button("Reset Filters");
private TextArea txtAreaInfo = new TextArea();
public BoundsFilter() {
initBoundsPanel();
btnResetAllFilters.setStyleName("button-hyperlink");
availablePlugin = new ArrayList<DataSourceModel>();
}
@Override
public ContentPanel getPanel() {
return boundsPanel;
}
private void initBoundsPanel() {
boundsPanel.setHeaderVisible(false);
boundsPanel.setBodyBorder(false);
upperBoundLatitudeField = new NumberField();
upperBoundLatitudeField.setPropertyEditorType(Float.class);
upperBoundLatitudeField.setEmptyText("Latitude");
upperBoundLongitudeField = new NumberField();
upperBoundLongitudeField.setPropertyEditorType(Float.class);
upperBoundLongitudeField.setEmptyText("Longitude");
MultiField<Float> uppertBound = new MultiField<Float>("Upper Bound",upperBoundLatitudeField, upperBoundLongitudeField);uppertBound.setSpacing(5);
left.add(uppertBound);
lowerBoundLatitudeField = new NumberField();
lowerBoundLatitudeField.setPropertyEditorType(Float.class);
lowerBoundLatitudeField.setEmptyText("Latitude");
lowerBoundLongitudeField = new NumberField();
lowerBoundLongitudeField.setPropertyEditorType(Float.class);
lowerBoundLongitudeField.setEmptyText("Longitude");
MultiField<Float> lowerBound = new MultiField<Float>("Lower Bound",lowerBoundLatitudeField, lowerBoundLongitudeField);
lowerBound.setSpacing(5);
left.add(lowerBound);
left.add(uppertBound);
// // Horizontal alignment right
// LayoutContainer containerRightAlign = new LayoutContainer();
// HBoxLayout layout2 = new HBoxLayout();
// layout2.setPadding(new Padding(5));
// layout2.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
// layout2.setPack(BoxLayoutPack.END);
// containerRightAlign.setLayout(layout2);
//
// HBoxLayoutData layoutData = new HBoxLayoutData(new Margins(0, 5, 0, 0));
// containerRightAlign.add(btnResetAllFilters, layoutData);
btnResetAllFilters.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
resetAdvancedFields();
}
});
final ContentPanel cp = new ContentPanel();
ButtonBar buttonBar = new ButtonBar();
ToggleButton toggleInfo = new ToggleButton("");
toggleInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
if (cp.isVisible()) {
// cp.el().slideOut(Direction.LEFT, FxConfig.NONE);
cp.setVisible(false);
} else {
cp.setVisible(true);
// cp.el().slideIn(Direction.RIGHT, FxConfig.NONE);
}
// cp.setVisible(true);
// cp.el().fadeToggle(FxConfig.NONE);
}
});
toggleInfo.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getInfoIcon()));
toggleInfo.toggle(false);
// buttonBar.add(btnResetAllFilters);
buttonBar.add(toggleInfo);
cp.setVisible(false);
cp.setHeading("Bounds");
cp.setBodyBorder(false);
txtAreaInfo.setReadOnly(true);
txtAreaInfo.setValue(ConstantsSpeciesDiscovery.AVAILABLEFILTERBOUND + ": \n");
cp.setLayout(new FitLayout());
cp.add(txtAreaInfo);
cp.setWidth(300);
cp.setHeight(50);
cp.setScrollMode(Scroll.AUTOY);
cp.setHeaderVisible(false);
HorizontalPanel hp = new HorizontalPanel();
cp.setWidth(310);
// hp.setSpacing(5);
cp.setStyleAttribute("margin-left", "5px");
cp.setStyleAttribute("margin-top", "2px");
toggleInfo.setStyleAttribute("margin-left", "5px");
toggleInfo.setStyleAttribute("margin-top", "2px");
hp.add(btnResetAllFilters);
hp.add(cp);
hp.add(toggleInfo);
right.add(hp);
// right.add(cp);
boundsPanel.add(columnContainer);
}
@Override
public String getName() {
return AdvancedSearchPanelEnum.BOUNDS.getLabel();
}
public void resetAdvancedFields() {
upperBoundLatitudeField.reset();
upperBoundLongitudeField.reset();
lowerBoundLatitudeField.reset();
lowerBoundLongitudeField.reset();
}
public NumberField getUpperBoundLatitudeField() {
return upperBoundLatitudeField;
}
public NumberField getUpperBoundLongitudeField() {
return upperBoundLongitudeField;
}
public NumberField getLowerBoundLatitudeField() {
return lowerBoundLatitudeField;
}
public NumberField getLowerBoundLongitudeField() {
return lowerBoundLongitudeField;
}
public void addAvailablePlugInfo(DataSourceModel plugin, SpeciesCapability capability){
availablePlugin.add(plugin);
String currentValue = txtAreaInfo.getValue();
txtAreaInfo.setValue(currentValue + plugin.getName() + " (" + capability.getName() + "); \n");
}
@Override
public ArrayList<DataSourceModel> getAvailablePlugIn() {
return availablePlugin;
}
}

View File

@ -0,0 +1,99 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.ConstantsSpeciesDiscovery;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.MainTaxonomicRankEnum;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ClassificationFilter extends ColumnContainer implements AdvancedSearchPanelInterface {
private Button btnResetAllFilters = new Button("Reset Filters");
private ContentPanel classificationFilterPanel = new ContentPanel();
private SimpleComboBox<String> scb;
private String baseClassification = MainTaxonomicRankEnum.CLASS.getLabel(); //is CLASS
public ClassificationFilter() {
init();
btnResetAllFilters.setStyleName("button-hyperlink");
}
private void init() {
classificationFilterPanel.setHeaderVisible(false);
classificationFilterPanel.setBodyBorder(false);
initComboRankFilter();
left.add(scb);
scb.setSimpleValue(baseClassification);
right.add(btnResetAllFilters);
btnResetAllFilters.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
resetAdvancedFields();
}
});
classificationFilterPanel.add(columnContainer);
}
@Override
public ContentPanel getPanel() {
return classificationFilterPanel;
}
@Override
public String getName() {
return AdvancedSearchPanelEnum.CLASSIFICATION.getLabel();
}
@Override
public void resetAdvancedFields() {
scb.setSimpleValue(baseClassification);
}
private SimpleComboBox<String> initComboRankFilter() {
List<String> ls = new ArrayList<String>();
for (String rank : MainTaxonomicRankEnum.getListLabels()) ls.add(rank);
scb = new SimpleComboBox<String>();
scb.setFieldLabel(ConstantsSpeciesDiscovery.GROUPBYRANK);
scb.setTypeAhead(true);
scb.setEditable(false);
scb.setTriggerAction(TriggerAction.ALL);
scb.add(ls);
return scb;
}
public String getSelectedRank(){
return this.scb.getSimpleValue();
}
@Override
public ArrayList<DataSourceModel> getAvailablePlugIn() {
return null;
}
}

View File

@ -0,0 +1,41 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ColumnContainer {
protected LayoutContainer columnContainer = new LayoutContainer();
protected LayoutContainer left = new LayoutContainer();
protected LayoutContainer right = new LayoutContainer();
public ColumnContainer() {
columnContainer.setLayout(new ColumnLayout());
columnContainer.setStyleAttribute("marginLeft", "10px");
columnContainer.setStyleAttribute("marginRight", "10px");
columnContainer.setStyleAttribute("padding", "5px");
left.setStyleAttribute("paddingRight", "10px");
FormLayout layout = new FormLayout();
left.setLayout(layout);
right.setStyleAttribute("paddingLeft", "10px");
layout = new FormLayout();
right.setLayout(layout);
columnContainer.add(left, new ColumnData(.5));
columnContainer.add(right, new ColumnData(.5));
}
}

View File

@ -0,0 +1,349 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.window.WindowCredits;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceCapability;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class DataSourceFilter implements AdvancedSearchPanelInterface {
private ContentPanel dataPanel = new ContentPanel();
private Button btnResetAllFilters = new Button("Reset Filters");
private CheckBoxGroup checkGroup = new CheckBoxGroup();
private CheckBoxGroup checkGroupOccurrences= new CheckBoxGroup();
private CheckBoxGroup checkGroupClassification = new CheckBoxGroup();
// private ArrayList<DataSourceModel> listDataSourceOccurrences = new ArrayList<DataSourceModel>();
// private ArrayList<DataSourceModel> listDataSourceClassification = new ArrayList<DataSourceModel>();
private HashMap<String, DataSourceModel> hashMapDataSourceClassification = new HashMap<String, DataSourceModel>();
private HashMap<String, DataSourceModel> hashMapDataSourceOccurrences = new HashMap<String, DataSourceModel>();
public DataSourceFilter() {
// checkGroup.setFieldLabel("Sources");
initDataSourceFilter();
addListners();
btnResetAllFilters.setStyleName("button-hyperlink");
}
private void initDataSourceFilter() {
dataPanel.setHeaderVisible(false);
dataPanel.setBodyBorder(false);
dataPanel.setLayout(new FitLayout());
dataPanel.setStyleAttribute("marginLeft", "10px");
dataPanel.setStyleAttribute("marginRight", "10px");
dataPanel.setStyleAttribute("padding", "5px");
VerticalPanel vp = new VerticalPanel();
HorizontalPanel hp1 = new HorizontalPanel();
HorizontalPanel hp2 = new HorizontalPanel();
// Html htmlSource = new Html("Occurences Sources: ");
Anchor htmlSource = new Anchor("Occurences Sources: ", true);
htmlSource.setStyleName("margin-occurrence-link");
htmlSource.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
new WindowCredits("Occurrences data sources credits", hashMapDataSourceOccurrences);
}
});
// Html htmlSource2 = new Html("Classification Sources: ");
Anchor htmlSource2 = new Anchor("Classification Sources: ", true);
htmlSource2.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
new WindowCredits("Classification data sources credits", hashMapDataSourceClassification);
}
});
htmlSource2.setStyleName("margin-occurrence-link");
// htmlSource.setStyleAttribute("margin-top", "2px");
// htmlSource.setStyleAttribute("margin-right", "5px");
// htmlSource2.setStyleAttribute("margin-top", "2px");
// htmlSource2.setStyleAttribute("margin-right", "5px");
hp1.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
hp2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
hp1.add(htmlSource);
hp2.add(htmlSource2);
hp1.add(checkGroupOccurrences);
hp2.add(checkGroupClassification);
// Anchor anchorAbout1 = new Anchor("<nobr>Abouts</nobr>", true);
//
// anchorAbout1.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// new WindowCredits("Occurrences data sources credits", hashMapDataSourceOccurrences);
//
// }
// });
//
// Anchor anchorAbout2 = new Anchor("<nobr>Abouts</nobr>", true);
//
// anchorAbout2.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// new WindowCredits("Classification data sources credits", hashMapDataSourceClassification);
//
// }
// });
// hp1.add(anchorAbout1);
// hp2.add(anchorAbout2);
vp.add(hp1);
vp.add(hp2);
dataPanel.add(vp);
}
private void addListners(){
btnResetAllFilters.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
resetAdvancedFields();
}
});
}
@Override
public void resetAdvancedFields() {
List<Field<?>> listChecks = checkGroup.getAll();
for (Field<?> item : listChecks) {
CheckBox checkBox = (CheckBox) item;
checkBox.reset();
}
}
@Override
public ContentPanel getPanel() {
return dataPanel;
}
@Override
public String getName() {
return AdvancedSearchPanelEnum.DATASOURCE.getLabel();
}
public List<DataSourceModel> getCheckedGroupList() {
List<DataSourceModel> listDS = new ArrayList<DataSourceModel>();
List<CheckBox> values = new ArrayList<CheckBox>();
if(checkGroup.getValues().size()>0)
values = checkGroup.getValues();
else{
List<Field<?>> listChecks = checkGroup.getAll();
for (Field<?> field : listChecks) {
values.add((CheckBox) field);
}
}
for (CheckBox checkBox : values) {
if (checkBox.isEnabled())
listDS.add(new DataSourceModel(checkBox.getValueAttribute(), checkBox.getValueAttribute()));
}
if(listDS.size()==0)
return null;
return listDS;
}
private static Comparator<DataSourceModel> COMPARATOR = new Comparator<DataSourceModel>()
{
// This is where the sorting happens.
public int compare(DataSourceModel o1, DataSourceModel o2)
{
return o1.getName().compareToIgnoreCase(o2.getName());
}
};
public void loadDataSource(List<DataSourceModel> result) {
Collections.sort(result, COMPARATOR);
if(result!=null){
for(DataSourceModel dsm: result){
System.out.println("Data Source name " + dsm.getName());
CheckBox check = null;
for (DataSourceCapability dsc : dsm.getListCapabilities()) {
System.out.println("\tData Source capability name: " + dsc.getCapability().getName());
if(dsc.getCapability().getName().compareTo(SpeciesCapability.RESULTITEM.getName())==0){
check = createCheckBox(dsm, SpeciesCapability.RESULTITEM.getName());
checkGroupOccurrences.add(check);
// if(dsm.getDataSourceRepositoryInfo()!=null)
// listDataSourceOccurrences.add(dsm);
hashMapDataSourceOccurrences.put(dsm.getName(), dsm);
System.out.println("\t\t added check " + dsm.getName() + " to checkGroupOccurences " + dsc.getCapability().getName());
checkGroup.add(check);
}
if(dsc.getCapability().getName().compareTo(SpeciesCapability.TAXONOMYITEM.getName())==0){
check = createCheckBox(dsm, SpeciesCapability.TAXONOMYITEM.getName());
checkGroupClassification.add(check);
// if(dsm.getDataSourceRepositoryInfo()!=null)
// listDataSourceClassification.add(dsm);
hashMapDataSourceClassification.put(dsm.getName(), dsm);
System.out.println("\t\t added check " + dsm.getName() + " to checkGroupClassification " + dsc.getCapability().getName());
checkGroup.add(check);
}
}
}
setVisibility();
}
}
private void setVisibility() {
if(checkGroup.getAll().size()==0)
checkGroup.setVisible(false);
}
public void enableCheckByCapability(SpeciesCapability capability){
setEnableAllCheck(false, checkGroupClassification);
setEnableAllCheck(false, checkGroupOccurrences);
setCheckByCapability(true,capability);
}
private void setCheckByCapability(boolean enable, SpeciesCapability capability){
if(capability.getName().compareTo(SpeciesCapability.TAXONOMYITEM.getName())==0){
setEnableAllCheck(enable, checkGroupClassification);
// checkGroupClassification.setEnabled(enable);
setValueAllCheck(enable, checkGroupClassification);
}
else if(capability.getName().compareTo(SpeciesCapability.RESULTITEM.getName())==0){
setEnableAllCheck(enable, checkGroupOccurrences);
// checkGroupOccurences.setEnabled(enable);
setValueAllCheck(enable, checkGroupOccurrences);
}
}
public void setValueAllCheck(boolean checkValue, CheckBoxGroup checksGroup){
List<Field<?>> listChecks = checksGroup.getAll();
for (Field<?> item : listChecks) {
CheckBox check = (CheckBox) item;
check.setValue(checkValue);
}
}
public void setEnableAllCheck(boolean checkValue, CheckBoxGroup checksGroup){
List<Field<?>> listChecks = checksGroup.getAll();
for (Field<?> item : listChecks) {
CheckBox check = (CheckBox) item;
check.setEnabled(checkValue);
}
}
private CheckBox createCheckBox(DataSourceModel dsm, String property){
CheckBox check = new CheckBox();
// check.setId(dsm.getId());
// check.setBoxLabel(dsm.getName() + " ("+property+")");
check.setBoxLabel(dsm.getName());
check.setValueAttribute(dsm.getName());
check.setData("capability", dsm);
check.setToolTip(new ToolTipConfig(dsm.getDescription()));
return check;
}
@Override
public ArrayList<DataSourceModel> getAvailablePlugIn() {
return null;
}
public HashMap<String, DataSourceModel> getHashMapDataSourceClassification() {
return hashMapDataSourceClassification;
}
public HashMap<String, DataSourceModel> getHashMapDataSourceOccurrences() {
return hashMapDataSourceOccurrences;
}
}

View File

@ -0,0 +1,207 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import java.util.ArrayList;
import org.gcube.portlets.user.speciesdiscovery.client.ConstantsSpeciesDiscovery;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.FieldEvent;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.HorizontalPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
import com.extjs.gxt.ui.client.widget.button.ToggleButton;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.MultiField;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class DateFilter extends ColumnContainer implements AdvancedSearchPanelInterface {
private DateField fromDate;
private DateField toDate;
private Button btnResetAllFilters = new Button("Reset Filters");
private ContentPanel dateFilterPanel = new ContentPanel();
private ArrayList<DataSourceModel> availablePlugin;
private TextArea txtAreaInfo = new TextArea();
@Override
public ContentPanel getPanel() {
return dateFilterPanel;
}
@Override
public String getName() {
return AdvancedSearchPanelEnum.DATE.getLabel();
}
public DateFilter(){
initDateFilter();
btnResetAllFilters.setStyleName("button-hyperlink");
availablePlugin = new ArrayList<DataSourceModel>();
}
private void initDateFilter() {
dateFilterPanel.setHeaderVisible(false);
dateFilterPanel.setBodyBorder(false);
fromDate = new DateField();
fromDate.setStyleAttribute("marginRight", "15px");
fromDate.setEmptyText("From");
toDate = new DateField();
toDate.setEmptyText("To");
MultiField<Float> dateField = new MultiField<Float>("Date bounds", fromDate, toDate);
dateField.setSpacing(5);
left.add(dateField);
// right.add(btnResetAllFilters);
btnResetAllFilters.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
resetAdvancedFields();
}
});
dateFilterPanel.add(columnContainer);
fromDate.addListener(Events.Change, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
if(fromDate.isValid())
toDate.setMinValue(fromDate.getValue());
else{
// toDate.reset();
toDate.getDatePicker().clearState();
}
}
});
toDate.addListener(Events.Change, new Listener<FieldEvent>() {
@Override
public void handleEvent(FieldEvent be) {
if(toDate.isValid()){
fromDate.setMaxValue(toDate.getValue());
}
else{
// fromDate.reset();
fromDate.getDatePicker().clearState();
}
}
});
final ContentPanel cp = new ContentPanel();
ButtonBar buttonBar = new ButtonBar();
ToggleButton toggleInfo = new ToggleButton("");
toggleInfo.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
if (cp.isVisible()) {
// cp.el().slideOut(Direction.LEFT, FxConfig.NONE);
cp.setVisible(false);
} else {
cp.setVisible(true);
// cp.el().slideIn(Direction.RIGHT, FxConfig.NONE);
}
// cp.setVisible(true);
// cp.el().fadeToggle(FxConfig.NONE);
}
});
toggleInfo.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getInfoIcon()));
toggleInfo.toggle(false);
// buttonBar.add(btnResetAllFilters);
buttonBar.add(toggleInfo);
cp.setVisible(false);
cp.setHeading("Bounds");
cp.setBodyBorder(false);
txtAreaInfo.setReadOnly(true);
txtAreaInfo.setValue(ConstantsSpeciesDiscovery.AVAILABLEFILTERDATE + ": \n");
cp.setLayout(new FitLayout());
cp.add(txtAreaInfo);
cp.setWidth(300);
cp.setHeight(50);
cp.setScrollMode(Scroll.AUTOY);
cp.setHeaderVisible(false);
HorizontalPanel hp = new HorizontalPanel();
cp.setWidth(310);
// hp.setSpacing(5);
cp.setStyleAttribute("margin-left", "5px");
cp.setStyleAttribute("margin-top", "2px");
toggleInfo.setStyleAttribute("margin-left", "5px");
toggleInfo.setStyleAttribute("margin-top", "2px");
hp.add(btnResetAllFilters);
hp.add(cp);
hp.add(toggleInfo);
right.add(hp);
}
public void resetAdvancedFields() {
fromDate.getDatePicker().clearState();
toDate.getDatePicker().clearState();
fromDate.reset();
toDate.reset();
}
public DateField getFromDate() {
return fromDate;
}
public DateField getToDate() {
return toDate;
}
public void addAvailablePlugInfo(DataSourceModel plugin, SpeciesCapability capability){
availablePlugin.add(plugin);
String currentValue = txtAreaInfo.getValue();
txtAreaInfo.setValue(currentValue + plugin.getName() + " (" + capability.getName() + "); \n");
}
@Override
public ArrayList<DataSourceModel> getAvailablePlugIn() {
return availablePlugin;
}
}

View File

@ -0,0 +1,57 @@
package org.gcube.portlets.user.speciesdiscovery.client.advancedsearch;
import java.util.ArrayList;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class RegionFilter extends ColumnContainer implements AdvancedSearchPanelInterface {
private Button btnResetAllFilters = new Button("Reset Filters");
private ContentPanel regionFilterPanel = new ContentPanel();
public RegionFilter() {
init();
btnResetAllFilters.setStyleName("button-hyperlink");
}
private void init() {
regionFilterPanel.setHeaderVisible(false);
regionFilterPanel.setBodyBorder(false);
}
@Override
public ContentPanel getPanel() {
return regionFilterPanel;
}
@Override
public String getName() {
return AdvancedSearchPanelEnum.REGION.getLabel();
}
@Override
public void resetAdvancedFields() {
// TODO Auto-generated method stub
}
@Override
public ArrayList<DataSourceModel> getAvailablePlugIn() {
return null;
}
}

View File

@ -0,0 +1,886 @@
package org.gcube.portlets.user.speciesdiscovery.client.cluster;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.SpeciesDiscovery;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.client.util.TaxonomyGridField;
import org.gcube.portlets.user.speciesdiscovery.shared.CommonName;
import org.gcube.portlets.user.speciesdiscovery.shared.ItemParameter;
import org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyRow;
import org.gcube.portlets.user.speciesdiscovery.shared.util.NormalizeString;
import com.allen_sauer.gwt.log.client.Log;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.Label;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class TabItemForTaxonomyRow {
private TabPanel tabPanel;
private AbstractImagePrototype imageLoading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls());
private EventBus eventBus;
// private List<TaxonomyRow> parents = null;
private TablesForTaxonomyRow tablesForTaxonomyRow;
private TaxonomyRow currentTaxonomy;
public void setCurrentTaxonomy(TaxonomyRow taxonomy){
this.currentTaxonomy = taxonomy;
}
public TabItemForTaxonomyRow(TablesForTaxonomyRow tablesForTaxonomyRow, TabPanel tabPanel2, EventBus eventBus2) {
this.tablesForTaxonomyRow = tablesForTaxonomyRow;
this.tabPanel = tabPanel2;
this.eventBus = eventBus2;
}
/**
*
* @param taxonomy
* @param isNewTab - set true if has been clicked a classification link, or false otherwise
* @return
*/
public VerticalPanel getPanelClassificationForTaxonomy(TaxonomyRow taxonomy, String dataSource, boolean isNewTab){
VerticalPanel vpClassification = new VerticalPanel();
vpClassification.setSpacing(5);
if(taxonomy!=null){
//CREATE CLASSIFICATION FOR PARENT ITEM
int parentsSize = taxonomy.getParents().size();
for(int i=parentsSize-1; i>=0; i--){
createPanelForParentTaxonomy(taxonomy.getParents().get(i), vpClassification, taxonomy.getServiceId(), isNewTab, dataSource, i+1);
}
//CREATE CLASSIFICATION FOR ITEM
createPanelForParentTaxonomy(taxonomy, vpClassification, taxonomy.getServiceId(), isNewTab, dataSource, 0);
}
return vpClassification;
}
/**
* Create a scientific classification: for each parent rank create a link, for current search item create a label
* @param taxon
* @param vpClassification
* @param taxonomyServiceId
* @param isNewTab
* @param parentIndex
*/
public void createPanelForParentTaxonomy(TaxonomyRow taxon, VerticalPanel vpClassification, String taxonomyServiceId, boolean isNewTab, String dataSource, int parentIndex){
if(taxon==null)
return;
// createPanelForParentTaxonomy(taxon.getParents(), vpClassification, taxonomyServiceId, isNewTab, dataSource);
HorizontalPanel hp = new HorizontalPanel();
Text labelRank;
if(!NormalizeString.isUndefined(taxon.getRank()))
labelRank = new Text(taxon.getRank()+":");
else
labelRank = new Text("Rank not found"+":");
// labelRank.setStyleAttribute("margin-right", "10px");
hp.add(labelRank);
hp.setCellWidth(labelRank, "120px");
Anchor anchor = getAnchorByTaxonomy(taxon, dataSource, parentIndex);
hp.add(anchor);
hp.setCellHorizontalAlignment(anchor, HorizontalPanel.ALIGN_LEFT);
vpClassification.add(hp);
//DEBUG
// System.out.println("taxon.getName()" +taxon.getName() + " serviceid : "+taxon.getServiceId() + " taxonomyServiceId "+taxonomyServiceId);
// System.out.println("taxon.getServiceId().compareTo(taxonomyServiceId)==0 "+ taxon.getServiceId().compareTo(taxonomyServiceId));
// System.out.println("isNewTab"+ isNewTab);
if((taxon.getServiceId().compareTo(taxonomyServiceId)==0) && isNewTab){
loadChildrenListOfItem(vpClassification, taxon, dataSource, taxon.getName(), -1); //parentIndex == -1 means that parent is currentTaxonomy
}
}
private void loadChildrenListOfItem(final VerticalPanel vpClassification, final TaxonomyRow taxonomyItem, final String dataSource, final String parentName, final int parentIndex){
final ContentPanel cp = new ContentPanel();
cp.setId("cp" + taxonomyItem.getId());
cp.setHeaderVisible(false);
cp.setBodyBorder(false);
cp.add(imageLoading.createImage());
vpClassification.add(cp);
//FOR DEBUG
// TaxonomyRow printParent = taxonomyItem;
System.out.println("Load child of item name: " + parentName + " parent id: " + taxonomyItem.getServiceId());
// while(printParent!=null){
//
// System.out.println("Parent Name: " + printParent.getName() + " parent id: " +printParent.getServiceId());
// printParent = printParent.getParent();
// }
SpeciesDiscovery.taxonomySearchService.loadListChildByParentId(taxonomyItem.getServiceId(), new AsyncCallback<ArrayList<TaxonomyRow>>() {
@Override
public void onSuccess(ArrayList<TaxonomyRow> result) {
Log.trace("Children returned in client: " + result.size() + " for parentName " +parentName);
LayoutContainer lc = new LayoutContainer();
lc.setLayout(new ColumnLayout());
vpClassification.remove(cp);
HorizontalPanel hp = new HorizontalPanel();
Text labelRank = new Text("Rank not found:");
hp.add(labelRank);
hp.setCellWidth(labelRank, "120px");
boolean setRank = false;
if(result.size()>0){
for (int i=0; i<result.size()-1; i++) {
TaxonomyRow taxonomy = result.get(i);
// //FOR DEBUG
// System.out.println("child "+taxonomy);
//SET PARENTS
taxonomy.setParent(Arrays.asList(taxonomyItem));
//SET RANK IF IS NOT EMPTY
if(!setRank)
setRank = replaceLabelRank(hp, labelRank, taxonomy.getRank());
Text comma = new Text(",");
comma.setStyleAttribute("margin-right", "5px");
lc.add(getAnchorByTaxonomy(taxonomy, dataSource, parentIndex));
lc.add(comma);
}
TaxonomyRow taxonomy = result.get(result.size()-1);
if(!setRank)
setRank = replaceLabelRank(hp, labelRank, taxonomy.getRank());
// //FOR DEBUG
// System.out.println("last child "+taxonomy);
//SET PARENTS
taxonomy.setParent(Arrays.asList(taxonomyItem));
lc.add(getAnchorByTaxonomy(taxonomy, dataSource,parentIndex));
}
else{
hp.remove(labelRank);
}
hp.add(lc);
hp.setCellHorizontalAlignment(lc, HorizontalPanel.ALIGN_LEFT);
vpClassification.add(hp);
vpClassification.layout();
}
@Override
public void onFailure(Throwable caught) {
Info.display("Error laoding child", "An error occurred in loading, retry.");
Log.error("Error laoding child", "An error occurred in loading, retry." +caught);
}
});
vpClassification.layout();
// hp.add(child)
}
/**
*
* @param hp
* @param oldLabelRank
* @param rank
* @return true if label is replaced
*/
private boolean replaceLabelRank(HorizontalPanel hp, Text oldLabelRank, String rank){
//SET NEW LABEL RANK IF IS NOT EMPTY
if(!NormalizeString.isUndefined(rank)){
// System.out.println("In if Taxonomy set rank " + taxonomy.getRank());
hp.remove(oldLabelRank);
Text setlabelRank = new Text(rank+":");
hp.add(setlabelRank);
hp.setCellWidth(setlabelRank, "120px");
return true;
}
return false;
}
/**
*
* @param taxon
* @param dataSource
* @param parentIndex - if parent index is egual -1.. the method set parent item of taxon as currentItem
* if parent index is egual -2.. the method not set parents of taxon
* @return
*/
private Anchor getAnchorByTaxonomy(final TaxonomyRow taxon, final String dataSource, final int parentIndex)
{
Anchor anchor = null;
if(taxon!=null){
anchor = new Anchor("<nobr>"+taxon.getName()+"</nobr>", true);
anchor.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
System.out.println("parent index: "+parentIndex + " size "+currentTaxonomy.getParents().size());
if(parentIndex >=0 && parentIndex<=currentTaxonomy.getParents().size()){
System.out.println("set parent true");
taxon.setParent(currentTaxonomy.getParents().subList(parentIndex, currentTaxonomy.getParents().size()));
}
else if(parentIndex == -1){ //items loaded from get children - the current Taxonomy item is the parent
List<TaxonomyRow> list = new ArrayList<TaxonomyRow>();
list.add(currentTaxonomy);
list.addAll(currentTaxonomy.getParents());
System.out.println("parentIndex == -1");
printParents(taxon);
taxon.setParent(list);
}
printParents(taxon);
tablesForTaxonomyRow.addTabItem(taxon, dataSource);
}
});
}
return anchor;
}
void printParents(TaxonomyRow taxon){
System.out.println("principal "+taxon.getName());
int i = 0;
for (TaxonomyRow tax : taxon.getParents()) {
System.out.println(++i + " parent name " + tax.getName());
}
}
private Text getLabelByTaxonomy(final TaxonomyRow taxon)
{
Text label = null;
if(taxon!=null){
if(!NormalizeString.isUndefined(taxon.getName()))
label = new Text(taxon.getName());
else
label = new Text("Name not found");
}
return label;
}
public Html getHTMLTableForTaxonomy(TaxonomyRow row, boolean isNewTab){
//Init values
String dataProviderName = "";
String dataSetCitation= "";
String matchingAccordionTo= "";
String rank= "";
// String matchingCredits= "";
String statusName = "";
String dateModified = "";
String statusRemark = "";
String author = "";
String lsid = "";
String credits = "";
String propertiesHtml = "";
if(row.getDataProviderName()!=null) dataProviderName = row.getDataProviderName();
if(row.getStatusName()!=null) statusName = row.getStatusName();
if(row.getDateModified()!=null) dateModified = row.getDateModified();
if(row.getDataSetCitation()!=null) dataSetCitation = row.getDataSetCitation();
if(row.getRank()!=null) rank = row.getRank();
if(row.getAccordingTo()!=null) matchingAccordionTo = row.getAccordingTo();
if(row.getStatusRemarks()!=null) statusRemark = row.getStatusRemarks();
if(row.getAuthor()!=null) author = row.getAuthor();
if(row.getLsid()!=null) lsid = row.getLsid();
if(row.getCredits()!=null) credits = row.getCredits();
if(row.getProperties()!=null){
List<ItemParameter> hashProperties = row.getProperties();
Collections.sort(hashProperties, ItemParameter.COMPARATOR);
propertiesHtml+="<table class=\"parameters\">";
for (ItemParameter itemParameter : hashProperties) {
propertiesHtml+=
"<tr>" +
" <td class=\"title\">"+itemParameter.getKey()+"</td>" +
" <td>"+itemParameter.getValue()+"</td>" +
"</tr>";
}
propertiesHtml+="</table>";
}
//Create list common name
String commonNames = "";
// if(isNewTab){
if(row.getCommonNames()!=null){
for (CommonName comName : row.getCommonNames()) {
commonNames+= "<b>"+comName.getName()+"</b>" +" ("+comName.getLanguage()+") - ";
}
}
// }
String table = "<table class=\"imagetable\">";
// if(isNewTab)
table+=
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.COMMON_NAMES.getName()+" (Language)</td>" +
" <td>"+commonNames+"</td>" +
"</tr>";
table+="<tr>" +
" <td class=\"title\">"+TaxonomyGridField.STATUSREFNAME.getName()+"</td>" +
" <td>"+statusName+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.STATUS_REMARKS.getName()+"</td>" +
" <td>"+statusRemark+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.DATASOURCE.getName()+"</td>" +
" <td>"+dataProviderName+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.DATEMODIFIED.getName()+"</td>" +
" <td>"+dateModified+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.MATCHING_RANK.getName()+"</td>" +
" <td>"+rank+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.CITATION.getName()+"</td>" +
" <td>"+dataSetCitation+"</td>" +
"</tr>" +
// "<tr>" +
// " <td class=\"title\">"+TaxonomyGridField.MATCHING_AUTHOR.getName()+"</td>" +
// " <td>"+matchingAccordionTo+"</td>" +
// "</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.LSID.getName()+"</td>" +
" <td>"+lsid+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.AUTHOR.getName()+"</td>" +
" <td>"+author+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.CREDITS.getName()+"</td>" +
" <td>"+credits+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+TaxonomyGridField.PROPERTIES.getName()+"</td>" +
" <td>"+propertiesHtml+"</td>" +
"</tr>" +
"</table>";
return new Html(table);
}
public FlexTable getHTMLTableForTaxonomyWithRef(final TaxonomyRow row,boolean isNewTab, final String dataSource) {
// Init values
String dataProviderName = "";
String dataSetCitation = "";
String matchingAccordionTo = "";
String rank = "";
// String matchingCredits= "";
String statusName = "";
String dateModified = "";
String statusRemark = "";
String author = "";
String lsid = "";
String credits = "";
String refId = null;
String propertiesHtml = "";
if (row.getDataProviderName() != null)
dataProviderName = row.getDataProviderName();
if (row.getStatusName() != null)
statusName = row.getStatusName();
if (row.getDateModified() != null)
dateModified = row.getDateModified();
if (row.getDataSetCitation() != null)
dataSetCitation = row.getDataSetCitation();
if (row.getRank() != null)
rank = row.getRank();
if (row.getAccordingTo() != null)
matchingAccordionTo = row.getAccordingTo();
if (row.getStatusRemarks() != null)
statusRemark = row.getStatusRemarks();
if (row.getAuthor() != null)
author = row.getAuthor();
if (row.getLsid() != null)
lsid = row.getLsid();
if (row.getCredits() != null)
credits = row.getCredits();
if (row.getStatusRefId() != null && !row.getStatusRefId().isEmpty())
refId = row.getStatusRefId();
if (row.getProperties() != null) {
List<ItemParameter> hashProperties = row.getProperties();
Collections.sort(hashProperties,
ItemParameter.COMPARATOR);
propertiesHtml += "<table class=\"parameters\">";
for (ItemParameter itemParameter : hashProperties) {
propertiesHtml += "<tr>" + " <td class=\"title\">"
+ itemParameter.getKey() + "</td>" + " <td>"
+ itemParameter.getValue() + "</td>" + "</tr>";
}
propertiesHtml += "</table>";
}
// Create list common name
String commonNames = "";
// if(isNewTab){
if (row.getCommonNames() != null) {
for (CommonName comName : row.getCommonNames()) {
commonNames += "<b>" + comName.getName() + "</b>" + " ("
+ comName.getLanguage() + ") - ";
}
}
// }
final FlexTable flexTable = new FlexTable();
flexTable.setStyleName("imagetable");
flexTable.setWidget(0, 0,new Label(TaxonomyGridField.COMMON_NAMES.getName()));
flexTable.setWidget(0, 1, new Html(commonNames));
flexTable.setWidget(1, 0,new Label(TaxonomyGridField.STATUSREFNAME.getName()));
flexTable.setWidget(1, 1, new Label(statusName));
if (refId != null) {
final String status;
if(!statusRemark.isEmpty())
status = statusRemark;
else
status = statusName;
final String referenceId = refId;
flexTable.setWidget(2, 0, new Label(TaxonomyGridField.STATUS_REMARKS.getName()));
AbstractImagePrototype synonyms = AbstractImagePrototype.create(Resources.INSTANCE.getSearch());
final Image imageStatusRemark = synonyms.createImage();
imageStatusRemark.setStyleName("image-load-synonyms");
imageStatusRemark.setAltText("show accepted name");
imageStatusRemark.setTitle("show accepted name");
final LayoutContainer layoutContainer = new LayoutContainer();
final Label labelStatusRemark = new Label(statusRemark);
labelStatusRemark.addStyleName("status-of");
layoutContainer.add(labelStatusRemark);
imageStatusRemark.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
flexTable.remove(layoutContainer);
if(row.getParents().size()>0)
getTaxonomyByReferenceId(flexTable, 2, 1, status, referenceId, dataSource, row.getParents());
}
});
layoutContainer.add(labelStatusRemark);
layoutContainer.add(imageStatusRemark);
flexTable.setWidget(2, 1, layoutContainer);
} else {
flexTable.setWidget(2, 0, new Label(TaxonomyGridField.STATUS_REMARKS.getName()));
flexTable.setWidget(2, 1, new Label(statusRemark));
}
//Create row get synonyms
flexTable.setWidget(3, 0,new Label(TaxonomyGridField.SYNONYMS.getName()));
AbstractImagePrototype synonyms = AbstractImagePrototype.create(Resources.INSTANCE.getSearch());
final Image imageSynonyms = synonyms.createImage();
imageSynonyms.setStyleName("image-load-synonyms");
imageSynonyms.setAltText("show synonyms");
imageSynonyms.setTitle("show synonyms");
imageSynonyms.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
flexTable.remove(imageSynonyms);
// DEBUG
// System.out.println("getSynonyms of "+row.getName() + " serviceId "+row.getServiceId());
if(row.getParents().size()>0){
//TODO
getSynonymsByReferenceId(flexTable, 3, 1, row.getServiceId(),dataSource, row.getParents());
}
}
});
flexTable.setWidget(3, 1, imageSynonyms);
flexTable.setWidget(4, 0,new Label(TaxonomyGridField.DATASOURCE.getName()));
flexTable.setWidget(4, 1, new Label(dataProviderName));
flexTable.setWidget(5, 0,new Label(TaxonomyGridField.DATEMODIFIED.getName()));
flexTable.setWidget(5, 1, new Label(dateModified));
flexTable.setWidget(6, 0,
new Label(TaxonomyGridField.MATCHING_RANK.getName()));
flexTable.setWidget(6, 1, new Label(rank));
flexTable.setWidget(7, 0,
new Label(TaxonomyGridField.CITATION.getName()));
flexTable.setWidget(7, 1, new Label(dataSetCitation));
flexTable.setWidget(8, 0, new Label(TaxonomyGridField.LSID.getName()));
flexTable.setWidget(8, 1, new Label(lsid));
flexTable
.setWidget(9, 0, new Label(TaxonomyGridField.AUTHOR.getName()));
flexTable.setWidget(9, 1, new Label(author));
flexTable.setWidget(10, 0,
new Label(TaxonomyGridField.CREDITS.getName()));
flexTable.setWidget(10, 1, new Label(credits));
flexTable.setWidget(11, 0,
new Label(TaxonomyGridField.PROPERTIES.getName()));
flexTable.setWidget(11, 1, new Html(propertiesHtml));
for (int i = 0; i < flexTable.getRowCount(); i++) {
flexTable.getFlexCellFormatter().setStyleName(i, 0, "title");
}
return flexTable;
}
public void getSynonymsByReferenceId(FlexTable flexTable, int row, int col, String refId, final String dataSource, final List<TaxonomyRow> parents){
final LayoutContainer layoutContainer = new LayoutContainer();
final Image loading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls()).createImage();
layoutContainer.add(loading);
flexTable.setWidget(row, col, layoutContainer);
SpeciesDiscovery.taxonomySearchService.retrieveSynonymsByRefId(refId, new AsyncCallback<List<TaxonomyRow>>() {
@Override
public void onFailure(Throwable caught) {
Info.display("Error laoding child", "An error occurred in loading, retry.");
Log.error("Error laoding child", "An error occurred in loading, retry." +caught);
}
@Override
public void onSuccess(List<TaxonomyRow> result) {
Log.trace("getReferenceById return " +result.size() + " items");
// System.out.println("getReferenceById return " +result.size() + " items");
if(result.size()>0){
layoutContainer.remove(loading);
LayoutContainer lc = new LayoutContainer();
lc.setLayout(new ColumnLayout());
if(result.size()>0){
for (int i=0; i<result.size()-1; i++) {
TaxonomyRow taxonomy = result.get(i);
// System.out.println("child "+taxonomy);
//SET PARENTS
taxonomy.setParent(parents);
Text comma = new Text(",");
comma.setStyleAttribute("margin-right", "5px");
lc.add(getAnchorByTaxonomy(taxonomy, dataSource,-2));
lc.add(comma);
}
TaxonomyRow taxonomy = result.get(result.size()-1);
// System.out.println("child "+taxonomy);
//SET PARENTS
taxonomy.setParent(parents);
lc.add(getAnchorByTaxonomy(taxonomy, dataSource,-2));
}
layoutContainer.add(lc);
}
else{
layoutContainer.remove(loading);
layoutContainer.add(new Label("not found"));
}
layoutContainer.layout();
}
});
}
public void getTaxonomyByReferenceId(FlexTable flexTable, int row, int col, final String statusRemark, String refId, final String dataSource, final List<TaxonomyRow> parents){
final LayoutContainer layoutContainer = new LayoutContainer();
// hp.getElement().getStyle().setBorderStyle(BorderStyle.NONE);
// hp.getElement().getStyle().setBorderWidth(0, Unit.PX);
final Label status = new Label(statusRemark);
layoutContainer.add(status);
// hp.setCellWidth(status, "160px");
final Image loading = AbstractImagePrototype.create(Resources.INSTANCE.loadingBalls()).createImage();
layoutContainer.add(loading);
flexTable.setWidget(row, col, layoutContainer);
List<String> listId = new ArrayList<String>();
listId.add(refId);
SpeciesDiscovery.taxonomySearchService.retrieveTaxonomyByIds(listId, new AsyncCallback<List<TaxonomyRow>>() {
@Override
public void onFailure(Throwable caught) {
Info.display("Error laoding child", "An error occurred in loading, retry.");
Log.error("Error laoding child", "An error occurred in loading, retry." +caught);
}
@Override
public void onSuccess(List<TaxonomyRow> result) {
Log.trace("getReferenceById return " +result.size() + " items");
// System.out.println("getReferenceById return " +result.size() + " items");
if(result.size()>0){
layoutContainer.remove(status);
layoutContainer.remove(loading);
Label labelOf = new Label(statusRemark + " for ");
layoutContainer.add(labelOf);
LayoutContainer lc = new LayoutContainer();
lc.setLayout(new ColumnLayout());
if(result.size()>0){
for (int i=0; i<result.size()-1; i++) {
TaxonomyRow taxonomy = result.get(i);
// System.out.println("child "+taxonomy);
//SET PARENTS
taxonomy.setParent(parents);
Text comma = new Text(",");
comma.setStyleAttribute("margin-right", "5px");
lc.add(comma);
}
TaxonomyRow taxonomy = result.get(result.size()-1);
//FOR DEBUG
// System.out.println("child "+taxonomy);
//SET PARENTS
taxonomy.setParent(parents);
//TODO
lc.add(getAnchorByTaxonomy(taxonomy, dataSource, -2));
}
layoutContainer.add(lc);
}
layoutContainer.layout();
}
});
}
// protected ContentPanel getPanelForTaxonomy(TaxonomyRow taxon, String dataSource, boolean isNewTab, final int parentIndex) {
//
// ContentPanel contentPanel = new ContentPanel();
//// contentPanel.setLayout(new FitLayout());
// contentPanel.setHeaderVisible(false);
// contentPanel.setBodyBorder(false);
//
// contentPanel.setStyleAttribute("padding", "5px");
// contentPanel.setStyleAttribute("margin", "5px");
//
// VerticalPanel verticaPanel = new VerticalPanel();
// verticaPanel.setSize("100%", "100%");
//
// contentPanel.add(new Html("<br/><br/><p style=\"font-size:18px;\"><b>" + taxon.getName() + "</b></p><hr>"));
// contentPanel.add(new Html("<br/><br/><p style=\"font-size:12px;\"><b>Scientific Classification</b></p><br/>"));
//
// contentPanel.add(getPanelClassificationForTaxonomy(taxon, dataSource, isNewTab));
//
// contentPanel.add(getHTMLTableForTaxonomyWithRef(taxon, isNewTab, dataSource,parentIndex));
//
// return contentPanel;
//
// }
// protected void addTabItem(final TaxonomyRow taxon, final String dataSource, final int parentIndex){
//
//
// TabItem tabItem = new TabItem();
//// tabItem.setLayout(new FitLayout());
// tabItem.setScrollMode(Scroll.AUTO);
// tabItem.setClosable(true);
//
//
// ContentPanel cp = new ContentPanel();
// cp.setHeaderVisible(false);
// ToolBar toolbar = new ToolBar();
//
//
// Button btnSaveTaxonomyChildren = new Button(ConstantsSpeciesDiscovery.SAVE_TAXONOMY_CHILDREN);
// Menu formatSubMenu = new Menu();
// btnSaveTaxonomyChildren.setMenu(formatSubMenu);
// btnSaveTaxonomyChildren.setScale(ButtonScale.SMALL);
// btnSaveTaxonomyChildren.setIconAlign(IconAlign.TOP);
// btnSaveTaxonomyChildren.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getSaveProducts()));
// btnSaveTaxonomyChildren.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.SAVE_TAXONOMY_CHILDREN, ConstantsSpeciesDiscovery.SAVES_TAXONOMY_CHILDREN_FROM_RESULT));
//
// MenuItem darwinCoreArchiveItem = new MenuItem(ConstantsSpeciesDiscovery.DARWIN_CORE_ARCHIVE);
// darwinCoreArchiveItem.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.SAVES_IN_DARWIN_CORE_ARCHIVE_FORMAT));
// darwinCoreArchiveItem.addSelectionListener(new SelectionListener<MenuEvent>() {
//
// @Override
// public void componentSelected(MenuEvent ce) {
// eventBus.fireEvent(new CreateTaxonomyJobEvent(taxon, dataSource, TaxonomyJobType.BYCHILDREN));
// }
// });
//
// formatSubMenu.add(darwinCoreArchiveItem);
// toolbar.add(btnSaveTaxonomyChildren);
//
// cp.setTopComponent(toolbar);
// cp.setBodyBorder(false);
//// cp.setScrollMode(Scroll.AUTOY);
//
// String tabName = taxon.getName() + " ("+ dataSource + ")";
// tabItem.setText(tabName);
//
// cp.add(getPanelForTaxonomy(taxon, dataSource, true, parentIndex));
//
// tabItem.add(cp);
//
// tabPanel.add(tabItem);
//
// }
}

View File

@ -0,0 +1,159 @@
package org.gcube.portlets.user.speciesdiscovery.client.cluster;
import java.util.Collections;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.util.SpeciesGridFields;
import org.gcube.portlets.user.speciesdiscovery.shared.CommonName;
import org.gcube.portlets.user.speciesdiscovery.shared.ItemParameter;
import org.gcube.portlets.user.speciesdiscovery.shared.ResultRow;
import com.extjs.gxt.ui.client.widget.Html;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class TablesForResultRow {
public static Html getTableForResultRow(ResultRow row, String classification){
//Init values
String dataSourceName = "";
String dataProviderName = "";
String dataSetName = "";
String dataSetCitation= "";
String matchingTaxonName= "";
String matchingAccordionTo= "";
String matchingRank= "";
String matchingCredits= "";
int occurencesCount = 0;
String author = "";
String lsid = "";
String credits = "";
String propertiesHtml = "";
//Validate values
if(row.getParents()!=null){
if(row.getParents().get(0).getName()!=null) matchingTaxonName = row.getParents().get(0).getName();
if(row.getParents().get(0).getAccordingTo()!=null) matchingAccordionTo = row.getParents().get(0).getAccordingTo();
if(row.getParents().get(0).getRank()!=null) matchingRank = row.getParents().get(0).getRank();
}
if(row.getDataSourceName()!=null) dataSourceName = row.getDataSourceName();
if(row.getDataProviderName()!=null) dataProviderName = row.getDataProviderName();
if(row.getDataSetName()!=null) dataSetName = row.getDataSetName();
if(row.getDataSetCitation()!=null) dataSetCitation = row.getDataSetCitation();
if(row.getMatchingCredits()!=null) matchingCredits = row.getMatchingCredits();
if(row.getOccurencesCount()!=0) occurencesCount = row.getOccurencesCount();
String commonNames = "";
if(row.getCommonNames()!=null){
for (CommonName comName : row.getCommonNames()) {
commonNames+= "<b>"+comName.getName()+"</b>" +" ("+comName.getLanguage()+") - ";
}
}
if(row.getAuthor()!=null) author = row.getAuthor();
if(row.getLsid()!=null) lsid = row.getLsid();
if(row.getCredits()!=null) credits = row.getCredits();
if(row.getProperties()!=null){
List<ItemParameter> listProperties = row.getProperties();
Collections.sort(listProperties, ItemParameter.COMPARATOR);
propertiesHtml+="<table class=\"parameters\">";
for (ItemParameter itemParameter : listProperties) {
propertiesHtml+=
"<tr>" +
" <td class=\"title\">"+itemParameter.getKey()+"</td>" +
" <td>"+itemParameter.getValue()+"</td>" +
"</tr>";
}
propertiesHtml+="</table>";
}
String table = "<table class=\"imagetable\">" +
"<tr>" +
" <th>"+matchingTaxonName+"</th>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.CLASSIFICATION_STRING.getName()+"</td>" +
" <td>"+classification+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.COMMON_NAMES.getName()+" (Language)</td>" +
" <td>"+commonNames+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.DATASOURCE.getName()+"</td>" +
" <td>"+dataSourceName+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.DATAPROVIDER.getName()+"</td>" +
" <td>"+dataProviderName+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.DATASET.getName()+"</td>" +
" <td>"+dataSetName+"</td>" +
"</tr>" +
// "<tr>" +
// " <td class=\"title\">"+SpeciesGridFields.MATCHING_AUTHOR.getName()+"</td>" +
// " <td>"+matchingAccordionTo+"</td>" +
// "</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.MATCHING_RANK.getName()+"</td>" +
" <td>"+matchingRank+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.DATASET_CITATION.getName()+"</td>" +
" <td>"+dataSetCitation+"</td>" +
"</tr>" +
// "<tr>" +
// " <td class=\"title\">"+SpeciesGridFields.MATCHING_CREDITS.getName()+"</td>" +
// " <td>"+matchingCredits+"</td>" +
// "</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.PRODUCT_OCCURRENCES.getName()+"</td>" +
" <td>"+occurencesCount+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.LSID.getName()+"</td>" +
" <td>"+lsid+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.AUTHOR.getName()+"</td>" +
" <td>"+author+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.CREDITS.getName()+"</td>" +
" <td>"+credits+"</td>" +
"</tr>" +
"<tr>" +
" <td class=\"title\">"+SpeciesGridFields.PROPERTIES.getName()+"</td>" +
" <td>"+propertiesHtml+"</td>" +
"</tr>" +
"</table>";
return new Html(table);
}
}

View File

@ -0,0 +1,178 @@
package org.gcube.portlets.user.speciesdiscovery.client.cluster;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.ConstantsSpeciesDiscovery;
import org.gcube.portlets.user.speciesdiscovery.client.event.CreateTaxonomyJobEvent;
import org.gcube.portlets.user.speciesdiscovery.client.event.CreateTaxonomyJobEvent.TaxonomyJobType;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyRow;
import com.extjs.gxt.ui.client.Style.ButtonScale;
import com.extjs.gxt.ui.client.Style.IconAlign;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.event.MenuEvent;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.menu.Menu;
import com.extjs.gxt.ui.client.widget.menu.MenuItem;
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.FlexTable;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class TablesForTaxonomyRow {
private TabPanel tabPanel;
private EventBus eventBus;
private List<TaxonomyRow> parents = null;
private TabItemForTaxonomyRow tabTR;
// private HashMap<String, TabItemForTaxonomyRow> hashTR = new HashMap<String, TabItemForTaxonomyRow>();
public List<TaxonomyRow> getParents() {
return parents;
}
public void setParents(List<TaxonomyRow> parents) {
this.parents = parents;
}
public TablesForTaxonomyRow(TabPanel tabPanel2, EventBus eventBus2) {
this.tabPanel = tabPanel2;
this.eventBus = eventBus2;
this.tabTR = new TabItemForTaxonomyRow(this, this.tabPanel, this.eventBus);
}
/**
*
* @param taxonomy
* @param isNewTab - set true if has been clicked a classification link, or false otherwise
* @return
*/
public VerticalPanel getPanelClassificationForTaxonomy(TaxonomyRow taxonomy, String dataSource, boolean isNewTab){
// hashTR.put(taxonomy.getIdToString(),tabTR);
tabTR.setCurrentTaxonomy(taxonomy);
//DEBUG
System.out.println("in getPanelClassificationForTaxonomy...");
System.out.println("principal "+taxonomy.getName() + " id " + taxonomy.getServiceId()+" parents");
int i=0;
for (TaxonomyRow tax : taxonomy.getParents()) {
System.out.println(++i + " parent name " + tax.getName());
}
return tabTR.getPanelClassificationForTaxonomy(taxonomy, dataSource, isNewTab);
}
/**
*
* @param row
* @param isNewTab
* @param dataSource
* @param parentIndex
* @return
*/
public FlexTable getHTMLTableForTaxonomyWithRef(final TaxonomyRow row,boolean isNewTab, final String dataSource) {
return tabTR.getHTMLTableForTaxonomyWithRef(row, isNewTab, dataSource);
}
protected ContentPanel getPanelForTaxonomy(TaxonomyRow taxon, String dataSource, boolean isNewTab) {
ContentPanel contentPanel = new ContentPanel();
// contentPanel.setLayout(new FitLayout());
contentPanel.setHeaderVisible(false);
contentPanel.setBodyBorder(false);
contentPanel.setStyleAttribute("padding", "5px");
contentPanel.setStyleAttribute("margin", "5px");
VerticalPanel verticaPanel = new VerticalPanel();
verticaPanel.setSize("100%", "100%");
contentPanel.add(new Html("<br/><br/><p style=\"font-size:18px;\"><b>" + taxon.getName() + "</b></p><hr>"));
contentPanel.add(new Html("<br/><br/><p style=\"font-size:12px;\"><b>Scientific Classification</b></p><br/>"));
contentPanel.add(getPanelClassificationForTaxonomy(taxon, dataSource, isNewTab));
contentPanel.add(getHTMLTableForTaxonomyWithRef(taxon, isNewTab, dataSource));
return contentPanel;
}
protected void addTabItem(final TaxonomyRow taxon, final String dataSource){
this.tabTR = new TabItemForTaxonomyRow(this, this.tabPanel, this.eventBus);
TabItem tabItem = new TabItem();
// tabItem.setLayout(new FitLayout());
tabItem.setScrollMode(Scroll.AUTO);
tabItem.setClosable(true);
ContentPanel cp = new ContentPanel();
cp.setHeaderVisible(false);
ToolBar toolbar = new ToolBar();
Button btnSaveTaxonomyChildren = new Button(ConstantsSpeciesDiscovery.SAVE_TAXONOMY_CHILDREN);
Menu formatSubMenu = new Menu();
btnSaveTaxonomyChildren.setMenu(formatSubMenu);
btnSaveTaxonomyChildren.setScale(ButtonScale.SMALL);
btnSaveTaxonomyChildren.setIconAlign(IconAlign.TOP);
btnSaveTaxonomyChildren.setIcon(AbstractImagePrototype.create(Resources.INSTANCE.getSaveProducts()));
btnSaveTaxonomyChildren.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.SAVE_TAXONOMY_CHILDREN, ConstantsSpeciesDiscovery.SAVES_TAXONOMY_CHILDREN_FROM_RESULT));
MenuItem darwinCoreArchiveItem = new MenuItem(ConstantsSpeciesDiscovery.DARWIN_CORE_ARCHIVE);
darwinCoreArchiveItem.setToolTip(new ToolTipConfig(ConstantsSpeciesDiscovery.SAVES_IN_DARWIN_CORE_ARCHIVE_FORMAT));
darwinCoreArchiveItem.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
eventBus.fireEvent(new CreateTaxonomyJobEvent(taxon, dataSource, TaxonomyJobType.BYCHILDREN));
}
});
formatSubMenu.add(darwinCoreArchiveItem);
toolbar.add(btnSaveTaxonomyChildren);
cp.setTopComponent(toolbar);
cp.setBodyBorder(false);
// cp.setScrollMode(Scroll.AUTOY);
String tabName = taxon.getName() + " ("+ dataSource + ")";
tabItem.setText(tabName);
cp.add(getPanelForTaxonomy(taxon, dataSource, true));
tabItem.add(cp);
tabPanel.add(tabItem);
}
}

View File

@ -0,0 +1,36 @@
package org.gcube.portlets.user.speciesdiscovery.client.detail;
import org.gcube.portlets.user.speciesdiscovery.client.util.SpeciesDetailsFields;
import com.extjs.gxt.ui.client.data.BaseModel;
import com.google.gwt.user.client.rpc.IsSerializable;
public class SpeciesDetail extends BaseModel implements IsSerializable {
/**
*
*/
private static final long serialVersionUID = 7073479182629932572L;
public SpeciesDetail() {
}
public SpeciesDetail(String name, String value, String group) {
set(SpeciesDetailsFields.NAME.getId(), name);
set(SpeciesDetailsFields.GROUP.getId(), group);
set(SpeciesDetailsFields.VALUE.getId(), value);
}
public String getGroup(){
return get(SpeciesDetailsFields.GROUP.getId());
}
public String getName(){
return get(SpeciesDetailsFields.NAME.getId());
}
public String getValue(){
return get(SpeciesDetailsFields.VALUE.getId());
}
}

View File

@ -0,0 +1,122 @@
package org.gcube.portlets.user.speciesdiscovery.client.detail;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.client.resources.Resources;
import org.gcube.portlets.user.speciesdiscovery.client.util.SpeciesDetailsFields;
import org.gcube.portlets.user.speciesdiscovery.client.util.SpeciesGridFields;
import org.gcube.portlets.user.speciesdiscovery.client.util.Util;
import org.gcube.portlets.user.speciesdiscovery.shared.CommonName;
import org.gcube.portlets.user.speciesdiscovery.shared.ResultRow;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.store.GroupingStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridGroupRenderer;
import com.extjs.gxt.ui.client.widget.grid.GroupColumnData;
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.google.gwt.user.client.ui.Image;
public class SpeciesDetailsPanel extends ContentPanel {
private Image image = new Image(Resources.INSTANCE.getNoPictureAvailable());
private Grid<SpeciesDetail> grid;
private GroupingStore<SpeciesDetail> store = new GroupingStore<SpeciesDetail>();
public SpeciesDetailsPanel() {
setLayout(new FlowLayout());
setHeading("Species Details");
setScrollMode(Scroll.AUTO);
image.setTitle("Species picture");
image.setAltText("");
image.setSize(String.valueOf(Resources.INSTANCE.getNoPictureAvailable().getWidth()), String.valueOf(Resources.INSTANCE.getNoPictureAvailable().getHeight()));
add(image);
store.groupBy(SpeciesDetailsFields.GROUP.getId());
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig name = Util.createColumnConfig(SpeciesDetailsFields.NAME, 100);
columns.add(name);
ColumnConfig value = Util.createColumnConfig(SpeciesDetailsFields.VALUE, 100);
columns.add(value);
ColumnModel cm = new ColumnModel(columns);
GroupingView view = new GroupingView();
view.setShowGroupedColumn(false);
view.setForceFit(true);
view.setSortingEnabled(false);
view.setStartCollapsed(true);
view.setGroupRenderer(new GridGroupRenderer() {
public String render(GroupColumnData data) {
String l = data.models.size() == 1 ? "Item" : "Items";
return data.group + " (" + data.models.size() + " " + l + ")";
}
});
grid = new Grid<SpeciesDetail>(store, cm);
grid.setView(view);
grid.setBorders(true);
grid.setHeight(318);
add(grid);
}
public void setSpeciesData(ModelData data){
// System.out.println("Setting details");
mask("Loading details..");
String scientificName = data.get(SpeciesGridFields.MATCHING_NAME.getId());
setHeading(scientificName+" details.");
String imageUrl = data.get(SpeciesGridFields.IMAGE.getId());
image.setUrl(imageUrl!=null?imageUrl:Resources.INSTANCE.getNoPictureAvailable().getSafeUri().asString());
image.setAltText("Image for "+scientificName);
image.setTitle(scientificName);
image.setPixelSize(Resources.INSTANCE.getNoPictureAvailable().getWidth(), Resources.INSTANCE.getNoPictureAvailable().getHeight());
ArrayList<SpeciesDetail> details = new ArrayList<SpeciesDetail>();
ResultRow row = (ResultRow) data.get(SpeciesGridFields.ROW.getId());
for (CommonName commonName:row.getCommonNames()) {
details.add(new SpeciesDetail(commonName.getLanguage(), commonName.getName(), SpeciesGridFields.COMMON_NAMES.getName()));
}
details.add(new SpeciesDetail(SpeciesGridFields.DATASOURCE.getName(), row.getDataSourceName(), SpeciesGridFields.PROVENANCE.getName()));
details.add(new SpeciesDetail(SpeciesGridFields.DATAPROVIDER.getName(), row.getDataProviderName(), SpeciesGridFields.PROVENANCE.getName()));
details.add(new SpeciesDetail(SpeciesGridFields.DATASET.getName(), row.getDataSetName(), SpeciesGridFields.PROVENANCE.getName()));
details.add(new SpeciesDetail(SpeciesGridFields.DATASET_CITATION.getName(), row.getDataSetCitation(), SpeciesGridFields.PROVENANCE.getName()));
// details.add(new SpeciesDetail(SpeciesGridFields.PRODUCT_IMAGES.getName(), String.valueOf(row.getImagesCount()), SpeciesGridFields.PRODUCTS.getName()));
// details.add(new SpeciesDetail(SpeciesGridFields.PRODUCT_MAPS.getName(), String.valueOf(row.getMapsCount()), SpeciesGridFields.PRODUCTS.getName()));
// details.add(new SpeciesDetail(SpeciesGridFields.PRODUCT_LAYERS.getName(), String.valueOf(row.getLayersCount()), SpeciesGridFields.PRODUCTS.getName()));
details.add(new SpeciesDetail(SpeciesGridFields.PRODUCT_OCCURRENCES.getName(), String.valueOf(row.getOccurencesCount()), SpeciesGridFields.PRODUCTS.getName()));
store.removeAll();
store.add(details);
// System.out.println("Details added "+details.size());
//grid.getView().refresh(false);
unmask();
//Log.debug("store contains : "+store.getModels().size());
}
}

View File

@ -0,0 +1,35 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ActiveButtonCheckAllRowEvent extends GwtEvent<ActiveButtonCheckAllRowEventHandler> {
public static final GwtEvent.Type<ActiveButtonCheckAllRowEventHandler> TYPE = new Type<ActiveButtonCheckAllRowEventHandler>();
private boolean activeFilter;
@Override
public Type<ActiveButtonCheckAllRowEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ActiveButtonCheckAllRowEventHandler handler) {
handler.onActiveCkeckAllRow(this);
}
public ActiveButtonCheckAllRowEvent(boolean activeFilter) {
this.activeFilter = activeFilter;
}
public boolean isActiveFilter() {
return activeFilter;
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface ActiveButtonCheckAllRowEventHandler extends EventHandler {
public void onActiveCkeckAllRow(ActiveButtonCheckAllRowEvent activeFilterCheckAllRowEvent);
}

View File

@ -0,0 +1,37 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import org.gcube.portlets.user.speciesdiscovery.shared.filter.ResultFilter;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ActiveFilterOnResultEvent extends GwtEvent<ActiveFilterOnResultEventHandler> {
public static final GwtEvent.Type<ActiveFilterOnResultEventHandler> TYPE = new Type<ActiveFilterOnResultEventHandler>();
private ResultFilter activeFilterObject;
@Override
public Type<ActiveFilterOnResultEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ActiveFilterOnResultEventHandler handler) {
handler.onActiveFilter(this);
}
public ActiveFilterOnResultEvent(ResultFilter activeFilter) {
this.activeFilterObject = activeFilter;
}
public ResultFilter getActiveFilterObject() {
return activeFilterObject;
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface ActiveFilterOnResultEventHandler extends EventHandler {
public void onActiveFilter(ActiveFilterOnResultEvent activeFilterOnResultEvent);
}

View File

@ -0,0 +1,38 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ActiveMaskLoadingGrid extends GwtEvent<ActiveMaskLoadingGridHandler> {
public static final GwtEvent.Type<ActiveMaskLoadingGridHandler> TYPE = new Type<ActiveMaskLoadingGridHandler>();
private boolean active;
@Override
public Type<ActiveMaskLoadingGridHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ActiveMaskLoadingGridHandler handler) {
handler.onActiveMaskLoadingGrid(this);
}
public ActiveMaskLoadingGrid(boolean active) {
this.active = active;
}
public boolean isActive() {
return active;
}
}

View File

@ -0,0 +1,17 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface ActiveMaskLoadingGridHandler extends EventHandler {
public void onActiveMaskLoadingGrid(ActiveMaskLoadingGrid activeLoadingGrid);
}

View File

@ -0,0 +1,42 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class CapabilitySelectedEvent extends GwtEvent<CapabilitySelectedEventHandler> {
public static final GwtEvent.Type<CapabilitySelectedEventHandler> TYPE = new Type<CapabilitySelectedEventHandler>();
private SpeciesCapability capability;
public CapabilitySelectedEvent(SpeciesCapability capability) {
this.capability = capability;
}
@Override
public Type<CapabilitySelectedEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CapabilitySelectedEventHandler handler) {
handler.onCapabilitySelected(this);
}
public SpeciesCapability getCapability() {
return capability;
}
public void setCapability(SpeciesCapability capability) {
this.capability = capability;
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface CapabilitySelectedEventHandler extends EventHandler {
public void onCapabilitySelected(CapabilitySelectedEvent capabilitySelectedEvent);
}

View File

@ -0,0 +1,26 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ChangeFilterClassificationOnResultEvent extends GwtEvent<ChangeFilterClassificationOnResultEventHandler> {
public static final GwtEvent.Type<ChangeFilterClassificationOnResultEventHandler> TYPE = new Type<ChangeFilterClassificationOnResultEventHandler>();
@Override
public Type<ChangeFilterClassificationOnResultEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ChangeFilterClassificationOnResultEventHandler handler) {
handler.onChangeFilter(this);
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface ChangeFilterClassificationOnResultEventHandler extends EventHandler {
public void onChangeFilter(ChangeFilterClassificationOnResultEvent changeFilterClassificationOnResultEvent);
}

View File

@ -0,0 +1,29 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class CompletedLoadDataSourceEvent extends GwtEvent<CompletedLoadDataSourceEventHandler> {
public static final GwtEvent.Type<CompletedLoadDataSourceEventHandler> TYPE = new Type<CompletedLoadDataSourceEventHandler>();
@Override
public Type<CompletedLoadDataSourceEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CompletedLoadDataSourceEventHandler handler) {
handler.onCompletedLoadDataSource(this);
}
public CompletedLoadDataSourceEvent() {
}
}

View File

@ -0,0 +1,17 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author francesco-mangiacrapa
*
*/
public interface CompletedLoadDataSourceEventHandler extends EventHandler {
public void onCompletedLoadDataSource(
CompletedLoadDataSourceEvent completedLoadDataSourceEvent);
}

View File

@ -0,0 +1,104 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.shared.OccurrencesSaveEnum;
import org.gcube.portlets.user.speciesdiscovery.shared.SaveFileFormat;
import com.google.gwt.event.shared.GwtEvent;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class CreateOccurrenceJobEvent extends GwtEvent<CreateOccurrenceJobEventHandler> {
public static final GwtEvent.Type<CreateOccurrenceJobEventHandler> TYPE = new Type<CreateOccurrenceJobEventHandler>();
private SaveFileFormat fileFormat;
private int expectedOccurrences;
private OccurrencesSaveEnum saveEnum;
private List<String> listDataSourceFound;
private String searchTerm;
private boolean isByDataSource;
@Override
public Type<CreateOccurrenceJobEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CreateOccurrenceJobEventHandler handler) {
handler.onCreateSpeciesJob(this);
}
/**
*
* @param fileFormat
* @param expectedOccurrences
* @param save
* @param listDataSourceFound
* @param searchTerm
* @param isByDataSource
*/
public CreateOccurrenceJobEvent(SaveFileFormat fileFormat, int expectedOccurrences, OccurrencesSaveEnum save, List<String> listDataSourceFound, String searchTerm, boolean isByDataSource) {
this.fileFormat = fileFormat;
this.expectedOccurrences = expectedOccurrences;
this.saveEnum = save;
this.listDataSourceFound = listDataSourceFound;
this.searchTerm = searchTerm;
this.isByDataSource = isByDataSource;
}
public OccurrencesSaveEnum getSaveEnum() {
return saveEnum;
}
public void setSaveEnum(OccurrencesSaveEnum saveEnum) {
this.saveEnum = saveEnum;
}
public List<String> getListDataSourceFound() {
return listDataSourceFound;
}
public void setListDataSourceFound(ArrayList<String> listDataSourceFound) {
this.listDataSourceFound = listDataSourceFound;
}
public SaveFileFormat getFileFormat() {
return fileFormat;
}
public void setFileFormat(SaveFileFormat fileFormat) {
this.fileFormat = fileFormat;
}
public int getExpectedOccurrences() {
return expectedOccurrences;
}
public void setExpectedOccurrences(int expectedOccurrences) {
this.expectedOccurrences = expectedOccurrences;
}
public String getSearchTerm() {
return searchTerm;
}
public void setSearchTerm(String searchTerm) {
this.searchTerm = searchTerm;
}
public boolean isByDataSource() {
return isByDataSource;
}
public void setByDataSource(boolean isByDataSource) {
this.isByDataSource = isByDataSource;
}
}

View File

@ -0,0 +1,17 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface CreateOccurrenceJobEventHandler extends EventHandler {
public void onCreateSpeciesJob(CreateOccurrenceJobEvent createOccurrenceJobEvent);
}

View File

@ -0,0 +1,73 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import org.gcube.portlets.user.speciesdiscovery.shared.TaxonomyRow;
import com.google.gwt.event.shared.GwtEvent;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class CreateTaxonomyJobEvent extends GwtEvent<CreateTaxonomyJobEventHandler> {
public static final GwtEvent.Type<CreateTaxonomyJobEventHandler> TYPE = new Type<CreateTaxonomyJobEventHandler>();
private TaxonomyRow taxonomy;
private String dataSourceName;
public enum TaxonomyJobType {BYCHILDREN, BYIDS};
private TaxonomyJobType jobType;
@Override
public Type<CreateTaxonomyJobEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CreateTaxonomyJobEventHandler handler) {
handler.onCreateSpeciesJob(this);
}
/**
*
* @param taxonomy
* @param dataSourceName
* @param type
* @param rank
*/
public CreateTaxonomyJobEvent(TaxonomyRow taxonomy, String dataSourceName, TaxonomyJobType jobType) {
this.taxonomy = taxonomy;
this.dataSourceName = dataSourceName;
this.jobType = jobType;
}
/**
*
* @param jobType
*/
public CreateTaxonomyJobEvent(TaxonomyJobType jobType){
this.jobType = jobType;
}
public TaxonomyJobType getJobType() {
return jobType;
}
public TaxonomyRow getTaxonomy() {
return taxonomy;
}
public void setTaxonomy(TaxonomyRow taxonomy) {
this.taxonomy = taxonomy;
}
public String getDataSourceName() {
return dataSourceName;
}
public void setDataSourceName(String dataSourceName) {
this.dataSourceName = dataSourceName;
}
}

View File

@ -0,0 +1,17 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface CreateTaxonomyJobEventHandler extends EventHandler {
public void onCreateSpeciesJob(CreateTaxonomyJobEvent createSpeciesJobEvent);
}

View File

@ -0,0 +1,28 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class DisableFilterEvent extends GwtEvent<DisableFilterEventHandler> {
public static final GwtEvent.Type<DisableFilterEventHandler> TYPE = new Type<DisableFilterEventHandler>();
@Override
public Type<DisableFilterEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(DisableFilterEventHandler handler) {
handler.onDisableFilter(this);
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface DisableFilterEventHandler extends EventHandler {
public void onDisableFilter(DisableFilterEvent disableFilterEvent);
}

View File

@ -0,0 +1,29 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class LoadDataSourceEvent extends GwtEvent<LoadDataSourceEventHandler> {
public static final GwtEvent.Type<LoadDataSourceEventHandler> TYPE = new Type<LoadDataSourceEventHandler>();
@Override
public Type<LoadDataSourceEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(LoadDataSourceEventHandler handler) {
handler.onLoadDataSource(this);
}
public LoadDataSourceEvent() {
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface LoadDataSourceEventHandler extends EventHandler {
public void onLoadDataSource(LoadDataSourceEvent loadDataSourceEvent);
}

View File

@ -0,0 +1,40 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ReLoadListJobEvent extends GwtEvent<ReLoadListJobEventHandler> {
public static final GwtEvent.Type<ReLoadListJobEventHandler> TYPE = new Type<ReLoadListJobEventHandler>();
private SearchResultType loadType;
@Override
public Type<ReLoadListJobEventHandler> getAssociatedType() {
return TYPE;
}
public ReLoadListJobEvent(SearchResultType loadType){
this.loadType = loadType;
}
public SearchResultType getLoadType() {
return loadType;
}
@Override
protected void dispatch(ReLoadListJobEventHandler handler) {
handler.onLoadJobList(this);
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface ReLoadListJobEventHandler extends EventHandler {
public void onLoadJobList(ReLoadListJobEvent loadJobListEvent);
}

View File

@ -0,0 +1,56 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import org.gcube.portlets.user.speciesdiscovery.shared.JobOccurrencesModel;
import org.gcube.portlets.user.speciesdiscovery.shared.JobTaxonomyModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ReSubmitJobEvent extends GwtEvent<ReSubmitJobEventHandler> {
public static final GwtEvent.Type<ReSubmitJobEventHandler> TYPE = new Type<ReSubmitJobEventHandler>();
private SearchResultType loadType;
private JobOccurrencesModel jobOccurrenceModel;
private JobTaxonomyModel jobTaxonomyModel;
@Override
public Type<ReSubmitJobEventHandler> getAssociatedType() {
return TYPE;
}
public ReSubmitJobEvent(SearchResultType loadType, JobOccurrencesModel jobOccurrenceModel, JobTaxonomyModel jobTaxonomyModel){
this.loadType = loadType;
this.jobOccurrenceModel = jobOccurrenceModel;
this.jobTaxonomyModel = jobTaxonomyModel;
}
public SearchResultType getLoadType() {
return loadType;
}
@Override
protected void dispatch(ReSubmitJobEventHandler handler) {
handler.onResubmitJob(this);
}
public JobOccurrencesModel getJobOccurrenceModel() {
return jobOccurrenceModel;
}
public JobTaxonomyModel getJobTaxonomyModel() {
return jobTaxonomyModel;
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface ReSubmitJobEventHandler extends EventHandler {
public void onResubmitJob(ReSubmitJobEvent reSubmitJobEvent);
}

View File

@ -0,0 +1,91 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import org.gcube.portlets.user.speciesdiscovery.shared.OccurrencesSaveEnum;
import org.gcube.portlets.user.speciesdiscovery.shared.SaveFileFormat;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
import com.google.gwt.event.shared.GwtEvent;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SaveItemsEvent extends GwtEvent<SaveItemsEventHandler> {
public static final GwtEvent.Type<SaveItemsEventHandler> TYPE = new Type<SaveItemsEventHandler>();
@Override
public Type<SaveItemsEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(SaveItemsEventHandler handler) {
handler.onSaveOccurrences(this);
}
protected SaveFileFormat fileFormat;
protected SearchResultType itemType;
private int expectedPoints;
private OccurrencesSaveEnum csvType;
/**
* @param taxonomyItem
* @param fileFormat
* @param count
*/
public SaveItemsEvent(SearchResultType itemType, SaveFileFormat fileFormat, int expectedPoints, OccurrencesSaveEnum csvType) {
this.fileFormat = fileFormat;
this.itemType = itemType;
this.expectedPoints = expectedPoints;
this.setCsvType(csvType);
}
/**
* @return the fileFormat
*/
public SaveFileFormat getFileFormat() {
return fileFormat;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SaveOccurrencesEvent [fileFormat=");
builder.append(fileFormat);
builder.append("]");
return builder.toString();
}
public SearchResultType getItemType() {
return itemType;
}
public void setItemType(SearchResultType itemType) {
this.itemType = itemType;
}
public void setFileFormat(SaveFileFormat fileFormat) {
this.fileFormat = fileFormat;
}
public int getExpectedPoints() {
return expectedPoints;
}
public void setCsvType(OccurrencesSaveEnum csvType) {
this.csvType = csvType;
}
public OccurrencesSaveEnum getCsvType() {
return csvType;
}
}

View File

@ -0,0 +1,17 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface SaveItemsEventHandler extends EventHandler {
public void onSaveOccurrences(SaveItemsEvent event);
}

View File

@ -0,0 +1,122 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSource;
import org.gcube.portlets.user.speciesdiscovery.shared.JobOccurrencesModel;
import org.gcube.portlets.user.speciesdiscovery.shared.JobTaxonomyModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
import com.google.gwt.event.shared.GwtEvent;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SaveJobEvent extends GwtEvent<SaveJobEventHandler> {
public static final GwtEvent.Type<SaveJobEventHandler> TYPE = new Type<SaveJobEventHandler>();
private String jobIdentifier;
private String scientificName;
private String rank;
private SearchResultType itemType;
private List<DataSource> listDataSources;
private JobTaxonomyModel jobTaxonomyModel;
private JobOccurrencesModel jobOccurrenceModel;
@Override
public Type<SaveJobEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(SaveJobEventHandler handler) {
handler.onSaveJob(this);
}
/**
*
* @param jobIdentifier
* @param scientificName
* @param listDataSource
* @param rank
* @param type
* @param jobTaxonomyModel
*/
public SaveJobEvent(String jobIdentifier, String scientificName, List<DataSource> dataSourceList, String rank, SearchResultType type, JobTaxonomyModel jobTaxonomyModel) {
this.jobIdentifier = jobIdentifier;
this.scientificName = scientificName;
this.listDataSources = dataSourceList;
this.rank = rank;
this.itemType = type;
this.jobTaxonomyModel = jobTaxonomyModel;
}
/**
*
* @param jobIdentifier
* @param scientificName
* @param dataSourceList
* @param type
* @param jobOccurrenceModel
*/
public SaveJobEvent(String jobIdentifier, String scientificName, List<DataSource> dataSourceList, SearchResultType type, JobOccurrencesModel jobOccurrenceModel) {
this.jobIdentifier = jobIdentifier;
this.scientificName = scientificName;
this.listDataSources = dataSourceList;
this.itemType = type;
this.jobOccurrenceModel = jobOccurrenceModel;
}
public String getJobIdentifier() {
return jobIdentifier;
}
public void setJobIdentifier(String jobIdentifier) {
this.jobIdentifier = jobIdentifier;
}
public String getScientificName() {
return scientificName;
}
public String getRank() {
return rank;
}
public SearchResultType getItemType() {
return itemType;
}
public JobTaxonomyModel getJobTaxonomyModel() {
return jobTaxonomyModel;
}
public JobOccurrencesModel getJobOccurrenceModel() {
return jobOccurrenceModel;
}
public void setJobTaxonomyModel(JobTaxonomyModel jobTaxonomyModel) {
this.jobTaxonomyModel = jobTaxonomyModel;
}
public void setJobOccurrenceModel(JobOccurrencesModel jobOccurrenceModel) {
this.jobOccurrenceModel = jobOccurrenceModel;
}
public List<DataSource> getListDataSources() {
return listDataSources;
}
public void setListDataSources(List<DataSource> listDataSources) {
this.listDataSources = listDataSources;
}
}

View File

@ -0,0 +1,17 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface SaveJobEventHandler extends EventHandler {
public void onSaveJob(SaveJobEvent saveJobEvent);
}

View File

@ -0,0 +1,26 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class SearchCompleteEvent extends GwtEvent<SearchCompleteEventHandler> {
public static GwtEvent.Type<SearchCompleteEventHandler> TYPE = new Type<SearchCompleteEventHandler>();
@Override
public Type<SearchCompleteEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(SearchCompleteEventHandler handler) {
handler.onSearchComplete(this);
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface SearchCompleteEventHandler extends EventHandler {
public void onSearchComplete(SearchCompleteEvent event);
}

View File

@ -0,0 +1,165 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import java.util.Date;
import java.util.List;
import org.gcube.portlets.user.speciesdiscovery.shared.DataSourceModel;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchType;
import org.gcube.portlets.user.speciesdiscovery.shared.SpeciesCapability;
import org.gcube.portlets.user.speciesdiscovery.shared.filter.ResultFilter;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class SearchEvent extends GwtEvent<SearchEventHandler> {
public static final GwtEvent.Type<SearchEventHandler> TYPE = new Type<SearchEventHandler>();
@Override
public Type<SearchEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(SearchEventHandler handler) {
handler.onSearch(this);
}
protected String searchTerm;
protected SearchType type;
protected Number upperBoundLongitude;
protected Number upperBoundLatitude;
protected Number lowerBoundLongitude;
protected Number lowerBoundLatitude;
protected Date fromDate;
protected Date toDate;
private List<DataSourceModel> lstDataSources;
private String groupByRank;
private SpeciesCapability resultType;
private String query;
private ResultFilter activeFilterOnResult;
public SearchEvent(SearchType type, String searchTerm, Number upperBoundLongitude, Number upperBoundLatitude, Number lowerBoundLongitude, Number lowerBoundLatitude,
Date fromDate, Date toDate, List<DataSourceModel> listDataSources, String rank, SpeciesCapability resultType) {
this.type = type;
this.searchTerm = searchTerm;
this.upperBoundLongitude = upperBoundLongitude;
this.upperBoundLatitude = upperBoundLatitude;
this.lowerBoundLongitude = lowerBoundLongitude;
this.lowerBoundLatitude = lowerBoundLatitude;
this.fromDate = fromDate;
this.toDate = toDate;
this.lstDataSources = listDataSources;
this.groupByRank = rank;
this.resultType = resultType;
}
public SearchEvent(SearchType byQuery, String query) {
this.type = byQuery;
this.query = query;
}
/**
* @return the type
*/
public SearchType getType() {
return type;
}
/**
* @return the searchTerm
*/
public String getSearchTerm() {
return searchTerm;
}
/**
* @return the upperBoundLongitude
*/
public Number getUpperBoundLongitude() {
return upperBoundLongitude;
}
/**
* @return the upperBoundLatitude
*/
public Number getUpperBoundLatitude() {
return upperBoundLatitude;
}
/**
* @return the lowerBoundLongitude
*/
public Number getLowerBoundLongitude() {
return lowerBoundLongitude;
}
/**
* @return the lowerBoundLatitude
*/
public Number getLowerBoundLatitude() {
return lowerBoundLatitude;
}
/**
* @return the fromDate
*/
public Date getFromDate() {
return fromDate;
}
/**
* @return the toDate
*/
public Date getToDate() {
return toDate;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SearchEvent [searchTerm=");
builder.append(searchTerm);
builder.append(", type=");
builder.append(type);
builder.append(", upperBoundLongitude=");
builder.append(upperBoundLongitude);
builder.append(", upperBoundLatitude=");
builder.append(upperBoundLatitude);
builder.append(", lowerBoundLongitude=");
builder.append(lowerBoundLongitude);
builder.append(", lowerBoundLatitude=");
builder.append(lowerBoundLatitude);
builder.append(", fromDate=");
builder.append(fromDate);
builder.append(", toDate=");
builder.append(toDate);
builder.append("]");
return builder.toString();
}
public List<DataSourceModel> getLstDataSources() {
return lstDataSources;
}
public String getGroupByRank() {
return groupByRank;
}
public SpeciesCapability getResultType() {
return resultType;
}
public String getQuery() {
return query;
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface SearchEventHandler extends EventHandler {
public void onSearch(SearchEvent event);
}

View File

@ -0,0 +1,26 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class SearchStartedEvent extends GwtEvent<SearchStartedEventHandler> {
public static GwtEvent.Type<SearchStartedEventHandler> TYPE = new Type<SearchStartedEventHandler>();
@Override
public Type<SearchStartedEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(SearchStartedEventHandler handler) {
handler.onSearchStarted(this);
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface SearchStartedEventHandler extends EventHandler {
public void onSearchStarted(SearchStartedEvent event);
}

View File

@ -0,0 +1,53 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class SelectAllEvent extends GwtEvent<SelectAllEventHandler> {
public static final GwtEvent.Type<SelectAllEventHandler> TYPE = new Type<SelectAllEventHandler>();
@Override
public Type<SelectAllEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(SelectAllEventHandler handler) {
handler.onSelectAll(this);
}
protected boolean selectAll;
/**
* @param onlySelected
*/
public SelectAllEvent(boolean onlySelected) {
this.selectAll = onlySelected;
}
/**
* @return the onlySelected
*/
public boolean isOnlySelected() {
return selectAll;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SelectAllEvent [onlySelected=");
builder.append(selectAll);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface SelectAllEventHandler extends EventHandler {
public void onSelectAll(SelectAllEvent event);
}

View File

@ -0,0 +1,37 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class SetCommonNamesEvent extends GwtEvent<SetCommonNamesEventHandler> {
public static final GwtEvent.Type<SetCommonNamesEventHandler> TYPE = new Type<SetCommonNamesEventHandler>();
private BaseModelData baseModelData;
@Override
public Type<SetCommonNamesEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(SetCommonNamesEventHandler handler) {
handler.onSetCommonNames(this);
}
public SetCommonNamesEvent(BaseModelData data) {
this.baseModelData = data;
}
public BaseModelData getBaseModelData() {
return baseModelData;
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface SetCommonNamesEventHandler extends EventHandler {
public void onSetCommonNames(SetCommonNamesEvent setCommonNamesEvent);
}

View File

@ -0,0 +1,36 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class ShowOccurrencesEvent extends GwtEvent<ShowOccurrencesEventHandler> {
public static final GwtEvent.Type<ShowOccurrencesEventHandler> TYPE = new Type<ShowOccurrencesEventHandler>();
@Override
public Type<ShowOccurrencesEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ShowOccurrencesEventHandler handler) {
handler.onShowOccurrences(this);
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowOccurrencesEvent []");
return builder.toString();
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface ShowOccurrencesEventHandler extends EventHandler {
public void onShowOccurrences(ShowOccurrencesEvent event);
}

View File

@ -0,0 +1,45 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class ShowOccurrencesMapEvent extends GwtEvent<ShowOccurrencesMapEventHandler> {
public static final GwtEvent.Type<ShowOccurrencesMapEventHandler> TYPE = new Type<ShowOccurrencesMapEventHandler>();
private int expectedPoints;
public ShowOccurrencesMapEvent(int expectedPoints) {
this.expectedPoints = expectedPoints;
}
@Override
public Type<ShowOccurrencesMapEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ShowOccurrencesMapEventHandler handler) {
handler.onShowOccurrencesMap(this);
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowOccurrencesMapEvent []");
return builder.toString();
}
public int getExpectedPoints() {
return expectedPoints;
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface ShowOccurrencesMapEventHandler extends EventHandler {
public void onShowOccurrencesMap(ShowOccurrencesMapEvent event);
}

View File

@ -0,0 +1,53 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public class ShowOnlySelectedRowEvent extends GwtEvent<ShowOnlySelectedRowEventHandler> {
public static final GwtEvent.Type<ShowOnlySelectedRowEventHandler> TYPE = new Type<ShowOnlySelectedRowEventHandler>();
@Override
public Type<ShowOnlySelectedRowEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ShowOnlySelectedRowEventHandler handler) {
handler.onShowOnlySelectedRow(this);
}
protected boolean onlySelected;
/**
* @param onlySelected
*/
public ShowOnlySelectedRowEvent(boolean onlySelected) {
this.onlySelected = onlySelected;
}
/**
* @return the onlySelected
*/
public boolean isOnlySelected() {
return onlySelected;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("ShowOnlySelectedRowEvent [onlySelected=");
builder.append(onlySelected);
builder.append("]");
return builder.toString();
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface ShowOnlySelectedRowEventHandler extends EventHandler {
public void onShowOnlySelectedRow(ShowOnlySelectedRowEvent event);
}

View File

@ -0,0 +1,46 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import org.gcube.portlets.user.speciesdiscovery.shared.SearchResultType;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class UpdateAllRowSelectionEvent extends GwtEvent<UpdateAllRowSelectionEventHandler> {
public static final GwtEvent.Type<UpdateAllRowSelectionEventHandler> TYPE = new Type<UpdateAllRowSelectionEventHandler>();
private boolean selectionValue;
private SearchResultType searchType;
@Override
public Type<UpdateAllRowSelectionEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(UpdateAllRowSelectionEventHandler handler) {
handler.onUpdateAllRowSelection(this);
}
public UpdateAllRowSelectionEvent(boolean selectionValue, SearchResultType type){
this.selectionValue = selectionValue;
this.searchType = type;
}
public boolean getSelectionValue() {
return selectionValue;
}
public SearchResultType getSearchType() {
return searchType;
}
}

View File

@ -0,0 +1,16 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public interface UpdateAllRowSelectionEventHandler extends EventHandler {
public void onUpdateAllRowSelection(UpdateAllRowSelectionEvent updateAllRowSelectionEvent);
}

View File

@ -0,0 +1,39 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import org.gcube.portlets.user.speciesdiscovery.client.util.SpeciesGridFields;
import org.gcube.portlets.user.speciesdiscovery.shared.filter.ResultFilter;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class UpdateFilterOnResultEvent extends GwtEvent<UpdateFilterOnResultEventHandler> {
public static final GwtEvent.Type<UpdateFilterOnResultEventHandler> TYPE = new Type<UpdateFilterOnResultEventHandler>();
private ResultFilter activeFilterObject;
private SpeciesGridFields updateFilterId;
public SpeciesGridFields getUpdateFilterId() {
return updateFilterId;
}
@Override
public Type<UpdateFilterOnResultEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(UpdateFilterOnResultEventHandler handler) {
handler.onUpdateFilter(this);
}
public UpdateFilterOnResultEvent(SpeciesGridFields filterId) {
this.updateFilterId = filterId;
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface UpdateFilterOnResultEventHandler extends EventHandler {
public void onUpdateFilter(UpdateFilterOnResultEvent updateFilterOnResultEvent);
}

View File

@ -0,0 +1,44 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class UpdateRowSelectionEvent extends GwtEvent<UpdateRowSelectionEventHandler> {
public static final GwtEvent.Type<UpdateRowSelectionEventHandler> TYPE = new Type<UpdateRowSelectionEventHandler>();
private int rowId;
private boolean selectionValue;
@Override
public Type<UpdateRowSelectionEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(UpdateRowSelectionEventHandler handler) {
handler.onUpdateRowSelection(this);
}
public UpdateRowSelectionEvent(int rowId, boolean selectionValue){
this.rowId = rowId;
this.selectionValue = selectionValue;
}
public int getRowId() {
return rowId;
}
public boolean getSelectionValue() {
return selectionValue;
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface UpdateRowSelectionEventHandler extends EventHandler {
public void onUpdateRowSelection(UpdateRowSelectionEvent updateRowSelectionEvent);
}

View File

@ -0,0 +1,30 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
*
*/
public class ViewDetailsOfSelectedEvent extends GwtEvent<ViewDetailsOfSelectedEventHandler> {
public static final GwtEvent.Type<ViewDetailsOfSelectedEventHandler> TYPE = new Type<ViewDetailsOfSelectedEventHandler>();
@Override
public Type<ViewDetailsOfSelectedEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(ViewDetailsOfSelectedEventHandler handler) {
handler.onViewDetails(this);
}
public ViewDetailsOfSelectedEvent() {
}
}

View File

@ -0,0 +1,15 @@
/**
*
*/
package org.gcube.portlets.user.speciesdiscovery.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* @author "Federico De Faveri defaveri@isti.cnr.it"
*
*/
public interface ViewDetailsOfSelectedEventHandler extends EventHandler {
public void onViewDetails(ViewDetailsOfSelectedEvent viewDetailsOfSelectedEvent);
}

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