Initial import.
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-codelistmapping-import-widget@96428 82a268e6-3cf1-43bd-a215-b396298e98cfmaster
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/tabular-data-codelistmapping-import-widget-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 excluding="**" kind="src" output="target/tabular-data-codelistmapping-import-widget-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<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 excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/tabular-data-codelistmapping-import-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>tabular-data-codelistmapping-import-widget</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<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.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -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,8 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
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.7
|
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="tabular-data-codelistmapping-import-widget">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||
<wb-resource deploy-path="/" source-path="/src/main/resources"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
</faceted-project>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="CodelistMappingImportWizardTD.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/tabular-data-codelistmapping-import-widget"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gdt.eclipse.maven.mavenClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value=""/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="tabular-data-codelistmapping-import-widget"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m -Dgwt.nowarn.legacy.tools"/>
|
||||
</launchConfiguration>
|
@ -0,0 +1,317 @@
|
||||
<?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-codelistmapping-import-widget</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
|
||||
<name>tabular-data-codelistmapping-import-widget</name>
|
||||
<description>tabular-data-codelistmapping-import-widget allows import from url, file and workspace of maps for codelist</description>
|
||||
|
||||
<scm>
|
||||
<url>https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-codelistmapping-import-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>2014-06-05</release.date>
|
||||
<templatesDirectory>templates</templatesDirectory>
|
||||
<distroDirectory>distro</distroDirectory>
|
||||
<configDirectory>config</configDirectory>
|
||||
|
||||
<!-- Convenience property to set the GWT version -->
|
||||
<gwtVersion>2.5.1</gwtVersion>
|
||||
|
||||
<KEYS>${env.KEYS}</KEYS>
|
||||
<!-- 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.8.1</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>
|
||||
|
||||
|
||||
|
||||
<!-- tabular-data-gwt-service -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-gwt-service</artifactId>
|
||||
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- tabular-data-widget-common-event -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-widget-common-event</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- tabular-data-wizard-widget -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-wizard-widget</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- WSLT dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<artifactId>workspace-light-tree</artifactId>
|
||||
<version>[2.13.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>home-library</artifactId>
|
||||
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>gcube-widgets</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- LOGGING -->
|
||||
<dependency>
|
||||
<groupId>com.allen-sauer.gwt.log</groupId>
|
||||
<artifactId>gwt-log</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<scope>provided</scope>
|
||||
</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>CodelistMappingImportWizardTD.html</runTarget>
|
||||
<hostedWebapp>${webappDirectory}</hostedWebapp>
|
||||
<module>org.gcube.portlets.user.td.codelistmappingimportwidget.CodelistMappingImportWizardTD</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,199 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
||||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.FileUploadProgressBarUpdater;
|
||||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.FileUploadProgressListener;
|
||||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.FileUploadProgressUpdater;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ChangeEvent;
|
||||
import com.google.gwt.event.dom.client.ChangeHandler;
|
||||
import com.sencha.gxt.core.client.Style.HideMode;
|
||||
import com.sencha.gxt.core.client.util.Padding;
|
||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
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.event.ShowEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.ShowEvent.ShowHandler;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
import com.sencha.gxt.widget.core.client.form.FileUploadField;
|
||||
import com.sencha.gxt.widget.core.client.form.FormPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingFileUploadPanel extends FormPanel {
|
||||
|
||||
protected static final String UPLOAD_SERVLET = "LocalUploadServlet";
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
|
||||
protected ResourceBundle res;
|
||||
protected FileUploadField fileUploadField;
|
||||
protected TextButton uploadButton;
|
||||
|
||||
protected FileUploadProgressUpdater progressUpdater;
|
||||
|
||||
protected ProgressBar uploadProgressBar;
|
||||
|
||||
protected TextButton cancelButton;
|
||||
|
||||
public CodelistMappingFileUploadPanel(ResourceBundle res, final CodelistMappingUploadFileCard card,
|
||||
final CSVImportSession importSession) {
|
||||
this.res = res;
|
||||
|
||||
setId("LocalUploadPanel");
|
||||
setLabelAlign(LabelAlign.TOP);
|
||||
getElement().setPadding(new Padding(5));
|
||||
|
||||
addShowHandler(new ShowHandler() {
|
||||
|
||||
|
||||
public void onShow(ShowEvent event) {
|
||||
doLayout();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
setAction(GWT.getModuleBaseURL() + UPLOAD_SERVLET);
|
||||
setWidth("100%");
|
||||
|
||||
setEncoding(Encoding.MULTIPART);
|
||||
setMethod(Method.POST);
|
||||
|
||||
VerticalLayoutContainer content = new VerticalLayoutContainer();
|
||||
content.setWidth("100%");
|
||||
add(content);
|
||||
|
||||
fileUploadField = new FileUploadField();
|
||||
fileUploadField.setName("uploadFormElement");
|
||||
fileUploadField.setWidth("100%");
|
||||
|
||||
content.add(new FieldLabel(fileUploadField,
|
||||
"Select the csv file to import"),
|
||||
new VerticalLayoutData(-2, -1));
|
||||
|
||||
uploadButton = new TextButton("Upload");
|
||||
content.add(uploadButton, new VerticalLayoutData(-1, -1));
|
||||
|
||||
fileUploadField.addChangeHandler(new ChangeHandler() {
|
||||
|
||||
public void onChange(ChangeEvent event) {
|
||||
uploadButton.setEnabled(fileUploadField.isValid());
|
||||
String path = fileUploadField.getValue();
|
||||
int punto = path.lastIndexOf(".");
|
||||
if(punto<0){
|
||||
punto=path.length();
|
||||
}
|
||||
int slash = path.lastIndexOf("/");
|
||||
int backslash = path.lastIndexOf("\\");
|
||||
String filename="";
|
||||
if (slash > backslash) {
|
||||
if (slash != -1) {
|
||||
filename = path.substring(slash + 1, punto);
|
||||
}
|
||||
} else {
|
||||
if (backslash != -1) {
|
||||
filename = path.substring(backslash + 1, punto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
importSession.setLocalFileName(filename);
|
||||
}
|
||||
});
|
||||
|
||||
uploadProgressBar = new ProgressBar();
|
||||
uploadProgressBar.setHideMode(HideMode.VISIBILITY);
|
||||
uploadProgressBar.getElement().setPadding(new Padding(3, 0, 5, 0));
|
||||
content.add(uploadProgressBar, new VerticalLayoutData(-2, -1));
|
||||
uploadProgressBar.hide();
|
||||
|
||||
cancelButton = new TextButton("Cancel");
|
||||
cancelButton.hide();
|
||||
content.add(cancelButton, new VerticalLayoutData(-1, -1));
|
||||
|
||||
uploadButton.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.info("request upload");
|
||||
|
||||
if (fileUploadField.getValue() == null
|
||||
|| fileUploadField.getValue().equals("")) {
|
||||
Log.info("fileUploadField is null or empty");
|
||||
AlertMessageBox alertMessageBox = new AlertMessageBox(
|
||||
"CSV file missing", "Please specify a CSV file.");
|
||||
alertMessageBox.show();
|
||||
return;
|
||||
} else {
|
||||
Log.info("startUpload call");
|
||||
startUpload();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
progressUpdater = new FileUploadProgressUpdater();
|
||||
progressUpdater.addListener(new FileUploadProgressBarUpdater(
|
||||
uploadProgressBar));
|
||||
|
||||
progressUpdater.addListener(new FileUploadProgressListener() {
|
||||
|
||||
public void operationUpdate(float elaborated) {
|
||||
//
|
||||
}
|
||||
|
||||
public void operationInitializing() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
card.showErrorAndHide("Error uploading the csv file", reason,
|
||||
failureDetails, caught);
|
||||
}
|
||||
|
||||
public void operationComplete() {
|
||||
card.setEnableNextButton(true);
|
||||
cancelButton.disable();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void startUpload() {
|
||||
disableUpload();
|
||||
|
||||
StringBuilder actionUrl = new StringBuilder();
|
||||
actionUrl.append(GWT.getModuleBaseURL());
|
||||
actionUrl.append(UPLOAD_SERVLET);
|
||||
setAction(actionUrl.toString());
|
||||
Log.info("Start Upload action Url " + actionUrl.toString());
|
||||
submit();
|
||||
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
}
|
||||
|
||||
protected void disableUpload() {
|
||||
fileUploadField.disable();
|
||||
uploadButton.disable();
|
||||
|
||||
uploadProgressBar.show();
|
||||
cancelButton.show();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingImportWizardTD extends WizardWindow {
|
||||
|
||||
protected CSVImportSession importSession;
|
||||
//private CSVImportWizardTD wizard;
|
||||
|
||||
/**
|
||||
* The id of the {@link CSVTarget} to use.
|
||||
* @param targetId
|
||||
*/
|
||||
|
||||
public CodelistMappingImportWizardTD(String title, EventBus eventBus) {
|
||||
super(title,eventBus);
|
||||
|
||||
importSession= new CSVImportSession();
|
||||
//this.wizard=this;
|
||||
|
||||
SourceSelectionCard sourceSelection= new SourceSelectionCard(importSession);
|
||||
addCard(sourceSelection);
|
||||
sourceSelection.setup();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.web.bindery.event.shared.SimpleEventBus;
|
||||
|
||||
public class CodelistMappingImportWizardTDEntry implements EntryPoint {
|
||||
|
||||
|
||||
public void onModuleLoad() {
|
||||
SimpleEventBus eventBus=new SimpleEventBus();
|
||||
CodelistMappingImportWizardTD importWizard= new CodelistMappingImportWizardTD("CSVImport",eventBus);
|
||||
Log.info(importWizard.getId());
|
||||
}
|
||||
}
|
@ -0,0 +1,221 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.CodelistMappingImportProgressBarUpdater;
|
||||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.CodelistMappingImportProgressListener;
|
||||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress.CodelistMappingImportProgressUpdater;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
|
||||
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.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.box.AlertMessageBox;
|
||||
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.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
|
||||
//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 CodelistMappingOperationInProgressCard extends WizardCard implements
|
||||
CodelistMappingImportProgressListener {
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected CodelistMappingOperationInProgressCard thisCard;
|
||||
protected CSVImportSession importSession;
|
||||
protected CodelistMappingImportProgressUpdater progressUpdater;
|
||||
|
||||
public CodelistMappingOperationInProgressCard(final CSVImportSession 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);
|
||||
|
||||
// display:block;vertical-align:text-top;
|
||||
description.setHTML(0, 0,
|
||||
"<span style=\"font-weight:bold;\";>Document: </span>");
|
||||
description.setText(0, 1, "CSV File");
|
||||
description.setHTML(1, 0,
|
||||
"<span style=\"font-weight:bold;\";>Source: </span>");
|
||||
description.setText(1, 1, importSession.getSource().getName());
|
||||
|
||||
description.setHTML(2, 0,
|
||||
"<span style=\"font-weight:bold;\";>File: </span>");
|
||||
description.setText(2, 1, importSession.getTabResource().getName());
|
||||
|
||||
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 CodelistMappingImportProgressUpdater();
|
||||
progressUpdater
|
||||
.addListener(new CodelistMappingImportProgressBarUpdater(progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
|
||||
setContent(operationInProgressPanel);
|
||||
|
||||
}
|
||||
|
||||
// columnToImportMask
|
||||
|
||||
public void importCSV() {
|
||||
TDGWTServiceAsync.INSTANCE.startCSVImport(importSession,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
showErrorAndHide(
|
||||
"Error in importCSV",
|
||||
"An error occured in importCSV: "
|
||||
+ caught.getLocalizedMessage(),
|
||||
caught.getStackTrace().toString(), caught);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
setBackButtonVisible(false);
|
||||
setNextButtonVisible(false);
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setNextButtonToFinish();
|
||||
importCSV();
|
||||
}
|
||||
|
||||
public void operationInitializing() {
|
||||
|
||||
}
|
||||
|
||||
public void operationUpdate(float elaborated) {
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void operationFailed(Throwable caught, String reason,
|
||||
String failureDetails) {
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
AlertMessageBox d = new AlertMessageBox("Error in CSV Import",
|
||||
reason);
|
||||
d.addHideHandler(new HideHandler() {
|
||||
public void onHide(HideEvent event) {
|
||||
}
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(final TRId trId, String reason, String details) {
|
||||
// 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 operationGeneratingView() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
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.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
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.TextArea;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingTableDetailCard extends WizardCard {
|
||||
|
||||
protected final String TABLEDETAILPANELWIDTH = "100%";
|
||||
protected final String TABLEDETAILPANELHEIGHT = "100%";
|
||||
protected final String FORMWIDTH = "538px";
|
||||
|
||||
protected CSVImportSession importSession;
|
||||
protected CodelistMappingTableDetailCard thisCard;
|
||||
|
||||
protected VerticalLayoutContainer p;
|
||||
protected VerticalPanel tableDetailPanel;
|
||||
|
||||
protected TextField name;
|
||||
protected TextArea description;
|
||||
protected TextArea rights;
|
||||
|
||||
protected TabResource detail = new TabResource();
|
||||
|
||||
public CodelistMappingTableDetailCard(final CSVImportSession importSession) {
|
||||
super("Codelist Mapping Detail", "");
|
||||
|
||||
this.importSession = importSession;
|
||||
thisCard = this;
|
||||
|
||||
tableDetailPanel = new VerticalPanel();
|
||||
|
||||
tableDetailPanel.setSpacing(4);
|
||||
tableDetailPanel.setWidth(TABLEDETAILPANELWIDTH);
|
||||
tableDetailPanel.setHeight(TABLEDETAILPANELHEIGHT);
|
||||
|
||||
FramedPanel form = new FramedPanel();
|
||||
form.setHeadingText("Details");
|
||||
form.setWidth(FORMWIDTH);
|
||||
|
||||
FieldSet fieldSet = new FieldSet();
|
||||
fieldSet.setHeadingText("Information");
|
||||
fieldSet.setCollapsible(false);
|
||||
form.add(fieldSet);
|
||||
|
||||
p = new VerticalLayoutContainer();
|
||||
fieldSet.add(p);
|
||||
|
||||
name = new TextField();
|
||||
name.setAllowBlank(false);
|
||||
name.setEmptyText("Enter a name...");
|
||||
name.setValue(importSession.getLocalFileName());
|
||||
name.setAllowBlank(false);
|
||||
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
||||
|
||||
description = new TextArea();
|
||||
description.setAllowBlank(false);
|
||||
description.setEmptyText("Enter a description...");
|
||||
description.setValue("File CSV");
|
||||
description.setAllowBlank(false);
|
||||
p.add(new FieldLabel(description, "Description"),
|
||||
new VerticalLayoutData(1, -1));
|
||||
|
||||
|
||||
tableDetailPanel.add(form);
|
||||
|
||||
setContent(tableDetailPanel);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
|
||||
public void execute() {
|
||||
checkData();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
getWizardWindow().previousCard();
|
||||
getWizardWindow().removeCard(thisCard);
|
||||
Log.info("Remove CodelistMappingTableDetailCard");
|
||||
} catch (Exception e) {
|
||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
|
||||
}
|
||||
|
||||
protected void checkData() {
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
AlertMessageBox d;
|
||||
HideHandler hideHandler = new HideHandler() {
|
||||
|
||||
public void onHide(HideEvent event) {
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
if (name.getValue() == null || name.getValue().isEmpty()
|
||||
|| !name.isValid() || description.getValue() == null
|
||||
|| description.getValue().isEmpty() || !description.isValid()
|
||||
) {
|
||||
d = new AlertMessageBox("Attention!", "Fill in all fields");
|
||||
d.addHideHandler(hideHandler);
|
||||
d.show();
|
||||
} else {
|
||||
name.setReadOnly(true);
|
||||
description.setReadOnly(true);
|
||||
rights.setReadOnly(true);
|
||||
goNext();
|
||||
}
|
||||
}
|
||||
|
||||
protected void goNext() {
|
||||
try {
|
||||
detail.setName(name.getCurrentValue());
|
||||
detail.setDescription(description.getCurrentValue());
|
||||
detail.setRight(rights.getCurrentValue());
|
||||
|
||||
importSession.setTabResource(detail);
|
||||
|
||||
CodelistMappingOperationInProgressCard csvOperationInProgressCard = new CodelistMappingOperationInProgressCard(
|
||||
importSession);
|
||||
getWizardWindow().addCard(csvOperationInProgressCard);
|
||||
Log.info("NextCard CodelistMappingOperationInProgressCard");
|
||||
getWizardWindow().nextCard();
|
||||
} catch (Exception e) {
|
||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
|
||||
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 CodelistMappingUploadFileCard extends WizardCard {
|
||||
protected CSVImportSession importSession;
|
||||
protected CodelistMappingFileUploadPanel fileUploadPanel;
|
||||
protected CodelistMappingUploadFileCard thisCard;
|
||||
|
||||
public CodelistMappingUploadFileCard(final CSVImportSession importSession) {
|
||||
super("Codelist Mapping Import File Upload", "");
|
||||
this.thisCard = this;
|
||||
this.importSession = importSession;
|
||||
|
||||
this.fileUploadPanel = new CodelistMappingFileUploadPanel(res, thisCard,importSession);
|
||||
|
||||
setContent(fileUploadPanel);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
public void execute() {
|
||||
CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard(importSession);
|
||||
getWizardWindow().addCard(detailsCard);
|
||||
Log.info("NextCard CodelistMappingTableDetailCard");
|
||||
getWizardWindow().nextCard();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
getWizardWindow().previousCard();
|
||||
getWizardWindow().removeCard(thisCard);
|
||||
Log.info("Remove CSVUploadFileCard");
|
||||
} catch (Exception e) {
|
||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,164 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
import org.gcube.portlets.user.td.codelistmappingimportwidget.client.workspace.WorkspacePanel;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||
import org.gcube.portlets.widgets.lighttree.client.Item;
|
||||
import org.gcube.portlets.widgets.lighttree.client.ItemType;
|
||||
import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionEvent;
|
||||
import org.gcube.portlets.widgets.lighttree.client.event.ItemSelectionHandler;
|
||||
|
||||
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.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingWorkSpaceSelectionCard extends WizardCard {
|
||||
|
||||
protected CSVImportSession importSession;
|
||||
protected CodelistMappingWorkSpaceSelectionCard thisCard;
|
||||
|
||||
protected Item item;
|
||||
protected VerticalLayoutContainer p;
|
||||
protected WorkspacePanel wpanel;
|
||||
|
||||
public CodelistMappingWorkSpaceSelectionCard(
|
||||
final CSVImportSession importSession) {
|
||||
super("CSV Import From Workspace", "");
|
||||
|
||||
this.importSession = importSession;
|
||||
thisCard = this;
|
||||
|
||||
p = new VerticalLayoutContainer();
|
||||
|
||||
Log.debug("Set Workspace Panel");
|
||||
wpanel = new WorkspacePanel();
|
||||
wpanel.setSpWidth("536px");
|
||||
wpanel.setSpHeight("384px");
|
||||
// wpanel.setShowableTypes(ItemType.EXTERNAL_FILE);
|
||||
wpanel.setSelectableTypes(ItemType.EXTERNAL_FILE);
|
||||
wpanel.getSelectableTypes().remove(ItemType.ROOT);
|
||||
wpanel.getSelectableTypes().remove(ItemType.FOLDER);
|
||||
wpanel.setAllowedMimeTypes("text/csv", "application/zip",
|
||||
"application/x-zip", "application/x-zip-compressed",
|
||||
"application/octet", "application/octet-stream");
|
||||
wpanel.addSelectionHandler(new ItemSelectionHandler() {
|
||||
|
||||
public void onSelection(ItemSelectionEvent event) {
|
||||
item = event.getSelectedItem();
|
||||
Log.debug("Selected Item:" + item);
|
||||
if (item.getType() == ItemType.EXTERNAL_FILE) {
|
||||
String filename = item.getName();
|
||||
if (filename != null && !filename.isEmpty()) {
|
||||
Log.debug("Item name: " + filename);
|
||||
Log.debug("Item path: " + item.getPath());
|
||||
|
||||
importSession.setItemId(item.getId());
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
|
||||
} else {
|
||||
Log.debug("Item name null or empty");
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
}
|
||||
|
||||
} else {
|
||||
Log.debug("Item type:" + item.getType());
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
p.add(wpanel);
|
||||
wpanel.loadTree();
|
||||
setContent(p);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Log.debug("CSVWorkSpaceSelectionCard Call Setup ");
|
||||
Command sayNextCard = new Command() {
|
||||
|
||||
public void execute() {
|
||||
Log.debug("CSVWorkSpaceSelectionCard Call sayNextCard wpanel:"
|
||||
+ wpanel);
|
||||
wpanel.disable();
|
||||
wpanel.startWaiting();
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
getWizardWindow().setEnableBackButton(false);
|
||||
getFileFromWorkspace();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
Command sayPreviousCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
getWizardWindow().previousCard();
|
||||
getWizardWindow().removeCard(thisCard);
|
||||
Log.debug("Remove CSVWorkSpaceSelectionCard");
|
||||
} catch (Exception e) {
|
||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||
getWizardWindow().setEnableNextButton(false);
|
||||
|
||||
}
|
||||
|
||||
protected void getFileFromWorkspace() {
|
||||
TDGWTServiceAsync tdGwtServiceAsync = TDGWTServiceAsync.INSTANCE;
|
||||
tdGwtServiceAsync.getFileFromWorkspace(importSession,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
wpanel.endWaiting();
|
||||
if (caught instanceof TDGWTSessionExpiredException) {
|
||||
getEventBus()
|
||||
.fireEvent(
|
||||
new SessionExpiredEvent(
|
||||
SessionExpiredType.EXPIREDONSERVER));
|
||||
} else {
|
||||
thisCard.showErrorAndHide("Error",
|
||||
"Error retrieving the file from the workspace: "
|
||||
+ caught.getLocalizedMessage(),
|
||||
caught.toString(), caught);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
wpanel.endWaiting();
|
||||
goForward();
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void goForward() {
|
||||
CodelistMappingTableDetailCard detailsCard = new CodelistMappingTableDetailCard(
|
||||
importSession);
|
||||
getWizardWindow().addCard(detailsCard);
|
||||
Log.info("NextCard CodelistMappingTableDetailCard");
|
||||
getWizardWindow().nextCard();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.FileSource;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.source.WorkspaceSource;
|
||||
|
||||
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 SourceSelectionCard extends WizardCard {
|
||||
|
||||
protected final CSVImportSession importSession;
|
||||
|
||||
final FileSource fileSource = FileSource.INSTANCE;
|
||||
final WorkspaceSource workspaceSource = WorkspaceSource.INSTANCE;
|
||||
|
||||
public SourceSelectionCard(final CSVImportSession importSession) {
|
||||
super("Codelist Mapping source selection", "");
|
||||
|
||||
this.importSession = importSession;
|
||||
// Default
|
||||
importSession.setSource(fileSource);
|
||||
|
||||
VerticalPanel sourceSelectionPanel = new VerticalPanel();
|
||||
sourceSelectionPanel.setStylePrimaryName(res.wizardCSS()
|
||||
.getImportSelectionSources());
|
||||
|
||||
Radio radioFileSource = new Radio();
|
||||
radioFileSource.setBoxLabel("<p style='display:inline-table;'><b>"
|
||||
+ fileSource.getName() + "</b><br>"
|
||||
+ fileSource.getDescription() + "</p>");
|
||||
radioFileSource.setName(fileSource.getName());
|
||||
radioFileSource.setStylePrimaryName(res.wizardCSS()
|
||||
.getImportSelectionSource());
|
||||
radioFileSource.setValue(true);
|
||||
|
||||
Radio radioWorkspaceSource = new Radio();
|
||||
radioWorkspaceSource.setBoxLabel("<p style='display:inline-table;'><b>"
|
||||
+ workspaceSource.getName() + "</b><br>"
|
||||
+ workspaceSource.getDescription() + "</p>");
|
||||
radioWorkspaceSource.setName(workspaceSource.getName());
|
||||
radioWorkspaceSource.setStylePrimaryName(res.wizardCSS()
|
||||
.getImportSelectionSource());
|
||||
// radioWorkspaceSource.disable();
|
||||
|
||||
sourceSelectionPanel.add(radioFileSource);
|
||||
sourceSelectionPanel.add(radioWorkspaceSource);
|
||||
|
||||
// we can set name on radios or use toggle group
|
||||
ToggleGroup toggle = new ToggleGroup();
|
||||
toggle.add(radioWorkspaceSource);
|
||||
toggle.add(radioFileSource);
|
||||
|
||||
toggle.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
||||
|
||||
|
||||
public void onValueChange(ValueChangeEvent<HasValue<Boolean>> event) {
|
||||
try {
|
||||
ToggleGroup group = (ToggleGroup) event.getSource();
|
||||
Radio radio = (Radio) group.getValue();
|
||||
Log.info("Source Selected:" + radio.getName());
|
||||
if (radio.getName().compareTo(workspaceSource.getName()) == 0) {
|
||||
importSession.setSource(workspaceSource);
|
||||
} else {
|
||||
if (radio.getName().compareTo(fileSource.getName()) == 0) {
|
||||
importSession.setSource(fileSource);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.error("ToggleGroup: onValueChange "
|
||||
+ e.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
setContent(sourceSelectionPanel);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
Log.debug("Setup Card");
|
||||
Command sayNextCard = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
String sourceId = importSession.getSource().getId();
|
||||
if (sourceId == null || sourceId.isEmpty()) {
|
||||
Log.error("CSV Import Source Id: " + sourceId);
|
||||
} else {
|
||||
if (sourceId.compareTo("File") == 0) {
|
||||
Log.info("NextCard CSVUploadFileCard");
|
||||
CodelistMappingUploadFileCard csvUploadFileCard = new CodelistMappingUploadFileCard(
|
||||
importSession);
|
||||
getWizardWindow().addCard(csvUploadFileCard);
|
||||
getWizardWindow().nextCard();
|
||||
} else {
|
||||
if (sourceId.compareTo("Workspace") == 0) {
|
||||
Log.info("NextCard CSVWorkspaceSelectionCard");
|
||||
CodelistMappingWorkSpaceSelectionCard csvWorkspaceSelectionCard = new CodelistMappingWorkSpaceSelectionCard(
|
||||
importSession);
|
||||
getWizardWindow().addCard(
|
||||
csvWorkspaceSelectionCard);
|
||||
getWizardWindow().nextCard();
|
||||
} else {
|
||||
Log.debug("No source selected and no card loaded");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.dataresource;
|
||||
|
||||
import com.google.gwt.resources.client.CssResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public interface CodelistMappingImportCSS 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("importSelection-sources")
|
||||
public String getImportSelectionSources();
|
||||
|
||||
@ClassName("importSelection-source")
|
||||
public String getImportSelectionSource();
|
||||
|
||||
@ClassName("sdmxRegistryUrlStyle")
|
||||
public String getSDMXRegistryUrlStyle();
|
||||
|
||||
@ClassName("sdmxRegistryUrlInputStyle")
|
||||
public String getSDMXRegistryUrlInputStyle();
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.dataresource;
|
||||
|
||||
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.resources.client.ClientBundle;
|
||||
import com.google.gwt.resources.client.ImageResource;
|
||||
|
||||
|
||||
public interface ResourceBundle extends ClientBundle {
|
||||
|
||||
public static final ResourceBundle INSTANCE=GWT.create(ResourceBundle.class);
|
||||
|
||||
@Source("resources/CSVImportWizardTD.css")
|
||||
CodelistMappingImportCSS importCss();
|
||||
|
||||
@Source("resources/arrow-refresh.png")
|
||||
ImageResource refresh();
|
||||
|
||||
@Source("resources/arrow-refresh_16.png")
|
||||
ImageResource refresh_16();
|
||||
|
||||
@Source("resources/arrow-refresh_32.png")
|
||||
ImageResource refresh32();
|
||||
|
||||
@Source("resources/accept.png")
|
||||
ImageResource csvCheckSuccess();
|
||||
|
||||
@Source("resources/error.png")
|
||||
ImageResource csvCheckFailure();
|
||||
|
||||
@Source("resources/loading.gif")
|
||||
ImageResource loading();
|
||||
|
||||
@Source("resources/information.png")
|
||||
ImageResource information();
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,99 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.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 CodelistMappingImportProgressListener} events.
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingImportProgressBarUpdater implements CodelistMappingImportProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public CodelistMappingImportProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void operationComplete(TRId trId) {
|
||||
Log.info("Import completed");
|
||||
progressBar.updateProgress(1, "Import completed.");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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("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...");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationValidate(float elaborated) {
|
||||
Log.info("Validation Elaborated: "+elaborated);
|
||||
if (elaborated == 0) progressBar.updateProgress(0, "Start Validation...");
|
||||
if (elaborated>0 && elaborated<1) {
|
||||
Log.trace("Validation progress "+elaborated);
|
||||
int elab=new Float(elaborated*100).intValue();
|
||||
progressBar.updateProgress(elaborated,elab+"% Validation Progress...");
|
||||
}
|
||||
if (elaborated == 1) progressBar.updateProgress(1, "Validation...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId,String reason, String details) {
|
||||
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
|
||||
progressBar.updateText("Validations failed");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void operationGeneratingView() {
|
||||
Log.info("Generating View...");
|
||||
progressBar.updateText("Generating View...");
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.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 CodelistMappingImportProgressListener {
|
||||
|
||||
/**
|
||||
* 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 there is a validate for the operation.
|
||||
* @param elaborated the elaborated part.
|
||||
*/
|
||||
public void operationValidate(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);
|
||||
|
||||
/**
|
||||
* Called when the operation is stopped
|
||||
*
|
||||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
*/
|
||||
public void operationStopped(TRId trId, String reason, String details);
|
||||
|
||||
/**
|
||||
* Called when the operation is generating the view
|
||||
*/
|
||||
public void operationGeneratingView();
|
||||
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.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 CodelistMappingImportProgressListener}.
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class CodelistMappingImportProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<CodelistMappingImportProgressListener> listeners = new ArrayList<CodelistMappingImportProgressListener>();
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getCSVImportMonitor(new AsyncCallback<CSVImportMonitor>() {
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void onSuccess(CSVImportMonitor result) {
|
||||
Log.info("retrieved CSVImportMonitor: "
|
||||
+ result.getStatus());
|
||||
switch (result.getStatus()) {
|
||||
case INITIALIZING:
|
||||
Log.info("CSV Import Initializing...");
|
||||
fireOperationInitializing();
|
||||
break;
|
||||
case ABORTED:
|
||||
cancel();
|
||||
Log.info("CSV Import Operation Aborted");
|
||||
break;
|
||||
case IN_PROGRESS:
|
||||
fireOperationUpdate(result.getProgress());
|
||||
break;
|
||||
case VALIDATING_RULES:
|
||||
fireOperationValidate(result.getProgress());
|
||||
break;
|
||||
case GENERATING_VIEW:
|
||||
Log.info("Generating View...");
|
||||
fireOperationGeneratingView();
|
||||
break;
|
||||
case STOPPED:
|
||||
cancel();
|
||||
stopMessage(result);
|
||||
break;
|
||||
case FAILED:
|
||||
cancel();
|
||||
errorMessage(result);
|
||||
break;
|
||||
case SUCCEDED:
|
||||
cancel();
|
||||
Log.info("Import fisnish TableId :"
|
||||
+ result.getTrId());
|
||||
fireOperationComplete(result.getTrId());
|
||||
break;
|
||||
default:
|
||||
Log.info("Unknow State");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void errorMessage(CSVImportMonitor result) {
|
||||
Log.info("CSV Import Failed");
|
||||
Throwable th = null;
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
th = result.getError();
|
||||
failure = "Failed Client Library Import";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
th = new Throwable("Failed");
|
||||
failure = "Failed Client Library Import";
|
||||
details = "Error in import";
|
||||
}
|
||||
fireOperationFailed(th, failure, details);
|
||||
|
||||
}
|
||||
|
||||
protected void stopMessage(CSVImportMonitor result) {
|
||||
Log.info("CSV Import Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped";
|
||||
details = "Stopped import CSV";
|
||||
}
|
||||
|
||||
fireOperationStopped(result.getTrId(),failure, details);
|
||||
}
|
||||
|
||||
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 (CodelistMappingImportProgressListener listener : listeners)
|
||||
listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationGeneratingView() {
|
||||
for (CodelistMappingImportProgressListener listener : listeners)
|
||||
listener.operationGeneratingView();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated) {
|
||||
for (CodelistMappingImportProgressListener listener : listeners)
|
||||
listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationValidate(float elaborated) {
|
||||
for (CodelistMappingImportProgressListener listener : listeners)
|
||||
listener.operationValidate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete(TRId trId) {
|
||||
for (CodelistMappingImportProgressListener listener : listeners)
|
||||
listener.operationComplete(trId);
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure,
|
||||
String failureDetails) {
|
||||
for (CodelistMappingImportProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (CodelistMappingImportProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new {@link CodelistMappingImportProgressListener} to this
|
||||
* {@link CodelistMappingImportProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to add.
|
||||
*/
|
||||
public void addListener(CodelistMappingImportProgressListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link CodelistMappingImportProgressListener} from this
|
||||
* {@link CodelistMappingImportProgressUpdater}.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to remove.
|
||||
*/
|
||||
public void removeListener(CodelistMappingImportProgressListener listener) {
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress;
|
||||
|
||||
|
||||
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 CodelistMappingImportProgressListener} events.
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class FileUploadProgressBarUpdater implements FileUploadProgressListener {
|
||||
|
||||
protected ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Creates a new {@link ProgressBar} updater.
|
||||
* @param progressBar the {@link ProgressBar} to update.
|
||||
*/
|
||||
public FileUploadProgressBarUpdater(ProgressBar progressBar) {
|
||||
this.progressBar = progressBar;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void operationComplete() {
|
||||
Log.info("File upload complete");
|
||||
progressBar.updateProgress(1, "File upload completed.");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||||
Log.info("File upload failed");
|
||||
progressBar.updateText("File upload failed.");
|
||||
}
|
||||
|
||||
public void operationInitializing() {
|
||||
Log.info("File upload inizializing");
|
||||
progressBar.updateProgress(0, "Initializing...");
|
||||
}
|
||||
|
||||
public void operationUpdate(float elaborated) {
|
||||
Log.info("File upload 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+"% Uploading...");
|
||||
}
|
||||
if (elaborated == 1) progressBar.updateProgress(1, "Completed.");
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress;
|
||||
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class FileUploadProgressCardUpdater implements FileUploadProgressListener {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public FileUploadProgressCardUpdater() {
|
||||
}
|
||||
|
||||
|
||||
public void operationComplete() {
|
||||
Log.info("File upload completed");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||||
Log.info("File upload failed");
|
||||
}
|
||||
|
||||
public void operationInitializing() {
|
||||
Log.info("File upload inizializing");
|
||||
}
|
||||
|
||||
public void operationUpdate(float elaborated) {
|
||||
Log.info("File uploading: "+elaborated);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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 FileUploadProgressListener {
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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,127 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.progress;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.file.FileUploadMonitor;
|
||||
|
||||
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 CodelistMappingImportProgressListener}.
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class FileUploadProgressUpdater extends Timer {
|
||||
|
||||
protected ArrayList<FileUploadProgressListener> listeners = new ArrayList<FileUploadProgressListener>();
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
Log.debug("requesting operation progress");
|
||||
TDGWTServiceAsync.INSTANCE.getFileUploadMonitor(new AsyncCallback<FileUploadMonitor>() {
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public void onSuccess(FileUploadMonitor result) {
|
||||
Log.info("retrieved FileUploadMonitor: "+result.getState());
|
||||
switch (result.getState()) {
|
||||
case STARTED:
|
||||
Log.debug("File Upload Started");
|
||||
break;
|
||||
case INPROGRESS:
|
||||
Log.debug("Progress: "+result.getElaboratedLenght()+" of "+result.getTotalLenght());
|
||||
fireOperationUpdate(result.getPercentDone());
|
||||
break;
|
||||
case FAILED:
|
||||
Log.debug("File Upload Failed");
|
||||
cancel();
|
||||
fireOperationFailed(new Throwable("Failed Client Library Import") ,result.getFailureReason(), result.getFailureDetails());
|
||||
break;
|
||||
case COMPLETED:
|
||||
cancel();
|
||||
Log.debug("File Upload Completed");
|
||||
fireOperationComplete();
|
||||
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 (FileUploadProgressListener listener:listeners) listener.operationInitializing();
|
||||
}
|
||||
|
||||
protected void fireOperationUpdate(float elaborated)
|
||||
{
|
||||
for (FileUploadProgressListener listener:listeners) listener.operationUpdate(elaborated);
|
||||
}
|
||||
|
||||
protected void fireOperationComplete()
|
||||
{
|
||||
for (FileUploadProgressListener listener:listeners) listener.operationComplete();
|
||||
}
|
||||
|
||||
protected void fireOperationFailed(Throwable caught, String failure, String failureDetails)
|
||||
{
|
||||
for (FileUploadProgressListener listener:listeners) listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new {@link CodelistMappingImportProgressListener} to this {@link FileUploadProgressUpdater}.
|
||||
* @param listener the listener to add.
|
||||
*/
|
||||
public void addListener(FileUploadProgressListener listener)
|
||||
{
|
||||
listeners.add(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the specified {@link CodelistMappingImportProgressListener} from this {@link FileUploadProgressUpdater}.
|
||||
* @param listener the listener to remove.
|
||||
*/
|
||||
public void removeListener(FileUploadProgressListener listener)
|
||||
{
|
||||
listeners.remove(listener);
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.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 "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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() {
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
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.setHideOnButtonClick(true);
|
||||
simple.setWidth(400);
|
||||
simple.setHeight(400);
|
||||
simple.show();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.util;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
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,22 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.util;
|
||||
|
||||
import com.google.gwt.core.client.Callback;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi"
|
||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
* @param <T>
|
||||
* @param <F>
|
||||
*/
|
||||
public class NOPCallBack<T,F> implements Callback<T, F> {
|
||||
|
||||
public void onFailure(F reason) {}
|
||||
|
||||
public void onSuccess(T result) {}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client.workspace;
|
||||
|
||||
import org.gcube.portlets.widgets.lighttree.client.WorkspaceLightTreePanel;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.event.DisableEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.EnableEvent;
|
||||
|
||||
public class WorkspacePanel extends WorkspaceLightTreePanel {
|
||||
|
||||
AutoProgressMessageBox box;
|
||||
|
||||
public void setSpWidth(String w) {
|
||||
sp.setWidth(w);
|
||||
|
||||
}
|
||||
|
||||
public void setSpHeight(String h) {
|
||||
sp.setHeight(h);
|
||||
}
|
||||
|
||||
public void disable() {
|
||||
Log.debug("WorkspacePanel Disable");
|
||||
fireEvent(new DisableEvent());
|
||||
}
|
||||
|
||||
public void enable() {
|
||||
Log.debug("WorkspacePanel Enable");
|
||||
fireEvent(new EnableEvent());
|
||||
}
|
||||
|
||||
public void startWaiting() {
|
||||
box= new AutoProgressMessageBox("Loading",
|
||||
"Retriving data from workspace, please wait...");
|
||||
box.setProgressText("Loading...");
|
||||
box.setModal(false);
|
||||
box.auto();
|
||||
box.show();
|
||||
|
||||
}
|
||||
|
||||
public void endWaiting() {
|
||||
box.hide();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to='CodelistMappingImportWizardTD'>
|
||||
<!-- 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.gwtservice.TDGWTService' />
|
||||
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
|
||||
|
||||
|
||||
<inherits name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />
|
||||
|
||||
|
||||
<!-- Specify the app entry point class. -->
|
||||
<!-- <entry-point class='org.gcube.portlets.user.SDMXImportWizardTD.client.SDMXImportWizardTDEntry' /> -->
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
<source path='shared' />
|
||||
<!-- <source path='org.gcube.data.analysis.tabulardata.operation.worker'/> -->
|
||||
|
||||
</module>
|
@ -0,0 +1,2 @@
|
||||
sendButton = Send
|
||||
nameField = Enter your name
|
@ -0,0 +1,2 @@
|
||||
sendButton = Envoyer
|
||||
nameField = Entrez votre nom
|
@ -0,0 +1,54 @@
|
||||
@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;
|
||||
}
|
||||
|
||||
.importSelection-sources {
|
||||
padding: 30px;
|
||||
display: block;
|
||||
margin-top: 20px;
|
||||
|
||||
}
|
||||
|
||||
.importSelection-source {
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.sdmxRegistryUrlStyle {
|
||||
padding-top:5px;
|
||||
}
|
||||
|
||||
.sdmxRegistryUrlInputStyle {
|
||||
width:300px!important;
|
||||
}
|
||||
|
||||
|
||||
input#sdmxRegistryUrlInputFieldId-input {
|
||||
width:300px!important;
|
||||
}
|
After Width: | Height: | Size: 781 B |
After Width: | Height: | Size: 984 B |
After Width: | Height: | Size: 572 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 778 B |
After Width: | Height: | Size: 771 B |
@ -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="CodelistMappingImportWizardTD.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="CodelistMappingImportWizardTD/CodelistMappingImportWizardTD.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,46 @@
|
||||
<?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>TDGWTService</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>WorkspaceLightService</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.lighttree.server.WorkspaceServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
|
||||
<!-- Servlets Mapping -->
|
||||
<servlet-mapping>
|
||||
<servlet-name>TDGWTService</servlet-name>
|
||||
<url-pattern>tdgwtservice/TDGWTService</url-pattern>
|
||||
</servlet-mapping>
|
||||
<servlet-mapping>
|
||||
<servlet-name>jUnitHostImpl</servlet-name>
|
||||
<url-pattern>CSVImportWizardTDManagerWidgets/junithost/*</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>WorkspaceLightService</servlet-name>
|
||||
<url-pattern>/CSVImportWizardTDManagerWidgets/WorkspaceLightService</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>CSVImportWizardTD.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
||||
</web-app>
|
@ -0,0 +1,82 @@
|
||||
package org.gcube.portlets.user.td.codelistmappingimportwidget.client;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTService;
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||
|
||||
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 GwtTestCodelistMappingImportWizardTD extends GWTTestCase {
|
||||
|
||||
/**
|
||||
* Must refer to a valid module that sources this class.
|
||||
*/
|
||||
public String getModuleName() {
|
||||
return "org.gcube.portlets.user.codelistmappingimportwidget.CodelistMappingImportWizardTDJUnit";
|
||||
}
|
||||
|
||||
/**
|
||||
* This test will send a request to the server
|
||||
*/
|
||||
public void testResource() {
|
||||
// Create the service that we will test.
|
||||
TDGWTServiceAsync tdGWTService = GWT.create(TDGWTService.class);
|
||||
ServiceDefTarget target = (ServiceDefTarget) tdGWTService;
|
||||
System.out.println(GWT.getModuleBaseURL() + "TDGWTService");
|
||||
target.setServiceEntryPoint(GWT.getModuleBaseURL() + "TDGWTService");
|
||||
|
||||
// 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 7 seconds before timing out.
|
||||
delayTestFinish(7000);
|
||||
|
||||
// Send a request to the server.
|
||||
tdGWTService.getTabularResources(new AsyncCallback<ArrayList<TabResource>>() {
|
||||
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
// The request resulted in an unexpected error.
|
||||
fail("Request failure: " + caught.getMessage());
|
||||
|
||||
}
|
||||
|
||||
public void onSuccess(ArrayList<TabResource> result) {
|
||||
// Shows the first three resources.
|
||||
int i=0;
|
||||
for(TabResource tr:result){
|
||||
i++;
|
||||
System.out.println(tr.toString());
|
||||
if(i>3){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(result.size()>0);
|
||||
|
||||
// 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,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module rename-to="CodelistMappingImportWizardTDJUnit">
|
||||
<!-- Inherit our applications main module. -->
|
||||
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
|
||||
|
||||
<!-- Specify the path to any remote services. -->
|
||||
<servlet path="/TDGWTService"
|
||||
class="org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl" />
|
||||
|
||||
|
||||
<!-- Specify the paths for translatable code -->
|
||||
<source path='client' />
|
||||
</module>
|
@ -0,0 +1,6 @@
|
||||
gCube System - License
|
||||
------------------------------------------------------------
|
||||
|
||||
The gCube/gCore software is licensed as Free Open Source software conveying to the EUPL (http://ec.europa.eu/idabc/eupl).
|
||||
The software and documentation is provided by its authors/distributors "as is" and no expressed or
|
||||
implied warranty is given for its use, quality or fitness for a particular case.
|
@ -0,0 +1 @@
|
||||
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
|
@ -0,0 +1,40 @@
|
||||
The gCube System - ${name}
|
||||
------------------------------------------------------------
|
||||
|
||||
This work has been supported by the following European projects: iMarine (FP7-INFRASTRUCTURES-2011-2)
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa,
|
||||
Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
|
||||
|
||||
|
||||
Version and Release Date
|
||||
------------------------
|
||||
|
||||
v. ${version} (${release.date})
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
${project.description}
|
||||
|
||||
Download information
|
||||
--------------------
|
||||
Source code URL: ${scm.url}
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
${project.description}
|
||||
|
||||
|
||||
Licensing
|
||||
---------
|
||||
|
||||
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.
|
||||
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
<ReleaseNotes>
|
||||
<Changeset component="${groupId}.${artifactId}.1-0-0"
|
||||
date="2014-06-05">
|
||||
<Change>First Release</Change>
|
||||
</Changeset>
|
||||
</ReleaseNotes>
|
@ -0,0 +1,39 @@
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||
<id>servicearchive</id>
|
||||
<formats>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<baseDirectory>/</baseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>${distroDirectory}</directory>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<useDefaultExcludes>true</useDefaultExcludes>
|
||||
<includes>
|
||||
<include>README</include>
|
||||
<include>LICENSE</include>
|
||||
<include>INSTALL</include>
|
||||
<include>MAINTAINERS</include>
|
||||
<include>changelog.xml</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
<files>
|
||||
<file>
|
||||
<source>${distroDirectory}/svnpath.txt</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>${configDirectory}/profile.xml</source>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
</file>
|
||||
<file>
|
||||
<source>target/${build.finalName}.${packaging}</source>
|
||||
<outputDirectory>/${artifactId}</outputDirectory>
|
||||
</file>
|
||||
</files>
|
||||
</assembly>
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Resource>
|
||||
<ID></ID>
|
||||
<Type>Service</Type>
|
||||
<Profile>
|
||||
<Description>${project.description}</Description>
|
||||
<Class>PortletsUser</Class>
|
||||
<Name>${project.name}</Name>
|
||||
<Version>1.0.0</Version>
|
||||
<Packages>
|
||||
<Software>
|
||||
<Description>${project.description}</Description>
|
||||
<Name>${project.name}</Name>
|
||||
<Version>${version}</Version>
|
||||
<MavenCoordinates>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>${project.artifactId}</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</MavenCoordinates>
|
||||
<Type>library</Type>
|
||||
<Files>
|
||||
<File>${project.build.finalName}.${project.packaging}</File>
|
||||
</Files>
|
||||
</Software>
|
||||
</Packages>
|
||||
</Profile>
|
||||
</Resource>
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
${scm.url}
|