[kune-commits] r812 - in trunk/src/main/java/org/ourproject/kune: app/public platf/client/app platf/client/services platf/client/state workspace/client/search workspace/client/sitebar workspace/client/socialnet workspace/client/socialnet/ui

vjrj vjrj at ourproject.org
Mon Jul 21 16:30:46 CEST 2008


Author: vjrj
Date: 2008-07-21 16:30:36 +0200 (Mon, 21 Jul 2008)
New Revision: 812

Added:
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
Modified:
   trunk/src/main/java/org/ourproject/kune/app/public/Kune.html
   trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryView.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/ParticipationSummaryPanel.java
Log:
new ParticipationSummary


Modified: trunk/src/main/java/org/ourproject/kune/app/public/Kune.html
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/Kune.html	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/app/public/Kune.html	2008-07-21 14:30:36 UTC (rev 812)
@@ -131,7 +131,7 @@
     src="org.ourproject.kune.app.Kune.nocache.js"></script>
 <iframe id="__gwt_historyFrame" style="width: 0; height: 0; border: 0"></iframe>
 <div id="kuneprogresspanel" class="kune-sitebar">
-<table cellspacing="0" summary="Loading" cellpadding="0" border="0"
+<table cellspacing="0" summary="Starting" cellpadding="0" border="0"
     style="height: 16px;">
     <tbody>
         <tr>
@@ -140,7 +140,7 @@
                 src="images/spin-kune-thund-green.gif"
                 style="height: 16px; width: 16px;" /></td>
             <td align="left" style="vertical-align: top;" class="kune-Progress">
-            <div class="kune-SiteBarPanel gwt-Label" id="kuneprogresstext">Loading</div>
+            <div class="kune-SiteBarPanel gwt-Label" id="kuneprogresstext">Starting</div>
             </td>
             <td width="100%" height="16" align="left"
                 style="vertical-align: top;"></td>

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -56,7 +56,7 @@
 
 	final Session session = kune.getSession();
 
-	Site.showProgressLoading();
+	Site.showProgressStarting();
 
 	final KunePlatform platform = kune.getPlatform();
 	final StateManager stateManager = kune.getStateManager();

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -179,12 +179,12 @@
 	}, SingletonScope.class);
 
 	final WorkspaceSkeleton ws = builder.getInstance(WorkspaceSkeleton.class);
+	final Images images = builder.getInstance(Images.class);
 
 	builder.registerProvider(SitePublicSpaceLink.class, new Provider<SitePublicSpaceLink>() {
 	    public SitePublicSpaceLink get() {
 		final SitePublicSpaceLinkPresenter presenter = new SitePublicSpaceLinkPresenter();
-		final SitePublicSpaceLinkPanel panel = new SitePublicSpaceLinkPanel(presenter, ws, i18n, builder
-			.getInstance(Images.class));
+		final SitePublicSpaceLinkPanel panel = new SitePublicSpaceLinkPanel(presenter, ws, i18n, images);
 		presenter.init(panel);
 		return presenter;
 	    }
@@ -368,7 +368,9 @@
 
 	builder.registerProvider(ParticipationSummary.class, new Provider<ParticipationSummary>() {
 	    public ParticipationSummary get() {
-		final ParticipationSummaryPresenter presenter = new ParticipationSummaryPresenter(i18n);
+		final ParticipationSummaryPresenter presenter = new ParticipationSummaryPresenter(i18n, builder
+			.getProvider(StateManager.class), builder.getInstance(ImageUtils.class), builder
+			.getInstance(Session.class), SocialNetworkService.App.getInstance());
 		final ParticipationSummaryView view = new ParticipationSummaryPanel(presenter, i18n, ws);
 		presenter.init(view);
 		return presenter;

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderImpl.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -35,26 +35,26 @@
     private final HashMap<StateToken, StateDTO> cache;
 
     public ContentProviderImpl(final ContentServiceAsync server) {
-        this.server = server;
-        this.cache = new HashMap<StateToken, StateDTO>();
+	this.server = server;
+	this.cache = new HashMap<StateToken, StateDTO>();
     }
 
     public void cache(final StateToken encodeState, final StateDTO content) {
-        cache.put(encodeState, content);
+	cache.put(encodeState, content);
     }
 
     public void getContent(final String user, final StateToken newState, final AsyncCallback<StateDTO> callback) {
-        Site.showProgressProcessing();
-        StateDTO catched = getCached(newState);
-        if (catched != null) {
-            callback.onSuccess(catched);
-        } else {
-            server.getContent(user, newState.getGroup(), newState, callback);
-        }
+	Site.showProgressLoading();
+	final StateDTO catched = getCached(newState);
+	if (catched != null) {
+	    callback.onSuccess(catched);
+	} else {
+	    server.getContent(user, newState.getGroup(), newState, callback);
+	}
     }
 
     private StateDTO getCached(final StateToken newState) {
-        return cache.remove(newState);
+	return cache.remove(newState);
     }
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -46,10 +46,11 @@
     }
 
     public void doSearch(final String text) {
+	Site.showProgressLoading();
 	searchHistory.put(text, null);
-	Site.hideProgress();
 	view.search(text, currentSearch);
 	view.show();
+	Site.hideProgress();
     }
 
     public void doSearchOfType(final String text, final SiteSearcherType typeOfSearch) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -84,6 +84,10 @@
 	progress.showProgress(i18n.t("Saving"));
     }
 
+    public static void showProgressStarting() {
+	progress.showProgress(i18n.t("Starting"));
+    }
+
     public static void veryImportant(final String value) {
 	getSiteMessage().setMessage(value, SiteErrorType.veryimp);
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -12,6 +12,7 @@
 import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
 import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
 
+import com.allen_sauer.gwt.log.client.Log;
 import com.gwtext.client.core.EventObject;
 import com.gwtext.client.widgets.BoxComponent;
 import com.gwtext.client.widgets.Button;
@@ -51,6 +52,7 @@
     }
 
     public void addButton(final GridButton gridButton) {
+	// Workaround: gwt-ext don't have toolbar.removeItem method ...
 	ToolbarButton button = buttonsCache.get(gridButton);
 	if (button == null) {
 	    button = new ToolbarButton(gridButton.getTitle());
@@ -61,10 +63,11 @@
 		    gridButton.getSlot().onEvent("");
 		}
 	    });
+	    buttonsCache.put(gridButton, button);
+	} else {
+	    button.setVisible(true);
 	}
-	if (!button.isAttached()) {
-	    gridMenuPanel.getBottomBar().addButton(button);
-	}
+	gridMenuPanel.getBottomBar().addButton(button);
     }
 
     public void addItem(final GridItem<GroupDTO> gridItem) {
@@ -74,6 +77,9 @@
     public void clear() {
 	gridMenuPanel.removeAll();
 	for (final ToolbarButton button : buttonsCache.values()) {
+	    // Workaround: gwt-ext don't have toolbar.removeItem method ...
+	    // gridMenuPanel.getBottomBar().getEl().removeChild(button.getElement());
+	    button.setVisible(false);
 	    button.removeFromParent();
 	}
     }
@@ -99,6 +105,7 @@
     }
 
     public void setVisible(final boolean visible) {
+	Log.debug("Set visible: " + visible + " in GroupMembers");
 	super.setVisible(visible);
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -9,68 +9,46 @@
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
 import org.ourproject.kune.platf.client.dto.StateDTO;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
-import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
 import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
 import org.ourproject.kune.platf.client.services.ImageDescriptor;
 import org.ourproject.kune.platf.client.services.ImageUtils;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
-import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
-import org.ourproject.kune.platf.client.ui.gridmenu.GridMenu;
-import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuItem;
-import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuItemCollection;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.sitebar.Site;
 import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
 import org.ourproject.kune.workspace.client.workspace.GroupMembersSummary;
 
 import com.calclab.suco.client.container.Provider;
-import com.calclab.suco.client.signal.Slot;
 
-public class GroupMembersSummaryPresenterNew implements GroupMembersSummary {
+public class GroupMembersSummaryPresenterNew extends SocialNetworkPresenter implements GroupMembersSummary {
 
     private GroupMembersSummaryViewNew view;
-    private final I18nTranslationService i18n;
-    private final GridGroup adminGroup;
-    private final GridGroup collabGroup;
-    private final GridGroup pendigGroup;
-    private GridMenuItem<GroupDTO> gotoGroupMenuItem;
-    private final ImageUtils imageUtils;
+    private final I18nUITranslationService i18n;
+    private final GridGroup adminCategory;
+    private final GridGroup collabCategory;
+    private final GridGroup pendigCategory;
     private final Session session;
     private final SocialNetworkServiceAsync snService;
-    private final Provider<StateManager> stateManager;
-    private GridMenuItem<GroupDTO> changeToCollabMenuItem;
-    private GridMenuItem<GroupDTO> removeMemberMenuItem;
-    private GridMenuItem<GroupDTO> changeToAdminMenuItem;
-    private GridMenuItem<GroupDTO> acceptJoinGroupMenuItem;
-    private GridMenuItem<GroupDTO> denyJoinGroupMenuItem;
-    private GridButton addMember;
-    private GridButton requestJoin;
-    private GridButton unJoinButton;
-    private GridMenuItemCollection<GroupDTO> otherOperations;
-    private GridMenuItemCollection<GroupDTO> otherLoggedOperations;
 
-    public GroupMembersSummaryPresenterNew(final I18nTranslationService i18n,
-	    final Provider<StateManager> stateManager, final ImageUtils imageUtils, final Session session,
+    public GroupMembersSummaryPresenterNew(final I18nUITranslationService i18n,
+	    final Provider<StateManager> stateManagerProvider, final ImageUtils imageUtils, final Session session,
 	    final SocialNetworkServiceAsync snService) {
+	super(i18n, stateManagerProvider, imageUtils, session, snService);
 	this.i18n = i18n;
-	this.stateManager = stateManager;
-	this.imageUtils = imageUtils;
 	this.session = session;
 	this.snService = snService;
 	final String adminsTitle = i18n.t("Admins");
 	final String collabsTitle = i18n.t("Collaborators");
 	final String pendingTitle = i18n.t("Pending");
-	adminGroup = new GridGroup(adminsTitle, adminsTitle, i18n.t("People that can admin this group"), true);
-	collabGroup = new GridGroup(collabsTitle, collabsTitle,
-		i18n.t("Other people that collaborate with this group"), true);
-	pendigGroup = new GridGroup(pendingTitle, pendingTitle, i18n
+	adminCategory = new GridGroup(adminsTitle, adminsTitle, i18n.t("People that can admin this group"), true);
+	collabCategory = new GridGroup(collabsTitle, collabsTitle, i18n
+		.t("Other people that collaborate with this group"), true);
+	pendigCategory = new GridGroup(pendingTitle, pendingTitle, i18n
 		.t("People pending to be accepted in this group by the admins"), imageUtils
 		.getImageHtml(ImageDescriptor.alert), true);
-	createMenuActions();
-	createButtons();
+	super.addGroupOperation(gotoMemberMenuItem, false);
     }
 
     public void addCollab(final String groupShortName) {
@@ -86,15 +64,6 @@
 		});
     }
 
-    public void addGroupOperation(final GridMenuItem<GroupDTO> operation, final boolean mustBeLogged) {
-	GridMenuItemCollection<GroupDTO> collection;
-	collection = mustBeLogged ? otherLoggedOperations : otherOperations;
-	if (collection == null) {
-	    collection = new GridMenuItemCollection<GroupDTO>();
-	}
-	collection.add(operation);
-    }
-
     public void hide() {
 	view.setVisible(false);
     }
@@ -103,16 +72,8 @@
 	this.view = view;
     }
 
-    public void removeGroupOperation(final GridMenuItem<GroupDTO> operation, final boolean mustBeLogged) {
-	GridMenuItemCollection<GroupDTO> collection;
-	collection = mustBeLogged ? otherLoggedOperations : otherOperations;
-	if (collection != null) {
-	    collection.remove(operation);
-	}
-    }
-
     public void setState(final StateDTO state) {
-	if (state.getGroup().getType() == GroupDTO.PERSONAL) {
+	if (state.getGroup().getType().equals(GroupDTO.PERSONAL)) {
 	    hide();
 	} else {
 	    setGroupMembers(state.getGroupMembers(), state.getGroupRights());
@@ -123,174 +84,11 @@
 	view.setTheme(oldTheme, newTheme);
     }
 
-    private void createButtons() {
-	addMember = new GridButton("images/add-green.gif", i18n.t("Add member"), i18n
-		.t("Add a group or a person as member of this group"), new Slot<String>() {
-	    public void onEvent(final String parameter) {
-		// TODO
-		// GroupLiveSearchComponent groupLiveSearchComponent
-		// = workspace.getGroupLiveSearchComponent();
-		// groupLiveSearchComponent.addListener(listener);
-		// groupLiveSearchComponent.show();
-	    }
-	});
-
-	requestJoin = new GridButton("images/add-green.gif", i18n.t("Participate"), i18n
-		.t("Request to participate in this group"), new Slot<String>() {
-	    public void onEvent(final String parameter) {
-		Site.showProgressProcessing();
-		snService.requestJoinGroup(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
-			new AsyncCallbackSimple<Object>() {
-			    public void onSuccess(final Object result) {
-				Site.hideProgress();
-				final String resultType = (String) result;
-				if (resultType == SocialNetworkDTO.REQ_JOIN_ACEPTED) {
-				    Site.info(i18n.t("You are now member of this group"));
-				    getStateManager().reload();
-				}
-				if (resultType == SocialNetworkDTO.REQ_JOIN_DENIED) {
-				    Site.important(i18n.t("Sorry this is a closed group"));
-				}
-				if (resultType == SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION) {
-				    Site.info(i18n.t("Requested. Waiting for admins decision"));
-				}
-			    }
-			});
-	    }
-	});
-
-	unJoinButton = new GridButton("images/del.gif", i18n.t("Unjoin"), i18n
-		.t("Don't participate more as a member in this group"), new Slot<String>() {
-	    public void onEvent(final String parameter) {
-		Site.showProgressProcessing();
-		snService.unJoinGroup(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
-			new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-			    public void onSuccess(final SocialNetworkResultDTO result) {
-				Site.hideProgress();
-				Site.info(i18n.t("Removed as member"));
-				getStateManager().reload();
-				// in the future with user info:
-				// services.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
-				// result);
-			    }
-			});
-	    }
-	});
-    }
-
-    private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
-	final GridMenu<GroupDTO> menu = new GridMenu<GroupDTO>(group);
-	final String longName = group.getLongName();
-	final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageUtils
-		.getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, i18n.t(
-		"User name: [%s]", group.getShortName()), menu);
-	menu.addMenuItem(gotoGroupMenuItem);
-	if (otherOperations != null) {
-	    menu.addMenuItemList(otherOperations);
-	}
-	if (session.isLogged() && otherOperations != null) {
-	    menu.addMenuItemList(otherLoggedOperations);
-	}
-	return gridItem;
-    }
-
-    private void createMenuActions() {
-	gotoGroupMenuItem = new GridMenuItem<GroupDTO>("images/group-home.gif", i18n.t("Visit this member homepage"),
-		new Slot<GroupDTO>() {
-		    public void onEvent(final GroupDTO groupDTO) {
-			getStateManager().gotoToken(groupDTO.getShortName());
-		    }
-		});
-	changeToCollabMenuItem = new GridMenuItem<GroupDTO>("images/arrow-down-green.gif", i18n
-		.t("Change to collaborator"), new Slot<GroupDTO>() {
-	    public void onEvent(final GroupDTO group) {
-		Site.showProgressProcessing();
-		snService.setCollabAsAdmin(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
-			group.getShortName(), new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-			    public void onSuccess(final SocialNetworkResultDTO result) {
-				Site.hideProgress();
-				Site.info(i18n.t("Type of member changed"));
-				getStateManager().setSocialNetwork(result);
-			    }
-			});
-	    }
-	});
-	removeMemberMenuItem = new GridMenuItem<GroupDTO>("images/del.gif", i18n.t("Remove this member"),
-		new Slot<GroupDTO>() {
-		    public void onEvent(final GroupDTO group) {
-			Site.showProgressProcessing();
-			snService.deleteMember(session.getUserHash(), session.getCurrentState().getGroup()
-				.getShortName(), group.getShortName(),
-				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-				    public void onSuccess(final SocialNetworkResultDTO result) {
-					Site.hideProgress();
-					Site.info(i18n.t("Member removed"));
-					getStateManager().reload();
-					// in the future, only if I cannot
-					// be affected:
-					// snService.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
-					// result);
-				    }
-				});
-		    }
-		});
-	changeToAdminMenuItem = new GridMenuItem<GroupDTO>("images/arrow-up-green.gif", i18n.t("Change to admin"),
-		new Slot<GroupDTO>() {
-		    public void onEvent(final GroupDTO group) {
-			Site.showProgressProcessing();
-			final SocialNetworkServiceAsync server = SocialNetworkService.App.getInstance();
-			server.addAdminMember(session.getUserHash(), session.getCurrentState().getGroup()
-				.getShortName(), group.getShortName(),
-				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-				    public void onSuccess(final SocialNetworkResultDTO result) {
-					Site.hideProgress();
-					Site.info(i18n.t("Member added as admin"));
-					getStateManager().setSocialNetwork(result);
-				    }
-				});
-		    }
-		});
-	acceptJoinGroupMenuItem = new GridMenuItem<GroupDTO>("images/accept.gif", i18n.t("Accept this member"),
-		new Slot<GroupDTO>() {
-		    public void onEvent(final GroupDTO group) {
-			Site.showProgressProcessing();
-			snService.AcceptJoinGroup(session.getUserHash(), session.getCurrentState().getGroup()
-				.getShortName(), group.getShortName(),
-				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-				    public void onSuccess(final SocialNetworkResultDTO result) {
-					Site.hideProgress();
-					Site.info(i18n.t("Member accepted"));
-					getStateManager().setSocialNetwork(result);
-				    }
-				});
-		    }
-		});
-	denyJoinGroupMenuItem = new GridMenuItem<GroupDTO>("images/cancel.gif", i18n.t("Don't accept this member"),
-		new Slot<GroupDTO>() {
-		    public void onEvent(final GroupDTO group) {
-			Site.showProgressProcessing();
-			final SocialNetworkServiceAsync server = SocialNetworkService.App.getInstance();
-			server.denyJoinGroup(session.getUserHash(),
-				session.getCurrentState().getGroup().getShortName(), group.getShortName(),
-				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
-				    public void onSuccess(final SocialNetworkResultDTO result) {
-					Site.hideProgress();
-					Site.info(i18n.t("Member rejected"));
-					getStateManager().setSocialNetwork(result);
-				    }
-				});
-		    }
-		});
-    }
-
-    private StateManager getStateManager() {
-	return stateManager.get();
-    }
-
     private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) {
 	return userIsAdmin || userIsCollab;
     }
 
+    @SuppressWarnings("unchecked")
     private void setGroupMembers(final SocialNetworkDTO socialNetwork, final AccessRightsDTO rights) {
 	final AccessListsDTO accessLists = socialNetwork.getAccessLists();
 
@@ -320,34 +118,22 @@
 
 	if (userCanView) {
 	    for (final GroupDTO admin : adminsList) {
-		final GridItem<GroupDTO> gridItem = createDefMemberMenu(admin, adminGroup);
-		final GridMenu<GroupDTO> menu = gridItem.getMenu();
-		if (rights.isAdministrable()) {
-		    menu.addMenuItem(changeToCollabMenuItem);
-		    menu.addMenuItem(removeMemberMenuItem);
-		}
-		view.addItem(gridItem);
+		view
+			.addItem(createGridItem(adminCategory, admin, rights, changeToCollabMenuItem,
+				removeMemberMenuItem));
 	    }
 	    for (final GroupDTO collab : collabList) {
-		final GridItem<GroupDTO> gridItem = createDefMemberMenu(collab, collabGroup);
-		final GridMenu<GroupDTO> menu = gridItem.getMenu();
-		if (rights.isAdministrable()) {
-		    menu.addMenuItem(changeToAdminMenuItem);
-		    menu.addMenuItem(removeMemberMenuItem);
-		}
-		view.addItem(gridItem);
+		view
+			.addItem(createGridItem(collabCategory, collab, rights, changeToAdminMenuItem,
+				removeMemberMenuItem));
 	    }
 	    for (final GroupDTO pendingCollab : pendingCollabsList) {
-		final GridItem<GroupDTO> gridItem = createDefMemberMenu(pendingCollab, pendigGroup);
-		final GridMenu<GroupDTO> menu = gridItem.getMenu();
-		if (rights.isAdministrable()) {
-		    menu.addMenuItem(acceptJoinGroupMenuItem);
-		    menu.addMenuItem(denyJoinGroupMenuItem);
-		}
-		view.addItem(gridItem);
+		view.addItem(createGridItem(pendigCategory, pendingCollab, rights, acceptJoinGroupMenuItem,
+			denyJoinGroupMenuItem));
 	    }
 	}
 	view.setDropDownContentVisible(true);
 	view.setVisible(true);
     }
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -19,66 +19,77 @@
  */
 package org.ourproject.kune.workspace.client.socialnet;
 
-import java.util.Iterator;
 import java.util.List;
 
-import org.ourproject.kune.platf.client.AbstractPresenter;
-import org.ourproject.kune.platf.client.PlatformEvents;
-import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.LinkDTO;
 import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
 import org.ourproject.kune.platf.client.dto.StateDTO;
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.workspace.client.WorkspaceEvents;
+import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
+import org.ourproject.kune.platf.client.services.ImageUtils;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
 import org.ourproject.kune.workspace.client.workspace.ParticipationSummary;
 
-public class ParticipationSummaryPresenter extends AbstractPresenter implements ParticipationSummary {
+import com.calclab.suco.client.container.Provider;
 
+public class ParticipationSummaryPresenter extends SocialNetworkPresenter implements ParticipationSummary {
+
     private ParticipationSummaryView view;
+    private final GridGroup adminCategory;
+    private GridGroup collabCategory;
+    private final GridGroup collabOnlyCategory;
 
-    private final I18nTranslationService i18n;
-
-    private final String admin_subtitle;
-
-    private final MemberAction goto_group_command;
-
-    public ParticipationSummaryPresenter(final I18nTranslationService i18n) {
-	this.i18n = i18n;
-	admin_subtitle = i18n.t("admin in:");
-	goto_group_command = new MemberAction(i18n.t("Visit this group homepage"), PlatformEvents.GOTO);
+    public ParticipationSummaryPresenter(final I18nUITranslationService i18n,
+	    final Provider<StateManager> stateManagerProvider, final ImageUtils imageUtils, final Session session,
+	    final SocialNetworkServiceAsync snService) {
+	super(i18n, stateManagerProvider, imageUtils, session, snService);
+	adminCategory = new GridGroup("admin in:", " ", i18n.tWithNT("Administrate these groups",
+		"talking about a person"), false);
+	collabCategory = new GridGroup(i18n.t("and as collaborator in:"), " ", i18n.t("Collaborate in these groups"),
+		false);
+	collabOnlyCategory = new GridGroup(i18n.t("collaborator in:"), " ", i18n.t("Collaborate in these groups"),
+		false);
+	super.addGroupOperation(gotoGroupMenuItem, false);
     }
 
-    public View getView() {
-	return view;
-    }
-
     public void init(final ParticipationSummaryView view) {
 	this.view = view;
     }
 
+    @SuppressWarnings("unchecked")
     public void setState(final StateDTO state) {
 	final ParticipationDataDTO participation = state.getParticipation();
 	final AccessRightsDTO rights = state.getGroupRights();
-	view.setDropDownContentVisible(false);
+	view.setContentVisible(false);
 	view.clear();
-	final MemberAction[] adminsActions = {
-		new MemberAction(i18n.t("Don't participate more in this group"), WorkspaceEvents.UNJOIN_GROUP),
-		goto_group_command };
-	final MemberAction[] collabActions = adminsActions;
-	final MemberAction[] viewerActions = { goto_group_command };
 	final List<LinkDTO> groupsIsAdmin = participation.getGroupsIsAdmin();
 	final List<LinkDTO> groupsIsCollab = participation.getGroupsIsCollab();
-	boolean userIsAdmin = rights.isAdministrable();
-	final boolean userIsCollab = !userIsAdmin && rights.isEditable();
-	final boolean userIsMember = isMember(userIsAdmin, userIsCollab);
 	final int numAdmins = groupsIsAdmin.size();
 	final int numCollaborators = groupsIsCollab.size();
+	if (numAdmins == 0) {
+	    collabCategory = collabOnlyCategory;
+	}
+	for (final LinkDTO link : groupsIsAdmin) {
+	    // FIXME: return GroupDTO not LinkDTO from server
+	    final GroupDTO group = new GroupDTO();
+	    group.setShortName(link.getShortName());
+	    group.setLongName(link.getLongName());
+	    view.addItem(createGridItem(adminCategory, group, rights, unJoinMenuItem));
+	}
+	for (final LinkDTO link : groupsIsCollab) {
+	    // FIXME: return GroupDTO not LinkDTO from server
+	    final GroupDTO group = new GroupDTO();
+	    group.setShortName(link.getShortName());
+	    group.setLongName(link.getLongName());
+	    view.addItem(createGridItem(collabCategory, group, rights, unJoinMenuItem));
+	}
 	if (numAdmins > 0 || numCollaborators > 0) {
-	    addParticipants(groupsIsAdmin, groupsIsCollab, numAdmins, numCollaborators, userIsAdmin, userIsMember,
-		    adminsActions, collabActions, viewerActions);
-	    view.setDropDownContentVisible(true);
+	    view.setContentVisible(true);
 	    view.show();
 	} else {
 	    hide();
@@ -90,48 +101,8 @@
 	view.setTheme(oldTheme, newTheme);
     }
 
-    private void addParticipants(final List<LinkDTO> groupsIsAdmin, final List<LinkDTO> groupsIsCollab,
-	    final int numAdmins, final int numCollaborators, final boolean userIsAdmin, boolean userIsMember,
-	    final MemberAction[] adminsActions, final MemberAction[] collabActions, final MemberAction[] viewerActions) {
-	MemberAction[] actions;
-	String collabTitle;
-
-	if (!userIsMember) {
-	    actions = viewerActions;
-	} else {
-	    if (userIsAdmin) {
-		actions = adminsActions;
-	    } else {
-		actions = collabActions;
-	    }
-	}
-	if (numAdmins > 0) {
-	    view.addCategory(admin_subtitle, i18n.tWithNT("Administrate these groups", "talking about a person"));
-	    iteraList(admin_subtitle, groupsIsAdmin, actions);
-	    collabTitle = i18n.t("and as collaborator in:");
-	} else {
-	    collabTitle = i18n.t("collaborator in:");
-	}
-	if (numCollaborators > 0) {
-	    view.addCategory(collabTitle, i18n.t("Collaborate in these groups"));
-	    iteraList(collabTitle, groupsIsCollab, actions);
-	}
-
-    }
-
     private void hide() {
 	view.hide();
     }
 
-    private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) {
-	return userIsAdmin || userIsCollab;
-    }
-
-    private void iteraList(final String categoryName, final List<LinkDTO> groupList, final MemberAction[] actions) {
-	final Iterator<LinkDTO> iter = groupList.iterator();
-	while (iter.hasNext()) {
-	    final LinkDTO group = iter.next();
-	    view.addCategoryMember(categoryName, group.getShortName(), group.getLongName(), actions);
-	}
-    }
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryView.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryView.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -20,19 +20,19 @@
 package org.ourproject.kune.workspace.client.socialnet;
 
 import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
 import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
 
 public interface ParticipationSummaryView extends View {
 
-    void addCategory(String name, String title);
+    void addItem(GridItem<GroupDTO> createGridItem);
 
-    void addCategoryMember(String categoryName, String name, String title, MemberAction[] memberActions);
-
     void clear();
 
     void hide();
 
-    void setDropDownContentVisible(boolean visible);
+    void setContentVisible(boolean visible);
 
     void setTheme(WsTheme oldTheme, WsTheme newTheme);
 

Added: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -0,0 +1,267 @@
+package org.ourproject.kune.workspace.client.socialnet;
+
+import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
+import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
+import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
+import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
+import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
+import org.ourproject.kune.platf.client.services.ImageDescriptor;
+import org.ourproject.kune.platf.client.services.ImageUtils;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridMenu;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuItem;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuItemCollection;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.sitebar.Site;
+
+import com.calclab.suco.client.container.Provider;
+import com.calclab.suco.client.signal.Slot;
+
+public class SocialNetworkPresenter {
+
+    protected GridButton addMember;
+    protected GridButton requestJoin;
+    protected GridButton unJoinButton;
+    protected GridMenuItem<GroupDTO> changeToCollabMenuItem;
+    protected GridMenuItem<GroupDTO> removeMemberMenuItem;
+    protected GridMenuItem<GroupDTO> changeToAdminMenuItem;
+    protected GridMenuItem<GroupDTO> acceptJoinGroupMenuItem;
+    protected GridMenuItem<GroupDTO> denyJoinGroupMenuItem;
+    protected GridMenuItem<GroupDTO> gotoMemberMenuItem;
+    protected GridMenuItem<GroupDTO> gotoGroupMenuItem;
+    protected GridMenuItem<GroupDTO> unJoinMenuItem;
+    private final I18nUITranslationService i18n;
+    private final Provider<StateManager> stateManagerProvider;
+    private final SocialNetworkServiceAsync snService;
+    private final Session session;
+    private final GridMenuItemCollection<GroupDTO> otherOperations;
+    private final GridMenuItemCollection<GroupDTO> otherLoggedOperations;
+    private final ImageUtils imageUtils;
+
+    public SocialNetworkPresenter(final I18nUITranslationService i18n,
+	    final Provider<StateManager> stateManagerProvider, final ImageUtils imageUtils, final Session session,
+	    final SocialNetworkServiceAsync snService) {
+	this.i18n = i18n;
+	this.stateManagerProvider = stateManagerProvider;
+	this.imageUtils = imageUtils;
+	this.session = session;
+	this.snService = snService;
+	createButtons();
+	createMenuActions();
+	otherOperations = new GridMenuItemCollection<GroupDTO>();
+	otherLoggedOperations = new GridMenuItemCollection<GroupDTO>();
+    }
+
+    public void addGroupOperation(final GridMenuItem<GroupDTO> operation, final boolean mustBeLogged) {
+	GridMenuItemCollection<GroupDTO> collection;
+	collection = mustBeLogged ? otherLoggedOperations : otherOperations;
+	collection.add(operation);
+    }
+
+    public void removeGroupOperation(final GridMenuItem<GroupDTO> operation, final boolean mustBeLogged) {
+	GridMenuItemCollection<GroupDTO> collection;
+	collection = mustBeLogged ? otherLoggedOperations : otherOperations;
+	collection.remove(operation);
+    }
+
+    protected GridItem<GroupDTO> createGridItem(final GridGroup groupCategory, final GroupDTO group,
+	    final AccessRightsDTO rights, final GridMenuItem<GroupDTO>... gridMenuItems) {
+	final GridItem<GroupDTO> gridItem = createDefMemberMenu(group, groupCategory);
+	final GridMenu<GroupDTO> menu = gridItem.getMenu();
+	if (rights.isAdministrable()) {
+	    for (final GridMenuItem<GroupDTO> item : gridMenuItems) {
+		menu.addMenuItem(item);
+	    }
+	}
+	return gridItem;
+    }
+
+    protected StateManager getStateManager() {
+	return stateManagerProvider.get();
+    }
+
+    private void createButtons() {
+	addMember = new GridButton("images/add-green.gif", i18n.t("Add member"), i18n
+		.t("Add a group or a person as member of this group"), new Slot<String>() {
+	    public void onEvent(final String parameter) {
+		// TODO
+		// GroupLiveSearchComponent groupLiveSearchComponent
+		// = workspace.getGroupLiveSearchComponent();
+		// groupLiveSearchComponent.addListener(listener);
+		// groupLiveSearchComponent.show();
+	    }
+	});
+
+	requestJoin = new GridButton("images/add-green.gif", i18n.t("Participate"), i18n
+		.t("Request to participate in this group"), new Slot<String>() {
+	    public void onEvent(final String parameter) {
+		Site.showProgressProcessing();
+		snService.requestJoinGroup(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
+			new AsyncCallbackSimple<Object>() {
+			    public void onSuccess(final Object result) {
+				Site.hideProgress();
+				final String resultType = (String) result;
+				if (resultType == SocialNetworkDTO.REQ_JOIN_ACEPTED) {
+				    Site.info(i18n.t("You are now member of this group"));
+				    getStateManager().reload();
+				}
+				if (resultType == SocialNetworkDTO.REQ_JOIN_DENIED) {
+				    Site.important(i18n.t("Sorry this is a closed group"));
+				}
+				if (resultType == SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION) {
+				    Site.info(i18n.t("Requested. Waiting for admins decision"));
+				}
+			    }
+			});
+	    }
+	});
+
+	unJoinButton = new GridButton("images/del.gif", i18n.t("Unjoin"), i18n
+		.t("Don't participate more as a member in this group"), new Slot<String>() {
+	    public void onEvent(final String parameter) {
+		removeMemberAction();
+	    }
+	});
+    }
+
+    private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
+	final GridMenu<GroupDTO> menu = new GridMenu<GroupDTO>(group);
+	final String longName = group.getLongName();
+	final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageUtils
+		.getImageHtml(ImageDescriptor.groupDefIcon), longName, longName, " ", longName, i18n.t(
+		"User name: [%s]", group.getShortName()), menu);
+	if (otherOperations != null) {
+	    menu.addMenuItemList(otherOperations);
+	}
+	if (session.isLogged() && otherOperations != null) {
+	    menu.addMenuItemList(otherLoggedOperations);
+	}
+	return gridItem;
+    }
+
+    private void createMenuActions() {
+	gotoGroupMenuItem = new GridMenuItem<GroupDTO>("images/group-home.gif", i18n.t("Visit this group homepage"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO groupDTO) {
+			getStateManager().gotoToken(groupDTO.getShortName());
+		    }
+		});
+	gotoMemberMenuItem = new GridMenuItem<GroupDTO>("images/group-home.gif", i18n.t("Visit this member homepage"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO groupDTO) {
+			getStateManager().gotoToken(groupDTO.getShortName());
+		    }
+		});
+	unJoinMenuItem = new GridMenuItem<GroupDTO>("images/del.gif", i18n
+		.t("Don't participate more as a member in this group"), new Slot<GroupDTO>() {
+	    public void onEvent(final GroupDTO groupDTO) {
+		removeMemberAction(groupDTO);
+	    }
+	});
+	changeToCollabMenuItem = new GridMenuItem<GroupDTO>("images/arrow-down-green.gif", i18n
+		.t("Change to collaborator"), new Slot<GroupDTO>() {
+	    public void onEvent(final GroupDTO group) {
+		Site.showProgressProcessing();
+		snService.setCollabAsAdmin(session.getUserHash(), session.getCurrentState().getGroup().getShortName(),
+			group.getShortName(), new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+			    public void onSuccess(final SocialNetworkResultDTO result) {
+				Site.hideProgress();
+				Site.info(i18n.t("Type of member changed"));
+				getStateManager().setSocialNetwork(result);
+			    }
+			});
+	    }
+	});
+	removeMemberMenuItem = new GridMenuItem<GroupDTO>("images/del.gif", i18n.t("Remove this member"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO group) {
+			Site.showProgressProcessing();
+			snService.deleteMember(session.getUserHash(), session.getCurrentState().getGroup()
+				.getShortName(), group.getShortName(),
+				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+				    public void onSuccess(final SocialNetworkResultDTO result) {
+					Site.hideProgress();
+					Site.info(i18n.t("Member removed"));
+					getStateManager().reload();
+					// in the future, only if I cannot
+					// be affected:
+					// snService.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
+					// result);
+				    }
+				});
+		    }
+		});
+	changeToAdminMenuItem = new GridMenuItem<GroupDTO>("images/arrow-up-green.gif", i18n.t("Change to admin"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO group) {
+			Site.showProgressProcessing();
+			final SocialNetworkServiceAsync server = SocialNetworkService.App.getInstance();
+			server.addAdminMember(session.getUserHash(), session.getCurrentState().getGroup()
+				.getShortName(), group.getShortName(),
+				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+				    public void onSuccess(final SocialNetworkResultDTO result) {
+					Site.hideProgress();
+					Site.info(i18n.t("Member added as admin"));
+					getStateManager().setSocialNetwork(result);
+				    }
+				});
+		    }
+		});
+	acceptJoinGroupMenuItem = new GridMenuItem<GroupDTO>("images/accept.gif", i18n.t("Accept this member"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO group) {
+			Site.showProgressProcessing();
+			snService.AcceptJoinGroup(session.getUserHash(), session.getCurrentState().getGroup()
+				.getShortName(), group.getShortName(),
+				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+				    public void onSuccess(final SocialNetworkResultDTO result) {
+					Site.hideProgress();
+					Site.info(i18n.t("Member accepted"));
+					getStateManager().setSocialNetwork(result);
+				    }
+				});
+		    }
+		});
+	denyJoinGroupMenuItem = new GridMenuItem<GroupDTO>("images/cancel.gif", i18n.t("Don't accept this member"),
+		new Slot<GroupDTO>() {
+		    public void onEvent(final GroupDTO group) {
+			Site.showProgressProcessing();
+			final SocialNetworkServiceAsync server = SocialNetworkService.App.getInstance();
+			server.denyJoinGroup(session.getUserHash(),
+				session.getCurrentState().getGroup().getShortName(), group.getShortName(),
+				new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+				    public void onSuccess(final SocialNetworkResultDTO result) {
+					Site.hideProgress();
+					Site.info(i18n.t("Member rejected"));
+					getStateManager().setSocialNetwork(result);
+				    }
+				});
+		    }
+		});
+    }
+
+    private void removeMemberAction() {
+	removeMemberAction(session.getCurrentState().getGroup());
+    }
+
+    private void removeMemberAction(final GroupDTO groupDTO) {
+	Site.showProgressProcessing();
+	snService.unJoinGroup(session.getUserHash(), groupDTO.getShortName(),
+		new AsyncCallbackSimple<SocialNetworkResultDTO>() {
+		    public void onSuccess(final SocialNetworkResultDTO result) {
+			Site.hideProgress();
+			Site.info(i18n.t("Removed as member"));
+			getStateManager().reload();
+			// in the future with user info:
+			// services.stateManager.reloadSocialNetwork((SocialNetworkResultDTO)
+			// result);
+		    }
+		});
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/ParticipationSummaryPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/ParticipationSummaryPanel.java	2008-07-21 02:46:08 UTC (rev 811)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/ParticipationSummaryPanel.java	2008-07-21 14:30:36 UTC (rev 812)
@@ -19,54 +19,51 @@
  */
 package org.ourproject.kune.workspace.client.socialnet.ui;
 
-import org.ourproject.kune.platf.client.AbstractPresenter;
-import org.ourproject.kune.platf.client.PlatformEvents;
+import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.services.Images;
-import org.ourproject.kune.platf.client.ui.UIConstants;
-import org.ourproject.kune.platf.client.ui.stacks.StackSubItemAction;
-import org.ourproject.kune.platf.client.ui.stacks.StackedDropDownPanel;
-import org.ourproject.kune.workspace.client.WorkspaceEvents;
-import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummaryView;
-import org.ourproject.kune.workspace.client.socialnet.MemberAction;
+import org.ourproject.kune.platf.client.ui.DropDownPanel;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
+import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuPanel;
+import org.ourproject.kune.workspace.client.socialnet.ParticipationSummaryPresenter;
 import org.ourproject.kune.workspace.client.socialnet.ParticipationSummaryView;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.EntitySummary;
 import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
 
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
+import com.gwtext.client.widgets.BoxComponent;
+import com.gwtext.client.widgets.event.ContainerListenerAdapter;
 
-public class ParticipationSummaryPanel extends StackedDropDownPanel implements ParticipationSummaryView {
+public class ParticipationSummaryPanel extends DropDownPanel implements ParticipationSummaryView {
 
-    private static final boolean COUNTS_VISIBLE = false;
-    private final Images img = Images.App.getInstance();
+    private final GridMenuPanel<GroupDTO> gridMenuPanel;
 
-    public ParticipationSummaryPanel(final AbstractPresenter presenter, final I18nTranslationService i18n,
+    public ParticipationSummaryPanel(final ParticipationSummaryPresenter presenter, final I18nTranslationService i18n,
 	    final WorkspaceSkeleton ws) {
-	super(presenter, "#00D4AA", i18n.t("Participates as..."), i18n.t("Groups in which participates"),
-		COUNTS_VISIBLE);
+	super(true);
+	super.setHeaderText(i18n.t("Participates as..."));
+	super.setHeaderTitle(i18n.t("Groups in which participates"));
+	super.setBorderStylePrimaryName("k-dropdownouter-part");
+	super.addStyleName("kune-Margin-Medium-tl");
+	gridMenuPanel = new GridMenuPanel<GroupDTO>(i18n.t("This user is not member of any group"), true, false, false,
+		false, false);
+	final EntitySummary entitySummary = ws.getEntitySummary();
+	entitySummary.addInSummary(this);
+	entitySummary.addListener(new ContainerListenerAdapter() {
+	    @Override
+	    public void onResize(final BoxComponent component, final int adjWidth, final int adjHeight,
+		    final int rawWidth, final int rawHeight) {
+		gridMenuPanel.setWidth(adjWidth);
+	    }
+	});
+	this.setContent(gridMenuPanel);
 	ws.getEntitySummary().addInSummary(this);
     }
 
-    public void addCategory(final String name, final String title) {
-	super.addStackItem(name, title, COUNTS_VISIBLE);
+    public void addItem(final GridItem<GroupDTO> gridItem) {
+	gridMenuPanel.addItem(gridItem);
     }
 
-    public void addCategory(final String name, final String title, final String iconType) {
-	super.addStackItem(name, title, getIcon(iconType), UIConstants.ICON_HORIZ_ALIGN_RIGHT, COUNTS_VISIBLE);
-    }
-
-    public void addCategoryMember(final String categoryName, final String name, final String title,
-	    final MemberAction[] memberActions) {
-	final StackSubItemAction[] subItems = new StackSubItemAction[memberActions.length];
-	for (int i = 0; i < memberActions.length; i++) {
-	    subItems[i] = new StackSubItemAction(getIconFronEvent(memberActions[i].getAction()), memberActions[i]
-		    .getText(), memberActions[i].getAction());
-	}
-
-	super.addStackSubItem(categoryName, img.groupDefIcon(), name, title, subItems);
-    }
-
     public void clear() {
-	super.clear();
+	gridMenuPanel.removeAll();
     }
 
     public void hide() {
@@ -77,21 +74,4 @@
 	this.setVisible(true);
     }
 
-    private AbstractImagePrototype getIcon(final String event) {
-	if (event == GroupMembersSummaryView.ICON_ALERT) {
-	    return img.alert();
-	}
-	throw new IndexOutOfBoundsException("Icon unknown in ParticipationPanelk");
-    }
-
-    private AbstractImagePrototype getIconFronEvent(final String event) {
-	if (event == WorkspaceEvents.UNJOIN_GROUP) {
-	    return img.del();
-	}
-	if (event == PlatformEvents.GOTO) {
-	    return img.groupHome();
-	}
-	throw new IndexOutOfBoundsException("Event unknown in ParticipationPanel");
-    }
-
 }




More information about the kune-commits mailing list