[kune-commits] r1244 - in trunk/src: main/java/cc/kune/common/client/actions/gxtui main/java/cc/kune/common/client/actions/ui main/java/cc/kune/common/client/ui main/java/cc/kune/core/client main/java/cc/kune/core/client/sitebar main/java/cc/kune/core/client/sn main/java/cc/kune/core/client/sn/actions main/java/cc/kune/core/client/sn/actions/conditions main/java/cc/kune/core/client/sn/actions/registry main/java/cc/kune/core/client/state main/java/cc/kune/core/public main/java/cc/kune/core/public/images main/java/cc/kune/gspace/client main/java/org/ourproject/kune/platf/client/services main/java/org/ourproject/kune/workspace/client/oldsn test/java/org/ourproject/kune/workspace/client/socialnet

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Thu Feb 10 19:28:58 CET 2011


Author: vjrj_
Date: 2011-02-10 19:28:58 +0100 (Thu, 10 Feb 2011)
New Revision: 1244

Added:
   trunk/src/main/java/cc/kune/core/client/sn/actions/GotoPersonAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/RolComparator.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithMemberAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersActionsRegistry.java
   trunk/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java
   trunk/src/main/java/cc/kune/core/public/images/unknown.jpg
Removed:
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSocialNetworActionsRegistry.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolComparator.java
Modified:
   trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java
   trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuGui.java
   trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java
   trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuGui.java
   trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java
   trunk/src/main/java/cc/kune/common/client/ui/BasicThumb.java
   trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
   trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java
   trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPanel.java
   trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPanel.ui.xml
   trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPresenter.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/AcceptJoinGroupAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/DenyJoinGroupAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/GotoGroupAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/GotoMemberAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithUserAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinGroupAction.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNAdminsMenuItemsRegistry.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNCollabsMenuItemsRegistry.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNPendingsMenuItemsRegistry.java
   trunk/src/main/java/cc/kune/core/client/state/AccessRightsClientManager.java
   trunk/src/main/java/cc/kune/core/public/ws.css
   trunk/src/main/java/cc/kune/gspace/client/WsArmorImpl.ui.xml
   trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolAction.java
   trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolComparatorTest.java
Log:
SN Refactorization

Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtButtonGui.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -34,7 +34,9 @@
 import com.extjs.gxt.ui.client.event.SelectionListener;
 import com.extjs.gxt.ui.client.widget.button.Button;
 import com.extjs.gxt.ui.client.widget.button.ToggleButton;
+import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
 
 public abstract class AbstractGxtButtonGui extends AbstractChildGuiItem {
 
@@ -94,6 +96,12 @@
     }
 
     @Override
+    public void setIconResource(final ImageResource icon) {
+        button.setIcon(AbstractImagePrototype.create(icon));
+        button.setScale(ButtonScale.SMALL);
+    }
+
+    @Override
     protected void setIconStyle(final String style) {
         button.setIconStyle(style);
         button.setScale(ButtonScale.SMALL);
@@ -117,9 +125,12 @@
         if (tooltip != null && !tooltip.isEmpty()) {
             final KeyStroke key = (KeyStroke) descriptor.getValue(Action.ACCELERATOR_KEY);
             if (key == null) {
-                button.setToolTip(new GxtDefTooltip(tooltip));
+                // button.setToolTip(new GxtDefTooltip(tooltip));
+                button.setTitle(tooltip);
             } else {
-                button.setToolTip(new GxtDefTooltip(tooltip + key.toString()));
+                // button.setToolTip(new GxtDefTooltip(tooltip +
+                // key.toString()));
+                button.setTitle(tooltip + key.toString());
             }
         }
     }

Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuGui.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuGui.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -31,11 +31,25 @@
 import com.extjs.gxt.ui.client.widget.menu.Menu;
 import com.extjs.gxt.ui.client.widget.menu.MenuItem;
 import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
+import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.UIObject;
 
 public abstract class AbstractGxtMenuGui extends AbstractChildGuiItem implements ParentWidget {
 
+    public enum MenuPosition {
+        b, // The top left corner (default)
+        bl, // The center of the top edge
+        br, // The bottom right corner ,// The top right corner
+        c, // The center of the left edge
+        l, // In the center of the element
+        r, // The center of the right edge
+        t, // The bottom left corner
+        tl, // The center of the bottom edge
+        tr
+    }
+    public static final String DEF_MENU_POSITION = "bl";
+    public static final String MENU_POSITION = "menu-position";
     protected Menu menu;
 
     public AbstractGxtMenuGui() {
@@ -52,7 +66,6 @@
 
     public void addSeparator() {
         menu.add(new SeparatorMenuItem());
-
     }
 
     @Override
@@ -92,6 +105,12 @@
         return this;
     }
 
+    protected String getMenuPosition() {
+        final MenuPosition position = (MenuPosition) descriptor.getValue(MENU_POSITION);
+        GWT.log("menu position" + position == null ? "none" : position.name());
+        return position == null ? DEF_MENU_POSITION : position.name();
+    }
+
     @Override
     public void insert(final int position, final UIObject item) {
         menu.insert((MenuItem) item, position);
@@ -104,9 +123,9 @@
 
     public void show(final Object relative) {
         if (relative instanceof String) {
-            menu.show(RootPanel.get((String) relative));
+            menu.show(RootPanel.get((String) relative).getElement(), getMenuPosition());
         } else if (relative instanceof UIObject) {
-            menu.show(((UIObject) relative).getElement(), "bl");
+            menu.show(((UIObject) relative).getElement(), getMenuPosition());
         } else if (relative instanceof Position) {
             final Position position = (Position) relative;
             menu.showAt(position.getX(), position.getY());

Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/AbstractGxtMenuItemGui.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -36,9 +36,11 @@
 import com.extjs.gxt.ui.client.event.SelectionListener;
 import com.extjs.gxt.ui.client.widget.menu.CheckMenuItem;
 import com.extjs.gxt.ui.client.widget.menu.MenuItem;
+import com.google.gwt.resources.client.ImageResource;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
 
 public abstract class AbstractGxtMenuItemGui extends AbstractChildGuiItem {
 
@@ -132,6 +134,11 @@
     }
 
     @Override
+    public void setIconResource(final ImageResource icon) {
+        item.setIcon(AbstractImagePrototype.create(icon));
+    }
+
+    @Override
     protected void setIconStyle(final String style) {
         item.setIconStyle(style);
     }

Modified: trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuGui.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/common/client/actions/gxtui/GxtMenuGui.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -26,11 +26,14 @@
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
 import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 
+import com.extjs.gxt.ui.client.Style.ButtonScale;
 import com.extjs.gxt.ui.client.event.ButtonEvent;
 import com.extjs.gxt.ui.client.event.SelectionListener;
 import com.extjs.gxt.ui.client.widget.button.SplitButton;
 import com.extjs.gxt.ui.client.widget.menu.MenuItem;
 import com.extjs.gxt.ui.client.widget.menu.SeparatorMenuItem;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
 import com.google.gwt.user.client.ui.UIObject;
 
 public class GxtMenuGui extends AbstractGxtMenuGui implements ParentWidget {
@@ -115,6 +118,14 @@
     }
 
     @Override
+    public void setIconResource(final ImageResource icon) {
+        if (button != null) {
+            button.setIcon(AbstractImagePrototype.create(icon));
+            button.setScale(ButtonScale.SMALL);
+        }
+    }
+
+    @Override
     public void setIconStyle(final String style) {
         if (button != null) {
             button.setIconStyle(style);

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	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractGuiItem.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -111,7 +111,7 @@
 
     private void setIcon(final Object icon) {
         if (icon instanceof ImageResource) {
-            setIconStyle((IconConstants.CSS_SUFFIX + ((ImageResource) icon).getName()));
+            setIconResource((ImageResource) icon);
         } else if (icon instanceof String) {
             setIconStyle((String) icon);
         } else if (icon != null) {
@@ -119,6 +119,10 @@
         }
     }
 
+    public void setIconResource(final ImageResource icon) {
+        setIconStyle((IconConstants.CSS_SUFFIX + icon.getName()));
+    }
+
     protected abstract void setIconStyle(String style);
 
     private void setStyles(final String styles) {

Modified: trunk/src/main/java/cc/kune/common/client/ui/BasicThumb.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/BasicThumb.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/common/client/ui/BasicThumb.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -65,9 +65,9 @@
         vpanel.add(image);
         vpanel.add(label);
         vpanel.addStyleName("k-basic-thumb");
-        vpanel.addStyleName("kune-Margin-Small-trbl");
-        vpanel.addStyleName("kune-pointer");
-        vpanel.addStyleName("kune-floatleft");
+        vpanel.addStyleName("kune-Margin-Mini-trbl");
+        vpanel.addStyleName("k-pointer");
+        vpanel.addStyleName("k-floatleft");
         vpanel.setCellHorizontalAlignment(label, VerticalPanel.ALIGN_CENTER);
         if (clickHandler instanceof ClickHandler) {
             addClickHandlerImpl(clickHandler);
@@ -110,9 +110,12 @@
         image.addClickHandler(clickHandler);
     }
 
+    public void setLabelVisible(final boolean visible) {
+        label.setVisible(visible);
+    }
+
     public void setOnOverLabel(final boolean onOverLabel) {
         this.onOverLabel = onOverLabel;
-        label.setVisible(!onOverLabel);
     }
 
     public void setText(final String text) {

Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -68,6 +68,11 @@
 import cc.kune.core.client.sitebar.spaces.SpaceSelectorViewImpl;
 import cc.kune.core.client.sn.GroupMembersPanel;
 import cc.kune.core.client.sn.GroupMembersPresenter;
+import cc.kune.core.client.sn.actions.registry.GroupMembersActionsRegistry;
+import cc.kune.core.client.sn.actions.registry.SNAdminsMenuItemsRegistry;
+import cc.kune.core.client.sn.actions.registry.SNCollabsMenuItemsRegistry;
+import cc.kune.core.client.sn.actions.registry.SNPendingsMenuItemsRegistry;
+import cc.kune.core.client.state.AccessRightsClientManager;
 import cc.kune.core.client.state.ContentProvider;
 import cc.kune.core.client.state.ContentProviderDefault;
 import cc.kune.core.client.state.HistoryWrapper;
@@ -158,12 +163,19 @@
         bind(ErrorHandler.class).in(Singleton.class);
         bind(StateManagerDefault.class).in(Singleton.class);
         bind(StateManager.class).to(StateManagerDefault.class).in(Singleton.class);
+        bind(AccessRightsClientManager.class).in(Singleton.class);
         bind(ContentProvider.class).to(ContentProviderDefault.class).in(Singleton.class);
         bind(HistoryWrapper.class).to(HistoryWrapperDefault.class).in(Singleton.class);
         bind(PrefetchUtilities.class).in(Singleton.class);
         bind(AppStarter.class).to(AppStarterDefault.class).in(Singleton.class);
         bind(CookiesManager.class).to(CookiesManagerImpl.class).in(Singleton.class);
 
+        // SN
+        bind(SNAdminsMenuItemsRegistry.class).in(Singleton.class);
+        bind(SNCollabsMenuItemsRegistry.class).in(Singleton.class);
+        bind(SNPendingsMenuItemsRegistry.class).in(Singleton.class);
+        bind(GroupMembersActionsRegistry.class).in(Singleton.class);
+
         bind(SitebarNewGroupLink.class).in(Singleton.class);
         bind(SitebarSignInLink.class).in(Singleton.class);
         bind(SitebarSignOutLink.class).in(Singleton.class);

Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -22,6 +22,7 @@
 import cc.kune.common.client.actions.AbstractExtendedAction;
 import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.gxtui.AbstractGxtMenuGui;
 import cc.kune.common.client.actions.ui.IsActionExtensible;
 import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
@@ -99,7 +100,6 @@
     private void init() {
         getView().getLeftBar().addAction(LEFT_TOOLBAR);
         getView().getRightBar().addAction(RIGHT_TOOLBAR);
-        getView().getRightBar().addAction(OPTIONS_MENU);
     }
 
     @ProxyEvent
@@ -116,6 +116,7 @@
         action.putValue(Action.NAME, "Test");
         final MenuItemDescriptor testMenuItem = new MenuItemDescriptor(OPTIONS_MENU, action);
         OPTIONS_MENU.setStyles("k-no-backimage, k-btn-sitebar");
+        OPTIONS_MENU.putValue(AbstractGxtMenuGui.MENU_POSITION, AbstractGxtMenuGui.MenuPosition.bl);
         // final ToolbarSeparatorDescriptor separator = new
         // ToolbarSeparatorDescriptor(Type.separator, RIGHT_TOOLBAR);
         // final ToolbarSeparatorDescriptor separator2 = new
@@ -151,10 +152,12 @@
         // right.addAction(separator2);
         right.addAction(newGroupLink.get());
         // right.addAction(separator);
+        right.addAction(OPTIONS_MENU);
         right.addAction(testMenuItem);
         right.addAction(menuSeparator);
         right.addAction(bugs);
         right.addAction(new MenuItemDescriptor(OPTIONS_MENU, aboutAction));
+
     }
 
     @Override

Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPanel.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPanel.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -1,5 +1,6 @@
 package cc.kune.core.client.sn;
 
+import cc.kune.common.client.actions.gxtui.AbstractGxtMenuGui;
 import cc.kune.common.client.actions.ui.ActionFlowPanel;
 import cc.kune.common.client.actions.ui.ActionSimplePanel;
 import cc.kune.common.client.actions.ui.IsActionExtensible;
@@ -19,6 +20,7 @@
 import com.google.gwt.uibinder.client.UiBinder;
 import com.google.gwt.uibinder.client.UiField;
 import com.google.gwt.user.client.ui.DeckPanel;
+import com.google.gwt.user.client.ui.DockLayoutPanel;
 import com.google.gwt.user.client.ui.FlowPanel;
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.ScrollPanel;
@@ -34,6 +36,8 @@
     private static GroupMembersPanelUiBinder uiBinder = GWT.create(GroupMembersPanelUiBinder.class);
     private final ActionSimplePanel actions;
     @UiField
+    Label adminsCount;
+    @UiField
     FlowPanel adminsFlow;
     @UiField
     Label adminsLabel;
@@ -41,10 +45,15 @@
     @UiField
     FlowPanel bottomPanel;
     @UiField
+    Label collabsCount;
+    @UiField
     FlowPanel collabsFlow;
     @UiField
     Label collabsLabel;
     @UiField
+    DockLayoutPanel collabsPanel;
+
+    @UiField
     ScrollPanel collabsScroll;
     @UiField
     DeckPanel deck;
@@ -59,10 +68,14 @@
     @UiField
     Label orphanProject;
     @UiField
+    Label pendingsCount;
+    @UiField
     FlowPanel pendingsFlow;
     @UiField
     Label pendingsLabel;
     @UiField
+    DockLayoutPanel pendingsPanel;
+    @UiField
     ScrollPanel pendingsScroll;
     private final Widget widget;
 
@@ -82,6 +95,7 @@
         bottomActionsToolbar = new ActionFlowPanel(guiProvider);
         actions = new ActionSimplePanel(guiProvider);
         bottomPanel.add(bottomActionsToolbar);
+        bottomActionsToolbar.setStyleName("k-sn-bottomPanel-actions");
         armor.getEntityToolsNorth().add(widget);
         deck.showWidget(2);
     }
@@ -125,6 +139,7 @@
         final BasicThumb thumb = new BasicThumb(avatarUrl, AVATARSIZE, group.getShortName(), AVATARLABELMAXSIZE, false);
         final MenuDescriptor menu = new MenuDescriptor();
         menu.setStandalone(true);
+        menu.putValue(AbstractGxtMenuGui.MENU_POSITION, AbstractGxtMenuGui.MenuPosition.bl);
         for (final GuiActionDescrip item : menuitems) {
             item.setParent(menu);
         }
@@ -138,9 +153,8 @@
         thumb.addClickHandler(clickHand);
         actions.add(menu);
         actions.add(menuitems);
-
         thumb.setTooltip(tooltipTitle, tooltip);
-        thumb.setOnOverLabel(true);
+        thumb.setLabelVisible(false);
         return thumb;
     }
 
@@ -150,6 +164,31 @@
     }
 
     @Override
+    public void setAdminsCount(final int count) {
+        adminsCount.setText(new StringBuffer("(").append(count).append(")").toString());
+    }
+
+    @Override
+    public void setCollabsCount(final int count) {
+        collabsCount.setText(new StringBuffer("(").append(count).append(")").toString());
+    }
+
+    @Override
+    public void setCollabsVisible(final boolean visible) {
+        collabsPanel.setVisible(visible);
+    }
+
+    @Override
+    public void setPendingsCount(final int count) {
+        pendingsCount.setText(new StringBuffer("(").append(count).append(")").toString());
+    }
+
+    @Override
+    public void setPendingVisible(final boolean visible) {
+        pendingsPanel.setVisible(visible);
+    }
+
+    @Override
     public void setVisible(final boolean visible) {
         deck.setVisible(visible);
     }

Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPanel.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPanel.ui.xml	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPanel.ui.xml	2011-02-10 18:28:58 UTC (rev 1244)
@@ -13,54 +13,65 @@
     <g:DeckPanel ui:field="deck" addStyleNames="k-sn-deck">
       <g:Label ui:field="noMembersVisible" addStyleNames="k-sn-novisible-label" />
       <g:Label ui:field="orphanProject" addStyleNames="k-sn-orphan-label" />
-      <g:FlowPanel width="100%" height="100px" ui:field="membersFlow">
+      <g:FlowPanel width="100%" ui:field="membersFlow">
 
         <g:DockLayoutPanel unit="EM" width="100%"
-          addStyleNames="k-sn-adminspanel" height="100px">
-          <g:north size="2.0">
+          addStyleNames="k-sn-adminspanel" height="80px">
+          <g:north size="1.2">
+            <g:FlowPanel>
             <g:Label text="Admins" ui:field="adminsLabel"
-              addStyleNames="k-sn-adminslabel" />
+              addStyleNames="k-sn-adminslabel" /><g:Label ui:field="adminsCount"
+              addStyleNames="k-sn-adminsCountlabel" />
+          </g:FlowPanel>
           </g:north>
           <g:center>
             <g:ScrollPanel width="100%" addStyleNames="k-sn-adminsscroll">
-              <g:FlowPanel width="100%" height="100%"
+              <g:FlowPanel addStyleNames="k-sn-adminsflow"
                 ui:field="adminsFlow" />
             </g:ScrollPanel>
           </g:center>
         </g:DockLayoutPanel>
 
         <g:DockLayoutPanel unit="EM" width="100%"
-          addStyleNames="k-sn-collabspanel" height="100px">
-          <g:north size="2.0">
+          ui:field="collabsPanel" addStyleNames="k-sn-collabspanel"
+          height="80px">
+          <g:north size="1.2">
+          <g:FlowPanel>
             <g:Label text="Collabs" ui:field="collabsLabel"
-              addStyleNames="k-sn-collabslabel" />
+              addStyleNames="k-sn-collabslabel" /><g:Label ui:field="collabsCount"
+              addStyleNames="k-sn-collabsCountlabel" />
+          </g:FlowPanel>
           </g:north>
           <g:center>
             <g:ScrollPanel ui:field="collabsScroll" width="100%"
               addStyleNames="k-sn-collabsscroll">
-              <g:FlowPanel width="100%" height="100%"
-                ui:field="collabsFlow" />
+              <g:FlowPanel ui:field="collabsFlow"
+                addStyleNames="k-sn-collabsflow" />
             </g:ScrollPanel>
           </g:center>
 
         </g:DockLayoutPanel>
 
         <g:DockLayoutPanel unit="EM" width="100%"
-          addStyleNames="k-sn-pendingspanel" height="100px">
-          <g:north size="2.0">
+          ui:field="pendingsPanel" addStyleNames="k-sn-pendingspanel"
+          height="80px">
+          <g:north size="1.2">
+           <g:FlowPanel>
             <g:Label text="Pendings" ui:field="pendingsLabel"
-              addStyleNames="k-sn-pendingslabel" />
+              addStyleNames="k-sn-pendingslabel" /><g:Label ui:field="pendingsCount"
+              addStyleNames="k-sn-pendingsCountlabel" />
+               </g:FlowPanel>
           </g:north>
           <g:center>
             <g:ScrollPanel ui:field="pendingsScroll"
               addStyleNames="k-sn-pendingsscroll" width="100%">
-              <g:FlowPanel width="100%" height="100%"
+              <g:FlowPanel addStyleNames="k-sn-pendingsflow"
                 ui:field="pendingsFlow" />
             </g:ScrollPanel>
           </g:center>
         </g:DockLayoutPanel>
       </g:FlowPanel>
     </g:DeckPanel>
-    <g:FlowPanel ui:field="bottomPanel" />
+    <g:FlowPanel ui:field="bottomPanel" addStyleNames="k-sn-bottomPanel" />
   </g:FlowPanel>
 </ui:UiBinder>
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPresenter.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupMembersPresenter.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -8,7 +8,8 @@
 import cc.kune.core.client.init.AppStartEvent;
 import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
 import cc.kune.core.client.services.FileDownloadUtils;
-import cc.kune.core.client.sn.actions.registry.AbstractSocialNetworActionsRegistry;
+import cc.kune.core.client.sn.actions.registry.AbstractSNMembersActionsRegistry;
+import cc.kune.core.client.sn.actions.registry.GroupMembersActionsRegistry;
 import cc.kune.core.client.sn.actions.registry.SNAdminsMenuItemsRegistry;
 import cc.kune.core.client.sn.actions.registry.SNCollabsMenuItemsRegistry;
 import cc.kune.core.client.sn.actions.registry.SNPendingsMenuItemsRegistry;
@@ -39,8 +40,9 @@
     }
 
     public interface GroupMembersView extends View {
-        int AVATARLABELMAXSIZE = 15;
-        int AVATARSIZE = 32;
+        int AVATARLABELMAXSIZE = 4;
+        // int AVATARSIZE = 32;
+        int AVATARSIZE = 22;
         String NOAVATAR = "";
 
         void addAdmin(GroupDTO group, String avatarUrl, String tooltip, String tooltipTitle,
@@ -56,8 +58,18 @@
 
         IsActionExtensible getBottomToolbar();
 
-        void setVisible(boolean b);
+        void setAdminsCount(int count);
 
+        void setCollabsCount(int count);
+
+        void setCollabsVisible(boolean visible);
+
+        void setPendingsCount(int count);
+
+        void setPendingVisible(boolean visible);
+
+        void setVisible(boolean visible);
+
         void showMemberNotPublic();
 
         void showMembers();
@@ -65,9 +77,10 @@
         void showOrphan();
     }
 
+    private final GroupMembersActionsRegistry actionsRegistry;
     private final SNAdminsMenuItemsRegistry adminsMenuItemsRegistry;
+
     private final SNCollabsMenuItemsRegistry collabsMenuItemsRegistry;
-
     private final Provider<FileDownloadUtils> downloadProvider;
     private final SNPendingsMenuItemsRegistry pendingsMenuItemsRegistry;
     private final Session session;
@@ -77,13 +90,15 @@
             final StateManager stateManager, final Session session, final Provider<FileDownloadUtils> downloadProvider,
             final SNAdminsMenuItemsRegistry adminsMenuItemsRegistry,
             final SNCollabsMenuItemsRegistry collabsMenuItemsRegistry,
-            final SNPendingsMenuItemsRegistry pendingsMenuItemsRegistry) {
+            final SNPendingsMenuItemsRegistry pendingsMenuItemsRegistry,
+            final GroupMembersActionsRegistry actionsRegistry) {
         super(eventBus, view, proxy);
         this.session = session;
         this.downloadProvider = downloadProvider;
         this.adminsMenuItemsRegistry = adminsMenuItemsRegistry;
         this.collabsMenuItemsRegistry = collabsMenuItemsRegistry;
         this.pendingsMenuItemsRegistry = pendingsMenuItemsRegistry;
+        this.actionsRegistry = actionsRegistry;
         stateManager.onStateChanged(new StateChangedEvent.StateChangedHandler() {
             @Override
             public void onStateChanged(final StateChangedEvent event) {
@@ -107,11 +122,11 @@
     }
 
     private void createActions() {
-        // TODO
+        getView().getBottomToolbar().addActions(actionsRegistry);
     }
 
     private GuiActionDescCollection createMenuItems(final GroupDTO group,
-            final AbstractSocialNetworActionsRegistry registry) {
+            final AbstractSNMembersActionsRegistry registry) {
         final GuiActionDescCollection items = new GuiActionDescCollection();
         for (final Provider<MenuItemDescriptor> provider : registry) {
             final MenuItemDescriptor menuItem = provider.get();
@@ -130,6 +145,7 @@
             getView().setVisible(false);
         } else {
             if (state.getSocialNetworkData().isMembersVisible()) {
+                getView().clear();
                 setGroupMembers(state.getGroupMembers(), state.getGroupRights());
             } else {
                 getView().clear();
@@ -155,7 +171,11 @@
         final int numCollabs = collabList.size();
         final int numPendings = pendingCollabsList.size();
 
-        if ((numAdmins + numCollabs + numPendings) == 0) {
+        getView().setAdminsCount(numAdmins);
+        getView().setCollabsCount(numCollabs);
+        getView().setPendingsCount(numPendings);
+
+        if ((numAdmins + numCollabs) == 0) {
             getView().showOrphan();
         } else {
             final boolean userIsAdmin = rights.isAdministrable();
@@ -166,19 +186,22 @@
                     final String avatar = getAvatar(admin);
                     getView().addAdmin(admin, avatar, admin.getLongName(), "",
                             createMenuItems(admin, adminsMenuItemsRegistry));
-
                 }
+                getView().setCollabsVisible(numCollabs > 0);
                 for (final GroupDTO collab : collabList) {
                     final String avatar = getAvatar(collab);
                     getView().addCollab(collab, avatar, collab.getLongName(), "",
                             createMenuItems(collab, collabsMenuItemsRegistry));
                 }
                 if (userIsAdmin) {
+                    getView().setPendingVisible(numPendings > 0);
                     for (final GroupDTO pendingCollab : pendingCollabsList) {
                         final String avatar = getAvatar(pendingCollab);
-                        getView().addCollab(pendingCollab, avatar, pendingCollab.getLongName(), "",
+                        getView().addPending(pendingCollab, avatar, pendingCollab.getLongName(), "",
                                 createMenuItems(pendingCollab, pendingsMenuItemsRegistry));
                     }
+                } else {
+                    getView().setPendingVisible(false);
                 }
                 getView().showMembers();
             }

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/AcceptJoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/AcceptJoinGroupAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/AcceptJoinGroupAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -3,7 +3,6 @@
 import cc.kune.common.client.actions.AbstractExtendedAction;
 import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.common.client.noti.NotifyUser;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
@@ -18,13 +17,6 @@
 import com.google.inject.Provider;
 
 public class AcceptJoinGroupAction extends AbstractExtendedAction {
-    public class AcceptJoinGroupMenuItem extends MenuItemDescriptor {
-
-        @Inject
-        public AcceptJoinGroupMenuItem(final AcceptJoinGroupAction action) {
-            super(action);
-        }
-    }
     private final I18nTranslationService i18n;
     private final Session session;
     private final Provider<SocialNetworkServiceAsync> snServiceProvider;

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -3,7 +3,6 @@
 import cc.kune.common.client.actions.AbstractExtendedAction;
 import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.common.client.noti.NotifyUser;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
@@ -18,16 +17,9 @@
 import com.google.inject.Provider;
 
 public class ChangeToAdminAction extends AbstractExtendedAction {
-    public class ChangeToAdminMenuItem extends MenuItemDescriptor {
-        @Inject
-        public ChangeToAdminMenuItem(final ChangeToAdminAction action) {
-            super(action);
-        }
-    }
     private final I18nTranslationService i18n;
     private final Session session;
     private final Provider<SocialNetworkServiceAsync> snServiceProvider;
-
     private final StateManager stateManager;
 
     @Inject

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -3,7 +3,6 @@
 import cc.kune.common.client.actions.AbstractExtendedAction;
 import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.common.client.noti.NotifyUser;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
@@ -18,12 +17,6 @@
 import com.google.inject.Provider;
 
 public class ChangeToCollabAction extends AbstractExtendedAction {
-    public class ChangeToCollabMenuItem extends MenuItemDescriptor {
-        @Inject
-        public ChangeToCollabMenuItem(final ChangeToCollabAction action) {
-            super(action);
-        }
-    }
     private final I18nTranslationService i18n;
     private final Session session;
     private final Provider<SocialNetworkServiceAsync> snServiceProvider;

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/DenyJoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/DenyJoinGroupAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/DenyJoinGroupAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -3,7 +3,6 @@
 import cc.kune.common.client.actions.AbstractExtendedAction;
 import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.common.client.noti.NotifyUser;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
@@ -18,16 +17,9 @@
 import com.google.inject.Provider;
 
 public class DenyJoinGroupAction extends AbstractExtendedAction {
-    public class DenyJoinGroupMenuItem extends MenuItemDescriptor {
-        @Inject
-        public DenyJoinGroupMenuItem(final DenyJoinGroupAction action) {
-            super(action);
-        }
-    }
     private final I18nTranslationService i18n;
     private final Session session;
     private final Provider<SocialNetworkServiceAsync> snServiceProvider;
-
     private final StateManager stateManager;
 
     @Inject

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/GotoGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/GotoGroupAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/GotoGroupAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -3,7 +3,6 @@
 import cc.kune.common.client.actions.AbstractExtendedAction;
 import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.state.StateManager;
 import cc.kune.core.shared.dto.GroupDTO;
@@ -12,12 +11,6 @@
 import com.google.inject.Inject;
 
 public class GotoGroupAction extends AbstractExtendedAction {
-    public class GotoGroupMenuItem extends MenuItemDescriptor {
-        @Inject
-        public GotoGroupMenuItem(final GotoGroupAction action) {
-            super(action);
-        }
-    }
 
     private final StateManager stateManager;
 

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/GotoMemberAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/GotoMemberAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/GotoMemberAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -1,35 +1,17 @@
 package cc.kune.core.client.sn.actions;
 
-import cc.kune.common.client.actions.AbstractExtendedAction;
-import cc.kune.common.client.actions.Action;
-import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.dto.GroupDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 
 import com.google.inject.Inject;
 
-public class GotoMemberAction extends AbstractExtendedAction {
-    public class GotoMemberMenuItem extends MenuItemDescriptor {
-        @Inject
-        public GotoMemberMenuItem(final GotoMemberAction action) {
-            super(action);
-        }
-    }
-    private final StateManager stateManager;
+public class GotoMemberAction extends GotoGroupAction {
 
     @Inject
     public GotoMemberAction(final StateManager stateManager, final I18nTranslationService i18n, final CoreResources res) {
-        this.stateManager = stateManager;
+        super(stateManager, i18n, res);
         putValue(NAME, i18n.t("Visit this member homepage"));
-        putValue(Action.SMALL_ICON, res.groupHome());
     }
 
-    @Override
-    public void actionPerformed(final ActionEvent event) {
-        stateManager.gotoToken(((GroupDTO) event.getSource()).getStateToken());
-    }
-
 }

Added: trunk/src/main/java/cc/kune/core/client/sn/actions/GotoPersonAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/GotoPersonAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/GotoPersonAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,17 @@
+package cc.kune.core.client.sn.actions;
+
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+
+public class GotoPersonAction extends GotoGroupAction {
+
+    @Inject
+    public GotoPersonAction(final StateManager stateManager, final I18nTranslationService i18n, final CoreResources res) {
+        super(stateManager, i18n, res);
+        putValue(NAME, i18n.t("Visit his/her homepage"));
+    }
+
+}


Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/GotoPersonAction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,58 @@
+package cc.kune.core.client.sn.actions;
+
+import cc.kune.common.client.actions.Action;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.noti.NotifyUser;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync;
+import cc.kune.core.client.state.AccessRightsClientManager;
+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.SocialNetworkRequestResult;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class JoinGroupAction extends RolAction {
+
+    @Inject
+    public JoinGroupAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n,
+            final CoreResources res, final Provider<SocialNetworkServiceAsync> snServiceProvider,
+            final AccessRightsClientManager rightsClientManager) {
+        super(stateManager, session, i18n, res, snServiceProvider, rightsClientManager, AccessRolDTO.Viewer, false,
+                true, false);
+        putValue(NAME, i18n.t("Participate"));
+        putValue(SHORT_DESCRIPTION, i18n.t("Request to participate in this group"));
+        putValue(Action.SMALL_ICON, res.addGreen());
+    }
+
+    @Override
+    public void actionPerformed(final ActionEvent event) {
+        NotifyUser.showProgressProcessing();
+        snServiceProvider.get().requestJoinGroup(session.getUserHash(), session.getCurrentState().getStateToken(),
+                new AsyncCallbackSimple<SocialNetworkRequestResult>() {
+                    @Override
+                    public void onSuccess(final SocialNetworkRequestResult result) {
+                        NotifyUser.hideProgress();
+                        switch ((result)) {
+                        case accepted:
+                            NotifyUser.info(i18n.t("You are now member of this group"));
+                            stateManager.reload();
+                            break;
+                        case denied:
+                            NotifyUser.important(i18n.t("Sorry this is a closed group"));
+                            break;
+                        case moderated:
+                            NotifyUser.info(i18n.t("Membership requested. Waiting for admins decision"));
+                            break;
+                        default:
+                            NotifyUser.info(i18n.t("Programatic error in ParticipateAction"));
+                        }
+                    }
+                });
+    }
+
+}
\ No newline at end of file


Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -3,7 +3,6 @@
 import cc.kune.common.client.actions.AbstractExtendedAction;
 import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.common.client.noti.NotifyUser;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
@@ -18,12 +17,6 @@
 import com.google.inject.Provider;
 
 public class RemoveMemberAction extends AbstractExtendedAction {
-    public class RemoveMemberMenuItem extends MenuItemDescriptor {
-        @Inject
-        public RemoveMemberMenuItem(final RemoveMemberAction action) {
-            super(action);
-        }
-    }
     private final I18nTranslationService i18n;
     private final Session session;
     private final Provider<SocialNetworkServiceAsync> snServiceProvider;

Added: trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,65 @@
+package cc.kune.core.client.sn.actions;
+
+
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync;
+import cc.kune.core.client.state.AccessRightsChangedEvent;
+import cc.kune.core.client.state.AccessRightsChangedEvent.AccessRightsChangedHandler;
+import cc.kune.core.client.state.AccessRightsClientManager;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.utils.AccessRights;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public abstract class RolAction extends AbstractExtendedAction {
+    protected final I18nTranslationService i18n;
+    protected final Session session;
+    protected final Provider<SocialNetworkServiceAsync> snServiceProvider;
+    protected final StateManager stateManager;
+
+    @Inject
+    public RolAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n,
+            final CoreResources res, final Provider<SocialNetworkServiceAsync> snServiceProvider,
+            final AccessRightsClientManager rightsManager, final AccessRolDTO rolRequired, final boolean authNeed,
+            final boolean visibleForNonMemb, final boolean visibleForMembers) {
+        this.stateManager = stateManager;
+        this.session = session;
+        this.i18n = i18n;
+        this.snServiceProvider = snServiceProvider;
+        rightsManager.onRightsChanged(new AccessRightsChangedHandler() {
+
+            @Override
+            public void onAccessRightsChanged(final AccessRightsChangedEvent event) {
+                refreshStatus(rolRequired, authNeed, session.isLogged(), visibleForMembers, visibleForNonMemb,
+                        event.getCurrentRights());
+
+            }
+        });
+    }
+
+    public void refreshStatus(final AccessRolDTO rolRequired, final boolean authNeed, final boolean isLogged,
+            final boolean visibleForMembers, final boolean visibleForNonMemb, final AccessRights newRights) {
+        boolean newVisibility = false;
+        boolean newEnabled = false;
+        if (authNeed && !isLogged) {
+            newVisibility = newEnabled = false;
+        } else {
+            // Auth ok
+            newEnabled = RolComparator.isEnabled(rolRequired, newRights);
+            if (newEnabled) {
+                final boolean isMember = RolComparator.isMember(newRights);
+                newEnabled = newVisibility = isMember && visibleForMembers || !isMember && visibleForNonMemb;
+            } else {
+                newVisibility = false;
+            }
+        }
+        setEnabled(newEnabled);
+        putValue(GuiActionDescrip.VISIBLE, newVisibility);
+    }
+}


Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: trunk/src/main/java/cc/kune/core/client/sn/actions/RolComparator.java (from rev 1243, trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolComparator.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/RolComparator.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/RolComparator.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,45 @@
+/*
+ *
+ * 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.core.client.sn.actions;
+
+import cc.kune.core.shared.domain.utils.AccessRights;
+import cc.kune.core.shared.dto.AccessRolDTO;
+
+public final class RolComparator {
+
+    public static boolean isEnabled(final AccessRolDTO rolRequired, final AccessRights rights) {
+        switch (rolRequired) {
+        case Administrator:
+            return rights.isAdministrable();
+        case Editor:
+            return rights.isEditable();
+        case Viewer:
+            return rights.isVisible();
+        }
+        return false;
+    }
+
+    public static boolean isMember(final AccessRights newRights) {
+        return newRights.isAdministrable() || newRights.isEditable();
+    }
+
+    private RolComparator() {
+    }
+}

Added: trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithMemberAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithMemberAction.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithMemberAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,40 @@
+package cc.kune.core.client.sn.actions;
+
+import cc.kune.chat.client.ChatClient;
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.Action;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.noti.NotifyUser;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class StartChatWithMemberAction extends AbstractExtendedAction {
+    private final Provider<ChatClient> chatClient;
+
+    private final I18nTranslationService i18n;
+
+    @Inject
+    public StartChatWithMemberAction(final I18nTranslationService i18n, final CoreResources res,
+            final Provider<ChatClient> chatClient) {
+        this.i18n = i18n;
+        this.chatClient = chatClient;
+        putValue(NAME, i18n.t("Start a chat with this member"));
+        putValue(Action.SMALL_ICON, res.newChat());
+    }
+
+    @Override
+    public void actionPerformed(final ActionEvent event) {
+        chatClient.get().show();
+        if (chatClient.get().isLoggedIn()) {
+            chatClient.get().chat(XmppURI.jid(((GroupDTO) event.getSource()).getShortName()));
+        } else {
+            NotifyUser.important(i18n.t("To start a chat you need to be 'online'"));
+        }
+    }
+
+}


Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithMemberAction.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithUserAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithUserAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/StartChatWithUserAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -1,47 +1,17 @@
 package cc.kune.core.client.sn.actions;
 
 import cc.kune.chat.client.ChatClient;
-import cc.kune.common.client.actions.AbstractExtendedAction;
-import cc.kune.common.client.actions.Action;
-import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
-import cc.kune.common.client.noti.NotifyUser;
 import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.shared.dto.GroupDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 
-import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
-public class StartChatWithUserAction extends AbstractExtendedAction {
-    public class StartChatWithUserMenuItem extends MenuItemDescriptor {
-        @Inject
-        public StartChatWithUserMenuItem(final StartChatWithUserAction action) {
-            super(action);
-        }
-    }
-    private final Provider<ChatClient> chatClient;
-
-    private final I18nTranslationService i18n;
-
+public class StartChatWithUserAction extends StartChatWithMemberAction {
     @Inject
     public StartChatWithUserAction(final I18nTranslationService i18n, final CoreResources res,
             final Provider<ChatClient> chatClient) {
-        this.i18n = i18n;
-        this.chatClient = chatClient;
-        putValue(NAME, i18n.t("Start a chat with this member"));
-        putValue(Action.SMALL_ICON, res.newChat());
+        super(i18n, res, chatClient);
+        putValue(NAME, i18n.t("Start a chat with this person"));
     }
-
-    @Override
-    public void actionPerformed(final ActionEvent event) {
-        chatClient.get().show();
-        if (chatClient.get().isLoggedIn()) {
-            chatClient.get().chat(XmppURI.jid(((GroupDTO) event.getSource()).getShortName()));
-        } else {
-            NotifyUser.important(i18n.t("To start a chat you need to be 'online'"));
-        }
-    }
-
 }

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinGroupAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinGroupAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -1,60 +1,55 @@
 package cc.kune.core.client.sn.actions;
 
-import cc.kune.common.client.actions.AbstractExtendedAction;
 import cc.kune.common.client.actions.Action;
 import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.common.client.noti.NotifyUser;
+import cc.kune.common.client.utils.OnAcceptCallback;
 import cc.kune.core.client.resources.CoreResources;
 import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
 import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync;
+import cc.kune.core.client.state.AccessRightsClientManager;
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.dto.AccessRolDTO;
 import cc.kune.core.shared.dto.SocialNetworkDataDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
-public class UnJoinGroupAction extends AbstractExtendedAction {
-    public class UnJoinGroupMenuItem extends MenuItemDescriptor {
-        @Inject
-        public UnJoinGroupMenuItem(final UnJoinGroupAction action) {
-            super(action);
-        }
-    }
-    private final I18nTranslationService i18n;
-    private final Session session;
-    private final Provider<SocialNetworkServiceAsync> snServiceProvider;
-    private final StateManager stateManager;
+public class UnJoinGroupAction extends RolAction {
 
     @Inject
     public UnJoinGroupAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n,
-            final CoreResources res, final Provider<SocialNetworkServiceAsync> snServiceProvider) {
-        this.stateManager = stateManager;
-        this.session = session;
-        this.i18n = i18n;
-        this.snServiceProvider = snServiceProvider;
-        putValue(NAME, i18n.t("Do not participate anymore in this group"));
+            final CoreResources res, final Provider<SocialNetworkServiceAsync> snServiceProvider,
+            final AccessRightsClientManager rightsClientManager) {
+        super(stateManager, session, i18n, res, snServiceProvider, rightsClientManager, AccessRolDTO.Editor, true,
+                false, true);
+        putValue(NAME, i18n.t("Leave this group"));
+        putValue(SHORT_DESCRIPTION, i18n.t("Do not participate anymore in this group"));
         putValue(Action.SMALL_ICON, res.del());
     }
 
     @Override
     public void actionPerformed(final ActionEvent event) {
-        NotifyUser.showProgressProcessing();
-        snServiceProvider.get().unJoinGroup(session.getUserHash(), ((GroupDTO) event.getSource()).getStateToken(),
-                new AsyncCallbackSimple<SocialNetworkDataDTO>() {
-                    @Override
-                    public void onSuccess(final SocialNetworkDataDTO result) {
-                        NotifyUser.hideProgress();
-                        NotifyUser.info(i18n.t("Removed as member"));
-                        stateManager.reload();
-                        // in the future with user info:
-                        // services.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
-                        // result);
-                    }
-                });
+        NotifyUser.askConfirmation(i18n.t("Leave this group"), i18n.t("Are you sure?"), new OnAcceptCallback() {
+            @Override
+            public void onSuccess() {
+                NotifyUser.showProgressProcessing();
+                snServiceProvider.get().unJoinGroup(session.getUserHash(), session.getCurrentState().getStateToken(),
+                        new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+                            @Override
+                            public void onSuccess(final SocialNetworkDataDTO result) {
+                                NotifyUser.hideProgress();
+                                NotifyUser.info(i18n.t("Removed as member"));
+                                stateManager.reload();
+                                // in the future with user info:
+                                // stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
+                                // result);
+                            }
+                        });
+            }
+        });
     }
 
 }
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -3,6 +3,7 @@
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
 import cc.kune.common.client.actions.ui.descrip.GuiAddCondition;
 import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.dto.StateContentDTO;
 
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
@@ -19,6 +20,9 @@
 
     @Override
     public boolean mustBeAdded(final GuiActionDescrip descr) {
+        if (session.getContainerState() instanceof StateContentDTO) {
+            // FIXME
+        }
         return (session.getContentState().getGroupRights().isAdministrable());
     }
 }

Added: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,11 @@
+package cc.kune.core.client.sn.actions.registry;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+
+public abstract class AbstractSNActionsRegistry extends GuiActionDescCollection { // NOPMD
+                                                                                  // by
+                                                                                  // vjrj
+                                                                                  // on
+                                                                                  // 10/02/11
+                                                                                  // 3:19
+}
\ No newline at end of file


Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNActionsRegistry.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java (from rev 1243, trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSocialNetworActionsRegistry.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,10 @@
+package cc.kune.core.client.sn.actions.registry;
+
+import java.util.ArrayList;
+
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+
+import com.google.inject.Provider;
+
+public abstract class AbstractSNMembersActionsRegistry extends ArrayList<Provider<MenuItemDescriptor>> { // NOPMD by vjrj on 10/02/11 3:19
+}
\ No newline at end of file


Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSNMembersActionsRegistry.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSocialNetworActionsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSocialNetworActionsRegistry.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/AbstractSocialNetworActionsRegistry.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -1,10 +0,0 @@
-package cc.kune.core.client.sn.actions.registry;
-
-import java.util.ArrayList;
-
-import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
-
-import com.google.inject.Provider;
-
-public abstract class AbstractSocialNetworActionsRegistry extends ArrayList<Provider<MenuItemDescriptor>> { // NOPMD by vjrj on 10/02/11 3:19
-}
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersActionsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersActionsRegistry.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersActionsRegistry.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,19 @@
+package cc.kune.core.client.sn.actions.registry;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.client.sn.actions.JoinGroupAction;
+import cc.kune.core.client.sn.actions.UnJoinGroupAction;
+
+import com.google.inject.Inject;
+
+public class GroupMembersActionsRegistry extends AbstractSNActionsRegistry {
+    @Inject
+    public GroupMembersActionsRegistry(final JoinGroupAction joinGroupAction, final UnJoinGroupAction unJoinGroupAction) {
+        final ButtonDescriptor join = new ButtonDescriptor(joinGroupAction);
+        final ButtonDescriptor unjoin = new ButtonDescriptor(unJoinGroupAction);
+        join.setStyles("k-no-backimage");
+        unjoin.setStyles("k-no-backimage");
+        add(join);
+        add(unjoin);
+    }
+}


Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersActionsRegistry.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNAdminsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNAdminsMenuItemsRegistry.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNAdminsMenuItemsRegistry.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -8,7 +8,7 @@
 import cc.kune.core.client.sn.actions.GotoGroupAction;
 import cc.kune.core.client.sn.actions.GotoMemberAction;
 import cc.kune.core.client.sn.actions.RemoveMemberAction;
-import cc.kune.core.client.sn.actions.StartChatWithUserAction;
+import cc.kune.core.client.sn.actions.StartChatWithMemberAction;
 import cc.kune.core.client.sn.actions.conditions.IsAdministrableCondition;
 import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
 import cc.kune.core.client.sn.actions.conditions.IsPersonCondition;
@@ -17,14 +17,14 @@
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
-public class SNAdminsMenuItemsRegistry extends AbstractSocialNetworActionsRegistry {
+public class SNAdminsMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
 
     @Inject
     public SNAdminsMenuItemsRegistry(final Session session, final IsAdministrableCondition isAdministrableCondition,
             final IsPersonCondition isPersonCondition, final IsGroupCondition isGroupCondition,
             final ChangeToCollabAction changeToCollabAction, final ChangeToAdminAction changeToAdminAction,
             final RemoveMemberAction removeMemberAction, final AcceptJoinGroupAction acceptJoinGroupAction,
-            final DenyJoinGroupAction denyJoinGroupAction, final StartChatWithUserAction startChatWithUserAction,
+            final DenyJoinGroupAction denyJoinGroupAction, final StartChatWithMemberAction startChatWithUserAction,
             final GotoGroupAction gotoGroupAction, final GotoMemberAction gotoMemberAction) {
         add(new Provider<MenuItemDescriptor>() {
             @Override

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNCollabsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNCollabsMenuItemsRegistry.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNCollabsMenuItemsRegistry.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -8,7 +8,7 @@
 import cc.kune.core.client.sn.actions.GotoGroupAction;
 import cc.kune.core.client.sn.actions.GotoMemberAction;
 import cc.kune.core.client.sn.actions.RemoveMemberAction;
-import cc.kune.core.client.sn.actions.StartChatWithUserAction;
+import cc.kune.core.client.sn.actions.StartChatWithMemberAction;
 import cc.kune.core.client.sn.actions.conditions.IsAdministrableCondition;
 import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
 import cc.kune.core.client.sn.actions.conditions.IsPersonCondition;
@@ -17,14 +17,14 @@
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
-public class SNCollabsMenuItemsRegistry extends AbstractSocialNetworActionsRegistry {
+public class SNCollabsMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
 
     @Inject
     public SNCollabsMenuItemsRegistry(final Session session, final IsAdministrableCondition isAdministrableCondition,
             final IsPersonCondition isPersonCondition, final IsGroupCondition isGroupCondition,
             final ChangeToCollabAction changeToCollabAction, final ChangeToAdminAction changeToAdminAction,
             final RemoveMemberAction removeMemberAction, final AcceptJoinGroupAction acceptJoinGroupAction,
-            final DenyJoinGroupAction denyJoinGroupAction, final StartChatWithUserAction startChatWithUserAction,
+            final DenyJoinGroupAction denyJoinGroupAction, final StartChatWithMemberAction startChatWithUserAction,
             final GotoGroupAction gotoGroupAction, final GotoMemberAction gotoMemberAction) {
         add(new Provider<MenuItemDescriptor>() {
             @Override

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNPendingsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNPendingsMenuItemsRegistry.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/SNPendingsMenuItemsRegistry.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -6,7 +6,7 @@
 import cc.kune.core.client.sn.actions.ChangeToCollabAction;
 import cc.kune.core.client.sn.actions.DenyJoinGroupAction;
 import cc.kune.core.client.sn.actions.GotoGroupAction;
-import cc.kune.core.client.sn.actions.GotoMemberAction;
+import cc.kune.core.client.sn.actions.GotoPersonAction;
 import cc.kune.core.client.sn.actions.RemoveMemberAction;
 import cc.kune.core.client.sn.actions.StartChatWithUserAction;
 import cc.kune.core.client.sn.actions.conditions.IsAdministrableCondition;
@@ -17,7 +17,7 @@
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
-public class SNPendingsMenuItemsRegistry extends AbstractSocialNetworActionsRegistry {
+public class SNPendingsMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
 
     @Inject
     public SNPendingsMenuItemsRegistry(final Session session, final IsAdministrableCondition isAdministrableCondition,
@@ -25,7 +25,7 @@
             final ChangeToCollabAction changeToCollabAction, final ChangeToAdminAction changeToAdminAction,
             final RemoveMemberAction removeMemberAction, final AcceptJoinGroupAction acceptJoinGroupAction,
             final DenyJoinGroupAction denyJoinGroupAction, final StartChatWithUserAction startChatWithUserAction,
-            final GotoGroupAction gotoGroupAction, final GotoMemberAction gotoMemberAction) {
+            final GotoGroupAction gotoGroupAction, final GotoPersonAction gotoPersonAction) {
         add(new Provider<MenuItemDescriptor>() {
             @Override
             public MenuItemDescriptor get() {
@@ -45,7 +45,7 @@
         add(new Provider<MenuItemDescriptor>() {
             @Override
             public MenuItemDescriptor get() {
-                final MenuItemDescriptor item = new MenuItemDescriptor(gotoMemberAction);
+                final MenuItemDescriptor item = new MenuItemDescriptor(gotoPersonAction);
                 item.setAddCondition(isPersonCondition);
                 return item;
             }

Added: trunk/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -0,0 +1,97 @@
+package cc.kune.core.client.state;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+
+import com.google.gwt.event.shared.HasHandlers;
+
+public class AccessRightsChangedEvent extends GwtEvent<AccessRightsChangedEvent.AccessRightsChangedHandler> { 
+
+  public interface HasAccessRightsChangedHandlers extends HasHandlers {
+    HandlerRegistration addAccessRightsChangedHandler(AccessRightsChangedHandler handler);
+  }
+
+  public interface AccessRightsChangedHandler extends EventHandler {
+    public void onAccessRightsChanged(AccessRightsChangedEvent event);
+  }
+
+  private static final Type<AccessRightsChangedHandler> TYPE = new Type<AccessRightsChangedHandler>();
+
+  public static void fire(HasHandlers source, cc.kune.core.shared.domain.utils.AccessRights previousRights, cc.kune.core.shared.domain.utils.AccessRights currentRights) {
+    source.fireEvent(new AccessRightsChangedEvent(previousRights, currentRights));
+  }
+
+  public static Type<AccessRightsChangedHandler> getType() {
+    return TYPE;
+  }
+
+  cc.kune.core.shared.domain.utils.AccessRights previousRights;
+  cc.kune.core.shared.domain.utils.AccessRights currentRights;
+
+  public AccessRightsChangedEvent(cc.kune.core.shared.domain.utils.AccessRights previousRights, cc.kune.core.shared.domain.utils.AccessRights currentRights) {
+    this.previousRights = previousRights;
+    this.currentRights = currentRights;
+  }
+
+  protected AccessRightsChangedEvent() {
+    // Possibly for serialization.
+  }
+
+  @Override
+  public Type<AccessRightsChangedHandler> getAssociatedType() {
+    return TYPE;
+  }
+
+  public cc.kune.core.shared.domain.utils.AccessRights getPreviousRights() {
+    return previousRights;
+  }
+
+  public cc.kune.core.shared.domain.utils.AccessRights getCurrentRights() {
+    return currentRights;
+  }
+
+  @Override
+  protected void dispatch(AccessRightsChangedHandler handler) {
+    handler.onAccessRightsChanged(this);
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (this == obj)
+        return true;
+    if (obj == null)
+        return false;
+    if (getClass() != obj.getClass())
+        return false;
+    AccessRightsChangedEvent other = (AccessRightsChangedEvent) obj;
+    if (previousRights == null) {
+      if (other.previousRights != null)
+        return false;
+    } else if (!previousRights.equals(other.previousRights))
+      return false;
+    if (currentRights == null) {
+      if (other.currentRights != null)
+        return false;
+    } else if (!currentRights.equals(other.currentRights))
+      return false;
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int hashCode = 23;
+    hashCode = (hashCode * 37) + (previousRights == null ? 1 : previousRights.hashCode());
+    hashCode = (hashCode * 37) + (currentRights == null ? 1 : currentRights.hashCode());
+    return hashCode;
+  }
+
+  @Override
+  public String toString() {
+    return "AccessRightsChangedEvent["
+                 + previousRights
+                 + ","
+                 + currentRights
+    + "]";
+  }
+}


Property changes on: trunk/src/main/java/cc/kune/core/client/state/AccessRightsChangedEvent.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/src/main/java/cc/kune/core/client/state/AccessRightsClientManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/AccessRightsClientManager.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/client/state/AccessRightsClientManager.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -19,31 +19,35 @@
  */
 package cc.kune.core.client.state;
 
+import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
 import cc.kune.core.shared.domain.utils.AccessRights;
 
-import com.calclab.suco.client.events.Listener2;
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
 
 public class AccessRightsClientManager {
-    private final AccessRights previousRights;
+    private final EventBus eventBus;
+    private AccessRights previousRights;
 
-    // private final Event2<AccessRights, AccessRights> onRightsChanged;
+    @Inject
+    public AccessRightsClientManager(final EventBus eventBus, final StateManager stateManager) {
+        this.eventBus = eventBus;
+        this.previousRights = null;
+        stateManager.onStateChanged(new StateChangedHandler() {
 
-    public AccessRightsClientManager(final StateManager stateManager) {
-        this.previousRights = null;
-        // this.onRightsChanged = new Event2<AccessRights , AccessRights
-        // >("onRightsChanged");
-        // stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
-        // public void onEvent(final StateAbstractDTO newState) {
-        // final AccessRights rights = newState.getGroupRights();
-        // if (!rights.equals(previousRights)) {
-        // onRightsChanged.fire(previousRights, rights);
-        // previousRights = rights;
-        // }
-        // }
-        // });
+            @Override
+            public void onStateChanged(final StateChangedEvent event) {
+                final AccessRights rights = event.getState().getGroupRights();
+                if (!rights.equals(previousRights)) {
+                    AccessRightsChangedEvent.fire(eventBus, previousRights, rights);
+                    previousRights = rights;
+                }
+
+            }
+        });
     }
 
-    public void onRightsChanged(final Listener2<AccessRights, AccessRights> listener) {
-        // onRightsChanged.add(listener);
+    public void onRightsChanged(final AccessRightsChangedEvent.AccessRightsChangedHandler handler) {
+        eventBus.addHandler(AccessRightsChangedEvent.getType(), handler);
     }
 }

Added: trunk/src/main/java/cc/kune/core/public/images/unknown.jpg
===================================================================
(Binary files differ)


Property changes on: trunk/src/main/java/cc/kune/core/public/images/unknown.jpg
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/core/public/ws.css	2011-02-10 18:28:58 UTC (rev 1244)
@@ -775,12 +775,56 @@
     color: #FFF;
     text-transform: lowercase;
     padding-left: 10px;
+    float: left;
 }
 
+.k-sn-adminsCountlabel,.k-sn-collabsCountlabel,.k-sn-pendingsCountlabel {
+  float: left;
+  padding-left: 5px;
+  color: #e0e0e0;
+}
+
 .k-sn-adminslabel {
 
 }
 
+.k-sn-mainpanel .k-basic-thumb {
+    float: left;
+}
+
+/*
+.k-sn-mainpanel .x-btn button {
+    text-decoration: underline;
+    white-space: nowrap;
+}
+*/
+.k-sn-mainpanel .x-btn button {
+    cursor: pointer;
+    font: 13px 'Ubuntu', arial;
+    padding: 2px;
+    -webkit-border-radius: 6px;
+    -moz-border-radius: 6px;
+    border-radius: 6px;
+    text-decoration: none;
+    vertical-align: middle;
+    background-color: #F2F2F2;
+    border: 2px gray solid;
+    height: 26px !important;
+    line-height: 2em !important;
+    padding-left: 25px !important;
+}
+
+.k-sn-mainpanel .x-btn button:hover {
+    border: 2px orange solid;
+    background: #f0f0f0;
+    color: #855585;
+}
+
+.k-sn-mainpanel .x-btn button:active {
+    border-top-color: #ffffff;
+    background: #ffffff;
+}
+
 .k-sn-collabslabel {
 
 }
@@ -789,6 +833,14 @@
 
 }
 
+.k-sn-orphan-label {
+    padding: 10px;
+}
+
+.k-sn-novisible-label {
+    padding: 10px;
+}
+
 .k-sn-adminspanel {
     background-color: #a05a2c;
 }
@@ -798,13 +850,17 @@
 }
 
 .k-sn-pendingspanel {
-
+    /* background-color: #a05a2c; */
 }
 
 .k-sn-adminsscroll,.k-sn-collabsscroll,.k-sn-pendingsscroll {
-    padding-left: 10px;
+
 }
 
+.k-sn-adminsflow,.k-sn-collabsflow,.k-sn-pendingsflow {
+    margin-left: 10px;
+}
+
 .k-sn-adminsscroll {
 
 }
@@ -814,7 +870,7 @@
 }
 
 .k-sn-pendingsscroll {
-    margin: 5px;
+
 }
 
 .k-userconfirm-label {
@@ -823,9 +879,18 @@
 }
 
 .k-sn-deck {
-    padding: 5px;
+
 }
 
+.k-sn-bottomPanel {
+    padding: 0 10px;
+    float: right;
+}
+
+.k-sn-bottomPanel-actions {
+    width: 100%;
+}
+
 .k-sn-novisible-label,.k-sn-orphan-label {
     color: #FFF;
     font-size: 16px;

Modified: trunk/src/main/java/cc/kune/gspace/client/WsArmorImpl.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/WsArmorImpl.ui.xml	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/cc/kune/gspace/client/WsArmorImpl.ui.xml	2011-02-10 18:28:58 UTC (rev 1244)
@@ -5,8 +5,8 @@
     type='cc.kune.gspace.client.resources.WsArmorResources' />
   <ui:style>
     .frame {
-    	border: 0px;
-    	margin: 0px;
+      border: 0px;
+      margin: 0px;
     }
   </ui:style>
   <g:DockLayoutPanel ui:field="mainpanel" styleName='{res.style.mainPanel}'
@@ -86,7 +86,7 @@
             <g:east size="200.0">
               <g:DockLayoutPanel unit="PX"
                 styleName="{res.style.entityTools}" ui:field="splitEast">
-                <g:north size="190">
+                <g:north size="305">
                   <g:VerticalPanel width="100%"
                     ui:field="entityToolsNorth" styleName="{res.style.entityToolsNorth}"></g:VerticalPanel>
                 </g:north>

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -461,7 +461,7 @@
         register(Singleton.class, new Factory<AccessRightsClientManager>(AccessRightsClientManager.class) {
             @Override
             public AccessRightsClientManager create() {
-                return new AccessRightsClientManager(i(StateManager.class));
+                return null; // new AccessRightsClientManager(i(StateManager.class));
             }
         });
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolAction.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolAction.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -22,6 +22,7 @@
 import org.ourproject.kune.platf.client.actions.AbstractExtendedAction;
 import org.ourproject.kune.platf.client.actions.ui.OldGuiActionDescrip;
 
+import cc.kune.core.client.sn.actions.RolComparator;
 import cc.kune.core.client.state.AccessRightsClientManager;
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.StateManager;
@@ -29,7 +30,6 @@
 import cc.kune.core.shared.dto.AccessRolDTO;
 import cc.kune.core.shared.i18n.I18nTranslationService;
 
-import com.calclab.suco.client.events.Listener2;
 import com.google.gwt.resources.client.ImageResource;
 
 public abstract class RolAction extends AbstractExtendedAction {
@@ -54,12 +54,12 @@
         return new UIStatus(newVisibility, newEnabled);
     }
 
+    private boolean authNeed;
+    protected final I18nTranslationService i18n;
     protected final Session session;
     protected final StateManager stateManager;
-    protected final I18nTranslationService i18n;
+    private boolean visibleForMembers;
     private boolean visibleForNonMemb;
-    private boolean visibleForMembers;
-    private boolean authNeed;
 
     public RolAction(final Session session, final StateManager stateManager,
             final AccessRightsClientManager rightsManager, final I18nTranslationService i18n,
@@ -71,26 +71,29 @@
         this.visibleForMembers = true;
         this.visibleForNonMemb = true;
         this.authNeed = false;
-        rightsManager.onRightsChanged(new Listener2<AccessRights, AccessRights>() {
-            public void onEvent(final AccessRights prevRights, final AccessRights newRights) {
-                setStatus(refreshStatus(rolRequired, authNeed, session.isLogged(), visibleForMembers,
-                        visibleForNonMemb, newRights));
-            }
-
-        });
+        // rightsManager.onRightsChanged(new Listener2<AccessRights,
+        // AccessRights>() {
+        // public void onEvent(final AccessRights prevRights, final AccessRights
+        // newRights) {
+        // setStatus(refreshStatus(rolRequired, authNeed, session.isLogged(),
+        // visibleForMembers,
+        // visibleForNonMemb, newRights));
+        // }
+        //
+        // });
     }
 
     public void setMustBeAuthenticated(final boolean authNeed) {
         this.authNeed = authNeed;
     }
 
+    private void setStatus(final UIStatus refreshStatus) {
+        setEnabled(refreshStatus.isEnabled());
+        putValue(OldGuiActionDescrip.VISIBLE, refreshStatus.isVisible());
+    }
+
     public void setVisible(final boolean forMembers, final boolean forNonMembers) {
         this.visibleForMembers = forMembers;
         this.visibleForNonMemb = forNonMembers;
     }
-
-    private void setStatus(final UIStatus refreshStatus) {
-        setEnabled(refreshStatus.isEnabled());
-        putValue(OldGuiActionDescrip.VISIBLE, refreshStatus.isVisible());
-    }
 }

Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolComparator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolComparator.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/oldsn/RolComparator.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -1,45 +0,0 @@
-/*
- *
- * 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 org.ourproject.kune.workspace.client.oldsn;
-
-import cc.kune.core.shared.domain.utils.AccessRights;
-import cc.kune.core.shared.dto.AccessRolDTO;
-
-public final class RolComparator {
-
-    public static boolean isEnabled(final AccessRolDTO rolRequired, final AccessRights rights) {
-        switch (rolRequired) {
-        case Administrator:
-            return rights.isAdministrable();
-        case Editor:
-            return rights.isEditable();
-        case Viewer:
-            return rights.isVisible();
-        }
-        return false;
-    }
-
-    public static boolean isMember(final AccessRights newRights) {
-        return newRights.isAdministrable() || newRights.isEditable();
-    }
-
-    private RolComparator() {
-    }
-}

Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolComparatorTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolComparatorTest.java	2011-02-10 03:07:28 UTC (rev 1243)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolComparatorTest.java	2011-02-10 18:28:58 UTC (rev 1244)
@@ -23,8 +23,8 @@
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
-import org.ourproject.kune.workspace.client.oldsn.RolComparator;
 
+import cc.kune.core.client.sn.actions.RolComparator;
 import cc.kune.core.shared.domain.utils.AccessRights;
 import cc.kune.core.shared.dto.AccessRolDTO;
 




More information about the kune-commits mailing list