Fixed upload archive

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@119430 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-10-06 10:07:37 +00:00
parent 9fdfff7ff0
commit 365b683889
4 changed files with 202 additions and 50 deletions

View File

@ -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){

View File

@ -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";

View File

@ -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<CompletedFileUploadEventHandler> implements GuiEventInterface{
public static Type<CompletedFileUploadEventHandler> TYPE = new Type<CompletedFileUploadEventHandler>();
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<CompletedFileUploadEventHandler> 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<CompletedFileUploadEventH
}
/**
* Sets the item identifier.
*
* @param itemIdentifier the itemIdentifier to set
*/
public void setItemIdentifier(String itemIdentifier) {
@ -57,20 +86,36 @@ public class CompletedFileUploadEvent extends GwtEvent<CompletedFileUploadEventH
}
/**
* Sets the parent id.
*
* @param parentId the parentId to set
*/
public void setParentId(String parentId) {
this.parentId = parentId;
}
/**
* Sets the parent model.
*
* @param parent the new parent model
*/
public void setParentModel(FileModel parent){
this.parentModel = parent;
}
/**
* Gets the parent model.
*
* @return the parentModel
*/
public FileModel getParentModel() {
return parentModel;
}
/**
* @return the uploadType
*/
public String getUploadType() {
return uploadType;
}
}

View File

@ -10,68 +10,173 @@ import org.gcube.portlets.user.workspace.client.model.FolderModel;
import org.gcube.portlets.user.workspace.shared.WorkspaceTrashOperation;
// Implements this interface to receive events by tree async
/**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* The Interface SubscriberInterface.
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Oct 6, 2015
*/
//Implements this interface to receive events by tree async
public interface SubscriberInterface {
// public void rescue(GuiEvent event);
// public void renameItem(FileModel item, String newName, String extension);
// public void deleteItem(FileModel item);
// void addFolder(FolderModel itemFolder);
void addedFile(String itemIdentifier, FileModel parent);
void selectedItem(FileModel item, List<FileModel> parents);
void expandFolderItem(FolderModel itemFolder);
void setParentItemSelected(ArrayList <FileModel> 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<FileModel> attachs);
void createNewMessage(HashMap<String, String> 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<FileModel> 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<FileModel> 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<String, String> 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<FileModel> targetFileModels);
void trashEvent(WorkspaceTrashOperation trashOperation,
List<FileModel> targetFileModels);
/**
* @param vreFolderId
* Updated vre permissions.
*
* @param vreFolderId the vre folder id
*/
void updatedVREPermissions(String vreFolderId);
/**
* Changed file model id.
*
* @param oldId
* @param newId
* @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);
}