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 7a0c00b..ee65cf3 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,8 +1,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.exception.TDGWTIsLockedException; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; 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.widgetcommonevent.client.event.SessionExpiredEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow; import com.allen_sauer.gwt.log.client.Log; @@ -21,43 +25,55 @@ import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox; public class SDMXExportWizardTD extends WizardWindow { protected SDMXExportSession exportSession; - + /** * The id of the {@link CSVTarget} to use. * * @param targetId */ - public SDMXExportWizardTD(String title,EventBus eventBus) { - super(title,eventBus); + public SDMXExportWizardTD(String title, final EventBus eventBus) { + super(title, eventBus); setWidth(550); setHeight(520); - - + exportSession = new SDMXExportSession(); - - final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait", "Retrive Tabular Resource Information, please wait..."); - box.setProgressText("Retrieving..."); - box.auto(); - box.show(); - + + final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait", + "Retrive Tabular Resource Information, please wait..."); + box.setProgressText("Retrieving..."); + box.auto(); + box.show(); + TDGWTServiceAsync.INSTANCE .getTabResourceInformation(new AsyncCallback() { - 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); + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + showErrorAndHide("Error Locked", + caught.getLocalizedMessage(), caught); + } else { + Log.error("No Tabular Resource Information retrived from server " + + caught.getLocalizedMessage()); + box.hide(); + showErrorAndHide("Error", + "Error retrieving tabular resource information: " + + caught.getLocalizedMessage(), + caught); + } + } } public void onSuccess(TabResource result) { Log.debug("Tabular Resource Information retrived"); exportSession.setTabResource(result); box.hide(); - + } }); 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 13b0482..41d263f 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 @@ -4,6 +4,7 @@ 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.exception.TDGWTIsLockedException; import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXExportSession; import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog; @@ -20,13 +21,10 @@ 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.box.AlertMessageBox; 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; -import com.sencha.gxt.widget.core.client.event.HideEvent; -import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler; /** * @@ -120,12 +118,16 @@ public class SDMXOperationInProgressCard extends WizardCard implements new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - - showErrorAndHide( - "Error in exportSDMX", - "An error occured in exportSDMX: " - + caught.getLocalizedMessage(), - caught.getStackTrace().toString(), caught); + if (caught instanceof TDGWTIsLockedException) { + Log.error(caught.getLocalizedMessage()); + showErrorAndHide("Error Locked", + caught.getLocalizedMessage(), caught); + } else { + showErrorAndHide("Error in exportSDMX", + "An error occured in exportSDMX: " + + caught.getLocalizedMessage(), + caught); + } } } }); @@ -191,13 +193,8 @@ public class SDMXOperationInProgressCard extends WizardCard implements new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - AlertMessageBox d = new AlertMessageBox("Error in SDMX Export", - reason); - d.addHideHandler(new HideHandler() { - public void onHide(HideEvent event) { - } - }); - d.show(); + showErrorAndHide("Error in SDMX Export", + reason,caught); } forceLayout(); } @@ -279,7 +276,7 @@ public class SDMXOperationInProgressCard extends WizardCard implements Log.info("fire Operation In Background"); getWizardWindow().firePutInBackground(); - + } catch (Exception e) { Log.error("fire Operation In Background :" + e.getLocalizedMessage()); 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 fb12855..0989643 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 @@ -156,8 +156,10 @@ public class SDMXRegistrySelectionCard extends WizardCard { new SessionExpiredEvent( SessionExpiredType.EXPIREDONSERVER)); } else { - Log.error("SDMXRegistrySource do not stored " + Log.error("SDMXRegistrySource do not stored " + caught.getLocalizedMessage()); + showErrorAndHide("Error", "SDMXRegistrySource do not stored " + + caught.getLocalizedMessage(), caught); } }