enhancement on copy/paste

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@81305 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2013-09-12 12:53:21 +00:00
parent f9682ba221
commit 01eaeeedd4
6 changed files with 76 additions and 2 deletions

View File

@ -37,6 +37,8 @@ import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.Download
import org.gcube.portlets.user.workspace.client.event.FileDownloadEventHandler;
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.CopytemEvent;
import org.gcube.portlets.user.workspace.client.event.CopytemEventHandler;
import org.gcube.portlets.user.workspace.client.event.FileUploadEventHandler;
import org.gcube.portlets.user.workspace.client.event.FilterScopeEvent;
import org.gcube.portlets.user.workspace.client.event.FilterScopeEventHandler;
@ -477,11 +479,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
if(refreshtemEvent.getFolderTarget()!=null){
explorerPanel.getAsycTreePanel().reloadTreeLevelAndExpandFolder(refreshtemEvent.getFolderTarget().getIdentifier(), true);
notifySubscriber(refreshtemEvent);
// notifySubscriber(refreshtemEvent);
}
else
GWT.log("warn: escape refresh because item is null");
notifySubscriber(refreshtemEvent);
}
});
@ -508,6 +513,14 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}
});
eventBus.addHandler(CopytemEvent.TYPE, new CopytemEventHandler() {
@Override
public void onCopyItem(CopytemEvent copytemEvent) {
notifySubscriber(copytemEvent);
}
});
eventBus.addHandler(PasteItemEvent.TYPE, new PasteItemEventHandler() {
@ -1678,6 +1691,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
sub.pasteEventIsCompleted();
}else if(event instanceof CopytemEvent){
sub.copyEventIsCompleted();
}

View File

@ -0,0 +1,40 @@
package org.gcube.portlets.user.workspace.client.event;
import org.gcube.portlets.user.workspace.client.interfaces.EventsTypeEnum;
import org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface;
import com.google.gwt.event.shared.GwtEvent;
public class CopytemEvent extends GwtEvent<CopytemEventHandler> implements GuiEventInterface{
public static Type<CopytemEventHandler> TYPE = new Type<CopytemEventHandler>();
private String itemId = null;
public CopytemEvent(String itemId) {
this.itemId = itemId;
}
@Override
public Type<CopytemEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(CopytemEventHandler handler) {
handler.onCopyItem(this);
}
public String getItemId() {
return itemId;
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
*/
@Override
public EventsTypeEnum getKey() {
return EventsTypeEnum.COPY_EVENT;
}
}

View File

@ -0,0 +1,10 @@
package org.gcube.portlets.user.workspace.client.event;
import com.google.gwt.event.shared.EventHandler;
public interface CopytemEventHandler extends EventHandler {
/**
* @param copytemEvent
*/
void onCopyItem(CopytemEvent copytemEvent);
}

View File

@ -28,5 +28,6 @@ public enum EventsTypeEnum
REPLY_FORWARD_MESSAGE,
FILE_DOWNLAD_EVENT,
SESSION_EXPIRED,
PASTED_EVENT
PASTED_EVENT,
COPY_EVENT;
}

View File

@ -46,5 +46,9 @@ public interface SubscriberInterface {
*
*/
void pasteEventIsCompleted();
/**
*
*/
void copyEventIsCompleted();
}

View File

@ -9,6 +9,7 @@ import org.gcube.portlets.user.workspace.client.constant.WorkspaceOperation;
import org.gcube.portlets.user.workspace.client.event.AccountingHistoryEvent;
import org.gcube.portlets.user.workspace.client.event.AccountingReadersEvent;
import org.gcube.portlets.user.workspace.client.event.AddFolderEvent;
import org.gcube.portlets.user.workspace.client.event.CopytemEvent;
import org.gcube.portlets.user.workspace.client.event.CreateSharedFolderEvent;
import org.gcube.portlets.user.workspace.client.event.CreateUrlEvent;
import org.gcube.portlets.user.workspace.client.event.DeleteItemEvent;
@ -321,6 +322,7 @@ public class ContextMenuTree {
for (FileModel target : listSelectedItems) {
if(target.getIdentifier()!=null){
CopyAndPaste.copy(target.getIdentifier());
eventBus.fireEvent(new CopytemEvent(target.getIdentifier()));
}
}