From c43ee4ee81a15d8eaf19b2677e432c30a2f2df8b Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Thu, 12 Sep 2013 14:52:31 +0000 Subject: [PATCH] refresh folder forced was added git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@81314 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../workspace/client/AppControllerExplorer.java | 8 ++++---- .../client/event/RefreshFolderEvent.java | 15 ++++++++++++++- .../client/interfaces/SubscriberInterface.java | 2 +- .../client/view/tree/ContextMenuTree.java | 2 +- .../user/workspace/server/util/WsUtil.java | 4 ++-- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java index 062b36d..635c540 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java @@ -219,7 +219,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt @Override public void onSuccess(Boolean result) { if(result) - eventBus.fireEvent(new RefreshFolderEvent(source.getParentFileModel(), true)); + eventBus.fireEvent(new RefreshFolderEvent(source.getParentFileModel(), true, false)); } }); @@ -332,7 +332,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt else parentToRefresh = parentFileModel; - eventBus.fireEvent(new RefreshFolderEvent(parentToRefresh, true)); + eventBus.fireEvent(new RefreshFolderEvent(parentToRefresh, true, false)); GWT.log("share completed refresh folder : "+parentModel.getName()); } explorerPanel.unmask(); @@ -548,7 +548,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt public void onSuccess(Boolean result) { if(result) - eventBus.fireEvent(new RefreshFolderEvent(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId()), false)); + eventBus.fireEvent(new RefreshFolderEvent(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId()), false, true)); notifySubscriber(pasteItemEvent); } @@ -1652,7 +1652,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt RefreshFolderEvent refresh = (RefreshFolderEvent) event; - sub.refreshFolder(refresh.getFolderTarget()); + sub.refreshFolder(refresh.getFolderTarget(), refresh.isForceRefresh()); }else if(event instanceof SendMessageEvent){ diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/RefreshFolderEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/RefreshFolderEvent.java index f3aa18e..00d3277 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/RefreshFolderEvent.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/RefreshFolderEvent.java @@ -12,10 +12,13 @@ public class RefreshFolderEvent extends GwtEvent implem private FileModel folderTarget= null; private boolean expandFolder = true; //DEFAULT EXPAND FOLDER + + private boolean forceRefresh; - public RefreshFolderEvent(FileModel folderTarget, boolean expandFolder) { + public RefreshFolderEvent(FileModel folderTarget, boolean expandFolder, boolean forceRefresh) { this.folderTarget = folderTarget; this.expandFolder = expandFolder; + this.forceRefresh = forceRefresh; } @@ -48,4 +51,14 @@ public class RefreshFolderEvent extends GwtEvent implem public void setExpandFolder(boolean expandFolder) { this.expandFolder = expandFolder; } + + + public boolean isForceRefresh() { + return forceRefresh; + } + + + public void setForceRefresh(boolean forceRefresh) { + this.forceRefresh = forceRefresh; + } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java index 20537ae..f2ae5be 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java @@ -30,7 +30,7 @@ public interface SubscriberInterface { void smartFolderSelected(String folderId, String category); void movedItems(String sourceParentIdentifier, FileModel targetParent); void switchView(ViewSwitchType type); - void refreshFolder(FileModel fileModel); + void refreshFolder(FileModel fileModel, boolean forzed); // void updatePrevieMessage(String fromLogin, String subject, String date, String body, List attachs); void createNewMessage(HashMap hashAttachs); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java index 637fa02..cd2440e 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/tree/ContextMenuTree.java @@ -561,7 +561,7 @@ public class ContextMenuTree { public void componentSelected(MenuEvent ce) { for (FileModel sel : listSelectedItems) { - eventBus.fireEvent(new RefreshFolderEvent(sel, true)); + eventBus.fireEvent(new RefreshFolderEvent(sel, true, false)); } } }); diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java b/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java index 653e8c0..124f080 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/util/WsUtil.java @@ -74,10 +74,10 @@ public class WsUtil { /*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING * COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/ -// user=TEST_USER; + user=TEST_USER; //UNCOMMENT THIS IN DEVELOP ENVIROMENT - user = "francesco.mangiacrapa"; +// user = "francesco.mangiacrapa"; defaultLogger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:"); defaultLogger.warn("session id: "+sessionID);