Refactor with enum WS_UPLOAD_TYPE
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@119432 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
30c01c88dc
commit
52b1bd4fa0
|
@ -8,6 +8,7 @@ import java.util.logging.Level;
|
|||
import java.util.logging.Logger;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WS_UPLOAD_TYPE;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WsPortletInitOperation;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsPortlet.ViewSwitchTypeInResult;
|
||||
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
|
||||
|
@ -1362,40 +1363,47 @@ public class AppController implements SubscriberInterface {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addedFile(String itemIdentifier, FileModel parent) {
|
||||
public void addedFile(String itemIdentifier, FileModel parent, WS_UPLOAD_TYPE uploadType) {
|
||||
// updateStoreByRpc(parent);
|
||||
GWT.log("Calling addFileToStoreById "+parent.getIdentifier());
|
||||
addFileToStoreById(itemIdentifier, parent);
|
||||
|
||||
}
|
||||
|
||||
//TODO
|
||||
private void addFileToStoreById(String itemIdentifier, FileModel parent){
|
||||
|
||||
GxtBreadcrumbPathPanel breadCrumb = this.wsPortlet.getToolBarPath();
|
||||
FileModel breadParent = breadCrumb.getLastParent();
|
||||
if(parent==null){
|
||||
GWT.log("addedFile skipping, parent is null");
|
||||
return;
|
||||
}
|
||||
|
||||
//UPDATE GRID ONLY IF TREE AND GRID DISPLAYING THE SAME PARENT
|
||||
if(breadParent!=null && parent!=null && breadParent.getIdentifier().compareTo(parent.getIdentifier())==0){
|
||||
// wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE);
|
||||
|
||||
appContrExplorer.getRpcWorkspaceService().getItemForFileGrid(itemIdentifier, new AsyncCallback<FileGridModel>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// wsPortlet.getGridGroupContainer().unmask();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(FileGridModel result) {
|
||||
wsPortlet.getGridGroupContainer().addToStore(result);
|
||||
// wsPortlet.getGridGroupContainer().unmask();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(parentIsBreadcrumbLastParent(parent)){
|
||||
|
||||
if(uploadType.equals(WS_UPLOAD_TYPE.File)){
|
||||
GWT.log("Calling addFileToStoreById "+parent.getIdentifier());
|
||||
addFileToStoreById(itemIdentifier, parent);
|
||||
}else{ //is ARCHIVE
|
||||
updateStoreByRpc(parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean parentIsBreadcrumbLastParent(FileModel parent){
|
||||
GxtBreadcrumbPathPanel breadCrumb = this.wsPortlet.getToolBarPath();
|
||||
FileModel breadParent = breadCrumb.getLastParent();
|
||||
return ((breadParent!=null) && (parent!=null) && (breadParent.getIdentifier().compareTo(parent.getIdentifier())==0));
|
||||
}
|
||||
|
||||
private void addFileToStoreById(String itemIdentifier, FileModel parent){
|
||||
|
||||
appContrExplorer.getRpcWorkspaceService().getItemForFileGrid(itemIdentifier, new AsyncCallback<FileGridModel>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
// wsPortlet.getGridGroupContainer().unmask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(FileGridModel result) {
|
||||
wsPortlet.getGridGroupContainer().addToStore(result);
|
||||
// wsPortlet.getGridGroupContainer().unmask();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.gcube.portlets.user.workspace.client.view.toolbars;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.workspace.client.AppController;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WS_UPLOAD_TYPE;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsPortlet;
|
||||
import org.gcube.portlets.user.workspace.client.ConstantsPortlet.ViewSwitchTypeInResult;
|
||||
import org.gcube.portlets.user.workspace.client.event.ActiveGroupingView;
|
||||
|
@ -12,7 +13,6 @@ import org.gcube.portlets.user.workspace.client.event.DoubleClickElementSelected
|
|||
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent;
|
||||
import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.DownloadType;
|
||||
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent;
|
||||
import org.gcube.portlets.user.workspace.client.event.FileUploadEvent.UploadType;
|
||||
import org.gcube.portlets.user.workspace.client.event.GetPublicLinkEvent;
|
||||
import org.gcube.portlets.user.workspace.client.event.GetShareLinkEvent;
|
||||
import org.gcube.portlets.user.workspace.client.event.GridRefreshEvent;
|
||||
|
@ -435,9 +435,9 @@ public class GxtToolBarItemFunctionality {
|
|||
final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
|
||||
|
||||
if(fileGridModel!=null)
|
||||
AppController.getEventBus().fireEvent(new FileUploadEvent(fileGridModel.getParentFileModel(), UploadType.FILE));
|
||||
AppController.getEventBus().fireEvent(new FileUploadEvent(fileGridModel.getParentFileModel(), WS_UPLOAD_TYPE.File));
|
||||
else
|
||||
AppController.getEventBus().fireEvent(new FileUploadEvent(null, UploadType.FILE));
|
||||
AppController.getEventBus().fireEvent(new FileUploadEvent(null, WS_UPLOAD_TYPE.File));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -449,9 +449,9 @@ public class GxtToolBarItemFunctionality {
|
|||
final FileGridModel fileGridModel = gridGroupViewContainer.getSelectedItem();
|
||||
|
||||
if(fileGridModel!=null)
|
||||
AppController.getEventBus().fireEvent(new FileUploadEvent(fileGridModel.getParentFileModel(), UploadType.ARCHIVE));
|
||||
AppController.getEventBus().fireEvent(new FileUploadEvent(fileGridModel.getParentFileModel(), WS_UPLOAD_TYPE.Archive));
|
||||
else
|
||||
AppController.getEventBus().fireEvent(new FileUploadEvent(null, UploadType.ARCHIVE));
|
||||
AppController.getEventBus().fireEvent(new FileUploadEvent(null, WS_UPLOAD_TYPE.Archive));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue