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
This commit is contained in:
Giancarlo Panichi 2014-05-16 14:09:30 +00:00
parent 3cb2f887ed
commit 88ac6d02f2
1 changed files with 45 additions and 29 deletions

View File

@ -3,13 +3,16 @@ package org.gcube.portlets.user.td.informationwidget.client;
import java.util.HashMap; import java.util.HashMap;
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.TDGWTSessionExpiredException;
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.gwtservice.shared.tr.TableData; 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.resources.ResourceBundle;
import org.gcube.portlets.user.td.informationwidget.client.util.InfoMessageBox; 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.TRMetadataAccordionPanel;
import org.gcube.portlets.user.td.metadatawidget.client.TableMetadataAccordionPanel; 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.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.client.type.WidgetRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
@ -150,11 +153,11 @@ public class TabularResourceProperties extends FramedPanel {
} }
}; };
validationsButton.addSelectHandler(validationsHandler); validationsButton.addSelectHandler(validationsHandler);
HBoxLayoutContainer hBox=new HBoxLayoutContainer(); HBoxLayoutContainer hBox = new HBoxLayoutContainer();
hBox.add(saveButton, new BoxLayoutData(new Margins(2,5,2,5))); hBox.add(saveButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
hBox.add(validationsButton,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, layoutTabularResource.add(hBox, new VerticalLayoutData(-1, -1,
new Margins(2))); new Margins(2)));
@ -230,19 +233,23 @@ public class TabularResourceProperties extends FramedPanel {
} }
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
AlertMessageBox d = new AlertMessageBox("Error", if (caught instanceof TDGWTSessionExpiredException) {
"Error retrienving properties: " eventBus.fireEvent(new SessionExpiredEvent(
+ caught.getLocalizedMessage()); SessionExpiredType.EXPIREDONSERVER));
d.addHideHandler(new HideHandler() { } 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) { public void onFailure(Throwable caught) {
AlertMessageBox d = new AlertMessageBox("Error", if (caught instanceof TDGWTSessionExpiredException) {
"Error retrienving Last Table: " eventBus.fireEvent(new SessionExpiredEvent(
+ caught.getLocalizedMessage()); SessionExpiredType.EXPIREDONSERVER));
d.addHideHandler(new HideHandler() { } 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<Void>() { new AsyncCallback<Void>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.debug("Error Setting Tabular Resoruce Properties: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
alert("Error", SessionExpiredType.EXPIREDONSERVER));
"Error setting tabular resource properties"); } else {
Log.debug("Error Setting Tabular Resoruce Properties: "
+ caught.getLocalizedMessage());
alert("Error",
"Error setting tabular resource properties");
}
} }
public void onSuccess(Void result) { public void onSuccess(Void result) {