Added SessionExpiredShow

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-open-widget@95785 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-16 13:42:51 +00:00 committed by Giancarlo Panichi
parent 4269155a7b
commit 1a91e67836
4 changed files with 41 additions and 23 deletions

View File

@ -4,6 +4,7 @@ import org.gcube.portlets.user.td.wizardwidget.client.WizardWindow;
import org.gcube.portlets.user.td.gwtservice.shared.tr.open.TDOpenSession;
import com.allen_sauer.gwt.log.client.Log;
import com.google.web.bindery.event.shared.EventBus;
/**
*
@ -20,8 +21,8 @@ public class TDOpen extends WizardWindow {
* @param targetId
*/
public TDOpen(String title) {
super(title);
public TDOpen(String title,EventBus eventBus) {
super(title,eventBus);
Log.info("TDOpen: "+title);
setWidth(550);
setHeight(520);

View File

@ -4,6 +4,7 @@ package org.gcube.portlets.user.td.openwidget.client;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
import com.google.web.bindery.event.shared.SimpleEventBus;
/**
*
@ -15,7 +16,8 @@ public class TDOpenEntry implements EntryPoint {
public void onModuleLoad() {
TDOpen tdopen= new TDOpen("Open Tabular Resource");
SimpleEventBus eventBus=new SimpleEventBus();
TDOpen tdopen= new TDOpen("Open Tabular Resource",eventBus);
Log.info(tdopen.getId());
}
}

View File

@ -41,7 +41,7 @@ public class TabResourcesSelectionCard extends WizardCard {
this.tdOpenSession = tdOpenSession;
thisCard = this;
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(res);
tabResourcesSelectionPanel = new TabResourcesSelectionPanel(thisCard,res);
// tabResourcesSelectionPanel.setResize(false);
// tabResourcesSelectionPanel.setSize(GRIDWIDTH, GRIDHEIGHT);

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.TabResource;
import org.gcube.portlets.user.td.openwidget.client.resources.ResourceBundleTDOpen;
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;
@ -86,8 +90,11 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
private TabResource removableTR;
public TabResourcesSelectionPanel(ResourceBundle res) {
private WizardCard parent;
public TabResourcesSelectionPanel(WizardCard parent, ResourceBundle res) {
this.res = res;
this.parent = parent;
Log.debug("TabResourcesSelectionPanel");
init();
try {
@ -97,12 +104,12 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
e.printStackTrace();
}
try {
buildPanel(properties.id(),
Arrays.<ColumnConfig<TabResource, ?>> asList(nameColumn,
typeColumn, agencyColumn, dateColumn), nameColumn);
} catch(Throwable e){
Log.debug("Error building panel:"+e.getMessage());
buildPanel(properties.id(),
Arrays.<ColumnConfig<TabResource, ?>> asList(nameColumn,
typeColumn, agencyColumn, dateColumn), nameColumn);
} catch (Throwable e) {
Log.debug("Error building panel:" + e.getMessage());
e.printStackTrace();
}
}
@ -260,19 +267,27 @@ public class TabResourcesSelectionPanel extends ContentPanel implements
.getTabularResources(new AsyncCallback<ArrayList<TabResource>>() {
public void onFailure(Throwable caught) {
Log.debug("Error retrieving tabular resource: "
+ caught.getLocalizedMessage());
if (caught instanceof TDGWTSessionExpiredException) {
parent.getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.debug("Error retrieving tabular resource: "
+ caught.getLocalizedMessage());
AlertMessageBox d = new AlertMessageBox("Error!",
"Error retrieving tabular resources on server!");
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
//
}
});
d.show();
}
callback.onFailure(caught);
AlertMessageBox d = new AlertMessageBox("Error!",
"Error retrieving tabular resources on server!");
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
//
}
});
d.show();
}
public void onSuccess(ArrayList<TabResource> result) {