merged with branch version for gcube 3.9

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@120099 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-10-29 15:19:45 +00:00
parent b8c8a9c542
commit 8f5db196b0
4 changed files with 69 additions and 13 deletions

View File

@ -8,7 +8,7 @@
<dependent-module archiveName="workspace-tree-widget-6.9.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-tree-widget-TRUNK/workspace-tree-widget-TRUNK">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="workspace-uploader-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-uploader-PRIVATE-1.0.0-SNAPSHOT/workspace-uploader-PRIVATE-1.0.0-SNAPSHOT">
<dependent-module archiveName="workspace-uploader-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/workspace-uploader-1.0.0-SNAPSHOT-TRUNK/workspace-uploader-1.0.0-SNAPSHOT-TRUNK">
<dependency-type>uses</dependency-type>
</dependent-module>

View File

@ -91,6 +91,7 @@ import org.gcube.portlets.user.workspace.client.event.VRESettingPermissionEvent;
import org.gcube.portlets.user.workspace.client.event.WebDavUrlEvent;
import org.gcube.portlets.user.workspace.client.event.WebDavUrlEventHandler;
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
import org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface;
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
import org.gcube.portlets.user.workspace.client.model.FileModel;
@ -106,6 +107,7 @@ import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
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.workspace.shared.ExtendedWorkspaceACL;
import org.gcube.portlets.user.workspace.shared.GarbageItem;
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
import org.gcube.portlets.user.workspace.shared.TrashContent;
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
@ -117,6 +119,7 @@ import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.Mul
import org.gcube.portlets.widgets.wsmail.client.forms.MailForm;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback;
@ -489,10 +492,6 @@ public class AppController implements SubscriberInterface {
@Override
public void onSuccess(List<ScopeModel> result) {
// for(ScopeModel scope: result)
// System.out.println("#############Scopde id " + scope.getId() + " name " + scope.getName());
if(result!=null && result.size()>0){
wsPortlet.getSearchAndFilterContainer().setListScope(result);
wsPortlet.getSearchAndFilterContainer().selectScopeByIndex(0); //select first scope
@ -857,17 +856,56 @@ public class AppController implements SubscriberInterface {
final int size = event.getListTarget().size();
final DialogConfirm confirm = new DialogConfirm(null, ConstantsExplorer.MESSAGE_DELETE,"Are you sure you want to delete "+size+" items?");
List<? extends FileModel> targets = event.getListTarget();
final List<FileModel> clearTargets = new ArrayList<FileModel>(targets);
//IGNORING SHARED FOLDER
List<FileModel> ingnoreFile = new ArrayList<FileModel>(size);
for (FileModel file : targets) {
GWT.log("Checking file "+file);
if((file.getType()!=null && file.getType().equals(GXTFolderItemTypeEnum.SHARED_FOLDER.toString())) || file.isSpecialFolder()){
ingnoreFile.add(file);
clearTargets.remove(file);
}
}
final int diff = size-ingnoreFile.size();
if(diff==0){
MessageBox.alert("Alert", "Shared folders cannot be deleted through multiple selection", null);
return;
}
String msg = "Are you sure you want to delete "+diff+" items?<br/>";
if(ingnoreFile.size()>0){
msg+="<br/>The shared "+(ingnoreFile.size()>1?"folders":"folder");
msg+= " following will not be removed:";
for (FileModel fileGridModel : ingnoreFile) {
msg+="<br/>"+fileGridModel.getName();
}
}
final DialogConfirm confirm = new DialogConfirm(null, ConstantsExplorer.MESSAGE_DELETE,msg);
confirm.setModal(true);
confirm.center();
//CREATING LIST IDS
final List<String> ids = new ArrayList<String>();
for (FileModel file : clearTargets) {
ids.add(file.getIdentifier());
}
confirm.getYesButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent clickEvent) {
confirm.loader("Deleting "+size+ " items, please wait");
confirm.loader("Deleting "+diff+ " items, please wait");
// wsPortlet.getGridGroupContainer().mask("Deleting",ConstantsExplorer.LOADINGSTYLE);
appContrExplorer.getRpcWorkspaceService().deleteListItemsForIds(event.getListTarget(), new AsyncCallback<Void>() {
appContrExplorer.getRpcWorkspaceService().deleteListItemsForIds(ids, new AsyncCallback<List<GarbageItem>>() {
@Override
public void onFailure(Throwable arg0) {
@ -878,11 +916,25 @@ public class AppController implements SubscriberInterface {
}
@Override
public void onSuccess(Void arg0) {
public void onSuccess(List<GarbageItem> errors) {
confirm.hide();
List<String> idErros = new ArrayList<String>(errors.size());
if(errors.size()>0){
String msg = "Error during delete of following: ";
for (GarbageItem gbi : errors) {
msg+=gbi.getOldItemName()+"; ";
idErros.add(gbi.getOldItemId());
}
MessageBox.alert("Error", msg, null);
return;
}
//Deleting item from grid
for (String id : event.getListTarget()) {
deleteItem(id);
for (String id : ids) {
if(!idErros.contains(id))
deleteItem(id);
}
// wsPortlet.getGridGroupContainer().unmask();

View File

@ -375,7 +375,11 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
public FileGridModel getSelectedItem(){
return currenItemSelected;
}
public List<FileGridModel> getSelectedItems(){
return grid.getSelectionModel().getSelection();
}
public List<String> getIdsSelectedItems(){

View File

@ -282,7 +282,7 @@ public class GxtToolBarItemFunctionality {
public void componentSelected(ButtonEvent ce) {
List<String> listTarget = gridGroupViewContainer.getIdsSelectedItems();
List<FileGridModel> listTarget = gridGroupViewContainer.getSelectedItems();
if(listTarget!=null){
if(listTarget.size()>1){ //IS MULTI