[kune-commits] r960 - in trunk: . src/main/java/org/ourproject/kune/platf/client/actions/toolbar src/main/java/org/ourproject/kune/platf/client/dto src/main/java/org/ourproject/kune/platf/client/services src/main/java/org/ourproject/kune/platf/client/state src/main/java/org/ourproject/kune/platf/client/utils src/main/java/org/ourproject/kune/platf/server/users src/main/java/org/ourproject/kune/workspace/client/editor src/main/java/org/ourproject/kune/workspace/client/skel src/main/java/org/ourproject/kune/workspace/client/socialnet src/main/java/org/ourproject/kune/workspace/client/tags src/main/resources src/test/java/org/ourproject/kune/platf/server src/test/java/org/ourproject/kune/workspace/client/editor

vjrj vjrj at ourproject.org
Sat Nov 22 00:14:35 CET 2008


Author: vjrj
Date: 2008-11-22 00:14:32 +0100 (Sat, 22 Nov 2008)
New Revision: 960

Added:
   trunk/src/main/java/org/ourproject/kune/platf/client/utils/DeferredCommandWrapper.java
Modified:
   trunk/pom.xml
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionBuddiesSummaryToolbar.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionBuddiesSummaryToolbarPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java
   trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfoServiceDefault.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/skel/SimpleToolbar.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java
   trunk/src/main/resources/dozerBeanMapping.xml
   trunk/src/test/java/org/ourproject/kune/platf/server/TestHelper.java
   trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
Log:
Incomplete - task Use of new ActionDescriptionClass in SocialNetwork

And some test fixed


Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/pom.xml	2008-11-21 23:14:32 UTC (rev 960)
@@ -379,8 +379,8 @@
         <version>2.0-beta23</version>
         <configuration>
           <logLevel>INFO</logLevel>
-          <style>PRETTY</style>
-          <!-- <style>OBF</style> -->
+          <style>OBF</style>
+          <!-- <style>PRETTY</style> -->
           <runTarget>
             org.ourproject.kune.app.Kune/Kune.html
           </runTarget>

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionBuddiesSummaryToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionBuddiesSummaryToolbar.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionBuddiesSummaryToolbar.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -1,7 +1,7 @@
 package org.ourproject.kune.platf.client.actions.toolbar;
 
-import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
 
-public interface ActionBuddiesSummaryToolbar extends ActionToolbar<StateToken> {
+public interface ActionBuddiesSummaryToolbar extends ActionToolbar<UserSimpleDTO> {
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionBuddiesSummaryToolbarPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionBuddiesSummaryToolbarPresenter.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/toolbar/ActionBuddiesSummaryToolbarPresenter.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -1,11 +1,11 @@
 package org.ourproject.kune.platf.client.actions.toolbar;
 
-import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
 
-public class ActionBuddiesSummaryToolbarPresenter extends ActionToolbarPresenter<StateToken> implements
+public class ActionBuddiesSummaryToolbarPresenter extends ActionToolbarPresenter<UserSimpleDTO> implements
         ActionBuddiesSummaryToolbar {
 
-    public ActionBuddiesSummaryToolbarPresenter(ActionToolbarView<StateToken> toolbar) {
+    public ActionBuddiesSummaryToolbarPresenter(ActionToolbarView<UserSimpleDTO> toolbar) {
         super(toolbar);
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserInfoDTO.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -24,14 +24,11 @@
 import com.google.gwt.user.client.rpc.IsSerializable;
 
 public class UserInfoDTO implements IsSerializable {
-    private String shortName;
-    private String name;
+    private UserSimpleDTO user;
     private String chatName;
     private String chatPassword;
     private String homePage;
     private String userHash;
-    private I18nLanguageDTO language;
-    private I18nCountryDTO country;
     private List<GroupDTO> groupsIsAdmin;
     private List<GroupDTO> groupsIsCollab;
 
@@ -44,7 +41,7 @@
     }
 
     public I18nCountryDTO getCountry() {
-        return country;
+        return user.getCountry();
     }
 
     public List<GroupDTO> getGroupsIsAdmin() {
@@ -60,17 +57,21 @@
     }
 
     public I18nLanguageDTO getLanguage() {
-        return language;
+        return user.getLanguage();
     }
 
     public String getName() {
-        return name;
+        return user.getName();
     }
 
     public String getShortName() {
-        return shortName;
+        return user.getShortName();
     }
 
+    public UserSimpleDTO getUser() {
+        return user;
+    }
+
     public String getUserHash() {
         return userHash;
     }
@@ -84,10 +85,6 @@
 
     }
 
-    public void setCountry(final I18nCountryDTO country) {
-        this.country = country;
-    }
-
     public void setGroupsIsAdmin(final List<GroupDTO> groupsIsAdmin) {
         this.groupsIsAdmin = groupsIsAdmin;
     }
@@ -100,18 +97,10 @@
         this.homePage = homePage;
     }
 
-    public void setLanguage(final I18nLanguageDTO language) {
-        this.language = language;
+    public void setUser(UserSimpleDTO user) {
+        this.user = user;
     }
 
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    public void setShortName(final String shortName) {
-        this.shortName = shortName;
-    }
-
     public void setUserHash(final String userHash) {
         this.userHash = userHash;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -45,6 +45,7 @@
 import org.ourproject.kune.platf.client.app.HistoryWrapperDefault;
 import org.ourproject.kune.platf.client.app.ToolGroup;
 import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
 import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.ContentService;
@@ -66,6 +67,7 @@
 import org.ourproject.kune.platf.client.ui.QuickTipsHelper;
 import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette;
+import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigatorPanel;
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigatorPresenter;
@@ -361,6 +363,13 @@
             }
         });
 
+        register(Singleton.class, new Factory<DeferredCommandWrapper>(DeferredCommandWrapper.class) {
+            @Override
+            public DeferredCommandWrapper create() {
+                return new DeferredCommandWrapper();
+            }
+        });
+
         register(Singleton.class, new Factory<TextEditor>(TextEditor.class) {
             @Override
             public TextEditor create() {
@@ -370,7 +379,8 @@
                         contentNavigatorToolbar);
 
                 final TextEditorPresenter presenter = new TextEditorPresenter(true, toolbar,
-                        $(I18nUITranslationService.class), $(StateManager.class), $(SiteSignOutLink.class));
+                        $(I18nUITranslationService.class), $(StateManager.class), $(SiteSignOutLink.class),
+                        $(DeferredCommandWrapper.class));
                 final TextEditorPanel panel = new TextEditorPanel(presenter, $(I18nTranslationService.class),
                         $(WorkspaceSkeleton.class), $(ColorWebSafePalette.class));
                 presenter.init(panel);
@@ -463,7 +473,7 @@
         }, new Factory<ActionBuddiesSummaryToolbar>(ActionBuddiesSummaryToolbar.class) {
             @Override
             public ActionBuddiesSummaryToolbar create() {
-                final ActionToolbarPanel<StateToken> panel = new ActionToolbarPanel<StateToken>(
+                final ActionToolbarPanel<UserSimpleDTO> panel = new ActionToolbarPanel<UserSimpleDTO>(
                         $$(ActionManager.class), $(WorkspaceSkeleton.class));
                 final ActionBuddiesSummaryToolbarPresenter toolbar = new ActionBuddiesSummaryToolbarPresenter(panel);
                 return toolbar;

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -363,9 +363,10 @@
             public BuddiesSummary create() {
                 final BuddiesSummaryPresenter presenter = new BuddiesSummaryPresenter($(StateManager.class),
                         $(Session.class), $(UserActionRegistry.class), $(I18nTranslationService.class),
-                        $$(ChatEngine.class));
+                        $$(ChatEngine.class), $(ActionBuddiesSummaryToolbar.class));
                 final BuddiesSummaryPanel panel = new BuddiesSummaryPanel(presenter, $(WorkspaceSkeleton.class),
-                        $(I18nTranslationService.class), $(ActionManager.class), $(ActionBuddiesSummaryToolbar.class));
+                        $(I18nTranslationService.class), $(ActionManager.class),
+                        $(ActionBuddiesSummaryToolbar.class).getView());
                 presenter.init(panel);
                 return presenter;
             }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -49,6 +49,7 @@
 import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 
 import com.calclab.suco.client.listener.Listener;
@@ -77,6 +78,8 @@
 
     StateToken getCurrentStateToken();
 
+    UserSimpleDTO getCurrentUser();
+
     UserInfoDTO getCurrentUserInfo();
 
     String getGalleryPermittedExtensions();

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -31,6 +31,7 @@
 import org.ourproject.kune.platf.client.dto.StateContentDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.workspace.client.site.rpc.UserServiceAsync;
 
@@ -100,6 +101,10 @@
         return currentState == null ? null : currentState.getStateToken();
     }
 
+    public UserSimpleDTO getCurrentUser() {
+        return currentUserInfo == null ? null : currentUserInfo.getUser();
+    }
+
     public UserInfoDTO getCurrentUserInfo() {
         return currentUserInfo;
     }

Added: trunk/src/main/java/org/ourproject/kune/platf/client/utils/DeferredCommandWrapper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/utils/DeferredCommandWrapper.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/utils/DeferredCommandWrapper.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -0,0 +1,26 @@
+package org.ourproject.kune.platf.client.utils;
+
+import com.calclab.suco.client.listener.Listener0;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
+
+/**
+ * The Class DeferredCommandWrapper is a wrapper of the GWT DeferredCommand
+ * (used for testing classes without GWT dependencies).
+ */
+public class DeferredCommandWrapper {
+
+    /**
+     * Adds the command.
+     * 
+     * @param command
+     *            the listener
+     */
+    public void addCommand(final Listener0 command) {
+        DeferredCommand.addCommand(new Command() {
+            public void execute() {
+                command.onEvent();
+            }
+        });
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfo.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -24,18 +24,16 @@
 import org.ourproject.kune.platf.server.domain.Group;
 import org.ourproject.kune.platf.server.domain.I18nCountry;
 import org.ourproject.kune.platf.server.domain.I18nLanguage;
+import org.ourproject.kune.platf.server.domain.User;
 
 public class UserInfo {
-    private String shortName;
-    private String name;
+    private User user;
     private String chatName;
     private String chatPassword;
     private String homePage;
     private List<Group> groupsIsAdmin;
     private List<Group> groupsIsCollab;
     private String userHash;
-    private I18nLanguage language;
-    private I18nCountry country;
 
     public String getChatName() {
         return chatName;
@@ -46,7 +44,7 @@
     }
 
     public I18nCountry getCountry() {
-        return country;
+        return user.getCountry();
     }
 
     public List<Group> getGroupsIsAdmin() {
@@ -62,17 +60,21 @@
     }
 
     public I18nLanguage getLanguage() {
-        return language;
+        return user.getLanguage();
     }
 
     public String getName() {
-        return name;
+        return user.getName();
     }
 
     public String getShortName() {
-        return shortName;
+        return user.getShortName();
     }
 
+    public User getUser() {
+        return user;
+    }
+
     public String getUserHash() {
         return userHash;
     }
@@ -85,10 +87,6 @@
         this.chatPassword = chatPassword;
     }
 
-    public void setCountry(final I18nCountry country) {
-        this.country = country;
-    }
-
     public void setGroupsIsAdmin(final List<Group> groupsIsAdmin) {
         this.groupsIsAdmin = groupsIsAdmin;
     }
@@ -101,18 +99,10 @@
         this.homePage = homePage;
     }
 
-    public void setLanguage(final I18nLanguage language) {
-        this.language = language;
+    public void setUser(User user) {
+        this.user = user;
     }
 
-    public void setName(final String name) {
-        this.name = name;
-    }
-
-    public void setShortName(final String shortName) {
-        this.shortName = shortName;
-    }
-
     public void setUserHash(final String userHash) {
         this.userHash = userHash;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfoServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfoServiceDefault.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/users/UserInfoServiceDefault.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -22,7 +22,6 @@
 import org.ourproject.kune.platf.client.errors.DefaultException;
 import org.ourproject.kune.platf.server.domain.Content;
 import org.ourproject.kune.platf.server.domain.Group;
-import org.ourproject.kune.platf.server.domain.I18nLanguage;
 import org.ourproject.kune.platf.server.domain.User;
 import org.ourproject.kune.platf.server.manager.SocialNetworkManager;
 import org.ourproject.kune.platf.server.sn.ParticipationData;
@@ -45,13 +44,9 @@
         if (User.isKnownUser(user)) {
             info = new UserInfo();
 
-            info.setShortName(user.getShortName());
-            info.setName(user.getName());
+            info.setUser(user);
             info.setChatName(user.getShortName());
             info.setChatPassword(user.getPassword());
-            final I18nLanguage language = user.getLanguage();
-            info.setLanguage(language);
-            info.setCountry(user.getCountry());
             info.setUserHash(userHash);
 
             final Group userGroup = user.getUserGroup();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -29,13 +29,12 @@
 import org.ourproject.kune.platf.client.dto.AccessRolDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
 
 import com.calclab.suco.client.listener.Listener;
 import com.calclab.suco.client.listener.Listener0;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.DeferredCommand;
 
 public class TextEditorPresenter implements TextEditor {
     public static final int AUTOSAVE_AFTER_FAILS_IN_MILLISECONS = 20000;
@@ -56,14 +55,17 @@
     private final BeforeActionListener beforeStateChangeListener;
     private final StateManager stateManager;
     private final SiteSignOutLink siteSignOutLink;
+    private final DeferredCommandWrapper deferredCommandWrapper;
 
     public TextEditorPresenter(final boolean isAutoSave, final ActionToolbar<StateToken> toolbar,
-            final I18nUITranslationService i18n, StateManager stateManager, SiteSignOutLink siteSignOutLink) {
+            final I18nUITranslationService i18n, StateManager stateManager, SiteSignOutLink siteSignOutLink,
+            DeferredCommandWrapper deferredCommandWrapper) {
         this.toolbar = toolbar;
         autoSave = isAutoSave;
         this.i18n = i18n;
         this.stateManager = stateManager;
         this.siteSignOutLink = siteSignOutLink;
+        this.deferredCommandWrapper = deferredCommandWrapper;
         savePending = false;
         editingHtml = false;
         saveAndCloseConfirmed = false;
@@ -181,8 +183,8 @@
             onCancel();
             return false;
         } else {
-            DeferredCommand.addCommand(new Command() {
-                public void execute() {
+            deferredCommandWrapper.addCommand(new Listener0() {
+                public void onEvent() {
                     onCancelConfirmed();
                 }
             });

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/skel/SimpleToolbar.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/skel/SimpleToolbar.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/skel/SimpleToolbar.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -72,6 +72,12 @@
         childPanel.clear();
     }
 
+    public void setCleanStyle() {
+        setStyleName("x-toolbar");
+        addStyleName("x-panel");
+        addStyleName("k-blank-toolbar");
+    }
+
     public void setHeight(int height) {
         mainPanel.setHeight("" + height);
         mainPanel.setCellHeight(childPanel, "" + height);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPanel.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -21,10 +21,13 @@
 import org.ourproject.kune.platf.client.actions.ActionItem;
 import org.ourproject.kune.platf.client.actions.ActionItemCollection;
 import org.ourproject.kune.platf.client.actions.ActionManager;
+import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
 import org.ourproject.kune.platf.client.actions.MenuItemsContainer;
-import org.ourproject.kune.platf.client.actions.toolbar.ActionBuddiesSummaryToolbar;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarPanel;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbarView;
 import org.ourproject.kune.platf.client.dto.UserSimpleDTO;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.workspace.client.skel.SimpleToolbar;
 import org.ourproject.kune.workspace.client.skel.SummaryPanel;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 
@@ -73,10 +76,10 @@
     private final Label otherBuddiesLabel;
     private final I18nTranslationService i18n;
     private final ActionManager actionManager;
+    private final SimpleToolbar toolbar;
 
     public BuddiesSummaryPanel(final BuddiesSummaryPresenter presenter, final WorkspaceSkeleton ws,
-            I18nTranslationService i18n, ActionManager actionManager,
-            ActionBuddiesSummaryToolbar actionBuddiesSummaryToolbar) {
+            I18nTranslationService i18n, ActionManager actionManager, ActionToolbarView<UserSimpleDTO> actionToolbarView) {
         super(i18n.t("Buddies"), i18n.t("Buddies of this user"), ws);
         this.actionManager = actionManager;
         menuItemsContainer = new MenuItemsContainer<UserSimpleDTO>();
@@ -87,9 +90,11 @@
         otherBuddiesLabel.addStyleName("kune-Margin-Small-trbl");
         vp.add(flowPanel);
         vp.add(otherBuddiesLabel);
+        toolbar = ((ActionToolbarPanel<UserSimpleDTO>) actionToolbarView).getToolbar(ActionToolbarPosition.bottombar);
+        toolbar.setCleanStyle();
+        vp.add(toolbar);
         super.add(vp);
         addInSummary();
-        clear();
     }
 
     public void addBuddie(final UserSimpleDTO user, ActionItemCollection<UserSimpleDTO> actionCollection) {
@@ -115,6 +120,7 @@
         flowPanel.clear();
         clearOtherUsers();
         menuItemsContainer.clear();
+        toolbar.removeAll();
         super.doLayoutIfNeeded();
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -22,11 +22,13 @@
 
 import org.ourproject.kune.chat.client.ChatEngine;
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
+import org.ourproject.kune.platf.client.actions.ActionAddCondition;
 import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
 import org.ourproject.kune.platf.client.actions.ActionToolbarButtonAndItemDescriptor;
+import org.ourproject.kune.platf.client.actions.ActionToolbarMenuDescriptor;
 import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
 import org.ourproject.kune.platf.client.actions.UserActionRegistry;
+import org.ourproject.kune.platf.client.actions.toolbar.ActionBuddiesSummaryToolbar;
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
 import org.ourproject.kune.platf.client.dto.AccessRolDTO;
 import org.ourproject.kune.platf.client.dto.GroupType;
@@ -36,6 +38,7 @@
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.site.Site;
 
 import com.calclab.suco.client.ioc.Provider;
 import com.calclab.suco.client.listener.Listener;
@@ -48,14 +51,17 @@
     private final I18nTranslationService i18n;
     private final Provider<ChatEngine> chatEngineProvider;
     private final Session session;
+    private final ActionBuddiesSummaryToolbar toolbar;
 
     public BuddiesSummaryPresenter(StateManager stateManager, final Session session, UserActionRegistry actionRegistry,
-            I18nTranslationService i18n, final Provider<ChatEngine> chatEngineProvider) {
+            I18nTranslationService i18n, final Provider<ChatEngine> chatEngineProvider,
+            final ActionBuddiesSummaryToolbar toolbar) {
         this.stateManager = stateManager;
         this.session = session;
         this.actionRegistry = actionRegistry;
         this.i18n = i18n;
         this.chatEngineProvider = chatEngineProvider;
+        this.toolbar = toolbar;
         stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
             public void onEvent(StateAbstractDTO state) {
                 setState(state);
@@ -105,6 +111,10 @@
                         view.setNoBuddies();
                     }
                 }
+                toolbar.disableMenusAndClearButtons();
+                toolbar.setActions(actionRegistry.getCurrentActions(session.getCurrentUser(), session.isLogged(),
+                        state.getGroupRights(), true));
+                toolbar.attach();
                 view.show();
             } else {
                 view.hide();
@@ -114,6 +124,19 @@
         }
     }
 
+    private void createShowAction(String textDescription) {
+        ActionToolbarMenuDescriptor<UserSimpleDTO> showBuddies = new ActionToolbarMenuDescriptor<UserSimpleDTO>(
+                AccessRolDTO.Administrator, ActionToolbarPosition.bottombar, new Listener<UserSimpleDTO>() {
+                    public void onEvent(UserSimpleDTO parameter) {
+                        Site.info("In development");
+                    }
+                });
+        showBuddies.setTextDescription(textDescription);
+        showBuddies.setParentMenuTitle(i18n.t("Options"));
+        showBuddies.setParentSubMenuTitle(i18n.t("Who can view your buddies list"));
+        actionRegistry.addAction(showBuddies);
+    }
+
     private void registerActions() {
         final ActionToolbarButtonAndItemDescriptor<UserSimpleDTO> addAsBuddie = new ActionToolbarButtonAndItemDescriptor<UserSimpleDTO>(
                 AccessRolDTO.Viewer, ActionToolbarPosition.bottombar, new Listener<UserSimpleDTO>() {
@@ -124,8 +147,8 @@
         addAsBuddie.setMustBeAuthenticated(true);
         addAsBuddie.setTextDescription(i18n.t("Add as buddie"));
         addAsBuddie.setIconUrl("images/add-green.png");
-        addAsBuddie.setEnableCondition(new ActionEnableCondition<UserSimpleDTO>() {
-            public boolean mustBeEnabled(UserSimpleDTO item) {
+        addAsBuddie.setAddCondition(new ActionAddCondition<UserSimpleDTO>() {
+            public boolean mustBeAdded(UserSimpleDTO item) {
                 return !session.getCurrentUserInfo().getShortName().equals(item.getShortName());
             }
         });
@@ -141,5 +164,10 @@
         go.setTextDescription(i18n.t("Visit this user homepage"));
         go.setIconUrl("images/group-home.gif");
         actionRegistry.addAction(go);
+
+        createShowAction(i18n.t("anyone"));
+        createShowAction(i18n.t("only your buddies"));
+        createShowAction(i18n.t("only you"));
     }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanel.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanel.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -65,12 +65,10 @@
         };
         // gridMenuPanel.onClick(go);
         gridMenuPanel.onDoubleClick(go);
+        gridMenuPanel.getBottomBar().setCls("k-blank-toolbar");
         super.add(gridMenuPanel);
         toolbar = ((ActionToolbarPanel<StateToken>) actionToolbarView).getToolbar(ActionToolbarPosition.bottombar);
-        toolbar.setStyleName("x-toolbar");
-        toolbar.addStyleName("x-panel");
-        toolbar.addStyleName("k-blank-toolbar");
-        // toolbar.addStyleName("k-site-traybar");
+        toolbar.setCleanStyle();
         super.add(toolbar);
         super.addInSummary();
         ws.addListenerInEntitySummary(new ContainerListenerAdapter() {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -171,18 +171,16 @@
     }
 
     private void createShowAction(String textDescription) {
-        ActionToolbarMenuDescriptor<StateToken> showMembersToAll = new ActionToolbarMenuDescriptor<StateToken>(
+        ActionToolbarMenuDescriptor<StateToken> showMembers = new ActionToolbarMenuDescriptor<StateToken>(
                 AccessRolDTO.Administrator, ActionToolbarPosition.bottombar, new Listener<StateToken>() {
                     public void onEvent(StateToken parameter) {
                         Site.info("In development");
                     }
                 });
-        // showMembersToAll.setIconUrl("images/add-green.gif");
-        showMembersToAll.setTextDescription(textDescription);
-        // showMembersToAll.setToolTip(i18n.t("Add a group or a person as member of this group"));
-        showMembersToAll.setParentMenuTitle(i18n.t("Options"));
-        showMembersToAll.setParentSubMenuTitle(i18n.t("Who can view this member list"));
-        groupActionRegistry.addAction(showMembersToAll);
+        showMembers.setTextDescription(textDescription);
+        showMembers.setParentMenuTitle(i18n.t("Options"));
+        showMembers.setParentSubMenuTitle(i18n.t("Who can view this member list"));
+        groupActionRegistry.addAction(showMembers);
     }
 
     @SuppressWarnings("unchecked")

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPanel.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPanel.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -27,6 +27,7 @@
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuPanel;
+import org.ourproject.kune.workspace.client.skel.SimpleToolbar;
 import org.ourproject.kune.workspace.client.skel.SummaryPanel;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 import org.ourproject.kune.workspace.client.themes.WsTheme;
@@ -38,6 +39,7 @@
 public class ParticipationSummaryPanel extends SummaryPanel implements ParticipationSummaryView {
 
     private final GridMenuPanel<GroupDTO> gridMenuPanel;
+    private final SimpleToolbar toolbar;
 
     public ParticipationSummaryPanel(final ParticipationSummaryPresenter presenter, final I18nTranslationService i18n,
             final WorkspaceSkeleton ws, ActionToolbarView<StateToken> actionToolbarView) {
@@ -52,7 +54,9 @@
         // gridMenuPanel.onClick(go);
         gridMenuPanel.onDoubleClick(go);
         super.add(gridMenuPanel);
-        super.add(((ActionToolbarPanel<StateToken>) actionToolbarView).getToolbar(ActionToolbarPosition.bottombar));
+        toolbar = ((ActionToolbarPanel<StateToken>) actionToolbarView).getToolbar(ActionToolbarPosition.bottombar);
+        toolbar.setCleanStyle();
+        super.add(toolbar);
         addInSummary();
         ws.addListenerInEntitySummary(new ContainerListenerAdapter() {
             @Override
@@ -70,6 +74,7 @@
     @Override
     public void clear() {
         gridMenuPanel.removeAll();
+        toolbar.removeAll();
     }
 
     public void setTheme(WsTheme oldTheme, WsTheme newTheme) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -36,7 +36,6 @@
 import org.ourproject.kune.workspace.client.themes.WsTheme;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
-import com.allen_sauer.gwt.log.client.Log;
 import com.calclab.suco.client.ioc.Provider;
 import com.calclab.suco.client.listener.Listener;
 import com.calclab.suco.client.listener.Listener2;
@@ -89,7 +88,6 @@
         view.clear();
         final List<GroupDTO> groupsIsAdmin = participation.getGroupsIsAdmin();
         final List<GroupDTO> groupsIsCollab = participation.getGroupsIsCollab();
-        Log.info(participation.toString());
         final int numAdmins = groupsIsAdmin.size();
         final int numCollaborators = groupsIsCollab.size();
         if (numAdmins == 0) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/tags/TagsSummaryPresenter.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -84,8 +84,8 @@
     }
 
     void setState(final StateContainerDTO state) {
-        Log.debug(state.getTagCloudResult().toString());
         if (state.getTagCloudResult() != null && state.getTagCloudResult().getTagCountList().size() > 0) {
+            Log.debug(state.getTagCloudResult().toString());
             view.setVisible(true);
             setCloud(state.getTagCloudResult());
         } else {

Modified: trunk/src/main/resources/dozerBeanMapping.xml
===================================================================
--- trunk/src/main/resources/dozerBeanMapping.xml	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/main/resources/dozerBeanMapping.xml	2008-11-21 23:14:32 UTC (rev 960)
@@ -295,25 +295,15 @@
       org.ourproject.kune.platf.server.users.UserInfo
     </class-b>
     <field>
-      <a>language</a>
-      <b>language</b>
+      <a>user</a>
+      <b>user</b>
       <a-hint>
-        org.ourproject.kune.platf.client.dto.I18nLanguageDTO
+        org.ourproject.kune.platf.client.dto.UserSimpleDTO
       </a-hint>
       <b-hint>
-        org.ourproject.kune.platf.server.domain.I18nLanguage
+        org.ourproject.kune.platf.server.domain.User
       </b-hint>
     </field>
-    <field>
-      <a>country</a>
-      <b>country</b>
-      <a-hint>
-        org.ourproject.kune.platf.client.dto.I18nCountryDTO
-      </a-hint>
-      <b-hint>
-        org.ourproject.kune.platf.server.domain.I18nCountry
-      </b-hint>
-    </field>
   </mapping>
 
   <mapping>

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/TestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/TestHelper.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/TestHelper.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -12,10 +12,6 @@
 import com.wideplay.warp.jpa.JpaUnit;
 
 public abstract class TestHelper {
-    public static void inject(final Object target) {
-        TestHelper.create(new PlatformServerModule(), "test", "kune.properties").injectMembers(target);
-    }
-
     public static Injector create(final Module module, final String persistenceUnit, final String propetiesFileName) {
         Injector injector = Guice.createInjector(module, new Module() {
             public void configure(Binder binder) {
@@ -27,4 +23,10 @@
         return injector;
     }
 
+    public static void inject(final Object target) {
+        // test: use memory
+        // test_db: use mysql
+        TestHelper.create(new PlatformServerModule(), "test", "kune.properties").injectMembers(target);
+    }
+
 }

Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java	2008-11-21 15:36:46 UTC (rev 959)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java	2008-11-21 23:14:32 UTC (rev 960)
@@ -8,9 +8,11 @@
 import org.mockito.Mockito;
 import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
 import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
 
+import com.calclab.suco.client.listener.Listener0;
 import com.calclab.suco.testing.listener.MockListener;
 import com.calclab.suco.testing.listener.MockListener0;
 
@@ -23,6 +25,7 @@
     private ActionToolbar toolbar;
     private StateManager stateManager;
     private SiteSignOutLink signOutLink;
+    private DeferredCommandWrapper deferredCommandWrapper;
 
     @SuppressWarnings("unchecked")
     @Before
@@ -31,7 +34,8 @@
         stateManager = Mockito.mock(StateManager.class);
         toolbar = Mockito.mock(ActionToolbar.class);
         signOutLink = Mockito.mock(SiteSignOutLink.class);
-        presenter = new TextEditorPresenter(true, toolbar, i18n, stateManager, signOutLink);
+        deferredCommandWrapper = Mockito.mock(DeferredCommandWrapper.class);
+        presenter = new TextEditorPresenter(true, toolbar, i18n, stateManager, signOutLink, deferredCommandWrapper);
         view = Mockito.mock(TextEditorView.class);
         presenter.init(view);
         saveListener = new MockListener<String>();
@@ -44,7 +48,7 @@
         boolean change = presenter.beforeTokenChange();
         assertTrue(change);
         Mockito.verify(view, Mockito.never()).showSaveBeforeDialog();
-        Mockito.verify(toolbar, Mockito.times(1)).detach();
+        Mockito.verify(deferredCommandWrapper, Mockito.times(1)).addCommand((Listener0) Mockito.anyObject());
     }
 
     @Test




More information about the kune-commits mailing list