[kune-commits] r1814 - in trunk: . debian src/main/java/cc/kune/chat/client/actions src/main/java/cc/kune/common/client/actions src/main/java/cc/kune/common/client/actions/gwtui src/main/java/cc/kune/common/client/actions/ui src/main/java/cc/kune/common/client/actions/ui/descrip src/main/java/cc/kune/core/client/actions src/main/java/cc/kune/core/client/events src/main/java/cc/kune/core/client/rpcservices src/main/java/cc/kune/core/client/sn/actions src/main/java/cc/kune/core/client/state src/main/java/cc/kune/core/client/state/impl src/main/java/cc/kune/core/server/content src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/gspace/client/actions src/main/java/cc/kune/gspace/client/viewers src/main/java/cc/kune/trash/client/actions src/test/java/cc/kune/core/server/integration

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Sun Apr 1 04:50:09 CEST 2012


Author: vjrj_
Date: 2012-04-01 04:50:08 +0200 (Sun, 01 Apr 2012)
New Revision: 1814

Added:
   trunk/debian/files
   trunk/debian/kune.postinst.debhelper
   trunk/debian/kune.postrm.debhelper
   trunk/debian/kune.prerm.debhelper
   trunk/src/main/java/cc/kune/trash/client/actions/EmptyTrashBinBtn.java
Modified:
   trunk/.classpath
   trunk/TROUBLESHOOT
   trunk/debian/kune.debhelper.log
   trunk/debian/kune.substvars
   trunk/pom.xml
   trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
   trunk/src/main/java/cc/kune/common/client/actions/AbstractAction.java
   trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
   trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java
   trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
   trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
   trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java
   trunk/src/main/java/cc/kune/core/client/events/StateChangedEvent.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceHelper.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java
   trunk/src/main/java/cc/kune/core/client/state/AccessRightsClientManager.java
   trunk/src/main/java/cc/kune/core/client/state/Session.java
   trunk/src/main/java/cc/kune/core/client/state/SessionExpirationManager.java
   trunk/src/main/java/cc/kune/core/client/state/StateManager.java
   trunk/src/main/java/cc/kune/core/client/state/impl/SessionDefault.java
   trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/content/ContainerManager.java
   trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
   trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
   trunk/src/main/java/cc/kune/core/server/rpc/ContentRPCMock.java
   trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
   trunk/src/main/java/cc/kune/trash/client/actions/TrashClientActions.java
   trunk/src/test/java/cc/kune/core/server/integration/HttpServletRequestMocked.java
Log:
NEW - # 222: Create a trash folder icon and improve contents delete functionality 
http://kune.ourproject.org/issues/ticket/222

Unregister of handlers in some actions
Force servlet 3.0 dep

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/.classpath	2012-04-01 02:50:08 UTC (rev 1814)
@@ -8,7 +8,7 @@
   <classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar" sourcepath="M2_REPO/javax/transaction/jta/1.1/jta-1.1-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4.4/mail-1.4.4.jar" sourcepath="M2_REPO/javax/mail/mail/1.4.4/mail-1.4.4-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar" sourcepath="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0-sources.jar"/>
-  <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar" sourcepath="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/3.0-0.3.14/servlet-api-3.0-0.3.14.jar"/>
   <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar" sourcepath="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
   <classpathentry kind="var" path="M2_REPO/org/waveprotocol/api/0.3.14/api-0.3.14.jar"/>

Modified: trunk/TROUBLESHOOT
===================================================================
--- trunk/TROUBLESHOOT	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/TROUBLESHOOT	2012-04-01 02:50:08 UTC (rev 1814)
@@ -144,7 +144,7 @@
 Authorizated.java:[50,47] incompatible types
 found   : cc.kune.core.shared.domain.AccessRol
 required: cc.kune.core.shared.domain.AccessRol
-seems that happens with some openjdk6 versions. Workaround to compile from eclipse or using sun-jdk or opnejdk7.
+seems that happens with some openjdk6 versions. Workaround to compile from eclipse or using sun-jdk or another jdk version.
 More info:
 https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/611284
 update-java-alternatives -l

Added: trunk/debian/files
===================================================================
--- trunk/debian/files	                        (rev 0)
+++ trunk/debian/files	2012-04-01 02:50:08 UTC (rev 1814)
@@ -0,0 +1 @@
+kune_0.1.0+b4_all.deb java optional

Modified: trunk/debian/kune.debhelper.log
===================================================================
--- trunk/debian/kune.debhelper.log	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/debian/kune.debhelper.log	2012-04-01 02:50:08 UTC (rev 1814)
@@ -1,3 +1,34 @@
 dh_prep
 dh_installdirs
 dh_installdirs
+dh_installdocs
+dh_installexamples
+dh_installman
+dh_installinfo
+dh_installmenu
+dh_installcron
+dh_installinit
+dh_installdebconf
+dh_installemacsen
+dh_installcatalogs
+dh_installpam
+dh_installlogrotate
+dh_installlogcheck
+dh_installchangelogs
+dh_installudev
+dh_lintian
+dh_bugfiles
+dh_install
+dh_link
+dh_installmime
+dh_installgsettings
+dh_strip
+dh_compress
+dh_fixperms
+dh_makeshlibs
+dh_installdeb
+dh_perl
+dh_shlibdeps
+dh_gencontrol
+dh_md5sums
+dh_builddeb

Added: trunk/debian/kune.postinst.debhelper
===================================================================
--- trunk/debian/kune.postinst.debhelper	                        (rev 0)
+++ trunk/debian/kune.postinst.debhelper	2012-04-01 02:50:08 UTC (rev 1814)
@@ -0,0 +1,6 @@
+# Automatically added by dh_installinit
+if [ -x "/etc/init.d/kune" ]; then
+	update-rc.d kune defaults >/dev/null
+	invoke-rc.d kune start || exit $?
+fi
+# End automatically added section

Added: trunk/debian/kune.postrm.debhelper
===================================================================
--- trunk/debian/kune.postrm.debhelper	                        (rev 0)
+++ trunk/debian/kune.postrm.debhelper	2012-04-01 02:50:08 UTC (rev 1814)
@@ -0,0 +1,11 @@
+# Automatically added by dh_installdebconf
+if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
+	. /usr/share/debconf/confmodule
+	db_purge
+fi
+# End automatically added section
+# Automatically added by dh_installinit
+if [ "$1" = "purge" ] ; then
+	update-rc.d kune remove >/dev/null
+fi
+# End automatically added section

Added: trunk/debian/kune.prerm.debhelper
===================================================================
--- trunk/debian/kune.prerm.debhelper	                        (rev 0)
+++ trunk/debian/kune.prerm.debhelper	2012-04-01 02:50:08 UTC (rev 1814)
@@ -0,0 +1,5 @@
+# Automatically added by dh_installinit
+if [ -x "/etc/init.d/kune" ]; then
+	invoke-rc.d kune stop || exit $?
+fi
+# End automatically added section

Modified: trunk/debian/kune.substvars
===================================================================
--- trunk/debian/kune.substvars	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/debian/kune.substvars	2012-04-01 02:50:08 UTC (rev 1814)
@@ -0,0 +1 @@
+misc:Depends=debconf (>= 0.5) | debconf-2.0

Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/pom.xml	2012-04-01 02:50:08 UTC (rev 1814)
@@ -465,8 +465,7 @@
     <dependency>
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
-      <version>2.5</version>
-      <scope>provided</scope>
+      <version>3.0-${wiab.version}</version>
     </dependency>
     <!-- testing dependencies -->
     <dependency>

Modified: trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -43,11 +43,13 @@
 import com.calclab.emite.im.client.chat.ChatStates;
 import com.calclab.emite.xep.muc.client.Occupant;
 import com.calclab.emite.xep.muc.client.Room;
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.inject.Inject;
 
 public class OpenGroupPublicChatRoomAction extends RolActionAutoUpdated {
 
   private final ChatClient chatClient;
+  private HandlerRegistration hadlerReg;
   protected final I18nTranslationService i18n;
   private boolean inviteMembers;
   protected final Session session;
@@ -92,7 +94,7 @@
 
   private void inviteMembers(final Room room) {
     if (inviteMembers) {
-      room.addChatStateChangedHandler(true,
+      hadlerReg = room.addChatStateChangedHandler(true,
           new com.calclab.emite.core.client.events.StateChangedHandler() {
             @Override
             public void onStateChanged(final com.calclab.emite.core.client.events.StateChangedEvent event) {
@@ -114,6 +116,7 @@
                   room.sendInvitationTo(memberNotPresent,
                       i18n.t("Join us in [%s] public room!", room.getURI().getNode()));
                 }
+                hadlerReg.removeHandler();
               }
             }
           });

Modified: trunk/src/main/java/cc/kune/common/client/actions/AbstractAction.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/AbstractAction.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/common/client/actions/AbstractAction.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -110,6 +110,12 @@
     return (Boolean) super.getValue(ENABLED);
   }
 
+  public void onAttach() {
+  }
+
+  public void onDettach() {
+  }
+
   @Override
   /**
    * Sets the value associated with the specified key and sends a

Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtButtonGui.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -19,11 +19,13 @@
  */
 package cc.kune.common.client.actions.gwtui;
 
+import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
 import cc.kune.common.client.actions.ui.AbstractChildGuiItem;
 import cc.kune.common.client.actions.ui.AbstractGuiItem;
 import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.log.Log;
 import cc.kune.common.client.tooltip.Tooltip;
 import cc.kune.common.client.ui.IconLabel;
 
@@ -111,6 +113,8 @@
 
   @Override
   public void setEnabled(final boolean enabled) {
+    Log.info("Set button" + descriptor.getValue(Action.NAME) + " enabled " + enabled
+        + " ----------------------------------");
     button.setEnabled(enabled);
     button.getElement().getStyle().setOpacity(enabled ? 1d : 0.6d);
   }

Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -123,6 +123,18 @@
         : descriptor.isChild() ? descriptor.getParent().getTarget() : ActionEvent.NO_TARGET;
   }
 
+  @Override
+  protected void onAttach() {
+    super.onAttach();
+    descriptor.onAttach();
+  }
+
+  @Override
+  protected void onDetach() {
+    super.onDetach();
+    descriptor.onDetach();
+  }
+
   private void setDropTarget(final DropTarget dropTarget) {
     if (dropTarget != null) {
       dropTarget.init(this);

Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -180,6 +180,16 @@
     return result;
   }
 
+  @Override
+  public void onAttach() {
+    action.onAttach();
+  }
+
+  @Override
+  public void onDetach() {
+    action.onDettach();
+  }
+
   public void setAction(final AbstractAction action) {
     this.action = action;
   }

Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -201,6 +201,16 @@
   boolean mustBeAdded();
 
   /**
+   * Fired when the widget is attached
+   */
+  void onAttach();
+
+  /**
+   * Fired when the widget is detached
+   */
+  void onDetach();
+
+  /**
    * Put value.
    * 
    * @param key

Modified: trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -29,6 +29,7 @@
 import cc.kune.core.shared.domain.utils.AccessRights;
 import cc.kune.core.shared.dto.AccessRolDTO;
 
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.inject.Inject;
 
 /**
@@ -38,6 +39,7 @@
  * 
  */
 public abstract class RolActionAutoUpdated extends AbstractExtendedAction {
+  private final HandlerRegistration handlerReg;
   protected final Session session;
   protected final StateManager stateManager;
 
@@ -47,7 +49,7 @@
       final boolean authNeed, final boolean visibleForNonMemb, final boolean visibleForMembers) {
     this.stateManager = stateManager;
     this.session = session;
-    rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
+    handlerReg = rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
       @Override
       public void onAccessRightsChanged(final AccessRightsChangedEvent event) {
         refreshStatus(rolRequired, authNeed, session.isLogged(), visibleForMembers, visibleForNonMemb,
@@ -56,6 +58,12 @@
     });
   }
 
+  @Override
+  public void onDettach() {
+    super.onDettach();
+    handlerReg.removeHandler();
+  }
+
   public void refreshStatus(final AccessRolDTO rolRequired, final boolean authNeed,
       final boolean isLogged, final boolean visibleForMembers, final boolean visibleForNonMemb,
       final AccessRights newRights) {

Modified: trunk/src/main/java/cc/kune/core/client/events/StateChangedEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/events/StateChangedEvent.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/events/StateChangedEvent.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -24,7 +24,7 @@
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.event.shared.HasHandlers;
 
-public class StateChangedEvent extends GwtEvent<StateChangedEvent.StateChangedHandler> { 
+public class StateChangedEvent extends GwtEvent<StateChangedEvent.StateChangedHandler> {
 
   public interface HasStateChangedHandlers extends HasHandlers {
     HandlerRegistration addStateChangedHandler(StateChangedHandler handler);
@@ -36,7 +36,7 @@
 
   private static final Type<StateChangedHandler> TYPE = new Type<StateChangedHandler>();
 
-  public static void fire(HasHandlers source, cc.kune.core.shared.dto.StateAbstractDTO state) {
+  public static void fire(final HasHandlers source, final cc.kune.core.shared.dto.StateAbstractDTO state) {
     source.fireEvent(new StateChangedEvent(state));
   }
 
@@ -46,46 +46,51 @@
 
   cc.kune.core.shared.dto.StateAbstractDTO state;
 
-  public StateChangedEvent(cc.kune.core.shared.dto.StateAbstractDTO state) {
-    this.state = state;
-  }
-
   protected StateChangedEvent() {
     // Possibly for serialization.
   }
 
-  @Override
-  public Type<StateChangedHandler> getAssociatedType() {
-    return TYPE;
+  public StateChangedEvent(final cc.kune.core.shared.dto.StateAbstractDTO state) {
+    this.state = state;
   }
 
-  public cc.kune.core.shared.dto.StateAbstractDTO getState() {
-    return state;
-  }
-
   @Override
-  protected void dispatch(StateChangedHandler handler) {
+  protected void dispatch(final StateChangedHandler handler) {
     handler.onStateChanged(this);
   }
 
   @Override
-  public boolean equals(Object obj) {
-    if (this == obj)
-        return true;
-    if (obj == null)
-        return false;
-    if (getClass() != obj.getClass())
-        return false;
-    StateChangedEvent other = (StateChangedEvent) obj;
+  public boolean equals(final Object obj) {
+    if (this == obj) {
+      return true;
+    }
+    if (obj == null) {
+      return false;
+    }
+    if (getClass() != obj.getClass()) {
+      return false;
+    }
+    final StateChangedEvent other = (StateChangedEvent) obj;
     if (state == null) {
-      if (other.state != null)
+      if (other.state != null) {
         return false;
-    } else if (!state.equals(other.state))
+      }
+    } else if (!state.equals(other.state)) {
       return false;
+    }
     return true;
   }
 
   @Override
+  public Type<StateChangedHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  public cc.kune.core.shared.dto.StateAbstractDTO getState() {
+    return state;
+  }
+
+  @Override
   public int hashCode() {
     int hashCode = 23;
     hashCode = (hashCode * 37) + (state == null ? 1 : state.hashCode());
@@ -94,8 +99,6 @@
 
   @Override
   public String toString() {
-    return "StateChangedEvent["
-                 + state
-    + "]";
+    return "StateChangedEvent[" + state + "]";
   }
 }

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentService.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -77,6 +77,8 @@
   StateContainerDTO moveContent(String userHash, StateToken contentToken, StateToken newContainerToken)
       throws DefaultException;
 
+  StateContainerDTO purgeAll(String userHash, StateToken token);
+
   StateContainerDTO purgeContent(String userHash, StateToken token);
 
   RateResult rateContent(String userHash, StateToken token, Double value) throws DefaultException;

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceAsync.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -77,6 +77,8 @@
   void moveContent(String userHash, StateToken contentToken, StateToken newContainerToken,
       AsyncCallback<StateContainerDTO> asyncCallback);
 
+  void purgeAll(String userHash, StateToken token, AsyncCallback<StateContainerDTO> callback);
+
   void purgeContent(String userHash, StateToken token, AsyncCallback<StateContainerDTO> callback);
 
   void rateContent(String userHash, StateToken token, Double value,

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceHelper.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceHelper.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/ContentServiceHelper.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -40,6 +40,7 @@
 
   private final ContentCache cache;
   private final Provider<ContentServiceAsync> contentService;
+  private final AsyncCallbackSimple<StateContainerDTO> defCallback;
   private final EventBus eventBus;
   private final FolderViewerPresenter folderViewer;
   private final I18nTranslationService i18n;
@@ -57,6 +58,27 @@
     this.eventBus = eventBus;
     this.contentService = contentService;
     this.stateManager = stateManager;
+    defCallback = new AsyncCallbackSimple<StateContainerDTO>() {
+      @Override
+      public void onFailure(final Throwable caught) {
+        // Should we do something with
+        // ContainerNotEmptyException?
+        super.onFailure(caught);
+        NotifyUser.hideProgress();
+      }
+
+      @Override
+      public void onSuccess(final StateContainerDTO state) {
+        final StateToken parentToken = state.getStateToken();
+        if (session.getCurrentStateToken().equals(parentToken)) {
+          stateManager.setRetrievedStateAndGo(state);
+        } else {
+          stateManager.gotoStateToken(parentToken, false);
+        }
+        NotifyUser.hideProgress();
+      }
+    };
+
   }
 
   public void addContainer(final String id, final String newName) {
@@ -102,27 +124,18 @@
           @Override
           public void onSuccess() {
             NotifyUser.showProgress();
-            contentService.get().delContent(session.getUserHash(), token,
-                new AsyncCallbackSimple<StateContainerDTO>() {
-                  @Override
-                  public void onFailure(final Throwable caught) {
-                    // Should we do something with
-                    // ContainerNotEmptyException?
-                    super.onFailure(caught);
-                    NotifyUser.hideProgress();
-                  }
+            contentService.get().delContent(session.getUserHash(), token, defCallback);
+          }
+        });
+  }
 
-                  @Override
-                  public void onSuccess(final StateContainerDTO state) {
-                    final StateToken parentToken = state.getStateToken();
-                    if (session.getCurrentStateToken().equals(parentToken)) {
-                      stateManager.setRetrievedStateAndGo(state);
-                    } else {
-                      stateManager.gotoStateToken(parentToken, false);
-                    }
-                    NotifyUser.hideProgress();
-                  }
-                });
+  public void purgeAll(final StateToken token) {
+    ConfirmAskEvent.fire(eventBus, i18n.t("Please confirm"), i18n.t("Are you sure?"), i18n.t("Yes"),
+        i18n.t("No"), null, null, new OnAcceptCallback() {
+          @Override
+          public void onSuccess() {
+            NotifyUser.showProgress();
+            contentService.get().purgeAll(session.getUserHash(), token, defCallback);
           }
         });
   }
@@ -133,27 +146,7 @@
           @Override
           public void onSuccess() {
             NotifyUser.showProgress();
-            contentService.get().purgeContent(session.getUserHash(), token,
-                new AsyncCallbackSimple<StateContainerDTO>() {
-                  @Override
-                  public void onFailure(final Throwable caught) {
-                    // Should we do something with
-                    // ContainerNotEmptyException?
-                    super.onFailure(caught);
-                    NotifyUser.hideProgress();
-                  }
-
-                  @Override
-                  public void onSuccess(final StateContainerDTO state) {
-                    final StateToken parentToken = state.getStateToken();
-                    if (session.getCurrentStateToken().equals(parentToken)) {
-                      stateManager.setRetrievedStateAndGo(state);
-                    } else {
-                      stateManager.gotoStateToken(parentToken, false);
-                    }
-                    NotifyUser.hideProgress();
-                  }
-                });
+            contentService.get().purgeContent(session.getUserHash(), token, defCallback);
           }
         });
   }

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -25,15 +25,17 @@
 import cc.kune.core.client.events.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
 import cc.kune.core.client.state.Session;
 
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.inject.Inject;
 
 public abstract class SessionAction extends AbstractExtendedAction {
+  private final HandlerRegistration hadlerReg;
   protected final Session session;
 
   @Inject
   public SessionAction(final Session session, final boolean authNeed) {
     this.session = session;
-    session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
+    hadlerReg = session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
       @Override
       public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
         refreshStatus(authNeed, event.isLogged());
@@ -41,6 +43,12 @@
     });
   }
 
+  @Override
+  public void onDettach() {
+    super.onDettach();
+    hadlerReg.removeHandler();
+  }
+
   public void refreshStatus(final boolean authNeed, final boolean isLogged) {
     boolean visible = false;
     final boolean noLogged = !isLogged;

Modified: trunk/src/main/java/cc/kune/core/client/state/AccessRightsClientManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/AccessRightsClientManager.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/state/AccessRightsClientManager.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -26,38 +26,46 @@
 import cc.kune.core.shared.dto.StateAbstractDTO;
 
 import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.inject.Inject;
+import com.google.inject.Singleton;
 
+ at Singleton
 public class AccessRightsClientManager {
-    private final EventBus eventBus;
-    private AccessRights previousRights;
-    private final Session session;
+  private final EventBus eventBus;
+  private AccessRights previousRights;
+  private final Session session;
 
-    @Inject
-    public AccessRightsClientManager(final EventBus eventBus, final StateManager stateManager, final Session session) {
-        this.eventBus = eventBus;
-        this.session = session;
-        this.previousRights = null;
-        stateManager.onStateChanged(true, new StateChangedHandler() {
-            @Override
-            public void onStateChanged(final StateChangedEvent event) {
-                final AccessRights rights = event.getState().getGroupRights();
-                // NotifyUser.info("prev rights " + previousRights +
-                // " new rights: " + rights);
-                if (!rights.equals(previousRights)) {
-                    AccessRightsChangedEvent.fire(eventBus, previousRights, rights);
-                    previousRights = rights;
-                }
+  @Inject
+  public AccessRightsClientManager(final EventBus eventBus, final StateManager stateManager,
+      final Session session) {
+    this.eventBus = eventBus;
+    this.session = session;
+    this.previousRights = null;
+    stateManager.onStateChanged(true, new StateChangedHandler() {
+      @Override
+      public void onStateChanged(final StateChangedEvent event) {
+        final AccessRights rights = event.getState().getGroupRights();
+        // NotifyUser.info("prev rights " + previousRights +
+        // " new rights: " + rights);
+        if (!rights.equals(previousRights)) {
+          AccessRightsChangedEvent.fire(eventBus, previousRights, rights);
+          previousRights = rights;
+        }
 
-            }
-        });
-    }
+      }
+    });
+  }
 
-    public void onRightsChanged(final boolean fireNow, final AccessRightsChangedEvent.AccessRightsChangedHandler handler) {
-        eventBus.addHandler(AccessRightsChangedEvent.getType(), handler);
-        final StateAbstractDTO currentState = session.getCurrentState();
-        if (fireNow && currentState != null) {
-            handler.onAccessRightsChanged(new AccessRightsChangedEvent(previousRights, currentState.getGroupRights()));
-        }
+  public HandlerRegistration onRightsChanged(final boolean fireNow,
+      final AccessRightsChangedEvent.AccessRightsChangedHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(AccessRightsChangedEvent.getType(),
+        handler);
+    final StateAbstractDTO currentState = session.getCurrentState();
+    if (fireNow && currentState != null) {
+      handler.onAccessRightsChanged(new AccessRightsChangedEvent(previousRights,
+          currentState.getGroupRights()));
     }
+    return handlerReg;
+  }
 }

Modified: trunk/src/main/java/cc/kune/core/client/state/Session.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/Session.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/state/Session.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -59,6 +59,8 @@
 import cc.kune.core.shared.dto.UserInfoDTO;
 import cc.kune.core.shared.dto.UserSimpleDTO;
 
+import com.google.gwt.event.shared.HandlerRegistration;
+
 public interface Session {
 
   void check(AsyncCallbackSimple<Void> callback);
@@ -131,23 +133,24 @@
 
   boolean isNotLogged();
 
-  void onAppStart(boolean fireNow, AppStartEvent.AppStartHandler handler);
+  HandlerRegistration onAppStart(boolean fireNow, AppStartEvent.AppStartHandler handler);
 
   /**
    * @param fireNow
    *          if @true the handler is fired after added if the user is loggedin
    * @param handler
    */
-  void onUserSignIn(boolean fireNow, UserSignInEvent.UserSignInHandler handler);
+  HandlerRegistration onUserSignIn(boolean fireNow, UserSignInEvent.UserSignInHandler handler);
 
-  void onUserSignInOrSignOut(boolean fireNow, UserSignInOrSignOutEvent.UserSignInOrSignOutHandler handler);
+  HandlerRegistration onUserSignInOrSignOut(boolean fireNow,
+      UserSignInOrSignOutEvent.UserSignInOrSignOutHandler handler);
 
   /**
    * @param fireNow
    *          if @true the handler is fired after added if the user is loggedin
    * @param handler
    */
-  void onUserSignOut(boolean fireNow, UserSignOutEvent.UserSignOutHandler handler);
+  HandlerRegistration onUserSignOut(boolean fireNow, UserSignOutEvent.UserSignOutHandler handler);
 
   void setCurrentLanguage(final I18nLanguageDTO currentLanguage);
 

Modified: trunk/src/main/java/cc/kune/core/client/state/SessionExpirationManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SessionExpirationManager.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/state/SessionExpirationManager.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -27,7 +27,9 @@
 
 import com.google.gwt.event.shared.EventBus;
 import com.google.inject.Inject;
+import com.google.inject.Singleton;
 
+ at Singleton
 public class SessionExpirationManager {
   @Inject
   public SessionExpirationManager(final EventBus eventBus, final Session session,

Modified: trunk/src/main/java/cc/kune/core/client/state/StateManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/StateManager.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/state/StateManager.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -28,6 +28,8 @@
 import cc.kune.core.shared.dto.SocialNetworkDataDTO;
 import cc.kune.core.shared.dto.StateAbstractDTO;
 
+import com.google.gwt.event.shared.HandlerRegistration;
+
 public interface StateManager {
 
   /**
@@ -59,9 +61,9 @@
 
   void gotoStateToken(StateToken token, boolean useCache);
 
-  void onGroupChanged(boolean fireNow, GroupChangedEvent.GroupChangedHandler handler);
+  HandlerRegistration onGroupChanged(boolean fireNow, GroupChangedEvent.GroupChangedHandler handler);
 
-  void onSocialNetworkChanged(boolean fireNow,
+  HandlerRegistration onSocialNetworkChanged(boolean fireNow,
       SocialNetworkChangedEvent.SocialNetworkChangedHandler handler);
 
   /**
@@ -69,9 +71,9 @@
    *          if true, fire handler with current state
    * @param handler
    */
-  void onStateChanged(boolean fireNow, StateChangedEvent.StateChangedHandler handler);
+  HandlerRegistration onStateChanged(boolean fireNow, StateChangedEvent.StateChangedHandler handler);
 
-  void onToolChanged(boolean fireNow, ToolChangedEvent.ToolChangedHandler handler);
+  HandlerRegistration onToolChanged(boolean fireNow, ToolChangedEvent.ToolChangedHandler handler);
 
   void redirectOrRestorePreviousToken(boolean fireChange);
 

Modified: trunk/src/main/java/cc/kune/core/client/state/impl/SessionDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/impl/SessionDefault.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/state/impl/SessionDefault.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -50,6 +50,7 @@
 
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
@@ -308,35 +309,41 @@
   }
 
   @Override
-  public void onAppStart(final boolean fireNow, final AppStartHandler handler) {
-    eventBus.addHandler(AppStartEvent.getType(), handler);
+  public HandlerRegistration onAppStart(final boolean fireNow, final AppStartHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(AppStartEvent.getType(), handler);
     if (fireNow && initData != null) {
       handler.onAppStart(new AppStartEvent(initData));
     }
+    return handlerReg;
   }
 
   @Override
-  public void onUserSignIn(final boolean fireNow, final UserSignInHandler handler) {
-    eventBus.addHandler(UserSignInEvent.getType(), handler);
+  public HandlerRegistration onUserSignIn(final boolean fireNow, final UserSignInHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(UserSignInEvent.getType(), handler);
     if (fireNow && isLogged() && currentUserInfo != null) {
       handler.onUserSignIn(new UserSignInEvent(currentUserInfo, null));
     }
+    return handlerReg;
   }
 
   @Override
-  public void onUserSignInOrSignOut(final boolean fireNow, final UserSignInOrSignOutHandler handler) {
-    eventBus.addHandler(UserSignInOrSignOutEvent.getType(), handler);
+  public HandlerRegistration onUserSignInOrSignOut(final boolean fireNow,
+      final UserSignInOrSignOutHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(UserSignInOrSignOutEvent.getType(),
+        handler);
     if (fireNow) {
       handler.onUserSignInOrSignOut(new UserSignInOrSignOutEvent(isLogged()));
     }
+    return handlerReg;
   }
 
   @Override
-  public void onUserSignOut(final boolean fireNow, final UserSignOutHandler handler) {
-    eventBus.addHandler(UserSignOutEvent.getType(), handler);
+  public HandlerRegistration onUserSignOut(final boolean fireNow, final UserSignOutHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(UserSignOutEvent.getType(), handler);
     if (fireNow && isNotLogged()) {
       handler.onUserSignOut(new UserSignOutEvent());
     }
+    return handlerReg;
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -66,6 +66,7 @@
 import com.google.gwt.event.logical.shared.ValueChangeEvent;
 import com.google.gwt.event.logical.shared.ValueChangeHandler;
 import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
@@ -283,41 +284,46 @@
   }
 
   @Override
-  public void onGroupChanged(final boolean fireNow, final GroupChangedHandler handler) {
-    eventBus.addHandler(GroupChangedEvent.getType(), handler);
+  public HandlerRegistration onGroupChanged(final boolean fireNow, final GroupChangedHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(GroupChangedEvent.getType(), handler);
     final StateAbstractDTO currentState = session.getCurrentState();
     if (fireNow && currentState != null) {
       handler.onGroupChanged(new GroupChangedEvent(getPreviousGroup(),
           currentState.getStateToken().getGroup()));
     }
-
+    return handlerReg;
   }
 
   @Override
-  public void onSocialNetworkChanged(final boolean fireNow, final SocialNetworkChangedHandler handler) {
-    eventBus.addHandler(SocialNetworkChangedEvent.getType(), handler);
+  public HandlerRegistration onSocialNetworkChanged(final boolean fireNow,
+      final SocialNetworkChangedHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(SocialNetworkChangedEvent.getType(),
+        handler);
     final StateAbstractDTO currentState = session.getCurrentState();
     if (fireNow && currentState != null) {
       handler.onSocialNetworkChanged(new SocialNetworkChangedEvent(currentState));
     }
+    return handlerReg;
   }
 
   @Override
-  public void onStateChanged(final boolean fireNow, final StateChangedHandler handler) {
-    eventBus.addHandler(StateChangedEvent.getType(), handler);
+  public HandlerRegistration onStateChanged(final boolean fireNow, final StateChangedHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(StateChangedEvent.getType(), handler);
     final StateAbstractDTO currentState = session.getCurrentState();
     if (fireNow && currentState != null) {
       handler.onStateChanged(new StateChangedEvent(currentState));
     }
+    return handlerReg;
   }
 
   @Override
-  public void onToolChanged(final boolean fireNow, final ToolChangedHandler handler) {
-    eventBus.addHandler(ToolChangedEvent.getType(), handler);
+  public HandlerRegistration onToolChanged(final boolean fireNow, final ToolChangedHandler handler) {
+    final HandlerRegistration handlerReg = eventBus.addHandler(ToolChangedEvent.getType(), handler);
     final StateAbstractDTO currentState = session.getCurrentState();
     if (fireNow && currentState != null) {
       handler.onToolChanged(new ToolChangedEvent(previousGroupToken, currentState.getStateToken()));
     }
+    return handlerReg;
   }
 
   @Override

Modified: trunk/src/main/java/cc/kune/core/server/content/ContainerManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContainerManager.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/server/content/ContainerManager.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -41,6 +41,8 @@
 
   Container moveContainer(Container container, Container newContainer);
 
+  Container purgeAll(Container container);
+
   Container purgeContainer(Container container);
 
   Container renameFolder(Group group, Container container, String newName) throws DefaultException;

Modified: trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/server/content/ContainerManagerDefault.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -132,6 +132,17 @@
   }
 
   @Override
+  public Container purgeAll(final Container container) {
+    Preconditions.checkState(container.isRoot(), "Trying to purge a non root folder: " + container);
+    Preconditions.checkState(container.getTypeId().equals(TrashToolConstants.TYPE_ROOT),
+        "Container is not a trash root folder");
+    for (final Container childContainer : container.getChilds()) {
+      purgeContainer(childContainer);
+    }
+    return container;
+  }
+
+  @Override
   public Container purgeContainer(final Container container) {
     // Enable this precondition ASAP
     // Preconditions.checkState(TrashServerUtils.inTrash(container),

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManager.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManager.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -70,6 +70,8 @@
 
   Content moveContent(Content content, Container newContainer);
 
+  Container purgeAll(Container container);
+
   Container purgeContent(Content content);
 
   RateResult rateContent(User rater, Long contentId, Double value) throws DefaultException;

Modified: trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/server/content/ContentManagerDefault.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -76,10 +76,12 @@
 import cc.kune.events.server.utils.EventsCache;
 import cc.kune.events.shared.EventsToolConstants;
 import cc.kune.trash.server.TrashServerUtils;
+import cc.kune.trash.shared.TrashToolConstants;
 import cc.kune.wave.server.KuneWaveServerUtils;
 import cc.kune.wave.server.ParticipantUtils;
 import cc.kune.wave.server.kspecific.KuneWaveService;
 
+import com.google.common.base.Preconditions;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.google.inject.Singleton;
@@ -322,6 +324,17 @@
     return persist(content);
   }
 
+  @Override
+  public Container purgeAll(final Container container) {
+    Preconditions.checkState(container.isRoot(), "Trying to purge a non root folder: " + container);
+    Preconditions.checkState(container.getTypeId().equals(TrashToolConstants.TYPE_ROOT),
+        "Container is not a trash root folder");
+    for (final Content content : container.getContents()) {
+      purgeContent(content);
+    }
+    return container;
+  }
+
   /**
    * Purge content (permanent delete)
    * 

Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPC.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -450,6 +450,18 @@
     }
   }
 
+  @Authenticated
+  @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Administrator)
+  @KuneTransactional
+  public StateContainerDTO purgeAll(final String userHash, final StateToken token) {
+    final User user = getCurrentUser();
+    final Long containerId = ContentUtils.parseId(token.getFolder());
+    final Container container = finderService.getContainer(containerId);
+    containerManager.purgeAll(container);
+    contentManager.purgeAll(container);
+    return mapState(stateService.create(user, container), user);
+  }
+
   @Override
   @Authenticated
   @Authorizated(actionLevel = ActionLevel.container, accessRolRequired = AccessRol.Administrator)

Modified: trunk/src/main/java/cc/kune/core/server/rpc/ContentRPCMock.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/ContentRPCMock.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/core/server/rpc/ContentRPCMock.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -132,6 +132,12 @@
   }
 
   @Override
+  public StateContainerDTO purgeAll(final String userHash, final StateToken token) {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
   public StateContainerDTO purgeContent(final String userHash, final StateToken token) {
     // TODO Auto-generated method stub
     return null;

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/GotoTokenAction.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -29,8 +29,11 @@
 import cc.kune.core.shared.domain.utils.StateToken;
 
 import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.event.shared.HandlerRegistration;
 
 public class GotoTokenAction extends AbstractExtendedAction {
+  private final HandlerRegistration renameHandler;
+  private final HandlerRegistration snHandler;
   private final StateManager stateManager;
   private final StateToken token;
 
@@ -43,26 +46,34 @@
     putValue(Action.NAME, name);
     putValue(Action.SMALL_ICON, icon);
     putValue(Action.TOOLTIP, tooltip);
-    stateManager.onSocialNetworkChanged(true, new SocialNetworkChangedHandler() {
+    snHandler = stateManager.onSocialNetworkChanged(true, new SocialNetworkChangedHandler() {
       @Override
       public void onSocialNetworkChanged(final SocialNetworkChangedEvent event) {
         putValue(Action.STYLES, !token.equals(event.getState().getStateToken()) ? style : style
             + ", k-button-disabled");
       }
     });
-    eventBus.addHandler(RenameContentEvent.getType(), new RenameContentEvent.RenameContentHandler() {
-      @Override
-      public void onRenameEvent(final RenameContentEvent event) {
-        final StateToken eToken = event.getToken();
-        if (eToken.equals(token)) {
-          putValue(Action.NAME, event.getNewName());
-        }
-      }
-    });
+    renameHandler = eventBus.addHandler(RenameContentEvent.getType(),
+        new RenameContentEvent.RenameContentHandler() {
+          @Override
+          public void onRenameEvent(final RenameContentEvent event) {
+            final StateToken eToken = event.getToken();
+            if (eToken.equals(token)) {
+              putValue(Action.NAME, event.getNewName());
+            }
+          }
+        });
   }
 
   @Override
   public void actionPerformed(final ActionEvent event) {
     this.stateManager.gotoStateToken(token);
+  };
+
+  @Override
+  public void onDettach() {
+    super.onDettach();
+    snHandler.removeHandler();
+    renameHandler.removeHandler();
   }
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -94,10 +94,18 @@
     final String style = calculateStyle(pos, length);
     final String name = container.getName();
     final String title = pos == 0 ? i18n.t(name) : name;
-    final ButtonDescriptor btn = new ButtonDescriptor(new GotoTokenAction(
+    final GotoTokenAction action = new GotoTokenAction(
         iconsRegistry.getContentTypeIcon(container.getTypeId()), TextUtils.ellipsis(title, 15),
         i18n.t("Click to go here or drop contents here to move them"), container.getStateToken(), style,
-        stateManager, eventBus));
+        stateManager, eventBus);
+    final ButtonDescriptor btn = new ButtonDescriptor(action) {
+      @Override
+      public void onDetach() {
+        super.onDetach();
+        action.onDettach();
+      }
+    };
+
     if (title.length() > 15) {
       btn.withToolTip(title);
     }

Added: trunk/src/main/java/cc/kune/trash/client/actions/EmptyTrashBinBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/trash/client/actions/EmptyTrashBinBtn.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/trash/client/actions/EmptyTrashBinBtn.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -0,0 +1,97 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.trash.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.client.events.StateChangedEvent;
+import cc.kune.core.client.events.StateChangedEvent.StateChangedHandler;
+import cc.kune.core.client.i18n.I18n;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.rpcservices.ContentServiceHelper;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.dto.ContainerDTO;
+import cc.kune.core.shared.dto.StateAbstractDTO;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.trash.shared.TrashToolConstants;
+
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.inject.Inject;
+
+public class EmptyTrashBinBtn extends ButtonDescriptor {
+
+  public static class EmptyTrashBinAction extends RolAction {
+
+    private final ContentServiceHelper contentService;
+    private final Session session;
+
+    @Inject
+    public EmptyTrashBinAction(final ContentServiceHelper contentService, final CoreResources res,
+        final Session session) {
+      super(AccessRolDTO.Administrator, true);
+      this.contentService = contentService;
+      this.session = session;
+    }
+
+    @Override
+    public void actionPerformed(final ActionEvent event) {
+      contentService.purgeAll(session.getCurrentStateToken());
+    }
+
+  }
+  private final HandlerRegistration reg;
+
+  @Inject
+  public EmptyTrashBinBtn(final EmptyTrashBinAction action, final StateManager stateManager) {
+    super(action);
+    this.withText(I18n.t("Empty trash bin")); // .withIcon(res.cancel());
+    reg = stateManager.onStateChanged(true, new StateChangedHandler() {
+      @Override
+      public void onStateChanged(final StateChangedEvent event) {
+        final StateAbstractDTO state = event.getState();
+        if (state instanceof StateContainerDTO) {
+          final ContainerDTO ctn = ((StateContainerDTO) state).getContainer();
+          if (ctn.getTypeId().equals(TrashToolConstants.TYPE_ROOT)) {
+            setVisibility(ctn);
+          }
+        }
+      }
+    });
+  }
+
+  @Override
+  public void onDetach() {
+    super.onDetach();
+    unregister();
+  }
+
+  private void setVisibility(final ContainerDTO ctn) {
+    final boolean visible = ctn.getChilds().size() > 0 || ctn.getContents().size() > 0;
+    setVisible(visible);
+  }
+
+  public void unregister() {
+    reg.removeHandler();
+  }
+
+}

Modified: trunk/src/main/java/cc/kune/trash/client/actions/TrashClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/trash/client/actions/TrashClientActions.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/main/java/cc/kune/trash/client/actions/TrashClientActions.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -45,10 +45,12 @@
   public TrashClientActions(final I18nUITranslationService i18n, final Session session,
       final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
       final Provider<RefreshContentMenuItem> refresh, final Provider<GoParentChatBtn> folderGoUp,
+      final Provider<EmptyTrashBinBtn> emptyTrashBin,
       final Provider<ContentViewerOptionsMenu> optionsMenuContent) {
     super(session, stateManager, i18n, registry);
     actionsRegistry.addAction(TOOL_NAME, ActionGroups.TOPBAR, optionsMenuContent, all);
     actionsRegistry.addAction(TOOL_NAME, ActionGroups.TOPBAR, refresh, all);
+    actionsRegistry.addAction(TOOL_NAME, ActionGroups.TOPBAR, emptyTrashBin, TYPE_ROOT);
   }
 
   @Override

Modified: trunk/src/test/java/cc/kune/core/server/integration/HttpServletRequestMocked.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/HttpServletRequestMocked.java	2012-03-31 21:43:21 UTC (rev 1813)
+++ trunk/src/test/java/cc/kune/core/server/integration/HttpServletRequestMocked.java	2012-04-01 02:50:08 UTC (rev 1814)
@@ -23,240 +23,422 @@
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.security.Principal;
+import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Map;
 
+import javax.servlet.AsyncContext;
+import javax.servlet.DispatcherType;
 import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
 import javax.servlet.ServletInputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
+import javax.servlet.http.Part;
 
 public class HttpServletRequestMocked implements HttpServletRequest {
 
-    public Object getAttribute(final String arg0) {
-        return null;
-    }
+  @Override
+  public boolean authenticate(final HttpServletResponse arg0) throws IOException, ServletException {
+    // TODO Auto-generated method stub
+    return false;
+  }
 
-    @SuppressWarnings("rawtypes")
-    public Enumeration getAttributeNames() {
-        return null;
-    }
+  @Override
+  public AsyncContext getAsyncContext() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getAuthType() {
-        return null;
-    }
+  @Override
+  public Object getAttribute(final String arg0) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getCharacterEncoding() {
-        return null;
-    }
+  @Override
+  public Enumeration<String> getAttributeNames() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public int getContentLength() {
-        return 0;
-    }
+  @Override
+  public String getAuthType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getContentType() {
-        return null;
-    }
+  @Override
+  public String getCharacterEncoding() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getContextPath() {
-        return null;
-    }
+  @Override
+  public int getContentLength() {
+    // TODO Auto-generated method stub
+    return 0;
+  }
 
-    // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17
-    public Cookie[] getCookies() {
-        return null;
-    }
+  @Override
+  public String getContentType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public long getDateHeader(final String arg0) {
-        return 0;
-    }
+  @Override
+  public String getContextPath() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getHeader(final String arg0) {
-        return null;
-    }
+  @Override
+  public Cookie[] getCookies() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    @SuppressWarnings("rawtypes")
-    public Enumeration getHeaderNames() {
-        return null;
-    }
+  @Override
+  public long getDateHeader(final String arg0) {
+    // TODO Auto-generated method stub
+    return 0;
+  }
 
-    @SuppressWarnings("rawtypes")
-    public Enumeration getHeaders(final String arg0) {
-        return null;
-    }
+  @Override
+  public DispatcherType getDispatcherType() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public ServletInputStream getInputStream() throws IOException {
-        return null;
-    }
+  @Override
+  public String getHeader(final String arg0) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public int getIntHeader(final String arg0) {
-        return 0;
-    }
+  @Override
+  public Enumeration<String> getHeaderNames() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getLocalAddr() {
-        return null;
-    }
+  @Override
+  public Enumeration<String> getHeaders(final String arg0) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public Locale getLocale() {
-        return null;
-    }
+  @Override
+  public ServletInputStream getInputStream() throws IOException {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    @SuppressWarnings("rawtypes")
-    public Enumeration getLocales() {
-        return null;
-    }
+  @Override
+  public int getIntHeader(final String arg0) {
+    // TODO Auto-generated method stub
+    return 0;
+  }
 
-    public String getLocalName() {
-        return null;
-    }
+  @Override
+  public String getLocalAddr() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public int getLocalPort() {
-        return 0;
-    }
+  @Override
+  public Locale getLocale() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getMethod() {
-        return null;
-    }
+  @Override
+  public Enumeration<Locale> getLocales() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getParameter(final String arg0) {
-        return null;
-    }
+  @Override
+  public String getLocalName() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    @SuppressWarnings("rawtypes")
-    public Map getParameterMap() {
-        return null;
-    }
+  @Override
+  public int getLocalPort() {
+    // TODO Auto-generated method stub
+    return 0;
+  }
 
-    @SuppressWarnings("rawtypes")
-    public Enumeration getParameterNames() {
-        return null;
-    }
+  @Override
+  public String getMethod() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17
-    public String[] getParameterValues(final String arg0) {
-        return null;
-    }
+  @Override
+  public String getParameter(final String arg0) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getPathInfo() {
-        return null;
-    }
+  @Override
+  public Map<String, String[]> getParameterMap() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getPathTranslated() {
-        return null;
-    }
+  @Override
+  public Enumeration<String> getParameterNames() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getProtocol() {
-        return null;
-    }
+  @Override
+  public String[] getParameterValues(final String arg0) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getQueryString() {
-        return null;
-    }
+  @Override
+  public Part getPart(final String arg0) throws IOException, ServletException {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public BufferedReader getReader() throws IOException {
-        return null;
-    }
+  @Override
+  public Collection<Part> getParts() throws IOException, ServletException {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getRealPath(final String arg0) {
-        return null;
-    }
+  @Override
+  public String getPathInfo() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getRemoteAddr() {
-        return null;
-    }
+  @Override
+  public String getPathTranslated() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getRemoteHost() {
-        return null;
-    }
+  @Override
+  public String getProtocol() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public int getRemotePort() {
-        return 0;
-    }
+  @Override
+  public String getQueryString() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getRemoteUser() {
-        return null;
-    }
+  @Override
+  public BufferedReader getReader() throws IOException {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public RequestDispatcher getRequestDispatcher(final String arg0) {
-        return null;
-    }
+  @Override
+  public String getRealPath(final String arg0) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getRequestedSessionId() {
-        return null;
-    }
+  @Override
+  public String getRemoteAddr() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getRequestURI() {
-        return null;
-    }
+  @Override
+  public String getRemoteHost() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public StringBuffer getRequestURL() {
-        return null;
-    }
+  @Override
+  public int getRemotePort() {
+    // TODO Auto-generated method stub
+    return 0;
+  }
 
-    public String getScheme() {
-        return null;
-    }
+  @Override
+  public String getRemoteUser() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getServerName() {
-        return null;
-    }
+  @Override
+  public RequestDispatcher getRequestDispatcher(final String arg0) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public int getServerPort() {
-        return 0;
-    }
+  @Override
+  public String getRequestedSessionId() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public String getServletPath() {
-        return null;
-    }
+  @Override
+  public String getRequestURI() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public HttpSession getSession() {
-        return null;
-    }
+  @Override
+  public StringBuffer getRequestURL() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public HttpSession getSession(final boolean arg0) {
-        return null;
-    }
+  @Override
+  public String getScheme() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public Principal getUserPrincipal() {
-        return null;
-    }
+  @Override
+  public String getServerName() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public boolean isRequestedSessionIdFromCookie() {
-        return false;
-    }
+  @Override
+  public int getServerPort() {
+    // TODO Auto-generated method stub
+    return 0;
+  }
 
-    public boolean isRequestedSessionIdFromUrl() {
-        return false;
-    }
+  @Override
+  public ServletContext getServletContext() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public boolean isRequestedSessionIdFromURL() {
-        return false;
-    }
+  @Override
+  public String getServletPath() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public boolean isRequestedSessionIdValid() {
-        return false;
-    }
+  @Override
+  public HttpSession getSession() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public boolean isSecure() {
-        return false;
-    }
+  @Override
+  public HttpSession getSession(final boolean arg0) {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public boolean isUserInRole(final String arg0) {
-        return false;
-    }
+  @Override
+  public Principal getUserPrincipal() {
+    // TODO Auto-generated method stub
+    return null;
+  }
 
-    public void removeAttribute(final String arg0) {
+  @Override
+  public boolean isAsyncStarted() {
+    // TODO Auto-generated method stub
+    return false;
+  }
 
-    }
+  @Override
+  public boolean isAsyncSupported() {
+    // TODO Auto-generated method stub
+    return false;
+  }
 
-    public void setAttribute(final String arg0, final Object arg1) {
+  @Override
+  public boolean isRequestedSessionIdFromCookie() {
+    // TODO Auto-generated method stub
+    return false;
+  }
 
-    }
+  @Override
+  public boolean isRequestedSessionIdFromUrl() {
+    // TODO Auto-generated method stub
+    return false;
+  }
 
-    public void setCharacterEncoding(final String arg0) throws UnsupportedEncodingException {
+  @Override
+  public boolean isRequestedSessionIdFromURL() {
+    // TODO Auto-generated method stub
+    return false;
+  }
 
-    }
+  @Override
+  public boolean isRequestedSessionIdValid() {
+    // TODO Auto-generated method stub
+    return false;
+  }
 
+  @Override
+  public boolean isSecure() {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public boolean isUserInRole(final String arg0) {
+    // TODO Auto-generated method stub
+    return false;
+  }
+
+  @Override
+  public void login(final String arg0, final String arg1) throws ServletException {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void logout() throws ServletException {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void removeAttribute(final String arg0) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void setAttribute(final String arg0, final Object arg1) {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public void setCharacterEncoding(final String arg0) throws UnsupportedEncodingException {
+    // TODO Auto-generated method stub
+
+  }
+
+  @Override
+  public AsyncContext startAsync() throws IllegalStateException {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
+  @Override
+  public AsyncContext startAsync(final ServletRequest arg0, final ServletResponse arg1)
+      throws IllegalStateException {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
 }




More information about the kune-commits mailing list