From 36060114702a3c4b401d3143930c3500ca1a0a5a Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Wed, 14 Oct 2015 15:14:48 +0000 Subject: [PATCH] 429: Workspace: uploading big files Task-Url: https://support.d4science.org/issues/429 Deleting many files now is modal git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@119760 82a268e6-3cf1-43bd-a215-b396298e98cf --- .settings/org.eclipse.wst.common.component | 3 ++ .../user/workspace/client/AppController.java | 50 ++++++++++++++++++- .../workspace/client/ConstantsPortlet.java | 2 +- .../toolbars/GxtToolBarItemFunctionality.java | 2 +- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index 8562dc6..bdff2e9 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -8,6 +8,9 @@ uses + + uses + 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 af72a42..be14fe5 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 @@ -100,6 +100,7 @@ import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel import org.gcube.portlets.user.workspace.client.view.panels.GxtItemsPanel; import org.gcube.portlets.user.workspace.client.view.toolbars.GxtBreadcrumbPathPanel; import org.gcube.portlets.user.workspace.client.view.trash.WindowTrash; +import org.gcube.portlets.user.workspace.client.view.windows.DialogConfirm; 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; @@ -122,6 +123,8 @@ 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.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.user.client.Cookies; import com.google.gwt.user.client.Timer; @@ -853,8 +856,51 @@ public class AppController implements SubscriberInterface { final FileModel target = parent; - int size = event.getListTarget().size(); + final int size = event.getListTarget().size(); + + final DialogConfirm confirm = new DialogConfirm(null, ConstantsExplorer.MESSAGE_DELETE,"Are you sure you want to delete "+size+" items?"); + confirm.setModal(true); + confirm.center(); + confirm.getYesButton().addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent clickEvent) { + confirm.loader("Deleting "+size+ " items, please wait"); +// wsPortlet.getGridGroupContainer().mask("Deleting",ConstantsExplorer.LOADINGSTYLE); + + appContrExplorer.getRpcWorkspaceService().deleteListItemsForIds(event.getListTarget(), new AsyncCallback() { + + @Override + public void onFailure(Throwable arg0) { + confirm.hide(); + new MessageBoxAlert("Error", arg0.getMessage(),null); + wsPortlet.getGridGroupContainer().unmask(); + appContrExplorer.refreshRoot(true); + } + + @Override + public void onSuccess(Void arg0) { + confirm.hide(); + //Deleting item from grid + for (String id : event.getListTarget()) { + deleteItem(id); + } +// wsPortlet.getGridGroupContainer().unmask(); + + GWT.log("target: "+target); + + if(wsPortlet.getSearchAndFilterContainer().isSearchActive()){ + appContrExplorer.refreshRoot(false); + }else + AppControllerExplorer.getEventBus().fireEvent(new RefreshFolderEvent(target, true, false, true)); + } + }); + + } + + }); + + /* MessageBoxConfirm mbc = new MessageBoxConfirm(ConstantsExplorer.MESSAGE_DELETE, "Are you sure you want to delete "+size+" items?"); mbc.getMessageBoxConfirm().addCallback(new Listener() { @@ -897,7 +943,7 @@ public class AppController implements SubscriberInterface { }); } } - }); + });*/ } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java index 9fa0243..6b7f7e6 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsPortlet.java @@ -12,7 +12,7 @@ public class ConstantsPortlet { public static final String REFRESH = "Refresh"; public static final String ADDFOLDER = "New Folder"; - public static final String REMOVEITEM = "Remove"; + public static final String DELETEITEM = "Delete"; public static final String RENAMEITEM = "Rename"; public static final String UPLOADFILE = "Upload"; public static final String DOWNLOADITEM = "Download"; diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java index 4bd8f06..bf0d7ed 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtToolBarItemFunctionality.java @@ -124,7 +124,7 @@ public class GxtToolBarItemFunctionality { // toolBar.add(btnGetInfo); // toolBar.add(new SeparatorToolItem()); - btnRemoveItem = new Button(ConstantsPortlet.REMOVEITEM, + btnRemoveItem = new Button(ConstantsPortlet.DELETEITEM, Resources.getIconDeleteItem()); btnRemoveItem.setScale(ButtonScale.SMALL); btnRemoveItem.setIconAlign(IconAlign.TOP);