Updated on stop of the tasks
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-export-widget@92508 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ce493a3b4e
commit
1f9f1c46f9
16
.classpath
16
.classpath
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/tabular-data-sdmx-export-widget-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<classpathentry kind="src" output="target/tabular-data-sdmx-export-widget-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry excluding="**" kind="src" output="target/tabular-data-sdmx-export-widget-1.0.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<classpathentry excluding="**" kind="src" output="target/tabular-data-sdmx-export-widget-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
|
@ -23,16 +23,16 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/tabular-data-sdmx-export-widget-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
<classpathentry kind="output" path="target/tabular-data-sdmx-export-widget-1.1.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</classpath>
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -13,7 +13,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.gcube.portlets.user</groupId>
|
||||
<artifactId>tabular-data-sdmx-export-widget</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<version>1.1.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
<name>tabular-data-sdmx-export-widget</name>
|
||||
|
|
|
@ -67,7 +67,6 @@ public class AgenciesSelectionPanel extends ContentPanel implements HasSelection
|
|||
protected ResourceBundle res;
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public AgenciesSelectionPanel(ResourceBundle res)
|
||||
{
|
||||
this.res=res;
|
||||
|
|
|
@ -68,7 +68,6 @@ public class CodelistSelectionPanel extends ContentPanel implements HasSelection
|
|||
protected ResourceBundle res;
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public CodelistSelectionPanel(ResourceBundle res)
|
||||
{
|
||||
this.res=res;
|
||||
|
|
|
@ -61,7 +61,6 @@ public class DatasetSelectionPanel extends ContentPanel implements HasSelectionH
|
|||
|
||||
protected Grid<Dataset> grid;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public DatasetSelectionPanel()
|
||||
{
|
||||
setHeaderVisible(false);
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
*/
|
||||
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.sdmxexportwidget.client.progress.SDMXExportProgressBarUpdater;
|
||||
import org.gcube.portlets.user.td.sdmxexportwidget.client.progress.SDMXExportProgressListener;
|
||||
import org.gcube.portlets.user.td.sdmxexportwidget.client.progress.SDMXExportProgressUpdater;
|
||||
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;
|
||||
|
@ -25,8 +25,6 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
|
|||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
|
@ -34,7 +32,7 @@ import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
|||
*
|
||||
*/
|
||||
public class SDMXOperationInProgressCard extends WizardCard implements
|
||||
SDMXExportProgressListener {
|
||||
SDMXExportProgressListener {
|
||||
|
||||
public static final int STATUS_POLLING_DELAY = 1000;
|
||||
protected SDMXOperationInProgressCard thisCard;
|
||||
|
@ -47,18 +45,18 @@ SDMXExportProgressListener {
|
|||
this.exportSession = exportSession;
|
||||
thisCard = this;
|
||||
String urlRegistry;
|
||||
if(exportSession.getRegistryBaseUrl()==null||
|
||||
exportSession.getRegistryBaseUrl().isEmpty()){
|
||||
urlRegistry="Internal";
|
||||
if (exportSession.getRegistryBaseUrl() == null
|
||||
|| exportSession.getRegistryBaseUrl().isEmpty()) {
|
||||
urlRegistry = "Internal";
|
||||
} else {
|
||||
urlRegistry=exportSession.getRegistryBaseUrl();
|
||||
urlRegistry = exportSession.getRegistryBaseUrl();
|
||||
}
|
||||
|
||||
|
||||
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
||||
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
|
||||
|
||||
final FlexTable description = new FlexTable();
|
||||
//FlexCellFormatter cellFormatter = description.getFlexCellFormatter();
|
||||
// FlexCellFormatter cellFormatter = description.getFlexCellFormatter();
|
||||
description.setCellSpacing(10);
|
||||
description.setCellPadding(4);
|
||||
description.setBorderWidth(0);
|
||||
|
@ -67,7 +65,7 @@ SDMXExportProgressListener {
|
|||
description.setHTML(0, 0,
|
||||
"<span style=\"font-weight:bold;\";>Destination: </span>");
|
||||
description.setText(0, 1, exportSession.getSource().getName());
|
||||
|
||||
|
||||
description.setHTML(1, 0,
|
||||
"<span style=\"font-weight:bold;\";>Id: </span>");
|
||||
description.setText(1, 1, exportSession.getId());
|
||||
|
@ -76,7 +74,6 @@ SDMXExportProgressListener {
|
|||
"<span style=\"font-weight:bold;\";>Agency: </span>");
|
||||
description.setText(2, 1, exportSession.getAgencyName());
|
||||
|
||||
|
||||
description.setHTML(3, 0,
|
||||
"<span style=\"font-weight:bold;\";>Registry: </span>");
|
||||
description.setText(3, 1, urlRegistry);
|
||||
|
@ -84,8 +81,7 @@ SDMXExportProgressListener {
|
|||
description.setHTML(4, 0,
|
||||
"<span style=\"font-weight:bold;\";>Version: </span>");
|
||||
description.setText(4, 1, exportSession.getVersion());
|
||||
|
||||
|
||||
|
||||
FramedPanel summary = new FramedPanel();
|
||||
summary.setHeadingText("Export Summary");
|
||||
summary.setWidth(400);
|
||||
|
@ -98,26 +94,31 @@ SDMXExportProgressListener {
|
|||
new Margins(10, 5, 10, 5)));
|
||||
|
||||
progressUpdater = new SDMXExportProgressUpdater();
|
||||
progressUpdater.addListener(new SDMXExportProgressBarUpdater(progressBar));
|
||||
progressUpdater.addListener(new SDMXExportProgressBarUpdater(
|
||||
progressBar));
|
||||
|
||||
progressUpdater.addListener(this);
|
||||
|
||||
setContent(operationInProgressPanel);
|
||||
|
||||
}
|
||||
//columnToImportMask
|
||||
|
||||
// columnToImportMask
|
||||
|
||||
public void exportSDMX() {
|
||||
TDGWTServiceAsync.INSTANCE.startSDMXExport(exportSession, new AsyncCallback<Void>() {
|
||||
TDGWTServiceAsync.INSTANCE.startSDMXExport(exportSession,
|
||||
new AsyncCallback<Void>() {
|
||||
|
||||
|
||||
public void onSuccess(Void result) {
|
||||
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
|
||||
}
|
||||
|
||||
public void onFailure(Throwable caught) {
|
||||
showErrorAndHide("Error in exportSDMX",
|
||||
"An error occured in exportSDMX: "+caught.getLocalizedMessage(), caught.getStackTrace().toString(), caught);
|
||||
showErrorAndHide(
|
||||
"Error in exportSDMX",
|
||||
"An error occured in exportSDMX: "
|
||||
+ caught.getLocalizedMessage(), caught
|
||||
.getStackTrace().toString(), caught);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -173,4 +174,28 @@ SDMXExportProgressListener {
|
|||
d.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId, String reason, String details) {
|
||||
// final String tableId,final String tableResourceId) {
|
||||
|
||||
Command sayComplete = new Command() {
|
||||
public void execute() {
|
||||
try {
|
||||
getWizardWindow().close(false);
|
||||
Log.info("fire Complete");
|
||||
getWizardWindow().fireCompleted(null);
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.error("fire Complete :" + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
getWizardWindow().setNextButtonCommand(sayComplete);
|
||||
|
||||
setNextButtonVisible(true);
|
||||
getWizardWindow().setEnableNextButton(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@ package org.gcube.portlets.user.td.sdmxexportwidget.client.progress;
|
|||
|
||||
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||
|
||||
|
@ -33,7 +35,7 @@ public class SDMXExportProgressBarUpdater implements SDMXExportProgressListener
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void operationComplete() {
|
||||
Log.info("Export completed");
|
||||
progressBar.updateProgress(1, "Export completed.");
|
||||
|
@ -43,16 +45,19 @@ public class SDMXExportProgressBarUpdater implements SDMXExportProgressListener
|
|||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails) {
|
||||
Log.info("Export failed");
|
||||
progressBar.updateText("Export failed.");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void operationInitializing() {
|
||||
Log.info("Export Inizializing");
|
||||
progressBar.updateProgress(0, "Initializing...");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationUpdate(float elaborated) {
|
||||
Log.info("Export elaborated: "+elaborated);
|
||||
if (elaborated == 0) progressBar.updateProgress(0, "Initializing...");
|
||||
|
@ -64,5 +69,12 @@ public class SDMXExportProgressBarUpdater implements SDMXExportProgressListener
|
|||
if (elaborated == 1) progressBar.updateProgress(1, "Completing...");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void operationStopped(TRId trId,String reason, String details) {
|
||||
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
|
||||
progressBar.updateText("Stopped");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.td.sdmxexportwidget.client.progress;
|
||||
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -38,4 +40,14 @@ public interface SDMXExportProgressListener {
|
|||
* @param reason the failure reason.
|
||||
*/
|
||||
public void operationFailed(Throwable caught, String reason, String failureDetails);
|
||||
|
||||
/**
|
||||
* Called when the operation is stopped
|
||||
*
|
||||
* @param trId
|
||||
* @param reason
|
||||
* @param details
|
||||
*/
|
||||
public void operationStopped(TRId trId, String reason, String details);
|
||||
|
||||
}
|
||||
|
|
|
@ -7,13 +7,11 @@ import java.util.ArrayList;
|
|||
|
||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportMonitor;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -69,7 +67,7 @@ public class SDMXExportProgressUpdater extends Timer {
|
|||
break;
|
||||
case STOPPED:
|
||||
cancel();
|
||||
errorMessage(result);
|
||||
stopMessage(result);
|
||||
break;
|
||||
case SUCCEDED:
|
||||
cancel();
|
||||
|
@ -103,11 +101,23 @@ public class SDMXExportProgressUpdater extends Timer {
|
|||
details = "Error in export";
|
||||
}
|
||||
fireOperationFailed(th, failure, details);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void stopMessage(SDMXExportMonitor result) {
|
||||
Log.info("SDMX Export Stopped");
|
||||
String failure = null;
|
||||
String details = null;
|
||||
if (result.getError() != null) {
|
||||
failure = "Stopped";
|
||||
details = result.getError().getLocalizedMessage();
|
||||
} else {
|
||||
failure = "Stopped";
|
||||
details = "Stopped export SDMX";
|
||||
}
|
||||
|
||||
fireOperationStopped(result.getTrId(),failure, details);
|
||||
}
|
||||
|
||||
protected String getStack(Throwable e) {
|
||||
String message = e.getLocalizedMessage() + " -> <br>";
|
||||
Throwable c = e.getCause();
|
||||
|
@ -136,6 +146,11 @@ public class SDMXExportProgressUpdater extends Timer {
|
|||
for (SDMXExportProgressListener listener : listeners)
|
||||
listener.operationFailed(caught, failure, failureDetails);
|
||||
}
|
||||
|
||||
protected void fireOperationStopped(TRId trId, String reason, String details) {
|
||||
for (SDMXExportProgressListener listener : listeners)
|
||||
listener.operationStopped(trId,reason, details);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new {@link SDMXExportProgressListener} to this
|
||||
|
|
Loading…
Reference in New Issue