Fixed Final and Lock error

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-export-widget@100234 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-26 15:49:37 +00:00 committed by Giancarlo Panichi
parent dc076f3994
commit 87e603628c
3 changed files with 51 additions and 36 deletions

View File

@ -1,8 +1,12 @@
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.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.sdmx.SDMXExportSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; 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 org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -28,15 +32,15 @@ public class SDMXExportWizardTD extends WizardWindow {
* @param targetId * @param targetId
*/ */
public SDMXExportWizardTD(String title,EventBus eventBus) { public SDMXExportWizardTD(String title, final EventBus eventBus) {
super(title,eventBus); super(title, eventBus);
setWidth(550); setWidth(550);
setHeight(520); setHeight(520);
exportSession = new SDMXExportSession(); exportSession = new SDMXExportSession();
final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait", "Retrive Tabular Resource Information, please wait..."); final AutoProgressMessageBox box = new AutoProgressMessageBox("Wait",
"Retrive Tabular Resource Information, please wait...");
box.setProgressText("Retrieving..."); box.setProgressText("Retrieving...");
box.auto(); box.auto();
box.show(); box.show();
@ -44,13 +48,25 @@ public class SDMXExportWizardTD extends WizardWindow {
TDGWTServiceAsync.INSTANCE TDGWTServiceAsync.INSTANCE
.getTabResourceInformation(new AsyncCallback<TabResource>() { .getTabResourceInformation(new AsyncCallback<TabResource>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
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 " Log.error("No Tabular Resource Information retrived from server "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
box.hide(); box.hide();
fireFailed(caught, "Error retrieving tabular resource information: "+ caught.getLocalizedMessage(), caught.toString()); showErrorAndHide("Error",
close(false); "Error retrieving tabular resource information: "
+ caught.getLocalizedMessage(),
caught);
}
}
} }
public void onSuccess(TabResource result) { public void onSuccess(TabResource result) {

View File

@ -4,6 +4,7 @@
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.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.exception.TDGWTSessionExpiredException;
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.monitorwidget.client.MonitorDialog; 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.google.gwt.user.client.ui.FlexTable;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel; 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.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer; 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;
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign; 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( new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
if (caught instanceof TDGWTIsLockedException) {
showErrorAndHide( Log.error(caught.getLocalizedMessage());
"Error in exportSDMX", showErrorAndHide("Error Locked",
caught.getLocalizedMessage(), caught);
} else {
showErrorAndHide("Error in exportSDMX",
"An error occured in exportSDMX: " "An error occured in exportSDMX: "
+ caught.getLocalizedMessage(), + caught.getLocalizedMessage(),
caught.getStackTrace().toString(), caught); caught);
}
} }
} }
}); });
@ -191,13 +193,8 @@ public class SDMXOperationInProgressCard extends WizardCard implements
new SessionExpiredEvent( new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} else { } else {
AlertMessageBox d = new AlertMessageBox("Error in SDMX Export", showErrorAndHide("Error in SDMX Export",
reason); reason,caught);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
} }
forceLayout(); forceLayout();
} }

View File

@ -158,6 +158,8 @@ public class SDMXRegistrySelectionCard extends WizardCard {
} else { } else {
Log.error("SDMXRegistrySource do not stored " Log.error("SDMXRegistrySource do not stored "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
showErrorAndHide("Error", "SDMXRegistrySource do not stored "
+ caught.getLocalizedMessage(), caught);
} }
} }