added refresh folder

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@172055 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2018-10-09 10:16:10 +00:00
parent 8d5ea237e9
commit 6285a31c94
3 changed files with 103 additions and 13 deletions

View File

@ -1487,7 +1487,7 @@ public class AppController implements SubscriberInterface {
if(folder==null) if(folder==null)
return; return;
//CREATE FOLDER PARENT FOR RPC //CREATING FOLDER PARENT FOR RPC
final FileModel parent = new FolderModel(folder.getIdentifier(), folder.getName(), folder.getParentFileModel(), true, folder.isShared(), folder.isVreFolder(), folder.isPublic()); final FileModel parent = new FolderModel(folder.getIdentifier(), folder.getName(), folder.getParentFileModel(), true, folder.isShared(), folder.isVreFolder(), folder.isPublic());
wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE); wsPortlet.getGridGroupContainer().mask(ConstantsExplorer.LOADING,ConstantsExplorer.LOADINGSTYLE);
@ -1868,6 +1868,23 @@ public class AppController implements SubscriberInterface {
GWT.log("folderTarget is null, refresh skypped"); GWT.log("folderTarget is null, refresh skypped");
} }
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#refreshFolder(org.gcube.portlets.user.workspace.client.model.FileModel, boolean, boolean)
*/
@Override
public void loadFolder(FileModel folderTarget){
resetSmartFolderSelected();
GWT.log("Loading Folder: "+folderTarget);
if(folderTarget!=null){
GWT.log("Loading folder: "+ folderTarget.getName());
updateStoreByRpc(folderTarget);
loadBreadcrumbByFileModel(folderTarget, true);
}
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#fileDownloaded(java.lang.String) * @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#fileDownloaded(java.lang.String)
*/ */
@ -1950,14 +1967,33 @@ public class AppController implements SubscriberInterface {
if(refreshingTheTree){ if(refreshingTheTree){
wsPortlet.getGridGroupContainer().unmask(); wsPortlet.getGridGroupContainer().unmask();
}else{ //FORCE GRID REFRESH }else{ //FORCE GRID REFRESH
FileModel lastBreadCrumb = wsPortlet.getToolBarPath().getLastParent(); FileModel theFolder = wsPortlet.getToolBarPath().getParentFolder(parentId);
GWT.log("moveEventIsCompleted tree is not refreshable"); GWT.log("moveEventIsCompleted tree is not refreshable");
if(lastBreadCrumb!=null){ if(theFolder!=null){
GWT.log("Comparing breadcrumb id: "+lastBreadCrumb.getIdentifier() + " and parent id: "+parentId); //THE FOLDER IS IN THE BREADCRUMB
if(lastBreadCrumb.getIdentifier().compareToIgnoreCase(parentId)==0){ GWT.log("Comparing breadcrumb id: "+theFolder.getIdentifier() + " and parent id: "+parentId);
if(theFolder.getIdentifier().compareToIgnoreCase(parentId)==0){
eventBus.fireEvent(new GridRefreshEvent()); eventBus.fireEvent(new GridRefreshEvent());
} }
}else{
//MOVING HAS BEEN PERFORMED IN A FOLDER MISSING IN THE BREADCRUMB, SO LOADING IT A NEW ONE
//FOR DISPLAYING
GWT.log("Loading grid on the parent folder of: "+parentId);
AppControllerExplorer.rpcWorkspaceService.getParentByItemId(parentId, new AsyncCallback<FileModel>() {
@Override
public void onFailure(Throwable caught) {
}
@Override
public void onSuccess(FileModel result) {
loadFolder(result);
}
});
} }
} }
// Info.display("Info", "paste submitting..."); // Info.display("Info", "paste submitting...");

View File

@ -24,8 +24,8 @@ import com.google.gwt.user.client.ui.Widget;
/** /**
* The Class Breadcrumbs. * The Class Breadcrumbs.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Dec 14, 2015 * Oct 9, 2018
*/ */
public class Breadcrumbs extends Composite { public class Breadcrumbs extends Composite {
@ -89,6 +89,20 @@ public class Breadcrumbs extends Composite {
/**
* Gets the parent folder.
*
* @param folderId the folder id
* @return the parent folder
*/
public FileModel getParentFolder(String folderId){
return hashFileModel.get(folderId);
}
/** /**
* Reset breadcrumbs. * Reset breadcrumbs.
*/ */

View File

@ -6,37 +6,77 @@ import org.gcube.portlets.user.workspace.client.model.FileModel;
import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Composite;
/** /**
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * The Class GxtBreadcrumbPathPanel.
* *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* Oct 9, 2018
*/ */
public class GxtBreadcrumbPathPanel { public class GxtBreadcrumbPathPanel {
private static final String ROOT_NAME = ""; private static final String ROOT_NAME = "";
private Breadcrumbs breadCrumbs = new Breadcrumbs(ROOT_NAME); private Breadcrumbs breadCrumbs = new Breadcrumbs(ROOT_NAME);
/**
* Instantiates a new gxt breadcrumb path panel.
*/
public GxtBreadcrumbPathPanel() { public GxtBreadcrumbPathPanel() {
} }
/**
* Gets the tool bar path panel.
*
* @return the tool bar path panel
*/
public Composite getToolBarPathPanel() { public Composite getToolBarPathPanel() {
return breadCrumbs; return breadCrumbs;
} }
/**
* Sets the path.
*
* @param parents the new path
*/
public void setPath(List<FileModel> parents) { public void setPath(List<FileModel> parents) {
breadCrumbs.setPath(parents); breadCrumbs.setPath(parents);
} }
/**
* Breadcrumb is empty.
*
* @return true, if successful
*/
public boolean breadcrumbIsEmpty(){ public boolean breadcrumbIsEmpty(){
return breadCrumbs.breadcrumbIsEmpty(); return breadCrumbs.breadcrumbIsEmpty();
} }
/**
* Gets the last parent.
*
* @return the last parent
*/
public FileModel getLastParent(){ public FileModel getLastParent(){
return breadCrumbs.getLastParent(); return breadCrumbs.getLastParent();
} }
/** /**
* * Gets the parent folder.
*
* @param folderId the folder id
* @return the parent folder
*/
public FileModel getParentFolder(String folderId){
if(folderId==null)
return null;
return breadCrumbs.getParentFolder(folderId);
}
/**
* Refresh size.
*/ */
public void refreshSize() { public void refreshSize() {
// TODO Auto-generated method stub // TODO Auto-generated method stub