enhancements on trash
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@95585 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
19961ae2b1
commit
0b53c23b4a
|
@ -94,7 +94,8 @@ 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.client.view.windows.MessageBoxAlert;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxConfirm;
|
import org.gcube.portlets.user.workspace.client.view.windows.MessageBoxConfirm;
|
||||||
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
import org.gcube.portlets.user.workspace.shared.SessionExpiredException;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashOperationResult;
|
import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
||||||
import org.gcube.portlets.widgets.wsmail.client.forms.MailForm;
|
import org.gcube.portlets.widgets.wsmail.client.forms.MailForm;
|
||||||
|
@ -177,34 +178,7 @@ public class AppController implements SubscriberInterface {
|
||||||
@Override
|
@Override
|
||||||
public void onTrashEvent(TrashEvent trashEvent) {
|
public void onTrashEvent(TrashEvent trashEvent) {
|
||||||
|
|
||||||
|
executeTrashOperation(trashEvent.getTrashOperation(), trashEvent.getTargetFileModels());
|
||||||
switch (trashEvent.getTrashOperation()) {
|
|
||||||
case SHOW:
|
|
||||||
WindowTrash.getInstance().show();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
|
|
||||||
if(trashEvent.getTrashOperation()!=null){
|
|
||||||
WindowTrash.getInstance().mask("Submitting Operation");
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.executeOperationOnTrash(trashEvent.getTargetFileModel().getIdentifier(), trashEvent.getTrashOperation(), new AsyncCallback<TrashOperationResult>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable arg0) {
|
|
||||||
WindowTrash.getInstance().unmask();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(TrashOperationResult operationResult) {
|
|
||||||
WindowTrash.getInstance().unmask();
|
|
||||||
WindowTrash.getInstance().updateTrashContainer(operationResult.getTrashContent());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1223,6 +1197,14 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//LOADING TRASH CONTENT
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
executeTrashOperation(WorkspaceTrashOperation.REFRESH, null);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1418,6 +1400,9 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteItem(String itemIdentifier) {
|
public boolean deleteItem(String itemIdentifier) {
|
||||||
|
|
||||||
|
executeTrashOperation(WorkspaceTrashOperation.REFRESH, null);
|
||||||
|
|
||||||
return wsPortlet.getGridGroupContainer().deleteItem(itemIdentifier);
|
return wsPortlet.getGridGroupContainer().deleteItem(itemIdentifier);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1665,16 +1650,6 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#trashEvent(org.gcube.portlets.user.workspace.client.event.TrashEvent.TRASHOPERATION, org.gcube.portlets.user.workspace.client.model.FileModel)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void trashEvent(WorkspaceTrashOperation trashOperation, FileModel targetFileModel) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#updatedVREPermissions(java.lang.String)
|
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#updatedVREPermissions(java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@ -1691,4 +1666,85 @@ public class AppController implements SubscriberInterface {
|
||||||
setACLInfo(vreFolderId);
|
setACLInfo(vreFolderId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param operation
|
||||||
|
* @param trashItemId
|
||||||
|
*/
|
||||||
|
private void executeTrashOperation(WorkspaceTrashOperation operation, List<FileModel> trashItemIds){
|
||||||
|
|
||||||
|
GWT.log("Executing trash operation: "+operation);
|
||||||
|
|
||||||
|
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().mask("Updating Trash");
|
||||||
|
List<String> 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().unmask();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(TrashOperationContent operationResult) {
|
||||||
|
WindowTrash.getInstance().unmask();
|
||||||
|
|
||||||
|
WindowTrash.getInstance().executeOperationOnTrashContainer(operationResult.getListTrashIds(), operationResult.getOperation());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
default:{
|
||||||
|
|
||||||
|
WindowTrash.getInstance().mask("Updating Trash");
|
||||||
|
AppControllerExplorer.rpcWorkspaceService.updateTrashContent(operation, new AsyncCallback<TrashContent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable arg0) {
|
||||||
|
WindowTrash.getInstance().unmask();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(TrashContent operationResult) {
|
||||||
|
WindowTrash.getInstance().unmask();
|
||||||
|
WindowTrash.getInstance().updateTrashContainer(operationResult.getTrashContent());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#trashEvent(org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation, java.util.List)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void trashEvent(WorkspaceTrashOperation trashOperation, List<FileModel> targetFileModels) {
|
||||||
|
executeTrashOperation(trashOperation, targetFileModels);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,10 +120,8 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// add(new FillToolItem());
|
add(new FillToolItem());
|
||||||
// add(btnGetTrash);
|
add(btnGetTrash);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enableInfoHistoryButtons(false);
|
enableInfoHistoryButtons(false);
|
||||||
|
|
|
@ -35,7 +35,6 @@ import com.extjs.gxt.ui.client.widget.grid.filters.GridFilters;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.filters.StringFilter;
|
import com.extjs.gxt.ui.client.widget.grid.filters.StringFilter;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||||
import com.google.gwt.i18n.client.NumberFormat;
|
|
||||||
|
|
||||||
public class TrashInfoContainer extends LayoutContainer {
|
public class TrashInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
|
@ -49,7 +48,6 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
private GroupingStore<FileTrashedModel> store = new GroupingStore<FileTrashedModel>();
|
private GroupingStore<FileTrashedModel> store = new GroupingStore<FileTrashedModel>();
|
||||||
private boolean groupingEnabled;
|
private boolean groupingEnabled;
|
||||||
private ListStore<FileTrashedModel> typeStoreOperation = new ListStore<FileTrashedModel>();
|
private ListStore<FileTrashedModel> typeStoreOperation = new ListStore<FileTrashedModel>();
|
||||||
private NumberFormat number = ConstantsExplorer.numberFormatterKB;
|
|
||||||
private GridDropTarget gridDropTarget;
|
private GridDropTarget gridDropTarget;
|
||||||
|
|
||||||
public TrashInfoContainer() {
|
public TrashInfoContainer() {
|
||||||
|
@ -178,18 +176,12 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
public void initGrid() {
|
public void initGrid() {
|
||||||
|
|
||||||
// store.groupBy(ConstantsExplorer.SHORTCUTCATEGORY);
|
|
||||||
// groupingEnabled = true;
|
|
||||||
|
|
||||||
ColumnConfig icon = new ColumnConfig(ConstantsExplorer.ICON, "", 25);
|
ColumnConfig icon = new ColumnConfig(ConstantsExplorer.ICON, "", 25);
|
||||||
ColumnConfig name = createSortableColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 200);
|
ColumnConfig name = createSortableColumnConfig(ConstantsExplorer.NAME, ConstantsExplorer.NAME, 200);
|
||||||
ColumnConfig type = createSortableColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 50);
|
ColumnConfig type = createSortableColumnConfig(ConstantsExplorer.TYPE, ConstantsExplorer.TYPE, 50);
|
||||||
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(), "Original Path", 200);
|
ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(), "Original Path", 200);
|
||||||
ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Delete Date", 50);
|
ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Deleted Date", 50);
|
||||||
ColumnConfig deleteUser = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEUSER.toString(), "Delete User", 150);
|
ColumnConfig deleteUser = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEUSER.toString(), "Deleted By", 150);
|
||||||
// ColumnConfig category = createSortableColumnConfig(ConstantsExplorer.SHORTCUTCATEGORY, ConstantsExplorer.SHORTCUTCATEGORY, 100);
|
|
||||||
// ColumnConfig ownerFullName = createSortableColumnConfig(ConstantsExplorer.OWNERFULLNAME, ConstantsExplorer.OWNER, 100);
|
|
||||||
// ColumnConfig ownerFullName = createSortableColumnConfig(ConstantsExplorer.OWNERFULLNAME, ConstantsExplorer.OWNER, 100);
|
|
||||||
|
|
||||||
ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
|
ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
|
||||||
|
|
||||||
|
@ -294,6 +286,11 @@ public class TrashInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
store.removeAll();
|
store.removeAll();
|
||||||
typeStoreOperation.removeAll();
|
typeStoreOperation.removeAll();
|
||||||
|
|
||||||
|
for (FileTrashedModel fileTrashedModel : trashFiles) {
|
||||||
|
fileTrashedModel.setIcon();
|
||||||
|
}
|
||||||
|
|
||||||
store.add(trashFiles);
|
store.add(trashFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
|
import org.gcube.portlets.user.workspace.client.model.FileTrashedModel;
|
||||||
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.widget.Window;
|
import com.extjs.gxt.ui.client.widget.Window;
|
||||||
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
||||||
|
@ -96,10 +97,27 @@ public class WindowTrash extends Window {
|
||||||
this.trashContainers.updateTrash(trashFiles);
|
this.trashContainers.updateTrash(trashFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void executeOperationOnTrashContainer(List<String> trashIds, WorkspaceTrashOperation operation) {
|
||||||
|
|
||||||
|
if(operation.equals(WorkspaceTrashOperation.DELETE_PERMANENTLY)){
|
||||||
|
deleteListItems(trashIds);
|
||||||
|
|
||||||
|
}else if(operation.equals(WorkspaceTrashOperation.RESTORE)){
|
||||||
|
deleteListItems(trashIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<FileTrashedModel> getTrashedFiles() {
|
public List<FileTrashedModel> getTrashedFiles() {
|
||||||
return trashedFiles;
|
return trashedFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void deleteListItems(List<String> trashIds){
|
||||||
|
|
||||||
|
for (String identifier : trashIds) {
|
||||||
|
this.trashContainers.deleteItem(identifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void maskAccountingInfo(boolean bool){
|
public void maskAccountingInfo(boolean bool){
|
||||||
|
|
||||||
// if(accountingsContainers!=null){
|
// if(accountingsContainers!=null){
|
||||||
|
|
Loading…
Reference in New Issue