Update SDMX Export
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-export-widget@86561 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b9ef689fb0
commit
a74e9acc71
|
@ -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.gwtservice.shared.tr.type.Agencies;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
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.SelectionEvent;
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
|
|
||||||
|
@ -49,12 +51,12 @@ public class SDMXAgenciesSelectionCard extends WizardCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup(){
|
public void setup(){
|
||||||
/*Command sayNextCard = new Command() {
|
Command sayNextCard = new Command() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
SDMXTableDetailCard sdmxTableDetailCard = new SDMXTableDetailCard(
|
SDMXTableDetailCard sdmxTableDetailCard = new SDMXTableDetailCard(
|
||||||
importSession);
|
exportSession);
|
||||||
getWizardWindow()
|
getWizardWindow()
|
||||||
.addCard(sdmxTableDetailCard);
|
.addCard(sdmxTableDetailCard);
|
||||||
Log.info("NextCard SDMXTableDetailCard");
|
Log.info("NextCard SDMXTableDetailCard");
|
||||||
|
@ -72,7 +74,7 @@ public class SDMXAgenciesSelectionCard extends WizardCard {
|
||||||
try {
|
try {
|
||||||
getWizardWindow().previousCard();
|
getWizardWindow().previousCard();
|
||||||
getWizardWindow().removeCard(thisCard);
|
getWizardWindow().removeCard(thisCard);
|
||||||
Log.info("Remove SDMXCodelistSelectionCard");
|
Log.info("Remove SDMXAgenciesSelectionCard");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
@ -81,7 +83,7 @@ public class SDMXAgenciesSelectionCard extends WizardCard {
|
||||||
|
|
||||||
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(false);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
package org.gcube.portlets.user.td.sdmxexportwidget.client;
|
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.sdmx.SDMXExportSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
|
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"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
* Entry point classes define <code>onModuleLoad()</code>.
|
* Entry point classes define <code>onModuleLoad()</code>.
|
||||||
*
|
*
|
||||||
|
@ -15,9 +21,9 @@ public class SDMXExportWizardTD extends WizardWindow {
|
||||||
|
|
||||||
protected SDMXExportSession exportSession;
|
protected SDMXExportSession exportSession;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The id of the {@link CSVTarget} to use.
|
* The id of the {@link CSVTarget} to use.
|
||||||
|
*
|
||||||
* @param targetId
|
* @param targetId
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -26,14 +32,44 @@ public class SDMXExportWizardTD extends WizardWindow {
|
||||||
setWidth(550);
|
setWidth(550);
|
||||||
setHeight(520);
|
setHeight(520);
|
||||||
|
|
||||||
|
|
||||||
exportSession = new SDMXExportSession();
|
exportSession = new SDMXExportSession();
|
||||||
|
|
||||||
SDMXRegistrySelectionCard sdmxRegistrySelectionCard=new SDMXRegistrySelectionCard(exportSession);
|
final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait", "Retrive Tabular Resource Information, please wait...");
|
||||||
|
box.setProgressText("Retrieving...");
|
||||||
|
box.auto();
|
||||||
|
box.show();
|
||||||
|
|
||||||
|
|
||||||
|
TDGWTServiceAsync.INSTANCE
|
||||||
|
.getTabResourceInformation(new AsyncCallback<TabResource>() {
|
||||||
|
|
||||||
|
@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);
|
addCard(sdmxRegistrySelectionCard);
|
||||||
sdmxRegistrySelectionCard.setup();
|
sdmxRegistrySelectionCard.setup();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -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.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.gwtservice.shared.sdmx.SDMXExportSession;
|
||||||
import org.gcube.portlets.user.td.sdmxexportwidget.client.progress.SDMXExportProgressBarUpdater;
|
import org.gcube.portlets.user.td.sdmxexportwidget.client.progress.SDMXExportProgressBarUpdater;
|
||||||
import org.gcube.portlets.user.td.sdmxexportwidget.client.progress.SDMXExportProgressListener;
|
import org.gcube.portlets.user.td.sdmxexportwidget.client.progress.SDMXExportProgressListener;
|
||||||
|
@ -58,13 +57,22 @@ SDMXExportProgressListener {
|
||||||
description.setHTML(0, 0,
|
description.setHTML(0, 0,
|
||||||
"<span style=\"font-weight:bold;\";>Destination: </span>");
|
"<span style=\"font-weight:bold;\";>Destination: </span>");
|
||||||
description.setText(0, 1, exportSession.getSource().getName());
|
description.setText(0, 1, exportSession.getSource().getName());
|
||||||
|
|
||||||
description.setHTML(1, 0,
|
description.setHTML(1, 0,
|
||||||
"<span style=\"font-weight:bold;\";>Agency: </span>");
|
"<span style=\"font-weight:bold;\";>Id: </span>");
|
||||||
description.setText(1, 1, exportSession.getAgency().getNameLabel());
|
description.setText(1, 1, exportSession.getId());
|
||||||
|
|
||||||
description.setHTML(2, 0,
|
description.setHTML(2, 0,
|
||||||
"<span style=\"font-weight:bold;\";>Tabular Resource: </span>");
|
"<span style=\"font-weight:bold;\";>Agency: </span>");
|
||||||
description.setText(2, 1, exportSession.getTabResource().getName());
|
description.setText(2, 1, exportSession.getAgencyName());
|
||||||
|
|
||||||
|
description.setHTML(3, 0,
|
||||||
|
"<span style=\"font-weight:bold;\";>Registry: </span>");
|
||||||
|
description.setText(3, 1, exportSession.getRegistryBaseUrl());
|
||||||
|
|
||||||
|
description.setHTML(4, 0,
|
||||||
|
"<span style=\"font-weight:bold;\";>Version: </span>");
|
||||||
|
description.setText(4, 1, exportSession.getVersion());
|
||||||
|
|
||||||
|
|
||||||
FramedPanel summary = new FramedPanel();
|
FramedPanel summary = new FramedPanel();
|
||||||
|
@ -132,8 +140,7 @@ SDMXExportProgressListener {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
try {
|
try {
|
||||||
getWizardWindow().close(false);
|
getWizardWindow().close(false);
|
||||||
Log.info("fire Complete: tableId");
|
Log.info("fire Complete");
|
||||||
|
|
||||||
getWizardWindow().fireCompleted(null);
|
getWizardWindow().fireCompleted(null);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -170,6 +170,24 @@ public class SDMXRegistrySelectionCard extends WizardCard {
|
||||||
};
|
};
|
||||||
|
|
||||||
getWizardWindow().setNextButtonCommand(sayNextCard);
|
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() {
|
protected void goNext() {
|
||||||
|
|
|
@ -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" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue