fixed copy and paste behaviour to manage Special Folder

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@92828 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-03-07 15:40:10 +00:00
parent 889643e7af
commit b009409842
5 changed files with 53 additions and 7 deletions

View File

@ -629,11 +629,18 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onSuccess(Boolean result) {
FileModel fileInTree = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId());
if(result){
eventBus.fireEvent(new RefreshFolderEvent(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId()), false, false, false));
eventBus.fireEvent(new RefreshFolderEvent(fileInTree, false, false, false));
// explorerPanel.getAsycTreePanel().setExpandTreeLevel(event.getTargetParentFileModel(), true); //Expand level drop
}
if(fileInTree!=null)
pasteItemEvent.setTreeRefreshable(true);
else
pasteItemEvent.setTreeRefreshable(false);
notifySubscriber(pasteItemEvent);
}
});
@ -663,9 +670,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
public void onSuccess(Boolean result) {
FileModel fileInTree = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId());
if(result)
eventBus.fireEvent(new RefreshFolderEvent(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId()), false, false, false));
eventBus.fireEvent(new RefreshFolderEvent(fileInTree, false, false, false));
if(fileInTree!=null)
pasteItemEvent.setTreeRefreshable(true);
else
pasteItemEvent.setTreeRefreshable(false);
notifySubscriber(pasteItemEvent);
}
@ -1895,7 +1908,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}else if(event instanceof PasteItemEvent){
sub.pasteEventIsCompleted();
PasteItemEvent pasteEvent = (PasteItemEvent) event;
sub.pasteEventIsCompleted(pasteEvent.isTreeRefreshable(), pasteEvent.getFolderDestinationId());
}else if(event instanceof CopytemEvent){

View File

@ -19,6 +19,8 @@ public class PasteItemEvent extends GwtEvent<PasteItemEventHandler> implements G
private OperationType operationType;
private String folderSourceId; //Used to move
private boolean treeRefreshable;
// public PasteItemEvent(String itemId, String folderDestinationId) {
@ -78,5 +80,13 @@ public class PasteItemEvent extends GwtEvent<PasteItemEventHandler> implements G
public void setFolderSourceId(String folderSourceId) {
this.folderSourceId = folderSourceId;
}
public void setTreeRefreshable(boolean bool){
this.treeRefreshable = bool;
}
public boolean isTreeRefreshable() {
return treeRefreshable;
}
}

View File

@ -44,9 +44,11 @@ public interface SubscriberInterface {
*/
void viewSessionExpiredPanel();
/**
* @param parentId
* @param isTreeRefreshable
*
*/
void pasteEventIsCompleted();
void pasteEventIsCompleted(boolean isTreeRefreshable, String parentId);
/**
*
*/

View File

@ -385,7 +385,11 @@ public class AsyncTreePanel extends LayoutContainer {
return false;
// if(source.getStore().getParent(model) == target.getModel())
// return false;
// return false;
if(zone.getModel().isSpecialFolder()) //NOT DROPPABLE INTO SPECIAL FOLDER
return false;
}
return true;

View File

@ -677,7 +677,9 @@ public class ContextMenuTree {
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_ARCHIVE.getId()).setVisible(true);
contextMenu.getItemByItemId(WorkspaceOperation.ADD_URL.getId()).setVisible(true);
contextMenu.getItemByItemId(WorkspaceOperation.SENDTO.getId()).setVisible(true); //send to
contextMenu.getItemByItemId(WorkspaceOperation.DOWNLOAD.getId()).setVisible(true); //DOWNLOAD
contextMenu.getItemByItemId(WorkspaceOperation.COPY.getId()).setEnabled(true); //DOWNLOAD
contextMenu.getItemByItemId(WorkspaceOperation.PREVIEW.getId()).setVisible(false); //preview image
contextMenu.getItemByItemId(WorkspaceOperation.LINK.getId()).setVisible(false); //open link
contextMenu.getItemByItemId(WorkspaceOperation.SHOW.getId()).setVisible(false); //show
@ -719,6 +721,20 @@ public class ContextMenuTree {
contextMenu.getItemByItemId(WorkspaceOperation.RENAME.getId()).setVisible(false); //RENAME
contextMenu.getItemByItemId(WorkspaceOperation.REMOVE.getId()).setVisible(false); //REMOVE
contextMenu.getItemByItemId(WorkspaceOperation.REFRESH_FOLDER.getId()).setVisible(true); //REFRESH_FOLDER
if(selectedItem.isVreFolder() && CutCopyAndPaste.getCopiedIdsFilesModel()!=null)
contextMenu.getItemByItemId(WorkspaceOperation.PASTE.getId()).setEnabled(true); //enable paste button
else if(selectedItem.isSpecialFolder()){
contextMenu.getItemByItemId(WorkspaceOperation.COPY.getId()).setEnabled(false);
contextMenu.getItemByItemId(WorkspaceOperation.PASTE.getId()).setEnabled(false);
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_FILE.getId()).setVisible(false);
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_ARCHIVE.getId()).setVisible(false);
contextMenu.getItemByItemId(WorkspaceOperation.ADD_URL.getId()).setVisible(false);
contextMenu.getItemByItemId(WorkspaceOperation.SENDTO.getId()).setVisible(false);
contextMenu.getItemByItemId(WorkspaceOperation.INSERT_FOLDER.getId()).setVisible(false); //insert folder
contextMenu.getItemByItemId(WorkspaceOperation.DOWNLOAD.getId()).setVisible(false);
}
return;
}