bug fixed on file upload

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@71746 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-03-25 18:01:50 +00:00
parent ff81bc5fb0
commit 50efbef1c7
4 changed files with 15 additions and 12 deletions

View File

@ -155,7 +155,6 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} }
public GWTWorkspaceServiceAsync getRpcWorkspaceService() { public GWTWorkspaceServiceAsync getRpcWorkspaceService() {
return rpcWorkspaceService; return rpcWorkspaceService;
} }
@ -679,7 +678,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
} }
private void doFileUploadEvent(FileUploadEvent fileUploadEvent) { private void doFileUploadEvent(FileUploadEvent fileUploadEvent) {
FileModel folder = fileUploadEvent.getParentFileModel(); FileModel folder = fileUploadEvent.getTargetFolderModel();
if(folder == null) if(folder == null)
folder = explorerPanel.getAsycTreePanel().getRootItem(); folder = explorerPanel.getAsycTreePanel().getRootItem();
@ -707,8 +706,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
private void doCompletedFileUploadEvent(CompletedFileUploadEvent completedFileUploadEvent) { private void doCompletedFileUploadEvent(CompletedFileUploadEvent completedFileUploadEvent) {
// explorerPanel.getAsycTreePanel().reloadAndSelectTreeLevelFromWorkspaceForUplaod(completedFileUploadEvent.getParentFileModel().getIdentifier()); // explorerPanel.getAsycTreePanel().reloadAndSelectTreeLevelFromWorkspaceForUplaod(completedFileUploadEvent.getParentFileModel().getIdentifier());
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(completedFileUploadEvent.getParentFileModel().getIdentifier());
//REFRESH TREE ONLY IF FOLDER PARENT EXISTS IN TREE
if(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(completedFileUploadEvent.getTargetFolderModel().getIdentifier())!=null){
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(completedFileUploadEvent.getTargetFolderModel().getIdentifier());
}
notifySubscriber(completedFileUploadEvent); notifySubscriber(completedFileUploadEvent);
} }
}); });
@ -1398,7 +1403,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
CompletedFileUploadEvent fileUpEvent = (CompletedFileUploadEvent) event; CompletedFileUploadEvent fileUpEvent = (CompletedFileUploadEvent) event;
sub.addedFile(fileUpEvent.getItemIdentifier(), fileUpEvent.getParentFileModel()); sub.addedFile(fileUpEvent.getItemIdentifier(), fileUpEvent.getTargetFolderModel());
}else if(event instanceof CreateUrlEvent){ }else if(event instanceof CreateUrlEvent){

View File

@ -36,7 +36,7 @@ public class CompletedFileUploadEvent extends GwtEvent<CompletedFileUploadEventH
return EventsTypeEnum.COMPLETED_FILE_UPLOAD_EVENT; return EventsTypeEnum.COMPLETED_FILE_UPLOAD_EVENT;
} }
public FileModel getParentFileModel() { public FileModel getTargetFolderModel() {
return parentFileModel; return parentFileModel;
} }

View File

@ -9,11 +9,11 @@ import com.google.gwt.event.shared.GwtEvent;
public class FileUploadEvent extends GwtEvent<FileUploadEventHandler> implements GuiEventInterface{ public class FileUploadEvent extends GwtEvent<FileUploadEventHandler> implements GuiEventInterface{
public static Type<FileUploadEventHandler> TYPE = new Type<FileUploadEventHandler>(); public static Type<FileUploadEventHandler> TYPE = new Type<FileUploadEventHandler>();
public enum UploadType {ARCHIVE, FILE}; public enum UploadType {ARCHIVE, FILE};
private FileModel parentFileModel = null; private FileModel targetFolder = null;
private UploadType uploadType; private UploadType uploadType;
public FileUploadEvent(FileModel parentFileModel, UploadType uploadType) { public FileUploadEvent(FileModel targetFolder, UploadType uploadType) {
this.parentFileModel = parentFileModel; this.targetFolder = targetFolder;
this.uploadType = uploadType; this.uploadType = uploadType;
} }
@ -32,8 +32,8 @@ public class FileUploadEvent extends GwtEvent<FileUploadEventHandler> implements
return EventsTypeEnum.FILE_UPLOAD_EVENT; return EventsTypeEnum.FILE_UPLOAD_EVENT;
} }
public FileModel getParentFileModel() { public FileModel getTargetFolderModel() {
return parentFileModel; return targetFolder;
} }
public UploadType getUploadType() { public UploadType getUploadType() {

View File

@ -75,8 +75,6 @@ public class DialogUpload extends Window {
// Add a label // Add a label
formPanel.add(new Hidden("idFolder",parent.getIdentifier())); formPanel.add(new Hidden("idFolder",parent.getIdentifier()));
formPanel.add(new Hidden("uploadType",fieldLabel)); formPanel.add(new Hidden("uploadType",fieldLabel));
// fileUploadField.setFieldLabel(ConstantsExplorer.FILE); // fileUploadField.setFieldLabel(ConstantsExplorer.FILE);
fileUploadField.setFieldLabel(fieldLabel); fileUploadField.setFieldLabel(fieldLabel);