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 7b6cc01..ee50d89 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 @@ -1150,13 +1150,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt caption+= " in: "+folder.getName(); MultipleDilaogUpload uploadStream = new MultipleDilaogUpload(caption, folder.getIdentifier(), upType); - + final String type = uploadType; WorskpaceUploadNotificationListener listener = new WorskpaceUploadNotificationListener() { @Override public void onUploadCompleted(String parentId, String itemId) { - GWT.log("Upload completed: [parentID: "+parentId+", itemId: "+itemId+"]"); - eventBus.fireEvent(new CompletedFileUploadEvent(parentId, itemId)); + GWT.log("Upload completed: [parentID: "+parentId+", itemId: "+itemId+", uploadType: "+type+"]"); + eventBus.fireEvent(new CompletedFileUploadEvent(parentId, itemId, type)); } @Override @@ -1254,13 +1254,11 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt } private void doCompletedFileUploadEvent(CompletedFileUploadEvent completedFileUploadEvent) { - GWT.log("doCompletedFileUploadEvent..."); - // explorerPanel.getAsycTreePanel().reloadAndSelectTreeLevelFromWorkspaceForUplaod(completedFileUploadEvent.getParentFileModel().getIdentifier()); - - + boolean isLevelExpanded = treeLevelIsExpanded(completedFileUploadEvent.getParentId()); //REFRESH TREE ONLY IF FOLDER PARENT EXISTS IN TREE FileModel parent = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(completedFileUploadEvent.getParentId()); + GWT.log("doCompletedFileUploadEvent..."+parent); if(parent!=null && completedFileUploadEvent.getItemIdentifier()!=null){ explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(completedFileUploadEvent.getParentId(), isLevelExpanded); // explorerPanel.getAsycTreePanel().addItemIdAndExpandFolder(parent, completedFileUploadEvent.getItemIdentifier(), isLevelExpanded); @@ -1972,13 +1970,13 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt CompletedFileUploadEvent fileUpEvent = (CompletedFileUploadEvent) event; - sub.addedFile(fileUpEvent.getItemIdentifier(), fileUpEvent.getParentModel()); + sub.addedFile(fileUpEvent.getItemIdentifier(), fileUpEvent.getParentModel(), fileUpEvent.getUploadType()); }else if(event instanceof CreateUrlEvent){ CreateUrlEvent createUrlEvent = (CreateUrlEvent) event; - sub.addedFile(createUrlEvent.getItemIdentifier(), createUrlEvent.getParentFileModel()); + sub.addedFile(createUrlEvent.getItemIdentifier(), createUrlEvent.getParentFileModel(), ConstantsExplorer.FILE); }else if(event instanceof MoveItemEvent){ diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java index d2f5f3e..5f102fc 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/ConstantsExplorer.java @@ -90,6 +90,10 @@ public class ConstantsExplorer { public static final String FILEUPLOADHEADER = "File upload in: "; public static final String FILE = "File"; + public static final String ARCHIVE = "Archive"; + + public static enum WS_UPLOAD_TYPE {File, Archive}; + public static final String ERROR = "Error"; public static final String NOFILESPECIFIED = "No file specified"; public static final String PROGRESS = "Progress"; @@ -97,7 +101,7 @@ public class ConstantsExplorer { public static final String PREVIEWOF = "Preview of: "; public static final String ARCHIVEUPLOADHEADER = "Archive upload in: "; - public static final String ARCHIVE = "Archive"; + public static final String DIALOG_DESCRIPTION = "Description"; public static final String DIALOG_NAME = "Name"; diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/CompletedFileUploadEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/CompletedFileUploadEvent.java index acef0b7..150af4c 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/event/CompletedFileUploadEvent.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/CompletedFileUploadEvent.java @@ -6,43 +6,70 @@ import org.gcube.portlets.user.workspace.client.model.FileModel; import com.google.gwt.event.shared.GwtEvent; + /** - * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * The Class CompletedFileUploadEvent. * + * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it + * Oct 6, 2015 */ public class CompletedFileUploadEvent extends GwtEvent implements GuiEventInterface{ public static Type TYPE = new Type(); private String itemIdentifier; private String parentId; - + private String uploadType; private FileModel parentModel; - public CompletedFileUploadEvent(String parentId, String itemIdentifier) { + /** + * Instantiates a new completed file upload event. + * + * @param parentId the parent id + * @param itemIdentifier the item identifier + * @param uploadType the upload type + */ + public CompletedFileUploadEvent(String parentId, String itemIdentifier, String uploadType) { this.parentId = parentId; this.itemIdentifier = itemIdentifier; + this.uploadType = uploadType; } + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() + */ @Override public Type getAssociatedType() { return TYPE; } + /* (non-Javadoc) + * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler) + */ @Override protected void dispatch(CompletedFileUploadEventHandler handler) { handler.onCompletedFileUploadEvent(this); } + /* (non-Javadoc) + * @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey() + */ @Override public EventsTypeEnum getKey() { return EventsTypeEnum.COMPLETED_FILE_UPLOAD_EVENT; } + /** + * Gets the item identifier. + * + * @return the item identifier + */ public String getItemIdentifier() { return itemIdentifier; } /** + * Gets the parent id. + * * @return the parentId */ public String getParentId() { @@ -50,6 +77,8 @@ public class CompletedFileUploadEvent extends GwtEvent parents); - void expandFolderItem(FolderModel itemFolder); - void setParentItemSelected(ArrayList listParents); - boolean renameItem(String itemIdentifier, String newName, String extension); - boolean deleteItem(String itemIdentifier); - void addedFolder(String itemIdentifier, FileModel parent); - void rootLoaded(FileModel root); - void smartFolderSelected(String folderId, String category); - void movedItems(String sourceParentIdentifier, FileModel targetParent); - void switchView(ViewSwitchType type); - void refreshFolder(FileModel fileModel, boolean forceRefreshContent, boolean forceRefreshBreadcrumb); -// void updatePrevieMessage(String fromLogin, String subject, String date, String body, List attachs); - void createNewMessage(HashMap hashAttachs); /** - * @param itemIdentifier + * Added file. + * + * @param itemIdentifier the item identifier + * @param parent the parent + * @param uploadType the upload type + */ + void addedFile(String itemIdentifier, FileModel parent, String uploadType); + + /** + * Selected item. + * + * @param item the item + * @param parents the parents + */ + void selectedItem(FileModel item, List parents); + + /** + * Expand folder item. + * + * @param itemFolder the item folder + */ + void expandFolderItem(FolderModel itemFolder); + + /** + * Sets the parent item selected. + * + * @param listParents the new parent item selected + */ + void setParentItemSelected(ArrayList listParents); + + /** + * Rename item. + * + * @param itemIdentifier the item identifier + * @param newName the new name + * @param extension the extension + * @return true, if successful + */ + boolean renameItem(String itemIdentifier, String newName, String extension); + + /** + * Delete item. + * + * @param itemIdentifier the item identifier + * @return true, if successful + */ + boolean deleteItem(String itemIdentifier); + + /** + * Added folder. + * + * @param itemIdentifier the item identifier + * @param parent the parent + */ + void addedFolder(String itemIdentifier, FileModel parent); + + /** + * Root loaded. + * + * @param root the root + */ + void rootLoaded(FileModel root); + + /** + * Smart folder selected. + * + * @param folderId the folder id + * @param category the category + */ + void smartFolderSelected(String folderId, String category); + + /** + * Moved items. + * + * @param sourceParentIdentifier the source parent identifier + * @param targetParent the target parent + */ + void movedItems(String sourceParentIdentifier, FileModel targetParent); + + /** + * Switch view. + * + * @param type the type + */ + void switchView(ViewSwitchType type); + + /** + * Refresh folder. + * + * @param fileModel the file model + * @param forceRefreshContent the force refresh content + * @param forceRefreshBreadcrumb the force refresh breadcrumb + */ + void refreshFolder(FileModel fileModel, boolean forceRefreshContent, + boolean forceRefreshBreadcrumb); + + /** + * Creates the new message. + * + * @param hashAttachs the hash attachs + */ + void createNewMessage(HashMap hashAttachs); + + /** + * File downloaded. + * + * @param itemIdentifier the item identifier */ void fileDownloaded(String itemIdentifier); + /** - * + * View session expired panel. */ void viewSessionExpiredPanel(); + /** - * @param parentId - * @param isTreeRefreshable - * + * Paste event is completed. + * + * @param isTreeRefreshable the is tree refreshable + * @param parentId the parent id */ void pasteEventIsCompleted(boolean isTreeRefreshable, String parentId); + /** - * + * Copy event is completed. */ void copyEventIsCompleted(); /** - * @param trashOperation - * @param targetFileModel + * Trash event. + * + * @param trashOperation the trash operation + * @param targetFileModels the target file models */ - void trashEvent(WorkspaceTrashOperation trashOperation, List targetFileModels); - + void trashEvent(WorkspaceTrashOperation trashOperation, + List targetFileModels); + /** - * @param vreFolderId + * Updated vre permissions. + * + * @param vreFolderId the vre folder id */ void updatedVREPermissions(String vreFolderId); - + /** - * - * @param oldId - * @param newId + * Changed file model id. + * + * @param oldId the old id + * @param newId the new id */ void changedFileModelId(String oldId, String newId); - + + /** + * Update worksapace size. + * + * @param delayCall the delay call + */ void updateWorksapaceSize(boolean delayCall); - + }