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:
parent
889643e7af
commit
b009409842
|
@ -629,11 +629,18 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(Boolean result) {
|
||||||
|
|
||||||
if(result){
|
FileModel fileInTree = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId());
|
||||||
|
|
||||||
eventBus.fireEvent(new RefreshFolderEvent(explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId()), false, false, false));
|
if(result){
|
||||||
|
eventBus.fireEvent(new RefreshFolderEvent(fileInTree, false, false, false));
|
||||||
// explorerPanel.getAsycTreePanel().setExpandTreeLevel(event.getTargetParentFileModel(), true); //Expand level drop
|
// explorerPanel.getAsycTreePanel().setExpandTreeLevel(event.getTargetParentFileModel(), true); //Expand level drop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(fileInTree!=null)
|
||||||
|
pasteItemEvent.setTreeRefreshable(true);
|
||||||
|
else
|
||||||
|
pasteItemEvent.setTreeRefreshable(false);
|
||||||
|
|
||||||
notifySubscriber(pasteItemEvent);
|
notifySubscriber(pasteItemEvent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -663,8 +670,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(Boolean result) {
|
public void onSuccess(Boolean result) {
|
||||||
|
|
||||||
|
FileModel fileInTree = explorerPanel.getAsycTreePanel().getFileModelByIdentifier(pasteItemEvent.getFolderDestinationId());
|
||||||
if(result)
|
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);
|
notifySubscriber(pasteItemEvent);
|
||||||
}
|
}
|
||||||
|
@ -1895,7 +1908,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
|
|
||||||
}else if(event instanceof PasteItemEvent){
|
}else if(event instanceof PasteItemEvent){
|
||||||
|
|
||||||
sub.pasteEventIsCompleted();
|
PasteItemEvent pasteEvent = (PasteItemEvent) event;
|
||||||
|
sub.pasteEventIsCompleted(pasteEvent.isTreeRefreshable(), pasteEvent.getFolderDestinationId());
|
||||||
|
|
||||||
}else if(event instanceof CopytemEvent){
|
}else if(event instanceof CopytemEvent){
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,8 @@ public class PasteItemEvent extends GwtEvent<PasteItemEventHandler> implements G
|
||||||
|
|
||||||
private String folderSourceId; //Used to move
|
private String folderSourceId; //Used to move
|
||||||
|
|
||||||
|
private boolean treeRefreshable;
|
||||||
|
|
||||||
|
|
||||||
// public PasteItemEvent(String itemId, String folderDestinationId) {
|
// public PasteItemEvent(String itemId, String folderDestinationId) {
|
||||||
// this.itemId = itemId;
|
// this.itemId = itemId;
|
||||||
|
@ -79,4 +81,12 @@ public class PasteItemEvent extends GwtEvent<PasteItemEventHandler> implements G
|
||||||
this.folderSourceId = folderSourceId;
|
this.folderSourceId = folderSourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTreeRefreshable(boolean bool){
|
||||||
|
this.treeRefreshable = bool;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTreeRefreshable() {
|
||||||
|
return treeRefreshable;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,9 +44,11 @@ public interface SubscriberInterface {
|
||||||
*/
|
*/
|
||||||
void viewSessionExpiredPanel();
|
void viewSessionExpiredPanel();
|
||||||
/**
|
/**
|
||||||
|
* @param parentId
|
||||||
|
* @param isTreeRefreshable
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void pasteEventIsCompleted();
|
void pasteEventIsCompleted(boolean isTreeRefreshable, String parentId);
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -386,6 +386,10 @@ public class AsyncTreePanel extends LayoutContainer {
|
||||||
|
|
||||||
// if(source.getStore().getParent(model) == target.getModel())
|
// if(source.getStore().getParent(model) == target.getModel())
|
||||||
// return false;
|
// return false;
|
||||||
|
|
||||||
|
if(zone.getModel().isSpecialFolder()) //NOT DROPPABLE INTO SPECIAL FOLDER
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -677,6 +677,8 @@ public class ContextMenuTree {
|
||||||
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_ARCHIVE.getId()).setVisible(true);
|
contextMenu.getItemByItemId(WorkspaceOperation.UPLOAD_ARCHIVE.getId()).setVisible(true);
|
||||||
contextMenu.getItemByItemId(WorkspaceOperation.ADD_URL.getId()).setVisible(true);
|
contextMenu.getItemByItemId(WorkspaceOperation.ADD_URL.getId()).setVisible(true);
|
||||||
contextMenu.getItemByItemId(WorkspaceOperation.SENDTO.getId()).setVisible(true); //send to
|
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.PREVIEW.getId()).setVisible(false); //preview image
|
||||||
contextMenu.getItemByItemId(WorkspaceOperation.LINK.getId()).setVisible(false); //open link
|
contextMenu.getItemByItemId(WorkspaceOperation.LINK.getId()).setVisible(false); //open link
|
||||||
|
@ -719,6 +721,20 @@ public class ContextMenuTree {
|
||||||
contextMenu.getItemByItemId(WorkspaceOperation.RENAME.getId()).setVisible(false); //RENAME
|
contextMenu.getItemByItemId(WorkspaceOperation.RENAME.getId()).setVisible(false); //RENAME
|
||||||
contextMenu.getItemByItemId(WorkspaceOperation.REMOVE.getId()).setVisible(false); //REMOVE
|
contextMenu.getItemByItemId(WorkspaceOperation.REMOVE.getId()).setVisible(false); //REMOVE
|
||||||
contextMenu.getItemByItemId(WorkspaceOperation.REFRESH_FOLDER.getId()).setVisible(true); //REFRESH_FOLDER
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue