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
This commit is contained in:
Giancarlo Panichi 2013-11-18 15:08:28 +00:00
parent 19448f68d0
commit 547c5a893a
4 changed files with 67 additions and 7 deletions

19
pom.xml
View File

@ -124,7 +124,7 @@
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>workspace-light-tree</artifactId> <artifactId>workspace-light-tree</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.common</groupId> <groupId>org.gcube.common</groupId>
<artifactId>home-library</artifactId> <artifactId>home-library</artifactId>
@ -132,7 +132,7 @@
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- TD Source --> <!-- TD Source -->
<dependency> <dependency>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
@ -186,6 +186,12 @@
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-csv-export-widget</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!--tabular-data-information-widget --> <!--tabular-data-information-widget -->
<dependency> <dependency>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
@ -199,7 +205,14 @@
<artifactId>tabular-data-gwt-service</artifactId> <artifactId>tabular-data-gwt-service</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency> </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>
</dependency>
<!-- LOGGING --> <!-- LOGGING -->
<dependency> <dependency>
<groupId>com.allen-sauer.gwt.log</groupId> <groupId>com.allen-sauer.gwt.log</groupId>

View File

@ -4,6 +4,7 @@
package org.gcube.portlets.user.td.client; package org.gcube.portlets.user.td.client;
import org.gcube.portlets.user.td.sdmximportwidget.client.SDMXImportWizardTD; 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.CloseTabularResourceEvent;
import org.gcube.portlets.user.td.client.event.CloseTabularResourceType; import org.gcube.portlets.user.td.client.event.CloseTabularResourceType;
import org.gcube.portlets.user.td.client.event.ExportTableEvent; 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.OpenTabularResourceType;
import org.gcube.portlets.user.td.client.event.UIStateEvent; import org.gcube.portlets.user.td.client.event.UIStateEvent;
import org.gcube.portlets.user.td.client.event.UIStateType; 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.csvimportwidget.client.CSVImportWizardTD;
import org.gcube.portlets.user.td.gwtservice.shared.TRId; import org.gcube.portlets.user.td.gwtservice.shared.TRId;
import org.gcube.portlets.user.td.informationwidget.client.TabularResourceProperties; import org.gcube.portlets.user.td.informationwidget.client.TabularResourceProperties;
@ -243,7 +245,7 @@ public class TabularDataController {
openSDMXExportWizard(); openSDMXExportWizard();
break; break;
case CSV: case CSV:
openSDMXExportWizard(); openCSVExportWizard();
break; break;
case JSON: case JSON:
openSDMXExportWizard(); 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() { protected void openSDMXExportWizard() {
/* /*

View File

@ -213,7 +213,7 @@ public class FileToolBar {
exportGroup.setId("Export"); exportGroup.setId("Export");
exportGroup.setStyleName("ribbon"); exportGroup.setStyleName("ribbon");
exportGroup.setHeadingText("Export"); exportGroup.setHeadingText("Export");
exportGroup.disable(); //exportGroup.disable();
toolBar.add(exportGroup); toolBar.add(exportGroup);
FlexTable exportLayout = new FlexTable(); FlexTable exportLayout = new FlexTable();
@ -221,6 +221,7 @@ public class FileToolBar {
exportSDMXButton = new TextButton("SDMX", exportSDMXButton = new TextButton("SDMX",
TabularDataResources.INSTANCE.sdmx32()); TabularDataResources.INSTANCE.sdmx32());
exportSDMXButton.disable();
exportSDMXButton.setToolTip("Export SDMX document"); exportSDMXButton.setToolTip("Export SDMX document");
exportSDMXButton.setScale(ButtonScale.LARGE); exportSDMXButton.setScale(ButtonScale.LARGE);
exportSDMXButton.setIconAlign(IconAlign.TOP); exportSDMXButton.setIconAlign(IconAlign.TOP);
@ -238,6 +239,7 @@ public class FileToolBar {
exportCSVButton = new TextButton("CSV", exportCSVButton = new TextButton("CSV",
TabularDataResources.INSTANCE.csv()); TabularDataResources.INSTANCE.csv());
exportCSVButton.disable();
exportCSVButton.setToolTip("Export CSV document"); exportCSVButton.setToolTip("Export CSV document");
exportCSVButton.addSelectHandler(new SelectHandler() { exportCSVButton.addSelectHandler(new SelectHandler() {
@ -250,6 +252,7 @@ public class FileToolBar {
exportJSONButton = new TextButton("JSON", exportJSONButton = new TextButton("JSON",
TabularDataResources.INSTANCE.json()); TabularDataResources.INSTANCE.json());
exportJSONButton.disable();
exportJSONButton.setToolTip("Export JSON document"); exportJSONButton.setToolTip("Export JSON document");
exportJSONButton.addSelectHandler(new SelectHandler() { exportJSONButton.addSelectHandler(new SelectHandler() {
@ -319,7 +322,7 @@ public class FileToolBar {
importCSVButton.enable(); importCSVButton.enable();
importJSONButton.disable(); importJSONButton.disable();
importSDMXButton.enable(); importSDMXButton.enable();
exportCSVButton.disable(); exportCSVButton.enable();
exportJSONButton.disable(); exportJSONButton.disable();
exportSDMXButton.disable(); exportSDMXButton.disable();
break; break;

View File

@ -13,11 +13,14 @@
<!-- <inherits name='org.gcube.portlets.user.td.ciw.csvimporterwidget' /> --> <!-- <inherits name='org.gcube.portlets.user.td.ciw.csvimporterwidget' /> -->
<inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' /> <inherits name='org.gcube.portlets.user.td.gwtservice.TDGWTService' />
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
<inherits name='org.gcube.portlets.user.td.informationwidget.Information' /> <inherits name='org.gcube.portlets.user.td.informationwidget.Information' />
<inherits name='org.gcube.portlets.user.td.openwidget.TDOpen' /> <inherits name='org.gcube.portlets.user.td.openwidget.TDOpen' />
<inherits name='org.gcube.portlets.user.td.sdmximportwidget.SDMXImportWizardTD' /> <inherits name='org.gcube.portlets.user.td.sdmximportwidget.SDMXImportWizardTD' />
<!-- <inherits name='org.gcube.portlets.user.td.sdmxexportwidget.SDMXExportWizardTD' /> --> <!-- <inherits name='org.gcube.portlets.user.td.sdmxexportwidget.SDMXExportWizardTD' /> -->
<inherits name='org.gcube.portlets.user.td.csvimportwidget.CSVImportWizardTD' /> <inherits name='org.gcube.portlets.user.td.csvimportwidget.CSVImportWizardTD' />
<inherits name='org.gcube.portlets.user.td.csvexportwidget.CSVExportWizardTD' />
<inherits name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' /> <inherits name='org.gcube.portlets.widgets.lighttree.WorkspacePortletLightTree' />