|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|