Minor Update

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@95854 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-20 12:36:38 +00:00
parent 87eec9c809
commit 7f9db52c2f
1 changed files with 34 additions and 22 deletions

View File

@ -52,6 +52,7 @@ import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus;
@ -106,12 +107,10 @@ public class TabularDataController {
// if you do not need to something when the session expire
CheckSession.getInstance().startPolling();
}
protected void sessionExpiredShow(){
protected void sessionExpiredShow() {
CheckSession.showLogoutDialog();
}
/**
* @return the eventBus
@ -146,8 +145,9 @@ public class TabularDataController {
@Override
public void onFailure(Throwable caught) {
Log.info("No valid user found: " + caught.getMessage());
if(caught instanceof TDGWTSessionExpiredException){
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
if (caught instanceof TDGWTSessionExpiredException) {
UtilsGXT3.alert("Error", "No user found");
sessionExpiredShowDelayed();
} else {
UtilsGXT3.alert("Error", "No user found");
}
@ -163,12 +163,26 @@ public class TabularDataController {
}
protected void sessionExpiredShowDelayed() {
Timer timeoutTimer = new Timer() {
public void run() {
sessionExpiredShow();
}
};
int TIMEOUT = 5; // 3 second timeout
timeoutTimer.schedule(TIMEOUT * 1000); // timeout is in milliseconds
}
// Bind Controller to events on bus
protected void bindToEvents() {
eventBus.addHandler(
SessionExpiredEvent.TYPE,
eventBus.addHandler(SessionExpiredEvent.TYPE,
new SessionExpiredEvent.SessionExpiredEventHandler() {
@Override
public void onSessionExpired(SessionExpiredEvent event) {
Log.debug("Catch Event SessionExpiredEvent");
@ -176,7 +190,7 @@ public class TabularDataController {
}
});
eventBus.addHandler(
GridHeaderColumnMenuItemEvent.TYPE,
new GridHeaderColumnMenuItemEvent.GridHeaderColumnMenuItemEventHandler() {
@ -566,7 +580,7 @@ public class TabularDataController {
public void onSuccess() {
openWizard();
SDMXImportWizardTD importWizard = new SDMXImportWizardTD(
"SDMX Import",eventBus);
"SDMX Import", eventBus);
importWizard.addListener(new WizardListener() {
public void completed(TRId tabularResourceId) {
@ -601,7 +615,7 @@ public class TabularDataController {
public void onSuccess() {
openWizard();
CSVExportWizardTD exportWizard = new CSVExportWizardTD(
"CSV Export",eventBus);
"CSV Export", eventBus);
exportWizard.addListener(new WizardListener() {
public void failed(Throwable throwable, String reason,
@ -636,7 +650,7 @@ public class TabularDataController {
public void onSuccess() {
openWizard();
SDMXExportWizardTD exportWizard = new SDMXExportWizardTD(
"SDMX Export",eventBus);
"SDMX Export", eventBus);
exportWizard.addListener(new WizardListener() {
public void failed(Throwable throwable, String reason,
@ -675,7 +689,7 @@ public class TabularDataController {
public void onSuccess() {
openWizard();
TDOpen tdOpen = new TDOpen("Open Tabular Resource",eventBus);
TDOpen tdOpen = new TDOpen("Open Tabular Resource", eventBus);
tdOpen.addListener(new WizardListener() {
@ -712,7 +726,7 @@ public class TabularDataController {
public void onSuccess() {
openWizard();
CSVImportWizardTD importWizard = new CSVImportWizardTD(
"CSV Import",eventBus);
"CSV Import", eventBus);
importWizard.addListener(new WizardListener() {
@ -1036,15 +1050,13 @@ public class TabularDataController {
}
}
protected void doSessionExpiredCommand(SessionExpiredEvent event){
Log.debug("Session Expired Event: "+ event.getSessionExpiredType());
protected void doSessionExpiredCommand(SessionExpiredEvent event) {
Log.debug("Session Expired Event: " + event.getSessionExpiredType());
sessionExpiredShow();
}
protected void doGridHeaderColumnMenuCommand(
GridHeaderColumnMenuItemEvent event) {
Log.debug("GridHeaderColumnMenu Fire Event",