1270: Workspace improvements: many rpc calls after an delete multiple

Task-Url: https://support.d4science.org/issues/1270

Fixed this task

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@120110 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-10-29 17:00:26 +00:00
parent 8f5db196b0
commit 65ca647b3a
1 changed files with 26 additions and 13 deletions

View File

@ -928,15 +928,22 @@ public class AppController implements SubscriberInterface {
idErros.add(gbi.getOldItemId()); idErros.add(gbi.getOldItemId());
} }
MessageBox.alert("Error", msg, null); MessageBox.alert("Error", msg, null);
return;
}
int diff = ids.size()-errors.size();
if(diff>0){
List<String> deletable = new ArrayList<String>(diff);
//Deleting item from grid //Deleting item from grid
for (String id : ids) { for (String id : ids) {
if(!idErros.contains(id)) if(!idErros.contains(id)) //is not an error so is deletable
deleteItem(id); deletable.add(id);
} }
// wsPortlet.getGridGroupContainer().unmask();
deleteItems(deletable);
}
}else
deleteItems(ids); //no error, delete all ids
GWT.log("target: "+target); GWT.log("target: "+target);
@ -1623,13 +1630,19 @@ public class AppController implements SubscriberInterface {
} }
@Override @Override
public boolean deleteItem(String itemIdentifier) { public boolean deleteItems(List<String> ids) {
executeTrashOperation(WorkspaceTrashOperation.REFRESH, null); if(ids==null || ids.size()==0)
return false;
return wsPortlet.getGridGroupContainer().deleteItem(itemIdentifier);
boolean deleted = false;
for (String itemIdentifier : ids) {
deleted = wsPortlet.getGridGroupContainer().deleteItem(itemIdentifier);
} }
executeTrashOperation(WorkspaceTrashOperation.REFRESH, null);
return deleted;
}
@Override @Override
public void rootLoaded(FileModel root) { public void rootLoaded(FileModel root) {