diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java index 35cf682..168ff82 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java @@ -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() { + + @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("
" + + "Ops! There were problems while retrieving your workspace!" + + "
Your session expired, please try to login again Press here ")); + + 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 { }); } + } diff --git a/src/main/webapp/workspaceportlet.css b/src/main/webapp/workspaceportlet.css index 811270c..e775d10 100644 --- a/src/main/webapp/workspaceportlet.css +++ b/src/main/webapp/workspaceportlet.css @@ -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;