changed versioning window
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@173410 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8470e4aeb7
commit
1cf343b239
|
@ -2080,7 +2080,8 @@ public class AppController implements SubscriberInterface {
|
|||
}
|
||||
case DOWNLOAD:{
|
||||
for (FileVersionModel fileVersionModel : olderVersions) {
|
||||
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(currentVersion.getIdentifier(), currentVersion.getName(), DownloadType.DOWNLOAD, false, fileVersionModel.getIdentifier()));
|
||||
//I'm passing the versionName as versionID
|
||||
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(currentVersion.getIdentifier(), currentVersion.getName(), DownloadType.DOWNLOAD, false, fileVersionModel.getName()));
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -2161,33 +2162,33 @@ public class AppController implements SubscriberInterface {
|
|||
});
|
||||
break;
|
||||
}
|
||||
case RESTORE:{
|
||||
|
||||
fileVersioningEvent.getWinVersioning().mask("performing operation...");
|
||||
List<String> olderVsIds = new ArrayList<String>(olderVersions.size());
|
||||
for (FileVersionModel fileVersionModel : olderVersions) {
|
||||
olderVsIds.add(fileVersionModel.getIdentifier());
|
||||
}
|
||||
|
||||
AppControllerExplorer.rpcWorkspaceService.performOperationOnVersionedFile(currentVersion.getIdentifier(), olderVsIds, WorkspaceVersioningOperation.RESTORE, new AsyncCallback<List<FileVersionModel>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
fileVersioningEvent.getWinVersioning().unmask();
|
||||
new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<FileVersionModel> result) {
|
||||
fileVersioningEvent.getWinVersioning().unmask();
|
||||
fileVersioningEvent.getWinVersioning().updateVersioningContainer(result);
|
||||
fileVersioningEvent.getWinVersioning().updateItemsNumber(result.size());
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
// case RESTORE:{
|
||||
//
|
||||
// fileVersioningEvent.getWinVersioning().mask("performing operation...");
|
||||
// List<String> olderVsIds = new ArrayList<String>(olderVersions.size());
|
||||
// for (FileVersionModel fileVersionModel : olderVersions) {
|
||||
// olderVsIds.add(fileVersionModel.getIdentifier());
|
||||
// }
|
||||
//
|
||||
// AppControllerExplorer.rpcWorkspaceService.performOperationOnVersionedFile(currentVersion.getIdentifier(), olderVsIds, WorkspaceVersioningOperation.RESTORE, new AsyncCallback<List<FileVersionModel>>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Throwable caught) {
|
||||
// fileVersioningEvent.getWinVersioning().unmask();
|
||||
// new MessageBoxAlert("Error", caught.getMessage(), null);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(List<FileVersionModel> result) {
|
||||
// fileVersioningEvent.getWinVersioning().unmask();
|
||||
// fileVersioningEvent.getWinVersioning().updateVersioningContainer(result);
|
||||
// fileVersioningEvent.getWinVersioning().updateItemsNumber(result.size());
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.gcube.portlets.user.workspace.client.view.versioning;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -39,8 +38,6 @@ import com.extjs.gxt.ui.client.widget.grid.filters.DateFilter;
|
|||
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.layout.FitLayout;
|
||||
import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.FillToolItem;
|
||||
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
|
@ -61,7 +58,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
private ListStore<FileVersionModel> typeStoreOperation = new ListStore<FileVersionModel>();
|
||||
//private GridDropTarget gridDropTarget;
|
||||
private Button buttonDelete;
|
||||
private Button buttonRestore;
|
||||
//private Button buttonRestore;
|
||||
private Button buttonDownload;
|
||||
private Button buttonEmptyVersions;
|
||||
private FileModel currentVersion;
|
||||
|
@ -122,43 +119,43 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
|
||||
ToolBar bar = new ToolBar();
|
||||
|
||||
buttonRestore = new Button(WorkspaceVersioningOperation.RESTORE.getLabel(),Resources.getIconUndo());
|
||||
buttonRestore.setToolTip(WorkspaceVersioningOperation.RESTORE.getOperationDescription());
|
||||
buttonRestore.setScale(ButtonScale.SMALL);
|
||||
buttonRestore.setIconAlign(IconAlign.TOP);
|
||||
|
||||
buttonRestore.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
|
||||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
if(checkSelection()){
|
||||
//ONLY THE FIRST ITEM SELECTED CAN BE RESTORED
|
||||
final List<FileVersionModel> firstFileToRestore = new ArrayList<FileVersionModel>(1);
|
||||
firstFileToRestore.add(grid.getSelectionModel().getSelectedItems().get(0));
|
||||
String msg = "Restoring the previous version: " +
|
||||
"<br/>"+firstFileToRestore.get(0).getName();
|
||||
msg+="<br/>Confirm?";
|
||||
|
||||
String title = "Restore version ";
|
||||
title+=" of: "+currentVersion.getName();
|
||||
final DialogConfirm box = new DialogConfirm(null, title, msg);
|
||||
box.getYesButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.RESTORE, currentVersion, firstFileToRestore, windowVersioning));
|
||||
box.hide();
|
||||
}
|
||||
});
|
||||
box.setModal(true);
|
||||
box.center();
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bar.add(buttonRestore);
|
||||
// buttonRestore = new Button(WorkspaceVersioningOperation.RESTORE.getLabel(),Resources.getIconUndo());
|
||||
// buttonRestore.setToolTip(WorkspaceVersioningOperation.RESTORE.getOperationDescription());
|
||||
// buttonRestore.setScale(ButtonScale.SMALL);
|
||||
// buttonRestore.setIconAlign(IconAlign.TOP);
|
||||
//
|
||||
// buttonRestore.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
//
|
||||
// @Override
|
||||
// public void componentSelected(ButtonEvent ce) {
|
||||
//
|
||||
// if(checkSelection()){
|
||||
// //ONLY THE FIRST ITEM SELECTED CAN BE RESTORED
|
||||
// final List<FileVersionModel> firstFileToRestore = new ArrayList<FileVersionModel>(1);
|
||||
// firstFileToRestore.add(grid.getSelectionModel().getSelectedItems().get(0));
|
||||
// String msg = "Restoring the previous version: " +
|
||||
// "<br/>"+firstFileToRestore.get(0).getName();
|
||||
// msg+="<br/>Confirm?";
|
||||
//
|
||||
// String title = "Restore version ";
|
||||
// title+=" of: "+currentVersion.getName();
|
||||
// final DialogConfirm box = new DialogConfirm(null, title, msg);
|
||||
// box.getYesButton().addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.RESTORE, currentVersion, firstFileToRestore, windowVersioning));
|
||||
// box.hide();
|
||||
// }
|
||||
// });
|
||||
// box.setModal(true);
|
||||
// box.center();
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// bar.add(buttonRestore);
|
||||
|
||||
|
||||
buttonDelete = new Button(WorkspaceVersioningOperation.DELETE_PERMANENTLY.getLabel(),Resources.getIconDeleteItem());
|
||||
|
@ -196,7 +193,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
}
|
||||
});
|
||||
|
||||
bar.add(buttonDelete);
|
||||
//bar.add(buttonDelete);
|
||||
|
||||
buttonDownload = new Button(WorkspaceVersioningOperation.DOWNLOAD.getLabel(),Resources.getIconDownload());
|
||||
buttonDownload.setToolTip(WorkspaceVersioningOperation.DOWNLOAD.getOperationDescription());
|
||||
|
@ -212,9 +209,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
}
|
||||
});
|
||||
|
||||
bar.add(buttonDownload);
|
||||
|
||||
bar.add(new SeparatorMenuItem());
|
||||
//bar.add(new SeparatorMenuItem());
|
||||
|
||||
buttonEmptyVersions = new Button(WorkspaceVersioningOperation.DELETE_ALL_OLDER_VERSIONS.getLabel(),Resources.getTrashEmpty());
|
||||
buttonEmptyVersions.setToolTip(WorkspaceVersioningOperation.DELETE_ALL_OLDER_VERSIONS.getOperationDescription());
|
||||
|
@ -245,10 +240,10 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
}
|
||||
});
|
||||
|
||||
bar.add(buttonEmptyVersions);
|
||||
//bar.add(buttonEmptyVersions);
|
||||
|
||||
|
||||
|
||||
bar.add(new FillToolItem());
|
||||
|
||||
Button buttonRefresh = new Button(WorkspaceTrashOperation.REFRESH.getLabel(),Resources.getIconRefresh());
|
||||
buttonRefresh.setToolTip(WorkspaceTrashOperation.REFRESH.getOperationDescription());
|
||||
|
@ -264,6 +259,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
});
|
||||
|
||||
bar.add(buttonRefresh);
|
||||
bar.add(buttonDownload);
|
||||
cp.setTopComponent(bar);
|
||||
|
||||
}
|
||||
|
@ -395,7 +391,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
*/
|
||||
private void activeCurrentVersionOperation(boolean bool){
|
||||
buttonDelete.setEnabled(bool);
|
||||
buttonRestore.setEnabled(bool);
|
||||
//buttonRestore.setEnabled(bool);
|
||||
}
|
||||
|
||||
|
||||
|
@ -441,7 +437,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
*/
|
||||
protected void activeButtonOnSelection(boolean bool) {
|
||||
buttonDelete.setEnabled(bool);
|
||||
buttonRestore.setEnabled(bool);
|
||||
//buttonRestore.setEnabled(bool);
|
||||
buttonDownload.setEnabled(bool);
|
||||
}
|
||||
|
||||
|
|
|
@ -189,10 +189,11 @@ public class WindowVersioning extends Window {
|
|||
this.mask("Deleting");
|
||||
deleteListItems(trashIds);
|
||||
|
||||
}else if(operation.equals(WorkspaceVersioningOperation.RESTORE)){
|
||||
this.mask("Restoring");
|
||||
deleteListItems(trashIds);
|
||||
}
|
||||
// else if(operation.equals(WorkspaceVersioningOperation.RESTORE)){
|
||||
// this.mask("Restoring");
|
||||
// deleteListItems(trashIds);
|
||||
// }
|
||||
|
||||
this.unmask();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue