bug fixed: on refresh store

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@81426 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-09-13 13:55:12 +00:00
parent c8fb0b7482
commit 507c5b5830
1 changed files with 50 additions and 37 deletions

View File

@ -115,6 +115,7 @@ public class AppController implements SubscriberInterface {
private HasWidgets rootPanel;
public AppController(AppControllerExplorer appControllerExplorer) {
this.appContrExplorer = appControllerExplorer;
this.appContrExplorer.subscribe(this, new EventsTypeEnum[] {
@ -275,8 +276,8 @@ public class AppController implements SubscriberInterface {
FileModel parent = wsPortlet.getToolBarPath().getLastParent();
//CREATE FOLDER PARENT FOR RPC
FolderModel folder = new FolderModel(parent.getIdentifier(), parent.getName(), parent.getParentFileModel(), true, parent.isShared());
updateStoreByRpc(folder);
// FolderModel folder = new FolderModel(parent.getIdentifier(), parent.getName(), parent.getParentFileModel(), true, parent.isShared());
updateStoreByRpc(parent);
}
}
});
@ -694,38 +695,43 @@ public class AppController implements SubscriberInterface {
FileModel parent = null;
if(!wsPortlet.getSearchAndFilterContainer().isSearchActive()){ //IF IS NOT SEARCH ACTIVE
//FILE UPLOAD CASES..
if(fileUploadEvent.getTargetFolderModel()!=null){
parent = fileUploadEvent.getTargetFolderModel();
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("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());
try{
if(!wsPortlet.getSearchAndFilterContainer().isSearchActive()){ //IF IS NOT SEARCH ACTIVE
//FILE UPLOAD CASES..
if(fileUploadEvent.getTargetFolderModel()!=null){
parent = fileUploadEvent.getTargetFolderModel();
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("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(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
}
AppControllerExplorer.getEventBus().fireEvent(new FileUploadEvent(parent,fileUploadEvent.getUploadType()));
}catch (Exception e) {
GWT.log("Error onFileUploadEvent", e);
}
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
}
AppControllerExplorer.getEventBus().fireEvent(new FileUploadEvent(parent,fileUploadEvent.getUploadType()));
}
});
@ -1049,13 +1055,20 @@ public class AppController implements SubscriberInterface {
private void updateStoreByRpc(final FileModel folder){
if(folder==null)
return;
//CREATE FOLDER PARENT FOR RPC
final FileModel parent = new FolderModel(folder.getIdentifier(), folder.getName(), folder.getParentFileModel(), true, folder.isShared());
wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE);
System.out.println("In client new RPC getFolderChildrenForFileGrid "+folder.getName());
System.out.println("In client new RPC getFolderChildrenForFileGrid "+parent.getName());
System.out.println(folder);
System.out.println(parent);
appContrExplorer.getRpcWorkspaceService().getFolderChildrenForFileGrid(folder, new AsyncCallback<List<FileGridModel>>() {
appContrExplorer.getRpcWorkspaceService().getFolderChildrenForFileGrid(parent, new AsyncCallback<List<FileGridModel>>() {
@Override
public void onFailure(Throwable caught) {
@ -1075,7 +1088,7 @@ public class AppController implements SubscriberInterface {
@Override
public void onSuccess(List<FileGridModel> result) {
wsPortlet.getGridGroupContainer().setCurrentFolderView(folder); //SET folder as current view
wsPortlet.getGridGroupContainer().setCurrentFolderView(parent); //SET folder as current view
wsPortlet.getGridGroupContainer().unmask();
wsPortlet.getGridGroupContainer().updateStore(result);
@ -1388,7 +1401,7 @@ public class AppController implements SubscriberInterface {
@Override
public void pasteEventIsCompleted() {
Info.display("Info", "pasting...");
Info.display("Info", "paste submitting...");
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activePasteButton(false);
}