[kune-commits] r803 - in trunk/src/main/java/org/ourproject/kune:
platf/client/services platf/client/state platf/client/ui
platf/client/ui/gridmenu workspace/client/socialnet
workspace/client/ui/newtmp/skel workspace/client/workspace
vjrj
vjrj at ourproject.org
Sun Jul 20 03:51:18 CEST 2008
Author: vjrj
Date: 2008-07-20 03:51:06 +0200 (Sun, 20 Jul 2008)
New Revision: 803
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDragConfiguration.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridItem.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItem.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItemCollection.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.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/GroupMembersSummaryViewNew.java
Modified:
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java
trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupMembersSummary.java
Log:
new GridMenuPanel and GroupMembersSummary
Added: trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.client.services;
+
+public enum ImageDescriptor {
+ accept, add, addGreen, alert, anybody, arrowDownBlack, arrowDownGreen, arrowDownWhite, arrowLeftGreen, arrowRightBlack, arrowRightGreen, arrowRightWhite, arrowUpGreen, bulletAdd, bulletBlack, bulletBlue, bulletDelete, bulletGreen, bulletPink, bulletPurple, bulletRed, bulletStar, bulletToggleMinus, bulletTogglePlus, bulletYellow, button15cblue, button15cdark, button15clight, button15cxlight, button15lblue, button15ldark, button15llight, button15lxlight, button15rblue, button15rdark, button15rlight, button15rxlight, button17cblue, button17cdark, button17clight, button17cxlight, button17lblue, button17ldark, button17llight, button17lxlight, button17rblue, button17rdark, button17rlight, button17rxlight, button20cblue, button20cdark, button20clight, button20cxlight, button20lblue, button20ldark, button20llight, button20lxlight, button20rblue, button20rdark, button20rlight, button20rxlight, buttonArrowDown, buttonHelpBlue, buttonHelpDark, buttonHelpLight, buttonSitebarArrowDown, by80x15, bync80x15, byncnd80x15, byncsa80x15, bynd80x15, bysa80x15, cancel, chat, clear, copyleft, cross, crossDark, del, emblemImportant, error, everybody, fullscreen, gnuFdl, groupDefIcon, groupHome, important, info, infoLight, kuneClose, kuneExternalWindow, kuneHelpTranslationIcon, kuneIcon16, kuneLogo16px, kunePreferences, kuneSearchIco, kuneSearchIcoPush, language, nobody, noCopyleft, nt, opentriangle, personDef, remove, rssIcon, searchIco, spinKuneThundGreen, splitterVertBar, star10, star20, star30, star40, star50, star60, star70, star80, star90, starGrey, starSmallYellow, starVsmallYellow, starYellow, step1, step2, step3, step4, step5, themeChoose, triangle
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,402 @@
+package org.ourproject.kune.platf.client.services;
+
+import com.google.gwt.user.client.ui.AbstractImagePrototype;
+
+public class ImageUtils {
+
+ public AbstractImagePrototype getImage(final ImageDescriptor imageDescriptor) {
+ final Images img = Images.App.getInstance();
+ switch (imageDescriptor) {
+ case accept: {
+ return img.accept();
+ }
+ case add: {
+ return img.add();
+ }
+ case addGreen: {
+ return img.addGreen();
+ }
+ case alert: {
+ return img.alert();
+ }
+ case anybody: {
+ return img.anybody();
+ }
+ case arrowDownBlack: {
+ return img.arrowDownBlack();
+ }
+ case arrowDownGreen: {
+ return img.arrowDownGreen();
+ }
+ case arrowDownWhite: {
+ return img.arrowDownWhite();
+ }
+ case arrowLeftGreen: {
+ return img.arrowLeftGreen();
+ }
+ case arrowRightBlack: {
+ return img.arrowRightBlack();
+ }
+ case arrowRightGreen: {
+ return img.arrowRightGreen();
+ }
+ case arrowRightWhite: {
+ return img.arrowRightWhite();
+ }
+ case arrowUpGreen: {
+ return img.arrowUpGreen();
+ }
+ case bulletAdd: {
+ return img.bulletAdd();
+ }
+ case bulletBlack: {
+ return img.bulletBlack();
+ }
+ case bulletBlue: {
+ return img.bulletBlue();
+ }
+ case bulletDelete: {
+ return img.bulletDelete();
+ }
+ case bulletGreen: {
+ return img.bulletGreen();
+ }
+ case bulletPink: {
+ return img.bulletPink();
+ }
+ case bulletPurple: {
+ return img.bulletPurple();
+ }
+ case bulletRed: {
+ return img.bulletRed();
+ }
+ case bulletStar: {
+ return img.bulletStar();
+ }
+ case bulletToggleMinus: {
+ return img.bulletToggleMinus();
+ }
+ case bulletTogglePlus: {
+ return img.bulletTogglePlus();
+ }
+ case bulletYellow: {
+ return img.bulletYellow();
+ }
+ case button15cblue: {
+ return img.button15cblue();
+ }
+ case button15cdark: {
+ return img.button15cdark();
+ }
+ case button15clight: {
+ return img.button15clight();
+ }
+ case button15cxlight: {
+ return img.button15cxlight();
+ }
+ case button15lblue: {
+ return img.button15lblue();
+ }
+ case button15ldark: {
+ return img.button15ldark();
+ }
+ case button15llight: {
+ return img.button15llight();
+ }
+ case button15lxlight: {
+ return img.button15lxlight();
+ }
+ case button15rblue: {
+ return img.button15rblue();
+ }
+ case button15rdark: {
+ return img.button15rdark();
+ }
+ case button15rlight: {
+ return img.button15rlight();
+ }
+ case button15rxlight: {
+ return img.button15rxlight();
+ }
+ case button17cblue: {
+ return img.button17cblue();
+ }
+ case button17cdark: {
+ return img.button17cdark();
+ }
+ case button17clight: {
+ return img.button17clight();
+ }
+ case button17cxlight: {
+ return img.button17cxlight();
+ }
+ case button17lblue: {
+ return img.button17lblue();
+ }
+ case button17ldark: {
+ return img.button17ldark();
+ }
+ case button17llight: {
+ return img.button17llight();
+ }
+ case button17lxlight: {
+ return img.button17lxlight();
+ }
+ case button17rblue: {
+ return img.button17rblue();
+ }
+ case button17rdark: {
+ return img.button17rdark();
+ }
+ case button17rlight: {
+ return img.button17rlight();
+ }
+ case button17rxlight: {
+ return img.button17rxlight();
+ }
+ case button20cblue: {
+ return img.button20cblue();
+ }
+ case button20cdark: {
+ return img.button20cdark();
+ }
+ case button20clight: {
+ return img.button20clight();
+ }
+ case button20cxlight: {
+ return img.button20cxlight();
+ }
+ case button20lblue: {
+ return img.button20lblue();
+ }
+ case button20ldark: {
+ return img.button20ldark();
+ }
+ case button20llight: {
+ return img.button20llight();
+ }
+ case button20lxlight: {
+ return img.button20lxlight();
+ }
+ case button20rblue: {
+ return img.button20rblue();
+ }
+ case button20rdark: {
+ return img.button20rdark();
+ }
+ case button20rlight: {
+ return img.button20rlight();
+ }
+ case button20rxlight: {
+ return img.button20rxlight();
+ }
+ case buttonArrowDown: {
+ return img.buttonArrowDown();
+ }
+ case buttonHelpBlue: {
+ return img.buttonHelpBlue();
+ }
+ case buttonHelpDark: {
+ return img.buttonHelpDark();
+ }
+ case buttonHelpLight: {
+ return img.buttonHelpLight();
+ }
+ case buttonSitebarArrowDown: {
+ return img.buttonSitebarArrowDown();
+ }
+ case by80x15: {
+ return img.by80x15();
+ }
+ case bync80x15: {
+ return img.bync80x15();
+ }
+ case byncnd80x15: {
+ return img.byncnd80x15();
+ }
+ case byncsa80x15: {
+ return img.byncsa80x15();
+ }
+ case bynd80x15: {
+ return img.bynd80x15();
+ }
+ case bysa80x15: {
+ return img.bysa80x15();
+ }
+ case cancel: {
+ return img.cancel();
+ }
+ case chat: {
+ return img.chat();
+ }
+ case clear: {
+ return img.clear();
+ }
+ case copyleft: {
+ return img.copyleft();
+ }
+ case cross: {
+ return img.cross();
+ }
+ case crossDark: {
+ return img.crossDark();
+ }
+ case del: {
+ return img.del();
+ }
+ case emblemImportant: {
+ return img.emblemImportant();
+ }
+ case error: {
+ return img.error();
+ }
+ case everybody: {
+ return img.everybody();
+ }
+ case fullscreen: {
+ return img.fullscreen();
+ }
+ case gnuFdl: {
+ return img.gnuFdl();
+ }
+ case groupDefIcon: {
+ return img.groupDefIcon();
+ }
+ case groupHome: {
+ return img.groupHome();
+ }
+ case important: {
+ return img.important();
+ }
+ case info: {
+ return img.info();
+ }
+ case infoLight: {
+ return img.infoLight();
+ }
+ case kuneClose: {
+ return img.kuneClose();
+ }
+ case kuneExternalWindow: {
+ return img.kuneExternalWindow();
+ }
+ case kuneHelpTranslationIcon: {
+ return img.kuneHelpTranslationIcon();
+ }
+ case kuneIcon16: {
+ return img.kuneIcon16();
+ }
+ case kuneLogo16px: {
+ return img.kuneLogo16px();
+ }
+ case kunePreferences: {
+ return img.kunePreferences();
+ }
+ case kuneSearchIco: {
+ return img.kuneSearchIco();
+ }
+ case kuneSearchIcoPush: {
+ return img.kuneSearchIcoPush();
+ }
+ case language: {
+ return img.language();
+ }
+ case nobody: {
+ return img.nobody();
+ }
+ case noCopyleft: {
+ return img.noCopyleft();
+ }
+ case nt: {
+ return img.nt();
+ }
+ case opentriangle: {
+ return img.opentriangle();
+ }
+ case personDef: {
+ return img.personDef();
+ }
+ case remove: {
+ return img.remove();
+ }
+ case rssIcon: {
+ return img.rssIcon();
+ }
+ case searchIco: {
+ return img.searchIco();
+ }
+ case spinKuneThundGreen: {
+ return img.spinKuneThundGreen();
+ }
+ case splitterVertBar: {
+ return img.splitterVertBar();
+ }
+ case star10: {
+ return img.star10();
+ }
+ case star20: {
+ return img.star20();
+ }
+ case star30: {
+ return img.star30();
+ }
+ case star40: {
+ return img.star40();
+ }
+ case star50: {
+ return img.star50();
+ }
+ case star60: {
+ return img.star60();
+ }
+ case star70: {
+ return img.star70();
+ }
+ case star80: {
+ return img.star80();
+ }
+ case star90: {
+ return img.star90();
+ }
+ case starGrey: {
+ return img.starGrey();
+ }
+ case starSmallYellow: {
+ return img.starSmallYellow();
+ }
+ case starVsmallYellow: {
+ return img.starVsmallYellow();
+ }
+ case starYellow: {
+ return img.starYellow();
+ }
+ case step1: {
+ return img.step1();
+ }
+ case step2: {
+ return img.step2();
+ }
+ case step3: {
+ return img.step3();
+ }
+ case step4: {
+ return img.step4();
+ }
+ case step5: {
+ return img.step5();
+ }
+ case themeChoose: {
+ return img.themeChoose();
+ }
+ case triangle: {
+ return img.triangle();
+ }
+ default:
+ return null;
+ }
+ }
+
+ public String getImageHtml(final ImageDescriptor imageDescriptor) {
+ return getImage(imageDescriptor).getHTML();
+ }
+}
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-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -11,6 +11,7 @@
import org.ourproject.kune.platf.client.extend.ExtensibleWidgetsManager;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.ContentService;
+import org.ourproject.kune.platf.client.rpc.SocialNetworkService;
import org.ourproject.kune.platf.client.state.ContentProviderImpl;
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.SessionImpl;
@@ -23,11 +24,11 @@
import org.ourproject.kune.workspace.client.search.SiteSearcherPresenter;
import org.ourproject.kune.workspace.client.search.SiteSearcherView;
import org.ourproject.kune.workspace.client.sitebar.Site;
-import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummaryPresenter;
-import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummaryView;
+import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummaryPanelNew;
+import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummaryPresenterNew;
+import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummaryViewNew;
import org.ourproject.kune.workspace.client.socialnet.ParticipationSummaryPresenter;
import org.ourproject.kune.workspace.client.socialnet.ParticipationSummaryView;
-import org.ourproject.kune.workspace.client.socialnet.ui.GroupMembersSummaryPanel;
import org.ourproject.kune.workspace.client.socialnet.ui.ParticipationSummaryPanel;
import org.ourproject.kune.workspace.client.summary.GroupSummaryPresenter;
import org.ourproject.kune.workspace.client.summary.GroupSummaryView;
@@ -98,6 +99,12 @@
}
}, SingletonScope.class);
+ builder.registerProvider(ImageUtils.class, new Provider<ImageUtils>() {
+ public ImageUtils get() {
+ return new ImageUtils();
+ }
+ }, SingletonScope.class);
+
final I18nUITranslationService i18n = builder.getInstance(I18nUITranslationService.class);
builder.registerProvider(KuneErrorHandler.class, new Provider<KuneErrorHandler>() {
public KuneErrorHandler get() {
@@ -220,6 +227,7 @@
builder.registerProvider(WorkspaceManager.class, new Provider<WorkspaceManager>() {
public WorkspaceManager get() {
+ // TODO: use here providers instead of getInstance
final WorkspaceManager presenter = new WorkspaceManager(builder.getInstance(EntityLogo.class), builder
.getInstance(EntityTitlePresenter.class), builder.getInstance(EntitySubTitlePresenter.class),
builder.getInstance(WsThemePresenter.class), builder.getInstance(EntityLicensePresenter.class),
@@ -232,8 +240,10 @@
builder.registerProvider(GroupMembersSummary.class, new Provider<GroupMembersSummary>() {
public GroupMembersSummary get() {
- final GroupMembersSummaryPresenter presenter = new GroupMembersSummaryPresenter(i18n);
- final GroupMembersSummaryView view = new GroupMembersSummaryPanel(presenter, i18n, ws);
+ final GroupMembersSummaryPresenterNew presenter = new GroupMembersSummaryPresenterNew(i18n, builder
+ .getProvider(StateManager.class), builder.getInstance(ImageUtils.class), builder
+ .getInstance(Session.class), SocialNetworkService.App.getInstance());
+ final GroupMembersSummaryViewNew view = new GroupMembersSummaryPanelNew(presenter, i18n, ws);
presenter.init(view);
return presenter;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -28,14 +28,16 @@
public interface StateManager extends HistoryListener {
+ void gotoToken(String token);
+
void reload();
- void setSocialNetwork(SocialNetworkResultDTO socialNet);
+ void reloadContextAndTitles();
void setRetrievedState(StateDTO content);
+ void setSocialNetwork(SocialNetworkResultDTO socialNet);
+
void setState(StateToken state);
- void reloadContextAndTitles();
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -56,6 +56,10 @@
this.oldState = null;
}
+ public void gotoToken(final String token) {
+ setState(new StateToken(token));
+ }
+
public void onHistoryChanged(final String historyToken) {
String oldStateEncoded = "";
if (oldState != null) {
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDragConfiguration.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDragConfiguration.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDragConfiguration.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,42 @@
+/*
+ *
+ * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library
+ *
+ * (c) 2008 The emite development team (see CREDITS for details)
+ * This file is part of emite.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+public class GridDragConfiguration {
+
+ private final String ddGroupId;
+ private final String dragMessage;
+
+ public GridDragConfiguration(final String ddGroupId, final String dragMessage) {
+ this.ddGroupId = ddGroupId;
+ this.dragMessage = dragMessage;
+ }
+
+ public String getDdGroupId() {
+ return ddGroupId;
+ }
+
+ public String getDragMessage() {
+ return dragMessage;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,50 @@
+/*
+ *
+ * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library
+ *
+ * (c) 2008 The emite development team (see CREDITS for details)
+ * This file is part of emite.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+import com.calclab.suco.client.signal.Signal;
+import com.calclab.suco.client.signal.Slot;
+
+public class GridDropConfiguration {
+
+ private final String ddGroupId;
+ private final Signal<String> onDrop;
+
+ public GridDropConfiguration(final String ddGroupId, final Slot<String> slot) {
+ this.ddGroupId = ddGroupId;
+ this.onDrop = new Signal<String>("onDrop");
+ this.onDrop(slot);
+ }
+
+ public void fire(final String id) {
+ onDrop.fire(id);
+ }
+
+ public String getDdGroupId() {
+ return ddGroupId;
+ }
+
+ public void onDrop(final Slot<String> slot) {
+ onDrop.add(slot);
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,69 @@
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+public class GridGroup {
+
+ public static GridGroup NoGridGroup = new GridGroup("", "", "", "", false);
+
+ private String name;
+ private String tooltipTitle;
+ private String tooltip;
+ private String endIconHtml;
+
+ public GridGroup(final String adminsTitle, final String tooltipTitle, final String tooltip,
+ final boolean countVisible) {
+ this(adminsTitle, tooltipTitle, tooltip, "", countVisible);
+ }
+
+ public GridGroup(final String name, final String tooltipTitle, final String tooltip, final String endIconHtml,
+ final boolean countVisible) {
+ this.name = name;
+ this.tooltipTitle = tooltipTitle;
+ this.tooltip = tooltip;
+ this.endIconHtml = endIconHtml;
+ }
+
+ GridGroup(final String adminsTitle) {
+ this(adminsTitle, "", "", false);
+ }
+
+ GridGroup(final String adminsTitle, final String tooltip) {
+ this(adminsTitle, "", tooltip, false);
+ }
+
+ GridGroup(final String adminsTitle, final String tooltipTitle, final String tooltip) {
+ this(adminsTitle, tooltipTitle, tooltip, false);
+ }
+
+ public String getEndIconHtml() {
+ return endIconHtml;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getTooltip() {
+ return tooltip;
+ }
+
+ public String getTooltipTitle() {
+ return tooltipTitle;
+ }
+
+ public void setEndIconHtml(final String endIconHtml) {
+ this.endIconHtml = endIconHtml;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public void setTooltip(final String tooltip) {
+ this.tooltip = tooltip;
+ }
+
+ public void setTooltipTitle(final String tooltipTitle) {
+ this.tooltipTitle = tooltipTitle;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridItem.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridItem.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,111 @@
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+public class GridItem<T> {
+
+ private GridGroup group;
+ private String id;
+ private String iconHtml;
+ private String title;
+ private String titleHtml;
+ private String endIconHtml;
+ private String tooltip;
+ private String tooltipTitle;
+ private T item;
+ private GridMenu<T> menu;
+
+ public GridItem(final T item, final GridGroup group, final String id, final String iconHtml, final String title,
+ final String titleHtml, final String endIconHtml, final String tooltipTitle, final String tooltip,
+ final GridMenu<T> menu) {
+ this.item = item;
+ this.group = group;
+ this.id = id;
+ this.iconHtml = iconHtml;
+ this.title = title;
+ this.titleHtml = titleHtml;
+ this.endIconHtml = endIconHtml;
+ this.tooltip = tooltip;
+ this.tooltipTitle = tooltipTitle;
+ this.menu = menu;
+ }
+
+ public String getEndIconHtml() {
+ return endIconHtml;
+ }
+
+ public GridGroup getGroup() {
+ return group;
+ }
+
+ public String getIconHtml() {
+ return iconHtml;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public T getItem() {
+ return item;
+ }
+
+ public GridMenu<T> getMenu() {
+ return menu;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public String getTitleHtml() {
+ return titleHtml;
+ }
+
+ public String getTooltip() {
+ return tooltip;
+ }
+
+ public String getTooltipTitle() {
+ return tooltipTitle;
+ }
+
+ public void setEndIconHtml(final String endIconHtml) {
+ this.endIconHtml = endIconHtml;
+ }
+
+ public void setGroup(final GridGroup group) {
+ this.group = group;
+ }
+
+ public void setIconHtml(final String iconHtml) {
+ this.iconHtml = iconHtml;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public void setItem(final T item) {
+ this.item = item;
+ }
+
+ public void setMenu(final GridMenu<T> menu) {
+ this.menu = menu;
+ }
+
+ public void setTitle(final String title) {
+ this.title = title;
+ }
+
+ public void setTitleHtml(final String titleHtml) {
+ this.titleHtml = titleHtml;
+ }
+
+ public void setTooltip(final String tooltip) {
+ this.tooltip = tooltip;
+ }
+
+ public void setTooltipTitle(final String tooltipTitle) {
+ this.tooltipTitle = tooltipTitle;
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenu.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,79 @@
+/*
+ *
+ * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library
+ *
+ * (c) 2008 The emite development team (see CREDITS for details)
+ * This file is part of emite.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+import java.util.Iterator;
+
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.menu.BaseItem;
+import com.gwtext.client.widgets.menu.Item;
+import com.gwtext.client.widgets.menu.Menu;
+import com.gwtext.client.widgets.menu.event.BaseItemListenerAdapter;
+
+public class GridMenu<T> {
+ private final T param;
+ private final Menu menu;
+
+ /**
+ *
+ * @param param
+ * the uniq id (for instance a group short name, a xmpp uri
+ * of the object asociated with this menu
+ *
+ */
+ public GridMenu(final T param) {
+ this.param = param;
+ menu = new Menu();
+ }
+
+ public void addMenuItem(final GridMenuItem<T> menuItem) {
+ final Item item = new Item(menuItem.getTitle());
+ item.setIconCls(menuItem.getIconCls());
+ menu.addItem(item);
+ item.addListener(new BaseItemListenerAdapter() {
+ public void onClick(final BaseItem item, final EventObject e) {
+ DeferredCommand.addCommand(new Command() {
+ public void execute() {
+ menuItem.fire(param);
+ }
+ });
+ }
+ });
+ }
+
+ @SuppressWarnings("unchecked")
+ public void addMenuItemList(final GridMenuItemCollection list) {
+ for (final Iterator iterator = list.iterator(); iterator.hasNext();) {
+ final GridMenuItem item = (GridMenuItem) iterator.next();
+ addMenuItem(item);
+ }
+ }
+
+ public void showMenu(final EventObject e) {
+ if (menu.getItems().length > 0) {
+ menu.showAt(e.getXY());
+ }
+ }
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItem.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItem.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,34 @@
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+import com.calclab.suco.client.signal.Signal;
+import com.calclab.suco.client.signal.Slot;
+
+public class GridMenuItem<T> {
+
+ final String iconCls;
+ final String title;
+ private final Signal<T> onClick;
+
+ public GridMenuItem(final String iconCls, final String title, final Slot<T> slot) {
+ this.iconCls = iconCls;
+ this.title = title;
+ this.onClick = new Signal<T>("onClick");
+ onClick(slot);
+ }
+
+ public void fire(final T id) {
+ onClick.fire(id);
+ }
+
+ public String getIconCls() {
+ return iconCls;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void onClick(final Slot<T> slot) {
+ onClick.add(slot);
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItemCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItemCollection.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuItemCollection.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,30 @@
+/*
+ *
+ * ((e)) emite: A pure gwt (Google Web Toolkit) xmpp (jabber) library
+ *
+ * (c) 2008 The emite development team (see CREDITS for details)
+ * This file is part of emite.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+import java.util.ArrayList;
+
+public class GridMenuItemCollection extends ArrayList<GridMenuItem<?>> {
+
+ private static final long serialVersionUID = 1L;
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,438 @@
+package org.ourproject.kune.platf.client.ui.gridmenu;
+
+import java.util.HashMap;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.suco.client.signal.Signal;
+import com.calclab.suco.client.signal.Slot;
+import com.google.gwt.user.client.ui.Composite;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.core.SortDir;
+import com.gwtext.client.data.ArrayReader;
+import com.gwtext.client.data.FieldDef;
+import com.gwtext.client.data.GroupingStore;
+import com.gwtext.client.data.MemoryProxy;
+import com.gwtext.client.data.Record;
+import com.gwtext.client.data.RecordDef;
+import com.gwtext.client.data.SortState;
+import com.gwtext.client.data.Store;
+import com.gwtext.client.data.StringFieldDef;
+import com.gwtext.client.dd.DragData;
+import com.gwtext.client.dd.DragSource;
+import com.gwtext.client.dd.DropTarget;
+import com.gwtext.client.dd.DropTargetConfig;
+import com.gwtext.client.util.Format;
+import com.gwtext.client.widgets.BoxComponent;
+import com.gwtext.client.widgets.Panel;
+import com.gwtext.client.widgets.Toolbar;
+import com.gwtext.client.widgets.event.ContainerListenerAdapter;
+import com.gwtext.client.widgets.grid.CellMetadata;
+import com.gwtext.client.widgets.grid.ColumnConfig;
+import com.gwtext.client.widgets.grid.ColumnModel;
+import com.gwtext.client.widgets.grid.GridDragData;
+import com.gwtext.client.widgets.grid.GridPanel;
+import com.gwtext.client.widgets.grid.GridView;
+import com.gwtext.client.widgets.grid.GroupingView;
+import com.gwtext.client.widgets.grid.Renderer;
+import com.gwtext.client.widgets.grid.RowSelectionModel;
+import com.gwtext.client.widgets.grid.event.GridRowListener;
+import com.gwtext.client.widgets.layout.FitLayout;
+
+public class GridMenuPanel<T> extends Composite {
+ public static final String GRID_MENU_PANEL_DD = "gridMenuPanelDD";
+ public static final int DEFAULT_INITIAL_WIDTH = 150;
+ private static final String GROUP = "groupField";
+ private static final String GROUP_TOOLTIP_TITLE = "groupTooltipTitleField";
+ private static final String GROUP_TOOLTIP = "groupTooltipField";
+ private static final String GROUP_ENDICON_HTML = "groupEndIconHtmlField";
+ private static final String ID = "idField";
+ private static final String ICON_HTML = "iconHtmlField";
+ private static final String TITLE = "titleField";
+ private static final String TITLE_HTML = "titleHtmlField";
+ private static final String END_ICON_HTML = "endIconHtmlField";
+ private static final String TOOLTIP = "tooltipField";
+ private static final String TOOLTIPTITLE = "tooltipTitleField";
+ private final HashMap<String, GridMenu<T>> menuMap;
+ private final HashMap<T, Record> recordMap;
+ private RecordDef recordDef;
+ private GroupingStore store;
+ private GridPanel grid;
+ private final Panel panel;
+ private final boolean grouped;
+ private final boolean withCounters;
+ private final Signal<String> onClick;
+ private final Signal<String> onDoubleClick;
+ private Toolbar topBar;
+ private Toolbar bottomBar;
+ private final String emptyText;
+ private final GridDragConfiguration gridDragConfiguration;
+ private final GridDropConfiguration gridDropConfiguration;
+ private ColumnModel columnModel;
+
+ public GridMenuPanel(final String emptyText) {
+ this(emptyText, null, null, false, false, false, false);
+ }
+
+ public GridMenuPanel(final String emptyText, final boolean grouped, final boolean withCounters) {
+ this(emptyText, null, null, grouped, withCounters, false, false);
+ }
+
+ public GridMenuPanel(final String emptyText, final boolean grouped, final boolean withCounters,
+ final boolean withTopBar, final boolean withBottomBar) {
+ this(emptyText, null, null, grouped, withCounters, withTopBar, withBottomBar);
+ }
+
+ public GridMenuPanel(final String emptyText, final GridDragConfiguration gridDragConfiguration) {
+ this(emptyText, gridDragConfiguration, null, false, false, false, false);
+ }
+
+ public GridMenuPanel(final String emptyText, final GridDragConfiguration gridDragConfiguration,
+ final GridDropConfiguration gridDropConfiguration, final boolean grouped, final boolean withCounters,
+ final boolean withTopBar, final boolean withBottomBar) {
+ this.emptyText = emptyText;
+ this.gridDragConfiguration = gridDragConfiguration;
+ this.gridDropConfiguration = gridDropConfiguration;
+ this.onClick = new Signal<String>("onClick");
+ this.onDoubleClick = new Signal<String>("onDoubleClick");
+ this.grouped = grouped;
+ this.withCounters = withCounters;
+ panel = new Panel();
+ panel.setBorder(false);
+ panel.setLayout(new FitLayout());
+ if (withTopBar) {
+ topBar = new Toolbar();
+ panel.setTopToolbar(topBar);
+ }
+ if (withBottomBar) {
+ bottomBar = new Toolbar();
+ panel.setBottomToolbar(bottomBar);
+ }
+ menuMap = new HashMap<String, GridMenu<T>>();
+ recordMap = new HashMap<T, Record>();
+ panel.addListener(new ContainerListenerAdapter() {
+ public void onResize(final BoxComponent component, final int adjWidth, final int adjHeight,
+ final int rawWidth, final int rawHeight) {
+ setWidth(adjWidth);
+ }
+ });
+ initWidget(panel);
+ }
+
+ public GridMenuPanel(final String emptyText, final GridDropConfiguration gridDropConfiguration) {
+ this(emptyText, null, gridDropConfiguration, false, false, false, false);
+ }
+
+ public void addItem(final GridItem<T> gridItem) {
+ createGridIfNeeded();
+ final String id = gridItem.getId();
+ final Record newRecord = recordDef
+ .createRecord(id, new Object[] { gridItem.getGroup().getName(), gridItem.getGroup().getTooltipTitle(),
+ gridItem.getGroup().getTooltip(), gridItem.getGroup().getEndIconHtml(), id,
+ gridItem.getIconHtml(), gridItem.getTitle(), gridItem.getTitleHtml(),
+ gridItem.getEndIconHtml(), gridItem.getTooltipTitle(), gridItem.getTooltip() });
+ recordMap.put(gridItem.getItem(), newRecord);
+ store.addSorted(newRecord);
+ menuMap.put(id, gridItem.getMenu());
+ sort();
+ doLayoutIfNeeded();
+ }
+
+ public void confDropInPanel(final Panel panel, final GridDropConfiguration gridDropConfiguration) {
+ // FIXME: This doesn't works :-/
+ // http://extjs.com/forum/showthread.php?t=18105
+ final DropTargetConfig dCfg = new DropTargetConfig();
+ dCfg.setTarget(true);
+ dCfg.setdDdGroup(gridDropConfiguration.getDdGroupId());
+ new DropTarget(panel, dCfg) {
+ @Override
+ public boolean notifyDrop(final DragSource src, final EventObject e, final DragData dragData) {
+ if (dragData instanceof GridDragData) {
+ final GridDragData gridDragData = (GridDragData) dragData;
+ final Record[] records = gridDragData.getSelections();
+ for (int i = 0; i < records.length; i++) {
+ gridDropConfiguration.fire(records[i].getAsString(ID));
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String notifyEnter(final DragSource src, final EventObject e, final DragData data) {
+ return "x-tree-drop-ok-append";
+ }
+
+ @Override
+ public String notifyOver(final DragSource src, final EventObject e, final DragData data) {
+ return "x-tree-drop-ok-append";
+ }
+ };
+ }
+
+ public Toolbar getBottomBar() {
+ return bottomBar;
+ }
+
+ public Toolbar getTopBar() {
+ return topBar;
+ }
+
+ public void onClick(final Slot<String> slot) {
+ onClick.add(slot);
+ }
+
+ public void onDoubleClick(final Slot<String> slot) {
+ onDoubleClick.add(slot);
+ }
+
+ public void removeAll() {
+ if (grid != null) {
+ store.removeAll();
+ }
+ recordMap.clear();
+ menuMap.clear();
+ }
+
+ public void removeItem(final GridItem<T> gridItem) {
+ final Record record = recordMap.get(gridItem.getItem());
+ if (record != null) {
+ menuMap.remove(record);
+ store.remove(record);
+ recordMap.remove(gridItem.getItem());
+ doLayoutIfNeeded();
+ } else {
+ Log.error("Trying to remove a non existing item: " + gridItem.getId());
+ }
+ }
+
+ public void setEndIconVisible(final boolean visible) {
+ createGrid(emptyText, gridDragConfiguration, gridDropConfiguration);
+ columnModel.setHidden(2, !visible);
+ doLayoutIfNeeded();
+ }
+
+ public void sort() {
+ store.sort(GROUP);
+ }
+
+ public void updateItem(final GridItem<T> gridItem) {
+ final String id = gridItem.getId();
+ final Record record = recordMap.get(gridItem.getItem());
+ if (record != null) {
+ record.set(GROUP, gridItem.getGroup().getName());
+ record.set(GROUP_TOOLTIP_TITLE, gridItem.getGroup().getTooltipTitle());
+ record.set(GROUP_TOOLTIP, gridItem.getGroup().getTooltip());
+ record.set(GROUP_ENDICON_HTML, gridItem.getGroup().getEndIconHtml());
+ record.set(ICON_HTML, gridItem.getIconHtml());
+ record.set(TITLE, gridItem.getTitle());
+ record.set(TITLE_HTML, gridItem.getTitleHtml());
+ record.set(END_ICON_HTML, gridItem.getEndIconHtml());
+ record.set(TOOLTIPTITLE, gridItem.getTooltipTitle());
+ record.set(TOOLTIP, gridItem.getTooltip());
+ store.commitChanges();
+ menuMap.put(id, gridItem.getMenu());
+ sort();
+ doLayoutIfNeeded();
+ } else {
+ Log.error("Trying to update a non existing item: " + id);
+ }
+ }
+
+ private void configureDrag(final GridDragConfiguration gridDragConfiguration) {
+ // TODO: put this in GDConf
+ grid.setEnableDragDrop(true);
+ grid.setDdGroup(gridDragConfiguration.getDdGroupId());
+ grid.setDragDropText(gridDragConfiguration.getDragMessage());
+ }
+
+ private void configureDrop(final GridDropConfiguration gridDropConfiguration) {
+ // TODO: put this in GDConf
+ grid.setEnableDragDrop(true);
+ grid.setDdGroup(gridDropConfiguration.getDdGroupId());
+ final DropTargetConfig dCfg = new DropTargetConfig();
+ dCfg.setTarget(true);
+ dCfg.setdDdGroup(gridDropConfiguration.getDdGroupId());
+ new DropTarget(grid, dCfg) {
+ @Override
+ public boolean notifyDrop(final DragSource src, final EventObject e, final DragData dragData) {
+ if (dragData instanceof GridDragData) {
+ final GridDragData gridDragData = (GridDragData) dragData;
+ final Record[] records = gridDragData.getSelections();
+ for (int i = 0; i < records.length; i++) {
+ gridDropConfiguration.fire(records[i].getAsString(ID));
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String notifyEnter(final DragSource src, final EventObject e, final DragData data) {
+ return "x-tree-drop-ok-append";
+ }
+
+ @Override
+ public String notifyOver(final DragSource src, final EventObject e, final DragData data) {
+ return "x-tree-drop-ok-append";
+ }
+ };
+ }
+
+ private void createGrid(final String emptyText, final GridDragConfiguration gridDragConfiguration,
+ final GridDropConfiguration gridDropConfiguration) {
+ grid = new GridPanel();
+ final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef(GROUP),
+ new StringFieldDef(GROUP_TOOLTIP_TITLE), new StringFieldDef(GROUP_TOOLTIP),
+ new StringFieldDef(GROUP_ENDICON_HTML), new StringFieldDef(ID), new StringFieldDef(ICON_HTML),
+ new StringFieldDef(TITLE), new StringFieldDef(TITLE_HTML), new StringFieldDef(END_ICON_HTML),
+ new StringFieldDef(TOOLTIPTITLE), new StringFieldDef(TOOLTIP) };
+ recordDef = new RecordDef(fieldDefs);
+
+ final MemoryProxy proxy = new MemoryProxy(new Object[][] {});
+
+ final ArrayReader reader = new ArrayReader(1, recordDef);
+ store = new GroupingStore(proxy, reader);
+ store.setSortInfo(new SortState(GROUP, SortDir.DESC));
+ store.setGroupField(GROUP);
+ store.setGroupOnSort(true);
+ store.load();
+ grid.setStore(store);
+
+ // TODO: Change this with a method that modify the html
+ final String commonTootipHtmlRender = "<span ext:qtitle=\"{1}\" ext:qtip=\"{2}\">{0}</span>";
+
+ final Renderer iconHtmlRenderer = new Renderer() {
+ public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
+ Store store) {
+ return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(ICON_HTML),
+ record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
+ }
+ };
+
+ final Renderer titleHtmlRenderer = new Renderer() {
+ public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
+ Store store) {
+ return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(TITLE_HTML),
+ record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
+ }
+ };
+
+ final Renderer endIconHtmlRenderer = new Renderer() {
+ public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
+ Store store) {
+ return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(END_ICON_HTML),
+ record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
+ }
+ };
+
+ final ColumnConfig[] columnsConfigs = new ColumnConfig[] {
+ new ColumnConfig("Icon", ICON_HTML, 24, false, iconHtmlRenderer, ICON_HTML),
+ new ColumnConfig("Title", TITLE_HTML, 80, true, titleHtmlRenderer, TITLE_HTML),
+ new ColumnConfig("EndIcon", END_ICON_HTML, 24, false, endIconHtmlRenderer, END_ICON_HTML),
+ new ColumnConfig(GROUP, GROUP, 0) };
+ columnModel = new ColumnModel(columnsConfigs);
+ grid.setColumnModel(columnModel);
+
+ grid.setAutoExpandColumn(TITLE_HTML);
+ grid.setSelectionModel(new RowSelectionModel());
+
+ grid.addGridRowListener(new GridRowListener() {
+ public void onRowClick(final GridPanel grid, final int rowIndex, final EventObject e) {
+ showMenu(rowIndex, e);
+ onClick(rowIndex);
+ }
+
+ public void onRowContextMenu(final GridPanel grid, final int rowIndex, final EventObject e) {
+ showMenu(rowIndex, e);
+ }
+
+ public void onRowDblClick(final GridPanel grid, final int rowIndex, final EventObject e) {
+ onDoubleClick(rowIndex);
+ }
+
+ private void showMenu(final int rowIndex, final EventObject e) {
+ final Record record = store.getRecordAt(rowIndex);
+ final GridMenu<T> menu = menuMap.get(record.getAsString(ID));
+ if (menu != null) {
+ menu.showMenu(e);
+ }
+ }
+ });
+ grid.stripeRows(true);
+ grid.setAutoWidth(true);
+ grid.setAutoHeight(true);
+
+ if (grouped) {
+ final GroupingView groupView = new GroupingView();
+ groupView.setForceFit(true);
+ final String groupEndIconHtmlTpl = "{[values.rs[0].data[\"" + GROUP_ENDICON_HTML + "\"]]}";
+ // http://www.gwt-ext.com/forum/viewtopic.php?f=7&t=1388&p=6789&hilit=setGroupTextTpl#p6789
+ if (withCounters) {
+ groupView.setGroupTextTpl("<span ext:qtip=\"{[values.rs[0].data[\"" + GROUP_TOOLTIP
+ + "\"]]}\">{[values.rs[0].data[\"" + GROUP + "\"]]} ({[values.rs.length]})</span>"
+ + groupEndIconHtmlTpl);
+ } else {
+ groupView.setGroupTextTpl("<span ext:qtip=\"{[values.rs[0].data[\"" + GROUP_TOOLTIP
+ + "\"]]}\">{[values.rs[0].data[\"" + GROUP + "\"]]}</span>" + groupEndIconHtmlTpl);
+ }
+ // Other sample with condition:
+ // view.setGroupTextTpl("{text} ({[values.rs.length]}
+ // {[values.rs.length
+ // > 1 ? \"Items\" : \"Item\"]})");
+ groupView.setHideGroupedColumn(true);
+ groupView.setEmptyGroupText(emptyText);
+ groupView.setShowGroupsText(true);
+ groupView.setEnableNoGroups(true);
+ groupView.setEmptyText(emptyText);
+ groupView.setGroupByText(GROUP);
+ groupView.setIgnoreAdd(true);
+ groupView.setEnableGrouping(true);
+ grid.setView(groupView);
+ } else {
+ final GridView view = new GridView();
+ view.setForceFit(true);
+ grid.setView(view);
+ }
+ grid.setHideColumnHeader(true);
+ grid.setBorder(false);
+ grid.setAutoScroll(true);
+ if (gridDropConfiguration != null) {
+ configureDrop(gridDropConfiguration);
+ }
+ if (gridDragConfiguration != null) {
+ configureDrag(gridDragConfiguration);
+ } else {
+ grid.setDraggable(false);
+ }
+ panel.add(grid);
+ }
+
+ private void createGridIfNeeded() {
+ if (grid == null) {
+ createGrid(emptyText, gridDragConfiguration, gridDropConfiguration);
+ }
+ }
+
+ private void doLayoutIfNeeded() {
+ if (panel.isRendered()) {
+ panel.doLayout();
+ }
+ }
+
+ private void onClick(final int rowIndex) {
+ final Record record = store.getRecordAt(rowIndex);
+ onClick.fire(record.getAsString(ID));
+ }
+
+ private void onDoubleClick(final int rowIndex) {
+ final Record record = store.getRecordAt(rowIndex);
+ onDoubleClick.fire(record.getAsString(ID));
+ }
+
+ private void setWidth(final int width) {
+ Log.info("Grid width: " + width);
+ if (grid != null) {
+ grid.setWidth(width - 27);
+ // panel.setWidth(width - 25);
+ doLayoutIfNeeded();
+ }
+ }
+}
Added: 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-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPanelNew.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,58 @@
+package org.ourproject.kune.workspace.client.socialnet;
+
+import org.ourproject.kune.platf.client.dto.GroupDTO;
+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.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+
+import com.gwtext.client.widgets.ToolbarButton;
+
+public class GroupMembersSummaryPanelNew extends DropDownPanel implements GroupMembersSummaryViewNew {
+ private final GridMenuPanel<GroupDTO> gridMenuPanel;
+
+ public GroupMembersSummaryPanelNew(final GroupMembersSummaryPresenterNew presenter,
+ final I18nUITranslationService i18n, final WorkspaceSkeleton ws) {
+ super(true);
+ super.setHeaderText(i18n.t("Group members"));
+ super.setHeaderTitle(i18n.t("People and groups collaborating in this group"));
+ gridMenuPanel = new GridMenuPanel<GroupDTO>(i18n.t("This is an orphaned project, if you are interested "
+ + "please request to join to work on it"), true, true, false, true);
+ ws.getEntitySummary().addInSummary(this);
+ this.setContent(gridMenuPanel);
+ }
+
+ public void addAddMemberButton() {
+ gridMenuPanel.getBottomBar().addButton(new ToolbarButton("Test"));
+ }
+
+ public void addItem(final GridItem<GroupDTO> gridItem) {
+ gridMenuPanel.addItem(gridItem);
+ }
+
+ public void addJoinButton() {
+ gridMenuPanel.getBottomBar().addButton(new ToolbarButton("Test"));
+ }
+
+ public void addUnjoinButton() {
+ gridMenuPanel.getBottomBar().addButton(new ToolbarButton("Test"));
+ }
+
+ public void clear() {
+ gridMenuPanel.removeAll();
+ }
+
+ public void setDropDownContentVisible(final boolean visible) {
+ super.setContentVisible(visible);
+ }
+
+ public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+ super.setTheme(oldTheme, newTheme);
+ }
+
+ public void setVisible(final boolean visible) {
+ super.setVisible(visible);
+ }
+}
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-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -168,11 +168,6 @@
if (userCanView) {
if (rights.isAdministrable()) {
- new MenuItem("", i18n.t("Remove this member"), new MenuItem.MenuItemListener() {
- public void onClick() {
-
- }
- });
final MemberAction[] adminsActions = {
new MemberAction(i18n.t("Remove this member"), WorkspaceEvents.DEL_MEMBER),
new MemberAction(i18n.t("Change to collaborator"), WorkspaceEvents.SET_ADMIN_AS_COLLAB),
Added: 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-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenterNew.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,246 @@
+package org.ourproject.kune.workspace.client.socialnet;
+
+import java.util.List;
+
+import org.ourproject.kune.platf.client.dto.AccessListsDTO;
+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.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.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.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 {
+
+ 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 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;
+
+ public GroupMembersSummaryPresenterNew(final I18nTranslationService i18n,
+ final Provider<StateManager> stateManager, final ImageUtils imageUtils, final Session session,
+ final SocialNetworkServiceAsync 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
+ .t("People pending to be accepted in this group by the admins"), imageUtils
+ .getImageHtml(ImageDescriptor.alert), true);
+ createActions();
+ }
+
+ public void hide() {
+ view.setVisible(false);
+ }
+
+ public void init(final GroupMembersSummaryViewNew view) {
+ this.view = view;
+ }
+
+ public void setState(final StateDTO state) {
+ if (state.getGroup().getType() == GroupDTO.PERSONAL) {
+ hide();
+ } else {
+ setGroupMembers(state.getGroupMembers(), state.getGroupRights());
+ }
+ }
+
+ public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+ view.setTheme(oldTheme, newTheme);
+ }
+
+ private void createActions() {
+ gotoGroupMenuItem = new GridMenuItem<GroupDTO>("", i18n.t("Visit this member homepage"), new Slot<GroupDTO>() {
+ public void onEvent(final GroupDTO groupDTO) {
+ getStateManager().gotoToken(groupDTO.getShortName());
+ }
+ });
+ changeToCollabMenuItem = new GridMenuItem<GroupDTO>("", 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>("", 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>("", 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>("", 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>("", 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 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);
+ return gridItem;
+ }
+
+ private StateManager getStateManager() {
+ return stateManager.get();
+ }
+
+ private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) {
+ return userIsAdmin || userIsCollab;
+ }
+
+ private void setGroupMembers(final SocialNetworkDTO socialNetwork, final AccessRightsDTO rights) {
+ final AccessListsDTO accessLists = socialNetwork.getAccessLists();
+
+ final List<GroupDTO> adminsList = accessLists.getAdmins().getList();
+ final List<GroupDTO> collabList = accessLists.getEditors().getList();
+ final List<GroupDTO> pendingCollabsList = socialNetwork.getPendingCollaborators().getList();
+
+ final int numAdmins = adminsList.size();
+
+ boolean userIsAdmin = rights.isAdministrable();
+ final boolean userIsCollab = !userIsAdmin && rights.isEditable();
+ final boolean userCanView = rights.isVisible();
+ boolean userIsMember = isMember(userIsAdmin, userIsCollab);
+
+ view.setDropDownContentVisible(false);
+ view.clear();
+
+ if (userIsAdmin) {
+ view.addAddMemberButton();
+ }
+
+ if (!userIsMember) {
+ view.addJoinButton();
+ } else if (userIsAdmin && numAdmins > 1 || userIsCollab) {
+ view.addUnjoinButton();
+ }
+
+ 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);
+ }
+ 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);
+ }
+ 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.setDropDownContentVisible(true);
+ view.setVisible(true);
+ }
+}
Added: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryViewNew.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryViewNew.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryViewNew.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -0,0 +1,25 @@
+package org.ourproject.kune.workspace.client.socialnet;
+
+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 GroupMembersSummaryViewNew {
+
+ void addAddMemberButton();
+
+ void addItem(GridItem<GroupDTO> gridItem);
+
+ void addJoinButton();
+
+ void addUnjoinButton();
+
+ void clear();
+
+ void setDropDownContentVisible(boolean visible);
+
+ void setTheme(WsTheme oldTheme, WsTheme newTheme);
+
+ void setVisible(boolean visible);
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntityWorkspace.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -31,6 +31,7 @@
final Panel bottomPanel = new Panel();
bottomPanel.setBorder(false);
bottomPanel.setLayout(new AnchorLayout());
+ ;
title = new TitleBar();
title.setHeight("" + (DEF_TOOLBAR_HEIGHT - 2));
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupMembersSummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupMembersSummary.java 2008-07-18 12:10:54 UTC (rev 802)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/GroupMembersSummary.java 2008-07-20 01:51:06 UTC (rev 803)
@@ -29,8 +29,4 @@
public void setTheme(WsTheme oldTheme, WsTheme newTheme);
- public void showAdmins();
-
- public void showCollabs();
-
}
More information about the kune-commits
mailing list