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;
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<TabResource>() {
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();
}
});

View File

@ -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());

View File

@ -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);
}
}