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 81e6ba0..361ee3c 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 @@ -117,7 +117,8 @@ public class AppController implements SubscriberInterface { EventsTypeEnum.REFRESH_FOLDER, EventsTypeEnum.SELECTED_MESSAGE, EventsTypeEnum.CREATE_NEW_MESSAGE, - EventsTypeEnum.REPLY_FORWARD_MESSAGE + EventsTypeEnum.REPLY_FORWARD_MESSAGE, + EventsTypeEnum.FILE_DOWNLAD_EVENT }); bind(); } @@ -164,7 +165,7 @@ public class AppController implements SubscriberInterface { FileGridModel fileItem = getGridSelectedItem(); if(fileItem!=null){ - AppControllerExplorer.getEventBus().fireEvent(new AccountingHistoryEvent(fileItem.getIdentifier())); + AppControllerExplorer.getEventBus().fireEvent(new AccountingHistoryEvent(fileItem)); } } }); @@ -178,7 +179,7 @@ public class AppController implements SubscriberInterface { FileGridModel fileItem = getGridSelectedItem(); if(fileItem!=null){ - AppControllerExplorer.getEventBus().fireEvent(new AccountingReadersEvent(fileItem.getIdentifier())); + AppControllerExplorer.getEventBus().fireEvent(new AccountingReadersEvent(fileItem)); } } }); @@ -235,7 +236,20 @@ public class AppController implements SubscriberInterface { @Override public void onFileDownloadEvent(FileDownloadEvent fileDownloadEvent) { - AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(fileDownloadEvent.getItemIdentifier(), fileDownloadEvent.getItemName(), fileDownloadEvent.getDownloadType())); + + if(fileDownloadEvent!=null){ +// FileGridModel fileItem = getGridSelectedItem(); +// +// String id = fileDownloadEvent.getItemIdentifier()!=null? fileDownloadEvent.getItemIdentifier():""; +// +// if(fileItem!=null && id.compareTo(fileItem.getIdentifier())==0){ +// fileItem.setMarkAsRead(true); +// accountingSetItemAsRead(true); +// } + + AppControllerExplorer.getEventBus().fireEvent(new FileDownloadEvent(fileDownloadEvent.getItemIdentifier(), fileDownloadEvent.getItemName(), fileDownloadEvent.getDownloadType())); + } + } }); @@ -957,4 +971,19 @@ public class AppController implements SubscriberInterface { }); } + /* (non-Javadoc) + * @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#fileDownloaded(java.lang.String) + */ + @Override + public void fileDownloaded(String itemIdentifier) { + + FileGridModel fileItem = wsPortlet.getGridGroupContainer().getFileGridModelByIdentifier(itemIdentifier); + + if(fileItem!=null && itemIdentifier!= null && fileItem.getIdentifier().compareTo(itemIdentifier)==0){ + fileItem.setMarkAsRead(true); + accountingSetItemAsRead(true); + } + + } + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java index 6f82c7c..17352bf 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/panels/GxtSeachAndFilterPanel.java @@ -250,7 +250,7 @@ public class GxtSeachAndFilterPanel extends LayoutContainer { } public void setSearchActive(boolean isSearchActive) { - System.out.println("#################SET SEARCH ACTIVE in GRID " + isSearchActive); +// System.out.println("#################SET SEARCH ACTIVE in GRID " + isSearchActive); this.isSearchActive = isSearchActive; }