From 547c5a893aff5ba67473596e87c905d0b4a36411 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 18 Nov 2013 15:08:28 +0000 Subject: [PATCH] Added CSV Export git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@85624 82a268e6-3cf1-43bd-a215-b396298e98cf --- pom.xml | 19 ++++++-- .../user/td/client/TabularDataController.java | 45 ++++++++++++++++++- .../user/td/client/ribbon/FileToolBar.java | 7 ++- .../user/td/tabulardataportlet.gwt.xml | 3 ++ 4 files changed, 67 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 7c34038..9bdbbfc 100644 --- a/pom.xml +++ b/pom.xml @@ -124,7 +124,7 @@ org.gcube.portlets.widgets workspace-light-tree - + org.gcube.common home-library @@ -132,7 +132,7 @@ provided - + org.gcube.portlets.user @@ -186,6 +186,12 @@ [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + + org.gcube.portlets.user + tabular-data-csv-export-widget + [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + + org.gcube.portlets.user @@ -199,7 +205,14 @@ tabular-data-gwt-service [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) - + + + + org.gcube.portlets.user + tabular-data-wizard-widget + [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT) + + com.allen-sauer.gwt.log diff --git a/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java b/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java index afafe26..c17af50 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java +++ b/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java @@ -4,6 +4,7 @@ package org.gcube.portlets.user.td.client; import org.gcube.portlets.user.td.sdmximportwidget.client.SDMXImportWizardTD; +import org.gcube.portlets.user.td.wizardwidget.client.WizardListener; import org.gcube.portlets.user.td.client.event.CloseTabularResourceEvent; import org.gcube.portlets.user.td.client.event.CloseTabularResourceType; import org.gcube.portlets.user.td.client.event.ExportTableEvent; @@ -16,6 +17,7 @@ import org.gcube.portlets.user.td.client.event.OpenTabularResourceEvent; import org.gcube.portlets.user.td.client.event.OpenTabularResourceType; import org.gcube.portlets.user.td.client.event.UIStateEvent; import org.gcube.portlets.user.td.client.event.UIStateType; +import org.gcube.portlets.user.td.csvexportwidget.client.CSVExportWizardTD; import org.gcube.portlets.user.td.csvimportwidget.client.CSVImportWizardTD; import org.gcube.portlets.user.td.gwtservice.shared.TRId; import org.gcube.portlets.user.td.informationwidget.client.TabularResourceProperties; @@ -243,7 +245,7 @@ public class TabularDataController { openSDMXExportWizard(); break; case CSV: - openSDMXExportWizard(); + openCSVExportWizard(); break; case JSON: openSDMXExportWizard(); @@ -398,7 +400,46 @@ public class TabularDataController { } - + protected void openCSVExportWizard() { + GWT.runAsync(new RunAsyncCallback() { + + @Override + public void onSuccess() { + openWizard(); + CSVExportWizardTD exportWizard = new CSVExportWizardTD( + "CSV Export"); + + exportWizard + .addListener(new WizardListener() { + @Override + public void failed(Throwable throwable, + String reason, String details) { + alertMessage(reason, details); + resumeUIState(); + } + + @Override + public void completed(TRId id) { + resumeUIState(); + + } + + @Override + public void aborted() { + resumeUIState(); + } + }); + + exportWizard.show(); + } + + @Override + public void onFailure(Throwable reason) { + asyncCodeLoadingFailed(reason); + } + }); + + } protected void openSDMXExportWizard() { /* diff --git a/src/main/java/org/gcube/portlets/user/td/client/ribbon/FileToolBar.java b/src/main/java/org/gcube/portlets/user/td/client/ribbon/FileToolBar.java index fafdf33..9311948 100644 --- a/src/main/java/org/gcube/portlets/user/td/client/ribbon/FileToolBar.java +++ b/src/main/java/org/gcube/portlets/user/td/client/ribbon/FileToolBar.java @@ -213,7 +213,7 @@ public class FileToolBar { exportGroup.setId("Export"); exportGroup.setStyleName("ribbon"); exportGroup.setHeadingText("Export"); - exportGroup.disable(); + //exportGroup.disable(); toolBar.add(exportGroup); FlexTable exportLayout = new FlexTable(); @@ -221,6 +221,7 @@ public class FileToolBar { exportSDMXButton = new TextButton("SDMX", TabularDataResources.INSTANCE.sdmx32()); + exportSDMXButton.disable(); exportSDMXButton.setToolTip("Export SDMX document"); exportSDMXButton.setScale(ButtonScale.LARGE); exportSDMXButton.setIconAlign(IconAlign.TOP); @@ -238,6 +239,7 @@ public class FileToolBar { exportCSVButton = new TextButton("CSV", TabularDataResources.INSTANCE.csv()); + exportCSVButton.disable(); exportCSVButton.setToolTip("Export CSV document"); exportCSVButton.addSelectHandler(new SelectHandler() { @@ -250,6 +252,7 @@ public class FileToolBar { exportJSONButton = new TextButton("JSON", TabularDataResources.INSTANCE.json()); + exportJSONButton.disable(); exportJSONButton.setToolTip("Export JSON document"); exportJSONButton.addSelectHandler(new SelectHandler() { @@ -319,7 +322,7 @@ public class FileToolBar { importCSVButton.enable(); importJSONButton.disable(); importSDMXButton.enable(); - exportCSVButton.disable(); + exportCSVButton.enable(); exportJSONButton.disable(); exportSDMXButton.disable(); break; diff --git a/src/main/resources/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml index 18dd258..e473fc5 100644 --- a/src/main/resources/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml +++ b/src/main/resources/org/gcube/portlets/user/td/tabulardataportlet.gwt.xml @@ -13,11 +13,14 @@ + + +