[kune-commits] r1320 - in trunk/src: main/java/cc/kune/common/client/actions/ui/descrip main/java/cc/kune/core/client/actions main/java/cc/kune/core/public main/java/cc/kune/docs/client/actions main/java/cc/kune/docs/client/viewers main/java/cc/kune/gspace/client/actions/perspective test/java/cc/kune/core/client/actions test/java/cc/kune/core/server/integration/content

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Tue Apr 26 13:38:17 CEST 2011


Author: vjrj_
Date: 2011-04-26 13:38:16 +0200 (Tue, 26 Apr 2011)
New Revision: 1320

Added:
   trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionGroups.java
   trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeBorrarTest.java
Removed:
   trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionsGroup.java
   trunk/src/main/java/cc/kune/gspace/client/actions/perspective/EditActionsGroup.java
   trunk/src/main/java/cc/kune/gspace/client/actions/perspective/MenuActionsGroup.java
   trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ViewActionsGroup.java
   trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeTest.java
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/GuiActionDescrip.java
   trunk/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java
   trunk/src/main/java/cc/kune/core/public/ws.css
   trunk/src/main/java/cc/kune/docs/client/actions/DelContentMenuItem.java
   trunk/src/main/java/cc/kune/docs/client/actions/DelFolderMenuItem.java
   trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
   trunk/src/main/java/cc/kune/docs/client/actions/FolderGoUpBtn.java
   trunk/src/main/java/cc/kune/docs/client/actions/NewDocBtn.java
   trunk/src/main/java/cc/kune/docs/client/actions/NewFolderBtn.java
   trunk/src/main/java/cc/kune/docs/client/actions/OpenContentMenuItem.java
   trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java
   trunk/src/main/java/cc/kune/docs/client/viewers/DocViewerPresenter.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java
   trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPresenter.java
   trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java
Log:
Actions groups revisited

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	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -27,7 +27,6 @@
 import cc.kune.common.client.actions.ActionEvent;
 import cc.kune.common.client.actions.ChangeableObject;
 import cc.kune.common.client.actions.KeyStroke;
-import cc.kune.gspace.client.actions.perspective.ActionsGroup;
 
 /**
  * The Class AbstractUIActionDescriptor.
@@ -139,12 +138,6 @@
     }
 
     @Override
-    public GuiActionDescrip in(final Class<? extends ActionsGroup> clazz) {
-        putValue(ActionsGroup.KEY, clazz);
-        return this;
-    }
-
-    @Override
     public boolean isChild() {
         return !parent.equals(NO_PARENT);
     }

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	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -4,7 +4,6 @@
 import cc.kune.common.client.actions.ActionEvent;
 import cc.kune.common.client.actions.KeyStroke;
 import cc.kune.common.client.actions.PropertyChangeListener;
-import cc.kune.gspace.client.actions.perspective.ActionsGroup;
 
 public interface GuiActionDescrip {
 
@@ -49,8 +48,6 @@
 
     boolean hasTarget();
 
-    GuiActionDescrip in(Class<? extends ActionsGroup> clazz);
-
     boolean isChild();
 
     boolean isEnabled();

Modified: trunk/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -1,7 +1,9 @@
 package cc.kune.core.client.actions;
 
 import java.util.HashMap;
+import java.util.Map;
 
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import cc.kune.common.client.actions.AbstractAction;
@@ -9,18 +11,20 @@
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescProviderCollection;
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
 import cc.kune.core.shared.domain.utils.AccessRights;
-import cc.kune.gspace.client.actions.perspective.ActionsGroup;
 
 import com.google.inject.Provider;
 
 /**
- * A registry of actions by content type (doc, post, etc)
+ * A registry of actions by content type (doc, post, etc) and grouped (some
+ * actions for some toolbar, etc)
  * 
  */
 public class ActionRegistryByType {
-    private static final String GENERIC = "kgenacts";
+    private static final String GENERIC_GROUP_ACTION = "kgengroup";
+    private static final String GENERIC_TYPE_ID = "kgentype";
+    private static final String KEY_SEPARATOR = "-";
 
-    private final HashMap<String, GuiActionDescProviderCollection> actions;
+    private final Map<String, GuiActionDescProviderCollection> actions;
 
     public ActionRegistryByType() {
         actions = new HashMap<String, GuiActionDescProviderCollection>();
@@ -32,34 +36,44 @@
     }
 
     public void addAction(final Provider<? extends GuiActionDescrip> action) {
-        addAction(action, GENERIC);
+        addAction(GENERIC_GROUP_ACTION, action, GENERIC_TYPE_ID);
     }
 
-    public void addAction(final Provider<? extends GuiActionDescrip> action, final String... typeIds) {
-        assert action != null;
+    public void addAction(@Nonnull final String actionsGroupId, final Provider<? extends GuiActionDescrip> action) {
+        addAction(actionsGroupId, action, GENERIC_TYPE_ID);
+    }
+
+    public void addAction(@Nonnull final String actionsGroupId,
+            final @Nonnull Provider<? extends GuiActionDescrip> action, @Nonnull final String... typeIds) {
         for (final String typeId : typeIds) {
-            final GuiActionDescProviderCollection actionColl = getActions(typeId);
+            final GuiActionDescProviderCollection actionColl = getActions(actionsGroupId, typeId);
             actionColl.add(action);
+            actions.put(genKey(actionsGroupId, typeId), actionColl);
         }
     }
 
-    private GuiActionDescProviderCollection getActions(final String typeId) {
-        GuiActionDescProviderCollection actionColl = actions.get(typeId);
+    private String genKey(final String actionsGroupId, final String typeId) {
+        return actionsGroupId + KEY_SEPARATOR + typeId;
+    }
+
+    private GuiActionDescProviderCollection getActions(final String actionsGroupId, final String typeId) {
+        final String key = genKey(actionsGroupId, typeId);
+        GuiActionDescProviderCollection actionColl = actions.get(key);
         if (actionColl == null) {
             actionColl = new GuiActionDescProviderCollection();
-            actions.put(typeId, actionColl);
+            actions.put(key, actionColl);
         }
         return actionColl;
     }
 
     public GuiActionDescCollection getCurrentActions(final Object targetItem, final boolean isLogged,
             final AccessRights rights) {
-        return getCurrentActions(targetItem, GENERIC, isLogged, rights, null);
+        return getCurrentActions(targetItem, GENERIC_TYPE_ID, isLogged, rights, null);
     }
 
     public GuiActionDescCollection getCurrentActions(final Object targetItem, final boolean isLogged,
-            final AccessRights rights, @Nullable final Class<?> clazz) {
-        return getCurrentActions(targetItem, GENERIC, isLogged, rights, clazz);
+            final AccessRights rights, @Nullable final String actionsGroup) {
+        return getCurrentActions(targetItem, GENERIC_TYPE_ID, isLogged, rights, actionsGroup);
     }
 
     public GuiActionDescCollection getCurrentActions(final Object targetItem, final String typeId,
@@ -68,25 +82,17 @@
     }
 
     public <T> GuiActionDescCollection getCurrentActions(final Object targetItem, final String typeId,
-            final boolean isLogged, final AccessRights rights, @Nullable final Class<?> clazz) {
+            final boolean isLogged, final AccessRights rights, @Nullable final String actionsGroupId) {
         final GuiActionDescCollection collection = new GuiActionDescCollection();
-        for (final Provider<? extends GuiActionDescrip> descripProv : getActions(typeId)) {
+        for (final Provider<? extends GuiActionDescrip> descripProv : getActions(actionsGroupId, typeId)) {
             final GuiActionDescrip descrip = descripProv.get();
-            // Log.info("Class " +
-            // descripProv.getClass().getAnnotations().toString());
             final AbstractAction action = descrip.getAction();
-            final Object actionGroup = descrip.getValue(ActionsGroup.KEY);
-            if (clazz != null && !clazz.equals(actionGroup)) {
-                // Not this perspective, then don't add this action
-            } else {
-                // Any perspective it's ok (==null) or same perspective -> add
-                if (action instanceof RolAction) {
-                    if (mustAdd((RolAction) action, isLogged, rights)) {
-                        add(collection, descrip, targetItem);
-                    }
-                } else {
+            if (action instanceof RolAction) {
+                if (mustAdd((RolAction) action, isLogged, rights)) {
                     add(collection, descrip, targetItem);
                 }
+            } else {
+                add(collection, descrip, targetItem);
             }
         }
         return collection;

Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/core/public/ws.css	2011-04-26 11:38:16 UTC (rev 1320)
@@ -1109,3 +1109,8 @@
 .k-def-docbtn span {
     font-size: 13px !important;
 }
+
+.k-empty-msg {
+    font-size: 16px;
+    font-style: italic;
+}
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/docs/client/actions/DelContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DelContentMenuItem.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DelContentMenuItem.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -16,7 +16,6 @@
 import cc.kune.core.shared.dto.StateContentDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.docs.client.viewers.FolderViewerPresenter;
-import cc.kune.gspace.client.actions.perspective.MenuActionsGroup;
 
 import com.google.gwt.event.shared.EventBus;
 import com.google.inject.Inject;
@@ -82,7 +81,7 @@
     @Inject
     public DelContentMenuItem(final I18nTranslationService i18n, final DelContentAction action, final CoreResources res) {
         super(action);
-        this.withText(i18n.t("Delete")).withIcon(res.cancel()).in(MenuActionsGroup.class);
+        this.withText(i18n.t("Delete")).withIcon(res.cancel());
     }
 
 }

Modified: trunk/src/main/java/cc/kune/docs/client/actions/DelFolderMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DelFolderMenuItem.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DelFolderMenuItem.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -14,7 +14,6 @@
 import cc.kune.core.shared.dto.AccessRolDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.docs.client.viewers.FolderViewerPresenter;
-import cc.kune.gspace.client.actions.perspective.MenuActionsGroup;
 
 import com.google.gwt.event.shared.EventBus;
 import com.google.inject.Inject;
@@ -64,7 +63,7 @@
     @Inject
     public DelFolderMenuItem(final I18nTranslationService i18n, final DelFolderAction action, final CoreResources res) {
         super(action);
-        this.withText(i18n.t("Delete")).withIcon(res.cancel()).in(MenuActionsGroup.class);
+        this.withText(i18n.t("Delete")).withIcon(res.cancel());
     }
 
 }

Modified: trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/actions/DocsClientActions.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -29,6 +29,7 @@
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.StateManager;
+import cc.kune.gspace.client.actions.perspective.ActionGroups;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -46,17 +47,16 @@
             final StateManager stateManager, final ActionRegistryByType registry, final CoreResources res,
             final Provider<FolderGoUpBtn> folderGoUp, final Provider<NewDocBtn> newDocBtn,
             final Provider<NewFolderBtn> newFolderBtn, final Provider<OpenContentMenuItem> openContentMenuItem,
-            final Provider<DelContentMenuItem> delContentMenuItem,
-        final Provider<DelFolderMenuItem> delFolderMenuItem) {
+            final Provider<DelContentMenuItem> delContentMenuItem, final Provider<DelFolderMenuItem> delFolderMenuItem) {
         super(session, stateManager, i18n, registry);
-        actionsRegistry.addAction(folderGoUp, contents);
-        actionsRegistry.addAction(folderGoUp, containersNoRoot);
-        actionsRegistry.addAction(newDocBtn, containers);
-        actionsRegistry.addAction(newFolderBtn, containers);
-        actionsRegistry.addAction(openContentMenuItem, contents);
-        actionsRegistry.addAction(openContentMenuItem, containersNoRoot);
-        actionsRegistry.addAction(delContentMenuItem, contents);
-        actionsRegistry.addAction(delFolderMenuItem, containersNoRoot);
+        actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, contents);
+        actionsRegistry.addAction(ActionGroups.VIEW, folderGoUp, containersNoRoot);
+        actionsRegistry.addAction(ActionGroups.VIEW, newDocBtn, containers);
+        actionsRegistry.addAction(ActionGroups.VIEW, newFolderBtn, containers);
+        actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, contents);
+        actionsRegistry.addAction(ActionGroups.MENUITEM, openContentMenuItem, containersNoRoot);
+        actionsRegistry.addAction(ActionGroups.MENUITEM, delContentMenuItem, contents);
+        actionsRegistry.addAction(ActionGroups.MENUITEM, delFolderMenuItem, containersNoRoot);
     }
 
     @Override

Modified: trunk/src/main/java/cc/kune/docs/client/actions/FolderGoUpBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/FolderGoUpBtn.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/actions/FolderGoUpBtn.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -13,7 +13,6 @@
 import cc.kune.core.shared.dto.StateContainerDTO;
 import cc.kune.core.shared.dto.StateContentDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.perspective.ViewActionsGroup;
 
 import com.google.inject.Inject;
 
@@ -42,7 +41,7 @@
                 stateToken = container.getStateToken().copy().setFolder(container.getParentFolderId());
             }
             stateManager.gotoStateToken(stateToken);
-            NotifyUser.hideProgress();
+            // NotifyUser.hideProgress();
         }
 
     }
@@ -50,8 +49,7 @@
     @Inject
     public FolderGoUpBtn(final I18nTranslationService i18n, final FolderGoUpAction action, final CoreResources res) {
         super(action);
-        this.withToolTip(i18n.t("Go up: Open the container folder")).withIcon(res.folderGoUp()).in(
-                ViewActionsGroup.class);
+        this.withToolTip(i18n.t("Go up: Open the container folder")).withIcon(res.folderGoUp());
     }
 
 }

Modified: trunk/src/main/java/cc/kune/docs/client/actions/NewDocBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/NewDocBtn.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/actions/NewDocBtn.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -18,12 +18,11 @@
 import cc.kune.core.shared.dto.StateContentDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.docs.client.DocsClientTool;
-import cc.kune.gspace.client.actions.perspective.ViewActionsGroup;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
-public class NewDocBtn extends ButtonDescriptor implements ViewActionsGroup {
+public class NewDocBtn extends ButtonDescriptor {
 
     public static class NewDocAction extends RolAction {
 
@@ -70,7 +69,7 @@
         shorcutReg.put(shortcut, action);
         this.withText(i18n.t("New document")).withToolTip(
                 "Create a New Document here. This document will be a new 'Page' in the public web if you publish it").withIcon(
-                res.pageAdd()).in(ViewActionsGroup.class).withShortcut(shortcut).withStyles("k-def-docbtn");
+                res.pageAdd()).withShortcut(shortcut).withStyles("k-def-docbtn");
     }
 
 }

Modified: trunk/src/main/java/cc/kune/docs/client/actions/NewFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/NewFolderBtn.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/actions/NewFolderBtn.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -15,7 +15,6 @@
 import cc.kune.core.shared.dto.StateContainerDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.docs.client.DocsClientTool;
-import cc.kune.gspace.client.actions.perspective.ViewActionsGroup;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -64,6 +63,6 @@
         super(action);
         this.withText(i18n.t("New folder")).withToolTip(
                 i18n.t("Create a new folder here. A folder will be a 'section' in the public web")).withIcon(
-                res.folderAdd()).in(ViewActionsGroup.class).withStyles("k-def-docbtn");
+                res.folderAdd()).withStyles("k-def-docbtn");
     }
 }

Modified: trunk/src/main/java/cc/kune/docs/client/actions/OpenContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/OpenContentMenuItem.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/actions/OpenContentMenuItem.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -7,7 +7,6 @@
 import cc.kune.core.client.state.StateManager;
 import cc.kune.core.shared.domain.utils.StateToken;
 import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.perspective.MenuActionsGroup;
 
 import com.google.inject.Inject;
 
@@ -32,7 +31,7 @@
     @Inject
     public OpenContentMenuItem(final I18nTranslationService i18n, final OpenContentAction action, final NavResources res) {
         super(action);
-        this.withText(i18n.t("Open")).withIcon(res.go()).in(MenuActionsGroup.class);
+        this.withText(i18n.t("Open")).withIcon(res.go());
     }
 
 }

Modified: trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/AbstractFolderViewerPanel.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -3,6 +3,7 @@
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
 import cc.kune.common.client.ui.UiUtils;
 import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.docs.client.viewers.FolderViewerPresenter.FolderViewerView;
 import cc.kune.gspace.client.GSpaceArmor;
 
@@ -12,11 +13,16 @@
 import com.gwtplatform.mvp.client.ViewImpl;
 
 public abstract class AbstractFolderViewerPanel extends ViewImpl implements FolderViewerView {
+    private final InlineLabel emptyLabel;
     protected final GSpaceArmor gsArmor;
+    protected final I18nTranslationService i18n;
     protected Widget widget;
 
-    public AbstractFolderViewerPanel(final GSpaceArmor gsArmor) {
+    public AbstractFolderViewerPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n) {
         this.gsArmor = gsArmor;
+        this.i18n = i18n;
+        emptyLabel = new InlineLabel(i18n.t("This folder is empty."));
+        emptyLabel.setStyleName("k-empty-msg");
     }
 
     @Override
@@ -52,4 +58,9 @@
     public void setContainer(final StateContainerDTO state) {
         gsArmor.getDocHeader().add(new InlineLabel(state.getTitle()));
     }
+
+    @Override
+    public void showEmptyMsg() {
+        gsArmor.getDocContainer().add(emptyLabel);
+    }
 }

Modified: trunk/src/main/java/cc/kune/docs/client/viewers/DocViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/DocViewerPresenter.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/DocViewerPresenter.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -10,7 +10,7 @@
 import cc.kune.core.shared.dto.StateContentDTO;
 import cc.kune.docs.client.DocsClientTool;
 import cc.kune.docs.client.actions.DocsClientActions;
-import cc.kune.gspace.client.actions.perspective.ViewActionsGroup;
+import cc.kune.gspace.client.actions.perspective.ActionGroups;
 import cc.kune.gspace.client.tool.ContentViewer;
 import cc.kune.gspace.client.tool.ContentViewerSelector;
 
@@ -76,7 +76,7 @@
         final StateContentDTO stateContent = (StateContentDTO) state;
         final AccessRights rights = stateContent.getContentRights();
         final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContent.getGroup(),
-                stateContent.getTypeId(), session.isLogged(), rights, ViewActionsGroup.class);
+                stateContent.getTypeId(), session.isLogged(), rights, ActionGroups.VIEW);
         getView().setActions(actions);
         getView().setContent(stateContent);
     }

Modified: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsFlowPanel.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -6,6 +6,7 @@
 import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.common.client.ui.BasicThumb;
 import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.gspace.client.GSpaceArmor;
 
 import com.google.gwt.core.client.GWT;
@@ -30,8 +31,8 @@
     int ICONSIZE = 100;
 
     @Inject
-    public FolderViewerAsFlowPanel(final GSpaceArmor gsArmor) {
-        super(gsArmor);
+    public FolderViewerAsFlowPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n) {
+        super(gsArmor, i18n);
         widget = uiBinder.createAndBindUi(this);
     }
 

Modified: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerAsTablePanel.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -35,15 +35,13 @@
     FlexTable flex;
 
     private final GuiProvider guiProvider;
-    private final I18nTranslationService i18n;
     private final CoreResources res;
     protected FolderItemWidget selected;
 
     @Inject
     public FolderViewerAsTablePanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
             final GuiProvider guiProvider, final CoreResources res) {
-        super(gsArmor);
-        this.i18n = i18n;
+        super(gsArmor, i18n);
         this.guiProvider = guiProvider;
         this.res = res;
         widget = uiBinder.createAndBindUi(this);
@@ -104,4 +102,5 @@
     public void setContainer(final StateContainerDTO state) {
         super.setContainer(state);
     }
+
 }

Modified: trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPresenter.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/docs/client/viewers/FolderViewerPresenter.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -3,7 +3,6 @@
 import javax.annotation.Nonnull;
 
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
-import cc.kune.common.client.log.Log;
 import cc.kune.core.client.actions.ActionRegistryByType;
 import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
 import cc.kune.core.client.registry.IconsRegistry;
@@ -23,8 +22,7 @@
 import cc.kune.core.shared.i18n.I18nTranslationService;
 import cc.kune.docs.client.DocsClientTool;
 import cc.kune.docs.client.actions.DocsClientActions;
-import cc.kune.gspace.client.actions.perspective.MenuActionsGroup;
-import cc.kune.gspace.client.actions.perspective.ViewActionsGroup;
+import cc.kune.gspace.client.actions.perspective.ActionGroups;
 import cc.kune.gspace.client.tool.ContentViewer;
 import cc.kune.gspace.client.tool.ContentViewerSelector;
 
@@ -62,6 +60,8 @@
         void setActions(GuiActionDescCollection actions);
 
         void setContainer(StateContainerDTO state);
+
+        void showEmptyMsg();
     }
 
     private final ActionRegistryByType actionsRegistry;
@@ -94,14 +94,13 @@
     private void addItem(final String title, final String contentTypeId, final BasicMimeTypeDTO mimeType,
             final ContentStatus status, final StateToken stateToken, final StateToken parentStateToken,
             final AccessRights rights) {
-        Log.info("Adding item: " + title);
         final Object icon = getIcon(stateToken, contentTypeId, mimeType);
         final String tooltip = getTooltip(stateToken, mimeType);
         final FolderItemDescriptor item = new FolderItemDescriptor(genId(stateToken), genId(parentStateToken), icon,
                 title, tooltip, status, stateToken, capabilitiesRegistry.isDragable(contentTypeId)
                         && rights.isAdministrable(), capabilitiesRegistry.isDropable(contentTypeId)
                         && rights.isAdministrable(), actionsRegistry.getCurrentActions(stateToken, contentTypeId,
-                        session.isLogged(), rights, MenuActionsGroup.class));
+                        session.isLogged(), rights, ActionGroups.MENUITEM));
         if (status.equals(ContentStatus.inTheDustbin) && !session.getShowDeletedContent()) {
             // Don't show
             // NotifyUser.info("Deleted, don't show");
@@ -127,7 +126,7 @@
 
     private void createChildItems(final ContainerDTO container, final AccessRights containerRights) {
         if (container.getContents().size() + container.getChilds().size() == 0) {
-            // FIXME
+            getView().showEmptyMsg();
         } else {
             // Folders
             for (final ContainerSimpleDTO childFolder : container.getChilds()) {
@@ -180,13 +179,12 @@
 
     @Override
     public void setContent(@Nonnull final HasContent state) {
-        Log.info("Set content in FolderViewer");
         getView().clear();
         final StateContainerDTO stateContainer = (StateContainerDTO) state;
         getView().setContainer(stateContainer);
         final AccessRights rights = stateContainer.getContainerRights();
         final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContainer.getGroup(),
-                stateContainer.getTypeId(), session.isLogged(), rights, ViewActionsGroup.class);
+                stateContainer.getTypeId(), session.isLogged(), rights, ActionGroups.VIEW);
         getView().setActions(actions);
         createChildItems(stateContainer.getContainer(), stateContainer.getContainerRights());
         // view.setEditable(rights.isEditable());

Copied: trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionGroups.java (from rev 1319, trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionsGroup.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionGroups.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionGroups.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -0,0 +1,14 @@
+package cc.kune.gspace.client.actions.perspective;
+
+/**
+ * A group of actions that must be grouped and showed in some perspective (on
+ * edit, etc)
+ */
+public class ActionGroups {
+    public static String EDIT = "edit";
+    public static String MENUITEM = "menu-item";
+    public static String VIEW = "view";
+
+    private ActionGroups() {
+    }
+}

Deleted: trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionsGroup.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionsGroup.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ActionsGroup.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -1,9 +0,0 @@
-package cc.kune.gspace.client.actions.perspective;
-
-/**
- * A group of actions that must be grouped and showed in some perspective (on
- * edit, etc)
- */
-public interface ActionsGroup {
-    String KEY = "actiongroup";
-}

Deleted: trunk/src/main/java/cc/kune/gspace/client/actions/perspective/EditActionsGroup.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/perspective/EditActionsGroup.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/perspective/EditActionsGroup.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -1,7 +0,0 @@
-package cc.kune.gspace.client.actions.perspective;
-
-/**
- * An action that must be showed when editing
- */
-public interface EditActionsGroup extends ActionsGroup {
-}

Deleted: trunk/src/main/java/cc/kune/gspace/client/actions/perspective/MenuActionsGroup.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/perspective/MenuActionsGroup.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/perspective/MenuActionsGroup.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -1,7 +0,0 @@
-package cc.kune.gspace.client.actions.perspective;
-
-/**
- * An action that must be showed in menu of docs/folder, etc
- */
-public interface MenuActionsGroup extends ActionsGroup {
-}

Deleted: trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ViewActionsGroup.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ViewActionsGroup.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/perspective/ViewActionsGroup.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -1,7 +0,0 @@
-package cc.kune.gspace.client.actions.perspective;
-
-/**
- * An action that must be showed when viewing
- */
-public interface ViewActionsGroup extends ActionsGroup {
-}

Copied: trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeBorrarTest.java (from rev 1319, trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeTest.java)
===================================================================
--- trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeBorrarTest.java	                        (rev 0)
+++ trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeBorrarTest.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -0,0 +1,45 @@
+package cc.kune.core.client.actions;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.core.shared.domain.utils.AccessRights;
+
+import com.google.inject.Provider;
+
+public class ActionRegistryByTypeBorrarTest {
+
+    private static final String OTHERACTIONGROUP = "otheractiongroup";
+    private static final String SOMEACTIONGROUP = "someactiongroup";
+    private GuiActionDescrip action;
+    private ActionRegistryByType actionRegistryByType;
+    private AccessRights allRights;
+
+    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @Before
+    public void before() {
+        actionRegistryByType = new ActionRegistryByType();
+        action = Mockito.mock(GuiActionDescrip.class);
+        allRights = new AccessRights(true, true, true);
+        actionRegistryByType.addAction(SOMEACTIONGROUP, new Provider() {
+            @Override
+            public Object get() {
+                return action;
+            }
+        });
+    }
+
+    @Test
+    public void testDontGetCurrentActionsOfOtherGroup() {
+        assertEquals(0, actionRegistryByType.getCurrentActions(null, false, allRights, OTHERACTIONGROUP).size());
+    }
+
+    @Test
+    public void testGetCurrentActionsOfGroup() {
+        assertEquals(1, actionRegistryByType.getCurrentActions(null, false, allRights, SOMEACTIONGROUP).size());
+    }
+}

Deleted: trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeTest.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/test/java/cc/kune/core/client/actions/ActionRegistryByTypeTest.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -1,55 +0,0 @@
-package cc.kune.core.client.actions;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
-import cc.kune.core.shared.domain.utils.AccessRights;
-import cc.kune.gspace.client.actions.perspective.ActionsGroup;
-import cc.kune.gspace.client.actions.perspective.EditActionsGroup;
-import cc.kune.gspace.client.actions.perspective.ViewActionsGroup;
-
-import com.google.inject.Provider;
-
-public class ActionRegistryByTypeTest {
-
-    private GuiActionDescrip action;
-    private ActionRegistryByType actionRegistryByType;
-    private AccessRights allRights;
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    @Before
-    public void before() {
-        actionRegistryByType = new ActionRegistryByType();
-        action = Mockito.mock(GuiActionDescrip.class);
-        allRights = new AccessRights(true, true, true);
-        actionRegistryByType.addAction(new Provider() {
-
-            @Override
-            public Object get() {
-                return action;
-            }
-        });
-    }
-
-    @Test
-    public void testDontGetCurrentActionsOfOtherPerspective() {
-        Mockito.when(action.getValue(ActionsGroup.KEY)).thenReturn(ViewActionsGroup.class);
-        assertEquals(0, actionRegistryByType.getCurrentActions(null, false, allRights, EditActionsGroup.class).size());
-    }
-
-    @Test
-    public void testGetCurrentActions() {
-        Mockito.when(action.getValue(ActionsGroup.KEY)).thenReturn(null);
-        assertEquals(1, actionRegistryByType.getCurrentActions(null, false, allRights, null).size());
-    }
-
-    @Test
-    public void testGetCurrentActionsOfPerspective() {
-        Mockito.when(action.getValue(ActionsGroup.KEY)).thenReturn(EditActionsGroup.class);
-        assertEquals(1, actionRegistryByType.getCurrentActions(null, false, allRights, EditActionsGroup.class).size());
-    }
-}

Modified: trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java	2011-04-26 09:28:16 UTC (rev 1319)
+++ trunk/src/test/java/cc/kune/core/server/integration/content/ContentServiceSaveTest.java	2011-04-26 11:38:16 UTC (rev 1320)
@@ -22,6 +22,7 @@
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import cc.kune.core.server.TestDomainHelper;
@@ -41,17 +42,19 @@
 
     @Test
     public void testSaveAndRetrieve() throws Exception {
-        final String text = "Lorem ipsum dolor sit amet";
+        // We set the same content (in this case a wave id)
+        final String text = defaultContent.getWaveRef();
         final int version = defaultContent.getVersion();
         contentService.save(getHash(), defaultContent.getStateToken(), text);
         final StateContentDTO again = (StateContentDTO) contentService.getContent(getHash(),
                 defaultContent.getStateToken());
-        assertEquals(text, again.getContent());
+        assertEquals(text, again.getWaveRef());
         assertEquals(version + 1, again.getVersion());
         assertEquals(0, again.getRateByUsers().intValue());
         assertEquals(new Double(0), again.getRate());
     }
 
+    @Ignore
     @Test
     public void testSaveAndRetrieveBig() throws Exception {
         final String text = TestDomainHelper.createBigText();




More information about the kune-commits mailing list