From cd885a3fb32dd2ec8f445ae73044e4c4f67a85c4 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Fri, 24 May 2013 16:18:02 +0000 Subject: [PATCH] updated accountings git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@75353 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../user/workspace/client/AppController.java | 37 +++++++++++++++++-- .../view/panels/GxtSeachAndFilterPanel.java | 2 +- 2 files changed, 34 insertions(+), 5 deletions(-) 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; }