Fixed name svn
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-export-widget@84481 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
commit
5366deb059
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry including="**/*.java" kind="src" output="target/SDMXExportWizardTD-1.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="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="com.google.gwt.eclipse.core.GWT_CONTAINER/GWT"/>
|
||||||
|
<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"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry kind="output" path="target/SDMXExportWizardTD-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
|
</classpath>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,59 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>SDMXExportWizardTD</name>
|
||||||
|
<comment>SDMXImportWizardTD 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>
|
|
@ -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>
|
|
@ -0,0 +1,4 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
filesCopiedToWebInfLib=
|
||||||
|
googleCloudSqlEnabled=false
|
||||||
|
localDevMySqlEnabled=true
|
|
@ -0,0 +1,5 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
jarsExcludedFromWebInfLib=
|
||||||
|
lastWarOutDir=/home/giancarlo/workspace/SDMXExportWizardTD/target/SDMXExportWizardTD-0.0.1-SNAPSHOT
|
||||||
|
warSrcDir=src/main/webapp
|
||||||
|
warSrcDirIsOutput=false
|
|
@ -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+
|
|
@ -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
|
|
@ -0,0 +1,12 @@
|
||||||
|
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.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
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
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
|
@ -0,0 +1,4 @@
|
||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
|
@ -0,0 +1,2 @@
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?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"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||||
|
<property name="java-output-path" value="/${module}/target/www/WEB-INF/classes"/>
|
||||||
|
<property name="context-root" value="SDMXExportWizardTD"/>
|
||||||
|
</wb-module>
|
||||||
|
</project-modules>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="jst.web" version="2.3"/>
|
||||||
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
<installed facet="java" version="1.6"/>
|
||||||
|
</faceted-project>
|
|
@ -0,0 +1 @@
|
||||||
|
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
|
|
@ -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
|
|
@ -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="/SDMXImportWizardTD/src/test/java/org/gcube/portlets/user/sdmximportwizardtd/client/GwtTestSDMXImportWizardTD.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.sdmximportwizardtd.client.GwtTestSDMXImportWizardTD"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="SDMXImportWizardTD"/>
|
||||||
|
</launchConfiguration>
|
|
@ -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="/SDMXImportWizardTD/src/test/java/org/gcube/portlets/user/sdmximportwizardtd/client/GwtTestSDMXImportWizardTD.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.sdmximportwizardtd.client.GwtTestSDMXImportWizardTD"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="SDMXImportWizardTD"/>
|
||||||
|
</launchConfiguration>
|
|
@ -0,0 +1,306 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>maven-parent</artifactId>
|
||||||
|
<groupId>org.gcube.tools</groupId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<relativePath />
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<!-- POM file generated with GWT webAppCreator -->
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>tabular-data-sdmx-export-widget</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
|
||||||
|
<name>tabular-data-sdmx-export-widget</name>
|
||||||
|
<description>tabular-data-sdmx-export-widget allows sdmx export of codelists and dataset</description>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-export-widget</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>Giancarlo Panichi</name>
|
||||||
|
<email>g.panichi@isti.cnr.it</email>
|
||||||
|
<organization>CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"</organization>
|
||||||
|
<roles>
|
||||||
|
<role>architect</role>
|
||||||
|
<role>developer</role>
|
||||||
|
</roles>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<distroDirectory>${project.basedir}/distro</distroDirectory>
|
||||||
|
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
|
||||||
|
<release.date>2013-10-18</release.date>
|
||||||
|
<templatesDirectory>templates</templatesDirectory>
|
||||||
|
<distroDirectory>distro</distroDirectory>
|
||||||
|
<configDirectory>config</configDirectory>
|
||||||
|
|
||||||
|
<!-- Convenience property to set the GWT version -->
|
||||||
|
<gwtVersion>2.5.1</gwtVersion>
|
||||||
|
<!-- To make this work on gwt-run you need to set up global env vars. on
|
||||||
|
MacOSX edit this file /etc/launchd.conf and put "setenv GLOBUS_LOCATION /Users/massi/portal/Portal-Bundle/gCore"
|
||||||
|
on Linux? -->
|
||||||
|
<GLOBUS_LOCATION>${env.GLOBUS_LOCATION}</GLOBUS_LOCATION>
|
||||||
|
<!-- GWT needs at least java 1.5 -->
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>localRun</id>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.0.1</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-servlet</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.gwt</groupId>
|
||||||
|
<artifactId>gwt-user</artifactId>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sencha.gxt</groupId>
|
||||||
|
<artifactId>gxt</artifactId>
|
||||||
|
<version>3.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.data.publishing</groupId>
|
||||||
|
<artifactId>sdmx-registry-client-gcube</artifactId>
|
||||||
|
<version>[3.0.0-SNAPSHOT,4.0.0-SNAPSHOT)</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
|
<artifactId>aslcore</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>custom-portal-handler</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<version>20090211</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- TD GXTService -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
|
<artifactId>tabular-data-gxtservice</artifactId>
|
||||||
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- LOGGING -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||||
|
<artifactId>gwt-log</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!-- Generate compiled stuff in the folder used for developing mode -->
|
||||||
|
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.16</version>
|
||||||
|
<configuration>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</configuration>
|
||||||
|
<!-- TODO check if needed -->
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.surefire</groupId>
|
||||||
|
<artifactId>surefire-junit47</artifactId>
|
||||||
|
<version>2.16</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- GWT Maven Plugin -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>gwt-maven-plugin</artifactId>
|
||||||
|
<version>${gwtVersion}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>resources</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<runTarget>SDMXExportWizardTD.html</runTarget>
|
||||||
|
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||||
|
<module>org.gcube.portlets.user.td.sdmxexportwidget.SDMXExportWizardTD</module>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- Maven -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-profile</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${configDirectory}</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${templatesDirectory}</directory>
|
||||||
|
<includes>
|
||||||
|
<include>profile.xml</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>copy-distro-resources</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${distroDirectory}</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${templatesDirectory}</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>profile.xml</exclude>
|
||||||
|
<exclude>descriptor.xml</exclude>
|
||||||
|
</excludes>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
|
<version>2.5</version>
|
||||||
|
<configuration>
|
||||||
|
<filesets>
|
||||||
|
<fileset>
|
||||||
|
<directory>${distroDirectory}</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**</include>
|
||||||
|
</includes>
|
||||||
|
<followSymlinks>false</followSymlinks>
|
||||||
|
</fileset>
|
||||||
|
<fileset>
|
||||||
|
<directory>${configDirectory}</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**</include>
|
||||||
|
</includes>
|
||||||
|
<followSymlinks>false</followSymlinks>
|
||||||
|
</fileset>
|
||||||
|
</filesets>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>2.2</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>${templatesDirectory}/descriptor.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>servicearchive</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
</build>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.gcube.distribution</groupId>
|
||||||
|
<artifactId>maven-portal-bom</artifactId>
|
||||||
|
<version>LATEST</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
</project>
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
|
||||||
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface AgenciesProperties extends PropertyAccess<Agencies> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<Agencies> key();
|
||||||
|
|
||||||
|
LabelProvider<Agencies> nameLabel();
|
||||||
|
|
||||||
|
ValueProvider<Agencies, String> name();
|
||||||
|
ValueProvider<Agencies, String> description();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,227 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.dataresource.ResourceBundle;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.rpc.SDMXExportWizardServiceAsync;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
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.dom.client.KeyUpEvent;
|
||||||
|
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||||
|
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||||
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.Store;
|
||||||
|
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoader;
|
||||||
|
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||||
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.Resizable;
|
||||||
|
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AgenciesSelectionPanel extends ContentPanel implements HasSelectionHandlers<Agencies> {
|
||||||
|
|
||||||
|
private static final AgenciesProperties properties = GWT.create(AgenciesProperties.class);
|
||||||
|
|
||||||
|
protected static final ColumnConfig<Agencies, String> nameColumn = new ColumnConfig<Agencies, String>(properties.name(), 50, "Name");
|
||||||
|
protected static final ColumnConfig<Agencies, String> descriptionColumn = new ColumnConfig<Agencies, String>(properties.description(), 50, "Description");
|
||||||
|
|
||||||
|
protected Grid<Agencies> grid;
|
||||||
|
protected ResourceBundle res;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public AgenciesSelectionPanel(ResourceBundle res)
|
||||||
|
{
|
||||||
|
this.res=res;
|
||||||
|
setHeaderVisible(false);
|
||||||
|
new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
||||||
|
buildPanel(properties.key(), Arrays.<ColumnConfig<Agencies, ?>>asList(nameColumn, descriptionColumn), nameColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void buildPanel(ModelKeyProvider<Agencies> keyProvider, List<ColumnConfig<Agencies, ?>> columns, ColumnConfig<Agencies, ?> autoexpandColumn)
|
||||||
|
{
|
||||||
|
|
||||||
|
ToolBar toolBar = new ToolBar();
|
||||||
|
toolBar.add(new LabelToolItem("Search: "));
|
||||||
|
final TextField searchField = new TextField();
|
||||||
|
toolBar.add(searchField);
|
||||||
|
|
||||||
|
TextButton btnReload = new TextButton();
|
||||||
|
//btnReload.setText("Reload");
|
||||||
|
btnReload.setIcon(res.refresh_16());
|
||||||
|
btnReload.setToolTip("Reload");
|
||||||
|
toolBar.add(btnReload);
|
||||||
|
|
||||||
|
|
||||||
|
IdentityValueProvider<Agencies> identity = new IdentityValueProvider<Agencies>();
|
||||||
|
final CheckBoxSelectionModel<Agencies> sm = new CheckBoxSelectionModel<Agencies>(identity);
|
||||||
|
|
||||||
|
ColumnModel<Agencies> cm = new ColumnModel<Agencies>(columns);
|
||||||
|
|
||||||
|
final ExtendedListStore<Agencies> store = new ExtendedListStore<Agencies>(keyProvider);
|
||||||
|
|
||||||
|
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyUp(KeyUpEvent event) {
|
||||||
|
Log.trace("searchTerm: "+searchField.getCurrentValue());
|
||||||
|
store.applyFilters();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.addFilter(new StoreFilter<Agencies>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean select(Store<Agencies> store, Agencies parent, Agencies item) {
|
||||||
|
String searchTerm = searchField.getCurrentValue();
|
||||||
|
if (searchTerm == null) return true;
|
||||||
|
return AgenciesSelectionPanel.this.select(item, searchTerm);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.setEnableFilters(true);
|
||||||
|
|
||||||
|
RpcProxy<ListLoadConfig, ListLoadResult<Agencies>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<Agencies>>() {
|
||||||
|
|
||||||
|
|
||||||
|
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Agencies>> callback) {
|
||||||
|
loadData(loadConfig, callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
final ListLoader<ListLoadConfig, ListLoadResult<Agencies>> loader = new ListLoader<ListLoadConfig, ListLoadResult<Agencies>>(proxy);
|
||||||
|
|
||||||
|
loader.setRemoteSort(false);
|
||||||
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, Agencies, ListLoadResult<Agencies>>(store));
|
||||||
|
|
||||||
|
grid = new Grid<Agencies>(store, cm){
|
||||||
|
@Override
|
||||||
|
protected void onAfterFirstAttach() {
|
||||||
|
super.onAfterFirstAttach();
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
loader.load();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
grid.setLoader(loader);
|
||||||
|
grid.setSelectionModel(sm);
|
||||||
|
grid.getView().setAutoExpandColumn(autoexpandColumn);
|
||||||
|
grid.getView().setStripeRows(true);
|
||||||
|
grid.getView().setColumnLines(true);
|
||||||
|
grid.getView().setAutoFill(true);
|
||||||
|
grid.setBorders(false);
|
||||||
|
grid.setLoadMask(true);
|
||||||
|
grid.setColumnReordering(true);
|
||||||
|
|
||||||
|
SelectHandler sh = new SelectHandler() {
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
loader.load();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
btnReload.addSelectHandler(sh);
|
||||||
|
|
||||||
|
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||||
|
con.add(toolBar, new VerticalLayoutData(1, -1));
|
||||||
|
con.add(grid, new VerticalLayoutData(1, 1));
|
||||||
|
setWidget(con);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean select(Agencies item, String searchTerm) {
|
||||||
|
if (item.getName()!=null && item.getName().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
if (item.getDescription()!=null && item.getDescription().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
if (item.getId()!=null &&item.getId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void loadData(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Agencies>> callback) {
|
||||||
|
SDMXExportWizardServiceAsync.INSTANCE.getAgencies(new AsyncCallback<List<Agencies>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
callback.onFailure(caught);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<Agencies> result) {
|
||||||
|
Log.trace("loaded "+result.size()+" agencies");
|
||||||
|
callback.onSuccess(new ListLoadResultBean<Agencies>(result));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerRegistration addSelectionHandler(SelectionHandler<Agencies> handler) {
|
||||||
|
return grid.getSelectionModel().addSelectionHandler(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*public List<Agencies> getSelectedItems() {
|
||||||
|
return grid.getSelectionModel().getSelectedItems();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public Agencies getSelectedItem() {
|
||||||
|
return grid.getSelectionModel().getSelectedItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class ExtendedListStore<M> extends ListStore<M> {
|
||||||
|
|
||||||
|
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
|
||||||
|
super(keyProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyFilters()
|
||||||
|
{
|
||||||
|
super.applyFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Codelist;
|
||||||
|
|
||||||
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface CodelistProperties extends PropertyAccess<Codelist> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<Codelist> key();
|
||||||
|
|
||||||
|
ValueProvider<Codelist, String> name();
|
||||||
|
ValueProvider<Codelist, String> agencyId();
|
||||||
|
ValueProvider<Codelist, String> version();
|
||||||
|
ValueProvider<Codelist, String> description();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,231 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.dataresource.ResourceBundle;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.rpc.SDMXExportWizardServiceAsync;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Codelist;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
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.dom.client.KeyUpEvent;
|
||||||
|
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||||
|
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||||
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.Store;
|
||||||
|
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoader;
|
||||||
|
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||||
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.Resizable;
|
||||||
|
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CodelistSelectionPanel extends ContentPanel implements HasSelectionHandlers<Codelist> {
|
||||||
|
|
||||||
|
private static final CodelistProperties properties = GWT.create(CodelistProperties.class);
|
||||||
|
|
||||||
|
protected static final ColumnConfig<Codelist, String> nameColumn = new ColumnConfig<Codelist, String>(properties.name(), 50, "Name");
|
||||||
|
protected static final ColumnConfig<Codelist, String> agencyIdColumn = new ColumnConfig<Codelist, String>(properties.agencyId(), 50, "Agency Id");
|
||||||
|
protected static final ColumnConfig<Codelist, String> versionColumn = new ColumnConfig<Codelist, String>(properties.version(), 50, "Version");
|
||||||
|
protected static final ColumnConfig<Codelist, String> descriptionColumn = new ColumnConfig<Codelist, String>(properties.description(), 50, "Description");
|
||||||
|
|
||||||
|
protected Grid<Codelist> grid;
|
||||||
|
protected ResourceBundle res;
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public CodelistSelectionPanel(ResourceBundle res)
|
||||||
|
{
|
||||||
|
this.res=res;
|
||||||
|
setHeaderVisible(false);
|
||||||
|
new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
||||||
|
buildPanel(properties.key(), Arrays.<ColumnConfig<Codelist, ?>>asList(nameColumn, agencyIdColumn, versionColumn, descriptionColumn), nameColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void buildPanel(ModelKeyProvider<Codelist> keyProvider, List<ColumnConfig<Codelist, ?>> columns, ColumnConfig<Codelist, ?> autoexpandColumn)
|
||||||
|
{
|
||||||
|
|
||||||
|
ToolBar toolBar = new ToolBar();
|
||||||
|
toolBar.add(new LabelToolItem("Search: "));
|
||||||
|
final TextField searchField = new TextField();
|
||||||
|
toolBar.add(searchField);
|
||||||
|
|
||||||
|
TextButton btnReload = new TextButton();
|
||||||
|
//btnReload.setText("Reload");
|
||||||
|
btnReload.setIcon(res.refresh_16());
|
||||||
|
btnReload.setToolTip("Reload");
|
||||||
|
toolBar.add(btnReload);
|
||||||
|
|
||||||
|
|
||||||
|
IdentityValueProvider<Codelist> identity = new IdentityValueProvider<Codelist>();
|
||||||
|
final CheckBoxSelectionModel<Codelist> sm = new CheckBoxSelectionModel<Codelist>(identity);
|
||||||
|
|
||||||
|
ColumnModel<Codelist> cm = new ColumnModel<Codelist>(columns);
|
||||||
|
|
||||||
|
final ExtendedListStore<Codelist> store = new ExtendedListStore<Codelist>(keyProvider);
|
||||||
|
|
||||||
|
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyUp(KeyUpEvent event) {
|
||||||
|
Log.trace("searchTerm: "+searchField.getCurrentValue());
|
||||||
|
store.applyFilters();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.addFilter(new StoreFilter<Codelist>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean select(Store<Codelist> store, Codelist parent, Codelist item) {
|
||||||
|
String searchTerm = searchField.getCurrentValue();
|
||||||
|
if (searchTerm == null) return true;
|
||||||
|
return CodelistSelectionPanel.this.select(item, searchTerm);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.setEnableFilters(true);
|
||||||
|
|
||||||
|
RpcProxy<ListLoadConfig, ListLoadResult<Codelist>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<Codelist>>() {
|
||||||
|
|
||||||
|
|
||||||
|
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Codelist>> callback) {
|
||||||
|
loadData(loadConfig, callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
final ListLoader<ListLoadConfig, ListLoadResult<Codelist>> loader = new ListLoader<ListLoadConfig, ListLoadResult<Codelist>>(proxy);
|
||||||
|
|
||||||
|
loader.setRemoteSort(false);
|
||||||
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, Codelist, ListLoadResult<Codelist>>(store));
|
||||||
|
|
||||||
|
grid = new Grid<Codelist>(store, cm){
|
||||||
|
@Override
|
||||||
|
protected void onAfterFirstAttach() {
|
||||||
|
super.onAfterFirstAttach();
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
loader.load();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
grid.setLoader(loader);
|
||||||
|
grid.setSelectionModel(sm);
|
||||||
|
grid.getView().setAutoExpandColumn(autoexpandColumn);
|
||||||
|
grid.getView().setStripeRows(true);
|
||||||
|
grid.getView().setColumnLines(true);
|
||||||
|
grid.getView().setAutoFill(true);
|
||||||
|
grid.setBorders(false);
|
||||||
|
grid.setLoadMask(true);
|
||||||
|
grid.setColumnReordering(true);
|
||||||
|
|
||||||
|
SelectHandler sh = new SelectHandler() {
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
loader.load();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
btnReload.addSelectHandler(sh);
|
||||||
|
|
||||||
|
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||||
|
con.add(toolBar, new VerticalLayoutData(1, -1));
|
||||||
|
con.add(grid, new VerticalLayoutData(1, 1));
|
||||||
|
setWidget(con);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean select(Codelist item, String searchTerm) {
|
||||||
|
if (item.getName()!=null && item.getName().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
if (item.getAgencyId()!=null &&item.getAgencyId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
if (item.getVersion()!=null && item.getVersion().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
if (item.getDescription()!=null && item.getDescription().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
if (item.getId()!=null &&item.getId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void loadData(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Codelist>> callback) {
|
||||||
|
SDMXExportWizardServiceAsync.INSTANCE.getCodelists(new AsyncCallback<List<Codelist>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
callback.onFailure(caught);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<Codelist> result) {
|
||||||
|
Log.trace("loaded "+result.size()+" codelists");
|
||||||
|
callback.onSuccess(new ListLoadResultBean<Codelist>(result));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerRegistration addSelectionHandler(SelectionHandler<Codelist> handler) {
|
||||||
|
return grid.getSelectionModel().addSelectionHandler(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*public List<Codelist> getSelectedItems() {
|
||||||
|
return grid.getSelectionModel().getSelectedItems();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public Codelist getSelectedItem() {
|
||||||
|
return grid.getSelectionModel().getSelectedItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class ExtendedListStore<M> extends ListStore<M> {
|
||||||
|
|
||||||
|
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
|
||||||
|
super(keyProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyFilters()
|
||||||
|
{
|
||||||
|
super.applyFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Dataset;
|
||||||
|
|
||||||
|
import com.google.gwt.editor.client.Editor.Path;
|
||||||
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface DatasetProperties extends PropertyAccess<Dataset> {
|
||||||
|
|
||||||
|
@Path("id")
|
||||||
|
ModelKeyProvider<Dataset> key();
|
||||||
|
|
||||||
|
ValueProvider<Dataset, String> name();
|
||||||
|
ValueProvider<Dataset, String> agencyId();
|
||||||
|
ValueProvider<Dataset, String> version();
|
||||||
|
ValueProvider<Dataset, String> description();
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,201 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.rpc.SDMXExportWizardServiceAsync;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Dataset;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
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.dom.client.KeyUpEvent;
|
||||||
|
import com.google.gwt.event.dom.client.KeyUpHandler;
|
||||||
|
import com.google.gwt.event.logical.shared.HasSelectionHandlers;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||||
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
import com.sencha.gxt.data.shared.Store;
|
||||||
|
import com.sencha.gxt.data.shared.Store.StoreFilter;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoader;
|
||||||
|
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||||
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.Resizable;
|
||||||
|
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DatasetSelectionPanel extends ContentPanel implements HasSelectionHandlers<Dataset> {
|
||||||
|
|
||||||
|
private static final DatasetProperties properties = GWT.create(DatasetProperties.class);
|
||||||
|
|
||||||
|
protected static final ColumnConfig<Dataset, String> nameColumn = new ColumnConfig<Dataset, String>(properties.name(), 50, "Name");
|
||||||
|
protected static final ColumnConfig<Dataset, String> agencyIdColumn = new ColumnConfig<Dataset, String>(properties.agencyId(), 50, "Agency Id");
|
||||||
|
protected static final ColumnConfig<Dataset, String> versionColumn = new ColumnConfig<Dataset, String>(properties.version(), 50, "Version");
|
||||||
|
protected static final ColumnConfig<Dataset, String> descriptionColumn = new ColumnConfig<Dataset, String>(properties.description(), 50, "Description");
|
||||||
|
|
||||||
|
protected Grid<Dataset> grid;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public DatasetSelectionPanel()
|
||||||
|
{
|
||||||
|
setHeaderVisible(false);
|
||||||
|
new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
||||||
|
buildPanel(properties.key(), Arrays.<ColumnConfig<Dataset, ?>>asList(nameColumn, agencyIdColumn, versionColumn, descriptionColumn), nameColumn);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void buildPanel(ModelKeyProvider<Dataset> keyProvider, List<ColumnConfig<Dataset, ?>> columns, ColumnConfig<Dataset, ?> autoexpandColumn)
|
||||||
|
{
|
||||||
|
|
||||||
|
ToolBar toolBar = new ToolBar();
|
||||||
|
toolBar.add(new LabelToolItem("Search: "));
|
||||||
|
final TextField searchField = new TextField();
|
||||||
|
toolBar.add(searchField);
|
||||||
|
|
||||||
|
IdentityValueProvider<Dataset> identity = new IdentityValueProvider<Dataset>();
|
||||||
|
final CheckBoxSelectionModel<Dataset> sm = new CheckBoxSelectionModel<Dataset>(identity);
|
||||||
|
|
||||||
|
ColumnModel<Dataset> cm = new ColumnModel<Dataset>(columns);
|
||||||
|
|
||||||
|
final ExtendedListStore<Dataset> store = new ExtendedListStore<Dataset>(keyProvider);
|
||||||
|
|
||||||
|
searchField.addKeyUpHandler(new KeyUpHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKeyUp(KeyUpEvent event) {
|
||||||
|
Log.trace("searchTerm: "+searchField.getCurrentValue());
|
||||||
|
store.applyFilters();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.addFilter(new StoreFilter<Dataset>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean select(Store<Dataset> store, Dataset parent, Dataset item) {
|
||||||
|
String searchTerm = searchField.getCurrentValue();
|
||||||
|
if (searchTerm == null) return true;
|
||||||
|
return DatasetSelectionPanel.this.select(item, searchTerm);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
store.setEnableFilters(true);
|
||||||
|
|
||||||
|
RpcProxy<ListLoadConfig, ListLoadResult<Dataset>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<Dataset>>() {
|
||||||
|
|
||||||
|
|
||||||
|
public void load(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Dataset>> callback) {
|
||||||
|
loadData(loadConfig, callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
final ListLoader<ListLoadConfig, ListLoadResult<Dataset>> loader = new ListLoader<ListLoadConfig, ListLoadResult<Dataset>>(proxy);
|
||||||
|
|
||||||
|
loader.setRemoteSort(false);
|
||||||
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, Dataset, ListLoadResult<Dataset>>(store));
|
||||||
|
|
||||||
|
grid = new Grid<Dataset>(store, cm){
|
||||||
|
@Override
|
||||||
|
protected void onAfterFirstAttach() {
|
||||||
|
super.onAfterFirstAttach();
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
loader.load();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
grid.setLoader(loader);
|
||||||
|
grid.setSelectionModel(sm);
|
||||||
|
grid.getView().setAutoExpandColumn(autoexpandColumn);
|
||||||
|
grid.getView().setStripeRows(true);
|
||||||
|
grid.getView().setColumnLines(true);
|
||||||
|
grid.getView().setAutoFill(true);
|
||||||
|
grid.setBorders(false);
|
||||||
|
grid.setLoadMask(true);
|
||||||
|
|
||||||
|
grid.setColumnReordering(true);
|
||||||
|
|
||||||
|
VerticalLayoutContainer con = new VerticalLayoutContainer();
|
||||||
|
con.add(toolBar, new VerticalLayoutData(1, -1));
|
||||||
|
con.add(grid, new VerticalLayoutData(1, 1));
|
||||||
|
setWidget(con);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected boolean select(Dataset item, String searchTerm) {
|
||||||
|
if (item.getName()!=null && item.getName().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
if (item.getAgencyId()!=null &&item.getAgencyId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
if (item.getId()!=null &&item.getId().toLowerCase().contains(searchTerm.toLowerCase())) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void loadData(ListLoadConfig loadConfig, final AsyncCallback<ListLoadResult<Dataset>> callback) {
|
||||||
|
SDMXExportWizardServiceAsync.INSTANCE.getDatasets(new AsyncCallback<List<Dataset>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
callback.onFailure(caught);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<Dataset> result) {
|
||||||
|
Log.trace("loaded "+result.size()+" datasets");
|
||||||
|
callback.onSuccess(new ListLoadResultBean<Dataset>(result));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HandlerRegistration addSelectionHandler(SelectionHandler<Dataset> handler) {
|
||||||
|
return grid.getSelectionModel().addSelectionHandler(handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<Dataset> getSelectedItems() {
|
||||||
|
return grid.getSelectionModel().getSelectedItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class ExtendedListStore<M> extends ListStore<M> {
|
||||||
|
|
||||||
|
public ExtendedListStore(ModelKeyProvider<? super M> keyProvider) {
|
||||||
|
super(keyProvider);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void applyFilters()
|
||||||
|
{
|
||||||
|
super.applyFilters();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardCard;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXAgenciesSelectionCard extends WizardCard {
|
||||||
|
|
||||||
|
protected SDMXAgenciesSelectionCard thisCard;
|
||||||
|
protected SDMXExportSession exportSession;
|
||||||
|
protected AgenciesSelectionPanel agenciesSelectionPanel;
|
||||||
|
protected Agencies selectedAgencies=null;
|
||||||
|
|
||||||
|
public SDMXAgenciesSelectionCard(final SDMXExportSession exportSession) {
|
||||||
|
super("SDMX Agencies selection", "");
|
||||||
|
|
||||||
|
this.exportSession = exportSession;
|
||||||
|
thisCard=this;
|
||||||
|
|
||||||
|
this.agenciesSelectionPanel=new AgenciesSelectionPanel(res);
|
||||||
|
|
||||||
|
agenciesSelectionPanel.addSelectionHandler(new SelectionHandler<Agencies>(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelection(SelectionEvent<Agencies> event) {
|
||||||
|
exportSession.setAgency(agenciesSelectionPanel.getSelectedItem());
|
||||||
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
setContent(agenciesSelectionPanel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup(){
|
||||||
|
/*Command sayNextCard = new Command() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
SDMXTableDetailCard sdmxTableDetailCard = new SDMXTableDetailCard(
|
||||||
|
importSession);
|
||||||
|
getWizardWindow()
|
||||||
|
.addCard(sdmxTableDetailCard);
|
||||||
|
Log.info("NextCard SDMXTableDetailCard");
|
||||||
|
getWizardWindow().nextCard();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||||
|
|
||||||
|
|
||||||
|
Command sayPreviousCard = new Command() {
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
getWizardWindow().previousCard();
|
||||||
|
getWizardWindow().removeCard(thisCard);
|
||||||
|
Log.info("Remove SDMXCodelistSelectionCard");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
|
getWizardWindow().setEnableNextButton(false);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardCard;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.source.FileSource;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.source.SDMXRegistrySource;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.source.WorkspaceSource;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.ui.HasValue;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
import com.sencha.gxt.core.client.util.ToggleGroup;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.Radio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXAgencyTypeCard extends WizardCard {
|
||||||
|
|
||||||
|
protected final SDMXExportSession exportSession;
|
||||||
|
|
||||||
|
protected Agencies agency;
|
||||||
|
|
||||||
|
public SDMXAgencyTypeCard(final SDMXExportSession exportSession) {
|
||||||
|
super("SDMX agency type", "");
|
||||||
|
|
||||||
|
this.exportSession = exportSession;
|
||||||
|
|
||||||
|
agency = new Agencies();
|
||||||
|
//agency.setNewAgency(false);
|
||||||
|
exportSession.setAgency(agency);
|
||||||
|
|
||||||
|
VerticalPanel selectionPanel = new VerticalPanel();
|
||||||
|
selectionPanel.setStylePrimaryName(res.sdmxExportCss()
|
||||||
|
.getExportSelectionSources());
|
||||||
|
|
||||||
|
Radio radioSDMXAgencyPresent = new Radio();
|
||||||
|
|
||||||
|
radioSDMXAgencyPresent
|
||||||
|
.setBoxLabel("<p style='display:inline-table;'><b>Agencies Present</b><br>Select from the agencies already present in the registry</p>");
|
||||||
|
radioSDMXAgencyPresent.setValue(true);
|
||||||
|
radioSDMXAgencyPresent.setName("present");
|
||||||
|
radioSDMXAgencyPresent.setStylePrimaryName(res.sdmxExportCss()
|
||||||
|
.getExportSelectionSource());
|
||||||
|
|
||||||
|
Radio radioSDMXAgencyNew = new Radio();
|
||||||
|
radioSDMXAgencyNew
|
||||||
|
.setBoxLabel("<p style='display:inline-table;'><b>New Agencies</b><br>Creates a new agency in the registry</p>");
|
||||||
|
radioSDMXAgencyNew.setName("new");
|
||||||
|
radioSDMXAgencyNew.setStylePrimaryName(res.sdmxExportCss()
|
||||||
|
.getExportSelectionSource());
|
||||||
|
|
||||||
|
selectionPanel.add(radioSDMXAgencyPresent);
|
||||||
|
selectionPanel.add(radioSDMXAgencyNew);
|
||||||
|
|
||||||
|
// we can set name on radios or use toggle group
|
||||||
|
ToggleGroup toggle = new ToggleGroup();
|
||||||
|
toggle.add(radioSDMXAgencyPresent);
|
||||||
|
toggle.add(radioSDMXAgencyNew);
|
||||||
|
|
||||||
|
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
||||||
|
try {
|
||||||
|
ToggleGroup group = (ToggleGroup) event.getSource();
|
||||||
|
Radio radio = (Radio) group.getValue();
|
||||||
|
Log.info("Agency type: " + radio.getName());
|
||||||
|
if (radio.getName().compareTo("present") == 0) {
|
||||||
|
//exportSession.getAgency().setNewAgency(false);
|
||||||
|
} else {
|
||||||
|
if (radio.getName().compareTo("new") == 0) {
|
||||||
|
//exportSession.getAgency().setNewAgency(true);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("ToggleGroup: onValueChange "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setContent(selectionPanel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
/*Log.info("Agency New: "+exportSession.getAgency().isNewAgency());
|
||||||
|
if (exportSession.getAgency().isNewAgency()) {
|
||||||
|
} else {
|
||||||
|
Command sayNextCard = new Command() {
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
SDMXAgenciesSelectionCard sdmxAgenciesSelectionCard = new SDMXAgenciesSelectionCard(
|
||||||
|
exportSession);
|
||||||
|
getWizardWindow().addCard(sdmxAgenciesSelectionCard);
|
||||||
|
Log.info("NextCard SDMXAgenciesSelectionCard");
|
||||||
|
getWizardWindow().nextCard();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||||
|
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardCard;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Codelist;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXCodelistSelectionCard extends WizardCard {
|
||||||
|
|
||||||
|
protected SDMXCodelistSelectionCard thisCard;
|
||||||
|
protected SDMXExportSession importSession;
|
||||||
|
protected CodelistSelectionPanel codelistSelectionPanel;
|
||||||
|
protected Codelist selectedCodelist=null;
|
||||||
|
public SDMXCodelistSelectionCard(final SDMXExportSession importSession) {
|
||||||
|
super("SDMX Codelist selection", "");
|
||||||
|
|
||||||
|
this.importSession = importSession;
|
||||||
|
thisCard=this;
|
||||||
|
|
||||||
|
this.codelistSelectionPanel=new CodelistSelectionPanel(res);
|
||||||
|
|
||||||
|
codelistSelectionPanel.addSelectionHandler(new SelectionHandler<Codelist>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelection(SelectionEvent<Codelist> event) {
|
||||||
|
importSession.setSelectedCodelist(codelistSelectionPanel.getSelectedItem());
|
||||||
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
setContent(codelistSelectionPanel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup(){
|
||||||
|
Command sayNextCard = new Command() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
SDMXTableDetailCard sdmxTableDetailCard = new SDMXTableDetailCard(
|
||||||
|
importSession);
|
||||||
|
getWizardWindow()
|
||||||
|
.addCard(sdmxTableDetailCard);
|
||||||
|
Log.info("NextCard SDMXTableDetailCard");
|
||||||
|
getWizardWindow().nextCard();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||||
|
|
||||||
|
|
||||||
|
Command sayPreviousCard = new Command() {
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
getWizardWindow().previousCard();
|
||||||
|
getWizardWindow().removeCard(thisCard);
|
||||||
|
Log.info("Remove SDMXCodelistSelectionCard");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
|
getWizardWindow().setEnableNextButton(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardCard;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXDatasetSelectionCard extends WizardCard {
|
||||||
|
|
||||||
|
protected SDMXDatasetSelectionCard thisCard;
|
||||||
|
protected SDMXExportSession importSession;
|
||||||
|
protected DatasetSelectionPanel datasetSelectionPanel;
|
||||||
|
|
||||||
|
public SDMXDatasetSelectionCard(final SDMXExportSession importSession) {
|
||||||
|
super("SDMX Dataset selection", "");
|
||||||
|
|
||||||
|
this.importSession = importSession;
|
||||||
|
|
||||||
|
thisCard=this;
|
||||||
|
|
||||||
|
this.datasetSelectionPanel=new DatasetSelectionPanel();
|
||||||
|
|
||||||
|
setContent(datasetSelectionPanel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup(){
|
||||||
|
Command sayPreviousCard = new Command() {
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
getWizardWindow().previousCard();
|
||||||
|
getWizardWindow().removeCard(thisCard);
|
||||||
|
Log.info("Remove SDMXDatasetSelectionCard");
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardWindow;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.rpc.SDMXExportWizardServiceAsync;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
|
*/
|
||||||
|
public class SDMXExportWizardTD extends WizardWindow {
|
||||||
|
|
||||||
|
protected SDMXExportSession exportSession;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of the {@link CSVTarget} to use.
|
||||||
|
* @param targetId
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
|
public SDMXExportWizardTD(String title) {
|
||||||
|
super(title);
|
||||||
|
setWidth(550);
|
||||||
|
setHeight(520);
|
||||||
|
|
||||||
|
exportSession= new SDMXExportSession();
|
||||||
|
|
||||||
|
SDMXExportWizardServiceAsync.INSTANCE.setSDMXSession(exportSession,new AsyncCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Object result) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
SDMXAgencyTypeCard sdmxAgencyType= new SDMXAgencyTypeCard(exportSession);
|
||||||
|
addCard(sdmxAgencyType);
|
||||||
|
|
||||||
|
SDMXAgenciesSelectionCard sdmxAgenciesSelection= new SDMXAgenciesSelectionCard(exportSession);
|
||||||
|
addCard(sdmxAgenciesSelection);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
|
|
||||||
|
public class SDMXExportWizardTDEntry implements EntryPoint {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModuleLoad() {
|
||||||
|
SDMXExportWizardTD exportWizard= new SDMXExportWizardTD("SDMXExport");
|
||||||
|
Log.info(exportWizard.getId());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,161 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardCard;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.progress.ImportProgressBarUpdater;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.progress.OperationProgressListener;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.progress.OperationProgressUpdater;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.rpc.SDMXExportWizardServiceAsync;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.source.SDMXRegistrySource;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.FlexTable;
|
||||||
|
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
|
||||||
|
import com.google.gwt.user.client.ui.HasVerticalAlignment;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign;
|
||||||
|
|
||||||
|
//import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
//import com.google.gwt.user.client.Command;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXOperationInProgressCard extends WizardCard
|
||||||
|
implements OperationProgressListener {
|
||||||
|
|
||||||
|
public static final int STATUS_POLLING_DELAY = 1000;
|
||||||
|
protected SDMXOperationInProgressCard thisCard;
|
||||||
|
protected SDMXExportSession importSession;
|
||||||
|
protected OperationProgressUpdater progressUpdater;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SDMXOperationInProgressCard(final SDMXExportSession importSession) {
|
||||||
|
super("Operation In Progress", "");
|
||||||
|
|
||||||
|
this.importSession = importSession;
|
||||||
|
thisCard=this;
|
||||||
|
|
||||||
|
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
||||||
|
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
|
||||||
|
|
||||||
|
final FlexTable description = new FlexTable();
|
||||||
|
FlexCellFormatter cellFormatter = description.getFlexCellFormatter();
|
||||||
|
description.setCellSpacing(10);
|
||||||
|
description.setCellPadding(4);
|
||||||
|
description.setBorderWidth(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FramedPanel summary = new FramedPanel();
|
||||||
|
summary.setHeadingText("Import Summary");
|
||||||
|
summary.setWidth(400);
|
||||||
|
summary.add(description);
|
||||||
|
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,5,10,5)));
|
||||||
|
|
||||||
|
ProgressBar progressBar = new ProgressBar();
|
||||||
|
operationInProgressPanel.add(progressBar, new BoxLayoutData(new Margins(10,5,10,5)));
|
||||||
|
|
||||||
|
progressUpdater = new OperationProgressUpdater();
|
||||||
|
progressUpdater.addListener(new ImportProgressBarUpdater(progressBar));
|
||||||
|
|
||||||
|
progressUpdater.addListener(this);
|
||||||
|
|
||||||
|
setContent(operationInProgressPanel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void exportSDMX()
|
||||||
|
{
|
||||||
|
SDMXExportWizardServiceAsync.INSTANCE.exportSDMXClientLibraryRequest(importSession, new AsyncCallback<Void>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
showErrorAndHide("Error in exportSDMX", "An error occured in exportSDMX", "", caught);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup(){
|
||||||
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
setBackButtonVisible(false);
|
||||||
|
setNextButtonVisible(false);
|
||||||
|
getWizardWindow().setEnableNextButton(false);
|
||||||
|
getWizardWindow().setNextButtonToFinish();
|
||||||
|
exportSDMX();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationInitializing() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationUpdate(float elaborated) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationComplete(final TRId trId){
|
||||||
|
// final String tableId,final String tableResourceId) {
|
||||||
|
|
||||||
|
Command sayComplete = new Command() {
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
getWizardWindow().close(false);
|
||||||
|
Log.info("fire Complete: tabular resource "+trId.getId());
|
||||||
|
Log.info("fire Complete: tableId "+trId.getTableId());
|
||||||
|
|
||||||
|
getWizardWindow().fireCompleted(trId);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("fire Complete :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setNextButtonCommand(sayComplete);
|
||||||
|
|
||||||
|
setNextButtonVisible(true);
|
||||||
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationFailed(Throwable caught, String reason,
|
||||||
|
String failureDetails) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,317 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.general.WizardCard;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.rpc.SDMXExportWizardServiceAsync;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.TableDetail;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.ui.HasValue;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
|
import com.sencha.gxt.core.client.util.ToggleGroup;
|
||||||
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
|
import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||||
|
import com.sencha.gxt.data.shared.loader.PagingLoadConfig;
|
||||||
|
import com.sencha.gxt.data.shared.loader.PagingLoadResult;
|
||||||
|
import com.sencha.gxt.data.shared.loader.PagingLoadResultBean;
|
||||||
|
import com.sencha.gxt.data.shared.loader.PagingLoader;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.Radio;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextArea;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXTableDetailCard extends WizardCard {
|
||||||
|
|
||||||
|
protected SDMXExportSession importSession;
|
||||||
|
protected SDMXTableDetailCard thisCard;
|
||||||
|
|
||||||
|
protected static final AgenciesProperties agenciesProperties = GWT.create(AgenciesProperties.class);
|
||||||
|
protected VerticalLayoutContainer p = new VerticalLayoutContainer();
|
||||||
|
//private final ComboBox<String> combo2;
|
||||||
|
protected VerticalPanel tableDetailPanel;
|
||||||
|
|
||||||
|
//private static TextField agencyName=null;
|
||||||
|
|
||||||
|
protected TextField name;
|
||||||
|
protected TextArea description;
|
||||||
|
protected TextField right;
|
||||||
|
protected ComboBox<Agencies> combo=null;
|
||||||
|
|
||||||
|
TableDetail detail=new TableDetail();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SDMXTableDetailCard(final SDMXExportSession importSession) {
|
||||||
|
super("SDMX Table Detail", "");
|
||||||
|
|
||||||
|
this.importSession = importSession;
|
||||||
|
thisCard=this;
|
||||||
|
|
||||||
|
|
||||||
|
tableDetailPanel = new VerticalPanel();
|
||||||
|
|
||||||
|
tableDetailPanel.setSpacing(4);
|
||||||
|
tableDetailPanel.setWidth("100%");
|
||||||
|
tableDetailPanel.setHeight("100%");
|
||||||
|
|
||||||
|
|
||||||
|
FramedPanel form2 = new FramedPanel();
|
||||||
|
form2.setHeadingText("Details");
|
||||||
|
//form2.setWidth(350);
|
||||||
|
|
||||||
|
FieldSet fieldSet = new FieldSet();
|
||||||
|
fieldSet.setHeadingText("Information");
|
||||||
|
fieldSet.setCollapsible(true);
|
||||||
|
form2.add(fieldSet);
|
||||||
|
|
||||||
|
//VerticalLayoutContainer p = new VerticalLayoutContainer();
|
||||||
|
fieldSet.add(p);
|
||||||
|
|
||||||
|
name = new TextField();
|
||||||
|
name.setAllowBlank(false);
|
||||||
|
name.setEmptyText("Enter a name...");
|
||||||
|
name.setValue(importSession.getSelectedCodelist().getName());
|
||||||
|
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
|
||||||
|
description = new TextArea();
|
||||||
|
description.setAllowBlank(false);
|
||||||
|
description.setEmptyText("Enter a description...");
|
||||||
|
description.setValue(importSession.getSelectedCodelist().getDescription());
|
||||||
|
p.add(new FieldLabel(description, "Description"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
right = new TextField();
|
||||||
|
right.setEmptyText("Enter right...");
|
||||||
|
right.setAllowBlank(false);
|
||||||
|
p.add(new FieldLabel(right, "Right"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
|
||||||
|
ListStore<Agencies> agenciesStore = new ListStore<Agencies>(agenciesProperties.key());
|
||||||
|
|
||||||
|
RpcProxy<PagingLoadConfig, PagingLoadResult<Agencies>> proxy = new RpcProxy<PagingLoadConfig, PagingLoadResult<Agencies>>() {
|
||||||
|
|
||||||
|
|
||||||
|
public void load(PagingLoadConfig loadConfig, final AsyncCallback<PagingLoadResult<Agencies>> callback) {
|
||||||
|
loadData(loadConfig, callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
final PagingLoader<PagingLoadConfig, PagingLoadResult<Agencies>> loader = new PagingLoader<PagingLoadConfig, PagingLoadResult<Agencies>>(proxy);
|
||||||
|
|
||||||
|
loader.setRemoteSort(false);
|
||||||
|
loader.addLoadHandler(new LoadResultListStoreBinding<PagingLoadConfig, Agencies, PagingLoadResult<Agencies>>(agenciesStore));
|
||||||
|
|
||||||
|
//agenciesStore.addAll(TestData.getStates());
|
||||||
|
|
||||||
|
combo = new ComboBox<Agencies>(agenciesStore, agenciesProperties.nameLabel());
|
||||||
|
addHandlersForEventObservation(combo, agenciesProperties.nameLabel());
|
||||||
|
|
||||||
|
combo.setLoader(loader);
|
||||||
|
combo.setEmptyText("Enter Agency...");
|
||||||
|
combo.setTriggerAction(TriggerAction.ALL);
|
||||||
|
combo.setAllowBlank(false);
|
||||||
|
combo.setForceSelection(true);
|
||||||
|
combo.setVisible(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//HorizontalLayoutContainer agenciesSelect= selectAgencies();
|
||||||
|
p.add(new FieldLabel(combo, "Agencies"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
/*FieldLabel comboLabel=new FieldLabel(combo, "");
|
||||||
|
comboLabel.setLabelSeparator("");
|
||||||
|
p.add(comboLabel, new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
|
||||||
|
agencyName = new TextField();
|
||||||
|
agencyName.setVisible(false);
|
||||||
|
agencyName.setEmptyText("Enter Agency...");
|
||||||
|
FieldLabel agencyNameLabel=new FieldLabel(agencyName, "");
|
||||||
|
agencyNameLabel.setLabelSeparator("");
|
||||||
|
p.add(agencyNameLabel, new VerticalLayoutData(1, -1));
|
||||||
|
*/
|
||||||
|
tableDetailPanel.add(form2);
|
||||||
|
|
||||||
|
setContent(tableDetailPanel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void loadData(PagingLoadConfig loadConfig, final AsyncCallback<PagingLoadResult<Agencies>> callback) {
|
||||||
|
SDMXExportWizardServiceAsync.INSTANCE.getAgencies(new AsyncCallback<List<Agencies>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
callback.onFailure(caught);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<Agencies> result) {
|
||||||
|
Log.trace("loaded "+result.size()+" agencies");
|
||||||
|
for(int i=0; i<result.size(); i++){
|
||||||
|
Agencies ag=result.get(i);
|
||||||
|
//if(ag.getId().compareTo())
|
||||||
|
}
|
||||||
|
|
||||||
|
callback.onSuccess(new PagingLoadResultBean<Agencies>(result, result.size(), 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper to add handlers to observe events that occur on each combobox
|
||||||
|
*/
|
||||||
|
private <T> void addHandlersForEventObservation(final ComboBox<T> combo, final LabelProvider<T> labelProvider) {
|
||||||
|
combo.addValueChangeHandler(new ValueChangeHandler<T>() {
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<T> event) {
|
||||||
|
|
||||||
|
Info.display("Value Changed", "New value: "
|
||||||
|
+ (event.getValue() == null ? combo.getValue() : labelProvider.getLabel(event.getValue()) + "!"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
combo.addSelectionHandler(new SelectionHandler<T>() {
|
||||||
|
@Override
|
||||||
|
public void onSelection(SelectionEvent<T> event) {
|
||||||
|
Info.display("Agency Selected", "You selected "
|
||||||
|
+ (event.getSelectedItem() == null ? combo.getValue() : labelProvider.getLabel(event.getSelectedItem()) + "!"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup(){
|
||||||
|
Command sayNextCard = new Command() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
detail.setName(name.getCurrentValue());
|
||||||
|
detail.setAgency(combo.getSelectedText());
|
||||||
|
detail.setDescription(description.getCurrentValue());
|
||||||
|
detail.setRight(right.getCurrentValue());
|
||||||
|
|
||||||
|
importSession.setTableDetail(detail);
|
||||||
|
SDMXOperationInProgressCard sdmxOperationInProgressCard = new SDMXOperationInProgressCard(
|
||||||
|
importSession);
|
||||||
|
getWizardWindow()
|
||||||
|
.addCard(sdmxOperationInProgressCard);
|
||||||
|
Log.info("NextCard SDMXOperationInProgressCard");
|
||||||
|
getWizardWindow().nextCard();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||||
|
|
||||||
|
|
||||||
|
Command sayPreviousCard = new Command() {
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
getWizardWindow().previousCard();
|
||||||
|
getWizardWindow().removeCard(thisCard);
|
||||||
|
Log.info("Remove SDMXTableDetailCard");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private HorizontalLayoutContainer selectAgencies(){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HorizontalLayoutContainer documentSelectionPanel = new HorizontalLayoutContainer();
|
||||||
|
|
||||||
|
Radio radioAgenciesAlready = new Radio();
|
||||||
|
|
||||||
|
radioAgenciesAlready.setBoxLabel("Present");
|
||||||
|
radioAgenciesAlready.setValue(true);
|
||||||
|
radioAgenciesAlready.setName("Agencies");
|
||||||
|
|
||||||
|
Radio radioAgencyNew = new Radio();
|
||||||
|
radioAgencyNew.setBoxLabel("New");
|
||||||
|
radioAgencyNew.setName("AgencyNew");
|
||||||
|
|
||||||
|
|
||||||
|
documentSelectionPanel.add(radioAgenciesAlready);
|
||||||
|
documentSelectionPanel.add(radioAgencyNew);
|
||||||
|
|
||||||
|
|
||||||
|
// we can set name on radios or use toggle group
|
||||||
|
ToggleGroup toggle = new ToggleGroup();
|
||||||
|
toggle.add(radioAgenciesAlready);
|
||||||
|
toggle.add(radioAgencyNew);
|
||||||
|
|
||||||
|
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
||||||
|
try {
|
||||||
|
ToggleGroup group = (ToggleGroup) event.getSource();
|
||||||
|
Radio radio = (Radio) group.getValue();
|
||||||
|
Log.info("Document Selected:" + radio.getName());
|
||||||
|
if (radio.getName().compareTo("AgencyNew") == 0) {
|
||||||
|
/*agencyName.setVisible(true);
|
||||||
|
combo.setVisible(false);
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
if (radio.getName().compareTo("Agency") == 0) {
|
||||||
|
/*agencyName.setVisible(false);
|
||||||
|
combo.setVisible(true);
|
||||||
|
*/
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("ToggleGroup: onValueChange " + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return documentSelectionPanel;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.dataresource;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle.Source;
|
||||||
|
|
||||||
|
public interface ResourceBundle extends ClientBundle {
|
||||||
|
|
||||||
|
public static final ResourceBundle IMPL=GWT.create(ResourceBundle.class);
|
||||||
|
|
||||||
|
@Source("org/gcube/portlets/user/sdmxexportwizardtd/client/dataresource/resources/SDMXExportWizardTD.css")
|
||||||
|
SDMXExportCSS sdmxExportCss();
|
||||||
|
|
||||||
|
@Source("resources/arrow-refresh.png")
|
||||||
|
ImageResource refresh();
|
||||||
|
|
||||||
|
@Source("resources/arrow-refresh_16.png")
|
||||||
|
ImageResource refresh_16();
|
||||||
|
|
||||||
|
@Source("resources/arrow-refresh_32.png")
|
||||||
|
ImageResource refresh32();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.dataresource;
|
||||||
|
|
||||||
|
import com.google.gwt.resources.client.CssResource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface SDMXExportCSS extends CssResource {
|
||||||
|
|
||||||
|
@ClassName("wizard-title")
|
||||||
|
public String getWizardTitle();
|
||||||
|
|
||||||
|
@ClassName("wizard-footer")
|
||||||
|
public String getWizardFooter();
|
||||||
|
|
||||||
|
@ClassName("source-selection-hover")
|
||||||
|
public String getSourceSelectionHover();
|
||||||
|
|
||||||
|
// @ClassName("column-excluded")
|
||||||
|
// public String getColumnExcluded();
|
||||||
|
|
||||||
|
@ClassName("exportSelection-sources")
|
||||||
|
public String getExportSelectionSources();
|
||||||
|
|
||||||
|
@ClassName("exportSelection-source")
|
||||||
|
public String getExportSelectionSource();
|
||||||
|
|
||||||
|
@ClassName("sdmxRegistryUrlStyle")
|
||||||
|
public String getSDMXRegistryUrlStyle();
|
||||||
|
|
||||||
|
@ClassName("sdmxRegistryUrlInputStyle")
|
||||||
|
public String getSDMXRegistryUrlInputStyle();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
@CHARSET "UTF-8";
|
||||||
|
|
||||||
|
|
||||||
|
.wizard-title {
|
||||||
|
padding: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: small;
|
||||||
|
background-color: #C3D9FF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.wizard-footer {
|
||||||
|
padding: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: small;
|
||||||
|
text-align: right;
|
||||||
|
background-color: #CDEB8B
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-selection-hover:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*.column-excluded {
|
||||||
|
background-color: #e6e0da !important;
|
||||||
|
color: #bfa698;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
.exportSelection-sources {
|
||||||
|
padding: 30px;
|
||||||
|
display: block;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.exportSelection-source {
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
.sdmxRegistryUrlStyle {
|
||||||
|
padding-top:5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sdmxRegistryUrlInputStyle {
|
||||||
|
width:300px!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
input#sdmxRegistryUrlInputFieldId-input {
|
||||||
|
width:300px!important;
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 984 B |
Binary file not shown.
After Width: | Height: | Size: 572 B |
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
|
@ -0,0 +1,59 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.document;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class CodelistDocument implements SDMXDocument {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 8732679674877915333L;
|
||||||
|
|
||||||
|
public static final CodelistDocument INSTANCE = new CodelistDocument();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return "codelist";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Codelist document";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Select this document if you want to retrive codelist";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Codelist Document [getId()=");
|
||||||
|
builder.append(getId());
|
||||||
|
builder.append(", getName()=");
|
||||||
|
builder.append(getName());
|
||||||
|
builder.append(", getDescription()=");
|
||||||
|
builder.append(getDescription());
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.document;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DatasetDocument implements SDMXDocument {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6134053739629827095L;
|
||||||
|
|
||||||
|
public static final DatasetDocument INSTANCE = new DatasetDocument();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return "dataset";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Dataset document";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Select this document if you want to retrive dataset";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("DataSet Document [getId()=");
|
||||||
|
builder.append(getId());
|
||||||
|
builder.append(", getName()=");
|
||||||
|
builder.append(getName());
|
||||||
|
builder.append(", getDescription()=");
|
||||||
|
builder.append(getDescription());
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.document;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SDMX document type interface. All SDMX document type have to implement this interface.
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface SDMXDocument extends Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the document id.
|
||||||
|
* @return the document id.
|
||||||
|
*/
|
||||||
|
public String getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the document name.
|
||||||
|
* @return the document name.
|
||||||
|
*/
|
||||||
|
public String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the document description.
|
||||||
|
* @return the document description.
|
||||||
|
*/
|
||||||
|
public String getDescription();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.general;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple wizard card.
|
||||||
|
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||||
|
*/
|
||||||
|
public class SimpleWizardCard extends WizardCard {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new simple wizard card.
|
||||||
|
* @param title the card title.
|
||||||
|
* @param footer the card footer.
|
||||||
|
* @param content the card content.
|
||||||
|
*/
|
||||||
|
public SimpleWizardCard(String title, String footer, String content) {
|
||||||
|
super(title, footer);
|
||||||
|
|
||||||
|
ContentPanel contentPanel = new ContentPanel();
|
||||||
|
contentPanel.setHeaderVisible(false);
|
||||||
|
HTML htmlContent = new HTML(content);
|
||||||
|
htmlContent.setStyleName("wizard-simple-content");
|
||||||
|
contentPanel.add(htmlContent);
|
||||||
|
|
||||||
|
setContent(contentPanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,273 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.general;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.dataresource.ResourceBundle;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
|
import com.sencha.gxt.widget.core.client.Component;
|
||||||
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a Wizard Card.
|
||||||
|
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||||
|
*/
|
||||||
|
public class WizardCard extends BorderLayoutContainer {
|
||||||
|
|
||||||
|
private WizardWindow wizardWindow;
|
||||||
|
protected ContentPanel titlePanel;
|
||||||
|
protected ContentPanel footerPanel;
|
||||||
|
protected boolean calculateFooter = false;
|
||||||
|
protected HTML titleHtml;
|
||||||
|
protected HTML footerHtml;
|
||||||
|
|
||||||
|
final protected ResourceBundle res=ResourceBundle.IMPL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new wizard card.
|
||||||
|
* The footer is automatically calculated.
|
||||||
|
* @param title the card title.
|
||||||
|
*/
|
||||||
|
public WizardCard(String title) {
|
||||||
|
this(title,"");
|
||||||
|
calculateFooter = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new wizard card.
|
||||||
|
* @param title the card title.
|
||||||
|
* @param footer the card footer.
|
||||||
|
*/
|
||||||
|
public WizardCard(String title, String footer) {
|
||||||
|
Log.info(title);
|
||||||
|
res.sdmxExportCss().ensureInjected();
|
||||||
|
|
||||||
|
//add the title panel
|
||||||
|
titlePanel = new ContentPanel();
|
||||||
|
titlePanel.setHeight(30);
|
||||||
|
titlePanel.setBodyStyle("background-color:#C3D9FF");
|
||||||
|
titlePanel.setHeaderVisible(false);
|
||||||
|
|
||||||
|
titleHtml = new HTML(title);
|
||||||
|
titleHtml.setStylePrimaryName(res.sdmxExportCss().getWizardTitle());
|
||||||
|
titlePanel.add(titleHtml);
|
||||||
|
|
||||||
|
setNorthWidget(titlePanel, new BorderLayoutData(30));
|
||||||
|
|
||||||
|
//add the footer panel
|
||||||
|
footerPanel = new ContentPanel();
|
||||||
|
footerPanel.setHeight(30);
|
||||||
|
footerPanel.setBodyStyle("background-color:#CDEB8B");
|
||||||
|
footerPanel.setHeaderVisible(false);
|
||||||
|
|
||||||
|
footerHtml = new HTML(footer);
|
||||||
|
footerHtml.setStylePrimaryName(res.sdmxExportCss().getWizardFooter());
|
||||||
|
footerPanel.add(footerHtml);
|
||||||
|
|
||||||
|
setSouthWidget(footerPanel, new BorderLayoutData(30));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
titleHtml.setHTML("<h1>"+title+"</h1>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the card footer.
|
||||||
|
* @param footer the footer.
|
||||||
|
*/
|
||||||
|
public void setFooter(String footer)
|
||||||
|
{
|
||||||
|
footerHtml.setHTML("<p>"+footer+"</p>");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the card content.
|
||||||
|
* @param content the card content.
|
||||||
|
*/
|
||||||
|
public void setContent(Component content)
|
||||||
|
{
|
||||||
|
setCenterWidget(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the card content.
|
||||||
|
* @param content the card content.
|
||||||
|
*/
|
||||||
|
public void setContent(com.google.gwt.user.client.ui.Panel content)
|
||||||
|
{
|
||||||
|
setCenterWidget(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the next button.
|
||||||
|
* @param enable <code>true</code> to enable it, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public void setEnableNextButton(boolean enable)
|
||||||
|
{
|
||||||
|
if (wizardWindow!=null){
|
||||||
|
wizardWindow.setEnableNextButton(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the back button.
|
||||||
|
* @param enable <code>true</code> to enable the button, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public void setEnableBackButton(boolean enable)
|
||||||
|
{
|
||||||
|
if (wizardWindow!=null){
|
||||||
|
wizardWindow.setEnableBackButton(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the next button label.
|
||||||
|
* @param text the button label.
|
||||||
|
*/
|
||||||
|
public void setNextButtonText(String text)
|
||||||
|
{
|
||||||
|
if (wizardWindow!=null){
|
||||||
|
wizardWindow.setNextButtonText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the back button label.
|
||||||
|
* @param text the button label.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void setBackButtonText(String text)
|
||||||
|
{
|
||||||
|
if (wizardWindow!=null){
|
||||||
|
wizardWindow.setBackButtonText(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visible the next button.
|
||||||
|
* @param visible <code>true</code> to show the button, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public void setNextButtonVisible(boolean visible)
|
||||||
|
{
|
||||||
|
if (wizardWindow!=null){
|
||||||
|
wizardWindow.setNextButtonVisible(visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visible the back button.
|
||||||
|
* @param visible <code>true</code> to show the button, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public void setBackButtonVisible(boolean visible)
|
||||||
|
{
|
||||||
|
if (wizardWindow!=null){
|
||||||
|
wizardWindow.setBackButtonVisible(visible);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setNextButtonToFinish()
|
||||||
|
{
|
||||||
|
if (wizardWindow!=null){
|
||||||
|
wizardWindow.setNextButtonToFinish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the WizardWindow for this import card.
|
||||||
|
* @param wizardWindow the WizardWindow.
|
||||||
|
*/
|
||||||
|
protected void setWizardWindow(WizardWindow wizardWindow)
|
||||||
|
{
|
||||||
|
this.wizardWindow = wizardWindow;
|
||||||
|
if (calculateFooter) {
|
||||||
|
StringBuilder footer = new StringBuilder();
|
||||||
|
footer.append("Step ");
|
||||||
|
footer.append(getCardPosition());
|
||||||
|
footer.append(" of ");
|
||||||
|
footer.append(getCardSize());
|
||||||
|
setFooter(footer.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current wizard window.
|
||||||
|
* @return the wizard window.
|
||||||
|
*/
|
||||||
|
protected WizardWindow getWizardWindow()
|
||||||
|
{
|
||||||
|
if (wizardWindow==null) throw new IllegalStateException("No Wizard Window setup");
|
||||||
|
return wizardWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addToWindowTitle(String toAdd)
|
||||||
|
{
|
||||||
|
wizardWindow.setTitle(wizardWindow.getOriginalTitle()+toAdd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called before the card is showed.
|
||||||
|
*/
|
||||||
|
public void setup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the card is disposed.
|
||||||
|
*/
|
||||||
|
public void dispose()
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a listener to the next button.
|
||||||
|
* @param listener the listener to add.
|
||||||
|
*/
|
||||||
|
public void addNextButtonListener(SelectHandler listener)
|
||||||
|
{
|
||||||
|
if (wizardWindow!=null){
|
||||||
|
wizardWindow.addNextButtonListener(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the number of cards in the wizard window.
|
||||||
|
* @return the number of cards.
|
||||||
|
*/
|
||||||
|
public int getCardSize()
|
||||||
|
{
|
||||||
|
return getWizardWindow().getCardStackSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this card position on card list.
|
||||||
|
* @return the card position on the card stack.
|
||||||
|
*/
|
||||||
|
public int getCardPosition()
|
||||||
|
{
|
||||||
|
int indexPosition = getWizardWindow().getCardStack().indexOf(this);
|
||||||
|
return (indexPosition>=0)?indexPosition+1:indexPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showErrorAndHide(String title, final String failureReason, final String failureDetails, final Throwable throwable)
|
||||||
|
{
|
||||||
|
wizardWindow.showErrorAndHide(title, failureReason, failureDetails, throwable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void hideWindow()
|
||||||
|
{
|
||||||
|
wizardWindow.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.general;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface WizardListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the wizard is completed without errors
|
||||||
|
*/
|
||||||
|
public void completed(TRId id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the wizard has been aborted by the user.
|
||||||
|
*/
|
||||||
|
public void aborted();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the something in the wizard is failed.
|
||||||
|
* @param throwable the exception or <code>null</code>.
|
||||||
|
* @param reason the failure reason or <code>null</code>.
|
||||||
|
* @param details the failure details or <code>null</code>.
|
||||||
|
*/
|
||||||
|
public void failed(Throwable throwable, String reason, String details);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,447 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.general;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.util.ErrorMessageBox;
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.Callback;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||||
|
import com.sencha.gxt.core.client.resources.ThemeStyles;
|
||||||
|
import com.sencha.gxt.widget.core.client.Dialog;
|
||||||
|
import com.sencha.gxt.widget.core.client.Window;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.CardLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.FillToolItem;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class WizardWindow extends Window {
|
||||||
|
|
||||||
|
protected ArrayList<WizardCard> cardStack = new ArrayList<WizardCard>();
|
||||||
|
|
||||||
|
protected TextButton backButton;
|
||||||
|
|
||||||
|
protected TextButton nextButton;
|
||||||
|
|
||||||
|
protected String originalTitle;
|
||||||
|
|
||||||
|
protected boolean checkBeforeClose = true;
|
||||||
|
|
||||||
|
protected boolean nextCardFinish = false;
|
||||||
|
|
||||||
|
protected Command nextButtonAction = null;
|
||||||
|
|
||||||
|
protected Command previousButtonAction = null;
|
||||||
|
|
||||||
|
protected CardLayoutContainer cardContainer;
|
||||||
|
|
||||||
|
protected ArrayList<WizardListener> listeners;
|
||||||
|
|
||||||
|
protected SimpleEventBus eventBus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new Wizard Window with the specified title.
|
||||||
|
* @param title the wizard window title.
|
||||||
|
*/
|
||||||
|
public WizardWindow(String title)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
this.eventBus= new SimpleEventBus();
|
||||||
|
Log.info(title);
|
||||||
|
//setModal(true);
|
||||||
|
setResizable(true);
|
||||||
|
setCollapsible(true);
|
||||||
|
|
||||||
|
listeners = new ArrayList<WizardListener>();
|
||||||
|
|
||||||
|
setHeadingText(title);
|
||||||
|
this.originalTitle = title;
|
||||||
|
|
||||||
|
VerticalLayoutContainer container = new VerticalLayoutContainer();
|
||||||
|
|
||||||
|
cardContainer = new CardLayoutContainer();
|
||||||
|
container.add(cardContainer, new VerticalLayoutData(1, 1));
|
||||||
|
|
||||||
|
ToolBar toolbar = new ToolBar();
|
||||||
|
toolbar.addStyleName(ThemeStyles.getStyle().borderTop());
|
||||||
|
|
||||||
|
backButton = new TextButton("Back");
|
||||||
|
backButton.setEnabled(false);
|
||||||
|
backButton.setTabIndex(1001);
|
||||||
|
toolbar.add(backButton);
|
||||||
|
toolbar.add(new FillToolItem());
|
||||||
|
|
||||||
|
nextButton = new TextButton("Next");
|
||||||
|
nextButton.setTabIndex(1000);
|
||||||
|
toolbar.add(nextButton);
|
||||||
|
|
||||||
|
toolbar.setLayoutData(new VerticalLayoutData(1, -1));
|
||||||
|
container.add(toolbar);
|
||||||
|
|
||||||
|
SelectHandler selectionHandler = new SelectHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
TextButton button = (TextButton)event.getSource();
|
||||||
|
String btnID = button.getId();
|
||||||
|
|
||||||
|
if (btnID.equals(backButton.getId())) {
|
||||||
|
|
||||||
|
if(previousButtonAction!=null) previousButtonAction.execute();
|
||||||
|
else previousCard();
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (nextButtonAction!=null) nextButtonAction.execute();
|
||||||
|
else nextCard();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
backButton.addSelectHandler(selectionHandler);
|
||||||
|
nextButton.addSelectHandler(selectionHandler);
|
||||||
|
|
||||||
|
setWidget(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void initTools() {
|
||||||
|
super.initTools();
|
||||||
|
|
||||||
|
//we can't distiimport org.gcube.portlets.user.sdmxexportwizardtd.shared.TRId;nguish between hide and hide with button
|
||||||
|
/*closeBtn.removeAllListeners();
|
||||||
|
closeBtn.addListener(Events.Select, new Listener<ComponentEvent>() {
|
||||||
|
public void handleEvent(ComponentEvent ce) {
|
||||||
|
MessageBox.confirm("Confirm", "Are you sure to cancel the operation?", new Listener<MessageBoxEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(MessageBoxEvent be) {
|
||||||
|
if (be.getButtonClicked().getItemId().equals(Dialog.YES)) {
|
||||||
|
hide();
|
||||||
|
fireAborted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addListener(WizardListener listener)
|
||||||
|
{
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(WizardListener listener)
|
||||||
|
{
|
||||||
|
listeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the next available card.
|
||||||
|
*/
|
||||||
|
public void nextCard()
|
||||||
|
{
|
||||||
|
|
||||||
|
Widget activeItem = cardContainer.getActiveWidget();
|
||||||
|
|
||||||
|
if (activeItem instanceof WizardCard) ((WizardCard)activeItem).dispose();
|
||||||
|
|
||||||
|
int cardPos = cardStack.indexOf(activeItem);
|
||||||
|
|
||||||
|
//NEXT ->
|
||||||
|
|
||||||
|
nextButton.setEnabled(true);
|
||||||
|
backButton.setEnabled(true);
|
||||||
|
|
||||||
|
int newPos=cardPos+1;
|
||||||
|
|
||||||
|
if (newPos == 0) {
|
||||||
|
//we are moving forward from the first card
|
||||||
|
backButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
nextButtonAction=null;
|
||||||
|
previousButtonAction=null;
|
||||||
|
Log.info("cardStack size:"+cardStack.size()+" newPos"+ newPos);
|
||||||
|
WizardCard card = cardStack.get(newPos);
|
||||||
|
cardContainer.setActiveWidget(card);
|
||||||
|
doLayout();
|
||||||
|
if (card instanceof WizardCard) ((WizardCard)card).setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows the previous available card.
|
||||||
|
*/
|
||||||
|
public void previousCard()
|
||||||
|
{
|
||||||
|
Widget activeItem = cardContainer.getActiveWidget();
|
||||||
|
|
||||||
|
if (activeItem instanceof WizardCard) ((WizardCard)activeItem).dispose();
|
||||||
|
|
||||||
|
int cardPos = cardStack.indexOf(activeItem);
|
||||||
|
|
||||||
|
//BACK <-
|
||||||
|
|
||||||
|
nextButton.setEnabled(true);
|
||||||
|
backButton.setEnabled(true);
|
||||||
|
|
||||||
|
int newPos=cardPos-1;
|
||||||
|
|
||||||
|
|
||||||
|
if (newPos == 0) {
|
||||||
|
backButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
nextButtonAction=null;
|
||||||
|
previousButtonAction=null;
|
||||||
|
|
||||||
|
WizardCard card = cardStack.get(newPos);
|
||||||
|
cardContainer.setActiveWidget(card);
|
||||||
|
doLayout();
|
||||||
|
if (card instanceof WizardCard) ((WizardCard)card).setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of available cards.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getCardStackSize()
|
||||||
|
{
|
||||||
|
return cardStack.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current active card.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int getCurrentCard()
|
||||||
|
{
|
||||||
|
return cardStack.indexOf(cardContainer.getActiveWidget());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean checkBeforeClose()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close(boolean check) {
|
||||||
|
checkBeforeClose = check;
|
||||||
|
hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the label of next button to "Finish" value and add a close command to it.
|
||||||
|
*/
|
||||||
|
public void setNextButtonToFinish()
|
||||||
|
{
|
||||||
|
nextButton.setText("Finish");
|
||||||
|
nextButtonAction = new Command() {
|
||||||
|
|
||||||
|
public void execute() {
|
||||||
|
close(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the command for the next button.
|
||||||
|
* @param command the command to execute.
|
||||||
|
*/
|
||||||
|
public void setNextButtonCommand(Command command)
|
||||||
|
{
|
||||||
|
nextButtonAction = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the command for the previous button.
|
||||||
|
* @param command the command to execute.
|
||||||
|
*/
|
||||||
|
public void setPreviousButtonCommand(Command command)
|
||||||
|
{
|
||||||
|
previousButtonAction = command;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void show() {
|
||||||
|
super.show();
|
||||||
|
|
||||||
|
Widget activeItem = cardContainer.getActiveWidget();
|
||||||
|
|
||||||
|
if (activeItem instanceof WizardCard) ((WizardCard)activeItem).setup();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the card list.
|
||||||
|
* @param cards
|
||||||
|
*/
|
||||||
|
public void setCards(ArrayList<WizardCard> cards)
|
||||||
|
{
|
||||||
|
for (WizardCard card:cards) {
|
||||||
|
addCard(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a card to this wizard.
|
||||||
|
* @param card the card to add.
|
||||||
|
*/
|
||||||
|
public void addCard(WizardCard card)
|
||||||
|
{
|
||||||
|
card.setWizardWindow(this);
|
||||||
|
cardContainer.add(card);
|
||||||
|
cardStack.add(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a card to this wizard.
|
||||||
|
* @param card the card to add.
|
||||||
|
*/
|
||||||
|
public void removeCard(WizardCard card)
|
||||||
|
{
|
||||||
|
cardContainer.remove(card);
|
||||||
|
cardStack.remove(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the next button on the wizard.
|
||||||
|
* @param enable <code>true</code> to enable the next button, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public void setEnableNextButton(boolean enable)
|
||||||
|
{
|
||||||
|
nextButton.setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables the back button on the wizard.
|
||||||
|
* @param enable <code>true</code> to enable the back button, <code>false</code> otherwise.
|
||||||
|
*/
|
||||||
|
public void setEnableBackButton(boolean enable)
|
||||||
|
{
|
||||||
|
backButton.setEnabled(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the next button label.
|
||||||
|
* @param text the button label.
|
||||||
|
*/
|
||||||
|
protected void setNextButtonText(String text)
|
||||||
|
{
|
||||||
|
nextButton.setText(text);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the back button label.
|
||||||
|
* @param text the button label.
|
||||||
|
*/
|
||||||
|
protected void setBackButtonText(String text)
|
||||||
|
{
|
||||||
|
backButton.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets visible next button.
|
||||||
|
* @param visible
|
||||||
|
*/
|
||||||
|
protected void setNextButtonVisible(boolean visible)
|
||||||
|
{
|
||||||
|
nextButton.setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets visible back button.
|
||||||
|
* @param visible
|
||||||
|
*/
|
||||||
|
protected void setBackButtonVisible(boolean visible)
|
||||||
|
{
|
||||||
|
backButton.setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a listener to the next button.
|
||||||
|
* @param listener the listener to add.
|
||||||
|
*/
|
||||||
|
protected void addNextButtonListener(SelectHandler listener)
|
||||||
|
{
|
||||||
|
nextButton.addSelectHandler(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the originalTitle
|
||||||
|
*/
|
||||||
|
public String getOriginalTitle() {
|
||||||
|
return originalTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the card list.
|
||||||
|
* @return teh card list.
|
||||||
|
*/
|
||||||
|
public ArrayList<WizardCard> getCardStack()
|
||||||
|
{
|
||||||
|
return cardStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showErrorAndHide(String title, final String failureReason, final String failureDetails, final Throwable throwable)
|
||||||
|
{
|
||||||
|
ErrorMessageBox.showError(title, failureReason, failureDetails, new Callback<Dialog, Void>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Dialog result) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Void reason) {
|
||||||
|
hide();
|
||||||
|
fireFailed(throwable, failureReason, failureDetails);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireCompleted(TRId id)
|
||||||
|
{
|
||||||
|
for (WizardListener listener:listeners) listener.completed(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireAborted()
|
||||||
|
{
|
||||||
|
for (WizardListener listener:listeners) listener.aborted();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fireFailed(Throwable throwable, String reason, String details)
|
||||||
|
{
|
||||||
|
for (WizardListener listener:listeners) listener.failed(throwable, reason, details);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.progress;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a {@link ProgressBar} progress and text based on {@link OperationProgressListener} events.
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ImportProgressBarUpdater implements OperationProgressListener {
|
||||||
|
|
||||||
|
protected ProgressBar progressBar;
|
||||||
|
//protected FramedPanel operationResult;
|
||||||
|
//protected WizardWindow wizardWindow;
|
||||||
|
/**
|
||||||
|
* Creates a new {@link ProgressBar} updater.
|
||||||
|
* @param progressBar the {@link ProgressBar} to update.
|
||||||
|
*/
|
||||||
|
public ImportProgressBarUpdater(ProgressBar progressBar) {
|
||||||
|
this.progressBar = progressBar;
|
||||||
|
//this.wizardWindow = w;
|
||||||
|
//this.operationResult = operationResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void operationComplete(TRId trId) {// TODO Auto-generated method stub
|
||||||
|
Log.info("Import complete");
|
||||||
|
progressBar.updateProgress(1, "Import complete.");
|
||||||
|
/*final FlexTable descriptionResult = new FlexTable();
|
||||||
|
descriptionResult.setCellSpacing(10);
|
||||||
|
descriptionResult.setCellPadding(4);
|
||||||
|
descriptionResult.setBorderWidth(0);
|
||||||
|
descriptionResult.setText(0, 0, "Result: ");
|
||||||
|
descriptionResult.setText(0, 1, "Import complete");
|
||||||
|
|
||||||
|
operationResult.add(descriptionResult);
|
||||||
|
operationResult.setVisible(true);
|
||||||
|
*/
|
||||||
|
//wizardWindow.setEnableNextButton(true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||||||
|
Log.info("Import failed");
|
||||||
|
progressBar.updateText("Import failed.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationInitializing() {
|
||||||
|
Log.info("Inport inizializing");
|
||||||
|
progressBar.updateProgress(0, "initializing...");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationUpdate(float elaborated) {
|
||||||
|
Log.info("Import elaborated: "+elaborated);
|
||||||
|
if (elaborated == 0) progressBar.updateProgress(0, "initializing...");
|
||||||
|
if (elaborated>0 && elaborated<1) {
|
||||||
|
Log.trace("progress "+elaborated);
|
||||||
|
int elab=new Float(elaborated*100).intValue();
|
||||||
|
progressBar.updateProgress(elaborated,elab+"% importing...");
|
||||||
|
}
|
||||||
|
if (elaborated == 1) progressBar.updateProgress(1, "completing...");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.progress;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines a listener for operation progress.
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface OperationProgressListener {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the operation is starting.
|
||||||
|
*/
|
||||||
|
public void operationInitializing();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when there is a progress for the operation.
|
||||||
|
* @param elaborated the elaborated part.
|
||||||
|
*/
|
||||||
|
public void operationUpdate(float elaborated);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the operation is complete.
|
||||||
|
*/
|
||||||
|
public void operationComplete(TRId trId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the operation is failed.
|
||||||
|
* @param caught the failure exception.
|
||||||
|
* @param reason the failure reason.
|
||||||
|
*/
|
||||||
|
public void operationFailed(Throwable caught, String reason, String failureDetails);
|
||||||
|
}
|
|
@ -0,0 +1,131 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.progress;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.rpc.SDMXExportWizardServiceAsync;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.ExportMonitor;
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.user.client.Timer;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This {@link Timer} retrieves {@link OperationProgress} from the specified {@link OperationProgressSource} with the scheduled interval.
|
||||||
|
* The retrieved information are spread to the subscribed {@link OperationProgressListener}.
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class OperationProgressUpdater extends Timer {
|
||||||
|
|
||||||
|
protected ArrayList<OperationProgressListener> listeners = new ArrayList<OperationProgressListener>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
Log.debug("requesting operation progress");
|
||||||
|
SDMXExportWizardServiceAsync.INSTANCE.getExportMonitor(new AsyncCallback<ExportMonitor>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
cancel();
|
||||||
|
Log.error("Error retrieving the operation state", caught);
|
||||||
|
String message = getStack(caught);
|
||||||
|
fireOperationFailed(caught, "Failed getting operation updates", message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ExportMonitor result) {
|
||||||
|
Log.info("retrieved ImportMonitor: "+result.getStatus());
|
||||||
|
switch (result.getStatus()) {
|
||||||
|
case WAITING:
|
||||||
|
break;
|
||||||
|
case INITIALIZING:
|
||||||
|
fireOperationInitializing();
|
||||||
|
break;
|
||||||
|
case IN_PROGRESS:
|
||||||
|
fireOperationUpdate(result.getProgress());
|
||||||
|
break;
|
||||||
|
case FAILED:
|
||||||
|
cancel();
|
||||||
|
fireOperationFailed(result.getError(),"Failed Client Library Import", result.getStatusDescription());
|
||||||
|
break;
|
||||||
|
case SUCCEDED:
|
||||||
|
cancel();
|
||||||
|
Log.info("Import fisnish TableId :"+result.getTrId());
|
||||||
|
fireOperationComplete(result.getTrId());
|
||||||
|
break;
|
||||||
|
case ABORTED:
|
||||||
|
cancel();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getStack(Throwable e)
|
||||||
|
{
|
||||||
|
String message = e.getLocalizedMessage()+" -> <br>";
|
||||||
|
Throwable c = e.getCause();
|
||||||
|
if (c!=null) message += getStack(c);
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void fireOperationInitializing()
|
||||||
|
{
|
||||||
|
for (OperationProgressListener listener:listeners) listener.operationInitializing();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void fireOperationUpdate(float elaborated)
|
||||||
|
{
|
||||||
|
for (OperationProgressListener listener:listeners) listener.operationUpdate(elaborated);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void fireOperationComplete(TRId trId)
|
||||||
|
{
|
||||||
|
for (OperationProgressListener listener:listeners) listener.operationComplete(trId);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void fireOperationFailed(Throwable caught, String failure, String failureDetails)
|
||||||
|
{
|
||||||
|
for (OperationProgressListener listener:listeners) listener.operationFailed(caught, failure, failureDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new {@link OperationProgressListener} to this {@link OperationProgressUpdater}.
|
||||||
|
* @param listener the listener to add.
|
||||||
|
*/
|
||||||
|
public void addListener(OperationProgressListener listener)
|
||||||
|
{
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the specified {@link OperationProgressListener} from this {@link OperationProgressUpdater}.
|
||||||
|
* @param listener the listener to remove.
|
||||||
|
*/
|
||||||
|
public void removeListener(OperationProgressListener listener)
|
||||||
|
{
|
||||||
|
listeners.remove(listener);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.rpc;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Codelist;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Dataset;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.ExportMonitor;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportWizardException;
|
||||||
|
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteService;
|
||||||
|
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RemoteServiceRelativePath("SDMXExportWizardService")
|
||||||
|
public interface SDMXExportWizardService extends RemoteService {
|
||||||
|
|
||||||
|
public List<Codelist> getCodelists() throws SDMXExportWizardException;
|
||||||
|
|
||||||
|
public List<Dataset> getDatasets() throws SDMXExportWizardException;
|
||||||
|
|
||||||
|
public List<Agencies> getAgencies() throws SDMXExportWizardException;
|
||||||
|
|
||||||
|
public void setSDMXSession(SDMXExportSession s) throws SDMXExportWizardException;
|
||||||
|
|
||||||
|
public ExportMonitor getExportMonitor() throws SDMXExportWizardException;
|
||||||
|
|
||||||
|
public void exportSDMXClientLibraryRequest(SDMXExportSession s) throws SDMXExportWizardException;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.rpc;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Codelist;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Dataset;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.ExportMonitor;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportWizardException;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface SDMXExportWizardServiceAsync {
|
||||||
|
|
||||||
|
public SDMXExportWizardServiceAsync INSTANCE = GWT.create(SDMXExportWizardService.class);
|
||||||
|
|
||||||
|
void getCodelists(AsyncCallback<List<Codelist>> callback);
|
||||||
|
|
||||||
|
void getDatasets(AsyncCallback<List<Dataset>> callback);
|
||||||
|
|
||||||
|
void getAgencies(AsyncCallback<List<Agencies>> callback);
|
||||||
|
|
||||||
|
void setSDMXSession(SDMXExportSession s, AsyncCallback<Void> callback);
|
||||||
|
|
||||||
|
void getExportMonitor(AsyncCallback<ExportMonitor> callback);
|
||||||
|
|
||||||
|
void exportSDMXClientLibraryRequest(SDMXExportSession s,AsyncCallback<Void> callback);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.source;
|
||||||
|
|
||||||
|
|
||||||
|
public class FileSource implements Source {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5990408094142286488L;
|
||||||
|
|
||||||
|
public static final FileSource INSTANCE = new FileSource();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return "File";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "File source";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Select this source if you want to retrive document from File";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("File source [getId()=");
|
||||||
|
builder.append(getId());
|
||||||
|
builder.append(", getName()=");
|
||||||
|
builder.append(getName());
|
||||||
|
builder.append(", getDescription()=");
|
||||||
|
builder.append(getDescription());
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.source;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class SDMXRegistrySource implements Source {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 3254879141340681969L;
|
||||||
|
|
||||||
|
public static final SDMXRegistrySource INSTANCE = new SDMXRegistrySource();
|
||||||
|
|
||||||
|
protected String url;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return "SDMXRegistry";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "SDMX Registry source";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Select this source if you want to retrive document from SDMX Registry";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("SDMXRegistry source [getId()=");
|
||||||
|
builder.append(getId());
|
||||||
|
builder.append(", getName()=");
|
||||||
|
builder.append(getName());
|
||||||
|
builder.append(", getDescription()=");
|
||||||
|
builder.append(getDescription());
|
||||||
|
builder.append(", getUrl()=");
|
||||||
|
builder.append(getUrl());
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.source;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public interface Source extends Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the document type id.
|
||||||
|
* @return the document type id.
|
||||||
|
*/
|
||||||
|
public String getId();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the document type name.
|
||||||
|
* @return the document type name.
|
||||||
|
*/
|
||||||
|
public String getName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the document type description.
|
||||||
|
* @return the document type description.
|
||||||
|
*/
|
||||||
|
public String getDescription();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.source;
|
||||||
|
|
||||||
|
|
||||||
|
public class WorkspaceSource implements Source {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 2826706131664617270L;
|
||||||
|
|
||||||
|
public static final WorkspaceSource INSTANCE = new WorkspaceSource();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getId() {
|
||||||
|
return "Workspace";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Workspace source";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return "Select this source if you want to retrive document from Workspace";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Workspace source [getId()=");
|
||||||
|
builder.append(getId());
|
||||||
|
builder.append(", getName()=");
|
||||||
|
builder.append(getName());
|
||||||
|
builder.append(", getDescription()=");
|
||||||
|
builder.append(getDescription());
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.util;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.Callback;
|
||||||
|
import com.google.gwt.user.client.ui.Label;
|
||||||
|
import com.sencha.gxt.widget.core.client.Dialog;
|
||||||
|
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.box.MessageBox;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ErrorMessageBox {
|
||||||
|
|
||||||
|
|
||||||
|
private static final String DETAILS = "Details";
|
||||||
|
|
||||||
|
|
||||||
|
public static void showError(String title, String failureReason, final String failureDetails)
|
||||||
|
{
|
||||||
|
showError(title, failureReason, failureDetails, new NOPCallBack<Dialog, Void>());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showError(String title, String failureReason, final String failureDetails, final Callback<Dialog, Void> callback)
|
||||||
|
{
|
||||||
|
final MessageBox box = new MessageBox(title);
|
||||||
|
box.setMessage(failureReason);
|
||||||
|
box.addHideHandler(new HideHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
Dialog dialog = (Dialog) event.getSource();
|
||||||
|
|
||||||
|
if (dialog.getHideButton().getText().equals(DETAILS)){
|
||||||
|
//box.close();
|
||||||
|
showErrorDetails("Error details", failureDetails);
|
||||||
|
} else callback.onSuccess(dialog);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/*FIXME box.setIcon(MessageBox.ERROR);
|
||||||
|
box.getDialog().cancelText = DETAILS;
|
||||||
|
box.getDialog().setButtons(MessageBox.OKCANCEL);*/
|
||||||
|
box.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void showErrorDetails(String title, String failureDetails)
|
||||||
|
{
|
||||||
|
final Dialog simple = new Dialog();
|
||||||
|
simple.setHeadingText(title);
|
||||||
|
simple.setPredefinedButtons(PredefinedButton.OK);
|
||||||
|
simple.setBodyStyleName("pad-text");
|
||||||
|
|
||||||
|
|
||||||
|
simple.add(new Label("<PRE>"+failureDetails+"</PRE>"));
|
||||||
|
//simple.getItem(0).getFocusSupport().setIgnore(true);
|
||||||
|
|
||||||
|
//FIXME simple.setScrollMode(ScrollMode.AUTO);
|
||||||
|
|
||||||
|
simple.setHideOnButtonClick(true);
|
||||||
|
simple.setWidth(400);
|
||||||
|
simple.setHeight(400);
|
||||||
|
simple.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Format {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a file size into a {@link String} representation adding the misure unit.
|
||||||
|
* @param size the file size.
|
||||||
|
* @return the textual representation.
|
||||||
|
*/
|
||||||
|
public static String fileSize(long size) {
|
||||||
|
StringBuilder text = new StringBuilder();
|
||||||
|
if (size < 1024) {
|
||||||
|
text.append(size);
|
||||||
|
text.append(" bytes");
|
||||||
|
} else if (size < 1048576) {
|
||||||
|
text.append(Math.round(((size * 10) / 1024)) / 10);
|
||||||
|
text.append(" KB");
|
||||||
|
} else if (size < 1073741824) {
|
||||||
|
text.append(Math.round(((size * 10) / 1048576)) / 10);
|
||||||
|
text.append(" MB");
|
||||||
|
} else {
|
||||||
|
text.append(Math.round(((size * 10) / 1073741824)) / 10);
|
||||||
|
text.append(" GB");
|
||||||
|
}
|
||||||
|
return text.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.util;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.Callback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class NOPCallBack<T,F> implements Callback<T, F> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(F reason) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(T result) {}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client.util;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Federico De Faveri defaveri@isti.cnr.it
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface WizardResources extends ClientBundle {
|
||||||
|
|
||||||
|
public static final WizardResources INSTANCE = GWT.create(WizardResources.class);
|
||||||
|
|
||||||
|
/* @Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/accept.png")
|
||||||
|
ImageResource csvCheckSuccess();
|
||||||
|
|
||||||
|
@Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/error.png")
|
||||||
|
ImageResource csvCheckFailure();
|
||||||
|
|
||||||
|
@Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/loading.gif")
|
||||||
|
ImageResource loading();
|
||||||
|
|
||||||
|
@Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/information.png")
|
||||||
|
ImageResource information();
|
||||||
|
|
||||||
|
@Source("org/gcube/portlets/user/csvimportwizardgxt3/client/util/resources/Wizard.css")
|
||||||
|
WizardCss wizardCss();
|
||||||
|
*/
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.server;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryDescriptor;
|
||||||
|
import org.gcube.datapublishing.sdmx.api.model.SDMXRegistryInterfaceType;
|
||||||
|
import org.gcube.datapublishing.sdmx.api.registry.SDMXRegistryClient;
|
||||||
|
import org.gcube.datapublishing.sdmx.api.registry.SDMXRegistryClient.Detail;
|
||||||
|
import org.gcube.datapublishing.sdmx.api.registry.SDMXRegistryClient.References;
|
||||||
|
import org.gcube.datapublishing.sdmx.impl.model.GCubeSDMXRegistryDescriptor;
|
||||||
|
import org.gcube.datapublishing.sdmx.impl.model.SDMXRegistryDescriptorImpl;
|
||||||
|
import org.gcube.datapublishing.sdmx.impl.registry.FusionRegistryClient;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Codelist;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Dataset;
|
||||||
|
import org.sdmxsource.sdmx.api.model.beans.SdmxBeans;
|
||||||
|
import org.sdmxsource.sdmx.api.model.beans.base.AgencyBean;
|
||||||
|
import org.sdmxsource.sdmx.api.model.beans.codelist.CodelistBean;
|
||||||
|
import org.sdmxsource.sdmx.api.model.beans.datastructure.DataflowBean;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXClient {
|
||||||
|
|
||||||
|
public static enum TYPE {
|
||||||
|
INTERNAL, ANOTHER
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static Logger logger = LoggerFactory.getLogger(SDMXClient.class);
|
||||||
|
|
||||||
|
protected SDMXRegistryClient client;
|
||||||
|
protected TYPE type;
|
||||||
|
protected String url;
|
||||||
|
|
||||||
|
public SDMXClient() {
|
||||||
|
type = TYPE.INTERNAL;
|
||||||
|
url = null;
|
||||||
|
SDMXRegistryDescriptor descriptor = new GCubeSDMXRegistryDescriptor();
|
||||||
|
client = new FusionRegistryClient(descriptor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public SDMXClient(String url) {
|
||||||
|
type = TYPE.ANOTHER;
|
||||||
|
this.url = url;
|
||||||
|
SDMXRegistryDescriptorImpl descriptor = new SDMXRegistryDescriptorImpl();
|
||||||
|
descriptor.setUrl(SDMXRegistryInterfaceType.RESTV2_1, url);
|
||||||
|
client = new FusionRegistryClient(descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Codelist> getAllCodelists() throws Exception {
|
||||||
|
SdmxBeans beans = client.getCodelist("all", "all", "all",
|
||||||
|
Detail.allstubs, References.none);
|
||||||
|
List<Codelist> codelists = new ArrayList<Codelist>();
|
||||||
|
for (CodelistBean codelist : beans.getCodelists())
|
||||||
|
codelists.add(new Codelist(codelist.getId(), codelist.getName(),
|
||||||
|
codelist.getAgencyId(), codelist.getVersion(), codelist
|
||||||
|
.getDescription()));
|
||||||
|
logger.debug("codelists: " + codelists);
|
||||||
|
return codelists;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Dataset> getAllDatasets() throws Exception {
|
||||||
|
SdmxBeans beans = client.getProvisionAgreement("all", "all", "latest",
|
||||||
|
Detail.full, References.children);
|
||||||
|
List<Dataset> datasets = new ArrayList<Dataset>();
|
||||||
|
for (DataflowBean dataflowBean : beans.getDataflows()) {
|
||||||
|
datasets.add(new Dataset(dataflowBean.getId(), dataflowBean
|
||||||
|
.getName(), dataflowBean.getAgencyId(), dataflowBean
|
||||||
|
.getVersion(), dataflowBean.getDescription()));
|
||||||
|
}
|
||||||
|
logger.debug("datasets: " + datasets);
|
||||||
|
return datasets;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Agencies> getAllAgencies() throws Exception {
|
||||||
|
List<Agencies> agenciesList = new ArrayList<Agencies>();
|
||||||
|
if (client == null) {
|
||||||
|
logger.error("getAllAgencies() Error: client is null");
|
||||||
|
} else {
|
||||||
|
SdmxBeans beans = client.getAgencyScheme("SDMX", "AGENCIES", "1.0",
|
||||||
|
Detail.full, References.none);
|
||||||
|
if (beans == null) {
|
||||||
|
logger.error("getAllAgencies() Error: SdmxBeans is null");
|
||||||
|
} else {
|
||||||
|
for (AgencyBean agency : beans.getAgencies())
|
||||||
|
agenciesList.add(new Agencies(agency.getId(), agency
|
||||||
|
.getName(), agency.getDescription()));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.debug("agencies: " + agenciesList);
|
||||||
|
return agenciesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,279 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.server;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.gcube.data.analysis.tabulardata.operation.worker.ActivityStatus;
|
||||||
|
import org.gcube.data.analysis.tabulardata.operation.worker.EligibleOperation;
|
||||||
|
import org.gcube.data.analysis.tabulardata.operation.worker.JobResult;
|
||||||
|
import org.gcube.data.analysis.tabulardata.operation.worker.OperationInvocation;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.TabularDataService;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.TabularDataServiceMock;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.operation.OperationInterface;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.operation.Task;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResource;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceId;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.tabular.TabularResourceInterface;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.AgencyMetadata;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.CreationDateMetadata;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.DescriptionMetadata;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.NameMetadata;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.tabular.metadata.TabularResourceMetadata;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.client.rpc.SDMXExportWizardService;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Codelist;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Dataset;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.ExportMonitor;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportWizardException;
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
|
|
||||||
|
//import org.gcube.portlets.user.sdmximportwizardtd.server.cl.ReadOnlyGroupMock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXExportWizardServiceImpl extends RemoteServiceServlet implements
|
||||||
|
SDMXExportWizardService {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5707400086333186368L;
|
||||||
|
|
||||||
|
protected static Logger logger = LoggerFactory.getLogger(SDMXExportWizardServiceImpl.class);
|
||||||
|
|
||||||
|
protected TabularDataService service;
|
||||||
|
protected org.gcube.data.analysis.tabulardata.model.table.TableId serviceTableId;
|
||||||
|
protected org.gcube.data.analysis.tabulardata.model.table.Table serviceTable;
|
||||||
|
|
||||||
|
public void setSDMXSession(SDMXExportSession s)
|
||||||
|
throws SDMXExportWizardException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
SessionUtil.setSDMXExportSession(session, s);
|
||||||
|
return;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new SDMXExportWizardException(
|
||||||
|
"Error setting SDMXSession parameter: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* jar {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Codelist> getCodelists() throws SDMXExportWizardException {
|
||||||
|
try {
|
||||||
|
logger.info("getCodelists()");
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
return SessionUtil.retrieveCodelists(session);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new SDMXExportWizardException("Error retrieving codelists: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Dataset> getDatasets() throws SDMXExportWizardException {
|
||||||
|
try {
|
||||||
|
logger.info("getDatasets()");
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
return SessionUtil.retrieveDatasets(session);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new SDMXExportWizardException("Error retrieving datasets: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Agencies> getAgencies() throws SDMXExportWizardException {
|
||||||
|
try {
|
||||||
|
logger.info("getAgencies()");
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
return SessionUtil.retrieveAgencies(session);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new SDMXExportWizardException("Error retrieving agencies: "
|
||||||
|
+ e.getMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected EligibleOperation getEligibleOperationWithId(String id,
|
||||||
|
List<EligibleOperation> capabilities) {
|
||||||
|
for (EligibleOperation eligibleOperation : capabilities) {
|
||||||
|
if (eligibleOperation.getOperationDescriptor().getOperationId()
|
||||||
|
.getValue() == Long.parseLong(id)) {
|
||||||
|
return eligibleOperation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Map<String, Object> setAgenciesParameters(
|
||||||
|
SDMXExportSession sdmxExportSession) {
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
Agencies agency = sdmxExportSession.getAgency();
|
||||||
|
|
||||||
|
map.put("id", agency.getId());
|
||||||
|
map.put("name", agency.getName());
|
||||||
|
map.put("description",agency.getDescription());
|
||||||
|
|
||||||
|
return map;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setTabularResourceParameters(TabularResource tr,
|
||||||
|
SDMXExportSession sdmxImportSession) {
|
||||||
|
TabularResourceMetadata name = new NameMetadata(sdmxImportSession
|
||||||
|
.getTableDetail().getName());
|
||||||
|
TabularResourceMetadata createdAt = new CreationDateMetadata(new Date());
|
||||||
|
TabularResourceMetadata agencyMeta = new AgencyMetadata(
|
||||||
|
sdmxImportSession.getTableDetail().getAgency());
|
||||||
|
TabularResourceMetadata description = new DescriptionMetadata(
|
||||||
|
sdmxImportSession.getTableDetail().getAgency());
|
||||||
|
TabularResourceMetadata right = new DescriptionMetadata(
|
||||||
|
sdmxImportSession.getTableDetail().getRight());
|
||||||
|
|
||||||
|
List<TabularResourceMetadata> metas = new ArrayList<TabularResourceMetadata>();
|
||||||
|
metas.add(name);
|
||||||
|
metas.add(createdAt);
|
||||||
|
metas.add(agencyMeta);
|
||||||
|
metas.add(description);
|
||||||
|
metas.add(right);
|
||||||
|
tr.setAllMetadata(metas);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void exportSDMXClientLibraryRequest(
|
||||||
|
SDMXExportSession sdmxImportSession)
|
||||||
|
throws SDMXExportWizardException {
|
||||||
|
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
SessionUtil.setSDMXExportSession(session, sdmxImportSession);
|
||||||
|
|
||||||
|
service = new TabularDataServiceMock();
|
||||||
|
OperationInterface oService = service;
|
||||||
|
TabularResourceInterface trService = service;
|
||||||
|
|
||||||
|
List<EligibleOperation> capabilities = service.getCapabilities();
|
||||||
|
|
||||||
|
// Import SDMX Codelist takes id 200
|
||||||
|
EligibleOperation exportSDMXCodelistOperation = getEligibleOperationWithId(
|
||||||
|
"200", capabilities);
|
||||||
|
|
||||||
|
Map<String, Object> parameterInstances = setAgenciesParameters(sdmxImportSession);
|
||||||
|
|
||||||
|
OperationInvocation invocation = exportSDMXCodelistOperation
|
||||||
|
.createOperationInvocation(parameterInstances);
|
||||||
|
|
||||||
|
TabularResourceId newTR = trService.createTabularResource();
|
||||||
|
|
||||||
|
/*setTabularResourceParameters(newTR, sdmxImportSession);
|
||||||
|
|
||||||
|
Task trTask = oService.execute(invocation, newTR.getId());
|
||||||
|
*/
|
||||||
|
TRId trId=new TRId();
|
||||||
|
//trId.setId(String.valueOf(newTR.getId().getValue()));
|
||||||
|
|
||||||
|
SessionUtil.setTRId(session, trId);
|
||||||
|
//SessionUtil.setTRTask(session, trTask);
|
||||||
|
return;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new SDMXExportWizardException(
|
||||||
|
"Error in Client Library Request: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExportMonitor getExportMonitor() throws SDMXExportWizardException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
Task task = SessionUtil.getTRTask(session);
|
||||||
|
TRId trId = SessionUtil.getTRId(session);
|
||||||
|
ExportMonitor exportMonitor = new ExportMonitor();
|
||||||
|
if (trId == null) {
|
||||||
|
throw new SDMXExportWizardException(
|
||||||
|
"Error in exportSDMX TabularResource Id null ");
|
||||||
|
} else {
|
||||||
|
if (task == null) {
|
||||||
|
throw new SDMXExportWizardException(
|
||||||
|
"Error in exportSDMX Task null ");
|
||||||
|
} else {
|
||||||
|
ActivityStatus status = task.getStatus();
|
||||||
|
if (status == null) {
|
||||||
|
throw new SDMXExportWizardException(
|
||||||
|
"Error in exportSDMX Status null");
|
||||||
|
} else {
|
||||||
|
exportMonitor.setStatus(task.getStatus().ordinal());
|
||||||
|
exportMonitor.setProgress(task.getProgress());
|
||||||
|
JobResult result = task.getResult();
|
||||||
|
if (result == null) {
|
||||||
|
logger.info("Task Result: "+task.getResult());
|
||||||
|
} else {
|
||||||
|
exportMonitor.setError(task.getResult()
|
||||||
|
.getException());
|
||||||
|
if (task.getResult().getOutput() == null){
|
||||||
|
logger.info("Task Result Output: "+task.getResult()
|
||||||
|
.getOutput());
|
||||||
|
} else {
|
||||||
|
if(task.getResult().getOutput().getId() == null) {
|
||||||
|
logger.info("Task Result Output Id: "+task.getResult()
|
||||||
|
.getOutput().getId());
|
||||||
|
} else {
|
||||||
|
logger.info("Task TableId: "+task.getResult()
|
||||||
|
.getOutput().getId().getValue());
|
||||||
|
trId.setTableId(String.valueOf(task.getResult()
|
||||||
|
.getOutput().getId().getValue()));
|
||||||
|
SessionUtil.setTRId(session, trId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
SessionUtil.setTRTask(session, task);
|
||||||
|
}
|
||||||
|
|
||||||
|
exportMonitor.setTrId(trId);
|
||||||
|
}
|
||||||
|
logger.info("getImportMonitor(): "+exportMonitor);
|
||||||
|
return exportMonitor;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new SDMXExportWizardException(
|
||||||
|
"Error in exportSDMX ExportMonitor: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,166 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.server;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.application.framework.core.session.SessionManager;
|
||||||
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
|
import org.gcube.data.analysis.tabulardata.service.operation.Task;
|
||||||
|
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Agencies;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Codelist;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Constants;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.Dataset;
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.SDMXExportSession;
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SessionUtil {
|
||||||
|
|
||||||
|
protected static final String SDMX_CLIENT_ATTRIBUTE = "SDMX_CLIENT";
|
||||||
|
protected static final String SDMX_EXPORT_SESSION = "SDMX_EXPORT";
|
||||||
|
protected static final String SDMX_TR_TASK = "SDMX_TR_TASK";
|
||||||
|
protected static final String SDMX_TR_ID = "SDMX_TR_ID";
|
||||||
|
|
||||||
|
|
||||||
|
protected static Logger logger = LoggerFactory.getLogger(SessionUtil.class);
|
||||||
|
|
||||||
|
public static void setSDMXExportSession(HttpSession httpSession, SDMXExportSession s){
|
||||||
|
|
||||||
|
SDMXExportSession session=(SDMXExportSession)httpSession.getAttribute(SDMX_EXPORT_SESSION);
|
||||||
|
if(session!=null) httpSession.removeAttribute(SDMX_EXPORT_SESSION);
|
||||||
|
httpSession.setAttribute(SDMX_EXPORT_SESSION, s);
|
||||||
|
ASLSession aslSession = getAslSession(httpSession);
|
||||||
|
ScopeProvider.instance.set(aslSession.getScope().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SDMXExportSession getSDMXExportSession(HttpSession httpSession){
|
||||||
|
SDMXExportSession sdmxExportSession = (SDMXExportSession) httpSession.getAttribute(SDMX_EXPORT_SESSION);
|
||||||
|
if(sdmxExportSession==null){
|
||||||
|
logger.error("SDMXImportSession was not acquired");
|
||||||
|
}
|
||||||
|
return sdmxExportSession;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<Codelist> retrieveCodelists(HttpSession httpSession)
|
||||||
|
throws Exception {
|
||||||
|
logger.info("SessionUtil retriveCodelists");
|
||||||
|
SDMXClient client = getSdmxClient(httpSession);
|
||||||
|
ASLSession aslSession = getAslSession(httpSession);
|
||||||
|
ScopeProvider.instance.set(aslSession.getScope().toString());
|
||||||
|
return client.getAllCodelists();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Dataset> retrieveDatasets(HttpSession httpSession)
|
||||||
|
throws Exception {
|
||||||
|
logger.info("SessionUtil retriveDatasets");
|
||||||
|
SDMXClient client = getSdmxClient(httpSession);
|
||||||
|
ASLSession aslSession = getAslSession(httpSession);
|
||||||
|
ScopeProvider.instance.set(aslSession.getScope().toString());
|
||||||
|
return client.getAllDatasets();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Agencies> retrieveAgencies(HttpSession httpSession)
|
||||||
|
throws Exception {
|
||||||
|
logger.info("SessionUtil retriveAgencies");
|
||||||
|
SDMXClient client = getSdmxClient(httpSession);
|
||||||
|
if(client==null){
|
||||||
|
logger.error("SessionUtil retriveAgencies client null");
|
||||||
|
throw new Exception("SessionUtil retriveAgencies client null");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
ASLSession aslSession = getAslSession(httpSession);
|
||||||
|
ScopeProvider.instance.set(aslSession.getScope().toString());
|
||||||
|
return client.getAllAgencies();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SDMXClient getSdmxClient(HttpSession httpSession){
|
||||||
|
SDMXClient sdmxClient = (SDMXClient) httpSession.getAttribute(SDMX_CLIENT_ATTRIBUTE);
|
||||||
|
SDMXExportSession sdmxExportSession=(SDMXExportSession) httpSession.getAttribute(SDMX_EXPORT_SESSION);
|
||||||
|
if(sdmxExportSession==null){
|
||||||
|
logger.error("SDMXExportSession was not acquired");
|
||||||
|
} else {
|
||||||
|
if (sdmxClient == null) {
|
||||||
|
sdmxClient = new SDMXClient();
|
||||||
|
} else {
|
||||||
|
if(sdmxClient.type.compareTo(SDMXClient.TYPE.ANOTHER)==0){
|
||||||
|
sdmxClient = new SDMXClient();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sdmxClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static ASLSession getAslSession(HttpSession httpSession) {
|
||||||
|
String username = (String) httpSession
|
||||||
|
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
||||||
|
|
||||||
|
if (username == null) {
|
||||||
|
logger.warn("no user found in session, using test one");
|
||||||
|
username = Constants.DEFAULT_USER;
|
||||||
|
String scope = Constants.DEFAULT_SCOPE;
|
||||||
|
|
||||||
|
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE, username);
|
||||||
|
ASLSession session = SessionManager.getInstance().getASLSession(
|
||||||
|
httpSession.getId(), username);
|
||||||
|
session.setScope(scope);
|
||||||
|
|
||||||
|
return session;
|
||||||
|
} else {
|
||||||
|
return SessionManager.getInstance().getASLSession(
|
||||||
|
httpSession.getId(), username);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Task getTRTask(HttpSession httpSession){
|
||||||
|
Task task = (Task) httpSession.getAttribute(SDMX_TR_TASK);
|
||||||
|
if(task==null){
|
||||||
|
logger.error("SDMX_TR_TASK was not acquired");
|
||||||
|
}
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTRTask(HttpSession httpSession, Task task){
|
||||||
|
Task t = (Task) httpSession.getAttribute(SDMX_TR_TASK);
|
||||||
|
if(t!=null) httpSession.removeAttribute(SDMX_TR_TASK);
|
||||||
|
httpSession.setAttribute(SDMX_TR_TASK, task);
|
||||||
|
ASLSession aslSession = getAslSession(httpSession);
|
||||||
|
ScopeProvider.instance.set(aslSession.getScope().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TRId getTRId(HttpSession httpSession){
|
||||||
|
TRId id = (TRId) httpSession.getAttribute(SDMX_TR_ID);
|
||||||
|
if(id==null){
|
||||||
|
logger.error("SDMX_TR_ID was not acquired");
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTRId(HttpSession httpSession, TRId trId){
|
||||||
|
TRId id = (TRId) httpSession.getAttribute(SDMX_TR_ID);
|
||||||
|
if(id!=null) httpSession.removeAttribute(SDMX_TR_ID);
|
||||||
|
httpSession.setAttribute(SDMX_TR_ID, trId);
|
||||||
|
ASLSession aslSession = getAslSession(httpSession);
|
||||||
|
ScopeProvider.instance.set(aslSession.getScope().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Agencies implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8353499109124097114L;
|
||||||
|
|
||||||
|
protected String id;
|
||||||
|
protected String name;
|
||||||
|
protected String description;
|
||||||
|
protected String nameLabel;
|
||||||
|
//protected boolean newAgency;
|
||||||
|
|
||||||
|
|
||||||
|
public Agencies(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @param agencyId
|
||||||
|
*/
|
||||||
|
public Agencies(String id, String name, String description) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.nameLabel=id;
|
||||||
|
//this.newAgency=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @param description
|
||||||
|
* @param newAgency
|
||||||
|
*/
|
||||||
|
public Agencies(String id, String name, String description, boolean newAgency) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.description = description;
|
||||||
|
this.nameLabel=id;
|
||||||
|
//this.newAgency=newAgency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNameLabel() {
|
||||||
|
return nameLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameLabel(String nameLabel) {
|
||||||
|
this.nameLabel = nameLabel;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
public boolean isNewAgency() {
|
||||||
|
return newAgency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewAgency(boolean newAgency) {
|
||||||
|
this.newAgency = newAgency;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Agencies [id=" + id + ", name=" + name + ", description="
|
||||||
|
+ description + ", nameLabel=" + nameLabel + ", newAgency="
|
||||||
|
/*+ newAgency */+ "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Codelist implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8353499109124097114L;
|
||||||
|
|
||||||
|
protected String id;
|
||||||
|
protected String name;
|
||||||
|
protected String agencyId;
|
||||||
|
protected String version;
|
||||||
|
protected String description;
|
||||||
|
|
||||||
|
|
||||||
|
public Codelist(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @param agencyId
|
||||||
|
*/
|
||||||
|
public Codelist(String id, String name, String agencyId,String version, String description) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.agencyId = agencyId;
|
||||||
|
this.version = version;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the agencyId
|
||||||
|
*/
|
||||||
|
public String getAgencyId() {
|
||||||
|
return agencyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the version
|
||||||
|
*/
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the version
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Codelist [id=");
|
||||||
|
builder.append(id);
|
||||||
|
builder.append(", name=");
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(", agencyId=");
|
||||||
|
builder.append(agencyId);
|
||||||
|
builder.append(", version=");
|
||||||
|
builder.append(version);
|
||||||
|
builder.append(", description=");
|
||||||
|
builder.append(description);
|
||||||
|
builder.append("]");
|
||||||
|
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public class Constants {
|
||||||
|
|
||||||
|
public final static String VERSION = "1.0.0";
|
||||||
|
public final static String DEFAULT_USER = "giancarlo.panichi";
|
||||||
|
public final static String DEFAULT_SCOPE = "/gcube/devsec";
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class Dataset implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -8353499109124097114L;
|
||||||
|
|
||||||
|
protected String id;
|
||||||
|
protected String name;
|
||||||
|
protected String agencyId;
|
||||||
|
protected String version;
|
||||||
|
protected String description;
|
||||||
|
|
||||||
|
|
||||||
|
public Dataset(){}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @param agencyId
|
||||||
|
*/
|
||||||
|
public Dataset(String id, String name, String agencyId, String version, String description) {
|
||||||
|
this.id = id;
|
||||||
|
this.name = name;
|
||||||
|
this.agencyId = agencyId;
|
||||||
|
this.version = version;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the id
|
||||||
|
*/
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the name
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the agencyId
|
||||||
|
*/
|
||||||
|
public String getAgencyId() {
|
||||||
|
return agencyId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the version
|
||||||
|
*/
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the version
|
||||||
|
*/
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("Codelist [id=");
|
||||||
|
builder.append(id);
|
||||||
|
builder.append(", name=");
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(", agencyId=");
|
||||||
|
builder.append(agencyId);
|
||||||
|
builder.append(", version=");
|
||||||
|
builder.append(version);
|
||||||
|
builder.append(", description=");
|
||||||
|
builder.append(description);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gxtservice.shared.TRId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class ExportMonitor implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5998841163159590481L;
|
||||||
|
|
||||||
|
|
||||||
|
protected float progress;
|
||||||
|
protected Status status;
|
||||||
|
protected String statusDescription;
|
||||||
|
protected Throwable error;
|
||||||
|
protected TRId trId;
|
||||||
|
|
||||||
|
public float getProgress(){
|
||||||
|
return progress;
|
||||||
|
};
|
||||||
|
|
||||||
|
public Status getStatus(){
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatusDescription(){
|
||||||
|
return statusDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgress(float progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Status status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(int status) {
|
||||||
|
this.status = Status.values()[status];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatusDescription(String statusDescription) {
|
||||||
|
this.statusDescription = statusDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Throwable getError() {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setError(Throwable error) {
|
||||||
|
this.error = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TRId getTrId() {
|
||||||
|
return trId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrId(TRId trId) {
|
||||||
|
this.trId = trId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ImportMonitor [progress=" + progress + ", status=" + status
|
||||||
|
+ ", statusDescription=" + statusDescription + ", error="
|
||||||
|
+ error + ", trId=" + trId + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* FieldVerifier validates that the name the user enters is valid.
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* This class is in the <code>shared</code> packing because we use it in both
|
||||||
|
* the client code and on the server. On the client, we verify that the name is
|
||||||
|
* valid before sending an RPC request so the user doesn't have to wait for a
|
||||||
|
* network round trip to get feedback. On the server, we verify that the name is
|
||||||
|
* correct to ensure that the input is correct regardless of where the RPC
|
||||||
|
* originates.
|
||||||
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* When creating a class that is used on both the client and the server, be sure
|
||||||
|
* that all code is translatable and does not use native JavaScript. Code that
|
||||||
|
* is note translatable (such as code that interacts with a database or the file
|
||||||
|
* system) cannot be compiled into client side JavaScript. Code that uses native
|
||||||
|
* JavaScript (such as Widgets) cannot be run on the server.
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public class FieldVerifier {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that the specified name is valid for our service.
|
||||||
|
*
|
||||||
|
* In this example, we only require that the name is at least four
|
||||||
|
* characters. In your application, you can use more complex checks to ensure
|
||||||
|
* that usernames, passwords, email addresses, URLs, and other fields have the
|
||||||
|
* proper syntax.
|
||||||
|
*
|
||||||
|
* @param name the name to validate
|
||||||
|
* @return true if valid, false if invalid
|
||||||
|
*/
|
||||||
|
public static boolean isValidName(String name) {
|
||||||
|
if (name == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return name.length() > 3;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXExportSession implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4176034045408445284L;
|
||||||
|
|
||||||
|
protected String id;
|
||||||
|
|
||||||
|
protected Codelist selectedCodelist;
|
||||||
|
protected TableDetail tableDetail;
|
||||||
|
protected Agencies agency;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public Codelist getSelectedCodelist() {
|
||||||
|
return selectedCodelist;
|
||||||
|
}
|
||||||
|
public void setSelectedCodelist(Codelist selectedCodelist) {
|
||||||
|
this.selectedCodelist = selectedCodelist;
|
||||||
|
}
|
||||||
|
public TableDetail getTableDetail() {
|
||||||
|
return tableDetail;
|
||||||
|
}
|
||||||
|
public void setTableDetail(TableDetail tableDetail) {
|
||||||
|
this.tableDetail = tableDetail;
|
||||||
|
}
|
||||||
|
public Agencies getAgency() {
|
||||||
|
return agency;
|
||||||
|
}
|
||||||
|
public void setAgency(Agencies agency) {
|
||||||
|
this.agency = agency;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "SDMXExportSession [id=" + id + ", selectedCodelist="
|
||||||
|
+ selectedCodelist + ", tableDetail=" + tableDetail
|
||||||
|
+ ", agency=" + agency + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author "Federico De Faveri defaveri@isti.cnr.it"
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class SDMXExportWizardException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -9066034060104406559L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public SDMXExportWizardException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
public SDMXExportWizardException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
public enum Status implements Serializable{
|
||||||
|
|
||||||
|
WAITING,
|
||||||
|
INITIALIZING,
|
||||||
|
IN_PROGRESS,
|
||||||
|
SUCCEDED,
|
||||||
|
FAILED,
|
||||||
|
ABORTED;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.shared;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi"
|
||||||
|
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class TableDetail implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7515852391099302206L;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String right;
|
||||||
|
private String agency;
|
||||||
|
|
||||||
|
public TableDetail(){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRight() {
|
||||||
|
return right;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRight(String right) {
|
||||||
|
this.right = right;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAgency() {
|
||||||
|
return agency;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAgency(String agency) {
|
||||||
|
this.agency = agency;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public String toString(){
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append("TableDetail [name=");
|
||||||
|
builder.append(name);
|
||||||
|
builder.append(", description=");
|
||||||
|
builder.append(description);
|
||||||
|
builder.append(", right=");
|
||||||
|
builder.append(right);
|
||||||
|
builder.append(", agency=");
|
||||||
|
builder.append(agency);
|
||||||
|
builder.append("]");
|
||||||
|
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module rename-to='SDMXExportWizardTD'>
|
||||||
|
<!-- Inherit the core Web Toolkit stuff. -->
|
||||||
|
<inherits name='com.google.gwt.user.User' />
|
||||||
|
|
||||||
|
<!-- We need the JUnit module in the main module, -->
|
||||||
|
<!-- otherwise eclipse complains (Google plugin bug?) -->
|
||||||
|
<inherits name='com.google.gwt.junit.JUnit' />
|
||||||
|
|
||||||
|
<!-- Inherit the default GWT style sheet. You can change -->
|
||||||
|
<!-- the theme of your GWT application by uncommenting -->
|
||||||
|
<!-- any one of the following lines. -->
|
||||||
|
<inherits name='com.google.gwt.user.theme.standard.Standard' />
|
||||||
|
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
|
||||||
|
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
|
||||||
|
|
||||||
|
<!-- Other module inherits -->
|
||||||
|
<inherits name='com.sencha.gxt.ui.GXT' />
|
||||||
|
<inherits name="com.allen_sauer.gwt.log.gwt-log-TRACE" />
|
||||||
|
<inherits name='org.gcube.portlets.user.td.gxtservice.GXTService' />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Specify the app entry point class. -->
|
||||||
|
|
||||||
|
<!-- Specify the paths for translatable code -->
|
||||||
|
<source path='client' />
|
||||||
|
<source path='shared' />
|
||||||
|
|
||||||
|
</module>
|
|
@ -0,0 +1,2 @@
|
||||||
|
sendButton = Send
|
||||||
|
nameField = Enter your name
|
|
@ -0,0 +1,2 @@
|
||||||
|
sendButton = Envoyer
|
||||||
|
nameField = Entrez votre nom
|
|
@ -0,0 +1,34 @@
|
||||||
|
/** Add css rules here for your application. */
|
||||||
|
|
||||||
|
|
||||||
|
/** Example rules used by the template application (remove for your app) */
|
||||||
|
h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #777777;
|
||||||
|
margin: 40px 0px 70px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sendButton {
|
||||||
|
display: block;
|
||||||
|
font-size: 16pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Most GWT widgets already have a style name defined */
|
||||||
|
.gwt-DialogBox {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialogVPanel {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.serverResponseLabelError {
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Set ids using widget.getElement().setId("idOfElement") */
|
||||||
|
#closeButton {
|
||||||
|
margin: 15px 6px 6px;
|
||||||
|
}
|
|
@ -0,0 +1,63 @@
|
||||||
|
<!doctype html>
|
||||||
|
<!-- The DOCTYPE declaration above will set the -->
|
||||||
|
<!-- browser's rendering engine into -->
|
||||||
|
<!-- "Standards Mode". Replacing this declaration -->
|
||||||
|
<!-- with a "Quirks Mode" doctype may lead to some -->
|
||||||
|
<!-- differences in layout. -->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Consider inlining CSS to reduce the number of requested files -->
|
||||||
|
<!-- -->
|
||||||
|
<link type="text/css" rel="stylesheet" href="SDMXImportWizardTD.css">
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- Any title is fine -->
|
||||||
|
<!-- -->
|
||||||
|
<title>Web Application Starter Project</title>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- This script loads your compiled module. -->
|
||||||
|
<!-- If you add any GWT meta tags, they must -->
|
||||||
|
<!-- be added before this line. -->
|
||||||
|
<!-- -->
|
||||||
|
<script type="text/javascript" language="javascript" src="SDMXImportWizardTD/SDMXImportWizardTD.nocache.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<!-- -->
|
||||||
|
<!-- The body can have arbitrary html, or -->
|
||||||
|
<!-- you can leave the body empty if you want -->
|
||||||
|
<!-- to create a completely dynamic UI. -->
|
||||||
|
<!-- -->
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<!-- OPTIONAL: include this if you want history support -->
|
||||||
|
<iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe>
|
||||||
|
|
||||||
|
<!-- RECOMMENDED if your web app will not function without JavaScript enabled -->
|
||||||
|
<noscript>
|
||||||
|
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
|
||||||
|
Your web browser must have JavaScript enabled
|
||||||
|
in order for this application to display correctly.
|
||||||
|
</div>
|
||||||
|
</noscript>
|
||||||
|
|
||||||
|
<h1>Web Application Starter Project</h1>
|
||||||
|
|
||||||
|
<table align="center">
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="font-weight:bold;">Please enter your name:</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td id="nameFieldContainer"></td>
|
||||||
|
<td id="sendButtonContainer"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="color:red;" id="errorLabelContainer"></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE web-app
|
||||||
|
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||||
|
"http://java.sun.com/dtd/web-app_2_3.dtd">
|
||||||
|
|
||||||
|
<web-app>
|
||||||
|
|
||||||
|
<!-- Servlets -->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>SDMXExportWizardService</servlet-name>
|
||||||
|
<servlet-class>org.gcube.portlets.user.sdmximportwizardtd.server.SDMXImportWizardServiceImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>jUnitHostImpl</servlet-name>
|
||||||
|
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
|
||||||
|
<!-- Servlets Mapping -->
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>SDMXExportWizardService</servlet-name>
|
||||||
|
<url-pattern>sdmximportwizard/SDMXExportWizardService</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>jUnitHostImpl</servlet-name>
|
||||||
|
<url-pattern>SDMXAgenciesManagerWidgets/junithost/*</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<!-- Default page to serve -->
|
||||||
|
<welcome-file-list>
|
||||||
|
<welcome-file>SDMXImportWizardTD.html</welcome-file>
|
||||||
|
</welcome-file-list>
|
||||||
|
|
||||||
|
</web-app>
|
|
@ -0,0 +1,78 @@
|
||||||
|
package org.gcube.portlets.user.sdmxexportwizardtd.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.sdmxexportwizardtd.shared.FieldVerifier;
|
||||||
|
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.junit.client.GWTTestCase;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.gwt.user.client.rpc.ServiceDefTarget;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GWT JUnit <b>integration</b> tests must extend GWTTestCase.
|
||||||
|
* Using <code>"GwtTest*"</code> naming pattern exclude them from running with
|
||||||
|
* surefire during the test phase.
|
||||||
|
*
|
||||||
|
* If you run the tests using the Maven command line, you will have to
|
||||||
|
* navigate with your browser to a specific url given by Maven.
|
||||||
|
* See http://mojo.codehaus.org/gwt-maven-plugin/user-guide/testing.html
|
||||||
|
* for details.
|
||||||
|
*/
|
||||||
|
public class GwtTestSDMXExportWizardTD extends GWTTestCase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Must refer to a valid module that sources this class.
|
||||||
|
*/
|
||||||
|
public String getModuleName() {
|
||||||
|
return "org.gcube.portlets.user.SDMXImportWizardTD.SDMXImportWizardTDJUnit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the FieldVerifier.
|
||||||
|
*/
|
||||||
|
public void testFieldVerifier() {
|
||||||
|
assertFalse(FieldVerifier.isValidName(null));
|
||||||
|
assertFalse(FieldVerifier.isValidName(""));
|
||||||
|
assertFalse(FieldVerifier.isValidName("a"));
|
||||||
|
assertFalse(FieldVerifier.isValidName("ab"));
|
||||||
|
assertFalse(FieldVerifier.isValidName("abc"));
|
||||||
|
assertTrue(FieldVerifier.isValidName("abcd"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test will send a request to the server using the greetServer method in
|
||||||
|
* GreetingService and verify the response.
|
||||||
|
*/
|
||||||
|
public void testGreetingService() {
|
||||||
|
// Create the service that we will test.
|
||||||
|
//GreetingServiceAsync greetingService = GWT.create(GreetingService.class);
|
||||||
|
//ServiceDefTarget target = (ServiceDefTarget) greetingService;
|
||||||
|
//target.setServiceEntryPoint(GWT.getModuleBaseURL() + "SDMXImportWizardTD/greet");
|
||||||
|
|
||||||
|
// Since RPC calls are asynchronous, we will need to wait for a response
|
||||||
|
// after this test method returns. This line tells the test runner to wait
|
||||||
|
// up to 10 seconds before timing out.
|
||||||
|
//delayTestFinish(10000);
|
||||||
|
|
||||||
|
// Send a request to the server.
|
||||||
|
/* greetingService.greetServer("GWT User", new AsyncCallback<String>() {
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
// The request resulted in an unexpected error.
|
||||||
|
fail("Request failure: " + caught.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onSuccess(String result) {
|
||||||
|
// Verify that the response is correct.
|
||||||
|
assertTrue(result.startsWith("Hello, GWT User!"));
|
||||||
|
|
||||||
|
// Now that we have received a response, we need to tell the test runner
|
||||||
|
// that the test is complete. You must call finishTest() after an
|
||||||
|
// asynchronous test finishes successfully, or the test will time out.
|
||||||
|
finishTest();
|
||||||
|
}
|
||||||
|
});*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module>
|
||||||
|
<!-- Inherit our applications main module. -->
|
||||||
|
<inherits name='org.gcube.portlets.user.SDMXImportWizardTD.SDMXImportWizardTD' />
|
||||||
|
|
||||||
|
<!-- Specify the path to any remote services. -->
|
||||||
|
<servlet path="/SDMXImportWizardTD/greet" class="org.gcube.portlets.user.SDMXImportWizardTD.server.GreetingServiceImpl" />
|
||||||
|
|
||||||
|
</module>
|
Loading…
Reference in New Issue