Enhancement on file versioning #7006
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@142775 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
5c46c8d997
commit
33c3c4fa22
|
@ -30,9 +30,12 @@ import org.gcube.portlets.user.workspace.client.event.DeleteMessageEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.DoubleClickElementSelectedEvent;
|
import org.gcube.portlets.user.workspace.client.event.DoubleClickElementSelectedEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.DoubleClickElementSelectedEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.DoubleClickElementSelectedEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent;
|
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FileDownloadEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.FileDownloadEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent;
|
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FileUploadEventHandler;
|
import org.gcube.portlets.user.workspace.client.event.FileUploadEventHandler;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.FileVersioningEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.FileVersioningEventHandler;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FilterScopeEvent;
|
import org.gcube.portlets.user.workspace.client.event.FilterScopeEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.GetFolderLinkEvent;
|
import org.gcube.portlets.user.workspace.client.event.GetFolderLinkEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.GetInfoEvent;
|
import org.gcube.portlets.user.workspace.client.event.GetInfoEvent;
|
||||||
|
@ -105,6 +108,7 @@ import org.gcube.portlets.user.workspace.client.view.panels.GxtBorderLayoutPanel
|
||||||
import org.gcube.portlets.user.workspace.client.view.panels.GxtItemsPanel;
|
import org.gcube.portlets.user.workspace.client.view.panels.GxtItemsPanel;
|
||||||
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtBreadcrumbPathPanel;
|
import org.gcube.portlets.user.workspace.client.view.toolbars.GxtBreadcrumbPathPanel;
|
||||||
import org.gcube.portlets.user.workspace.client.view.trash.WindowTrash;
|
import org.gcube.portlets.user.workspace.client.view.trash.WindowTrash;
|
||||||
|
import org.gcube.portlets.user.workspace.client.view.versioning.WindowVersioning;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogConfirm;
|
import org.gcube.portlets.user.workspace.client.view.windows.DialogConfirm;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
|
import org.gcube.portlets.user.workspace.client.view.windows.DialogGetInfo;
|
||||||
import org.gcube.portlets.user.workspace.client.view.windows.InfoDisplay;
|
import org.gcube.portlets.user.workspace.client.view.windows.InfoDisplay;
|
||||||
|
@ -116,6 +120,7 @@ import org.gcube.portlets.user.workspace.shared.TrashContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
import org.gcube.portlets.user.workspace.shared.TrashOperationContent;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceUserQuote;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceUserQuote;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceVersioningOperation;
|
||||||
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
import org.gcube.portlets.widgets.workspaceuploader.client.WorkspaceUploadNotification.WorskpaceUploadNotificationListener;
|
||||||
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
import org.gcube.portlets.widgets.workspaceuploader.client.uploader.dragdrop.MultipleDNDUpload;
|
||||||
|
@ -190,7 +195,8 @@ public class AppController implements SubscriberInterface {
|
||||||
EventsTypeEnum.COPY_EVENT,
|
EventsTypeEnum.COPY_EVENT,
|
||||||
EventsTypeEnum.TRASH_EVENT,
|
EventsTypeEnum.TRASH_EVENT,
|
||||||
EventsTypeEnum.UPDATE_WORKSPACE_SIZE,
|
EventsTypeEnum.UPDATE_WORKSPACE_SIZE,
|
||||||
EventsTypeEnum.UPDATED_VRE_PERMISSION
|
EventsTypeEnum.UPDATED_VRE_PERMISSION,
|
||||||
|
EventsTypeEnum.FILE_VERSIONING_HISTORY_EVENT
|
||||||
});
|
});
|
||||||
bind();
|
bind();
|
||||||
}
|
}
|
||||||
|
@ -228,6 +234,15 @@ public class AppController implements SubscriberInterface {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eventBus.addHandler(FileVersioningEvent.TYPE, new FileVersioningEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFileVersioning(FileVersioningEvent fileVersioningEvent) {
|
||||||
|
|
||||||
|
performVersioningOperation(fileVersioningEvent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
eventBus.addHandler(UpdateWorkspaceSizeEvent.TYPE, new UpdateWorkspaceSizeEventHandler() {
|
eventBus.addHandler(UpdateWorkspaceSizeEvent.TYPE, new UpdateWorkspaceSizeEventHandler() {
|
||||||
|
|
||||||
|
@ -263,7 +278,7 @@ public class AppController implements SubscriberInterface {
|
||||||
@Override
|
@Override
|
||||||
public void onTrashEvent(TrashEvent trashEvent) {
|
public void onTrashEvent(TrashEvent trashEvent) {
|
||||||
|
|
||||||
executeTrashOperation(trashEvent.getTrashOperation(), trashEvent.getTargetFileModels());
|
performTrashOperation(trashEvent.getTrashOperation(), trashEvent.getTargetFileModels());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -446,7 +461,7 @@ public class AppController implements SubscriberInterface {
|
||||||
public void onFileDownloadEvent(FileDownloadEvent fileDownloadEvent) {
|
public void onFileDownloadEvent(FileDownloadEvent fileDownloadEvent) {
|
||||||
|
|
||||||
if(fileDownloadEvent!=null && fileDownloadEvent.getItemIdentifier()!=null){
|
if(fileDownloadEvent!=null && fileDownloadEvent.getItemIdentifier()!=null){
|
||||||
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(fileDownloadEvent.getItemIdentifier(), fileDownloadEvent.getItemName(), fileDownloadEvent.getDownloadType(), fileDownloadEvent.isFolder()));
|
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(fileDownloadEvent.getItemIdentifier(), fileDownloadEvent.getItemName(), fileDownloadEvent.getDownloadType(), fileDownloadEvent.isFolder(), null));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1361,7 +1376,7 @@ public class AppController implements SubscriberInterface {
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
executeTrashOperation(WorkspaceTrashOperation.REFRESH, null);
|
performTrashOperation(WorkspaceTrashOperation.REFRESH, null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1715,7 +1730,7 @@ public class AppController implements SubscriberInterface {
|
||||||
for (String itemIdentifier : ids) {
|
for (String itemIdentifier : ids) {
|
||||||
deleted = wsPortlet.getGridGroupContainer().deleteItem(itemIdentifier);
|
deleted = wsPortlet.getGridGroupContainer().deleteItem(itemIdentifier);
|
||||||
}
|
}
|
||||||
executeTrashOperation(WorkspaceTrashOperation.REFRESH, null);
|
performTrashOperation(WorkspaceTrashOperation.REFRESH, null);
|
||||||
return deleted;
|
return deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2020,13 +2035,101 @@ public class AppController implements SubscriberInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute trash operation.
|
* Perform versioning operation.
|
||||||
|
*
|
||||||
|
* @param fileVersioningEvent the file versioning event
|
||||||
|
*/
|
||||||
|
private void performVersioningOperation(FileVersioningEvent fileVersioningEvent){
|
||||||
|
|
||||||
|
final FileModel currentVersion = fileVersioningEvent.getCurrentVersion();
|
||||||
|
final FileModel olderVersion = fileVersioningEvent.getOlderVersion();
|
||||||
|
|
||||||
|
switch (fileVersioningEvent.getVersioningOperation()) {
|
||||||
|
case SHOW:{
|
||||||
|
|
||||||
|
final WindowVersioning wv = new WindowVersioning(currentVersion);
|
||||||
|
appContrExplorer.getRpcWorkspaceService().getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<FileModel> result) {
|
||||||
|
wv.updateVersioningContainer(result);
|
||||||
|
wv.updateItemsNumber(result.size());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
wv.show();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DOWNLOAD:{
|
||||||
|
AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(olderVersion.getIdentifier(), currentVersion.getName(), DownloadType.DOWNLOAD, false, olderVersion.getIdentifier()));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case DELETE_PERMANENTLY: {
|
||||||
|
|
||||||
|
final WindowVersioning wv = new WindowVersioning(currentVersion);
|
||||||
|
appContrExplorer.getRpcWorkspaceService().performOperationOnVersionedFile(currentVersion, olderVersion, WorkspaceVersioningOperation.DELETE_PERMANENTLY, new AsyncCallback<List<FileModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<FileModel> result) {
|
||||||
|
wv.updateVersioningContainer(result);
|
||||||
|
wv.updateItemsNumber(result.size());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
wv.show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case REFRESH: {
|
||||||
|
final WindowVersioning wv = fileVersioningEvent.getWinVersioning();
|
||||||
|
appContrExplorer.getRpcWorkspaceService().getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileModel>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(List<FileModel> result) {
|
||||||
|
wv.updateVersioningContainer(result);
|
||||||
|
wv.updateItemsNumber(result.size());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
wv.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
case EMPTY_OLDER_VERSIONS: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RESTORE:{
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform trash operation.
|
||||||
*
|
*
|
||||||
* @param operation the operation
|
* @param operation the operation
|
||||||
* @param trashItemIds the trash item ids
|
* @param trashItemIds the trash item ids
|
||||||
*/
|
*/
|
||||||
private void executeTrashOperation(final WorkspaceTrashOperation operation, List<FileModel> trashItemIds){
|
private void performTrashOperation(final WorkspaceTrashOperation operation, List<FileModel> trashItemIds){
|
||||||
|
|
||||||
GWT.log("Executing trash operation: "+operation);
|
GWT.log("Executing trash operation: "+operation);
|
||||||
|
|
||||||
|
@ -2122,7 +2225,7 @@ public class AppController implements SubscriberInterface {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void trashEvent(WorkspaceTrashOperation trashOperation, List<FileModel> targetFileModels) {
|
public void trashEvent(WorkspaceTrashOperation trashOperation, List<FileModel> targetFileModels) {
|
||||||
executeTrashOperation(trashOperation, targetFileModels);
|
performTrashOperation(trashOperation, targetFileModels);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2193,4 +2296,15 @@ public class AppController implements SubscriberInterface {
|
||||||
else
|
else
|
||||||
t.run();
|
t.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#versioningHistory(org.gcube.portlets.user.workspace.client.model.FileModel)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void versioningHistory(FileModel file) {
|
||||||
|
|
||||||
|
eventBus.fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.SHOW, file, null, null));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,162 @@
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.gcube.portlets.user.workspace.client.event;
|
||||||
|
|
||||||
|
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.view.versioning.WindowVersioning;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceVersioningOperation;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Class FileVersioningEvent.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 20, 2017
|
||||||
|
*/
|
||||||
|
public class FileVersioningEvent extends GwtEvent<FileVersioningEventHandler> implements GuiEventInterface{
|
||||||
|
|
||||||
|
public static Type<FileVersioningEventHandler> TYPE = new Type<FileVersioningEventHandler>();
|
||||||
|
private WorkspaceVersioningOperation workspaceVersioningOperation;
|
||||||
|
private FileModel currentVersion;
|
||||||
|
private FileModel olderVersion;
|
||||||
|
private WindowVersioning winVersioning;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new file versioning event.
|
||||||
|
*
|
||||||
|
* @param workspaceVersioningOperation the workspace versioning operation
|
||||||
|
* @param currentVersion the current version
|
||||||
|
* @param olderVersion the older version
|
||||||
|
* @param winVersioning the win versioning
|
||||||
|
*/
|
||||||
|
public FileVersioningEvent(WorkspaceVersioningOperation workspaceVersioningOperation, FileModel currentVersion, FileModel olderVersion, WindowVersioning winVersioning) {
|
||||||
|
this.workspaceVersioningOperation = workspaceVersioningOperation;
|
||||||
|
this.currentVersion = currentVersion;
|
||||||
|
this.olderVersion = olderVersion;
|
||||||
|
this.winVersioning = winVersioning;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the win versioning.
|
||||||
|
*
|
||||||
|
* @return the winVersioning
|
||||||
|
*/
|
||||||
|
public WindowVersioning getWinVersioning() {
|
||||||
|
|
||||||
|
return winVersioning;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the current version.
|
||||||
|
*
|
||||||
|
* @return the currentVersion
|
||||||
|
*/
|
||||||
|
public FileModel getCurrentVersion() {
|
||||||
|
|
||||||
|
return currentVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the current version.
|
||||||
|
*
|
||||||
|
* @param currentVersion the currentVersion to set
|
||||||
|
*/
|
||||||
|
public void setCurrentVersion(FileModel currentVersion) {
|
||||||
|
|
||||||
|
this.currentVersion = currentVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the older version.
|
||||||
|
*
|
||||||
|
* @return the olderVersion
|
||||||
|
*/
|
||||||
|
public FileModel getOlderVersion() {
|
||||||
|
|
||||||
|
return olderVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the workspace versioning operation.
|
||||||
|
*
|
||||||
|
* @param workspaceVersioningOperation the workspaceVersioningOperation to set
|
||||||
|
*/
|
||||||
|
public void setWorkspaceVersioningOperation(
|
||||||
|
WorkspaceVersioningOperation workspaceVersioningOperation) {
|
||||||
|
|
||||||
|
this.workspaceVersioningOperation = workspaceVersioningOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the older version.
|
||||||
|
*
|
||||||
|
* @param olderVersion the olderVersion to set
|
||||||
|
*/
|
||||||
|
public void setOlderVersion(FileModel olderVersion) {
|
||||||
|
|
||||||
|
this.olderVersion = olderVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Type<FileVersioningEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void dispatch(FileVersioningEventHandler handler) {
|
||||||
|
handler.onFileVersioning(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public EventsTypeEnum getKey() {
|
||||||
|
return EventsTypeEnum.FILE_VERSIONING_HISTORY_EVENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the versioning operation.
|
||||||
|
*
|
||||||
|
* @param workspaceVersioningOperation the new versioning operation
|
||||||
|
*/
|
||||||
|
public void setVersioningOperation(WorkspaceVersioningOperation workspaceVersioningOperation) {
|
||||||
|
this.workspaceVersioningOperation = workspaceVersioningOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the versioning operation.
|
||||||
|
*
|
||||||
|
* @return the versioning operation
|
||||||
|
*/
|
||||||
|
public WorkspaceVersioningOperation getVersioningOperation() {
|
||||||
|
|
||||||
|
return workspaceVersioningOperation;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package org.gcube.portlets.user.workspace.client.event;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Interface FileVersioningEventHandler.
|
||||||
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
|
* Feb 20, 2017
|
||||||
|
*/
|
||||||
|
public interface FileVersioningEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* On file versioning.
|
||||||
|
*
|
||||||
|
* @param fileVersioningEvent the file versioning event
|
||||||
|
*/
|
||||||
|
void onFileVersioning(FileVersioningEvent fileVersioningEvent);
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
|
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEvent;
|
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.AddAdministratorEvent;
|
import org.gcube.portlets.user.workspace.client.event.AddAdministratorEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.FileVersioningEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.GetInfoEvent;
|
import org.gcube.portlets.user.workspace.client.event.GetInfoEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.TrashEvent;
|
import org.gcube.portlets.user.workspace.client.event.TrashEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
|
@ -13,6 +14,7 @@ import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceACL.USER_TYPE;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceACL.USER_TYPE;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
||||||
|
import org.gcube.portlets.user.workspace.shared.WorkspaceVersioningOperation;
|
||||||
|
|
||||||
import com.extjs.gxt.ui.client.Style.ButtonScale;
|
import com.extjs.gxt.ui.client.Style.ButtonScale;
|
||||||
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
||||||
|
@ -30,11 +32,16 @@ import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
import com.google.gwt.user.client.ui.AbstractImagePrototype;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* The Class GxtBottomToolBarItem.
|
||||||
*
|
*
|
||||||
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||||
*/
|
*/
|
||||||
public class GxtBottomToolBarItem extends ToolBar{
|
public class GxtBottomToolBarItem extends ToolBar{
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final String VERSIONING = "Versioning";
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -58,11 +65,15 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
private Button bHistory;
|
private Button bHistory;
|
||||||
private Button bRead;
|
private Button bRead;
|
||||||
private Button btnGetTrash;
|
private Button btnGetTrash;
|
||||||
|
private Button btnVersioning;
|
||||||
private ACLDivInfo aclDivInfo;
|
private ACLDivInfo aclDivInfo;
|
||||||
private Label labelItemsNumber = new Label();
|
private Label labelItemsNumber = new Label();
|
||||||
private HorizontalPanel hpItemsNumber;
|
private HorizontalPanel hpItemsNumber;
|
||||||
private Button btnAddAdmin;
|
private Button btnAddAdmin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new gxt bottom tool bar item.
|
||||||
|
*/
|
||||||
public GxtBottomToolBarItem(){
|
public GxtBottomToolBarItem(){
|
||||||
super();
|
super();
|
||||||
initToolbar();
|
initToolbar();
|
||||||
|
@ -77,6 +88,9 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
setItemsNumberToCenter();
|
setItemsNumberToCenter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inits the toolbar.
|
||||||
|
*/
|
||||||
private void initToolbar(){
|
private void initToolbar(){
|
||||||
|
|
||||||
btnGetTrash = new Button("Trash");
|
btnGetTrash = new Button("Trash");
|
||||||
|
@ -129,6 +143,19 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
btnVersioning = new Button(VERSIONING);
|
||||||
|
btnVersioning.setIcon(Resources.getIconVersioning());
|
||||||
|
btnVersioning.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
|
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.SHOW, null, null, null));
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
btnAddAdmin = new Button(EDIT_ADMINISTRATOR);
|
btnAddAdmin = new Button(EDIT_ADMINISTRATOR);
|
||||||
//TODO CHANGE ICON
|
//TODO CHANGE ICON
|
||||||
btnAddAdmin.setIcon(Resources.getIconManageAdministrator());
|
btnAddAdmin.setIcon(Resources.getIconManageAdministrator());
|
||||||
|
@ -149,6 +176,7 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
add(btnGetTrash);
|
add(btnGetTrash);
|
||||||
add(btnGetInfo);
|
add(btnGetInfo);
|
||||||
add(bHistory);
|
add(bHistory);
|
||||||
|
add(btnVersioning);
|
||||||
|
|
||||||
hpItemsNumber = new HorizontalPanel();
|
hpItemsNumber = new HorizontalPanel();
|
||||||
hpItemsNumber.setId("HP-ItemsNumber");
|
hpItemsNumber.setId("HP-ItemsNumber");
|
||||||
|
@ -165,11 +193,19 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
enableInfoHistoryButtons(false);
|
enableInfoHistoryButtons(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the visible add administrators.
|
||||||
|
*
|
||||||
|
* @param bool the new visible add administrators
|
||||||
|
*/
|
||||||
private void setVisibleAddAdministrators(boolean bool){
|
private void setVisibleAddAdministrators(boolean bool){
|
||||||
btnAddAdmin.setVisible(bool);
|
btnAddAdmin.setVisible(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset details.
|
||||||
|
*/
|
||||||
public void resetDetails(){
|
public void resetDetails(){
|
||||||
|
|
||||||
this.txtDimension.setText("");
|
this.txtDimension.setText("");
|
||||||
|
@ -178,12 +214,29 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
this.txtOwner.setText("");
|
this.txtOwner.setText("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable info history buttons.
|
||||||
|
*
|
||||||
|
* @param enable the enable
|
||||||
|
*/
|
||||||
public void enableInfoHistoryButtons(boolean enable){
|
public void enableInfoHistoryButtons(boolean enable){
|
||||||
bHistory.setEnabled(enable);
|
bHistory.setEnabled(enable);
|
||||||
bRead.setEnabled(enable);
|
bRead.setEnabled(enable);
|
||||||
btnGetInfo.setEnabled(enable);
|
btnGetInfo.setEnabled(enable);
|
||||||
|
btnVersioning.setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the details.
|
||||||
|
*
|
||||||
|
* @param itemName the item name
|
||||||
|
* @param description the description
|
||||||
|
* @param dimension the dimension
|
||||||
|
* @param creationTime the creation time
|
||||||
|
* @param owner the owner
|
||||||
|
*/
|
||||||
public void setDetails(String itemName, String description, String dimension, String creationTime, String owner){
|
public void setDetails(String itemName, String description, String dimension, String creationTime, String owner){
|
||||||
|
|
||||||
this.resetDetails();
|
this.resetDetails();
|
||||||
|
@ -195,6 +248,11 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update acl info.
|
||||||
|
*
|
||||||
|
* @param acl the acl
|
||||||
|
*/
|
||||||
public void updateACLInfo(WorkspaceACL acl){
|
public void updateACLInfo(WorkspaceACL acl){
|
||||||
setVisibleAddAdministrators(false);
|
setVisibleAddAdministrators(false);
|
||||||
|
|
||||||
|
@ -209,6 +267,12 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update add administator info.
|
||||||
|
*
|
||||||
|
* @param loginUserLogger the login user logger
|
||||||
|
* @param acl the acl
|
||||||
|
*/
|
||||||
public void updateAddAdministatorInfo(String loginUserLogger, ExtendedWorkspaceACL acl){
|
public void updateAddAdministatorInfo(String loginUserLogger, ExtendedWorkspaceACL acl){
|
||||||
setVisibleAddAdministrators(false);
|
setVisibleAddAdministrators(false);
|
||||||
|
|
||||||
|
@ -225,6 +289,11 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
this.layout();
|
this.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update trash icon.
|
||||||
|
*
|
||||||
|
* @param trashIsFull the trash is full
|
||||||
|
*/
|
||||||
public void updateTrashIcon(boolean trashIsFull){
|
public void updateTrashIcon(boolean trashIsFull){
|
||||||
|
|
||||||
if(trashIsFull)
|
if(trashIsFull)
|
||||||
|
@ -234,7 +303,9 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param size
|
* Update items number.
|
||||||
|
*
|
||||||
|
* @param size the size
|
||||||
*/
|
*/
|
||||||
public void updateItemsNumber(int size) {
|
public void updateItemsNumber(int size) {
|
||||||
if(size<=0)
|
if(size<=0)
|
||||||
|
@ -247,6 +318,9 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
hpItemsNumber.layout();
|
hpItemsNumber.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the items number to center.
|
||||||
|
*/
|
||||||
public void setItemsNumberToCenter(){
|
public void setItemsNumberToCenter(){
|
||||||
|
|
||||||
if(this.isRendered()){
|
if(this.isRendered()){
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.workspace.client.view.version;
|
package org.gcube.portlets.user.workspace.client.view.versioning;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -59,19 +59,21 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
private Button buttonRestore;
|
private Button buttonRestore;
|
||||||
private Button buttonRestoreAll;
|
private Button buttonRestoreAll;
|
||||||
private Button buttonEmptyTrash;
|
private Button buttonEmptyTrash;
|
||||||
private FileModel fileVersioned;
|
private FileModel currentVersion;
|
||||||
|
private WindowVersioning windowVersioning;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new versioning info container.
|
* Instantiates a new versioning info container.
|
||||||
*
|
*
|
||||||
* @param file the versioning files
|
* @param file the versioning files
|
||||||
*/
|
*/
|
||||||
public VersioningInfoContainer(FileModel file) {
|
public VersioningInfoContainer(FileModel file, WindowVersioning windowVersioning) {
|
||||||
|
|
||||||
initContentPanel();
|
initContentPanel();
|
||||||
initGrid();
|
initGrid();
|
||||||
createToolBar();
|
createToolBar();
|
||||||
this.fileVersioned = file;
|
this.currentVersion = file;
|
||||||
|
this.windowVersioning = windowVersioning;
|
||||||
|
|
||||||
activeButtonOnSelection(false);
|
activeButtonOnSelection(false);
|
||||||
//updateVersions(file);
|
//updateVersions(file);
|
||||||
|
@ -125,7 +127,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
if(checkSelection())
|
if(checkSelection())
|
||||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.RESTORE, grid.getSelectionModel().getSelectedItems().get(0)));
|
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.RESTORE, currentVersion, grid.getSelectionModel().getSelectedItems().get(0), windowVersioning));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -142,7 +144,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
if(checkSelection())
|
if(checkSelection())
|
||||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DELETE_PERMANENTLY, grid.getSelectionModel().getSelectedItems().get(0)));
|
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DELETE_PERMANENTLY,currentVersion, grid.getSelectionModel().getSelectedItems().get(0), windowVersioning));
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -162,7 +164,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
if(checkSelection())
|
if(checkSelection())
|
||||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DOWNLOAD, grid.getSelectionModel().getSelectedItems().get(0)));
|
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.DOWNLOAD, currentVersion, grid.getSelectionModel().getSelectedItems().get(0), windowVersioning));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -181,7 +183,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
// if(checkSelection())
|
// if(checkSelection())
|
||||||
// AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS, null));
|
// AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS, null));
|
||||||
|
|
||||||
DialogConfirm box = new DialogConfirm(null, "Confirm Delete?", "Are you sure you want delete older versions of: "+ fileVersioned.getName());
|
DialogConfirm box = new DialogConfirm(null, "Confirm Delete?", "Are you sure you want delete older versions of: "+ currentVersion.getName());
|
||||||
box.setModal(true);
|
box.setModal(true);
|
||||||
box.center();
|
box.center();
|
||||||
box.getYesButton().addClickHandler(new ClickHandler() {
|
box.getYesButton().addClickHandler(new ClickHandler() {
|
||||||
|
@ -189,7 +191,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
|
||||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS, fileVersioned));
|
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS, currentVersion, null, windowVersioning));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -209,7 +211,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.REFRESH, null));
|
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.REFRESH, currentVersion, null, windowVersioning));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.gcube.portlets.user.workspace.client.view.version;
|
package org.gcube.portlets.user.workspace.client.view.versioning;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -46,7 +46,7 @@ public class WindowVersioning extends Window {
|
||||||
*
|
*
|
||||||
* @param fileVersioned the file versioned
|
* @param fileVersioned the file versioned
|
||||||
*/
|
*/
|
||||||
private WindowVersioning(FileModel fileVersioned) {
|
public WindowVersioning(FileModel fileVersioned) {
|
||||||
initAccounting();
|
initAccounting();
|
||||||
this.fileVersioned = fileVersioned;
|
this.fileVersioned = fileVersioned;
|
||||||
//setIcon(Resources.getTrashFull()); //TODO
|
//setIcon(Resources.getTrashFull()); //TODO
|
||||||
|
@ -61,7 +61,7 @@ public class WindowVersioning extends Window {
|
||||||
setSize(770, 400);
|
setSize(770, 400);
|
||||||
setResizable(true);
|
setResizable(true);
|
||||||
setMaximizable(true);
|
setMaximizable(true);
|
||||||
this.versioningContainer = new VersioningInfoContainer(fileVersioned);
|
this.versioningContainer = new VersioningInfoContainer(fileVersioned, this);
|
||||||
add(versioningContainer);
|
add(versioningContainer);
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar();
|
ToolBar toolBar = new ToolBar();
|
Loading…
Reference in New Issue