Added SessionExpiredShow

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-sdmx-import-widget@95790 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-16 14:04:49 +00:00 committed by Giancarlo Panichi
parent a2445f9ab6
commit ca68d2872a
8 changed files with 90 additions and 21 deletions

View File

@ -8,7 +8,11 @@ import java.util.Arrays;
import java.util.List;
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.type.Codelist;
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.WizardCard;
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
@ -67,11 +71,13 @@ public class CodelistSelectionPanel extends ContentPanel implements HasSelection
protected Grid<Codelist> grid;
protected ResourceBundle res;
private WizardCard parent;
@SuppressWarnings("unchecked")
public CodelistSelectionPanel(ResourceBundle res)
public CodelistSelectionPanel(WizardCard parent,ResourceBundle res)
{
this.parent=parent;
this.res=res;
setHeaderVisible(false);
new Resizable(this, Dir.E, Dir.SE, Dir.S);
@ -186,6 +192,16 @@ public class CodelistSelectionPanel extends ContentPanel implements HasSelection
TDGWTServiceAsync.INSTANCE.getCodelists(new AsyncCallback<ArrayList<Codelist>>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
parent.getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("No codelists retrieved");
}
callback.onFailure(caught);
}

View File

@ -8,8 +8,12 @@ import java.util.Arrays;
import java.util.List;
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.type.Dataset;
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.WizardCard;
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
@ -61,10 +65,16 @@ public class DatasetSelectionPanel extends ContentPanel implements HasSelectionH
protected static final ColumnConfig<Dataset, String> descriptionColumn = new ColumnConfig<Dataset, String>(properties.description(), 50, "Description");
protected Grid<Dataset> grid;
private WizardCard parent;
@SuppressWarnings("unused")
private ResourceBundle res;
@SuppressWarnings("unchecked")
public DatasetSelectionPanel()
public DatasetSelectionPanel(WizardCard parent, ResourceBundle res)
{
this.parent=parent;
this.res=res;
setHeaderVisible(false);
new Resizable(this, Dir.E, Dir.SE, Dir.S);
buildPanel(properties.key(), Arrays.<ColumnConfig<Dataset, ?>>asList(nameColumn, agencyIdColumn, versionColumn, descriptionColumn), nameColumn);
@ -161,6 +171,14 @@ public class DatasetSelectionPanel extends ContentPanel implements HasSelectionH
TDGWTServiceAsync.INSTANCE.getDatasets(new AsyncCallback<ArrayList<Dataset>>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
parent.getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("No datases retrieved");
}
callback.onFailure(caught);
}

View File

@ -30,7 +30,7 @@ public class SDMXCodelistSelectionCard extends WizardCard {
this.importSession = importSession;
thisCard=this;
this.codelistSelectionPanel=new CodelistSelectionPanel(res);
this.codelistSelectionPanel=new CodelistSelectionPanel(thisCard,res);
codelistSelectionPanel.addSelectionHandler(new SelectionHandler<Codelist>() {

View File

@ -29,7 +29,7 @@ public class SDMXDatasetSelectionCard extends WizardCard {
thisCard=this;
this.datasetSelectionPanel=new DatasetSelectionPanel();
this.datasetSelectionPanel=new DatasetSelectionPanel(thisCard,res);
setContent(datasetSelectionPanel);

View File

@ -3,6 +3,8 @@ package org.gcube.portlets.user.td.sdmximportwidget.client;
import org.gcube.portlets.user.td.gwtservice.shared.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
import com.google.web.bindery.event.shared.EventBus;
@ -20,8 +22,8 @@ public class SDMXImportWizardTD extends WizardWindow {
* @param targetId
*/
public SDMXImportWizardTD(String title) {
super(title);
public SDMXImportWizardTD(String title,EventBus eventBus) {
super(title,eventBus);
setWidth(550);
setHeight(520);

View File

@ -4,12 +4,14 @@ package org.gcube.portlets.user.td.sdmximportwidget.client;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.web.bindery.event.shared.SimpleEventBus;
public class SDMXImportWizardTDEntry implements EntryPoint {
public void onModuleLoad() {
SDMXImportWizardTD importWizard= new SDMXImportWizardTD("SDMXImport");
SimpleEventBus eventBus=new SimpleEventBus();
SDMXImportWizardTD importWizard= new SDMXImportWizardTD("SDMXImport",eventBus);
Log.info(importWizard.getId());
}
}

View File

@ -4,8 +4,11 @@
package org.gcube.portlets.user.td.sdmximportwidget.client;
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.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
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.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import org.gcube.portlets.user.td.sdmximportwidget.client.progress.ImportProgressBarUpdater;
@ -144,8 +147,17 @@ public class SDMXOperationInProgressCard extends WizardCard implements
}
public void onFailure(Throwable caught) {
showErrorAndHide("Error in importSDMX",
"An error occured in importSDMX", "", caught);
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
showErrorAndHide("Error in importSDMX",
"An error occured in importSDMX", "",
caught);
}
}
});
}
@ -194,15 +206,23 @@ public class SDMXOperationInProgressCard extends WizardCard implements
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
AlertMessageBox d = new AlertMessageBox("Error in SDMX Import", reason);
d.addHideHandler(new HideHandler() {
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
AlertMessageBox d = new AlertMessageBox("Error in SDMX Import",
reason);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
//
}
public void onHide(HideEvent event) {
//
}
});
d.show();
});
d.show();
}
}
@Override
@ -234,13 +254,13 @@ public class SDMXOperationInProgressCard extends WizardCard implements
@Override
public void operationGeneratingView() {
// TODO Auto-generated method stub
}
@Override
public void operationValidate(float elaborated) {
// TODO Auto-generated method stub
}
}

View File

@ -4,8 +4,11 @@
package org.gcube.portlets.user.td.sdmximportwidget.client;
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.sdmx.SDMXImportSession;
import org.gcube.portlets.user.td.gwtservice.shared.source.SDMXRegistrySource;
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.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
@ -146,8 +149,16 @@ public class SDMXRegistrySelectionCard extends WizardCard {
((SDMXRegistrySource)importSession.getSource()), new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("SDMXImportSession do not stored "
+ caught.getLocalizedMessage());
}
}
public void onSuccess(Void result) {