Bug fixed: Session expired.

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@80973 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-09-02 10:45:00 +00:00
parent 7281300f37
commit 35e0357197
2 changed files with 94 additions and 3 deletions

View File

@ -82,14 +82,19 @@ import org.gcube.portlets.user.workspace.client.view.windows.InfoDisplay;
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxAlert;
import org.gcube.portlets.user.wsmail.client.forms.MailForm;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dev.asm.tree.IntInsnNode;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasWidgets;
/**
@ -105,6 +110,7 @@ public class AppController implements SubscriberInterface {
// public static boolean isSearchActive = false;
public AppController(AppControllerExplorer appControllerExplorer) {
this.appContrExplorer = appControllerExplorer;
this.appContrExplorer.subscribe(this, new EventsTypeEnum[] {
@ -817,10 +823,10 @@ public class AppController implements SubscriberInterface {
boolean isSearchForItemId = false;
// Log.trace("Start Workspace Portlet");
if (this.appContrExplorer == null){
this.wsPortlet = new WorskpacePortlet(instanceWithGrouping);
}
else{
if(searchParameter!=null && !searchParameter.isEmpty())
isSearch = true;
@ -833,8 +839,83 @@ public class AppController implements SubscriberInterface {
eventBus.fireEvent(new LoadAllScopeEvent()); //LOAD ALL SCOPE EVENT
}
// System.out.println("isSearch "+isSearch);
// System.out.println("isSearchForItemId "+isSearchForItemId);
final boolean searchingForItemId = isSearchForItemId;
//VALIDATING SESSION
if(appContrExplorer!=null){
appContrExplorer.getRpcWorkspaceService().isSessionExpired(new AsyncCallback<Boolean>() {
@Override
public void onFailure(Throwable caught) {
GWT.log("ERROR ON VALIDATING SESSION");
}
@Override
public void onSuccess(Boolean result) {
//SESSION IS NOT EXPIRED
if(!result)
initPortlet(rootPanel, instanceWithGrouping, searchingForItemId, searchParameter, itemIdParameter, operationParameter);
else{
//SESSION IS EXPIRED
rootPanel.add(showProblems());
}
}
});
}
else
initPortlet(rootPanel, instanceWithGrouping, searchingForItemId, searchParameter, itemIdParameter, operationParameter);
//// System.out.println("isSearch "+isSearch);
//// System.out.println("isSearchForItemId "+isSearchForItemId);
//
// rootPanel.add(wsPortlet.getBorderLayoutContainer());
//
// //SET TOGGLE BUTTON GRID VIEW
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
//
// @Override
// public void execute() {
// wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().toggleGridViewButton(instanceWithGrouping);
// }
// });
//
// //IF IS SEARCH and IS NOT SEARCH FOR ITEM ID - fire event search text
// if(searchParameter!=null && !searchParameter.isEmpty() && !isSearchForItemId){
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
// @Override
// public void execute() {
// wsPortlet.getSearchAndFilterContainer().searchText(searchParameter);
// }
// });
// } else if(itemIdParameter!=null && !itemIdParameter.isEmpty()){ //SEARCH FOR ITEM ID
//
// Scheduler.get().scheduleDeferred(new ScheduledCommand() {
// @Override
// public void execute() {
// AppController.getEventBus().fireEvent(new SearchItemByIdEvent(itemIdParameter, operationParameter));
// }
// });
//
// }
}
private LayoutContainer showProblems() {
LayoutContainer errorPanel = new LayoutContainer();
errorPanel.setLayout(new FitLayout());
errorPanel.add(new HTML("<div class=\"nofeed-message\">" +
"Ops! There were problems while retrieving your workspace!" +
"<br> Your session expired, please try to login again <a href=\"\\\">Press here</a> "));
return errorPanel;
}
private void initPortlet(final HasWidgets rootPanel, final boolean instanceWithGrouping, boolean isSearchForItemId, final String searchParameter, final String itemIdParameter, final String operationParameter){
rootPanel.add(wsPortlet.getBorderLayoutContainer());
@ -865,6 +946,7 @@ public class AppController implements SubscriberInterface {
});
}
}

View File

@ -1,3 +1,12 @@
@import url(http://fonts.googleapis.com/css?family=Architects+Daughter);
.nofeed-message {
line-height: 40px;
font-family: 'Architects Daughter', arial, sans-serif;
font-size: 15px;
text-align: center;
}
.x-form-text, textarea.x-form-field {
-moz-border-radius: 3px !important;