Enhancement on file versioning #7006
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@142811 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
33c3c4fa22
commit
ced48b264d
|
@ -99,6 +99,7 @@ import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum
|
||||||
import org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface;
|
import org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
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.model.FolderModel;
|
import org.gcube.portlets.user.workspace.client.model.FolderModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.ScopeModel;
|
import org.gcube.portlets.user.workspace.client.model.ScopeModel;
|
||||||
import org.gcube.portlets.user.workspace.client.view.WorkspaceFeaturesView;
|
import org.gcube.portlets.user.workspace.client.view.WorkspaceFeaturesView;
|
||||||
|
@ -487,11 +488,8 @@ public class AppController implements SubscriberInterface {
|
||||||
}else{ //IS MULTISELECTION
|
}else{ //IS MULTISELECTION
|
||||||
|
|
||||||
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activeButtonForMultiSelection(true);
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activeButtonForMultiSelection(true);
|
||||||
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().enableInfoHistoryButtons(false);
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().enableInfoHistoryButtons(event.getSourceFile(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//setFileDetailsInView(event.getSourceFile().getIdentifier());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -1032,7 +1030,7 @@ public class AppController implements SubscriberInterface {
|
||||||
private void doElementGridSelected(boolean isSelected, FileModel target) {
|
private void doElementGridSelected(boolean isSelected, FileModel target) {
|
||||||
|
|
||||||
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activeButtonsOnSelectForOperation(target, isSelected);
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activeButtonsOnSelectForOperation(target, isSelected);
|
||||||
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().enableInfoHistoryButtons(isSelected);
|
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemDetails().enableInfoHistoryButtons(target, isSelected);
|
||||||
disableButtonsOnBreadcrumbSpecialFolder();
|
disableButtonsOnBreadcrumbSpecialFolder();
|
||||||
|
|
||||||
if(isSelected){
|
if(isSelected){
|
||||||
|
@ -2043,21 +2041,26 @@ public class AppController implements SubscriberInterface {
|
||||||
*/
|
*/
|
||||||
private void performVersioningOperation(FileVersioningEvent fileVersioningEvent){
|
private void performVersioningOperation(FileVersioningEvent fileVersioningEvent){
|
||||||
|
|
||||||
final FileModel currentVersion = fileVersioningEvent.getCurrentVersion();
|
FileModel currentVersion = fileVersioningEvent.getCurrentVersion();
|
||||||
final FileModel olderVersion = fileVersioningEvent.getOlderVersion();
|
FileModel olderVersion = fileVersioningEvent.getOlderVersion();
|
||||||
|
|
||||||
|
//INVOKING FROM TOOLBAR??
|
||||||
|
if(currentVersion==null) {
|
||||||
|
currentVersion = getGridSelectedItem();
|
||||||
|
}
|
||||||
|
|
||||||
switch (fileVersioningEvent.getVersioningOperation()) {
|
switch (fileVersioningEvent.getVersioningOperation()) {
|
||||||
case SHOW:{
|
case SHOW:{
|
||||||
|
|
||||||
final WindowVersioning wv = new WindowVersioning(currentVersion);
|
final WindowVersioning wv = new WindowVersioning(currentVersion);
|
||||||
appContrExplorer.getRpcWorkspaceService().getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileModel>>() {
|
appContrExplorer.getRpcWorkspaceService().getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileVersionModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<FileModel> result) {
|
public void onSuccess(List<FileVersionModel> result) {
|
||||||
wv.updateVersioningContainer(result);
|
wv.updateVersioningContainer(result);
|
||||||
wv.updateItemsNumber(result.size());
|
wv.updateItemsNumber(result.size());
|
||||||
}
|
}
|
||||||
|
@ -2074,7 +2077,7 @@ public class AppController implements SubscriberInterface {
|
||||||
case DELETE_PERMANENTLY: {
|
case DELETE_PERMANENTLY: {
|
||||||
|
|
||||||
final WindowVersioning wv = new WindowVersioning(currentVersion);
|
final WindowVersioning wv = new WindowVersioning(currentVersion);
|
||||||
appContrExplorer.getRpcWorkspaceService().performOperationOnVersionedFile(currentVersion, olderVersion, WorkspaceVersioningOperation.DELETE_PERMANENTLY, new AsyncCallback<List<FileModel>>() {
|
appContrExplorer.getRpcWorkspaceService().performOperationOnVersionedFile(currentVersion, olderVersion, WorkspaceVersioningOperation.DELETE_PERMANENTLY, new AsyncCallback<List<FileVersionModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
@ -2082,7 +2085,7 @@ public class AppController implements SubscriberInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<FileModel> result) {
|
public void onSuccess(List<FileVersionModel> result) {
|
||||||
wv.updateVersioningContainer(result);
|
wv.updateVersioningContainer(result);
|
||||||
wv.updateItemsNumber(result.size());
|
wv.updateItemsNumber(result.size());
|
||||||
|
|
||||||
|
@ -2094,14 +2097,14 @@ public class AppController implements SubscriberInterface {
|
||||||
|
|
||||||
case REFRESH: {
|
case REFRESH: {
|
||||||
final WindowVersioning wv = fileVersioningEvent.getWinVersioning();
|
final WindowVersioning wv = fileVersioningEvent.getWinVersioning();
|
||||||
appContrExplorer.getRpcWorkspaceService().getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileModel>>() {
|
appContrExplorer.getRpcWorkspaceService().getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback<List<FileVersionModel>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(List<FileModel> result) {
|
public void onSuccess(List<FileVersionModel> result) {
|
||||||
wv.updateVersioningContainer(result);
|
wv.updateVersioningContainer(result);
|
||||||
wv.updateItemsNumber(result.size());
|
wv.updateItemsNumber(result.size());
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,7 +310,7 @@ public class GxtGridFilterGroupPanel extends LayoutContainer {
|
||||||
case URL_DOCUMENT:
|
case URL_DOCUMENT:
|
||||||
case EXTERNAL_RESOURCE_LINK:
|
case EXTERNAL_RESOURCE_LINK:
|
||||||
|
|
||||||
AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW, target.isDirectory() || target.isVreFolder()));
|
AppController.getEventBus().fireEvent(new FileDownloadEvent(target.getIdentifier(), target.getName(), DownloadType.SHOW, target.isDirectory() || target.isVreFolder(), null));
|
||||||
break;
|
break;
|
||||||
case EXTERNAL_URL:
|
case EXTERNAL_URL:
|
||||||
AppController.getEventBus().fireEvent(new ShowUrlEvent(target));
|
AppController.getEventBus().fireEvent(new ShowUrlEvent(target));
|
||||||
|
|
|
@ -8,6 +8,8 @@ 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.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.interfaces.GXTFolderItemTypeEnum;
|
||||||
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
import org.gcube.portlets.user.workspace.client.util.GetPermissionIconByACL;
|
import org.gcube.portlets.user.workspace.client.util.GetPermissionIconByACL;
|
||||||
import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
|
import org.gcube.portlets.user.workspace.shared.ExtendedWorkspaceACL;
|
||||||
|
@ -149,13 +151,10 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
AppController.getEventBus().fireEvent(new FileVersioningEvent(WorkspaceVersioningOperation.SHOW, null, null, null));
|
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());
|
||||||
|
@ -190,7 +189,7 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
add(filler);
|
add(filler);
|
||||||
add(btnAddAdmin);
|
add(btnAddAdmin);
|
||||||
add(aclDivInfo);
|
add(aclDivInfo);
|
||||||
enableInfoHistoryButtons(false);
|
enableInfoHistoryButtons(null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,17 +214,23 @@ public class GxtBottomToolBarItem extends ToolBar{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable info history buttons.
|
* Enable info history buttons.
|
||||||
*
|
*
|
||||||
|
* @param selectedFile the selected file
|
||||||
* @param enable the enable
|
* @param enable the enable
|
||||||
*/
|
*/
|
||||||
public void enableInfoHistoryButtons(boolean enable){
|
public void enableInfoHistoryButtons(FileModel target, boolean enable){
|
||||||
bHistory.setEnabled(enable);
|
bHistory.setEnabled(enable);
|
||||||
bRead.setEnabled(enable);
|
bRead.setEnabled(enable);
|
||||||
btnGetInfo.setEnabled(enable);
|
btnGetInfo.setEnabled(enable);
|
||||||
btnVersioning.setEnabled(enable);
|
|
||||||
|
btnVersioning.setEnabled(false);
|
||||||
|
if(target!=null){
|
||||||
|
GXTFolderItemTypeEnum category = target.getGXTFolderItemType();
|
||||||
|
if(category!=null && (category.equals(GXTFolderItemTypeEnum.EXTERNAL_FILE) || category.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE) || category.equals(GXTFolderItemTypeEnum.EXTERNAL_IMAGE)))
|
||||||
|
btnVersioning.setEnabled(enable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,9 +17,9 @@ import org.gcube.portlets.user.workspace.client.event.GetPublicLinkEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.GetShareLinkEvent;
|
import org.gcube.portlets.user.workspace.client.event.GetShareLinkEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.GridRefreshEvent;
|
import org.gcube.portlets.user.workspace.client.event.GridRefreshEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent;
|
import org.gcube.portlets.user.workspace.client.event.ImagePreviewEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.ShowUrlEvent;
|
|
||||||
import org.gcube.portlets.user.workspace.client.event.PasteItemEvent;
|
import org.gcube.portlets.user.workspace.client.event.PasteItemEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
|
import org.gcube.portlets.user.workspace.client.event.RenameItemEvent;
|
||||||
|
import org.gcube.portlets.user.workspace.client.event.ShowUrlEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.VREChangePermissionsEvent;
|
import org.gcube.portlets.user.workspace.client.event.VREChangePermissionsEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.WebDavUrlEvent;
|
import org.gcube.portlets.user.workspace.client.event.WebDavUrlEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.event.WsGetFolderLinkEvent;
|
import org.gcube.portlets.user.workspace.client.event.WsGetFolderLinkEvent;
|
||||||
|
@ -524,7 +524,7 @@ public class GxtToolBarItemFunctionality {
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
|
||||||
final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
|
final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
|
||||||
AppController.getEventBus().fireEvent(new FileDownloadEvent(fileGridModel.getIdentifier(), fileGridModel.getName(), DownloadType.DOWNLOAD, fileGridModel.isDirectory() || fileGridModel.isVreFolder()));
|
AppController.getEventBus().fireEvent(new FileDownloadEvent(fileGridModel.getIdentifier(), fileGridModel.getName(), DownloadType.DOWNLOAD, fileGridModel.isDirectory() || fileGridModel.isVreFolder(), null));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ public class GxtToolBarItemFunctionality {
|
||||||
AppController.getEventBus().fireEvent(new ShowUrlEvent(fileGridModel));
|
AppController.getEventBus().fireEvent(new ShowUrlEvent(fileGridModel));
|
||||||
|
|
||||||
}else
|
}else
|
||||||
AppController.getEventBus().fireEvent(new FileDownloadEvent(fileGridModel.getIdentifier(), fileGridModel.getName(), DownloadType.SHOW,fileGridModel.isDirectory() || fileGridModel.isVreFolder()));
|
AppController.getEventBus().fireEvent(new FileDownloadEvent(fileGridModel.getIdentifier(), fileGridModel.getName(), DownloadType.SHOW,fileGridModel.isDirectory() || fileGridModel.isVreFolder(), null));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.AppController;
|
import org.gcube.portlets.user.workspace.client.AppController;
|
||||||
import org.gcube.portlets.user.workspace.client.event.FileVersioningEvent;
|
import org.gcube.portlets.user.workspace.client.event.FileVersioningEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
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.resources.Resources;
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
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.shared.WorkspaceTrashOperation;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
|
||||||
|
@ -28,10 +28,8 @@ import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
||||||
import com.extjs.gxt.ui.client.widget.MessageBox;
|
import com.extjs.gxt.ui.client.widget.MessageBox;
|
||||||
import com.extjs.gxt.ui.client.widget.button.Button;
|
import com.extjs.gxt.ui.client.widget.button.Button;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
|
||||||
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
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.Grid;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
|
||||||
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
import com.extjs.gxt.ui.client.widget.grid.GroupingView;
|
||||||
import com.extjs.gxt.ui.client.widget.grid.filters.GridFilters;
|
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;
|
||||||
|
@ -57,8 +55,8 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
//private GridDropTarget gridDropTarget;
|
//private GridDropTarget gridDropTarget;
|
||||||
private Button buttonDelete;
|
private Button buttonDelete;
|
||||||
private Button buttonRestore;
|
private Button buttonRestore;
|
||||||
private Button buttonRestoreAll;
|
private Button buttonDownload;
|
||||||
private Button buttonEmptyTrash;
|
private Button buttonEmptyVersions;
|
||||||
private FileModel currentVersion;
|
private FileModel currentVersion;
|
||||||
private WindowVersioning windowVersioning;
|
private WindowVersioning windowVersioning;
|
||||||
|
|
||||||
|
@ -154,11 +152,11 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
bar.add(new SeparatorMenuItem());
|
bar.add(new SeparatorMenuItem());
|
||||||
|
|
||||||
buttonRestoreAll = new Button(WorkspaceVersioningOperation.DOWNLOAD.getLabel(),Resources.getIconRecycle());
|
buttonDownload = new Button(WorkspaceVersioningOperation.DOWNLOAD.getLabel(),Resources.getIconRecycle());
|
||||||
buttonRestoreAll.setToolTip(WorkspaceVersioningOperation.DOWNLOAD.getOperationDescription());
|
buttonDownload.setToolTip(WorkspaceVersioningOperation.DOWNLOAD.getOperationDescription());
|
||||||
buttonRestoreAll.setScale(ButtonScale.SMALL);
|
buttonDownload.setScale(ButtonScale.SMALL);
|
||||||
buttonRestoreAll.setIconAlign(IconAlign.TOP);
|
buttonDownload.setIconAlign(IconAlign.TOP);
|
||||||
buttonRestoreAll.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
buttonDownload.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
@ -168,14 +166,14 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bar.add(buttonRestoreAll);
|
bar.add(buttonDownload);
|
||||||
|
|
||||||
|
|
||||||
buttonEmptyTrash = new Button(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS.getLabel(),Resources.getTrashEmpty());
|
buttonEmptyVersions = new Button(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS.getLabel(),Resources.getTrashEmpty());
|
||||||
buttonEmptyTrash.setToolTip(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS.getOperationDescription());
|
buttonEmptyVersions.setToolTip(WorkspaceVersioningOperation.EMPTY_OLDER_VERSIONS.getOperationDescription());
|
||||||
buttonEmptyTrash.setScale(ButtonScale.SMALL);
|
buttonEmptyVersions.setScale(ButtonScale.SMALL);
|
||||||
buttonEmptyTrash.setIconAlign(IconAlign.TOP);
|
buttonEmptyVersions.setIconAlign(IconAlign.TOP);
|
||||||
buttonEmptyTrash.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
buttonEmptyVersions.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentSelected(ButtonEvent ce) {
|
public void componentSelected(ButtonEvent ce) {
|
||||||
|
@ -183,7 +181,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: "+ currentVersion.getName());
|
DialogConfirm box = new DialogConfirm(null, "Confirm Delete?", "Are you sure you want delete the 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() {
|
||||||
|
@ -197,7 +195,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bar.add(buttonEmptyTrash);
|
bar.add(buttonEmptyVersions);
|
||||||
|
|
||||||
|
|
||||||
bar.add(new FillToolItem());
|
bar.add(new FillToolItem());
|
||||||
|
@ -229,17 +227,15 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
//ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 25);
|
//ColumnConfig icon = new ColumnConfig(FileGridModel.ICON, "", 25);
|
||||||
ColumnConfig name = createSortableColumnConfig(FileModel.NAME, FileModel.NAME, 200);
|
ColumnConfig name = createSortableColumnConfig(FileModel.NAME, FileModel.NAME, 200);
|
||||||
ColumnConfig type = createSortableColumnConfig(FileModel.TYPE, FileModel.TYPE, 80);
|
//ColumnConfig type = createSortableColumnConfig(FileModel.TYPE, FileModel.TYPE, 80);
|
||||||
//ColumnConfig originalPath = createSortableColumnConfig(FileTrashedModel.STOREINFO.ORIGINALPATH.toString(), "Original Path", 200);
|
ColumnConfig originalPath = createSortableColumnConfig(FileVersionModel.PATH, "Original Path", 200);
|
||||||
//ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Deleted Date", 90);
|
//ColumnConfig deleteDate = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEDATE.toString(), "Deleted Date", 90);
|
||||||
//deleteDate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
|
//deleteDate.setDateTimeFormat(DateTimeFormat.getFormat("dd MMM hh:mm aaa yyyy"));
|
||||||
//ColumnConfig deleteUser = createSortableColumnConfig(FileTrashedModel.STOREINFO.DELETEUSER.toString(), "Deleted By", 150);
|
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(icon, name, type, originalPath, deleteDate, deleteUser));
|
||||||
|
|
||||||
ColumnModel cm = new ColumnModel(Arrays.asList(name));
|
ColumnModel cm = new ColumnModel(Arrays.asList(name, originalPath, user));
|
||||||
|
|
||||||
final ColumnModel columnModel = cm;
|
|
||||||
|
|
||||||
grid = new Grid<FileModel>(this.store, cm);
|
grid = new Grid<FileModel>(this.store, cm);
|
||||||
|
|
||||||
|
@ -249,38 +245,16 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
this.grid.setView(view);
|
this.grid.setView(view);
|
||||||
this.grid.setContextMenu(null);
|
this.grid.setContextMenu(null);
|
||||||
|
|
||||||
|
|
||||||
GridCellRenderer<FileModel> folderRender = new GridCellRenderer<FileModel>() {
|
|
||||||
@Override
|
|
||||||
public String render(FileModel model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<FileModel> store, Grid<FileModel> grid) {
|
|
||||||
String val = model.get(property);
|
|
||||||
String color = "black";
|
|
||||||
|
|
||||||
if(val != null && val.equals(GXTFolderItemTypeEnum.FOLDER.toString())){
|
|
||||||
// color = "#EEC900";
|
|
||||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='font-weight: bold;color:" + color + "'>" + val + "</span>";
|
|
||||||
}else{
|
|
||||||
if(val==null)
|
|
||||||
val = "";
|
|
||||||
return "<span qtitle='" + columnModel.getColumnById(property).getHeader() + "' qtip='" + val + "' style='color:" + color + "'>" + val + "</span>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
type.setRenderer(folderRender);
|
|
||||||
|
|
||||||
GridFilters filters = new GridFilters();
|
GridFilters filters = new GridFilters();
|
||||||
filters.setLocal(true);
|
filters.setLocal(true);
|
||||||
|
|
||||||
|
|
||||||
StringFilter nameFilter = new StringFilter(FileModel.NAME);
|
StringFilter nameFilter = new StringFilter(FileModel.NAME);
|
||||||
StringFilter typeFilter = new StringFilter(FileModel.TYPE);
|
StringFilter pathFilter = new StringFilter("Original Path");
|
||||||
|
StringFilter userFilter = new StringFilter("User");
|
||||||
//DateFilter dateFilter = new DateFilter(FileModel.STOREINFO.DELETEDATE.toString());
|
|
||||||
|
|
||||||
filters.addFilter(nameFilter);
|
filters.addFilter(nameFilter);
|
||||||
filters.addFilter(typeFilter);
|
filters.addFilter(pathFilter);
|
||||||
//filters.addFilter(dateFilter);
|
filters.addFilter(userFilter);
|
||||||
|
|
||||||
grid.addPlugin(filters);
|
grid.addPlugin(filters);
|
||||||
|
|
||||||
|
@ -307,7 +281,6 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the panel size.
|
* Sets the panel size.
|
||||||
*
|
*
|
||||||
|
@ -318,28 +291,18 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
|
|
||||||
if (width > 0 && height > 0 && grid != null) {
|
if (width > 0 && height > 0 && grid != null) {
|
||||||
cp.setSize(width, height);
|
cp.setSize(width, height);
|
||||||
// grid.setSize(width, height);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update versions.
|
* Update versions.
|
||||||
*
|
*
|
||||||
* @param versioningFiles the versioning files
|
* @param versioningFiles the versioning files
|
||||||
*/
|
*/
|
||||||
public void updateVersions(List<FileModel> versioningFiles) {
|
public void updateVersions(List<FileVersionModel> versioningFiles) {
|
||||||
|
|
||||||
store.removeAll();
|
store.removeAll();
|
||||||
typeStoreOperation.removeAll();
|
typeStoreOperation.removeAll();
|
||||||
|
|
||||||
// for (FileModel fileTrashedModel : trashFiles) {
|
|
||||||
// fileTrashedModel.setIcon();
|
|
||||||
// }
|
|
||||||
|
|
||||||
store.add(versioningFiles);
|
store.add(versioningFiles);
|
||||||
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
activeButtonsOnNotEmtpy(store.getModels().size()>0);
|
||||||
}
|
}
|
||||||
|
@ -350,8 +313,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
* @param isNotEmpty the is not empty
|
* @param isNotEmpty the is not empty
|
||||||
*/
|
*/
|
||||||
private void activeButtonsOnNotEmtpy(boolean isNotEmpty) {
|
private void activeButtonsOnNotEmtpy(boolean isNotEmpty) {
|
||||||
buttonRestoreAll.setEnabled(isNotEmpty);
|
buttonEmptyVersions.setEnabled(isNotEmpty);
|
||||||
buttonEmptyTrash.setEnabled(isNotEmpty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -362,6 +324,7 @@ public class VersioningInfoContainer extends LayoutContainer {
|
||||||
protected void activeButtonOnSelection(boolean bool) {
|
protected void activeButtonOnSelection(boolean bool) {
|
||||||
buttonDelete.setEnabled(bool);
|
buttonDelete.setEnabled(bool);
|
||||||
buttonRestore.setEnabled(bool);
|
buttonRestore.setEnabled(bool);
|
||||||
|
buttonDownload.setEnabled(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.gcube.portlets.user.workspace.client.AppController;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
|
||||||
import org.gcube.portlets.user.workspace.client.event.UpdateWorkspaceSizeEvent;
|
import org.gcube.portlets.user.workspace.client.event.UpdateWorkspaceSizeEvent;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
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.resources.Resources;
|
import org.gcube.portlets.user.workspace.client.resources.Resources;
|
||||||
import org.gcube.portlets.user.workspace.shared.WorkspaceVersioningOperation;
|
import org.gcube.portlets.user.workspace.shared.WorkspaceVersioningOperation;
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
||||||
*/
|
*/
|
||||||
public class WindowVersioning extends Window {
|
public class WindowVersioning extends Window {
|
||||||
|
|
||||||
private List<FileModel> versionedFile;
|
private List<FileVersionModel> versionedFiles;
|
||||||
private VersioningInfoContainer versioningContainer;
|
private VersioningInfoContainer versioningContainer;
|
||||||
private HorizontalPanel hpItemsNumber;
|
private HorizontalPanel hpItemsNumber;
|
||||||
private Label labelItemsNumber = new Label();
|
private Label labelItemsNumber = new Label();
|
||||||
|
@ -170,10 +171,10 @@ public class WindowVersioning extends Window {
|
||||||
*
|
*
|
||||||
* @param versioningFiles the versioning files
|
* @param versioningFiles the versioning files
|
||||||
*/
|
*/
|
||||||
public void updateVersioningContainer(List<FileModel> versioningFiles) {
|
public void updateVersioningContainer(List<FileVersionModel> versioningFiles) {
|
||||||
|
|
||||||
this.versioningContainer.resetStore();
|
this.versioningContainer.resetStore();
|
||||||
this.versionedFile = versioningFiles;
|
this.versionedFiles = versioningFiles;
|
||||||
this.versioningContainer.updateVersions(versioningFiles);
|
this.versioningContainer.updateVersions(versioningFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,13 +198,14 @@ public class WindowVersioning extends Window {
|
||||||
this.unmask();
|
this.unmask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the versions of file.
|
* Gets the versions.
|
||||||
*
|
*
|
||||||
* @return the versions of file
|
* @return the versions
|
||||||
*/
|
*/
|
||||||
public List<FileModel> getVersionsOfFile() {
|
public List<FileVersionModel> getVersions() {
|
||||||
return versionedFile;
|
return versionedFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue