update copy&paste behaviour to manage special folder

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace@92830 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-03-07 15:43:32 +00:00
parent a1e6f7ce07
commit e19ddebe10
2 changed files with 45 additions and 7 deletions

View File

@ -1068,10 +1068,20 @@ public class AppController implements SubscriberInterface {
FileModel parent = breadCrumb.getLastParent();
if(parent!=null && parent.isDirectory() && parent.isShared())
setACLInfo(parent.getIdentifier());
else
// GWT.log("Update Breadcrumb for : "+parent);
if(parent!=null){
if(parent.isDirectory() && parent.isShared()){ //IS SHARED FOLDER
setACLInfo(parent.getIdentifier());
}else if(parent.isSpecialFolder()){ //IS SPECIAL FOLDER? DISABLING PASTE BUTTON
// GWT.log("Update Breadcrumb is special folder.. disabling paste button");
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activePasteButton(false);
setACLInfo(null);
}else
setACLInfo(null); //IS NOT A SHARE FOLDER DOSN'T DISPLAY ACL INFO
}else
setACLInfo(null);
}
@ -1633,8 +1643,21 @@ public class AppController implements SubscriberInterface {
* @see org.gcube.portlets.user.workspace.client.interfaces.SubscriberInterface#pasteEventIsCompleted()
*/
@Override
public void pasteEventIsCompleted() {
wsPortlet.getGridGroupContainer().unmask();
public void pasteEventIsCompleted(boolean isTreeRefreshable, String parentId) {
if(isTreeRefreshable){
wsPortlet.getGridGroupContainer().unmask();
}else{ //FORCE GRID REFRESH
FileModel lastBreadCrumb = wsPortlet.getToolBarPath().getLastParent();
GWT.log("PasteEventIsCompleted tree is not refreshable");
if(lastBreadCrumb!=null){
GWT.log("Comparing breadcrumb id: "+lastBreadCrumb.getIdentifier() + " and parent id: "+parentId);
if(lastBreadCrumb.getIdentifier().compareToIgnoreCase(parentId)==0){
eventBus.fireEvent(new GridRefreshEvent());
}
}
}
// Info.display("Info", "paste submitting...");
wsPortlet.getGxtCardLayoutResultPanel().getToolBarItemFunctionalities().activePasteButton(false);

View File

@ -372,7 +372,7 @@ public class GxtToolBarItemFunctionality {
event.setFolderSourceId(null);
AppController.getEventBus().fireEvent(event);
CutCopyAndPaste.setCopiedIdsFileModels(null);
CutCopyAndPaste.setOperationType(null);
btnPasteItem.setEnabled(false);
@ -660,16 +660,31 @@ public class GxtToolBarItemFunctionality {
activeButtonForSharing(active);
else
activeButtonForSharing(false);
//IF TARGET IS NOT NULL AND AN ITEM IS COPIED, PASTE IS ENABLING
if(CutCopyAndPaste.getCopiedIdsFilesModel()!=null){
this.btnPasteItem.enable();
}
}
//TARGET (SELECTED ITEM) CAN BE NULL, HIS PARENT IS NOT NULL ACTIVING BUTTONS
activeButtons(active);
//HANDLE VRE FOLDER AND SPECIAL FOLDER
if(target!=null && (target.isVreFolder() || target.isSpecialFolder())){
this.btnRemoveItem.disable();
this.btnRenameItem.disable();
this.btnSetPermission.enable();
if(target.isVreFolder()) //IS VRE -> ENABLING SET PERMISSION
this.btnSetPermission.enable();
if(target.isSpecialFolder()){ //IS SPECIAL FOLDER -> DISABLING COPY AND PASTE
this.btnPasteItem.disable();
this.btnCopyItem.disable();
}
this.btnRefreshFolder.enable();
}
}