");
+ 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(radioSDMXRegistrySource);
+ toggle.add(radioWorkspaceSource);
+ toggle.add(radioFileSource);
+
+ toggle.addValueChangeHandler(new ValueChangeHandler>() {
+
+ @Override
+ public void onValueChange(ValueChangeEvent> 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() {
+ 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) {
+ /* CSVUploadFileCard csvUploadFileCard = new CSVUploadFileCard( importSession);
+ getWizardWindow().addCard(csvUploadFileCard);
+ Log.info("NextCard CSVUploadFileCard");
+ getWizardWindow().nextCard();*/
+ } else {
+ if (sourceId.compareTo("Workspace") == 0) {
+
+ } else {
+
+ }
+ }
+ }
+ } catch (Exception e) {
+ Log.error("sayNextCard :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setNextButtonCommand(sayNextCard);
+
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressBarUpdater.java b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressBarUpdater.java
new file mode 100644
index 0000000..33a198a
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressBarUpdater.java
@@ -0,0 +1,73 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.csvexportwidget.client.progress;
+
+
+
+
+import org.gcube.portlets.user.td.gwtservice.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 CSVExportProgressListener} events.
+ *
+ * @author "Giancarlo Panichi"
+ * g.panichi@isti.cnr.it
+ *
+ */
+public class CSVExportProgressBarUpdater implements CSVExportProgressListener {
+
+ protected ProgressBar progressBar;
+ //protected FramedPanel operationResult;
+ //protected WizardWindow wizardWindow;
+ /**
+ * Creates a new {@link ProgressBar} updater.
+ * @param progressBar the {@link ProgressBar} to update.
+ */
+ public CSVExportProgressBarUpdater(ProgressBar progressBar) {
+ this.progressBar = progressBar;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void operationComplete(TRId trId) {
+ Log.info("Export completed");
+ progressBar.updateProgress(1, "Export completed.");
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void operationFailed(Throwable caught, String reason, String failureDetails) {
+ Log.info("Export failed");
+ progressBar.updateText("Export failed.");
+ }
+
+ @Override
+ public void operationInitializing() {
+ Log.info("Export Inizializing");
+ progressBar.updateProgress(0, "Initializing...");
+ }
+
+ @Override
+ public void operationUpdate(float elaborated) {
+ Log.info("Export 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+"% Exporting...");
+ }
+ if (elaborated == 1) progressBar.updateProgress(1, "Completing...");
+
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressListener.java b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressListener.java
new file mode 100644
index 0000000..172411c
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressListener.java
@@ -0,0 +1,42 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.csvexportwidget.client.progress;
+
+import org.gcube.portlets.user.td.gwtservice.shared.TRId;
+
+
+
+/**
+ * Defines a listener for operation progress.
+ *
+ * @author "Giancarlo Panichi"
+ * g.panichi@isti.cnr.it
+ *
+ */
+public interface CSVExportProgressListener {
+
+ /**
+ * Called when the operation is starting.
+ */
+ public void operationInitializing();
+
+ /**
+ * Called when there is a progress for the operation.
+ * @param elaborated the elaborated part.
+ */
+ public void operationUpdate(float elaborated);
+
+
+ /**
+ * Called when the operation is complete.
+ */
+ public void operationComplete(TRId trId);
+
+ /**
+ * Called when the operation is failed.
+ * @param caught the failure exception.
+ * @param reason the failure reason.
+ */
+ public void operationFailed(Throwable caught, String reason, String failureDetails);
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressUpdater.java b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressUpdater.java
new file mode 100644
index 0000000..822ef1b
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressUpdater.java
@@ -0,0 +1,168 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.csvexportwidget.client.progress;
+
+import java.util.ArrayList;
+
+import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
+import org.gcube.portlets.user.td.gwtservice.shared.TRId;
+import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportMonitor;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
+import com.sencha.gxt.widget.core.client.event.HideEvent;
+import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
+
+/**
+ * This {@link Timer} retrieves {@link OperationProgress} from the specified
+ * {@link OperationProgressSource} with the scheduled interval. The retrieved
+ * information are spread to the subscribed {@link CSVExportProgressListener}.
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class CSVExportProgressUpdater extends Timer {
+
+ protected ArrayList listeners = new ArrayList();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void run() {
+ Log.debug("requesting operation progress");
+ TDGWTServiceAsync.INSTANCE
+ .getCSVImportMonitor(new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ cancel();
+ Log.error("Error retrieving the operation state",
+ caught);
+ String message = getStack(caught);
+ fireOperationFailed(caught,
+ "Failed getting operation updates", message);
+ }
+
+ @Override
+ public void onSuccess(CSVImportMonitor result) {
+ Log.info("retrieved CSVImportMonitor: "
+ + result.getStatus());
+ switch (result.getStatus()) {
+ case INITIALIZING:
+ Log.info("CSV Export Initializing...");
+ fireOperationInitializing();
+ break;
+ case ABORTED:
+ cancel();
+ Log.info("CSV Export Operation Aborted");
+ break;
+ case IN_PROGRESS:
+ fireOperationUpdate(result.getProgress());
+ break;
+ case FAILED:
+ cancel();
+ errorMessage(result);
+ break;
+ case SUCCEDED:
+ cancel();
+ Log.info("Export fisnish TableId :"
+ + result.getTrId());
+ fireOperationComplete(result.getTrId());
+ break;
+
+ default:
+ Log.info("Unknow State");
+ break;
+ }
+
+ }
+
+ });
+
+ }
+
+ protected void errorMessage(CSVImportMonitor result) {
+ Log.info("CSV Export Failed");
+ Throwable th = null;
+ String failure = null;
+ String details = null;
+ if (result.getError() != null) {
+ th = result.getError();
+ failure = "Failed Client Library Export";
+ details = result.getError().getLocalizedMessage();
+ } else {
+ th = new Throwable("Failed");
+ failure = "Failed Client Library Export";
+ details = "Error in export";
+ }
+ fireOperationFailed(th, failure, details);
+
+ AlertMessageBox d = new AlertMessageBox("Error in CSV Export", details);
+ d.addHideHandler(new HideHandler() {
+
+ @Override
+ public void onHide(HideEvent event) {
+ //
+ }
+
+ });
+ d.show();
+
+ }
+
+ protected String getStack(Throwable e) {
+ String message = e.getLocalizedMessage() + " -> ";
+ Throwable c = e.getCause();
+ if (c != null)
+ message += getStack(c);
+ return message;
+ }
+
+ protected void fireOperationInitializing() {
+ for (CSVExportProgressListener listener : listeners)
+ listener.operationInitializing();
+ }
+
+ protected void fireOperationUpdate(float elaborated) {
+ for (CSVExportProgressListener listener : listeners)
+ listener.operationUpdate(elaborated);
+ }
+
+ protected void fireOperationComplete(TRId trId) {
+ for (CSVExportProgressListener listener : listeners)
+ listener.operationComplete(trId);
+ }
+
+ protected void fireOperationFailed(Throwable caught, String failure,
+ String failureDetails) {
+ for (CSVExportProgressListener listener : listeners)
+ listener.operationFailed(caught, failure, failureDetails);
+ }
+
+ /**
+ * Add a new {@link CSVExportProgressListener} to this
+ * {@link CSVExportProgressUpdater}.
+ *
+ * @param listener
+ * the listener to add.
+ */
+ public void addListener(CSVExportProgressListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Removes the specified {@link CSVExportProgressListener} from this
+ * {@link CSVExportProgressUpdater}.
+ *
+ * @param listener
+ * the listener to remove.
+ */
+ public void removeListener(CSVExportProgressListener listener) {
+ listeners.remove(listener);
+ }
+}
diff --git a/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/CSVExportWizardTD.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/CSVExportWizardTD.gwt.xml
new file mode 100644
index 0000000..f975b25
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/CSVExportWizardTD.gwt.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/client/Messages.properties
new file mode 100644
index 0000000..c222555
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/client/Messages.properties
@@ -0,0 +1,2 @@
+sendButton = Send
+nameField = Enter your name
\ No newline at end of file
diff --git a/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/client/Messages_fr.properties
new file mode 100644
index 0000000..b4a7627
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/csvexportwidget/client/Messages_fr.properties
@@ -0,0 +1,2 @@
+sendButton = Envoyer
+nameField = Entrez votre nom
\ No newline at end of file
diff --git a/src/main/webapp/CSVImportWizardTD.css b/src/main/webapp/CSVImportWizardTD.css
new file mode 100644
index 0000000..7aca7ac
--- /dev/null
+++ b/src/main/webapp/CSVImportWizardTD.css
@@ -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;
+}
diff --git a/src/main/webapp/CSVImportWizardTD.html b/src/main/webapp/CSVImportWizardTD.html
new file mode 100644
index 0000000..5057b47
--- /dev/null
+++ b/src/main/webapp/CSVImportWizardTD.html
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Web Application Starter Project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Web Application Starter Project
+
+
+
+
Please enter your name:
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..5c2073d
--- /dev/null
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+ TDGWTService
+ org.gcube.portlets.user.td.gwtservice.server.TDGWTServiceImpl
+
+
+
+ jUnitHostImpl
+ com.google.gwt.junit.server.JUnitHostImpl
+
+
+
+
+ TDGWTService
+ tdgwtservice/TDGWTService
+
+
+ jUnitHostImpl
+ CSVImportWizardTDManagerWidgets/junithost/*
+
+
+
+
+ CSVImportWizardTD.html
+
+
+
diff --git a/src/test/java/org/gcube/portlets/user/td/csvexportwidget/client/GwtTestCSVExportWizardTD.java b/src/test/java/org/gcube/portlets/user/td/csvexportwidget/client/GwtTestCSVExportWizardTD.java
new file mode 100644
index 0000000..664aa3d
--- /dev/null
+++ b/src/test/java/org/gcube/portlets/user/td/csvexportwidget/client/GwtTestCSVExportWizardTD.java
@@ -0,0 +1,83 @@
+package org.gcube.portlets.user.td.csvexportwidget.client;
+
+import java.util.List;
+
+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.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 integration tests must extend GWTTestCase.
+ * Using "GwtTest*" 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 GwtTestCSVExportWizardTD extends GWTTestCase {
+
+ /**
+ * Must refer to a valid module that sources this class.
+ */
+ public String getModuleName() {
+ return "org.gcube.portlets.user.csvimportWizard.CSVImportWizardTDJUnit";
+ }
+
+ /**
+ * This test will send a request to the server
+ */
+ public void testResource() {
+ // Create the service that we will test.
+ TDGWTServiceAsync tdGXTService = GWT.create(TDGWTService.class);
+ ServiceDefTarget target = (ServiceDefTarget) tdGXTService;
+ 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.
+ tdGXTService.getTabularResources(new AsyncCallback>() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ // The request resulted in an unexpected error.
+ fail("Request failure: " + caught.getMessage());
+
+ }
+
+ @Override
+ public void onSuccess(List 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();
+
+ }
+ });
+
+ }
+
+
+}
diff --git a/src/test/resources/org/gcube/portlets/user/td/csvexportwidget/CSVExportWizardTDJUnit.gwt.xml b/src/test/resources/org/gcube/portlets/user/td/csvexportwidget/CSVExportWizardTDJUnit.gwt.xml
new file mode 100644
index 0000000..e493fb5
--- /dev/null
+++ b/src/test/resources/org/gcube/portlets/user/td/csvexportwidget/CSVExportWizardTDJUnit.gwt.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/INSTALL b/templates/INSTALL
new file mode 100644
index 0000000..e69de29
diff --git a/templates/LICENSE b/templates/LICENSE
new file mode 100644
index 0000000..cc51139
--- /dev/null
+++ b/templates/LICENSE
@@ -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.
\ No newline at end of file
diff --git a/templates/MAINTAINERS b/templates/MAINTAINERS
new file mode 100644
index 0000000..0bc9be3
--- /dev/null
+++ b/templates/MAINTAINERS
@@ -0,0 +1 @@
+Giancarlo Panichi (giancarlo.panichi@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo"
diff --git a/templates/README b/templates/README
new file mode 100644
index 0000000..e81341a
--- /dev/null
+++ b/templates/README
@@ -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.
+
+
+
diff --git a/templates/changelog.xml b/templates/changelog.xml
new file mode 100644
index 0000000..a87dfa1
--- /dev/null
+++ b/templates/changelog.xml
@@ -0,0 +1,6 @@
+
+
+ First Release
+
+
\ No newline at end of file
diff --git a/templates/descriptor.xml b/templates/descriptor.xml
new file mode 100644
index 0000000..b978636
--- /dev/null
+++ b/templates/descriptor.xml
@@ -0,0 +1,39 @@
+
+ servicearchive
+
+ tar.gz
+
+ /
+
+
+ ${distroDirectory}
+ /
+ true
+
+ README
+ LICENSE
+ INSTALL
+ MAINTAINERS
+ changelog.xml
+
+ 755
+
+
+
+
+
+ /${artifactId}
+
+
+
+ /
+
+
+
+ /${artifactId}
+
+
+
\ No newline at end of file
diff --git a/templates/profile.xml b/templates/profile.xml
new file mode 100644
index 0000000..ffa3274
--- /dev/null
+++ b/templates/profile.xml
@@ -0,0 +1,29 @@
+
+
+
+ Service
+
+ ${project.description}
+ PortletsUser
+ ${project.name}
+ 1.0.0
+
+
+ ${project.description}
+ ${project.name}
+ ${version}
+
+ ${project.groupId}
+ ${project.artifactId}
+ ${project.version}
+
+ library
+
+ ${project.build.finalName}.${project.packaging}
+
+
+
+
+
+
+
diff --git a/templates/svnpath.txt b/templates/svnpath.txt
new file mode 100644
index 0000000..dcd0d22
--- /dev/null
+++ b/templates/svnpath.txt
@@ -0,0 +1 @@
+${scm.url}
\ No newline at end of file