|
|
|
@ -116,7 +116,13 @@ import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSha
|
|
|
|
|
import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
|
|
|
|
|
import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
|
|
|
|
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
|
|
|
|
import org.gcube.portlets.widgets.wsexplorer.client.WorkspaceExplorerConstants;
|
|
|
|
|
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
|
|
|
|
|
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
|
|
|
|
|
import org.gcube.portlets.widgets.wsexplorer.client.view.grid.ItemsTable.DISPLAY_FIELD;
|
|
|
|
|
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
|
|
|
|
|
|
|
|
|
|
import com.extjs.gxt.ui.client.core.XDOM;
|
|
|
|
|
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;
|
|
|
|
@ -2072,86 +2078,143 @@ public class AppController implements SubscriberInterface {
|
|
|
|
|
|
|
|
|
|
if(operation==null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
switch (operation) {
|
|
|
|
|
|
|
|
|
|
case SHOW:
|
|
|
|
|
WindowTrash.getInstance().show();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DELETE_PERMANENTLY:
|
|
|
|
|
case RESTORE:{
|
|
|
|
|
|
|
|
|
|
if(trashItemIds==null || trashItemIds.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().maskContainer("Updating Trash");
|
|
|
|
|
List<String> trashIds = new ArrayList<String>(trashItemIds.size());
|
|
|
|
|
|
|
|
|
|
GWT.log("Trash items are: "+trashItemIds);
|
|
|
|
|
List<String> trashIds = null;
|
|
|
|
|
if(trashItemIds!=null) {
|
|
|
|
|
//creating list of trash ids
|
|
|
|
|
trashIds = new ArrayList<String>(trashItemIds.size());
|
|
|
|
|
for (FileModel fileModel : trashItemIds) {
|
|
|
|
|
trashIds.add(fileModel.getIdentifier());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.executeOperationOnTrash(trashIds, operation, new AsyncCallback<TrashOperationContent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable arg0) {
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(TrashOperationContent operationResult) {
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().executeOperationOnTrashContainer(operationResult.getListTrashIds(), operationResult.getOperation());
|
|
|
|
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(WindowTrash.getInstance().getTrashedFiles().size()>0);
|
|
|
|
|
|
|
|
|
|
//SHOW POSSIBLY ERRORS
|
|
|
|
|
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
|
|
|
|
|
|
|
|
|
|
if(operation.equals(WorkspaceTrashOperation.RESTORE)){
|
|
|
|
|
appContrExplorer.refreshRoot(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (operation) {
|
|
|
|
|
|
|
|
|
|
default:{
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().maskContainer("Updating Trash");
|
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.updateTrashContent(operation, new AsyncCallback<TrashContent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable arg0) {
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(TrashContent operationResult) {
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().updateTrashContainer(operationResult.getTrashContent());
|
|
|
|
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(operationResult.getTrashContent().size()>0);
|
|
|
|
|
|
|
|
|
|
//SHOW POSSIBLY ERRORS
|
|
|
|
|
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
|
|
|
|
|
|
|
|
|
|
if(operation.equals(WorkspaceTrashOperation.RESTORE_ALL)){
|
|
|
|
|
appContrExplorer.refreshRoot(true);
|
|
|
|
|
case SHOW:
|
|
|
|
|
WindowTrash.getInstance().show();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case DELETE_PERMANENTLY:
|
|
|
|
|
|
|
|
|
|
if(trashIds==null || trashIds.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().maskContainer("Updating Trash");
|
|
|
|
|
|
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.executeOperationOnTrash(trashIds, null, operation, new AsyncCallback<TrashOperationContent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable arg0) {
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(TrashOperationContent operationResult) {
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().executeOperationOnTrashContainer(operationResult.getListTrashIds(), operationResult.getOperation());
|
|
|
|
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(WindowTrash.getInstance().getTrashedFiles().size()>0);
|
|
|
|
|
//SHOW THE ERRORS IF OCCURRED
|
|
|
|
|
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case RESTORE:
|
|
|
|
|
|
|
|
|
|
if(trashIds==null || trashIds.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
final List<String> toTrashIds = trashIds;
|
|
|
|
|
WindowTrash.getInstance().maskContainer("Updating Trash");
|
|
|
|
|
WorkspaceExplorerConstants.SELECT = "Restore";
|
|
|
|
|
DISPLAY_FIELD[] displayFields = new DISPLAY_FIELD[] { DISPLAY_FIELD.ICON, DISPLAY_FIELD.NAME,
|
|
|
|
|
DISPLAY_FIELD.OWNER };
|
|
|
|
|
final WorkspaceExplorerSelectDialog navigator = new WorkspaceExplorerSelectDialog("Restore to...", true, rootIdentifier, "", displayFields);
|
|
|
|
|
int topZIndex = XDOM.getTopZIndex();
|
|
|
|
|
WorskpaceExplorerSelectNotificationListener listener = new WorskpaceExplorerSelectNotificationListener() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSelectedItem(Item item) {
|
|
|
|
|
|
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.executeOperationOnTrash(toTrashIds, item.getId(), operation, new AsyncCallback<TrashOperationContent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable arg0) {
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(TrashOperationContent operationResult) {
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().executeOperationOnTrashContainer(operationResult.getListTrashIds(), operationResult.getOperation());
|
|
|
|
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(WindowTrash.getInstance().getTrashedFiles().size()>0);
|
|
|
|
|
|
|
|
|
|
//SHOW THE ERRORS IF OCCURRED
|
|
|
|
|
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
|
|
|
|
|
appContrExplorer.refreshRoot(true);
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onAborted() {
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailed(Throwable throwable) {
|
|
|
|
|
Window.alert("Error: "+throwable.getMessage());
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onNotValidSelection() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
navigator.addWorkspaceExplorerSelectNotificationListener(listener);
|
|
|
|
|
navigator.setZIndex(topZIndex+10);
|
|
|
|
|
navigator.show();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:{
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().maskContainer("Updating Trash");
|
|
|
|
|
GWT.log("Performing trash operation: "+operation);
|
|
|
|
|
AppControllerExplorer.rpcWorkspaceService.updateTrashContent(operation, new AsyncCallback<TrashContent>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable arg0) {
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(TrashContent operationResult) {
|
|
|
|
|
GWT.log("Returned from operation: "+operation + " with result: "+operationResult);
|
|
|
|
|
WindowTrash.getInstance().updateTrashContainer(operationResult.getTrashContent());
|
|
|
|
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().updateTrashIcon(operationResult.getTrashContent().size()>0);
|
|
|
|
|
|
|
|
|
|
//SHOW POSSIBLY ERRORS
|
|
|
|
|
WindowTrash.getInstance().showTrashErrors(operation, operationResult.getListErrors());
|
|
|
|
|
|
|
|
|
|
if(operation.equals(WorkspaceTrashOperation.RESTORE_ALL)){
|
|
|
|
|
appContrExplorer.refreshRoot(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WindowTrash.getInstance().unmaskContainer();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|