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;
@ -21,43 +25,55 @@ import com.sencha.gxt.widget.core.client.box.AutoProgressMessageBox;
public class SDMXExportWizardTD extends WizardWindow { 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
*/ */
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",
box.setProgressText("Retrieving..."); "Retrive Tabular Resource Information, please wait...");
box.auto(); box.setProgressText("Retrieving...");
box.show(); box.auto();
box.show();
TDGWTServiceAsync.INSTANCE TDGWTServiceAsync.INSTANCE
.getTabResourceInformation(new AsyncCallback<TabResource>() { .getTabResourceInformation(new AsyncCallback<TabResource>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("No Tabular Resource Information retrived from server " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
box.hide(); SessionExpiredType.EXPIREDONSERVER));
fireFailed(caught, "Error retrieving tabular resource information: "+ caught.getLocalizedMessage(), caught.toString()); } else {
close(false); 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) { public void onSuccess(TabResource result) {
Log.debug("Tabular Resource Information retrived"); Log.debug("Tabular Resource Information retrived");
exportSession.setTabResource(result); exportSession.setTabResource(result);
box.hide(); box.hide();
} }
}); });

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",
"An error occured in exportSDMX: " caught.getLocalizedMessage(), caught);
+ caught.getLocalizedMessage(), } else {
caught.getStackTrace().toString(), caught); showErrorAndHide("Error in exportSDMX",
"An error occured in exportSDMX: "
+ caught.getLocalizedMessage(),
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();
} }
@ -279,7 +276,7 @@ public class SDMXOperationInProgressCard extends WizardCard implements
Log.info("fire Operation In Background"); Log.info("fire Operation In Background");
getWizardWindow().firePutInBackground(); getWizardWindow().firePutInBackground();
} catch (Exception e) { } catch (Exception e) {
Log.error("fire Operation In Background :" Log.error("fire Operation In Background :"
+ e.getLocalizedMessage()); + e.getLocalizedMessage());

View File

@ -156,8 +156,10 @@ public class SDMXRegistrySelectionCard extends WizardCard {
new SessionExpiredEvent( new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER)); SessionExpiredType.EXPIREDONSERVER));
} 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);
} }
} }