diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java index fb74abb..eef6ca6 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppController.java @@ -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 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>() { + AppControllerExplorer.rpcWorkspaceService.getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback>() { @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>() { + fileVersioningEvent.getWinVersioning().mask("performing operation..."); + List olderVsIds = new ArrayList(olderVersions.size()); + for (FileVersionModel fileVersionModel : olderVersions) { + olderVsIds.add(fileVersionModel.getIdentifier()); + } + + AppControllerExplorer.rpcWorkspaceService.performOperationOnVersionedFile(currentVersion.getIdentifier(), olderVsIds, WorkspaceVersioningOperation.DELETE_PERMANENTLY, new AsyncCallback>() { @Override public void onFailure(Throwable caught) { + fileVersioningEvent.getWinVersioning().unmask(); + Window.alert("error: "+caught); } @Override public void onSuccess(List 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>() { + fileVersioningEvent.getWinVersioning().mask("performing operation..."); + AppControllerExplorer.rpcWorkspaceService.getVersionHistory(currentVersion.getIdentifier(), new AsyncCallback>() { @Override public void onFailure(Throwable caught) { + fileVersioningEvent.getWinVersioning().unmask(); } @Override public void onSuccess(List 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 olderVsIds = new ArrayList(olderVersions.size()); + for (FileVersionModel fileVersionModel : olderVersions) { + olderVsIds.add(fileVersionModel.getIdentifier()); + } + + AppControllerExplorer.rpcWorkspaceService.performOperationOnVersionedFile(currentVersion.getIdentifier(), olderVsIds, WorkspaceVersioningOperation.DELETE_ALL_OLDER_VERSIONS, new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + fileVersioningEvent.getWinVersioning().unmask(); + Window.alert("error: "+caught); + + } + + @Override + public void onSuccess(List result) { + fileVersioningEvent.getWinVersioning().unmask(); + fileVersioningEvent.getWinVersioning().updateVersioningContainer(result); + fileVersioningEvent.getWinVersioning().updateItemsNumber(result.size()); + + } + }); break; } case RESTORE:{ + fileVersioningEvent.getWinVersioning().mask("performing operation..."); + List olderVsIds = new ArrayList(olderVersions.size()); + for (FileVersionModel fileVersionModel : olderVersions) { + olderVsIds.add(fileVersionModel.getIdentifier()); + } + + AppControllerExplorer.rpcWorkspaceService.performOperationOnVersionedFile(currentVersion.getIdentifier(), olderVsIds, WorkspaceVersioningOperation.RESTORE, new AsyncCallback>() { + + @Override + public void onFailure(Throwable caught) { + fileVersioningEvent.getWinVersioning().unmask(); + Window.alert("error: "+caught); + + } + + @Override + public void onSuccess(List 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)); } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/FileVersioningEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/FileVersioningEvent.java index 6fd9a7f..26324df 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/FileVersioningEvent.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/FileVersioningEvent.java @@ -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 im public static Type TYPE = new Type(); private WorkspaceVersioningOperation workspaceVersioningOperation; private FileModel currentVersion; - private FileModel olderVersion; + private List olderVersion; private WindowVersioning winVersioning; - /** * Instantiates a new file versioning event. * @@ -35,7 +37,7 @@ public class FileVersioningEvent extends GwtEvent 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 olderVersion, WindowVersioning winVersioning) { this.workspaceVersioningOperation = workspaceVersioningOperation; this.currentVersion = currentVersion; this.olderVersion = olderVersion; @@ -76,14 +78,12 @@ public class FileVersioningEvent extends GwtEvent im } - - /** * Gets the older version. * * @return the olderVersion */ - public FileModel getOlderVersion() { + public List getOlderVersion() { return olderVersion; } @@ -95,20 +95,18 @@ public class FileVersioningEvent extends GwtEvent 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 olderVersion) { this.olderVersion = olderVersion; } @@ -159,4 +157,25 @@ public class FileVersioningEvent extends GwtEvent 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(); + } + + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtBottomToolBarItem.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtBottomToolBarItem.java index c4cebdf..ca4cb7a 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtBottomToolBarItem.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/toolbars/GxtBottomToolBarItem.java @@ -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() { diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/trash/TrashInfoContainer.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/trash/TrashInfoContainer.java index e82cc1c..aafc4bd 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/trash/TrashInfoContainer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/trash/TrashInfoContainer.java @@ -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() { diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/versioning/VersioningInfoContainer.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/versioning/VersioningInfoContainer.java index 504026d..e2f56f3 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/versioning/VersioningInfoContainer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/versioning/VersioningInfoContainer.java @@ -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 grid; + private Grid grid; private ContentPanel cp; - private GroupingStore store = new GroupingStore(); - private ListStore typeStoreOperation = new ListStore(); + private GroupingStore store = new GroupingStore(); + private ListStore typeStoreOperation = new ListStore(); //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 firstFileToRestore = new ArrayList(1); + firstFileToRestore.add(grid.getSelectionModel().getSelectedItems().get(0)); + String msg = "Restoring the previous version: " + + "
"+firstFileToRestore.get(0).getName(); + msg+="
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 selectedItems = grid.getSelectionModel().getSelectedItems(); + String msg = "Deleting older version/s: "; + for (FileVersionModel file : selectedItems) { + msg+="
- "+file.getName(); + } + msg+="
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() { @@ -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:
- "+ currentVersion.getName()+"." + + "
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(this.store, cm); + grid = new Grid(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() { + grid.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener() { @Override - public void selectionChanged(SelectionChangedEvent se) { + public void selectionChanged(SelectionChangedEvent 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 store) { + private void updateStore(ListStore 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 getStore() { + protected GroupingStore getStore() { return store; } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/versioning/WindowVersioning.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/versioning/WindowVersioning.java index e903f0d..c446cfc 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/versioning/WindowVersioning.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/versioning/WindowVersioning.java @@ -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()); }