From 090993da69524f865fdcb59c39c2afb54c503588 Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Mon, 13 Jan 2014 16:11:09 +0000 Subject: [PATCH] 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 --- .../client/AppControllerExplorer.java | 16 +++- .../workspace/client/event/TrashEvent.java | 70 ++++++++++++++++++ .../client/event/TrashEventHandler.java | 16 ++++ .../client/interfaces/EventsTypeEnum.java | 3 +- .../interfaces/SubscriberInterface.java | 6 ++ .../workspace/client/resources/Icons.java | 3 + .../workspace/client/resources/Resources.java | 5 ++ .../client/resources/icons/trash.png | Bin 0 -> 3391 bytes .../client/view/trash/WindowTrash.java | 6 +- 9 files changed, 119 insertions(+), 6 deletions(-) create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/event/TrashEvent.java create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/event/TrashEventHandler.java create mode 100644 src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/trash.png diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java index c405baf..36ed1a3 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/AppControllerExplorer.java @@ -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()); } - - } } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/TrashEvent.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/TrashEvent.java new file mode 100644 index 0000000..2f4adab --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/TrashEvent.java @@ -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 implements GuiEventInterface{ + + public static Type TYPE = new Type(); + + 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 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; + } + + +} diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/event/TrashEventHandler.java b/src/main/java/org/gcube/portlets/user/workspace/client/event/TrashEventHandler.java new file mode 100644 index 0000000..b2ef92a --- /dev/null +++ b/src/main/java/org/gcube/portlets/user/workspace/client/event/TrashEventHandler.java @@ -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); +} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java index a992371..ed8635d 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/EventsTypeEnum.java @@ -29,5 +29,6 @@ public enum EventsTypeEnum FILE_DOWNLAD_EVENT, SESSION_EXPIRED, PASTED_EVENT, - COPY_EVENT; + COPY_EVENT, + TRASH_EVENT; } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java index f2ae5be..786c140 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/interfaces/SubscriberInterface.java @@ -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); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java index 9bd7e44..72b46a3 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Icons.java @@ -286,5 +286,8 @@ public interface Icons extends ClientBundle { @Source("icons/sharelink.png") ImageResource publicLink(); + + @Source("icons/trash.png") + ImageResource trash(); } diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java index 9367beb..c5d0752 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java +++ b/src/main/java/org/gcube/portlets/user/workspace/client/resources/Resources.java @@ -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()); diff --git a/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/trash.png b/src/main/java/org/gcube/portlets/user/workspace/client/resources/icons/trash.png new file mode 100644 index 0000000000000000000000000000000000000000..aac5230d27093b10681b541ef418afab31e3aada GIT binary patch literal 3391 zcmV-F4Z!k=P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;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L004C`008P>0026e000+nl3&F} z0004BP)t-sqobq$|NnBLG1b-8a-uN+0000000000*Voqo007a^(T}iTtJ^x0u57E@ zI@{aZ&(F`@-QCU2&Ck!z#l^+g*x1U-%G1-+*4Ea}&d$fj$Gf|`(9qDbva+zSu*Jp2 zu&}U*i-d}eg|f1;!otGK%gbhwDrTM~X`mZxqa19Z9&V#7Z=)@5rXO;mCUdAKbgCwG zs4RG^DtW3sdaERSt|xt|IDV@)f3Gcotv!IUB7v?#g0U}yu{?vbFNn1}iM|(#m3)f6 z7mB|Oio{N~#5Tw#Ks@FlW%80S!K(*)?xXzcm%$dB*puy}w z!^6YF)ThMNr^Us^#n-3D*0IRQ$ji&i%-Oun&CSu>yVKLt)7Z|`)YR7C#Mjr?*Wkz5 z+1c6oklWka-{0Th<=Eop+vDTolt+FVa{>*(w2>+9_5?Ck8|?vr=` z001U*QchC<00IOB5*Z*VEG;}hMoVdUm8Y+`yUE$w;NkA^^Yrxh{r&y@{p*qduK)l5 z%}GQ-R2Uge!9h#IFaUtjFKOzEoyOs09`&Lkp7gMr$o{#WcCjJ|!t|h*;h=~%EM1c{ zRYa!m36Wp2cC$ompXtTPA^6v4gS4KC8jvr|m~Npz#( zha;9#pG1(j+fRF1+UY@MiUt&o&$3zTtNSjgJt(5<#=z trashFiles) { - updateTrashContainer(trashFiles); - } +// public WindowTrash(List trashFiles) { +// updateTrashContainer(trashFiles); +// } private void initAccounting() { setModal(true);