enhancements on trash implementantions

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@90055 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2014-01-13 16:11:09 +00:00
parent fab79668ed
commit 090993da69
9 changed files with 119 additions and 6 deletions

View File

@ -84,6 +84,8 @@ import org.gcube.portlets.user.workspace.client.event.SubTreeLoadedEvent;
import org.gcube.portlets.user.workspace.client.event.SubTreeLoadedEventHandler;
import org.gcube.portlets.user.workspace.client.event.SwitchViewEvent;
import org.gcube.portlets.user.workspace.client.event.SwitchViewEventHandler;
import org.gcube.portlets.user.workspace.client.event.TrashEvent;
import org.gcube.portlets.user.workspace.client.event.TrashEventHandler;
import org.gcube.portlets.user.workspace.client.event.UnShareFolderEvent;
import org.gcube.portlets.user.workspace.client.event.UnShareFolderEventHandler;
import org.gcube.portlets.user.workspace.client.event.WebDavUrlEvent;
@ -241,6 +243,15 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
}
});
eventBus.addHandler(TrashEvent.TYPE, new TrashEventHandler() {
@Override
public void onTrashEvent(TrashEvent trashEvent) {
notifySubscriber(trashEvent);
}
});
eventBus.addHandler(GetInfoEvent.TYPE, new GetInfoEventHandler() {
@Override
@ -1709,9 +1720,10 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
sub.copyEventIsCompleted();
}else if(event instanceof TrashEvent){
TrashEvent trashEvent = (TrashEvent) event;
sub.trashEvent(trashEvent.getTrashOperation(), trashEvent.getTargetFileModel());
}
}
}

View File

@ -0,0 +1,70 @@
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 org.gcube.portlets.user.workspace.client.model.FileModel;
import com.google.gwt.event.shared.GwtEvent;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @May 23, 2013
*
*/
public class TrashEvent extends GwtEvent<TrashEventHandler> implements GuiEventInterface{
public static Type<TrashEventHandler> TYPE = new Type<TrashEventHandler>();
public static enum TRASHOPERATION {SHOW, MOVETO, RESTOREFROM}
private FileModel targetFileModel;
private TRASHOPERATION trashOperation;
public TrashEvent(TRASHOPERATION trashOperation, FileModel target) {
this.trashOperation = trashOperation;
this.setTargetFileModel(target);
}
@Override
public Type<TrashEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(TrashEventHandler handler) {
handler.onTrashEvent(this);
}
/**
* @return the targetFileModel
*/
public FileModel getTargetFileModel() {
return targetFileModel;
}
/**
* @param targetFileModel the targetFileModel to set
*/
public void setTargetFileModel(FileModel targetFileModel) {
this.targetFileModel = targetFileModel;
}
public TRASHOPERATION getTrashOperation() {
return trashOperation;
}
public void setSetTrashOperation(TRASHOPERATION setTrashOperation) {
this.trashOperation = setTrashOperation;
}
/* (non-Javadoc)
* @see org.gcube.portlets.user.workspace.client.interfaces.GuiEventInterface#getKey()
*/
@Override
public EventsTypeEnum getKey() {
return EventsTypeEnum.TRASH_EVENT;
}
}

View File

@ -0,0 +1,16 @@
package org.gcube.portlets.user.workspace.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
*
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* @May 23, 2013
*
*/
public interface TrashEventHandler extends EventHandler {
/**
* @param accountingHistoryEvent
*/
void onTrashEvent(TrashEvent trashEvent);
}

View File

@ -29,5 +29,6 @@ public enum EventsTypeEnum
FILE_DOWNLAD_EVENT,
SESSION_EXPIRED,
PASTED_EVENT,
COPY_EVENT;
COPY_EVENT,
TRASH_EVENT;
}

View File

@ -5,6 +5,7 @@ import java.util.HashMap;
import java.util.List;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType;
import org.gcube.portlets.user.workspace.client.event.TrashEvent.TRASHOPERATION;
import org.gcube.portlets.user.workspace.client.model.FileModel;
import org.gcube.portlets.user.workspace.client.model.FolderModel;
@ -50,5 +51,10 @@ public interface SubscriberInterface {
*
*/
void copyEventIsCompleted();
/**
* @param trashOperation
* @param targetFileModel
*/
void trashEvent(TRASHOPERATION trashOperation, FileModel targetFileModel);
}

View File

@ -286,5 +286,8 @@ public interface Icons extends ClientBundle {
@Source("icons/sharelink.png")
ImageResource publicLink();
@Source("icons/trash.png")
ImageResource trash();
}

View File

@ -50,6 +50,11 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.shareLink());
}
public static AbstractImagePrototype getTrash(){
return AbstractImagePrototype.create(ICONS.trash());
}
public static AbstractImagePrototype getIconCreateNew(){
return AbstractImagePrototype.create(ICONS.createNew());

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -57,9 +57,9 @@ public class WindowTrash extends Window {
// });
// }
public WindowTrash(List<FileModel> trashFiles) {
updateTrashContainer(trashFiles);
}
// public WindowTrash(List<FileModel> trashFiles) {
// updateTrashContainer(trashFiles);
// }
private void initAccounting() {
setModal(true);