File Versioning #7006 first release
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@144066 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ced48b264d
commit
da2d492bc7
|
@ -239,7 +239,7 @@ public class AppController implements SubscriberInterface {
|
|||
|
||||
@Override
|
||||
public void onFileVersioning(FileVersioningEvent fileVersioningEvent) {
|
||||
|
||||
ConstantsExplorer.log("quiqui");
|
||||
performVersioningOperation(fileVersioningEvent);
|
||||
}
|
||||
});
|
||||
|
@ -2039,24 +2039,28 @@ public class AppController implements SubscriberInterface {
|
|||
*
|
||||
* @param fileVersioningEvent the file versioning event
|
||||
*/
|
||||
private void performVersioningOperation(FileVersioningEvent fileVersioningEvent){
|
||||
private void performVersioningOperation(final FileVersioningEvent fileVersioningEvent){
|
||||
|
||||
FileModel currentVersion = fileVersioningEvent.getCurrentVersion();
|
||||
FileModel olderVersion = fileVersioningEvent.getOlderVersion();
|
||||
List<FileVersionModel> olderVersions = fileVersioningEvent.getOlderVersion();
|
||||
|
||||
GWT.log("current version: "+currentVersion);
|
||||
GWT.log("olderVersions: "+olderVersions);
|
||||
//INVOKING FROM TOOLBAR??
|
||||
if(currentVersion==null) {
|
||||
currentVersion = getGridSelectedItem();
|
||||
}
|
||||
GWT.log("current version: "+currentVersion);
|
||||
|
||||
switch (fileVersioningEvent.getVersioningOperation()) {
|
||||
case SHOW:{
|
||||
|
||||
final WindowVersioning wv = new WindowVersioning(currentVersion);
|
||||
appContrExplorer.getRpcWorkspaceService().getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileVersionModel>>() {
|
||||
AppControllerExplorer.rpcWorkspaceService.getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileVersionModel>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Window.alert("error: "+caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -2070,54 +2074,112 @@ public class AppController implements SubscriberInterface {
|
|||
break;
|
||||
}
|
||||
case DOWNLOAD:{
|
||||
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(olderVersion.getIdentifier(), currentVersion.getName(), DownloadType.DOWNLOAD, false, olderVersion.getIdentifier()));
|
||||
for (FileVersionModel fileVersionModel : olderVersions) {
|
||||
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(currentVersion.getIdentifier(), currentVersion.getName(), DownloadType.DOWNLOAD, false, fileVersionModel.getIdentifier()));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case DELETE_PERMANENTLY: {
|
||||
|
||||
final WindowVersioning wv = new WindowVersioning(currentVersion);
|
||||
appContrExplorer.getRpcWorkspaceService().performOperationOnVersionedFile(currentVersion, olderVersion, WorkspaceVersioningOperation.DELETE_PERMANENTLY, new AsyncCallback<List<FileVersionModel>>() {
|
||||
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.DELETE_PERMANENTLY, new AsyncCallback<List<FileVersionModel>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
fileVersioningEvent.getWinVersioning().unmask();
|
||||
Window.alert("error: "+caught);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<FileVersionModel> result) {
|
||||
wv.updateVersioningContainer(result);
|
||||
wv.updateItemsNumber(result.size());
|
||||
fileVersioningEvent.getWinVersioning().unmask();
|
||||
fileVersioningEvent.getWinVersioning().updateVersioningContainer(result);
|
||||
fileVersioningEvent.getWinVersioning().updateItemsNumber(result.size());
|
||||
|
||||
}
|
||||
});
|
||||
wv.show();
|
||||
break;
|
||||
}
|
||||
|
||||
case REFRESH: {
|
||||
final WindowVersioning wv = fileVersioningEvent.getWinVersioning();
|
||||
appContrExplorer.getRpcWorkspaceService().getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileVersionModel>>() {
|
||||
fileVersioningEvent.getWinVersioning().mask("performing operation...");
|
||||
AppControllerExplorer.rpcWorkspaceService.getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileVersionModel>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
fileVersioningEvent.getWinVersioning().unmask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<FileVersionModel> result) {
|
||||
wv.updateVersioningContainer(result);
|
||||
wv.updateItemsNumber(result.size());
|
||||
fileVersioningEvent.getWinVersioning().unmask();
|
||||
fileVersioningEvent.getWinVersioning().updateVersioningContainer(result);
|
||||
fileVersioningEvent.getWinVersioning().updateItemsNumber(result.size());
|
||||
}
|
||||
});
|
||||
wv.show();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case EMPTY_OLDER_VERSIONS: {
|
||||
case DELETE_ALL_OLDER_VERSIONS: {
|
||||
|
||||
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.DELETE_ALL_OLDER_VERSIONS, new AsyncCallback<List<FileVersionModel>>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
fileVersioningEvent.getWinVersioning().unmask();
|
||||
Window.alert("error: "+caught);
|
||||
|
||||
}
|
||||
|
||||
@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();
|
||||
Window.alert("error: "+caught);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<FileVersionModel> result) {
|
||||
fileVersioningEvent.getWinVersioning().unmask();
|
||||
fileVersioningEvent.getWinVersioning().updateVersioningContainer(result);
|
||||
fileVersioningEvent.getWinVersioning().updateItemsNumber(result.size());
|
||||
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2307,7 +2369,7 @@ public class AppController implements SubscriberInterface {
|
|||
@Override
|
||||
public void versioningHistory(FileModel file) {
|
||||
|
||||
eventBus.fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.SHOW, file, null, null));
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.SHOW, file, null, null));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,9 +3,12 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.workspace.client.event;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
|
||||
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||
import org.gcube.portlets.user.workspace.client.model.FileVersionModel;
|
||||
import org.gcube.portlets.user.workspace.client.view.versioning.WindowVersioning;
|
||||
import org.gcube.portlets.user.workspace.shared.WorkspaceVersioningOperation;
|
||||
|
||||
|
@ -23,10 +26,9 @@ public class FileVersioningEvent extends GwtEvent<FileVersioningEventHandler> im
|
|||
public static Type<FileVersioningEventHandler> TYPE = new Type<FileVersioningEventHandler>();
|
||||
private WorkspaceVersioningOperation workspaceVersioningOperation;
|
||||
private FileModel currentVersion;
|
||||
private FileModel olderVersion;
|
||||
private List<FileVersionModel> olderVersion;
|
||||
private WindowVersioning winVersioning;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new file versioning event.
|
||||
*
|
||||
|
@ -35,7 +37,7 @@ public class FileVersioningEvent extends GwtEvent<FileVersioningEventHandler> im
|
|||
* @param olderVersion the older version
|
||||
* @param winVersioning the win versioning
|
||||
*/
|
||||
public FileVersioningEvent(WorkspaceVersioningOperation workspaceVersioningOperation, FileModel currentVersion, FileModel olderVersion, WindowVersioning winVersioning) {
|
||||
public FileVersioningEvent(WorkspaceVersioningOperation workspaceVersioningOperation, FileModel currentVersion, List<FileVersionModel> olderVersion, WindowVersioning winVersioning) {
|
||||
this.workspaceVersioningOperation = workspaceVersioningOperation;
|
||||
this.currentVersion = currentVersion;
|
||||
this.olderVersion = olderVersion;
|
||||
|
@ -76,14 +78,12 @@ public class FileVersioningEvent extends GwtEvent<FileVersioningEventHandler> im
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the older version.
|
||||
*
|
||||
* @return the olderVersion
|
||||
*/
|
||||
public FileModel getOlderVersion() {
|
||||
public List<FileVersionModel> getOlderVersion() {
|
||||
|
||||
return olderVersion;
|
||||
}
|
||||
|
@ -95,20 +95,18 @@ public class FileVersioningEvent extends GwtEvent<FileVersioningEventHandler> im
|
|||
*
|
||||
* @param workspaceVersioningOperation the workspaceVersioningOperation to set
|
||||
*/
|
||||
public void setWorkspaceVersioningOperation(
|
||||
WorkspaceVersioningOperation workspaceVersioningOperation) {
|
||||
public void setWorkspaceVersioningOperation(WorkspaceVersioningOperation workspaceVersioningOperation) {
|
||||
|
||||
this.workspaceVersioningOperation = workspaceVersioningOperation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Sets the older version.
|
||||
*
|
||||
* @param olderVersion the olderVersion to set
|
||||
*/
|
||||
public void setOlderVersion(FileModel olderVersion) {
|
||||
public void setOlderVersion(List<FileVersionModel> olderVersion) {
|
||||
|
||||
this.olderVersion = olderVersion;
|
||||
}
|
||||
|
@ -159,4 +157,25 @@ public class FileVersioningEvent extends GwtEvent<FileVersioningEventHandler> im
|
|||
|
||||
return workspaceVersioningOperation;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("FileVersioningEvent [workspaceVersioningOperation=");
|
||||
builder.append(workspaceVersioningOperation);
|
||||
builder.append(", currentVersion=");
|
||||
builder.append(currentVersion);
|
||||
builder.append(", olderVersion=");
|
||||
builder.append(olderVersion);
|
||||
builder.append(", winVersioning=");
|
||||
builder.append(winVersioning);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class GxtBottomToolBarItem extends ToolBar{
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final String VERSIONING = "Versioning";
|
||||
private static final String VERSIONS = "Versions";
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -145,7 +145,7 @@ public class GxtBottomToolBarItem extends ToolBar{
|
|||
}
|
||||
});
|
||||
|
||||
btnVersioning = new Button(VERSIONING);
|
||||
btnVersioning = new Button(VERSIONS);
|
||||
btnVersioning.setIcon(Resources.getIconVersioning());
|
||||
btnVersioning.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
initGrid();
|
||||
createToolBar();
|
||||
// initDropTarget();
|
||||
|
||||
activeButtonOnSelection(false);
|
||||
}
|
||||
|
||||
|
@ -145,8 +144,6 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
return listDraggedFile;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void initContentPanel() {
|
||||
|
@ -260,10 +257,7 @@ public class TrashInfoContainer extends LayoutContainer {
|
|||
});
|
||||
|
||||
bar.add(buttonRefresh);
|
||||
|
||||
|
||||
cp.setTopComponent(bar);
|
||||
|
||||
}
|
||||
|
||||
public void initGrid() {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.gcube.portlets.user.workspace.client.view.versioning;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -31,27 +32,30 @@ import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
|||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
||||
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
||||
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
||||
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;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
|
||||
|
||||
/**
|
||||
* The Class VersioningInfoContainer.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 17, 2017
|
||||
* Feb 21, 2017
|
||||
*/
|
||||
public class VersioningInfoContainer extends LayoutContainer {
|
||||
|
||||
private Grid<FileModel> grid;
|
||||
private Grid<FileVersionModel> grid;
|
||||
private ContentPanel cp;
|
||||
private GroupingStore<FileModel> store = new GroupingStore<FileModel>();
|
||||
private ListStore<FileModel> typeStoreOperation = new ListStore<FileModel>();
|
||||
private GroupingStore<FileVersionModel> store = new GroupingStore<FileVersionModel>();
|
||||
private ListStore<FileVersionModel> typeStoreOperation = new ListStore<FileVersionModel>();
|
||||
//private GridDropTarget gridDropTarget;
|
||||
private Button buttonDelete;
|
||||
private Button buttonRestore;
|
||||
|
@ -64,6 +68,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
* Instantiates a new versioning info container.
|
||||
*
|
||||
* @param file the versioning files
|
||||
* @param windowVersioning the window versioning
|
||||
*/
|
||||
public VersioningInfoContainer(FileModel file, WindowVersioning windowVersioning) {
|
||||
|
||||
|
@ -72,9 +77,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
createToolBar();
|
||||
this.currentVersion = file;
|
||||
this.windowVersioning = windowVersioning;
|
||||
|
||||
activeButtonOnSelection(false);
|
||||
//updateVersions(file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,6 +107,8 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
return false;
|
||||
}
|
||||
|
||||
GWT.log("Returning checkSelection");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -124,8 +129,29 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
if(checkSelection())
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.RESTORE, currentVersion, grid.getSelectionModel().getSelectedItems().get(0), windowVersioning));
|
||||
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();
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -141,18 +167,37 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
if(checkSelection())
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DELETE_PERMANENTLY,currentVersion, grid.getSelectionModel().getSelectedItems().get(0), windowVersioning));
|
||||
if(checkSelection()){
|
||||
final List<FileVersionModel> selectedItems = grid.getSelectionModel().getSelectedItems();
|
||||
String msg = "Deleting older version/s: ";
|
||||
for (FileVersionModel file : selectedItems) {
|
||||
msg+="<br/> - "+file.getName();
|
||||
}
|
||||
msg+="<br/>Confirm?";
|
||||
|
||||
String title = selectedItems.size()>1?"Delete version":"Delete versions";
|
||||
title+=" of "+currentVersion.getName();
|
||||
final DialogConfirm box = new DialogConfirm(null, title, msg);
|
||||
box.getYesButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
GWT.log("Fire event");
|
||||
//Window.alert("Closed");
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DELETE_PERMANENTLY, currentVersion, selectedItems, windowVersioning));
|
||||
box.hide();
|
||||
}
|
||||
});
|
||||
box.setModal(true);
|
||||
box.center();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bar.add(buttonDelete);
|
||||
|
||||
|
||||
bar.add(new SeparatorMenuItem());
|
||||
|
||||
buttonDownload = new Button(WorkspaceVersioningOperation.DOWNLOAD.getLabel(),Resources.getIconRecycle());
|
||||
buttonDownload = new Button(WorkspaceVersioningOperation.DOWNLOAD.getLabel(),Resources.getIconDownload());
|
||||
buttonDownload.setToolTip(WorkspaceVersioningOperation.DOWNLOAD.getOperationDescription());
|
||||
buttonDownload.setScale(ButtonScale.SMALL);
|
||||
buttonDownload.setIconAlign(IconAlign.TOP);
|
||||
|
@ -162,15 +207,16 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
if(checkSelection())
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DOWNLOAD, currentVersion, grid.getSelectionModel().getSelectedItems().get(0), windowVersioning));
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DOWNLOAD, currentVersion, grid.getSelectionModel().getSelectedItems(), windowVersioning));
|
||||
}
|
||||
});
|
||||
|
||||
bar.add(buttonDownload);
|
||||
|
||||
bar.add(new SeparatorMenuItem());
|
||||
|
||||
buttonEmptyVersions = new Button(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS.getLabel(),Resources.getTrashEmpty());
|
||||
buttonEmptyVersions.setToolTip(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS.getOperationDescription());
|
||||
buttonEmptyVersions = new Button(WorkspaceVersioningOperation.DELETE_ALL_OLDER_VERSIONS.getLabel(),Resources.getTrashEmpty());
|
||||
buttonEmptyVersions.setToolTip(WorkspaceVersioningOperation.DELETE_ALL_OLDER_VERSIONS.getOperationDescription());
|
||||
buttonEmptyVersions.setScale(ButtonScale.SMALL);
|
||||
buttonEmptyVersions.setIconAlign(IconAlign.TOP);
|
||||
buttonEmptyVersions.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||
|
@ -178,20 +224,19 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
@Override
|
||||
public void componentSelected(ButtonEvent ce) {
|
||||
|
||||
// if(checkSelection())
|
||||
// AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS, null));
|
||||
|
||||
DialogConfirm box = new DialogConfirm(null, "Confirm Delete?", "Are you sure you want delete the older versions of: "+ currentVersion.getName());
|
||||
box.setModal(true);
|
||||
box.center();
|
||||
String msg = "Deleting all older versions of: <br/> - "+ currentVersion.getName()+"." +
|
||||
"<br/>Confirm?";
|
||||
DialogConfirm box = new DialogConfirm(null, "Delete older versions of:"+ currentVersion.getName(), msg);
|
||||
box.getYesButton().addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS, currentVersion, null, windowVersioning));
|
||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DELETE_ALL_OLDER_VERSIONS, currentVersion, store.getModels(), windowVersioning));
|
||||
}
|
||||
});
|
||||
box.setModal(true);
|
||||
box.center();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -214,8 +259,6 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
});
|
||||
|
||||
bar.add(buttonRefresh);
|
||||
|
||||
|
||||
cp.setTopComponent(bar);
|
||||
|
||||
}
|
||||
|
@ -228,16 +271,17 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
//ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 25);
|
||||
ColumnConfig name = createSortableColumnConfig(FileModel.NAME, FileModel.NAME, 200);
|
||||
//ColumnConfig type = createSortableColumnConfig(FileModel.TYPE, FileModel.TYPE, 80);
|
||||
ColumnConfig originalPath = createSortableColumnConfig(FileVersionModel.PATH, "Original Path", 200);
|
||||
//ColumnConfig originalPath = createSortableColumnConfig(FileVersionModel.PATH, "Original Path", 200);
|
||||
ColumnConfig created = createSortableColumnConfig(FileVersionModel.CREATED, "Created", 100);
|
||||
//ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Deleted Date", 90);
|
||||
//deleteDate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
|
||||
ColumnConfig user = createSortableColumnConfig(FileVersionModel.USER_VERSIONING, "User", 150);
|
||||
|
||||
//ColumnModel cm = new ColumnModel(Arrays.asList(icon, name, type, originalPath, deleteDate, deleteUser));
|
||||
|
||||
ColumnModel cm = new ColumnModel(Arrays.asList(name, originalPath, user));
|
||||
ColumnModel cm = new ColumnModel(Arrays.asList(name, created, user));
|
||||
|
||||
grid = new Grid<FileModel>(this.store, cm);
|
||||
grid = new Grid<FileVersionModel>(this.store, cm);
|
||||
|
||||
GroupingView view = new GroupingView();
|
||||
view.setShowGroupedColumn(false);
|
||||
|
@ -249,19 +293,19 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
filters.setLocal(true);
|
||||
|
||||
StringFilter nameFilter = new StringFilter(FileModel.NAME);
|
||||
StringFilter pathFilter = new StringFilter("Original Path");
|
||||
StringFilter userFilter = new StringFilter("User");
|
||||
DateFilter dateFilter = new DateFilter(FileVersionModel.CREATED);
|
||||
StringFilter userFilter = new StringFilter(FileVersionModel.USER_VERSIONING);
|
||||
|
||||
filters.addFilter(nameFilter);
|
||||
filters.addFilter(pathFilter);
|
||||
filters.addFilter(dateFilter);
|
||||
filters.addFilter(userFilter);
|
||||
|
||||
grid.addPlugin(filters);
|
||||
|
||||
grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<FileModel>() {
|
||||
grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<FileVersionModel>() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent<FileModel> se) {
|
||||
public void selectionChanged(SelectionChangedEvent<FileVersionModel> se) {
|
||||
|
||||
boolean selection = grid.getSelectionModel().getSelectedItems().size()>0;
|
||||
activeButtonOnSelection(selection);
|
||||
|
@ -332,7 +376,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
*
|
||||
* @param store the store
|
||||
*/
|
||||
private void updateStore(ListStore<FileModel> store) {
|
||||
private void updateStore(ListStore<FileVersionModel> store) {
|
||||
|
||||
resetStore();
|
||||
this.grid.getStore().add(store.getModels());
|
||||
|
@ -377,7 +421,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
* @param identifier the identifier
|
||||
* @return the file model by identifier
|
||||
*/
|
||||
public FileModel getFileModelByIdentifier(String identifier){
|
||||
public FileVersionModel getFileModelByIdentifier(String identifier){
|
||||
|
||||
return store.findModel(FileModel.IDENTIFIER, identifier);
|
||||
|
||||
|
@ -391,7 +435,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
*/
|
||||
public boolean deleteItem(String identifier) {
|
||||
|
||||
FileModel fileTarget = getFileModelByIdentifier(identifier);
|
||||
FileVersionModel fileTarget = getFileModelByIdentifier(identifier);
|
||||
|
||||
|
||||
if(fileTarget!=null){
|
||||
|
@ -409,13 +453,13 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
* @param fileTarget (MANDATORY)
|
||||
* @return true, if successful
|
||||
*/
|
||||
private boolean deleteItem(FileModel fileTarget) {
|
||||
private boolean deleteItem(FileVersionModel fileTarget) {
|
||||
|
||||
Record record = store.getRecord(fileTarget);
|
||||
|
||||
if (record != null) {
|
||||
|
||||
FileModel item = (FileModel) record.getModel();
|
||||
FileVersionModel item = (FileVersionModel) record.getModel();
|
||||
store.remove(item);
|
||||
|
||||
return true;
|
||||
|
@ -445,7 +489,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
|||
*
|
||||
* @return the store
|
||||
*/
|
||||
protected GroupingStore<FileModel> getStore() {
|
||||
protected GroupingStore<FileVersionModel> getStore() {
|
||||
return store;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ public class WindowVersioning extends Window {
|
|||
* @param fileVersioned the file versioned
|
||||
*/
|
||||
public WindowVersioning(FileModel fileVersioned) {
|
||||
initAccounting();
|
||||
this.fileVersioned = fileVersioned;
|
||||
initAccounting();
|
||||
//setIcon(Resources.getTrashFull()); //TODO
|
||||
setHeading("Versions of: "+fileVersioned.getName());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue