From 88ac6d02f2519b61076a571632cb3e079c2da93f Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Fri, 16 May 2014 14:09:30 +0000 Subject: [PATCH] Added SessionExpiredShow git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-information-widget@95791 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/TabularResourceProperties.java | 74 +++++++++++-------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java b/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java index 70404f2..8b1a575 100644 --- a/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java +++ b/src/main/java/org/gcube/portlets/user/td/informationwidget/client/TabularResourceProperties.java @@ -3,13 +3,16 @@ package org.gcube.portlets.user.td.informationwidget.client; import java.util.HashMap; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; +import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException; import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; import org.gcube.portlets.user.td.informationwidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.informationwidget.client.util.InfoMessageBox; import org.gcube.portlets.user.td.metadatawidget.client.TRMetadataAccordionPanel; import org.gcube.portlets.user.td.metadatawidget.client.TableMetadataAccordionPanel; +import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.event.WidgetRequestEvent; +import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType; import org.gcube.portlets.user.td.widgetcommonevent.client.type.WidgetRequestType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; @@ -150,11 +153,11 @@ public class TabularResourceProperties extends FramedPanel { } }; validationsButton.addSelectHandler(validationsHandler); - - HBoxLayoutContainer hBox=new HBoxLayoutContainer(); - hBox.add(saveButton, new BoxLayoutData(new Margins(2,5,2,5))); - hBox.add(validationsButton,new BoxLayoutData(new Margins(2,5,2,5))); - + + HBoxLayoutContainer hBox = new HBoxLayoutContainer(); + hBox.add(saveButton, new BoxLayoutData(new Margins(2, 5, 2, 5))); + hBox.add(validationsButton, new BoxLayoutData(new Margins(2, 5, 2, 5))); + layoutTabularResource.add(hBox, new VerticalLayoutData(-1, -1, new Margins(2))); @@ -230,19 +233,23 @@ public class TabularResourceProperties extends FramedPanel { } public void onFailure(Throwable caught) { - AlertMessageBox d = new AlertMessageBox("Error", - "Error retrienving properties: " - + caught.getLocalizedMessage()); - d.addHideHandler(new HideHandler() { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + AlertMessageBox d = new AlertMessageBox("Error", + "Error retrienving properties: " + + caught.getLocalizedMessage()); + d.addHideHandler(new HideHandler() { - public void onHide(HideEvent event) { - // + public void onHide(HideEvent event) { + // - } - - }); - d.show(); + } + }); + d.show(); + } } }); @@ -259,19 +266,23 @@ public class TabularResourceProperties extends FramedPanel { } public void onFailure(Throwable caught) { - AlertMessageBox d = new AlertMessageBox("Error", - "Error retrienving Last Table: " - + caught.getLocalizedMessage()); - d.addHideHandler(new HideHandler() { + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + AlertMessageBox d = new AlertMessageBox("Error", + "Error retrienving Last Table: " + + caught.getLocalizedMessage()); + d.addHideHandler(new HideHandler() { - public void onHide(HideEvent event) { - // + public void onHide(HideEvent event) { + // - } - - }); - d.show(); + } + }); + d.show(); + } } }); @@ -309,11 +320,16 @@ public class TabularResourceProperties extends FramedPanel { new AsyncCallback() { public void onFailure(Throwable caught) { - Log.debug("Error Setting Tabular Resoruce Properties: " - + caught.getLocalizedMessage()); - alert("Error", - "Error setting tabular resource properties"); + if (caught instanceof TDGWTSessionExpiredException) { + eventBus.fireEvent(new SessionExpiredEvent( + SessionExpiredType.EXPIREDONSERVER)); + } else { + Log.debug("Error Setting Tabular Resoruce Properties: " + + caught.getLocalizedMessage()); + alert("Error", + "Error setting tabular resource properties"); + } } public void onSuccess(Void result) {