diff --git a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXAgenciesSelectionCard.java b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXAgenciesSelectionCard.java
index c831d54..2652f50 100644
--- a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXAgenciesSelectionCard.java
+++ b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXAgenciesSelectionCard.java
@@ -7,6 +7,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.type.Agencies;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.Command;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
@@ -49,12 +51,12 @@ public class SDMXAgenciesSelectionCard extends WizardCard {
@Override
public void setup(){
- /*Command sayNextCard = new Command() {
+ Command sayNextCard = new Command() {
@Override
public void execute() {
SDMXTableDetailCard sdmxTableDetailCard = new SDMXTableDetailCard(
- importSession);
+ exportSession);
getWizardWindow()
.addCard(sdmxTableDetailCard);
Log.info("NextCard SDMXTableDetailCard");
@@ -72,7 +74,7 @@ public class SDMXAgenciesSelectionCard extends WizardCard {
try {
getWizardWindow().previousCard();
getWizardWindow().removeCard(thisCard);
- Log.info("Remove SDMXCodelistSelectionCard");
+ Log.info("Remove SDMXAgenciesSelectionCard");
} catch (Exception e) {
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
}
@@ -81,7 +83,7 @@ public class SDMXAgenciesSelectionCard extends WizardCard {
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
getWizardWindow().setEnableNextButton(false);
- */
+
}
}
diff --git a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXExportWizardTD.java b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXExportWizardTD.java
index 0d6cf98..128f4ac 100644
--- a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXExportWizardTD.java
+++ b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXExportWizardTD.java
@@ -1,39 +1,75 @@
package org.gcube.portlets.user.td.sdmxexportwidget.client;
+import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
+
/**
*
- * @author "Giancarlo Panichi"
- * g.panichi@isti.cnr.it
- *
- * Entry point classes define onModuleLoad()
.
- *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ * Entry point classes define onModuleLoad()
.
+ *
*/
-public class SDMXExportWizardTD extends WizardWindow {
+public class SDMXExportWizardTD extends WizardWindow {
protected SDMXExportSession exportSession;
-
-
+
/**
* The id of the {@link CSVTarget} to use.
+ *
* @param targetId
*/
-
- public SDMXExportWizardTD(String title) {
+
+ public SDMXExportWizardTD(String title) {
super(title);
setWidth(550);
setHeight(520);
- exportSession= new SDMXExportSession();
- SDMXRegistrySelectionCard sdmxRegistrySelectionCard=new SDMXRegistrySelectionCard(exportSession);
+ exportSession = new SDMXExportSession();
+
+ final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait", "Retrive Tabular Resource Information, please wait...");
+ box.setProgressText("Retrieving...");
+ box.auto();
+ box.show();
+
+
+ TDGWTServiceAsync.INSTANCE
+ .getTabResourceInformation(new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ Log.error("No Tabular Resource Information retrived from server "
+ + caught.getLocalizedMessage());
+ box.hide();
+ fireFailed(caught, "Error retrieving tabular resource information: "+ caught.getLocalizedMessage(), caught.toString());
+ close(false);
+ }
+
+ @Override
+ public void onSuccess(TabResource result) {
+ Log.debug("Tabular Resource Information retrived");
+ exportSession.setTabResource(result);
+ box.hide();
+ startCardLoad();
+
+ }
+ });
+
+ }
+
+ protected void startCardLoad() {
+ SDMXRegistrySelectionCard sdmxRegistrySelectionCard = new SDMXRegistrySelectionCard(
+ exportSession);
addCard(sdmxRegistrySelectionCard);
sdmxRegistrySelectionCard.setup();
-
-
}
-
-
+
}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXOperationInProgressCard.java b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXOperationInProgressCard.java
index 4479c55..9d3a9cd 100644
--- a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXOperationInProgressCard.java
+++ b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXOperationInProgressCard.java
@@ -5,7 +5,6 @@ package org.gcube.portlets.user.td.sdmxexportwidget.client;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
-import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
import org.gcube.portlets.user.td.sdmxexportwidget.client.progress.SDMXExportProgressBarUpdater;
import org.gcube.portlets.user.td.sdmxexportwidget.client.progress.SDMXExportProgressListener;
@@ -58,14 +57,23 @@ SDMXExportProgressListener {
description.setHTML(0, 0,
"Destination: ");
description.setText(0, 1, exportSession.getSource().getName());
+
description.setHTML(1, 0,
- "Agency: ");
- description.setText(1, 1, exportSession.getAgency().getNameLabel());
+ "Id: ");
+ description.setText(1, 1, exportSession.getId());
description.setHTML(2, 0,
- "Tabular Resource: ");
- description.setText(2, 1, exportSession.getTabResource().getName());
+ "Agency: ");
+ description.setText(2, 1, exportSession.getAgencyName());
+ description.setHTML(3, 0,
+ "Registry: ");
+ description.setText(3, 1, exportSession.getRegistryBaseUrl());
+
+ description.setHTML(4, 0,
+ "Version: ");
+ description.setText(4, 1, exportSession.getVersion());
+
FramedPanel summary = new FramedPanel();
summary.setHeadingText("Export Summary");
@@ -132,8 +140,7 @@ SDMXExportProgressListener {
public void execute() {
try {
getWizardWindow().close(false);
- Log.info("fire Complete: tableId");
-
+ Log.info("fire Complete");
getWizardWindow().fireCompleted(null);
} catch (Exception e) {
diff --git a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXRegistrySelectionCard.java b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXRegistrySelectionCard.java
index 93ed739..24080dd 100644
--- a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXRegistrySelectionCard.java
+++ b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXRegistrySelectionCard.java
@@ -170,6 +170,24 @@ public class SDMXRegistrySelectionCard extends WizardCard {
};
getWizardWindow().setNextButtonCommand(sayNextCard);
+
+ Command sayPreviousCard = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().previousCard();
+ getWizardWindow().removeCard(thisCard);
+ Log.info("Remove SDMXRegistrySelectionCard");
+ } catch (Exception e) {
+ Log.error("sayPreviousCard :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
+
+ setEnableBackButton(true);
+ setEnableNextButton(true);
+
}
protected void goNext() {
diff --git a/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXTableDetailCard.java b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXTableDetailCard.java
new file mode 100644
index 0000000..6a4b134
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/sdmxexportwidget/client/SDMXTableDetailCard.java
@@ -0,0 +1,194 @@
+/**
+ *
+ */
+package org.gcube.portlets.user.td.sdmxexportwidget.client;
+
+import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession;
+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.user.client.Command;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.sencha.gxt.widget.core.client.FramedPanel;
+import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
+import com.sencha.gxt.widget.core.client.button.TextButton;
+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.FieldSet;
+import com.sencha.gxt.widget.core.client.form.TextField;
+
+/**
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class SDMXTableDetailCard extends WizardCard {
+
+ protected final String TABLEDETAILPANELWIDTH = "100%";
+ protected final String TABLEDETAILPANELHEIGHT = "100%";
+ protected final String FORMWIDTH = "538px";
+
+ protected SDMXExportSession exportSession;
+ protected SDMXTableDetailCard thisCard;
+
+ protected static final AgenciesProperties agenciesProperties = GWT
+ .create(AgenciesProperties.class);
+ protected VerticalLayoutContainer p = new VerticalLayoutContainer();
+ protected VerticalPanel tableDetailPanel;
+
+ protected TextField id;
+ protected TextField agencyName;
+ protected TextField registryBaseUrl;
+ protected TextField version;
+
+
+ protected TextButton checkButton;
+
+
+
+ public SDMXTableDetailCard(final SDMXExportSession exportSession) {
+ super("SDMX Table Detail", "");
+
+ this.exportSession = exportSession;
+ thisCard = this;
+
+ tableDetailPanel = new VerticalPanel();
+
+ tableDetailPanel.setSpacing(4);
+ tableDetailPanel.setWidth(TABLEDETAILPANELWIDTH);
+ tableDetailPanel.setHeight(TABLEDETAILPANELHEIGHT);
+
+ FramedPanel form = new FramedPanel();
+ form.setHeadingText("Details");
+ form.setWidth(FORMWIDTH);
+
+ FieldSet fieldSet = new FieldSet();
+ fieldSet.setHeadingText("Information");
+ fieldSet.setCollapsible(false);
+ form.add(fieldSet);
+
+ fieldSet.add(p);
+
+ id = new TextField();
+ id.setAllowBlank(false);
+ id.setEmptyText("Enter Id...");
+ id.setValue(exportSession.getTabResource().getName());
+ p.add(new FieldLabel(id, "Id"), new VerticalLayoutData(1, -1));
+
+
+ agencyName = new TextField();
+ agencyName.setVisible(true);
+ agencyName.setEmptyText("Enter Agency...");
+ agencyName.setValue(exportSession.getAgency().getName());
+ FieldLabel agencyNameLabel = new FieldLabel(agencyName, "Agency");
+ agencyNameLabel.setLabelSeparator("");
+ p.add(agencyNameLabel, new VerticalLayoutData(1, -1));
+
+
+ registryBaseUrl = new TextField();
+ registryBaseUrl.setVisible(true);
+ registryBaseUrl.setEmptyText("Enter Registry URL...");
+ registryBaseUrl.setValue(exportSession.getAgency().getName());
+ FieldLabel registryBaseUrlLabel = new FieldLabel(registryBaseUrl, "Registry URL");
+ registryBaseUrlLabel.setLabelSeparator("");
+ p.add(registryBaseUrlLabel, new VerticalLayoutData(1, -1));
+
+ version = new TextField();
+ version.setAllowBlank(false);
+ version.setEmptyText("Enter Version...");
+ version.setValue(exportSession.getTabResource().getName());
+ p.add(new FieldLabel(version, "Version"), new VerticalLayoutData(1, -1));
+
+
+ tableDetailPanel.add(form);
+ setContent(tableDetailPanel);
+
+ }
+
+
+ @Override
+ public void setup() {
+ Command sayNextCard = new Command() {
+
+ @Override
+ public void execute() {
+ checkData();
+ }
+
+ };
+
+ getWizardWindow().setNextButtonCommand(sayNextCard);
+
+ Command sayPreviousCard = new Command() {
+ public void execute() {
+ try {
+ getWizardWindow().previousCard();
+ getWizardWindow().removeCard(thisCard);
+ Log.info("Remove SDMXTableDetailCard");
+ } catch (Exception e) {
+ Log.error("sayPreviousCard :" + e.getLocalizedMessage());
+ }
+ }
+ };
+
+ getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
+ getWizardWindow().setEnableNextButton(true);
+
+ }
+
+ protected void checkData() {
+ getWizardWindow().setEnableNextButton(false);
+ getWizardWindow().setEnableBackButton(false);
+ AlertMessageBox d;
+ HideHandler hideHandler = new HideHandler() {
+
+ @Override
+ public void onHide(HideEvent event) {
+ getWizardWindow().setEnableNextButton(true);
+ getWizardWindow().setEnableBackButton(false);
+
+ }
+ };
+
+ if (id.getValue() == null || id.getValue().isEmpty()
+ || !id.isValid() || registryBaseUrl.getValue() == null
+ || registryBaseUrl.getValue().isEmpty() || !registryBaseUrl.isValid()
+ || version.getValue() == null || version.getValue().isEmpty()
+ || !version.isValid() || agencyName.getValue() == null
+ || agencyName.getValue().isEmpty() || !agencyName.isValid()) {
+
+ d = new AlertMessageBox("Attention!", "Fill in all fields");
+ d.addHideHandler(hideHandler);
+ d.show();
+ } else {
+ id.setReadOnly(true);
+ registryBaseUrl.setReadOnly(true);
+ version.setReadOnly(true);
+ agencyName.setReadOnly(true);
+ goNext();
+ }
+
+ }
+
+ protected void goNext() {
+ try {
+ exportSession.setId(id.getCurrentValue());
+ exportSession.setAgencyName(agencyName.getCurrentValue());
+ exportSession.setVersion(version.getCurrentValue());
+ exportSession.setRegistryBaseUrl(registryBaseUrl.getCurrentValue());
+ SDMXOperationInProgressCard sdmxOperationInProgressCard = new SDMXOperationInProgressCard(
+ exportSession);
+ getWizardWindow().addCard(sdmxOperationInProgressCard);
+ Log.info("NextCard SDMXOperationInProgressCard");
+ getWizardWindow().nextCard();
+ } catch (Exception e) {
+ Log.error("sayNextCard :" + e.getLocalizedMessage());
+ }
+ }
+
+}