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 40d3737..0f56365 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 @@ -112,6 +112,7 @@ public class AppController implements SubscriberInterface { private HasWidgets rootPanel; + public AppController(AppControllerExplorer appControllerExplorer) { this.appContrExplorer = appControllerExplorer; this.appContrExplorer.subscribe(this, new EventsTypeEnum[] { @@ -665,17 +666,32 @@ public class AppController implements SubscriberInterface { //FILE UPLOAD CASES.. if(fileUploadEvent.getTargetFolderModel()!=null){ parent = fileUploadEvent.getTargetFolderModel(); - GWT.log("get parent item for uploading from parent of file model: " +fileUploadEvent.getTargetFolderModel().getName()); - }else if(wsPortlet.getGridGroupContainer().getCurrentFolderView()!=null){ - parent = wsPortlet.getGridGroupContainer().getCurrentFolderView(); - GWT.log("get parent item for uploading from CurrentFolderView: " +parent.getName()); + GWT.log("Search is not active, get parent item for uploading from parent of file model: " +fileUploadEvent.getTargetFolderModel().getName()); }else if(wsPortlet.getToolBarPath().getLastParent()!=null){ parent = wsPortlet.getToolBarPath().getLastParent(); - GWT.log("get parent item for uploading from breadcrumb: " +parent.getName()); + GWT.log("Search is not active get parent item for uploading from breadcrumb: " +parent.getName()); + }else if(wsPortlet.getGridGroupContainer().getCurrentFolderView()!=null){ + parent = wsPortlet.getGridGroupContainer().getCurrentFolderView(); + GWT.log("Search is not active get parent item for uploading from CurrentFolderView: " +parent.getName()); } +// }else if(wsPortlet.getGridGroupContainer().getCurrentFolderView()!=null){ +// parent = wsPortlet.getGridGroupContainer().getCurrentFolderView(); +// GWT.log("get parent item for uploading from CurrentFolderView: " +parent.getName()); +// }else if(wsPortlet.getToolBarPath().getLastParent()!=null){ +// parent = wsPortlet.getToolBarPath().getLastParent(); +// GWT.log("get parent item for uploading from breadcrumb: " +parent.getName()); +// } + } + else{ //IF IS SEARCH ACTIVE + + //is BREADCRUMB fully? + if(wsPortlet.getToolBarPath().getLastParent()!=null){ + parent = wsPortlet.getToolBarPath().getLastParent(); + GWT.log("Search is active get parent item for uploading from breadcrumb: " +parent.getName()); + }else + parent = null; //also SET null AS PARENT + } - else - parent = null; //IF IS SEARCH ACTIVE SET null AS PARENT AppControllerExplorer.getEventBus().fireEvent(new FileUploadEvent(parent,fileUploadEvent.getUploadType()));