[kune-commits] r981 - in trunk/src/main/java/org/ourproject/kune: platf/client/dto platf/client/services platf/server/domain platf/server/manager/impl platf/server/state workspace/client/entityheader workspace/client/options workspace/client/options/logo workspace/client/options/tools workspace/client/sitebar/siteusermenu workspace/client/socialnet

vjrj vjrj at ourproject.org
Thu Dec 4 15:34:36 CET 2008


Author: vjrj
Date: 2008-12-04 15:34:33 +0100 (Thu, 04 Dec 2008)
New Revision: 981

Modified:
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
   trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/options/tools/EntityOptionsToolsConfPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu/SiteUserMenuPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
Log:
Complete - task Logo/Avatar in SN 

Complete - task Gallery action order problem 


Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/GroupDTO.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -122,7 +122,7 @@
         return getHasLogo();
     }
 
-    public boolean isPersonalGroup() {
+    public boolean isPersonal() {
         return groupType.equals(GroupType.PERSONAL);
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -181,7 +181,7 @@
             @Override
             public SiteUserMenu create() {
                 final SiteUserMenuPresenter presenter = new SiteUserMenuPresenter($(Session.class),
-                        $(StateManager.class), $$(EntityOptions.class));
+                        $(StateManager.class), $$(EntityOptions.class), $$(FileDownloadUtils.class));
                 final SiteUserMenuPanel panel = new SiteUserMenuPanel(presenter, $(WorkspaceSkeleton.class),
                         $(I18nUITranslationService.class));
                 presenter.init(panel);
@@ -346,7 +346,7 @@
                         $(I18nUITranslationService.class), $(StateManager.class), $(ImageUtils.class),
                         $(Session.class), $$(SocialNetworkServiceAsync.class), $$(GroupServiceAsync.class),
                         $$(GroupLiveSearcher.class), $(WsThemePresenter.class), $$(ChatEngine.class),
-                        $(GroupActionRegistry.class), $(ActionGroupSummaryToolbar.class));
+                        $(GroupActionRegistry.class), $(ActionGroupSummaryToolbar.class), $$(FileDownloadUtils.class));
                 final GroupMembersSummaryView view = new GroupMembersSummaryPanel(presenter,
                         $(I18nUITranslationService.class), $(WorkspaceSkeleton.class), $(
                                 ActionGroupSummaryToolbar.class).getView());
@@ -388,7 +388,7 @@
                 final ParticipationSummaryPresenter presenter = new ParticipationSummaryPresenter(
                         $(I18nUITranslationService.class), $(StateManager.class), $(ImageUtils.class),
                         $(Session.class), $$(SocialNetworkServiceAsync.class), $(WsThemePresenter.class),
-                        $(GroupActionRegistry.class), $(ActionParticipationToolbar.class));
+                        $(GroupActionRegistry.class), $(ActionParticipationToolbar.class), $$(FileDownloadUtils.class));
                 final ParticipationSummaryView view = new ParticipationSummaryPanel(presenter,
                         $(I18nUITranslationService.class), $(WorkspaceSkeleton.class),
                         ($(ActionParticipationToolbar.class).getView()));

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -262,6 +262,10 @@
         return (logo != null && logo.length > 0 && logoMime != null);
     }
 
+    public boolean isPersonal() {
+        return getGroupType().equals(GroupType.PERSONAL);
+    }
+
     public void setAdmissionType(final AdmissionType admissionType) {
         this.admissionType = admissionType;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -139,7 +139,7 @@
         final Long groupId = group.getId();
         final List<Group> adminInGroups = finder.findAdminInGroups(groupId);
         // Don't show self user group
-        if (group.getGroupType().equals(GroupType.PERSONAL)) {
+        if (group.isPersonal()) {
             adminInGroups.remove(group);
         }
         // adminInGroups.remove(userLogged.getUserGroup());
@@ -162,7 +162,7 @@
         socialNetData.setGroupRights(groupRights);
         socialNetData.setUserParticipation(findParticipation(userLogged, group));
         socialNetData.setGroupMembers(get(userLogged, group));
-        if (group.getGroupType().equals(GroupType.PERSONAL)) {
+        if (group.isPersonal()) {
             UserBuddiesData userBuddies = userManager.getUserBuddies(group.getShortName());
             User userGroup = userManager.findByShortname(group.getShortName());
             socialNetData.setUserBuddies(userBuddies);
@@ -327,7 +327,7 @@
     }
 
     private void throwGroupMemberException(final Group group) throws DefaultException {
-        if (group.getGroupType().equals(GroupType.PERSONAL)) {
+        if (group.isPersonal()) {
             throw new AlreadyUserMemberException();
         } else {
             throw new AlreadyGroupMemberException();

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/state/StateServiceDefault.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -19,7 +19,6 @@
  */
 package org.ourproject.kune.platf.server.state;
 
-import org.ourproject.kune.platf.client.dto.GroupType;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
 import org.ourproject.kune.platf.server.access.AccessRightsService;
 import org.ourproject.kune.platf.server.content.ContentManager;
@@ -109,7 +108,7 @@
 
     public StateNoContent createNoHome(User userLogged, String groupShortName) {
         Group group = groupManager.findByShortName(groupShortName);
-        assert (group.getGroupType().equals(GroupType.PERSONAL));
+        assert (group.isPersonal());
         StateNoContent state = new StateNoContent();
         state.setGroup(group);
         state.setEnabledTools(groupManager.findEnabledTools(group.getId()));

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPanel.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -42,8 +42,9 @@
     private final Images images;
     private final VerticalPanel vp;
 
-    public EntityHeaderPanel(final WorkspaceSkeleton ws, final Provider<FileDownloadUtils> dowloadProvider, Images images) {
-        this.downloadProvider = dowloadProvider;
+    public EntityHeaderPanel(final WorkspaceSkeleton ws, final Provider<FileDownloadUtils> downloadProvider,
+            Images images) {
+        this.downloadProvider = downloadProvider;
         this.images = images;
         vp = new VerticalPanel();
         vp.setWidth("100%");

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -21,7 +21,6 @@
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.dto.ContentSimpleDTO;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.GroupType;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.themes.WsTheme;
@@ -77,7 +76,7 @@
             view.setLogoImageVisible(true);
         } else {
             setLogoText(group.getLongName());
-            if (group.getGroupType().equals(GroupType.PERSONAL)) {
+            if (group.isPersonal()) {
                 view.showDefUserLogo();
                 view.setLogoImageVisible(true);
             } else {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -19,7 +19,7 @@
 
     class EntityOptionPushButton extends IconLabel implements View {
         public EntityOptionPushButton(String text, AbstractImagePrototype icon) {
-            super(text, icon);
+            super(text, icon, false);
         }
     }
     public static final String GROUP_OPTIONS_ERROR_ID = "k-gop-err-mess";
@@ -66,16 +66,18 @@
 
     public void setGroupTitle() {
         super.setTitle(i18n.t(PlatfMessages.ENT_OPTIONS_GROUP_TITLE));
-        optionsButton.setTitle(i18n.t("Configure this group preferences"));
+        optionsButton.setText(i18n.t(PlatfMessages.ENT_OPTIONS_GROUP_TITLE));
+        // optionsButton.setTitle(i18n.t("Configure this group preferences"));
     }
 
     public void setPersonalTitle() {
         super.setTitle(i18n.t(PlatfMessages.ENT_OPTIONS_USER_TITLE));
-        optionsButton.setTitle(i18n.t("Configure your preferences"));
+        optionsButton.setText(i18n.t(PlatfMessages.ENT_OPTIONS_USER_TITLE));
+        // optionsButton.setTitle(i18n.t("Configure your preferences"));
     }
 
     private void createOptionsButton() {
-        optionsButton = new EntityOptionPushButton(i18n.t("Configure"), images.emblemSystem());
+        optionsButton = new EntityOptionPushButton("", images.emblemSystem());
         optionsButton.addClickListener(new ClickListener() {
             public void onClick(Widget arg0) {
                 createAndShow();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -14,7 +14,7 @@
     public EntityOptionsPresenter(StateManager stateManager) {
         stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
             public void onEvent(StateAbstractDTO state) {
-                if (state.getGroup().isPersonalGroup()) {
+                if (state.getGroup().isPersonal()) {
                     view.setPersonalTitle();
                 } else {
                     view.setGroupTitle();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -66,7 +66,7 @@
 
     private void setState() {
         view.setUploadParams(session.getUserHash(), session.getCurrentStateToken().toString());
-        if (session.getCurrentState().getGroup().isPersonalGroup()) {
+        if (session.getCurrentState().getGroup().isPersonal()) {
             view.setPersonalGroupsLabels();
         } else {
             view.setNormalGroupsLabels();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/tools/EntityOptionsToolsConfPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/tools/EntityOptionsToolsConfPresenter.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/tools/EntityOptionsToolsConfPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -82,7 +82,7 @@
         StateAbstractDTO state = session.getCurrentState();
         reset();
         Collection<ToolSimpleDTO> toolCollection;
-        if (state.getGroup().isPersonalGroup()) {
+        if (state.getGroup().isPersonal()) {
             toolCollection = session.getUserTools();
         } else {
             toolCollection = session.getGroupTools();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu/SiteUserMenuPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu/SiteUserMenuPresenter.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteusermenu/SiteUserMenuPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -25,6 +25,7 @@
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.platf.client.ui.MenuItem;
 import org.ourproject.kune.platf.client.ui.MenuItemCollection;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.workspace.client.options.EntityOptions;
 
 import com.calclab.suco.client.ioc.Provider;
@@ -38,12 +39,14 @@
     private final StateManager stateManager;
     private final Session session;
     private final Provider<EntityOptions> entityOptions;
+    private final Provider<FileDownloadUtils> downloadProvider;
 
     public SiteUserMenuPresenter(final Session session, final StateManager stateManager,
-            final Provider<EntityOptions> entityOptions) {
+            final Provider<EntityOptions> entityOptions, final Provider<FileDownloadUtils> downloadProvider) {
         this.session = session;
         this.stateManager = stateManager;
         this.entityOptions = entityOptions;
+        this.downloadProvider = downloadProvider;
         participateInGroups = new MenuItemCollection<GroupDTO>();
         session.onUserSignIn(new Listener<UserInfoDTO>() {
             public void onEvent(final UserInfoDTO userInfoDTO) {
@@ -77,12 +80,13 @@
     }
 
     private void addPartipation(final GroupDTO group) {
-        participateInGroups.add(new MenuItem<GroupDTO>("images/group-def-icon.gif", group.getShortName(),
-                new Listener<GroupDTO>() {
-                    public void onEvent(final GroupDTO param) {
-                        stateManager.gotoToken(group.getShortName());
-                    }
-                }));
+        String logoImageUrl = group.hasLogo() ? downloadProvider.get().getLogoImageUrl(group.getStateToken())
+                : "images/group-def-icon.gif";
+        participateInGroups.add(new MenuItem<GroupDTO>(logoImageUrl, group.getShortName(), new Listener<GroupDTO>() {
+            public void onEvent(final GroupDTO param) {
+                stateManager.gotoToken(group.getShortName());
+            }
+        }));
     }
 
     private void onUserSignIn(final UserInfoDTO userInfoDTO) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -32,7 +32,6 @@
 import org.ourproject.kune.platf.client.actions.toolbar.ActionBuddiesSummaryToolbar;
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
 import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import org.ourproject.kune.platf.client.dto.GroupType;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.UserBuddiesDataDTO;
 import org.ourproject.kune.platf.client.dto.UserBuddiesVisibilityDTO;
@@ -94,7 +93,7 @@
     }
 
     protected void setState(StateAbstractDTO state) {
-        if (state.getGroup().getGroupType().equals(GroupType.PERSONAL)) {
+        if (state.getGroup().isPersonal()) {
             view.clear();
             UserBuddiesDataDTO userBuddies = state.getUserBuddies();
             if (state.getSocialNetworkData().isBuddiesVisible()) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -29,7 +29,6 @@
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
 import org.ourproject.kune.platf.client.dto.AccessRolDTO;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.GroupType;
 import org.ourproject.kune.platf.client.dto.InitDataDTO;
 import org.ourproject.kune.platf.client.dto.LinkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
@@ -45,6 +44,7 @@
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.platf.client.ui.MenuItem;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.search.GroupLiveSearcher;
@@ -77,8 +77,8 @@
             final Provider<GroupServiceAsync> groupServiceProvider,
             final Provider<GroupLiveSearcher> liveSearcherProvider, final WsThemePresenter wsThemePresenter,
             final Provider<ChatEngine> chatEngineProvider, final GroupActionRegistry groupActionRegistry,
-            final ActionGroupSummaryToolbar toolbar) {
-        super(i18n, stateManager, imageUtils, session, snServiceProvider, groupActionRegistry);
+            final ActionGroupSummaryToolbar toolbar, final Provider<FileDownloadUtils> downloadProvider) {
+        super(i18n, stateManager, imageUtils, session, snServiceProvider, groupActionRegistry, downloadProvider);
         this.i18n = i18n;
         this.stateManager = stateManager;
         this.session = session;
@@ -229,7 +229,7 @@
     }
 
     private void setState(final StateAbstractDTO state) {
-        if (state.getGroup().getGroupType().equals(GroupType.PERSONAL)) {
+        if (state.getGroup().isPersonal()) {
             view.setVisible(false);
         } else {
             if (state.getSocialNetworkData().isMembersVisible()) {

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-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -31,6 +31,7 @@
 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.download.FileDownloadUtils;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.themes.WsTheme;
@@ -50,8 +51,9 @@
     public ParticipationSummaryPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
             final ImageUtils imageUtils, final Session session,
             final Provider<SocialNetworkServiceAsync> snServiceProvider, final WsThemePresenter wsThemePresenter,
-            GroupActionRegistry groupActionRegistry, ActionParticipationToolbar actionParticipationToolbar) {
-        super(i18n, stateManager, imageUtils, session, snServiceProvider, groupActionRegistry);
+            GroupActionRegistry groupActionRegistry, ActionParticipationToolbar actionParticipationToolbar,
+            final Provider<FileDownloadUtils> downloadProvider) {
+        super(i18n, stateManager, imageUtils, session, snServiceProvider, groupActionRegistry, downloadProvider);
         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"),

Modified: 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-12-03 11:25:34 UTC (rev 980)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java	2008-12-04 14:34:33 UTC (rev 981)
@@ -26,9 +26,8 @@
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
 import org.ourproject.kune.platf.client.dto.AccessRolDTO;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkRequestResult;
-import org.ourproject.kune.platf.client.dto.SocialNetworkDataDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync;
@@ -38,6 +37,7 @@
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.platf.client.ui.MenuItem;
 import org.ourproject.kune.platf.client.ui.MenuItemCollection;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
 import org.ourproject.kune.platf.client.ui.gridmenu.CustomMenu;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridItem;
@@ -49,6 +49,8 @@
 
 public class SocialNetworkPresenter {
 
+    private static final int ICOSIZE = 16;
+    private static final int THUMBSIZE = 50;
     protected MenuItem<GroupDTO> changeToCollabMenuItem;
     protected MenuItem<GroupDTO> removeMemberMenuItem;
     protected MenuItem<GroupDTO> changeToAdminMenuItem;
@@ -69,22 +71,24 @@
 
     protected ActionToolbarMenuDescriptor<StateToken> unJoin;
     protected ActionToolbarButtonDescriptor<StateToken> participate;
+    private final Provider<FileDownloadUtils> downloadProvider;
 
     public SocialNetworkPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
             final ImageUtils imageUtils, final Session session,
-            final Provider<SocialNetworkServiceAsync> snServiceProvider, GroupActionRegistry groupActionRegistry) {
+            final Provider<SocialNetworkServiceAsync> snServiceProvider, GroupActionRegistry groupActionRegistry,
+            final Provider<FileDownloadUtils> downloadProvider) {
         this.i18n = i18n;
         this.stateManager = stateManager;
         this.imageUtils = imageUtils;
         this.session = session;
         this.snServiceProvider = snServiceProvider;
+        this.downloadProvider = downloadProvider;
         createButtons();
         createMenuActions();
         otherOperationsUsers = new MenuItemCollection<GroupDTO>();
         otherLoggedOperationsUsers = new MenuItemCollection<GroupDTO>();
         otherOperations = new MenuItemCollection<GroupDTO>();
         otherLoggedOperations = new MenuItemCollection<GroupDTO>();
-
     }
 
     public void addGroupOperation(final MenuItem<GroupDTO> operation, final boolean mustBeLogged) {
@@ -187,29 +191,46 @@
     private GridItem<GroupDTO> createDefMemberMenu(final GroupDTO group, final GridGroup gridGroup) {
         final CustomMenu<GroupDTO> menu = new CustomMenu<GroupDTO>(group);
         final String longName = group.getLongName();
-        boolean isPersonal = group.getGroupType().equals(GroupType.PERSONAL);
-        final String toolTip = i18n.t(isPersonal ? "User nickname: [%s]" : "Group short name: [%s]",
-                group.getShortName());
-        final String imageHtml = isPersonal ? imageUtils.getImageHtml(ImageDescriptor.personDef)
-                : imageUtils.getImageHtml(ImageDescriptor.groupDefIcon);
+        boolean hasLogo = group.hasLogo();
+        final String toolTip = createTooltipWithLogo(group, hasLogo);
+        final String imageHtml = createLogoAvatar(group.getStateToken(), hasLogo, group.isPersonal(), ICOSIZE, 0);
         final GridItem<GroupDTO> gridItem = new GridItem<GroupDTO>(group, gridGroup, group.getShortName(), imageHtml,
                 longName, longName, " ", longName, toolTip, menu);
-        if (!isPersonal) {
+        if (!group.isPersonal()) {
             menu.addMenuItemList(otherOperations);
         }
-        if (session.isLogged() && !isPersonal) {
+        if (session.isLogged() && !group.isPersonal()) {
             menu.addMenuItemList(otherLoggedOperations);
         }
-        if (isPersonal) {
+        if (group.isPersonal()) {
             menu.addMenuItemList(otherOperationsUsers);
         }
-        if (session.isLogged() && isPersonal) {
+        if (session.isLogged() && group.isPersonal()) {
             menu.addMenuItemList(otherLoggedOperationsUsers);
         }
 
         return gridItem;
     }
 
+    private String createTooltipWithLogo(final GroupDTO group, boolean hasLogo) {
+        return "<table><tr><td>"
+                + (hasLogo ? createLogoAvatar(group.getStateToken(), hasLogo, group.isPersonal(), THUMBSIZE, 3) : "")
+                + "</td><td>"
+                + i18n.t(group.isPersonal() ? "Nickname: [%s]" : "Group short name: [%s]", group.getShortName())
+                + "</td></tr></table>";
+    }
+
+    private String createLogoAvatar(StateToken groupToken, boolean groupHasLogo, boolean isPersonal, int size,
+            int hvspace) {
+        if (groupHasLogo) {
+            return "<img hspace='" + hvspace + "' vspace='" + hvspace + "' align='left' style='width: " + size
+                    + "px; height: " + size + "px;' src='" + downloadProvider.get().getLogoImageUrl(groupToken) + "'>";
+        } else {
+            return isPersonal ? imageUtils.getImageHtml(ImageDescriptor.personDef)
+                    : imageUtils.getImageHtml(ImageDescriptor.groupDefIcon);
+        }
+    }
+
     private void createMenuActions() {
         gotoGroupMenuItem = new MenuItem<GroupDTO>("images/group-home.gif", i18n.t("Visit this group homepage"),
                 new Listener<GroupDTO>() {




More information about the kune-commits mailing list