From 31dbc7fab35679445131b34a92e7791ebf59d12d Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 18 Nov 2013 09:44:53 +0000 Subject: [PATCH] git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-export-widget@85578 82a268e6-3cf1-43bd-a215-b396298e98cf --- CSVExportWizardTDTest-dev.launch | 22 ++ CSVExportWizardTDTest-prod.launch | 22 ++ pom.xml | 292 ++++++++++++++++++ .../client/CSVExportWizardTD.java | 39 +++ .../client/CSVExportWizardTDEntry.java | 13 + .../client/SourceSelectionCard.java | 138 +++++++++ .../progress/CSVExportProgressBarUpdater.java | 73 +++++ .../progress/CSVExportProgressListener.java | 42 +++ .../progress/CSVExportProgressUpdater.java | 168 ++++++++++ .../csvexportwidget/CSVExportWizardTD.gwt.xml | 32 ++ .../client/Messages.properties | 2 + .../client/Messages_fr.properties | 2 + src/main/webapp/CSVImportWizardTD.css | 34 ++ src/main/webapp/CSVImportWizardTD.html | 63 ++++ src/main/webapp/WEB-INF/web.xml | 34 ++ .../client/GwtTestCSVExportWizardTD.java | 83 +++++ .../CSVExportWizardTDJUnit.gwt.xml | 13 + templates/INSTALL | 0 templates/LICENSE | 6 + templates/MAINTAINERS | 1 + templates/README | 40 +++ templates/changelog.xml | 6 + templates/descriptor.xml | 39 +++ templates/profile.xml | 29 ++ templates/svnpath.txt | 1 + 25 files changed, 1194 insertions(+) create mode 100644 CSVExportWizardTDTest-dev.launch create mode 100644 CSVExportWizardTDTest-prod.launch create mode 100644 pom.xml create mode 100644 src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/CSVExportWizardTD.java create mode 100644 src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/CSVExportWizardTDEntry.java create mode 100644 src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/SourceSelectionCard.java create mode 100644 src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressBarUpdater.java create mode 100644 src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressListener.java create mode 100644 src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/progress/CSVExportProgressUpdater.java create mode 100644 src/main/resources/org/gcube/portlets/user/td/csvexportwidget/CSVExportWizardTD.gwt.xml create mode 100644 src/main/resources/org/gcube/portlets/user/td/csvexportwidget/client/Messages.properties create mode 100644 src/main/resources/org/gcube/portlets/user/td/csvexportwidget/client/Messages_fr.properties create mode 100644 src/main/webapp/CSVImportWizardTD.css create mode 100644 src/main/webapp/CSVImportWizardTD.html create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/test/java/org/gcube/portlets/user/td/csvexportwidget/client/GwtTestCSVExportWizardTD.java create mode 100644 src/test/resources/org/gcube/portlets/user/td/csvexportwidget/CSVExportWizardTDJUnit.gwt.xml create mode 100644 templates/INSTALL create mode 100644 templates/LICENSE create mode 100644 templates/MAINTAINERS create mode 100644 templates/README create mode 100644 templates/changelog.xml create mode 100644 templates/descriptor.xml create mode 100644 templates/profile.xml create mode 100644 templates/svnpath.txt diff --git a/CSVExportWizardTDTest-dev.launch b/CSVExportWizardTDTest-dev.launch new file mode 100644 index 0000000..36889ba --- /dev/null +++ b/CSVExportWizardTDTest-dev.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/CSVExportWizardTDTest-prod.launch b/CSVExportWizardTDTest-prod.launch new file mode 100644 index 0000000..a4b76e5 --- /dev/null +++ b/CSVExportWizardTDTest-prod.launch @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..17bb29c --- /dev/null +++ b/pom.xml @@ -0,0 +1,292 @@ + + + + + maven-parent + org.gcube.tools + 1.0.0 + + + + + 4.0.0 + org.gcube.portlets.user + tabular-data-csv-export-widget + 1.0.0-SNAPSHOT + + tabular-data-csv-export-widget + tabular-data-csv-export-widget allows csv export inside file and workspace + + + https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-export-widget + + + + + Giancarlo Panichi + g.panichi@isti.cnr.it + CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" + + architect + developer + + + + + + ${project.basedir}/distro + ${project.build.directory}/${project.build.finalName} + 2013-10-18 + templates + distro + config + + + 2.5.1 + + ${env.GLOBUS_LOCATION} + + UTF-8 + UTF-8 + + + + + localRun + + + org.slf4j + slf4j-api + compile + + + ch.qos.logback + logback-classic + 1.0.1 + runtime + + + + + + + + + com.google.gwt + gwt-servlet + + + com.google.gwt + gwt-user + + + + + javax.validation + validation-api + 1.0.0.GA + test + + + javax.validation + validation-api + 1.0.0.GA + sources + test + + + + com.sencha.gxt + gxt + 3.0.1 + + + + + + + org.gcube.portlets.user + tabular-data-gwt-service + 1.0.0-SNAPSHOT + + + + + org.gcube.portlets.user + tabular-data-wizard-widget + 1.0.0-SNAPSHOT + + + + + + com.allen-sauer.gwt.log + gwt-log + + + + org.slf4j + slf4j-api + + + + + junit + junit + 4.8.1 + test + + + + + + + + + + ${webappDirectory}/WEB-INF/classes + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.16 + + true + + + + + org.apache.maven.surefire + surefire-junit47 + 2.16 + + + + + + + org.codehaus.mojo + gwt-maven-plugin + ${gwtVersion} + + + + resources + + + + + CSVExportWizardTD.html + ${webappDirectory} + org.gcube.portlets.user.td.csvexportwidget.CSVExportWizardTD + + + + + + maven-resources-plugin + 2.6 + + + copy-profile + process-resources + + copy-resources + + + ${configDirectory} + + + ${templatesDirectory} + + profile.xml + + true + + + + + + copy-distro-resources + process-resources + + copy-resources + + + ${distroDirectory} + + + ${templatesDirectory} + + profile.xml + descriptor.xml + + true + + + + + + + + maven-clean-plugin + 2.5 + + + + ${distroDirectory} + + ** + + false + + + ${configDirectory} + + ** + + false + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 2.2 + + + ${templatesDirectory}/descriptor.xml + + + + + servicearchive + package + + single + + + + + + + + + + + + + org.gcube.distribution + maven-portal-bom + LATEST + pom + import + + + + diff --git a/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/CSVExportWizardTD.java b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/CSVExportWizardTD.java new file mode 100644 index 0000000..533c686 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/CSVExportWizardTD.java @@ -0,0 +1,39 @@ +package org.gcube.portlets.user.td.csvexportwidget.client; + + + +import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVImportSession; +import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow; + + + + +/** + * + */ +public class CSVExportWizardTD extends WizardWindow { + + protected CSVImportSession importSession; + + + /** + * The id of the {@link CSVTarget} to use. + * @param targetId + */ + + public CSVExportWizardTD(String title) { + super(title); + + importSession= new CSVImportSession(); + + + SourceSelectionCard sourceSelection= new SourceSelectionCard(importSession); + addCard(sourceSelection); + sourceSelection.setup(); + + } + + + + +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/CSVExportWizardTDEntry.java b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/CSVExportWizardTDEntry.java new file mode 100644 index 0000000..32ea482 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/CSVExportWizardTDEntry.java @@ -0,0 +1,13 @@ +package org.gcube.portlets.user.td.csvexportwidget.client; + +import com.allen_sauer.gwt.log.client.Log; +import com.google.gwt.core.client.EntryPoint; + +public class CSVExportWizardTDEntry implements EntryPoint { + + @Override + public void onModuleLoad() { + CSVExportWizardTD exportWizard= new CSVExportWizardTD("CSVExport"); + Log.info(exportWizard.getId()); + } +} diff --git a/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/SourceSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/SourceSelectionCard.java new file mode 100644 index 0000000..e9d4db2 --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/td/csvexportwidget/client/SourceSelectionCard.java @@ -0,0 +1,138 @@ +/** + * + */ +package org.gcube.portlets.user.td.csvexportwidget.client; + + + +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 org.gcube.portlets.user.td.wizardwidget.client.WizardCard; + +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" g.panichi@isti.cnr.it + * + */ +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("CSV source selection", ""); + + this.importSession = importSession; + // Default + importSession.setSource(fileSource); + + VerticalPanel sourceSelectionPanel = new VerticalPanel(); + sourceSelectionPanel.setStylePrimaryName(res.wizardCSS() + .getImportSelectionSources()); + + Radio radioFileSource = new Radio(); + radioFileSource.setBoxLabel("

" + + fileSource.getName() + "
" + + fileSource.getDescription() + "

"); + radioFileSource.setName(fileSource.getName()); + radioFileSource.setStylePrimaryName(res.wizardCSS() + .getImportSelectionSource()); + radioFileSource.setValue(true); + + Radio radioSDMXRegistrySource = new Radio(); + + Radio radioWorkspaceSource = new Radio(); + radioWorkspaceSource.setBoxLabel("

" + + workspaceSource.getName() + "
" + + workspaceSource.getDescription() + "

"); + 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 + + + + + ${distroDirectory}/svnpath.txt + /${artifactId} + + + ${configDirectory}/profile.xml + / + + + target/${build.finalName}.${packaging} + /${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