diff --git a/.gwt/.gwt-log b/.gwt/.gwt-log index cac4568..0b19bf2 100644 --- a/.gwt/.gwt-log +++ b/.gwt/.gwt-log @@ -48501,3 +48501,99 @@ Compiling... Compilation completed in 0.00 seconds Removing invalidated units Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 0% complete (ETR: 59 seconds) + 10% complete (ETR: 55 seconds) + 20% complete (ETR: 32 seconds) + 30% complete (ETR: 24 seconds) + 40% complete (ETR: 17 seconds) + 50% complete (ETR: 12 seconds) + 60% complete (ETR: 9 seconds) + 70% complete (ETR: 6 seconds) + 80% complete (ETR: 4 seconds) + 90% complete (ETR: 2 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 24.90 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 30% complete (ETR: 9 seconds) + 30% complete (ETR: 9 seconds) + 30% complete (ETR: 9 seconds) + 30% complete (ETR: 9 seconds) + 40% complete (ETR: 8 seconds) + 50% complete (ETR: 6 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 18.82 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 0 cached/archived units. Used 0 / 2719 units from cache. +Compiling... + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 40% complete (ETR: 7 seconds) + 50% complete (ETR: 5 seconds) + 60% complete (ETR: 4 seconds) + 70% complete (ETR: 3 seconds) + 80% complete (ETR: 2 seconds) + 90% complete (ETR: 1 seconds) + 100% complete (ETR: 0 seconds) + Compilation completed in 21.98 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes +Public resources found in... +Translatable source found in... +Found 2719 cached/archived units. Used 2719 / 2719 units from cache. +Compiling... + Compilation completed in 0.00 seconds +Removing invalidated units +Finding entry point classes 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 1d11231..92975ee 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 @@ -90,6 +90,8 @@ import org.gcube.portlets.user.workspace.client.event.TrashEvent; import org.gcube.portlets.user.workspace.client.event.TrashEventHandler; import org.gcube.portlets.user.workspace.client.event.UnShareFolderEvent; import org.gcube.portlets.user.workspace.client.event.UnShareFolderEventHandler; +import org.gcube.portlets.user.workspace.client.event.UpdateWorkspaceSizeEvent; +import org.gcube.portlets.user.workspace.client.event.UpdateWorkspaceSizeEventHandler; import org.gcube.portlets.user.workspace.client.event.UpdatedVREPermissionEvent; import org.gcube.portlets.user.workspace.client.event.UpdatedVREPermissionEventHandler; import org.gcube.portlets.user.workspace.client.event.VRESettingPermissionEvent; @@ -206,6 +208,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } private void bind() { + + eventBus.addHandler(UpdateWorkspaceSizeEvent.TYPE, new UpdateWorkspaceSizeEventHandler() { + + @Override + public void onUpdateWorkspaceSize(UpdateWorkspaceSizeEvent updateWorkspaceSizeEvent) { + doUpdateWorkspaceSize(updateWorkspaceSizeEvent); + } + }); eventBus.addHandler(RenderForm.TYPE, new RenderFormEventHandler() { @Override @@ -1167,8 +1177,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(completedFileUploadEvent.getTargetFolderModel().getIdentifier(), isLevelExpanded); } + doUpdateWorkspaceSize(new UpdateWorkspaceSizeEvent()); notifySubscriber(completedFileUploadEvent); - } }); @@ -1402,6 +1412,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } notifySubscriber(event); + doUpdateWorkspaceSize(new UpdateWorkspaceSizeEvent()); +// eventBus.fireEvent(new UpdateWorkspaceSizeEvent()); } }; @@ -1787,6 +1799,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } + /** + * @param updateWorkspaceSizeEvent + * + */ + protected void doUpdateWorkspaceSize(UpdateWorkspaceSizeEvent updateWorkspaceSizeEvent) { + notifySubscriber(updateWorkspaceSizeEvent); + } + public static native String portalURL()/*-{ return $wnd.location.href; }-*/; @@ -1944,6 +1964,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt UpdatedVREPermissionEvent vreEvent = (UpdatedVREPermissionEvent) event; sub.updatedVREPermissions(vreEvent.getVreFolderId()); + }else if(event instanceof UpdateWorkspaceSizeEvent){ + sub.updateWorksapaceSize(true); } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/UpdateWorkspaceSizeEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/UpdateWorkspaceSizeEvent.java new file mode 100644 index 0000000..a0bc04b --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/UpdateWorkspaceSizeEvent.java @@ -0,0 +1,40 @@ +package org.gcube.portlets.user.workspace.client.event; + +import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum; +import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface; + +import com.google.gwt.event.shared.GwtEvent; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * @Oct 30, 2014 + * + */ +public class UpdateWorkspaceSizeEvent extends GwtEvent implements GuiEventInterface{ + public static Type TYPE = new Type(); + + + public UpdateWorkspaceSizeEvent() { + + } + + @Override + public Type getAssociatedType() { + return TYPE; + } + + @Override + protected void dispatch(UpdateWorkspaceSizeEventHandler handler) { + handler.onUpdateWorkspaceSize(this); + } + + /* (non-Javadoc) + * @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey() + */ + @Override + public EventsTypeEnum getKey() { + return EventsTypeEnum.UPDATE_WORKSPACE_SIZE; + } + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/UpdateWorkspaceSizeEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/UpdateWorkspaceSizeEventHandler.java new file mode 100644 index 0000000..9c5a20a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/UpdateWorkspaceSizeEventHandler.java @@ -0,0 +1,17 @@ +package org.gcube.portlets.user.workspace.client.event; + +import com.google.gwt.event.shared.EventHandler; + +/** + * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * @Oct 30, 2014 + * + */ +public interface UpdateWorkspaceSizeEventHandler extends EventHandler { + + /** + * @param updateWorkspaceSizeEvent + */ + void onUpdateWorkspaceSize(UpdateWorkspaceSizeEvent updateWorkspaceSizeEvent); +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java index 1b05230..9a9a448 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java @@ -32,5 +32,6 @@ public enum EventsTypeEnum COPY_EVENT, TRASH_EVENT, UPDATED_VRE_PERMISSION, + UPDATE_WORKSPACE_SIZE, ADD_ADMINISTRATOR_EVENT; } \ No newline at end of file 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 dad4069..1c5ba59 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 @@ -72,4 +72,6 @@ public interface SubscriberInterface { */ void changedFileModelId(String oldId, String newId); + void updateWorksapaceSize(boolean delayCall); + } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/uploader/UpdateServiceUploader.java b/src/main/java/org/gcube/portlets/user/workspace/client/uploader/UpdateServiceUploader.java index 67a89ff..babd637 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/uploader/UpdateServiceUploader.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/uploader/UpdateServiceUploader.java @@ -76,28 +76,7 @@ public class UpdateServiceUploader extends Window{ throw new Exception("File absolute path on server is null"); String parameters = ""; - - /* parameters+=ConstantsExplorer.UPLOAD_FORM_ELEMENT+"="+fileName+"&"; - - - if(parent.getIdentifier()!=null && !parent.getIdentifier().isEmpty()) - parameters+=ConstantsExplorer.ID_FOLDER+"="+parent.getIdentifier()+"&"; - else - throw new Exception("Parent Folder ID parameter is null or empty"); - - if(uploadType!=null && !uploadType.isEmpty()) - parameters+=ConstantsExplorer.UPLOAD_TYPE+"="+uploadType+"&"; - else - throw new Exception("UploadType parameter is null or empty"); - - parameters+=ConstantsExplorer.IS_OVERWRITE+"="+overwrite; - - String urlRequest = ConstantsExplorer.LOCAL_UPLOAD_WORKSPACE_SERVICE+"?"+URL.encodeQueryString(parameters); - - String urlRequest = ConstantsExplorer.LOCAL_UPLOAD_WORKSPACE_SERVICE+"?"+parameters; - */ - String fileNameEscaped = URL.encodeQueryString(fileName); // fileNameEscaped = encodeUrlDelimiters(fileNameEscaped); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java index ab5e647..d03a493 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/view/windows/DialogGetInfo.java @@ -7,7 +7,6 @@ import org.gcube.portlets.user.workspace.client.AppControllerExplorer; import org.gcube.portlets.user.workspace.client.ConstantsExplorer; 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.FolderGridModel; import org.gcube.portlets.user.workspace.client.model.InfoContactModel; import com.extjs.gxt.ui.client.Style.HorizontalAlignment; diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java index d8e5323..790c80f 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/GWTWorkspaceServiceImpl.java @@ -3224,8 +3224,13 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT @Override public String getUserWorkspaceSize() throws Exception { + workspaceLogger.info("Getting workspace size.."); Workspace workspace = getWorkspace(); - return formatFileSize(workspace.getRoot().getSize()); + long size = workspace.getRoot().getSize(); + workspaceLogger.info("Root size is: "+size +" formatting.."); + String formatSize = formatFileSize(size); + workspaceLogger.info("returning workspace size: "+formatSize); + return formatSize; } /** * returns dynamically the formated size @@ -3234,7 +3239,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT */ private static String formatFileSize(long size) { String formattedSize = null; - + double b = size; double k = size/1024.0; double m = ((size/1024.0)/1024.0); 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 5ec10ae..4b3c13d 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 @@ -100,10 +100,8 @@ public class WsUtil { * COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/ user=TEST_USER; - //UNCOMMENT THIS IN DEVELOP ENVIROMENT -// user = "francesco.mangiacrapa"; if (! isWithinPortal()) { - TEST_USER = "francesco.mangiacrapa"; + user = "francesco.mangiacrapa"; TEST_USER_FULL_NAME = "Francesco Mangiacrapa"; }