diff --git a/.classpath b/.classpath
new file mode 100644
index 0000000..001ae1b
--- /dev/null
+++ b/.classpath
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..7d71a58
--- /dev/null
+++ b/.project
@@ -0,0 +1,36 @@
+
+
+ tabular-data-json-export-widget
+
+
+
+
+
+ org.eclipse.wst.common.project.facet.core.builder
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jem.workbench.JavaEMFNature
+ org.eclipse.wst.common.modulecore.ModuleCoreNature
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+ org.eclipse.wst.common.project.facet.core.nature
+
+
diff --git a/JSONExportWizardTDTest-dev.launch b/JSONExportWizardTDTest-dev.launch
new file mode 100644
index 0000000..e154ca9
--- /dev/null
+++ b/JSONExportWizardTDTest-dev.launch
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/JSONExportWizardTDTest-prod.launch b/JSONExportWizardTDTest-prod.launch
new file mode 100644
index 0000000..c85b365
--- /dev/null
+++ b/JSONExportWizardTDTest-prod.launch
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..f26cc17
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,328 @@
+
+
+
+
+ maven-parent
+ org.gcube.tools
+ 1.0.0
+
+
+
+
+ 4.0.0
+ org.gcube.portlets.user
+ tabular-data-json-export-widget
+ 1.0.0-SNAPSHOT
+
+ tabular-data-json-export-widget
+ tabular-data-json-export-widget allows json export inside file and workspace
+
+
+ https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-json-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}
+ 2014-09-12
+ templates
+ distro
+ config
+
+
+ 2.5.1
+
+ ${env.KEYS}
+
+ 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
+ [2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)
+ provided
+
+
+
+
+ org.gcube.portlets.user
+ tabular-data-widget-common-event
+ [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)
+ provided
+
+
+
+
+ org.gcube.portlets.user
+ tabular-data-monitor-widget
+ [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)
+ provided
+
+
+
+
+ org.gcube.portlets.user
+ tabular-data-wizard-widget
+ [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)
+ provided
+
+
+
+
+ org.gcube.portlets.widgets
+ workspace-light-tree
+ [2.13.0-SNAPSHOT, 3.0.0-SNAPSHOT)
+ provided
+
+
+ org.gcube.common
+ home-library
+ [1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)
+ provided
+
+
+ org.gcube.portlets.user
+ gcube-widgets
+ provided
+
+
+
+
+ com.allen-sauer.gwt.log
+ gwt-log
+ 3.2.1
+ provided
+
+
+
+ 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
+
+
+
+
+ JSONExportWidgetTD.html
+ ${webappDirectory}
+ org.gcube.portlets.user.td.jsonexportwidget.JSONExportWidgetTD
+
+
+
+
+
+ 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/jsonexportwidget/client/DestinationSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/DestinationSelectionCard.java
new file mode 100644
index 0000000..356b0e2
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/DestinationSelectionCard.java
@@ -0,0 +1,163 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.jsonexportwidget.client;
+
+
+
+import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
+import org.gcube.portlets.user.td.gwtservice.shared.destination.FileDestination;
+import org.gcube.portlets.user.td.gwtservice.shared.destination.WorkspaceDestination;
+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 DestinationSelectionCard extends WizardCard {
+
+ protected final JSONExportSession exportSession;
+ protected DestinationSelectionCard thisCard;
+
+ final FileDestination fileDestination = FileDestination.INSTANCE;
+ final WorkspaceDestination workspaceDestination = WorkspaceDestination.INSTANCE;
+
+ public DestinationSelectionCard(final JSONExportSession exportSession) {
+ super("JSON destination selection", "");
+ thisCard=this;
+ this.exportSession = exportSession;
+ // Default
+ exportSession.setDestination(workspaceDestination);
+
+ VerticalPanel destinationSelectionPanel = new VerticalPanel();
+ destinationSelectionPanel.setStylePrimaryName(res.wizardCSS()
+ .getImportSelectionSources());
+
+ Radio radioWorkspaceDestination = new Radio();
+ radioWorkspaceDestination.setBoxLabel("
"
+ + workspaceDestination.getName() + " "
+ + workspaceDestination.getDescription() + "
");
+ radioWorkspaceDestination.setName(workspaceDestination.getName());
+ radioWorkspaceDestination.setStylePrimaryName(res.wizardCSS()
+ .getImportSelectionSource());
+ radioWorkspaceDestination.setValue(true);
+
+
+ Radio radioFileDestination = new Radio();
+ radioFileDestination.setBoxLabel(""
+ + fileDestination.getName() + " "
+ + fileDestination.getDescription() + "
");
+ radioFileDestination.setName(fileDestination.getName());
+ radioFileDestination.setStylePrimaryName(res.wizardCSS()
+ .getImportSelectionSource());
+ radioFileDestination.disable();
+
+ destinationSelectionPanel.add(radioWorkspaceDestination);
+ destinationSelectionPanel.add(radioFileDestination);
+
+
+ // we can set name on radios or use toggle group
+ ToggleGroup toggle = new ToggleGroup();
+ toggle.add(radioWorkspaceDestination);
+ toggle.add(radioFileDestination);
+
+ toggle.addValueChangeHandler(new ValueChangeHandler>() {
+
+
+ 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(workspaceDestination.getName()) == 0) {
+ exportSession.setDestination(workspaceDestination);
+ } else {
+ if (radio.getName().compareTo(fileDestination.getName()) == 0) {
+ exportSession.setDestination(fileDestination);
+ } else {
+
+ }
+
+ }
+
+ } catch (Exception e) {
+ Log.error("ToggleGroup: onValueChange "
+ + e.getLocalizedMessage());
+ }
+
+ }
+ });
+
+ setContent(destinationSelectionPanel);
+
+ }
+
+ @Override
+ public void setup() {
+ Log.debug("Setup Card");
+ Command sayNextCard = new Command() {
+ public void execute() {
+ try {
+ String destinationId = exportSession.getDestination().getId();
+ if (destinationId == null || destinationId.isEmpty()) {
+ Log.error("JSON Export Source Id: " + destinationId);
+ } else {
+ if (destinationId.compareTo("File") == 0) {
+ Log.info("NextCard JSONDownloadFileCard");
+ DownloadFileCard downloadFileCard = new DownloadFileCard(
+ exportSession);
+ getWizardWindow().addCard(downloadFileCard);
+ getWizardWindow().nextCard();
+ } else {
+ if (destinationId.compareTo("Workspace") == 0) {
+ Log.info("NextCard JSONWorkspaceSelectionCard");
+ JSONWorkSpaceSelectionCard jsonWorkspaceSelectionCard = new JSONWorkSpaceSelectionCard(
+ exportSession);
+ getWizardWindow().addCard(
+ jsonWorkspaceSelectionCard);
+ getWizardWindow().nextCard();
+ } else {
+ Log.debug("No destination selected and no card loaded");
+ }
+ }
+ }
+ } catch (Exception e) {
+ Log.error("sayNextCard :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setNextButtonCommand(sayNextCard);
+
+ Command sayPreviousCard = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().previousCard();
+ getWizardWindow().removeCard(thisCard);
+ Log.info("Remove DestinationSelectionCard");
+ } catch (Exception e) {
+ Log.error("sayPreviousCard :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
+
+ setEnableBackButton(true);
+ setEnableNextButton(true);
+
+ }
+
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/DownloadFileCard.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/DownloadFileCard.java
new file mode 100644
index 0000000..6e46b25
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/DownloadFileCard.java
@@ -0,0 +1,62 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.jsonexportwidget.client;
+
+
+import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
+
+import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.Command;
+
+/**
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class DownloadFileCard extends WizardCard {
+ protected JSONExportSession exportSession;
+ protected DownloadFileCard thisCard;
+
+ public DownloadFileCard(final JSONExportSession exportSession) {
+ super("Download File", "");
+ this.thisCard = this;
+ this.exportSession = exportSession;
+
+
+
+ //setContent();
+
+ }
+
+ @Override
+ public void setup() {
+ Command sayNextCard = new Command() {
+
+ public void execute() {
+ }
+
+ };
+
+ getWizardWindow().setNextButtonCommand(sayNextCard);
+
+ Command sayPreviousCard = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().previousCard();
+ getWizardWindow().removeCard(thisCard);
+ Log.info("Remove DownloadFileCard");
+ } catch (Exception e) {
+ Log.error("sayPreviousCard :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
+ getWizardWindow().setEnableNextButton(false);
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportConfigCard.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportConfigCard.java
new file mode 100644
index 0000000..169f152
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportConfigCard.java
@@ -0,0 +1,178 @@
+package org.gcube.portlets.user.td.jsonexportwidget.client;
+
+import java.util.ArrayList;
+
+import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
+import org.gcube.portlets.user.td.jsonexportwidget.client.grid.ColumnDataGridPanel;
+import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.sencha.gxt.core.client.util.Padding;
+import com.sencha.gxt.core.client.util.ToggleGroup;
+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.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.FormPanel;
+import com.sencha.gxt.widget.core.client.form.Radio;
+import com.sencha.gxt.widget.core.client.tips.ToolTip;
+import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;
+
+/**
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class JSONExportConfigCard extends WizardCard {
+
+ private static final int LABEL_WIDTH = 128;
+ private static final int LABEL_PAD_WIDTH = 2;
+
+ protected JSONExportSession exportSession;
+
+
+
+ private Radio viewColumnExportTrue;
+ private Radio viewColumnExportFalse;
+
+ protected ColumnDataGridPanel jsonColumnGridPanel;
+
+ public JSONExportConfigCard(final JSONExportSession exportSession) {
+ super("JSON configuration", "");
+
+ if (exportSession == null) {
+ Log.error("JSONExportSession is null");
+ }
+ this.exportSession = exportSession;
+
+ FormPanel panel = createPanel();
+ setContent(panel);
+
+ }
+
+ protected FormPanel createPanel() {
+ FormPanel panel = new FormPanel();
+ panel.setLabelWidth(90);
+ panel.getElement().setPadding(new Padding(5));
+
+ VerticalLayoutContainer content = new VerticalLayoutContainer();
+ panel.add(content);
+
+ // Export View Column
+ viewColumnExportTrue = new Radio();
+ viewColumnExportTrue.setBoxLabel("True");
+ viewColumnExportTrue.setValue(true);
+
+ viewColumnExportFalse = new Radio();
+ viewColumnExportFalse.setBoxLabel("False");
+
+ ToggleGroup exportViewColumnGroup = new ToggleGroup();
+ exportViewColumnGroup.add(viewColumnExportTrue);
+ exportViewColumnGroup.add(viewColumnExportFalse);
+
+ HorizontalPanel viewColumnExportPanel = new HorizontalPanel();
+ viewColumnExportPanel.add(viewColumnExportTrue);
+ viewColumnExportPanel.add(viewColumnExportFalse);
+
+ new ToolTip(viewColumnExportPanel, new ToolTipConfig(
+ "Export View Columns Too"));
+ FieldLabel fieldViewColumns=new FieldLabel(viewColumnExportPanel, "Export View Columns");
+ fieldViewColumns.setLabelWidth(LABEL_WIDTH);
+ fieldViewColumns.setLabelPad(LABEL_PAD_WIDTH);
+ content.add(fieldViewColumns);
+
+ // Column Selection Grid
+ jsonColumnGridPanel = new ColumnDataGridPanel(this);
+
+ jsonColumnGridPanel
+ .addSelectionHandler(new SelectionHandler() {
+
+ public void onSelection(SelectionEvent event) {
+
+ }
+
+ });
+
+ content.add(jsonColumnGridPanel);
+
+ return panel;
+ }
+
+
+
+ protected boolean getExportViewColumns() {
+ if(viewColumnExportTrue.getValue()){
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public void setup() {
+ Log.debug("JSONExportConfigCard Setup");
+ Command sayNextCard = new Command() {
+
+ public void execute() {
+ Log.debug("JSONExportConfigCard Call sayNextCard");
+ checkData();
+ }
+
+ };
+
+ getWizardWindow().setNextButtonCommand(sayNextCard);
+ setEnableBackButton(false);
+ 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);
+
+ }
+ };
+
+ ArrayList columns = jsonColumnGridPanel.getSelectedItems();
+ if (columns.size() == 0) {
+ d = new AlertMessageBox("Attention", "No columns selected");
+ d.addHideHandler(hideHandler);
+ d.setModal(false);
+ d.show();
+ } else {
+ exportSession.setColumns(columns);
+ exportSession.setExportViewColumns(getExportViewColumns());
+ goNext();
+ }
+
+ }
+
+ protected void goNext() {
+ try {
+ DestinationSelectionCard destCard = new DestinationSelectionCard(
+ exportSession);
+ getWizardWindow().addCard(destCard);
+ getWizardWindow().nextCard();
+ } catch (Exception e) {
+ Log.error("sayNextCard :" + e.getLocalizedMessage());
+ }
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportWidgetTD.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportWidgetTD.java
new file mode 100644
index 0000000..41fa339
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportWidgetTD.java
@@ -0,0 +1,43 @@
+package org.gcube.portlets.user.td.jsonexportwidget.client;
+
+
+
+import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
+import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
+import com.google.web.bindery.event.shared.EventBus;
+
+
+
+/**
+ *
+ * @author giancarlo
+ * email: g.panichi@isti.cnr.it
+ *
+ */
+public class JSONExportWidgetTD extends WizardWindow {
+
+ protected JSONExportSession exportSession;
+
+
+
+ /**
+ *
+ * @param title
+ * @param eventBus
+ */
+ public JSONExportWidgetTD(String title, EventBus eventBus) {
+ super(title,eventBus);
+
+ exportSession= new JSONExportSession();
+
+ JSONExportConfigCard jsonExportConfigCard=new JSONExportConfigCard(exportSession);
+ addCard(jsonExportConfigCard);
+ jsonExportConfigCard.setup();
+
+
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportWidgetTDEntry.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportWidgetTDEntry.java
new file mode 100644
index 0000000..f758d4d
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONExportWidgetTDEntry.java
@@ -0,0 +1,15 @@
+package org.gcube.portlets.user.td.jsonexportwidget.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 JSONExportWidgetTDEntry implements EntryPoint {
+
+
+ public void onModuleLoad() {
+ SimpleEventBus eventBus=new SimpleEventBus();
+ JSONExportWidgetTD exportWizard= new JSONExportWidgetTD("CSVExport",eventBus);
+ Log.info(exportWizard.getId());
+ }
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONOperationInProgressCard.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONOperationInProgressCard.java
new file mode 100644
index 0000000..d168981
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONOperationInProgressCard.java
@@ -0,0 +1,283 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.jsonexportwidget.client;
+
+import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
+import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
+import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
+import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
+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 com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+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.container.BoxLayoutContainer.BoxLayoutData;
+import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
+import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer;
+import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign;
+
+/**
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class JSONOperationInProgressCard extends WizardCard implements
+ MonitorDialogListener {
+
+ protected JSONOperationInProgressCard thisCard;
+ protected JSONExportSession exportSession;
+ protected TRId newTrId;
+ protected HtmlLayoutContainer resultField;
+
+ public JSONOperationInProgressCard(final JSONExportSession exportSession) {
+ super("Operation In Progress", "");
+
+ this.exportSession = exportSession;
+ 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,
+ "Destination: ");
+ description.setText(0, 1, exportSession.getDestination().getName());
+ description.setHTML(1, 0,
+ "File Name: ");
+ description.setText(1, 1, exportSession.getFileName());
+
+ description.setHTML(2, 0,
+ "File Description: ");
+ description.setText(2, 1, exportSession.getFileDescription());
+
+ FramedPanel summary = new FramedPanel();
+ summary.setHeadingText("Export Summary");
+ summary.setWidth(400);
+ summary.add(description);
+ operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
+ 5, 10, 5)));
+
+ resultField = new HtmlLayoutContainer("
");
+
+ operationInProgressPanel.add(resultField, new BoxLayoutData(
+ new Margins(10, 5, 10, 5)));
+
+ setContent(operationInProgressPanel);
+ resultField.setVisible(false);
+
+ }
+
+ public void exportCSV() {
+ TDGWTServiceAsync.INSTANCE.startJSONExport(exportSession,
+ new AsyncCallback() {
+
+ public void onSuccess(String taskId) {
+ openMonitorDialog(taskId);
+
+ }
+
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ getEventBus()
+ .fireEvent(
+ new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ if (caught instanceof TDGWTIsLockedException) {
+ Log.error(caught.getLocalizedMessage());
+ showErrorAndHide("Error Locked",
+ caught.getLocalizedMessage(), caught);
+ } else {
+ showErrorAndHide("Error in export",
+ "An error occured in export: "
+ + caught.getLocalizedMessage(),
+ caught);
+
+ }
+ }
+ }
+ });
+ }
+
+ @Override
+ public void setup() {
+ getWizardWindow().setEnableBackButton(false);
+ setBackButtonVisible(false);
+ setNextButtonVisible(false);
+ getWizardWindow().setEnableNextButton(false);
+ getWizardWindow().setNextButtonToFinish();
+ exportCSV();
+ }
+
+ //
+ protected void openMonitorDialog(String taskId) {
+ MonitorDialog monitorDialog = new MonitorDialog(taskId, getEventBus());
+ monitorDialog.addProgressDialogListener(this);
+ monitorDialog.setBackgroundBtnEnabled(false);
+ monitorDialog.show();
+ }
+
+ @Override
+ public void operationComplete(TRId trId) {
+ newTrId = trId;
+ SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
+ safeHtmlBuilder
+ .appendHtmlConstant("Operation Completed
");
+ resultField.setHTML(safeHtmlBuilder.toSafeHtml());
+ resultField.setVisible(true);
+
+ Command sayComplete = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().close(false);
+ Log.info("fire Complete: " + newTrId);
+
+ getWizardWindow().fireCompleted(newTrId);
+
+ } catch (Exception e) {
+ Log.error("fire Complete :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setNextButtonCommand(sayComplete);
+
+ setNextButtonVisible(true);
+ getWizardWindow().setEnableNextButton(true);
+
+ forceLayout();
+
+ }
+
+ @Override
+ public void operationFailed(Throwable caught, String reason, String details) {
+ SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
+ safeHtmlBuilder
+ .appendHtmlConstant("Operation Failed
");
+ resultField.setHTML(safeHtmlBuilder.toSafeHtml());
+ resultField.setVisible(true);
+ if (caught instanceof TDGWTSessionExpiredException) {
+ getEventBus()
+ .fireEvent(
+ new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ showErrorAndHide("Error in Export",
+ reason,caught);
+ }
+
+ forceLayout();
+ }
+
+ @Override
+ public void operationStopped(TRId trId, String reason, String details) {
+ newTrId = trId;
+ SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
+ safeHtmlBuilder
+ .appendHtmlConstant("Problems in the Operation
");
+ resultField.setHTML(safeHtmlBuilder.toSafeHtml());
+ resultField.setVisible(true);
+
+ Command sayComplete = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().close(false);
+ Log.info("fire Complete: tabular resource "
+ + newTrId.getId());
+ Log.info("fire Complete: tableId " + newTrId.getTableId());
+
+ getWizardWindow().fireCompleted(newTrId);
+
+ } catch (Exception e) {
+ Log.error("fire Complete :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setNextButtonCommand(sayComplete);
+
+ setNextButtonVisible(true);
+ getWizardWindow().setEnableNextButton(true);
+
+ forceLayout();
+ }
+
+ @Override
+ public void operationAborted() {
+ SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
+ safeHtmlBuilder
+ .appendHtmlConstant("Operation Aborted
");
+ resultField.setHTML(safeHtmlBuilder.toSafeHtml());
+ resultField.setVisible(true);
+
+ Command sayComplete = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().close(false);
+ Log.info("fire Aborted");
+
+ getWizardWindow().fireAborted();
+
+ } catch (Exception e) {
+ Log.error("fire Aborted :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setNextButtonCommand(sayComplete);
+
+ setNextButtonVisible(true);
+ getWizardWindow().setEnableNextButton(true);
+ forceLayout();
+
+ }
+
+ @Override
+ public void operationPutInBackground() {
+ SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
+ safeHtmlBuilder
+ .appendHtmlConstant("Operation in Background
");
+ resultField.setHTML(safeHtmlBuilder.toSafeHtml());
+ resultField.setVisible(true);
+
+ Command sayComplete = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().close(false);
+ Log.info("fire Operation In Background");
+
+ getWizardWindow().firePutInBackground();
+
+ } catch (Exception e) {
+ Log.error("fire Operation In Background :"
+ + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setNextButtonCommand(sayComplete);
+
+ setNextButtonVisible(true);
+ getWizardWindow().setEnableNextButton(true);
+ forceLayout();
+
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONWorkSpaceSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONWorkSpaceSelectionCard.java
new file mode 100644
index 0000000..2e361e9
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/JSONWorkSpaceSelectionCard.java
@@ -0,0 +1,196 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.jsonexportwidget.client;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gcube.portlets.user.td.gwtservice.shared.json.JSONExportSession;
+import org.gcube.portlets.user.td.jsonexportwidget.client.workspace.WorkspacePanel;
+import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
+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.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.TextField;
+
+/**
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class JSONWorkSpaceSelectionCard extends WizardCard {
+
+ protected JSONExportSession exportSession;
+ protected JSONWorkSpaceSelectionCard thisCard;
+ protected TextField fileName;
+ protected TextField fileDescription;
+
+ protected Item item;
+ protected VerticalLayoutContainer p;
+ protected WorkspacePanel wpanel;
+
+ /**
+ *
+ * @param exportSession
+ */
+ public JSONWorkSpaceSelectionCard(final JSONExportSession exportSession) {
+ super("JSON Export in Workspace", "");
+
+ this.exportSession = exportSession;
+ thisCard = this;
+
+ FramedPanel formPanel = new FramedPanel();
+ formPanel.setHeaderVisible(false);
+ p = new VerticalLayoutContainer();
+ formPanel.setWidget(p);
+
+ fileName = new TextField();
+ fileName.setAllowBlank(false);
+ fileName.setWidth("410px");
+ fileName.setValue("filename.json");
+ p.add(new FieldLabel(fileName, "File Name"), new VerticalLayoutData(-1,
+ -1));
+
+ fileDescription = new TextField();
+ fileDescription.setAllowBlank(false);
+ fileDescription.setWidth("410px");
+ fileDescription.setValue("json");
+ p.add(new FieldLabel(fileDescription, "File Description"),
+ new VerticalLayoutData(-1, -1));
+
+ Log.debug("Set Workspace Panel");
+ wpanel = new WorkspacePanel();
+ wpanel.setSpWidth("410px");
+ wpanel.setSpHeight("330px");
+ List lItemType = new ArrayList();
+ lItemType.add(ItemType.ROOT);
+ lItemType.add(ItemType.FOLDER);
+ wpanel.setShowableTypes(lItemType);
+ wpanel.setSelectableTypes(lItemType);
+ wpanel.addSelectionHandler(new ItemSelectionHandler() {
+
+
+ public void onSelection(ItemSelectionEvent event) {
+ item = event.getSelectedItem();
+ Log.debug("Selected Item:" + item);
+ if (item.getType() == ItemType.FOLDER
+ || item.getType() == ItemType.ROOT) {
+ thisCard.exportSession.setItemId(item.getId());
+ } else {
+ thisCard.exportSession.setItemId(null);
+ Log.debug("Item type:" + item.getType());
+ }
+ }
+ });
+ p.add(new FieldLabel(wpanel, "Folder"), new VerticalLayoutData(-1, -1));
+ wpanel.loadTree();
+ setContent(formPanel);
+
+ }
+
+ protected void checkExportData() {
+ Log.debug("File Name:" + fileName.getCurrentValue() + " Item id: "
+ + exportSession.getItemId());
+ wpanel.disable();
+ fileName.disable();
+ getWizardWindow().setEnableNextButton(false);
+ getWizardWindow().setEnableBackButton(false);
+ AlertMessageBox d;
+ HideHandler hideHandler = new HideHandler() {
+
+ public void onHide(HideEvent event) {
+ wpanel.enable();
+ getWizardWindow().setEnableNextButton(true);
+ getWizardWindow().setEnableBackButton(true);
+ fileName.enable();
+ }
+ };
+ if (fileName.getCurrentValue() != null
+ && !fileName.getCurrentValue().isEmpty() && fileName.validate()) {
+ if (fileDescription.getCurrentValue() != null
+ && !fileDescription.getCurrentValue().isEmpty()
+ && fileDescription.validate()) {
+
+ if (exportSession.getItemId() != null) {
+ exportSession.setFileName(fileName.getCurrentValue());
+ exportSession.setFileDescription(fileDescription.getCurrentValue());
+ goNext();
+ } else {
+ d = new AlertMessageBox("Attetion",
+ "No folder selected");
+ d.addHideHandler(hideHandler);
+ d.setModal(false);
+ d.show();
+
+ }
+ } else {
+ d = new AlertMessageBox("Attention",
+ "No valid file description");
+ d.addHideHandler(hideHandler);
+ d.setModal(false);
+ d.show();
+
+ }
+ } else {
+ d = new AlertMessageBox("Attention", "No valid file name");
+ d.addHideHandler(hideHandler);
+ d.setModal(false);
+ d.show();
+ }
+
+ }
+
+ @Override
+ public void setup() {
+ Log.debug("JSONWorkSpaceSelectionCard Call Setup ");
+ Command sayNextCard = new Command() {
+
+ public void execute() {
+ Log.debug("JSONWorkSpaceSelectionCard Call sayNextCard wpanel:"
+ + wpanel);
+ checkExportData();
+ }
+
+ };
+
+ getWizardWindow().setNextButtonCommand(sayNextCard);
+
+ Command sayPreviousCard = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().previousCard();
+ getWizardWindow().removeCard(thisCard);
+ Log.debug("Remove JSONWorkSpaceSelectionCard");
+ } catch (Exception e) {
+ Log.error("sayPreviousCard :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
+ getWizardWindow().setEnableNextButton(true);
+
+ }
+
+ protected void goNext() {
+ JSONOperationInProgressCard jsonOperationInProgressCard = new JSONOperationInProgressCard(exportSession);
+ getWizardWindow().addCard(jsonOperationInProgressCard);
+ Log.info("NextCard CSVOperationInProgressCard");
+ getWizardWindow().nextCard();
+
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/grid/ColumnDataGridPanel.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/grid/ColumnDataGridPanel.java
new file mode 100644
index 0000000..5669671
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/grid/ColumnDataGridPanel.java
@@ -0,0 +1,179 @@
+package org.gcube.portlets.user.td.jsonexportwidget.client.grid;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
+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 com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.google.gwt.event.logical.shared.HasSelectionHandlers;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.sencha.gxt.core.client.IdentityValueProvider;
+import com.sencha.gxt.core.client.Style.SelectionMode;
+import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
+import com.sencha.gxt.core.client.util.Margins;
+import com.sencha.gxt.data.client.loader.RpcProxy;
+import com.sencha.gxt.data.shared.ListStore;
+import com.sencha.gxt.data.shared.loader.ListLoadConfig;
+import com.sencha.gxt.data.shared.loader.ListLoadResult;
+import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
+import com.sencha.gxt.data.shared.loader.ListLoader;
+import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
+import com.sencha.gxt.widget.core.client.ContentPanel;
+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.grid.CheckBoxSelectionModel;
+import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
+import com.sencha.gxt.widget.core.client.grid.ColumnModel;
+import com.sencha.gxt.widget.core.client.grid.Grid;
+
+/**
+ *
+ * @author giancarlo
+ * email: g.panichi@isti.cnr.it
+ *
+ */
+public class ColumnDataGridPanel extends ContentPanel implements
+ HasSelectionHandlers {
+ //private static final String GRID_WIDTH ="524px";
+ private static final String GRID_HEIGHT = "280px";
+ protected static final ColumnDataProperties props = GWT
+ .create(ColumnDataProperties.class);
+ protected final CheckBoxSelectionModel sm;
+
+ protected final Grid grid;
+ private WizardCard parent;
+
+ /**
+ *
+ * @param parent
+ */
+ public ColumnDataGridPanel(WizardCard parent) {
+ this.parent=parent;
+ Log.debug("ColumnDataGridPanel");
+ setHeadingText("Columns");
+
+ ColumnConfig labelCol = new ColumnConfig(
+ props.label());
+
+ IdentityValueProvider identity = new IdentityValueProvider();
+
+ sm = new CheckBoxSelectionModel(identity);
+
+ List> l = new ArrayList>();
+ l.add(sm.getColumn());
+ l.add(labelCol);
+ ColumnModel cm = new ColumnModel(l);
+
+ ListStore store = new ListStore(props.id());
+
+ RpcProxy> proxy = new RpcProxy>() {
+
+ public void load(ListLoadConfig loadConfig,
+ final AsyncCallback> callback) {
+ loadData(loadConfig, callback);
+ }
+ };
+ final ListLoader> loader = new ListLoader>(
+ proxy);
+
+ loader.setRemoteSort(false);
+ loader.addLoadHandler(new LoadResultListStoreBinding>(
+ store) {
+ });
+
+ grid = new Grid(store, cm) {
+ @Override
+ protected void onAfterFirstAttach() {
+ super.onAfterFirstAttach();
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+
+ public void execute() {
+ loader.load();
+ }
+ });
+ }
+ };
+
+ sm.setSelectionMode(SelectionMode.MULTI);
+ grid.setLoader(loader);
+ grid.setSelectionModel(sm);
+ grid.setHeight(GRID_HEIGHT);
+ //grid.setWidth(GRID_WIDTH);
+ // grid.getView().setAutoExpandColumn(labelCol);
+ grid.getView().setStripeRows(true);
+ grid.getView().setColumnLines(true);
+ grid.getView().setAutoFill(true);
+ grid.setBorders(false);
+ grid.setLoadMask(true);
+ grid.setColumnReordering(false);
+
+ VerticalLayoutContainer con = new VerticalLayoutContainer();
+ con.setScrollMode(ScrollMode.AUTO);
+ con.add(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
+ setWidget(con);
+
+ }
+
+ public Grid getGrid() {
+ return grid;
+ }
+
+ protected void loadData(ListLoadConfig loadConfig,
+ final AsyncCallback> callback) {
+ TDGWTServiceAsync.INSTANCE
+ .getColumns(new AsyncCallback>() {
+
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ parent.getEventBus()
+ .fireEvent(
+ new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ if (caught instanceof TDGWTIsLockedException) {
+ Log.error(caught.getLocalizedMessage());
+ parent.showErrorAndHide("Error Locked",
+ caught.getLocalizedMessage(), caught);
+ } else {
+
+ Log.error("No load columns: "
+ + caught.getLocalizedMessage());
+ }
+ }
+ callback.onFailure(caught);
+ }
+
+ public void onSuccess(ArrayList result) {
+ Log.trace("loaded " + result.size() + " columns");
+ callback.onSuccess(new ListLoadResultBean(
+ result));
+ sm.selectAll();
+ forceLayout();
+ }
+ });
+ }
+
+ public ArrayList getSelectedItems() {
+ return new ArrayList(grid.getSelectionModel()
+ .getSelectedItems());
+
+ }
+
+ public HandlerRegistration addSelectionHandler(
+ SelectionHandler handler) {
+ return grid.getSelectionModel().addSelectionHandler(handler);
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/grid/ColumnDataProperties.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/grid/ColumnDataProperties.java
new file mode 100644
index 0000000..6c06ff1
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/grid/ColumnDataProperties.java
@@ -0,0 +1,29 @@
+package org.gcube.portlets.user.td.jsonexportwidget.client.grid;
+
+import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
+
+import com.google.gwt.editor.client.Editor.Path;
+import com.sencha.gxt.core.client.ValueProvider;
+import com.sencha.gxt.data.shared.ModelKeyProvider;
+import com.sencha.gxt.data.shared.PropertyAccess;
+
+/**
+ *
+ * @author giancarlo
+ * email: g.panichi@isti.cnr.it
+ *
+ */
+public interface ColumnDataProperties extends
+ PropertyAccess {
+
+ @Path("id")
+ ModelKeyProvider id();
+
+ ValueProvider label();
+
+ //ValueProvider typeName();
+
+ //ValueProvider typeCode();
+
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/workspace/WorkspacePanel.java b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/workspace/WorkspacePanel.java
new file mode 100644
index 0000000..f0a7c66
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/jsonexportwidget/client/workspace/WorkspacePanel.java
@@ -0,0 +1,53 @@
+package org.gcube.portlets.user.td.jsonexportwidget.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;
+
+/**
+ *
+ * @author giancarlo
+ * email: g.panichi@isti.cnr.it
+ *
+ */
+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();
+ }
+
+}
diff --git a/src/main/resources/org/gcube/portlets/user/td/jsonexportwidget/JSONExportWidgetTD.gwt.xml b/src/main/resources/org/gcube/portlets/user/td/jsonexportwidget/JSONExportWidgetTD.gwt.xml
new file mode 100644
index 0000000..95b2f58
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/jsonexportwidget/JSONExportWidgetTD.gwt.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/org/gcube/portlets/user/td/jsonexportwidget/client/Messages.properties b/src/main/resources/org/gcube/portlets/user/td/jsonexportwidget/client/Messages.properties
new file mode 100644
index 0000000..c222555
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/jsonexportwidget/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/jsonexportwidget/client/Messages_fr.properties b/src/main/resources/org/gcube/portlets/user/td/jsonexportwidget/client/Messages_fr.properties
new file mode 100644
index 0000000..b4a7627
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/jsonexportwidget/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/JSONExportWidgetTD.css b/src/main/webapp/JSONExportWidgetTD.css
new file mode 100644
index 0000000..7aca7ac
--- /dev/null
+++ b/src/main/webapp/JSONExportWidgetTD.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/JSONExportWidgetTD.html b/src/main/webapp/JSONExportWidgetTD.html
new file mode 100644
index 0000000..fd0007e
--- /dev/null
+++ b/src/main/webapp/JSONExportWidgetTD.html
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Web Application Starter Project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Your web browser must have JavaScript enabled
+ in order for this application to display correctly.
+
+
+
+ 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..7bec410
--- /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
+ JSONExportWidget/junithost/*
+
+
+
+
+ JSONExportWidgetTD.html
+
+
+
diff --git a/src/test/java/org/gcube/portlets/user/td/jsonexportwidget/client/GwtTestJSONExportWidgetTD.java b/src/test/java/org/gcube/portlets/user/td/jsonexportwidget/client/GwtTestJSONExportWidgetTD.java
new file mode 100644
index 0000000..a1fa217
--- /dev/null
+++ b/src/test/java/org/gcube/portlets/user/td/jsonexportwidget/client/GwtTestJSONExportWidgetTD.java
@@ -0,0 +1,83 @@
+package org.gcube.portlets.user.td.jsonexportwidget.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 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 GwtTestJSONExportWidgetTD extends GWTTestCase {
+
+ /**
+ * Must refer to a valid module that sources this class.
+ */
+ public String getModuleName() {
+ return "org.gcube.portlets.user.jsonexportwidget.JSONExportWidgetTDJUnit";
+ }
+
+ /**
+ * 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>() {
+
+
+ public void onFailure(Throwable caught) {
+ // The request resulted in an unexpected error.
+ fail("Request failure: " + caught.getMessage());
+
+ }
+
+
+ public void onSuccess(ArrayList 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/jsonexportwidget/JSONExportWidgetTDJUnit.gwt.xml b/src/test/resources/org/gcube/portlets/user/td/jsonexportwidget/JSONExportWidgetTDJUnit.gwt.xml
new file mode 100644
index 0000000..75ea135
--- /dev/null
+++ b/src/test/resources/org/gcube/portlets/user/td/jsonexportwidget/JSONExportWidgetTDJUnit.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..07cb684
--- /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..19ed5bc
--- /dev/null
+++ b/templates/profile.xml
@@ -0,0 +1,29 @@
+
+
+
+ Service
+
+ ${project.description}
+ PortletsUser
+ ${project.name}
+ ${version}
+
+
+ ${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