[kune-commits] r1417 - in trunk: . src/main/java/cc/kune/chat/client src/main/java/cc/kune/chat/client/actions src/main/java/cc/kune/common/client/actions/gwtui src/main/java/cc/kune/common/client/actions/ui/descrip src/main/java/cc/kune/core/client/actions src/main/java/cc/kune/core/client/sn src/main/java/cc/kune/core/client/sn/actions/registry src/main/java/cc/kune/gspace/client/actions src/main/java/cc/kune/gspace/client/viewers src/main/webapp/others

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Sat Jun 25 01:04:18 CEST 2011


Author: vjrj_
Date: 2011-06-25 01:04:18 +0200 (Sat, 25 Jun 2011)
New Revision: 1417

Added:
   trunk/src/main/java/cc/kune/chat/client/actions/StartAssemblyWithMembers.java
Modified:
   trunk/TODO
   trunk/src/main/java/cc/kune/chat/client/ChatParts.java
   trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java
   trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
   trunk/src/main/java/cc/kune/chat/client/actions/OpenRoomBtn.java
   trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuGui.java
   trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/SubMenuDescriptor.java
   trunk/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java
   trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java
   trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java
   trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java
   trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
   trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
   trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java
   trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java
   trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java
   trunk/src/main/java/cc/kune/gspace/client/actions/NewMenuProvider.java
   trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
   trunk/src/main/webapp/others/kune-wave-extensions.xml
Log:
Gadgets hierarchy. Chat new actions (Assembly in chatroom, add as buddie menuitem)

Modified: trunk/TODO
===================================================================
--- trunk/TODO	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/TODO	2011-06-24 23:04:18 UTC (rev 1417)
@@ -371,6 +371,8 @@
 ** vjrj <v> IconHyperlink.java and IconLabel.java to gwt1.5
    
 * MID-TERM
+** Menubar submenus problem
+https://groups.google.com/group/google-web-toolkit/browse_thread/thread/aa887d470ed609c/c76d622622e39a56?lnk=gst&q=menubar+left+#c76d622622e39a56
 ** Template system for new waves with legal free/open procedures
 New
  Templates

Modified: trunk/src/main/java/cc/kune/chat/client/ChatParts.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatParts.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/chat/client/ChatParts.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -20,16 +20,22 @@
 package cc.kune.chat.client;
 
 import cc.kune.chat.client.actions.AddAsBuddieHeaderButton;
+import cc.kune.chat.client.actions.AddAsBuddieHeaderButton.AddAsBuddieAction;
 import cc.kune.chat.client.actions.ChatClientActions;
 import cc.kune.chat.client.actions.ChatSitebarActions;
 import cc.kune.chat.client.actions.OpenGroupPublicChatRoomAction;
+import cc.kune.chat.client.actions.StartAssemblyWithMembers;
 import cc.kune.chat.client.actions.StartChatWithMemberAction;
 import cc.kune.chat.client.actions.StartChatWithThisBuddieAction;
 import cc.kune.chat.client.actions.StartChatWithUserAction;
 import cc.kune.chat.shared.ChatConstants;
+import cc.kune.common.client.actions.AbstractAction;
+import cc.kune.common.client.actions.PropertyChangeEvent;
+import cc.kune.common.client.actions.PropertyChangeListener;
 import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
 import cc.kune.core.client.init.AppStartEvent;
 import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
+import cc.kune.core.client.sn.GroupSNPresenter;
 import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAGroupCondition;
 import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAdministrableCondition;
 import cc.kune.core.client.sn.actions.conditions.IsCurrentStateEditableCondition;
@@ -58,15 +64,16 @@
       final Provider<GroupSNAdminsMenuItemsRegistry> snAdminsRegistry,
       final Provider<GroupSNCollabsMenuItemsRegistry> snCollabsItemsRegistry,
       final Provider<GroupSNPendingsMenuItemsRegistry> snPendingItemsRegistry,
-      final Provider<GroupSNConfActions> groupConfActions,
+      final Provider<GroupSNConfActions> groupConfActions, final Provider<GroupSNPresenter> groupSN,
       final Provider<UserSNMenuItemsRegistry> userItemsRegistry, final IsNotMeCondition isNotMe,
       final IsCurrentStateAdministrableCondition isAdministrableCondition,
       final IsCurrentStateEditableCondition isEditableCondition,
       final IsCurrentStateAGroupCondition isGroupCondition, final IsPersonCondition isPersonCondition,
+      final Provider<AddAsBuddieAction> addAsBuddie,
       final Provider<StartChatWithMemberAction> startChatWithMemberAction,
       final IsLoggedCondition isLogged, final Provider<StartChatWithUserAction> startChatWithUserAction,
       final Provider<StartChatWithThisBuddieAction> startChatWithBuddieAction,
-      final ChatClientActions chatActions,
+      final ChatClientActions chatActions, final Provider<StartAssemblyWithMembers> startAssembly,
       final Provider<OpenGroupPublicChatRoomAction> openGroupRoomAction,
       // final Provider<OpenGroupPublicChatRoomButton> openGroupRoom,
       final ContentViewerSelector viewerSelector, final FolderViewerPresenter folderViewer) {
@@ -96,35 +103,47 @@
             return item;
           }
         };
-        final Provider<MenuItemDescriptor> startChatWithUserItem = new Provider<MenuItemDescriptor>() {
+        final Provider<MenuItemDescriptor> addAsBuddieItem = new Provider<MenuItemDescriptor>() {
           @Override
           public MenuItemDescriptor get() {
-            final MenuItemDescriptor item = new MenuItemDescriptor(startChatWithUserAction.get());
+            final AddAsBuddieAction action = addAsBuddie.get();
+            final MenuItemDescriptor item = new MenuItemDescriptor(action);
             item.add(isNotMe);
             item.add(isLogged);
             item.add(isPersonCondition);
+            /**
+             * FIXME Buggy & duplicate code with {@link AddAsBuddieHeaderButton}
+             */
+            action.addPropertyChangeListener(new PropertyChangeListener() {
+              @Override
+              public void propertyChange(final PropertyChangeEvent event) {
+                if (event.getPropertyName().equals(AbstractAction.ENABLED)) {
+                  item.setVisible((Boolean) event.getNewValue());
+                }
+              }
+            });
             return item;
           }
         };
-        final Provider<MenuItemDescriptor> openChatAndInvite = new Provider<MenuItemDescriptor>() {
+        final Provider<MenuItemDescriptor> startChatWithUserItem = new Provider<MenuItemDescriptor>() {
           @Override
           public MenuItemDescriptor get() {
-            final OpenGroupPublicChatRoomAction action = openGroupRoomAction.get();
-            action.setInviteMembers(true);
-            final MenuItemDescriptor item = new MenuItemDescriptor(action);
-            item.withText(i18n.t("Open group's room with members")).withToolTip(
-                i18n.t("Enter to this group public chat room and invite members"));
-            item.setParent(GroupSNConfActions.OPTIONS_MENU);
-            item.setPosition(0);
+            final MenuItemDescriptor item = new MenuItemDescriptor(startChatWithUserAction.get());
+            item.add(isNotMe);
+            item.add(isLogged);
+            item.add(isPersonCondition);
             return item;
           }
         };
+
         snAdminsRegistry.get().add(startChatWithMemberItem);
         snCollabsItemsRegistry.get().add(startChatWithMemberItem);
         snPendingItemsRegistry.get().add(startChatWithUserItem);
         userItemsRegistry.get().add(startChatWithBuddieItem);
-        groupConfActions.get().add(openChatAndInvite.get());
+        userItemsRegistry.get().add(addAsBuddieItem);
+        groupConfActions.get().add(startAssembly.get());
         buddieButton.get();
+        groupSN.get().refreshActions();
         // openGroupRoom.get();
       }
     });

Modified: trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -91,7 +91,7 @@
   public NewRoomBtn(final I18nTranslationService i18n, final NewRoomAction action, final NavResources res) {
     super(action);
     this.withText(i18n.t("New room")).withToolTip(i18n.t("Create a new chat room")).withStyles(
-        "k-def-docbtn, k-fr").withIcon(res.roomAdd());
+        "k-def-docbtn, k-fl").withIcon(res.roomAdd());
   }
 
 }

Modified: trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -48,93 +48,96 @@
 
 public class OpenGroupPublicChatRoomAction extends RolActionAutoUpdated {
 
-    private final ChatClient chatClient;
-    private final I18nTranslationService i18n;
-    private boolean inviteMembers;
-    private final RoomManager roomManager;
-    private final Session session;
+  private final ChatClient chatClient;
+  private final I18nTranslationService i18n;
+  private boolean inviteMembers;
+  private final RoomManager roomManager;
+  private final Session session;
 
-    @SuppressWarnings("deprecation")
-    @Inject
-    public OpenGroupPublicChatRoomAction(final Session session,
-            final AccessRightsClientManager accessRightsClientManager, final ChatClient chatClient,
-            final StateManager stateManager, final I18nTranslationService i18n, final ChatResources res) {
-        super(stateManager, session, accessRightsClientManager, AccessRolDTO.Editor, true, false, true);
-        this.session = session;
-        this.chatClient = chatClient;
-        this.i18n = i18n;
-        roomManager = Suco.get(RoomManager.class);
-        stateManager.onStateChanged(true, new StateChangedHandler() {
-            @Override
-            public void onStateChanged(final StateChangedEvent event) {
-                setState(session.getCurrentState());
-            }
-        });
-        putValue(Action.NAME, i18n.t("Group's public room"));
-        putValue(Action.SHORT_DESCRIPTION, i18n.t("Enter to this group public chat room"));
-        putValue(Action.SMALL_ICON, res.groupChat());
-        setInviteMembersImpl(false);
-    }
+  @SuppressWarnings("deprecation")
+  @Inject
+  public OpenGroupPublicChatRoomAction(final Session session,
+      final AccessRightsClientManager accessRightsClientManager, final ChatClient chatClient,
+      final StateManager stateManager, final I18nTranslationService i18n, final ChatResources res) {
+    super(stateManager, session, accessRightsClientManager, AccessRolDTO.Editor, true, false, true);
+    this.session = session;
+    this.chatClient = chatClient;
+    this.i18n = i18n;
+    roomManager = Suco.get(RoomManager.class);
+    stateManager.onStateChanged(true, new StateChangedHandler() {
+      @Override
+      public void onStateChanged(final StateChangedEvent event) {
+        // setState(session.getCurrentState());
+      }
+    });
+    putValue(Action.NAME, i18n.t("Group's public room"));
+    putValue(Action.SHORT_DESCRIPTION, i18n.t("Enter to this group public chat room"));
+    putValue(Action.SMALL_ICON, res.groupChat());
+    setInviteMembersImpl(false);
+  }
 
-    @Override
-    public void actionPerformed(final ActionEvent event) {
-        final String currentGroupName = session.getCurrentGroupShortName();
-        final Room room = chatClient.joinRoom(currentGroupName, session.getCurrentUser().getShortName());
-        inviteMembers(room);
-        chatClient.show();
-    }
+  @Override
+  public void actionPerformed(final ActionEvent event) {
+    final String currentGroupName = session.getCurrentGroupShortName();
+    final Room room = chatClient.joinRoom(currentGroupName, session.getCurrentUser().getShortName());
+    inviteMembers(room);
+    chatClient.show();
+  }
 
-    private void addGroup(final List<XmppURI> membersUris, final GroupDTO member) {
-        membersUris.add(chatClient.uriFrom(member.getShortName()));
-    }
+  private void addGroup(final List<XmppURI> membersUris, final GroupDTO member) {
+    membersUris.add(chatClient.uriFrom(member.getShortName()));
+  }
 
-    private boolean currentGroupsIsAsPerson(final StateAbstractDTO state) {
-        return state.getGroup().isPersonal();
-    }
+  private boolean currentGroupsIsAsPerson(final StateAbstractDTO state) {
+    return state.getGroup().isPersonal();
+  }
 
-    private void inviteMembers(final Room room) {
-        if (inviteMembers) {
-            room.addChatStateChangedHandler(true, new com.calclab.emite.core.client.events.StateChangedHandler() {
-                @Override
-                public void onStateChanged(final com.calclab.emite.core.client.events.StateChangedEvent event) {
-                    if (event.getState().equals(ChatStates.ready)) {
-                        // When ready we invite to the rest of members
-                        final SocialNetworkDTO groupMembers = session.getCurrentState().getGroupMembers();
-                        final List<XmppURI> membersUris = new ArrayList<XmppURI>();
-                        for (final GroupDTO member : groupMembers.getAccessLists().getAdmins().getList()) {
-                            addGroup(membersUris, member);
-                        }
-                        for (final GroupDTO member : groupMembers.getAccessLists().getEditors().getList()) {
-                            addGroup(membersUris, member);
-                        }
-                        for (final Occupant occupant : room.getOccupants()) {
-                            // Remove all member that are in the room
-                            membersUris.remove(occupant.getJID());
-                        }
-                        for (final XmppURI memberNotPresent : membersUris) {
-                            room.sendInvitationTo(memberNotPresent,
-                                    i18n.t("Join us in [%s] public room!", room.getURI().getNode()));
-                        }
-                    }
+  private void inviteMembers(final Room room) {
+    if (inviteMembers) {
+      room.addChatStateChangedHandler(true,
+          new com.calclab.emite.core.client.events.StateChangedHandler() {
+            @Override
+            public void onStateChanged(final com.calclab.emite.core.client.events.StateChangedEvent event) {
+              if (event.getState().equals(ChatStates.ready)) {
+                // When ready we invite to the rest of members
+                final SocialNetworkDTO groupMembers = session.getCurrentState().getGroupMembers();
+                final List<XmppURI> membersUris = new ArrayList<XmppURI>();
+                for (final GroupDTO member : groupMembers.getAccessLists().getAdmins().getList()) {
+                  addGroup(membersUris, member);
                 }
-            });
-        }
+                for (final GroupDTO member : groupMembers.getAccessLists().getEditors().getList()) {
+                  addGroup(membersUris, member);
+                }
+                for (final Occupant occupant : room.getOccupants()) {
+                  // Remove all member that are in the room
+                  membersUris.remove(occupant.getJID());
+                }
+                for (final XmppURI memberNotPresent : membersUris) {
+                  room.sendInvitationTo(memberNotPresent,
+                      i18n.t("Join us in [%s] public room!", room.getURI().getNode()));
+                }
+              }
+            }
+          });
     }
+  }
 
-    public void setInviteMembers(final boolean inviteMembers) {
-        setInviteMembersImpl(inviteMembers);
-    }
+  public void setInviteMembers(final boolean inviteMembers) {
+    setInviteMembersImpl(inviteMembers);
+  }
 
-    private void setInviteMembersImpl(final boolean inviteMembers) {
-        this.inviteMembers = inviteMembers;
-    }
+  private void setInviteMembersImpl(final boolean inviteMembers) {
+    this.inviteMembers = inviteMembers;
+  }
 
-    private void setState(final StateAbstractDTO state) {
-        final boolean imLogged = session.isLogged();
-        if (imLogged && !currentGroupsIsAsPerson(state)) {
-            setEnabled(true);
-        } else {
-            setEnabled(false);
-        }
+  private void setState(final StateAbstractDTO state) {
+    final boolean imLogged = session.isLogged();
+    if (imLogged && !currentGroupsIsAsPerson(state)) {
+      setEnabled(false);
+      setEnabled(true);
+    } else {
+      setEnabled(true);
+      setEnabled(false);
     }
+  }
 }
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/chat/client/actions/OpenRoomBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/OpenRoomBtn.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/chat/client/actions/OpenRoomBtn.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -12,6 +12,6 @@
   public OpenRoomBtn(final I18nTranslationService i18n, final OpenChatAction action,
       final NavResources res) {
     super(action);
-    this.withText(i18n.t("Enter to this room")).withIcon(res.room()).withStyles("k-def-docbtn, k-fr");
+    this.withText(i18n.t("Enter to this room")).withIcon(res.room()).withStyles("k-def-docbtn, k-fl");
   }
 }
\ No newline at end of file

Added: trunk/src/main/java/cc/kune/chat/client/actions/StartAssemblyWithMembers.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/StartAssemblyWithMembers.java	                        (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/actions/StartAssemblyWithMembers.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -0,0 +1,21 @@
+package cc.kune.chat.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.core.client.sn.actions.registry.GroupSNConfActions;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+
+public class StartAssemblyWithMembers extends MenuItemDescriptor {
+
+  @Inject
+  public StartAssemblyWithMembers(final OpenGroupPublicChatRoomAction action,
+      final I18nTranslationService i18n) {
+    super(action);
+    action.setInviteMembers(true);
+    withText(i18n.t("Start a public assembly with members")).withToolTip(
+        i18n.t("Enter to this group public chat room and invite members"));
+    setParent(GroupSNConfActions.OPTIONS_MENU);
+    setPosition(0);
+  }
+}


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

Modified: trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuGui.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuGui.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/common/client/actions/gwtui/AbstractGwtMenuGui.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -40,112 +40,112 @@
 
 public abstract class AbstractGwtMenuGui extends AbstractChildGuiItem implements ParentWidget {
 
-    protected MenuBar menu;
-    private PopupPanel popup;
+  protected MenuBar menu;
+  private PopupPanel popup;
 
-    public AbstractGwtMenuGui() {
-    }
+  public AbstractGwtMenuGui() {
+  }
 
-    public AbstractGwtMenuGui(final GuiActionDescrip descriptor) {
-        super(descriptor);
-    }
+  public AbstractGwtMenuGui(final GuiActionDescrip descriptor) {
+    super(descriptor);
+  }
 
-    @Override
-    public void add(final UIObject item) {
-        menu.addItem((MenuItem) item);
-    }
+  @Override
+  public void add(final UIObject item) {
+    menu.addItem((MenuItem) item);
+  }
 
-    public void addSeparator() {
-        menu.addSeparator();
-    }
+  public void addSeparator() {
+    menu.addSeparator();
+  }
 
-    @Override
-    public void configureItemFromProperties() {
-        super.configureItemFromProperties();
-        descriptor.addPropertyChangeListener(new PropertyChangeListener() {
-            @Override
-            public void propertyChange(final PropertyChangeEvent event) {
-                if (event.getPropertyName().equals(MenuDescriptor.MENU_CLEAR)) {
-                    menu.clearItems();
-                }
-            }
-        });
-    }
+  @Override
+  public void configureItemFromProperties() {
+    super.configureItemFromProperties();
+    descriptor.addPropertyChangeListener(new PropertyChangeListener() {
+      @Override
+      public void propertyChange(final PropertyChangeEvent event) {
+        if (event.getPropertyName().equals(MenuDescriptor.MENU_CLEAR)) {
+          menu.clearItems();
+        }
+      }
+    });
+  }
 
-    @Override
-    public AbstractGuiItem create(final GuiActionDescrip descriptor) {
-        super.create(descriptor);
-        menu = new MenuBar(true, SubMenuResources.INSTANCE);
-        menu.setAutoOpen(true);
-        menu.setFocusOnHoverEnabled(true);
-        menu.setAnimationEnabled(true);
-        descriptor.addPropertyChangeListener(new PropertyChangeListener() {
-            @Override
-            public void propertyChange(final PropertyChangeEvent event) {
-                if (event.getPropertyName().equals(MenuDescriptor.MENU_HIDE)) {
-                    if (popup != null && popup.isShowing()) {
-                        popup.hide();
-                    }
-                }
-            }
-        });
-        descriptor.addPropertyChangeListener(new PropertyChangeListener() {
-            @Override
-            public void propertyChange(final PropertyChangeEvent event) {
-                if (event.getPropertyName().equals(MenuDescriptor.MENU_SHOW)) {
-                    show(descriptor.getValue(MenuDescriptor.MENU_SHOW_NEAR_TO));
-                }
-            }
-        });
-        return this;
-    }
-
-    private PopupPanel createPopup() {
-        popup = new PopupPanel(true);
-        popup.setStyleName("oc-menu");
-        popup.add(menu);
-        popup.addCloseHandler(new CloseHandler<PopupPanel>() {
-            @Override
-            public void onClose(final CloseEvent<PopupPanel> event) {
-                descriptor.putValue(MenuDescriptor.MENU_ONHIDE, popup);
-            }
-        });
-        return popup;
-    }
-
-    public void hide() {
-        if (popup != null) {
-            // if menu (not submenu)
+  @Override
+  public AbstractGuiItem create(final GuiActionDescrip descriptor) {
+    super.create(descriptor);
+    menu = new MenuBar(true, SubMenuResources.INSTANCE);
+    menu.setAutoOpen(true);
+    menu.setFocusOnHoverEnabled(true);
+    menu.setAnimationEnabled(true);
+    descriptor.addPropertyChangeListener(new PropertyChangeListener() {
+      @Override
+      public void propertyChange(final PropertyChangeEvent event) {
+        if (event.getPropertyName().equals(MenuDescriptor.MENU_HIDE)) {
+          if (popup != null && popup.isShowing()) {
             popup.hide();
+          }
         }
-    }
+      }
+    });
+    descriptor.addPropertyChangeListener(new PropertyChangeListener() {
+      @Override
+      public void propertyChange(final PropertyChangeEvent event) {
+        if (event.getPropertyName().equals(MenuDescriptor.MENU_SHOW)) {
+          show(descriptor.getValue(MenuDescriptor.MENU_SHOW_NEAR_TO));
+        }
+      }
+    });
+    return this;
+  }
 
-    @Override
-    public void insert(final int position, final UIObject item) {
-        menu.insertItem((MenuItem) item, position);
-    }
+  private PopupPanel createPopup() {
+    popup = new PopupPanel(true);
+    popup.setStyleName("oc-menu");
+    popup.add(menu);
+    popup.addCloseHandler(new CloseHandler<PopupPanel>() {
+      @Override
+      public void onClose(final CloseEvent<PopupPanel> event) {
+        descriptor.putValue(MenuDescriptor.MENU_ONHIDE, popup);
+      }
+    });
+    return popup;
+  }
 
-    @Override
-    public boolean shouldBeAdded() {
-        return !descriptor.isChild();
+  public void hide() {
+    if (popup != null) {
+      // if menu (not submenu)
+      popup.hide();
     }
+  }
 
-    public void show(final Object relative) {
-        createPopup();
-        if (relative instanceof String) {
-            popup.showRelativeTo(RootPanel.get((String) relative));
-        } else if (relative instanceof UIObject) {
-            popup.showRelativeTo((UIObject) relative);
-        } else if (relative instanceof Position) {
-            popup.setPopupPositionAndShow(new PositionCallback() {
-                @Override
-                public void setPosition(final int offsetWidth, final int offsetHeight) {
-                    final Position position = (Position) relative;
-                    popup.setPopupPosition(position.getX(), position.getY());
-                }
-            });
+  @Override
+  public void insert(final int position, final UIObject item) {
+    menu.insertItem((MenuItem) item, position);
+  }
+
+  @Override
+  public boolean shouldBeAdded() {
+    return !descriptor.isChild();
+  }
+
+  public void show(final Object relative) {
+    createPopup();
+    if (relative instanceof String) {
+      popup.showRelativeTo(RootPanel.get((String) relative));
+    } else if (relative instanceof UIObject) {
+      popup.showRelativeTo((UIObject) relative);
+    } else if (relative instanceof Position) {
+      popup.setPopupPositionAndShow(new PositionCallback() {
+        @Override
+        public void setPosition(final int offsetWidth, final int offsetHeight) {
+          final Position position = (Position) relative;
+          popup.setPopupPosition(position.getX(), position.getY());
         }
-        descriptor.putValue(MenuDescriptor.MENU_ONSHOW, popup);
+      });
     }
+    descriptor.putValue(MenuDescriptor.MENU_ONSHOW, popup);
+  }
 
 }
\ No newline at end of file

Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/SubMenuDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/SubMenuDescriptor.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/SubMenuDescriptor.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -26,46 +26,51 @@
 
 public class SubMenuDescriptor extends MenuDescriptor {
 
-    public SubMenuDescriptor() {
-        this(new BaseAction(null, null));
-    }
+  public SubMenuDescriptor() {
+    this(new BaseAction(null, null));
+  }
 
-    public SubMenuDescriptor(final AbstractAction action) {
-        this(NO_PARENT, action);
-    }
+  public SubMenuDescriptor(final AbstractAction action) {
+    this(NO_PARENT, action);
+  }
 
-    public SubMenuDescriptor(final GuiActionDescrip parent, final AbstractAction action) {
-        super(action);
-        setParent(parent);
-        putValue(MENU_HIDE, false);
-        putValue(MENU_SHOW, false);
-        putValue(MENU_CLEAR, false);
-        putValue(MENU_STANDALONE, false);
-    }
+  public SubMenuDescriptor(final GuiActionDescrip parent, final AbstractAction action) {
+    super(action);
+    setParent(parent);
+    putValue(MENU_HIDE, false);
+    putValue(MENU_SHOW, false);
+    putValue(MENU_CLEAR, false);
+    putValue(MENU_STANDALONE, false);
+  }
 
-    public SubMenuDescriptor(final String text) {
-        this(new BaseAction(text, null));
-    }
+  public SubMenuDescriptor(final GuiActionDescrip parent, final String text) {
+    this(text);
+    setParent(parent);
+  }
 
-    public SubMenuDescriptor(final String text, final ImageResource icon) {
-        this(new BaseAction(text, null, icon));
-    }
+  public SubMenuDescriptor(final String text) {
+    this(new BaseAction(text, null));
+  }
 
-    public SubMenuDescriptor(final String text, final String tooltip) {
-        this(new BaseAction(text, tooltip));
-    }
+  public SubMenuDescriptor(final String text, final ImageResource icon) {
+    this(new BaseAction(text, null, icon));
+  }
 
-    public SubMenuDescriptor(final String text, final String tooltip, final ImageResource icon) {
-        this(new BaseAction(text, tooltip, icon));
-    }
+  public SubMenuDescriptor(final String text, final String tooltip) {
+    this(new BaseAction(text, tooltip));
+  }
 
-    public SubMenuDescriptor(final String text, final String tooltip, final String icon) {
-        this(new BaseAction(text, tooltip, icon));
-    }
+  public SubMenuDescriptor(final String text, final String tooltip, final ImageResource icon) {
+    this(new BaseAction(text, tooltip, icon));
+  }
 
-    @Override
-    public Class<?> getType() {
-        return SubMenuDescriptor.class;
-    }
+  public SubMenuDescriptor(final String text, final String tooltip, final String icon) {
+    this(new BaseAction(text, tooltip, icon));
+  }
 
+  @Override
+  public Class<?> getType() {
+    return SubMenuDescriptor.class;
+  }
+
 }

Modified: trunk/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/core/client/actions/ActionRegistryByType.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -59,6 +59,15 @@
     addAction(GENERIC_GROUP_ACTION, action, GENERIC_TYPE_ID);
   }
 
+  public void addAction(final String actionsGroupId, final GuiActionDescrip descrip, final String typeId) {
+    addAction(actionsGroupId, new Provider<GuiActionDescrip>() {
+      @Override
+      public GuiActionDescrip get() {
+        return descrip;
+      }
+    }, typeId);
+  }
+
   public void addAction(@Nonnull final String actionsGroupId,
       final Provider<? extends GuiActionDescrip> action) {
     addAction(actionsGroupId, action, GENERIC_TYPE_ID);

Modified: trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/core/client/actions/RolActionAutoUpdated.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -53,7 +53,6 @@
       public void onAccessRightsChanged(final AccessRightsChangedEvent event) {
         refreshStatus(rolRequired, authNeed, session.isLogged(), visibleForMembers, visibleForNonMemb,
             event.getCurrentRights());
-
       }
     });
   }
@@ -75,6 +74,7 @@
         newVisibility = false;
       }
     }
+    setEnabled(!newEnabled);
     setEnabled(newEnabled);
     // Workaround to force change ...
     putValue(GuiActionDescrip.VISIBLE, !newVisibility);

Modified: trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/core/client/actions/XMLActionsParser.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -8,8 +8,10 @@
 import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
 import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.common.client.actions.ui.descrip.SubMenuDescriptor;
 import cc.kune.common.client.errors.UIException;
 import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.TextUtils;
 import cc.kune.core.client.actions.WaveExtension.Builder;
 import cc.kune.core.client.errors.ErrorHandler;
 import cc.kune.core.client.registry.NewMenusForTypeIdsRegistry;
@@ -52,11 +54,14 @@
 
   }
 
+  private static final String SEP = "»";
+
   private final ActionRegistryByType actionRegistry;
   private final Provider<ContentServiceAsync> contentService;
   private final ErrorHandler errHandler;
   private final Map<String, WaveExtension> extensionsMap;
   private final NewMenusForTypeIdsRegistry newMenusRegistry;
+  private final HashMap<String, SubMenuDescriptor> submenus;
 
   @Inject
   public XMLActionsParser(final ErrorHandler errHandler, final ActionRegistryByType actionRegistry,
@@ -67,6 +72,7 @@
     this.contentService = contentService;
     this.newMenusRegistry = newMenusRegistry;
     extensionsMap = new HashMap<String, WaveExtension>();
+    submenus = new HashMap<String, SubMenuDescriptor>();
 
     // Based on:
     // http://www.roseindia.net/tutorials/gwt/retrieving-xml-data.shtml
@@ -94,6 +100,36 @@
     return child != null ? child.getNodeValue() : "";
   }
 
+  private SubMenuDescriptor getSubMenu(final MenuDescriptor menu, final String typeId,
+      final String parentS) {
+    final String[] path = parentS.split(SEP);
+    SubMenuDescriptor current = null;
+    for (int i = 0; i < path.length; i++) {
+      final String name = path[i];
+      final String subpathId = getSubPathId(typeId, path, i);
+      SubMenuDescriptor subMenuDescriptor = submenus.get(subpathId);
+      if (subMenuDescriptor == null) {
+        final GuiActionDescrip parent = (i == 0 ? menu : submenus.get(getSubPathId(typeId, path, i - 1)));
+        assert parent != null;
+        subMenuDescriptor = new SubMenuDescriptor(parent, name);
+        // subMenuDescriptor.setVisible(false);
+        submenus.put(subpathId, subMenuDescriptor);
+        actionRegistry.addAction(ActionGroups.TOOLBAR, subMenuDescriptor, typeId);
+      }
+      current = subMenuDescriptor;
+    }
+    assert current != null;
+    return current;
+  }
+
+  private String getSubPathId(final String typeId, final String[] path, final int i) {
+    final StringBuffer id = new StringBuffer().append(typeId);
+    for (int j = 0; j <= i; j++) {
+      id.append(SEP).append(path[j]);
+    }
+    return id.toString();
+  }
+
   private void onFailed(final Throwable ex) {
     errHandler.process(ex);
   }
@@ -116,34 +152,39 @@
     for (int i = 0; i < guiDescriptors.getLength(); i++) {
       final Element guiDescriptor = (Element) guiDescriptors.item(i);
       if (Boolean.parseBoolean(get(guiDescriptor, "enabled"))) {
-        final String extensionName = get(guiDescriptor, "extensionName");
-        final WaveExtension extension = extensionsMap.get(extensionName);
-        if (extension == null) {
-          throw new UIException("Undefined extension " + extensionName);
-        }
-        final String name = get(guiDescriptor, "name");
-        final String description = get(guiDescriptor, "description");
-        final AccessRolDTO rol = AccessRolDTO.valueOf(get(guiDescriptor, "rolRequired"));
-        final GadgetAction action = new GadgetAction(contentService, rol, Boolean.parseBoolean(get(
-            guiDescriptor, "authNeed")), extension.getGadgetUrl(), extension.getIconUrl());
-        final NodeList typeIds = ((Element) guiDescriptor.getElementsByTagName("typeIds").item(0)).getElementsByTagName("typeId");
-        final int length = typeIds.getLength();
+        final String type = get(guiDescriptor, "type");
+        if (type.equals("wave-gadget")) {
+          final String extensionName = get(guiDescriptor, "extensionName");
+          final WaveExtension extension = extensionsMap.get(extensionName);
+          if (extension == null) {
+            throw new UIException("Undefined extension " + extensionName);
+          }
+          final String name = get(guiDescriptor, "name");
+          final String description = get(guiDescriptor, "description");
+          final AccessRolDTO rol = AccessRolDTO.valueOf(get(guiDescriptor, "rolRequired"));
+          final GadgetAction action = new GadgetAction(contentService, rol, Boolean.parseBoolean(get(
+              guiDescriptor, "authNeed")), extension.getGadgetUrl(), extension.getIconUrl());
+          final NodeList typeIds = ((Element) guiDescriptor.getElementsByTagName("typeIds").item(0)).getElementsByTagName("typeId");
+          final int length = typeIds.getLength();
 
-        for (int j = 0; j < length; j++) {
-          final Element typeIdElem = (Element) typeIds.item(j);
-          final String typeId = typeIdElem.getFirstChild().getNodeValue();
-          final MenuDescriptor menu = newMenusRegistry.get(typeId);
-          assert menu != null;
-          final Provider<GuiActionDescrip> menuItemProvider = new Provider<GuiActionDescrip>() {
-            @Override
-            public GuiActionDescrip get() {
-              final MenuItemDescriptor menuItem = new MenuItemDescriptor(action);
-              menuItem.withText(name).withToolTip(description);
-              menuItem.setParent(menu);
-              return menuItem;
-            }
-          };
-          actionRegistry.addAction(ActionGroups.TOOLBAR, menuItemProvider, typeId);
+          for (int j = 0; j < length; j++) {
+            final Element typeIdElem = (Element) typeIds.item(j);
+            final String typeId = typeIdElem.getFirstChild().getNodeValue();
+            final MenuDescriptor menu = newMenusRegistry.get(typeId);
+            assert menu != null;
+            final String parent = get(guiDescriptor, "parent");
+            final SubMenuDescriptor submenu = getSubMenu(menu, typeId, parent);
+            final Provider<GuiActionDescrip> menuItemProvider = new Provider<GuiActionDescrip>() {
+              @Override
+              public GuiActionDescrip get() {
+                final MenuItemDescriptor menuItem = new MenuItemDescriptor(action);
+                menuItem.withText(name).withToolTip(description);
+                menuItem.setParent(TextUtils.notEmpty(parent) ? submenu : menu);
+                return menuItem;
+              }
+            };
+            actionRegistry.addAction(ActionGroups.TOOLBAR, menuItemProvider, typeId);
+          }
         }
       }
     }

Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -133,15 +133,10 @@
       public void onUserSignOut(final UserSignOutEvent event) {
         refreshOnSignInSignOut(session);
       }
-
     });
-    createActions();
+    refreshActionsImpl();
   }
 
-  private void createActions() {
-    getView().getBottomToolbar().addAll(actionsRegistry);
-  }
-
   @Override
   public GroupSNView getView() {
     return (GroupSNView) super.getView();
@@ -162,6 +157,15 @@
     }
   }
 
+  public void refreshActions() {
+    refreshActionsImpl();
+  }
+
+  private void refreshActionsImpl() {
+    getView().getBottomToolbar().clear();
+    getView().getBottomToolbar().addAll(actionsRegistry);
+  }
+
   private void refreshOnSignInSignOut(final Session session) {
     final StateAbstractDTO currentState = session.getCurrentState();
     if (currentState != null) {

Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -126,13 +126,9 @@
             UserSNPresenter.this.onStateChanged(event.getState());
           }
         });
-    createActions();
+    refreshActionsImpl();
   }
 
-  private void createActions() {
-    getView().getBottomToolbar().addAll(confActionsRegistry);
-  }
-
   @Override
   public UserSNView getView() {
     return (UserSNView) super.getView();
@@ -156,6 +152,15 @@
     }
   }
 
+  public void refreshActions() {
+    refreshActionsImpl();
+  }
+
+  private void refreshActionsImpl() {
+    getView().getBottomToolbar().clear();
+    getView().getBottomToolbar().addAll(confActionsRegistry);
+  }
+
   private void refreshOnSignInSignOut(final Session session) {
     final StateAbstractDTO currentState = session.getCurrentState();
     if (currentState != null) {

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -26,6 +26,7 @@
 import cc.kune.common.client.actions.ui.descrip.MenuTitleItemDescriptor;
 import cc.kune.common.client.actions.ui.descrip.SubMenuDescriptor;
 import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.sn.GroupSNPresenter;
 import cc.kune.core.client.sn.actions.JoinGroupAction;
 import cc.kune.core.client.sn.actions.MembersModerationMenuItem;
 import cc.kune.core.client.sn.actions.MembersVisibilityMenuItem;
@@ -45,6 +46,13 @@
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
+/**
+ * 
+ * You must call {@link GroupSNPresenter#refreshActions()} when adding some
+ * action externally with
+ * {@link #add(cc.kune.common.client.actions.ui.descrip.GuiActionDescrip)}
+ * 
+ */
 @SuppressWarnings("serial")
 public class GroupSNConfActions extends AbstractSNActionsRegistry {
 
@@ -73,24 +81,24 @@
     final MenuRadioItemDescriptor moderatedItem = membersModeration.get().withModeration(
         AdmissionType.Moderated);
     final MenuRadioItemDescriptor openItem = membersModeration.get().withModeration(AdmissionType.Open);
-    add(OPTIONS_MENU);
-    add(optionsTitle);
-    add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(
+    addImpl(OPTIONS_MENU);
+    addImpl(optionsTitle);
+    addImpl(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(
         OPTIONS_MENU));
-    add(MODERATION_SUBMENU.withText(i18n.t("New members policy")).withParent(OPTIONS_MENU));
-    add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
-    add(onlyMembersItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only members")));
-    add(onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins")));
-    add(moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join")));
-    add(openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join")));
+    addImpl(MODERATION_SUBMENU.withText(i18n.t("New members policy")).withParent(OPTIONS_MENU));
+    addImpl(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
+    addImpl(onlyMembersItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only members")));
+    addImpl(onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins")));
+    addImpl(moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join")));
+    addImpl(openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join")));
     // add(closedItem.withParent(MODERATION_SUBMENU).withText(
     // i18n.t("closed for new members")));
 
     final ButtonDescriptor joinBtn = new ButtonDescriptor(joinGroupAction);
     final ButtonDescriptor unJoinBtn = new ButtonDescriptor(unJoinGroupAction);
     // unJoinBtn.add(isLoggedCondition);
-    add(joinBtn); // .withStyles("k-no-backimage, k-noborder, k-nobackcolor"));
-    add(unJoinBtn); // .withStyles("k-no-backimage, k-noborder, k-nobackcolor"));
+    addImpl(joinBtn); // .withStyles("k-no-backimage, k-noborder, k-nobackcolor"));
+    addImpl(unJoinBtn); // .withStyles("k-no-backimage, k-noborder, k-nobackcolor"));
 
     stateManager.onStateChanged(true, new StateChangedHandler() {
       @Override
@@ -128,4 +136,21 @@
       }
     });
   }
+
+  /**
+   * 
+   * You must call {@link GroupSNPresenter#refreshActions()} when adding some
+   * action externally with
+   * {@link #add(cc.kune.common.client.actions.ui.descrip.GuiActionDescrip)}
+   * 
+   */
+  @Override
+  public boolean add(final GuiActionDescrip action) {
+    return addImpl(action);
+  }
+
+  private boolean addImpl(final GuiActionDescrip action) {
+    return super.add(action);
+  }
+
 }

Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -20,10 +20,12 @@
 package cc.kune.core.client.sn.actions.registry;
 
 import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
 import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.common.client.actions.ui.descrip.MenuRadioItemDescriptor;
 import cc.kune.common.client.actions.ui.descrip.SubMenuDescriptor;
 import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.sn.UserSNPresenter;
 import cc.kune.core.client.sn.actions.AddNewBuddiesAction;
 import cc.kune.core.client.sn.actions.UserSNVisibilityMenuItem;
 import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
@@ -38,6 +40,13 @@
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 
+/**
+ * 
+ * You must call {@link UserSNPresenter#refreshActions()} when adding some
+ * action externally with
+ * {@link #add(cc.kune.common.client.actions.ui.descrip.GuiActionDescrip)}
+ * 
+ */
 @SuppressWarnings("serial")
 public class UserSNConfActions extends AbstractSNActionsRegistry {
 
@@ -59,15 +68,16 @@
         UserSNetVisibility.onlyyou);
     assert anyoneItem.getAction() != onlyYourBuddiesItem.getAction();
     assert anyoneItem.getAction() != onlyYou.getAction();
-    add(OPTIONS_MENU);
-    add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view your network")).withParent(OPTIONS_MENU));
-    add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
-    add(onlyYourBuddiesItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only your buddies")));
-    add(onlyYou.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only you")));
+    addImpl(OPTIONS_MENU);
+    addImpl(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view your network")).withParent(
+        OPTIONS_MENU));
+    addImpl(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
+    addImpl(onlyYourBuddiesItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only your buddies")));
+    addImpl(onlyYou.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only you")));
 
     final ButtonDescriptor addBuddieBtn = new ButtonDescriptor(addNewBuddiesAction);
 
-    add(addBuddieBtn.withStyles("k-no-backimage"));
+    addImpl(addBuddieBtn.withStyles("k-no-backimage"));
 
     stateManager.onStateChanged(true, new StateChangedHandler() {
       @Override
@@ -97,4 +107,21 @@
       }
     });
   }
+
+  /**
+   * 
+   * You must call {@link UserSNPresenter#refreshActions()} when adding some
+   * action externally with
+   * {@link #add(cc.kune.common.client.actions.ui.descrip.GuiActionDescrip)}
+   * 
+   */
+  @Override
+  public boolean add(final GuiActionDescrip action) {
+    return addImpl(action);
+  }
+
+  private boolean addImpl(final GuiActionDescrip action) {
+    return super.add(action);
+  }
+
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/AbstractNewMenu.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -21,9 +21,9 @@
 
 import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
 import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.UserSignInOrSignOutEvent;
-import cc.kune.core.client.state.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
+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.shared.i18n.I18nTranslationService;
 
 import com.google.inject.Inject;
@@ -32,14 +32,15 @@
 
   @Inject
   public AbstractNewMenu(final CoreResources res, final I18nTranslationService i18n,
-      final Session session) {
+      final AccessRightsClientManager rightsManager) {
     super();
-    this.withIcon(res.arrowdownsitebar()).withStyles("k-button, k-btn, k-5corners, k-def-docbtn, k-fr").withText(
+    this.withIcon(res.arrowdownsitebar()).withStyles("k-button, k-btn, k-5corners, k-def-docbtn, k-fl").withText(
         "New");
-    session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
+
+    rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
       @Override
-      public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
-        AbstractNewMenu.this.setVisible(event.isLogged());
+      public void onAccessRightsChanged(final AccessRightsChangedEvent event) {
+        AbstractNewMenu.this.setVisible(event.getCurrentRights().isEditable());
       }
     });
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -93,6 +93,6 @@
     // The name given to this new content
     action.putValue(NEW_NAME, newName);
     action.putValue(ID, id);
-    this.withText(title).withToolTip(tooltip).withIcon(icon).withStyles("k-def-docbtn, k-fr");
+    this.withText(title).withToolTip(tooltip).withIcon(icon).withStyles("k-def-docbtn, k-fl");
   }
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContentBtn.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -97,7 +97,7 @@
     // final KeyStroke shortcut = Shortcut.getShortcut(false, true, false,
     // false, Character.valueOf('N'));
     // shorcutReg.put(shortcut, action);
-    this.withText(title).withToolTip(tooltip).withIcon(icon).withStyles("k-def-docbtn, k-fr");
+    this.withText(title).withToolTip(tooltip).withIcon(icon).withStyles("k-def-docbtn, k-fl");
   }
 
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewMenuProvider.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewMenuProvider.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewMenuProvider.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -5,7 +5,7 @@
 import com.google.inject.Provider;
 
 /**
- * The Class NewMenusProvider ins a way to create a kind of singeltons for menu
+ * The Class NewMenusProvider is a way to create a kind of singletons for menu
  * entries. This can be register in a list of Providers<GuiDescriptor> but in
  * fact only references one item and can be used to select the parent of some
  * menu items

Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java	2011-06-24 23:04:18 UTC (rev 1417)
@@ -100,10 +100,10 @@
     void showEmptyMsg(String contentTypeId);
   }
 
-  protected static final String CSSBTN = "k-button";
-  protected static final String CSSBTNC = "k-button, k-button-center";
-  protected static final String CSSBTNL = "k-button, k-button-left";
-  protected static final String CSSBTNR = "k-button, k-button-right";
+  protected static final String CSSBTN = "k-button, k-fr";
+  protected static final String CSSBTNC = "k-button, k-button-center, k-fr";
+  protected static final String CSSBTNL = "k-button, k-button-left, k-fr";
+  protected static final String CSSBTNR = "k-button, k-button-right, k-fr";
 
   private final ActionRegistryByType actionsRegistry;
 
@@ -236,7 +236,7 @@
     final ContainerSimpleDTO[] path = container.getAbsolutePath();
     final int pathLength = path.length;
     if (pathLength > 0) {
-      for (int i = 0; i < pathLength; i++) {
+      for (int i = pathLength - 1; i >= 0; i--) {
         final ButtonDescriptor btn = createPathButton(path[i], pathLength, i);
         actions.add(btn);
       }

Modified: trunk/src/main/webapp/others/kune-wave-extensions.xml
===================================================================
--- trunk/src/main/webapp/others/kune-wave-extensions.xml	2011-06-24 16:50:59 UTC (rev 1416)
+++ trunk/src/main/webapp/others/kune-wave-extensions.xml	2011-06-24 23:04:18 UTC (rev 1417)
@@ -2,99 +2,108 @@
 
 <kuneWaveExtensions>
 
-<!-- List of Wave extensions to use in Kune ===================== -->
+  <!-- List of Wave extensions to use in Kune ===================== -->
 
-<extensions>
+  <extensions>
 
-  <extension>
-    <name>pollo</name>
-    <installerUrl>http://wavepollo.appspot.com/pollo.xml
-    </installerUrl>
-    <gadgetUrl>http://wavepollo.appspot.com/wavepollo/com.appspot.wavepollo.client.PolloWaveGadget.gadget.xml
-    </gadgetUrl>
-    <iconUrl>https://flinz-pollo.appspot.com/document_graph.png</iconUrl>
-    <iconCss></iconCss>
-  </extension>
-  <extension>
-    <name>massmob</name>
-    <installerUrl>http://mass-mob.appspot.com/massmob/massmob-extension.xml
-    </installerUrl>
-    <gadgetUrl>http://mass-mob.appspot.com/massmob/org.ourproject.massmob.client.MassmobGadget.gadget.xml
-    </gadgetUrl>
-    <iconUrl>http://mass-mob.appspot.com/logo.png</iconUrl>
-    <iconCss></iconCss>
-  </extension>
+    <extension>
+      <name>pollo</name>
+      <installerUrl>http://wavepollo.appspot.com/pollo.xml
+      </installerUrl>
+      <gadgetUrl>http://wavepollo.appspot.com/wavepollo/com.appspot.wavepollo.client.PolloWaveGadget.gadget.xml
+      </gadgetUrl>
+      <iconUrl>https://flinz-pollo.appspot.com/document_graph.png
+      </iconUrl>
+      <iconCss></iconCss>
+    </extension>
 
-</extensions>
+    <extension>
+      <name>massmob</name>
+      <installerUrl>http://mass-mob.appspot.com/massmob/massmob-extension.xml
+      </installerUrl>
+      <gadgetUrl>http://mass-mob.appspot.com/massmob/org.ourproject.massmob.client.MassmobGadget.gadget.xml
+      </gadgetUrl>
+      <iconUrl>http://mass-mob.appspot.com/logo.png</iconUrl>
+      <iconCss></iconCss>
+    </extension>
 
-<!-- Where and how to use the above extensions ================ -->
+  </extensions>
 
-<guiActionDescriptors>
+  <!-- Where and how to use the above extensions ================ -->
 
-  <guiActionDescriptor>
-    <extensionName>massmob</extensionName>
-    <name>New meeting</name>
-    <description>Call and speed-up of events as meeting, smartmobs,
-      flashmobs, protest demonstrations, etc.</description>
-    <enabled>true</enabled>
-    <typeIds>
-      <typeId>docs.folder</typeId>
-      <typeId>docs.root</typeId>
-      <typeId>blogs.blog</typeId>
-    </typeIds>
-    <name></name>
-    <location>
-      <rol>
-        <!-- Administrator, Editor, Viewer -->
-        <rolRequired>Editor</rolRequired>
-        <authNeed>true</authNeed>
-      </rol>
-    </location>
-    <!-- only for new waves: anyone, onlymembers, onlyadmins, ask -->
-    <participants>ask</participants>
-  </guiActionDescriptor>
+  <guiActionDescriptors>
 
-  <guiActionDescriptor>
-    <extensionName>pollo</extensionName>
-    <name>New poll</name>
-    <description>Make some poll (allow single and multiple polls))</description>
-    <enabled>true</enabled>
-    <typeIds>
-      <typeId>docs.folder</typeId>
-      <typeId>docs.root</typeId>
-      <typeId>blogs.blog</typeId>
-    </typeIds>
-    <name></name>
-    <location>
-      <rol>
-        <!-- Administrator, Editor, Viewer -->
-        <rolRequired>Editor</rolRequired>
-        <authNeed>true</authNeed>
-      </rol>
-    </location>
-    <!-- only for new waves: anyone, onlymembers, onlyadmins, ask -->
-    <participants>ask</participants>
-  </guiActionDescriptor>
+    <guiActionDescriptor>
+      <type>wave-gadget</type>
+      <extensionName>massmob</extensionName>
+      <name>New meeting</name>
+      <parent>Gadget»Calendar</parent>
+      <description>Call and speed-up of events as meeting, smartmobs,
+        flashmobs, protest demonstrations, etc.</description>
+      <enabled>true</enabled>
+      <typeIds>
+        <typeId>docs.folder</typeId>
+        <typeId>docs.root</typeId>
+        <typeId>blogs.blog</typeId>
+      </typeIds>
+      <name></name>
+      <location>
+        <rol>
+          <!-- Administrator, Editor, Viewer -->
+          <rolRequired>Editor</rolRequired>
+          <authNeed>true</authNeed>
+        </rol>
+      </location>
+      <!-- only for new waves: anyone, onlymembers, onlyadmins, ask -->
+      <participants>ask</participants>
+    </guiActionDescriptor>
 
-  <guiActionDescriptor>
-    <extensionName>massmob</extensionName>
-    <name>Add a meeting</name>
-    <description>Call and speed-up of events as meeting, smartmobs,
-      flashmobs, protest demonstrations, etc.</description>
-    <enabled>false</enabled>
-    <typeIds>
-      <typeId>docs.doc</typeId>
-    </typeIds>
-    <name></name>
-    <location>
-      <rol>
-        <!-- Administrator, Editor, Viewer -->
-        <rolRequired>Editor</rolRequired>
-        <authNeed>true</authNeed>
-      </rol>
-    </location>
-  </guiActionDescriptor>
+    <guiActionDescriptor>
+      <type>wave-gadget</type>
+      <extensionName>pollo</extensionName>
+      <name>New poll</name>
+      <parent>Gadget»Voting</parent>
+      <description>Make some poll (allow single and multiple polls))
+      </description>
+      <enabled>true</enabled>
+      <typeIds>
+        <typeId>docs.folder</typeId>
+        <typeId>docs.root</typeId>
+        <typeId>blogs.blog</typeId>
+      </typeIds>
+      <name></name>
+      <location>
+        <rol>
+          <!-- Administrator, Editor, Viewer -->
+          <rolRequired>Editor</rolRequired>
+          <authNeed>true</authNeed>
+        </rol>
+      </location>
+      <!-- only for new waves: anyone, onlymembers, onlyadmins, ask -->
+      <participants>ask</participants>
+    </guiActionDescriptor>
 
-</guiActionDescriptors>
+    <guiActionDescriptor>
+      <type>wave-gadget</type>
+      <extensionName>massmob</extensionName>
+      <name>Add a meeting</name>
+      <parent>Gadget»Calendar</parent>
+      <description>Call and speed-up of events as meeting, smartmobs,
+        flashmobs, protest demonstrations, etc.</description>
+      <enabled>false</enabled>
+      <typeIds>
+        <typeId>docs.doc</typeId>
+      </typeIds>
+      <name></name>
+      <location>
+        <rol>
+          <!-- Administrator, Editor, Viewer -->
+          <rolRequired>Editor</rolRequired>
+          <authNeed>true</authNeed>
+        </rol>
+      </location>
+    </guiActionDescriptor>
 
+  </guiActionDescriptors>
+
 </kuneWaveExtensions>
\ No newline at end of file




More information about the kune-commits mailing list