[kune-commits] r1272 - in trunk: img/webtemplate src/main/java/cc/kune/chat/client src/main/java/cc/kune/chat/client/actions src/main/java/cc/kune/core/client src/main/java/cc/kune/core/client/sn src/main/java/cc/kune/core/client/sn/actions src/main/java/cc/kune/core/client/sn/actions/conditions src/main/java/cc/kune/core/client/sn/actions/registry src/main/java/cc/kune/core/client/state src/main/webapp/WEB-INF src/test/java/org/ourproject/kune/workspace/client/socialnet src/test/java/testsuites
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Sun Mar 13 15:44:04 CET 2011
Author: vjrj_
Date: 2011-03-13 15:44:03 +0100 (Sun, 13 Mar 2011)
New Revision: 1272
Added:
trunk/src/main/java/cc/kune/chat/client/actions/
trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java
trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomButton.java
trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithMemberAction.java
trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithThisBuddieAction.java
trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithUserAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/SNRolAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAGroupCondition.java
trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAPersonCondition.java
trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAdministrableCondition.java
trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
trunk/src/main/webapp/WEB-INF/web.xml.wiab-int-sample
trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/SNRolActionTest.java
Removed:
trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java
trunk/src/main/java/cc/kune/chat/client/ChatSitebarActions.java
trunk/src/main/java/cc/kune/chat/client/StartChatWithMemberAction.java
trunk/src/main/java/cc/kune/chat/client/StartChatWithThisBuddieAction.java
trunk/src/main/java/cc/kune/chat/client/StartChatWithUserAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java
trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsEditableCondition.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersConfActions.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNBottomActionsRegistry.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNBottomActionsRegistry.java
trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolActionTest.java
Modified:
trunk/img/webtemplate/web_template-2011.svg
trunk/src/main/java/cc/kune/chat/client/ChatClient.java
trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java
trunk/src/main/java/cc/kune/chat/client/ChatGinModule.java
trunk/src/main/java/cc/kune/chat/client/ChatParts.java
trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
trunk/src/main/java/cc/kune/core/client/CoreParts.java
trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNAdminsMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNCollabsMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNPendingsMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/state/Session.java
trunk/src/main/java/cc/kune/core/client/state/SessionDefault.java
trunk/src/test/java/testsuites/OthersTestSuite.java
Log:
CLOSED - # 34: Group chat (room) with all members
http://kune.ourproject.org/issues/ticket/34
Modified: trunk/img/webtemplate/web_template-2011.svg
===================================================================
--- trunk/img/webtemplate/web_template-2011.svg 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/img/webtemplate/web_template-2011.svg 2011-03-13 14:44:03 UTC (rev 1272)
@@ -59,7 +59,7 @@
inkscape:document-units="px"
showgrid="false"
inkscape:window-width="1280"
- inkscape:window-height="747"
+ inkscape:window-height="748"
inkscape:window-x="0"
inkscape:window-y="1024"
inkscape:window-maximized="1"
@@ -910,6 +910,16 @@
inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/webtemplate/web_template-2011.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90" />
+ <rect
+ inkscape:export-ydpi="90"
+ inkscape:export-xdpi="90"
+ inkscape:export-filename="/home/vjrj/proyectos/dev/kune/trunk/img/webtemplate/web_template-2011.png"
+ y="247.41856"
+ x="821"
+ height="72.793892"
+ width="193"
+ id="rect3822"
+ style="opacity:1;color:#000000;fill:#d38d5f;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<image
width="30"
height="30"
@@ -2682,39 +2692,13 @@
y="336.0275"
x="885.00128"
id="image4011"
- xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAApVJREFU
-OI1lkk9oVFcUh7/3ZpLJjJNkYv2XKDFxjAGLWFypC1Ehiihu2k1pVxUsgcCsgpvgQkTBrMS94CJB
-KrgQBLNwI6IgKoIOMdFYVCyYBjJmMjPOu/ec08Wz8RkPHO7dnI/f+e4NzIxkTU5O5lV1VET2icha
-EcE51+Wc210qlZZZVUESMDEx8ZOq3uzp6env6OggDENUlZmZGebn52ve+12lu2dGAZeZshJAOjGc
-F5EbxWKxP4oipqenqdVqiAhmxkC6cfXI1NhdYANw4v+5FYCIDHd3d293zjE7O/vGe39YRP4REX69
-d3G4q74wDrwCNmWmbPk7gPd+Xy6XY25uDufciZGRkbcAzaPBceAScPXK0PjlfD5/e+H8eRsbGzu4
-GrA+DEOq1Sre+78Tnj4Av1/Ye/ZWsLzc7OzspF6vP/pG4rv7f9jDuUE+fsoiIpz88TEpc5h4zMft
-nHDt2R5UlY1tixzf/JjB00+DOIEZv/x8iICQIJUl4BhoAOk2wEAc4qucG6qBOgBeX3/w1YGJBwy/
-8BfpzDqCIA/aAtkCmEL9E7L0iqjxAfV1sv0jWNRMALwHNZCISvkJYbiGws79vL8zjukGeg8MUXlZ
-Jmos0t7XhZlgLkoCHJhh4igM7iBsXQeBIk3h+UKWXiIKxX4+1zKYr4PpCiAEMOcwExDH4otnVMqP
-IPToZ6XZaIJFVGamqcy+i9dVxZxLJHAupkpEYaCPVO4HCCO2/fYn25yHpY90FntoXWqJE6itBkSg
-ivqISrlMKtcObXlIt4J6WKrQWPwXV6vS3tuBofHaSYCZkNlyiuzWFEFrJn7CsAVUIGrQ3qgiromp
-xL68TwCiJm9ujsYuvMe8+9J+5UQk/lgi8V0FgP8Au3qlSuYS8nsAAAAASUVORK5CYII=
-"
+ xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAApVJREFU OI1lkk9oVFcUh7/3ZpLJjJNkYv2XKDFxjAGLWFypC1Ehiihu2k1pVxUsgcCsgpvgQkTBrMS94CJB KrgQBLNwI6IgKoIOMdFYVCyYBjJmMjPOu/ec08Wz8RkPHO7dnI/f+e4NzIxkTU5O5lV1VET2icha EcE51+Wc210qlZZZVUESMDEx8ZOq3uzp6env6OggDENUlZmZGebn52ve+12lu2dGAZeZshJAOjGc F5EbxWKxP4oipqenqdVqiAhmxkC6cfXI1NhdYANw4v+5FYCIDHd3d293zjE7O/vGe39YRP4REX69 d3G4q74wDrwCNmWmbPk7gPd+Xy6XY25uDufciZGRkbcAzaPBceAScPXK0PjlfD5/e+H8eRsbGzu4 GrA+DEOq1Sre+78Tnj4Av1/Ye/ZWsLzc7OzspF6vP/pG4rv7f9jDuUE+fsoiIpz88TEpc5h4zMft nHDt2R5UlY1tixzf/JjB00+DOIEZv/x8iICQIJUl4BhoAOk2wEAc4qucG6qBOgBeX3/w1YGJBwy/ 8BfpzDqCIA/aAtkCmEL9E7L0iqjxAfV1sv0jWNRMALwHNZCISvkJYbiGws79vL8zjukGeg8MUXlZ Jmos0t7XhZlgLkoCHJhh4igM7iBsXQeBIk3h+UKWXiIKxX4+1zKYr4PpCiAEMOcwExDH4otnVMqP IPToZ6XZaIJFVGamqcy+i9dVxZxLJHAupkpEYaCPVO4HCCO2/fYn25yHpY90FntoXWqJE6itBkSg ivqISrlMKtcObXlIt4J6WKrQWPwXV6vS3tuBofHaSYCZkNlyiuzWFEFrJn7CsAVUIGrQ3qgiromp xL68TwCiJm9ujsYuvMe8+9J+5UQk/lgi8V0FgP8Au3qlSuYS8nsAAAAASUVORK5CYII= "
height="16"
width="16" />
<image
width="16"
height="16"
- xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAApVJREFU
-OI1lkk9oVFcUh7/3ZpLJjJNkYv2XKDFxjAGLWFypC1Ehiihu2k1pVxUsgcCsgpvgQkTBrMS94CJB
-KrgQBLNwI6IgKoIOMdFYVCyYBjJmMjPOu/ec08Wz8RkPHO7dnI/f+e4NzIxkTU5O5lV1VET2icha
-EcE51+Wc210qlZZZVUESMDEx8ZOq3uzp6env6OggDENUlZmZGebn52ve+12lu2dGAZeZshJAOjGc
-F5EbxWKxP4oipqenqdVqiAhmxkC6cfXI1NhdYANw4v+5FYCIDHd3d293zjE7O/vGe39YRP4REX69
-d3G4q74wDrwCNmWmbPk7gPd+Xy6XY25uDufciZGRkbcAzaPBceAScPXK0PjlfD5/e+H8eRsbGzu4
-GrA+DEOq1Sre+78Tnj4Av1/Ye/ZWsLzc7OzspF6vP/pG4rv7f9jDuUE+fsoiIpz88TEpc5h4zMft
-nHDt2R5UlY1tixzf/JjB00+DOIEZv/x8iICQIJUl4BhoAOk2wEAc4qucG6qBOgBeX3/w1YGJBwy/
-8BfpzDqCIA/aAtkCmEL9E7L0iqjxAfV1sv0jWNRMALwHNZCISvkJYbiGws79vL8zjukGeg8MUXlZ
-Jmos0t7XhZlgLkoCHJhh4igM7iBsXQeBIk3h+UKWXiIKxX4+1zKYr4PpCiAEMOcwExDH4otnVMqP
-IPToZ6XZaIJFVGamqcy+i9dVxZxLJHAupkpEYaCPVO4HCCO2/fYn25yHpY90FntoXWqJE6itBkSg
-ivqISrlMKtcObXlIt4J6WKrQWPwXV6vS3tuBofHaSYCZkNlyiuzWFEFrJn7CsAVUIGrQ3qgiromp
-xL68TwCiJm9ujsYuvMe8+9J+5UQk/lgi8V0FgP8Au3qlSuYS8nsAAAAASUVORK5CYII=
-"
+ xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAApVJREFU OI1lkk9oVFcUh7/3ZpLJjJNkYv2XKDFxjAGLWFypC1Ehiihu2k1pVxUsgcCsgpvgQkTBrMS94CJB KrgQBLNwI6IgKoIOMdFYVCyYBjJmMjPOu/ec08Wz8RkPHO7dnI/f+e4NzIxkTU5O5lV1VET2icha EcE51+Wc210qlZZZVUESMDEx8ZOq3uzp6env6OggDENUlZmZGebn52ve+12lu2dGAZeZshJAOjGc F5EbxWKxP4oipqenqdVqiAhmxkC6cfXI1NhdYANw4v+5FYCIDHd3d293zjE7O/vGe39YRP4REX69 d3G4q74wDrwCNmWmbPk7gPd+Xy6XY25uDufciZGRkbcAzaPBceAScPXK0PjlfD5/e+H8eRsbGzu4 GrA+DEOq1Sre+78Tnj4Av1/Ye/ZWsLzc7OzspF6vP/pG4rv7f9jDuUE+fsoiIpz88TEpc5h4zMft nHDt2R5UlY1tixzf/JjB00+DOIEZv/x8iICQIJUl4BhoAOk2wEAc4qucG6qBOgBeX3/w1YGJBwy/ 8BfpzDqCIA/aAtkCmEL9E7L0iqjxAfV1sv0jWNRMALwHNZCISvkJYbiGws79vL8zjukGeg8MUXlZ Jmos0t7XhZlgLkoCHJhh4igM7iBsXQeBIk3h+UKWXiIKxX4+1zKYr4PpCiAEMOcwExDH4otnVMqP IPToZ6XZaIJFVGamqcy+i9dVxZxLJHAupkpEYaCPVO4HCCO2/fYn25yHpY90FntoXWqJE6itBkSg ivqISrlMKtcObXlIt4J6WKrQWPwXV6vS3tuBofHaSYCZkNlyiuzWFEFrJn7CsAVUIGrQ3qgiromp xL68TwCiJm9ujsYuvMe8+9J+5UQk/lgi8V0FgP8Au3qlSuYS8nsAAAAASUVORK5CYII= "
id="image4014"
x="885.00128"
y="368.0275" />
Deleted: trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,116 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.chat.client;
-
-import cc.kune.common.client.actions.AbstractAction;
-import cc.kune.common.client.actions.AbstractExtendedAction;
-import cc.kune.common.client.actions.Action;
-import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.PropertyChangeEvent;
-import cc.kune.common.client.actions.PropertyChangeListener;
-import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
-import cc.kune.common.client.noti.NotifyUser;
-import cc.kune.core.client.resources.icons.IconResources;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateChangedEvent;
-import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
-import cc.kune.core.client.state.StateManager;
-import cc.kune.core.client.ws.entheader.EntityHeader;
-import cc.kune.core.shared.dto.StateAbstractDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.calclab.emite.im.client.roster.XmppRoster;
-import com.calclab.emite.im.client.roster.events.RosterGroupChangedEvent;
-import com.calclab.emite.im.client.roster.events.RosterGroupChangedHandler;
-import com.calclab.suco.client.Suco;
-import com.google.inject.Inject;
-
-public class AddAsBuddieHeaderButton {
-
- public static class AddAsBuddieAction extends AbstractExtendedAction {
- private final ChatClient chatEngine;
- private final Session session;
-
- @Inject
- public AddAsBuddieAction(final ChatClient chatEngine, final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final IconResources img) {
- super();
- this.chatEngine = chatEngine;
- this.session = session;
- stateManager.onStateChanged(true, new StateChangedHandler() {
- @Override
- public void onStateChanged(final StateChangedEvent event) {
- setState(event.getState());
- }
- });
- Suco.get(XmppRoster.class).addRosterGroupChangedHandler(new RosterGroupChangedHandler() {
-
- @Override
- public void onGroupChanged(final RosterGroupChangedEvent event) {
- setState(session.getCurrentState());
- }
- });
- putValue(Action.NAME, i18n.t("Add as a buddie"));
- putValue(Action.SMALL_ICON, img.addGreen());
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- chatEngine.addNewBuddie(session.getCurrentState().getGroup().getShortName());
- NotifyUser.info("Added as buddie. Waiting buddie response");
- setEnabled(false);
- }
-
- private boolean currentGroupsIsAsPerson(final StateAbstractDTO state) {
- return state.getGroup().isPersonal();
- }
-
- private boolean isNotMe(final String groupName) {
- return !session.getCurrentUser().getShortName().equals(groupName);
- }
-
- private void setState(final StateAbstractDTO state) {
- final String groupName = state.getGroup().getShortName();
- final boolean imLogged = session.isLogged();
- final boolean isNotBuddie = !chatEngine.isBuddie(groupName);
- if (imLogged && currentGroupsIsAsPerson(state) && isNotBuddie && isNotMe(groupName)) {
- setEnabled(true);
- } else {
- setEnabled(false);
- }
- }
- }
-
- @Inject
- public AddAsBuddieHeaderButton(final AddAsBuddieAction buddieAction, final EntityHeader entityHeader) {
- final ButtonDescriptor button = new ButtonDescriptor(buddieAction);
- button.setVisible(false);
- button.setStyles("k-chat-add-as-buddie");
- buddieAction.addPropertyChangeListener(new PropertyChangeListener() {
- @Override
- public void propertyChange(final PropertyChangeEvent event) {
- if (event.getPropertyName().equals(AbstractAction.ENABLED)) {
- button.setVisible((Boolean) event.getNewValue());
- }
- }
- });
- entityHeader.addAction(button);
- }
-}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/chat/client/ChatClient.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatClient.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/ChatClient.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -20,6 +20,7 @@
package cc.kune.chat.client;
import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
+import com.calclab.emite.xep.muc.client.Room;
public interface ChatClient {
@@ -37,9 +38,9 @@
boolean isLoggedIn();
- void joinRoom(String roomName, String userAlias);
+ Room joinRoom(String roomName, String userAlias);
- void joinRoom(String roomName, String subject, String userAlias);
+ Room joinRoom(String roomName, String subject, String userAlias);
void login(XmppURI uri, String passwd);
@@ -50,8 +51,12 @@
void logout();
+ XmppURI roomUriFrom(String shortName);
+
void setAvatar(String photoBinary);
void show();
+ XmppURI uriFrom(String shortName);
+
}
Modified: trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -329,21 +329,23 @@
}
@Override
- public void joinRoom(final String roomName, final String userAlias) {
- joinRoom(roomName, null, userAlias);
+ public Room joinRoom(final String roomName, final String userAlias) {
+ return joinRoom(roomName, null, userAlias);
}
@Override
- public void joinRoom(final String roomName, final String subject, final String userAlias) {
+ public Room joinRoom(final String roomName, final String subject, final String userAlias) {
+ Room room = null;
if (xmppSession.isReady()) {
final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/" + chatOptions.username);
- final Room room = roomManager.open(roomURI, roomManager.getDefaultHistoryOptions());
+ room = roomManager.open(roomURI, roomManager.getDefaultHistoryOptions());
if (TextUtils.notEmpty(subject)) {
RoomSubject.requestSubjectChange(room, subject);
}
} else {
NotifyUser.error(i18n.t("Error"), i18n.t("To join a chatroom you need to be 'online'"), true);
}
+ return room;
}
public void loadIcons(final ChatResources others) {
@@ -396,6 +398,11 @@
}
@Override
+ public XmppURI roomUriFrom(final String shortName) {
+ return XmppURI.jid(shortName + "@" + chatOptions.roomHost);
+ }
+
+ @Override
public void setAvatar(final String photoBinary) {
Suco.get(AvatarManager.class).setVCardAvatar(photoBinary);
}
@@ -436,7 +443,8 @@
showDialog(dialog == null ? true : !dialogVisible());
}
- private XmppURI uriFrom(final String shortName) {
+ @Override
+ public XmppURI uriFrom(final String shortName) {
return XmppURI.jid(shortName + "@" + chatOptions.domain);
}
}
Modified: trunk/src/main/java/cc/kune/chat/client/ChatGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatGinModule.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/ChatGinModule.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -19,6 +19,10 @@
*/
package cc.kune.chat.client;
+import cc.kune.chat.client.actions.AddAsBuddieHeaderButton;
+import cc.kune.chat.client.actions.ChatSitebarActions;
+import cc.kune.chat.client.actions.OpenGroupPublicChatRoomButton;
+
import com.google.inject.Singleton;
import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
@@ -35,5 +39,6 @@
bind(ChatSitebarActions.class).in(Singleton.class);
bind(ChatParts.class).asEagerSingleton();
bind(AddAsBuddieHeaderButton.class).in(Singleton.class);
+ bind(OpenGroupPublicChatRoomButton.class).in(Singleton.class);
}
}
Modified: trunk/src/main/java/cc/kune/chat/client/ChatParts.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatParts.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/ChatParts.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,16 +1,28 @@
package cc.kune.chat.client;
+import cc.kune.chat.client.actions.AddAsBuddieHeaderButton;
+import cc.kune.chat.client.actions.ChatSitebarActions;
+import cc.kune.chat.client.actions.OpenGroupPublicChatRoomAction;
+import cc.kune.chat.client.actions.OpenGroupPublicChatRoomButton;
+import cc.kune.chat.client.actions.StartChatWithMemberAction;
+import cc.kune.chat.client.actions.StartChatWithThisBuddieAction;
+import cc.kune.chat.client.actions.StartChatWithUserAction;
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.core.client.init.AppStartEvent;
import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
+import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAGroupCondition;
+import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAdministrableCondition;
+import cc.kune.core.client.sn.actions.conditions.IsCurrentStateEditableCondition;
import cc.kune.core.client.sn.actions.conditions.IsLoggedCondition;
import cc.kune.core.client.sn.actions.conditions.IsNotMeCondition;
import cc.kune.core.client.sn.actions.conditions.IsPersonCondition;
import cc.kune.core.client.sn.actions.registry.GroupSNAdminsMenuItemsRegistry;
import cc.kune.core.client.sn.actions.registry.GroupSNCollabsMenuItemsRegistry;
+import cc.kune.core.client.sn.actions.registry.GroupSNConfActions;
import cc.kune.core.client.sn.actions.registry.GroupSNPendingsMenuItemsRegistry;
import cc.kune.core.client.sn.actions.registry.UserSNMenuItemsRegistry;
import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -18,16 +30,22 @@
public class ChatParts {
@Inject
- public ChatParts(final Session session, final Provider<ChatSitebarActions> chatActionsProvider,
+ public ChatParts(final Session session, final I18nTranslationService i18n,
+ final Provider<ChatSitebarActions> chatActionsProvider,
final Provider<AddAsBuddieHeaderButton> buddieButton,
final Provider<GroupSNAdminsMenuItemsRegistry> snAdminsRegistry,
final Provider<GroupSNCollabsMenuItemsRegistry> snCollabsItemsRegistry,
final Provider<GroupSNPendingsMenuItemsRegistry> snPendingItemsRegistry,
+ final Provider<GroupSNConfActions> groupConfActions,
final Provider<UserSNMenuItemsRegistry> userItemsRegistry, final IsNotMeCondition isNotMe,
- final IsPersonCondition isPersonCondition,
+ final IsCurrentStateAdministrableCondition isAdministrableCondition,
+ final IsCurrentStateEditableCondition isEditableCondition,
+ final IsCurrentStateAGroupCondition isGroupCondition, final IsPersonCondition isPersonCondition,
final Provider<StartChatWithMemberAction> startChatWithMemberAction, final IsLoggedCondition isLogged,
final Provider<StartChatWithUserAction> startChatWithUserAction,
- final Provider<StartChatWithThisBuddieAction> startChatWithBuddieAction) {
+ final Provider<StartChatWithThisBuddieAction> startChatWithBuddieAction,
+ final Provider<OpenGroupPublicChatRoomAction> openGroupRoomAction,
+ final Provider<OpenGroupPublicChatRoomButton> openGroupRoom) {
session.onInitDataReceived(true, new AppStartHandler() {
@Override
public void onAppStart(final AppStartEvent event) {
@@ -61,11 +79,26 @@
return item;
}
};
+ final Provider<MenuItemDescriptor> openChatAndInvite = new Provider<MenuItemDescriptor>() {
+ @Override
+ public MenuItemDescriptor get() {
+ final OpenGroupPublicChatRoomAction action = openGroupRoomAction.get();
+ action.setInviteMembers(true);
+ final MenuItemDescriptor item = new MenuItemDescriptor(action);
+ item.withText(i18n.t("Open group's room with members")).withToolTip(
+ i18n.t("Enter to this group public chat room and invite members"));
+ item.setParent(GroupSNConfActions.OPTIONS_MENU);
+ item.setPosition(0);
+ return item;
+ }
+ };
snAdminsRegistry.get().add(startChatWithMemberItem);
snCollabsItemsRegistry.get().add(startChatWithMemberItem);
snPendingItemsRegistry.get().add(startChatWithUserItem);
userItemsRegistry.get().add(startChatWithBuddieItem);
+ groupConfActions.get().add(openChatAndInvite.get());
buddieButton.get();
+ openGroupRoom.get();
}
});
}
Deleted: trunk/src/main/java/cc/kune/chat/client/ChatSitebarActions.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatSitebarActions.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/ChatSitebarActions.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,163 +0,0 @@
-package cc.kune.chat.client;
-
-import cc.kune.chat.client.resources.ChatResources;
-import cc.kune.common.client.actions.AbstractAction;
-import cc.kune.common.client.actions.AbstractExtendedAction;
-import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.actions.ui.descrip.MenuRadioItemDescriptor;
-import cc.kune.common.client.actions.ui.descrip.MenuSeparatorDescriptor;
-import cc.kune.common.client.actions.ui.descrip.MenuTitleItemDescriptor;
-import cc.kune.core.client.sitebar.SiteUserOptions;
-import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.calclab.emite.core.client.events.StateChangedEvent;
-import com.calclab.emite.core.client.events.StateChangedHandler;
-import com.calclab.emite.core.client.xmpp.session.XmppSession;
-import com.calclab.emite.core.client.xmpp.stanzas.Presence;
-import com.calclab.emite.core.client.xmpp.stanzas.Presence.Show;
-import com.calclab.emite.im.client.presence.PresenceManager;
-import com.calclab.emite.im.client.presence.events.OwnPresenceChangedEvent;
-import com.calclab.emite.im.client.presence.events.OwnPresenceChangedHandler;
-import com.calclab.suco.client.Suco;
-import com.google.gwt.resources.client.ImageResource;
-import com.google.inject.Inject;
-
-public class ChatSitebarActions {
-
- public class ChangeOfflineStatusAction extends AbstractExtendedAction {
- public ChangeOfflineStatusAction(final ImageResource icon) {
- xmppSession.addSessionStateChangedHandler(true, new StateChangedHandler() {
- @Override
- public void onStateChanged(final StateChangedEvent event) {
- if (!xmppSession.isReady()) {
- SiteUserOptionsPresenter.LOGGED_USER_MENU.putValue(AbstractAction.SMALL_ICON, icon);
- }
- }
- });
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- // presenceManager.changeOwnPresence(Presence.build(NO_STATUS,
- // Show.xa));
- xmppSession.logout();
- }
- }
- public class ChangeOnlineStatusAction extends AbstractExtendedAction {
- private final Presence thisPresence;
-
- public ChangeOnlineStatusAction(final String statusText, final Show show, final ImageResource icon) {
- thisPresence = Presence.build(statusText, show);
- presenceManager.addOwnPresenceChangedHandler(new OwnPresenceChangedHandler() {
-
- @Override
- public void onOwnPresenceChanged(final OwnPresenceChangedEvent event) {
- updateStatusIcon(icon, event.getCurrentPresence());
- }
-
- });
- updateStatusIcon(icon, presenceManager.getOwnPresence());
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- if (!chatClient.loginIfNecessary()) {
- presenceManager.changeOwnPresence(thisPresence);
- }
- nextPresence = thisPresence;
- }
-
- private void updateStatusIcon(final ImageResource icon, final Presence currentPresence) {
- if (thisPresence.getShow().equals(currentPresence.getShow())
- && ((currentPresence.getStatus() == null) || currentPresence.getStatus().equals(
- thisPresence.getStatus()))) {
- SiteUserOptionsPresenter.LOGGED_USER_MENU.putValue(AbstractAction.SMALL_ICON, icon);
- }
- }
- }
-
- private static final String CHAT_STATUS = "k-chat-status-group";
- private static final String GROUP_CHAT_STATUS = "k-group-chat-status";
- private static final String NO_STATUS = null;
- private final ChatClient chatClient;
- private final I18nTranslationService i18n;
- private Presence nextPresence = Presence.build(NO_STATUS, Show.notSpecified);
- private final PresenceManager presenceManager = Suco.get(PresenceManager.class);
- private final ChatResources res;
- private final Session session;
- private final SiteUserOptions userOptions;
- private final XmppSession xmppSession = Suco.get(XmppSession.class);
-
- @Inject
- public ChatSitebarActions(final Session session, final ChatClient chatClient, final SiteUserOptions userOptions,
- final I18nTranslationService i18n, final ChatResources res) {
- this.session = session;
- this.chatClient = chatClient;
- this.userOptions = userOptions;
- this.i18n = i18n;
- this.res = res;
- createActions();
- }
-
- private void createActions() {
- final MenuTitleItemDescriptor chatActionsTitle = new MenuTitleItemDescriptor(
- SiteUserOptionsPresenter.LOGGED_USER_MENU, i18n.t("Set your chat status"));
- userOptions.addAction(new MenuSeparatorDescriptor(SiteUserOptionsPresenter.LOGGED_USER_MENU));
- userOptions.addAction(chatActionsTitle);
- final MenuRadioItemDescriptor onlineItem = createChatStatusAction(res.online(), i18n.t("Available"),
- onlineAction(NO_STATUS, Show.notSpecified, res.online()));
- final MenuRadioItemDescriptor availableItem = createChatStatusAction(res.xa(), i18n.t("Available for chat"),
- onlineAction(NO_STATUS, Show.chat, res.xa()));
- final MenuRadioItemDescriptor awayItem = createChatStatusAction(res.away(), i18n.t("Away"),
- onlineAction(NO_STATUS, Show.away, res.away()));
- final MenuRadioItemDescriptor busyItem = createChatStatusAction(res.busy(), i18n.t("Busy"),
- onlineAction(NO_STATUS, Show.dnd, res.busy()));
- final MenuRadioItemDescriptor offlineItem = createChatStatusAction(res.offline(), i18n.t("Sign out of chat"),
- new ChangeOfflineStatusAction(res.offline()));
- userOptions.addAction(onlineItem);
- userOptions.addAction(availableItem);
- userOptions.addAction(awayItem);
- userOptions.addAction(busyItem);
- userOptions.addAction(offlineItem);
- xmppSession.addSessionStateChangedHandler(false, new StateChangedHandler() {
-
- @Override
- public void onStateChanged(final StateChangedEvent event) {
- if (xmppSession.isReady()) {
- presenceManager.changeOwnPresence(nextPresence);
- switch (nextPresence.getShow()) {
- case notSpecified:
- onlineItem.setChecked(true);
- break;
- case dnd:
- busyItem.setChecked(true);
- break;
- case chat:
- availableItem.setChecked(true);
- break;
- case away:
- awayItem.setChecked(true);
- break;
- }
- } else {
- offlineItem.setChecked(true);
- }
- }
- });
- }
-
- private MenuRadioItemDescriptor createChatStatusAction(final ImageResource icon, final String text,
- final AbstractAction action) {
- final MenuRadioItemDescriptor item = new MenuRadioItemDescriptor(SiteUserOptionsPresenter.LOGGED_USER_MENU,
- action, GROUP_CHAT_STATUS);
- item.putValue(AbstractAction.NAME, text);
- item.putValue(AbstractAction.SMALL_ICON, icon);
- return item;
- }
-
- private AbstractExtendedAction onlineAction(final String statusText, final Show show, final ImageResource icon) {
- return new ChangeOnlineStatusAction(statusText, show, icon);
- }
-}
Deleted: trunk/src/main/java/cc/kune/chat/client/StartChatWithMemberAction.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/StartChatWithMemberAction.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/StartChatWithMemberAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,38 +0,0 @@
-package cc.kune.chat.client;
-
-import cc.kune.common.client.actions.AbstractExtendedAction;
-import cc.kune.common.client.actions.Action;
-import cc.kune.common.client.actions.ActionEvent;
-import cc.kune.common.client.noti.NotifyUser;
-import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.shared.dto.GroupDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class StartChatWithMemberAction extends AbstractExtendedAction {
- private final Provider<ChatClient> chatClient;
- private final I18nTranslationService i18n;
-
- @Inject
- public StartChatWithMemberAction(final I18nTranslationService i18n, final CoreResources res,
- final Provider<ChatClient> chatClient) {
- this.i18n = i18n;
- this.chatClient = chatClient;
- putValue(NAME, i18n.t("Chat with this member"));
- putValue(Action.SMALL_ICON, res.newChat());
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- chatClient.get().show();
- if (chatClient.get().isLoggedIn()) {
- chatClient.get().chat(XmppURI.jid(((GroupDTO) event.getTarget()).getShortName()));
- } else {
- NotifyUser.important(i18n.t("To start a chat you need to be 'online'"));
- }
- }
-
-}
Deleted: trunk/src/main/java/cc/kune/chat/client/StartChatWithThisBuddieAction.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/StartChatWithThisBuddieAction.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/StartChatWithThisBuddieAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,16 +0,0 @@
-package cc.kune.chat.client;
-
-import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class StartChatWithThisBuddieAction extends StartChatWithMemberAction {
- @Inject
- public StartChatWithThisBuddieAction(final I18nTranslationService i18n, final CoreResources res,
- final Provider<ChatClient> chatClient) {
- super(i18n, res, chatClient);
- putValue(NAME, i18n.t("Chat with your buddie"));
- }
-}
Deleted: trunk/src/main/java/cc/kune/chat/client/StartChatWithUserAction.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/StartChatWithUserAction.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/chat/client/StartChatWithUserAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,16 +0,0 @@
-package cc.kune.chat.client;
-
-import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class StartChatWithUserAction extends StartChatWithMemberAction {
- @Inject
- public StartChatWithUserAction(final I18nTranslationService i18n, final CoreResources res,
- final Provider<ChatClient> chatClient) {
- super(i18n, res, chatClient);
- putValue(NAME, i18n.t("Chat with this person"));
- }
-}
Copied: trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java (from rev 1267, trunk/src/main/java/cc/kune/chat/client/AddAsBuddieHeaderButton.java)
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,117 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.chat.client.actions;
+
+import cc.kune.chat.client.ChatClient;
+import cc.kune.common.client.actions.AbstractAction;
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.Action;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.PropertyChangeEvent;
+import cc.kune.common.client.actions.PropertyChangeListener;
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.common.client.noti.NotifyUser;
+import cc.kune.core.client.resources.icons.IconResources;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateChangedEvent;
+import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.client.ws.entheader.EntityHeader;
+import cc.kune.core.shared.dto.StateAbstractDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.calclab.emite.im.client.roster.XmppRoster;
+import com.calclab.emite.im.client.roster.events.RosterGroupChangedEvent;
+import com.calclab.emite.im.client.roster.events.RosterGroupChangedHandler;
+import com.calclab.suco.client.Suco;
+import com.google.inject.Inject;
+
+public class AddAsBuddieHeaderButton {
+
+ public static class AddAsBuddieAction extends AbstractExtendedAction {
+ private final ChatClient chatEngine;
+ private final Session session;
+
+ @Inject
+ public AddAsBuddieAction(final ChatClient chatEngine, final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final IconResources img) {
+ super();
+ this.chatEngine = chatEngine;
+ this.session = session;
+ stateManager.onStateChanged(true, new StateChangedHandler() {
+ @Override
+ public void onStateChanged(final StateChangedEvent event) {
+ setState(event.getState());
+ }
+ });
+ Suco.get(XmppRoster.class).addRosterGroupChangedHandler(new RosterGroupChangedHandler() {
+
+ @Override
+ public void onGroupChanged(final RosterGroupChangedEvent event) {
+ setState(session.getCurrentState());
+ }
+ });
+ putValue(Action.NAME, i18n.t("Add as a buddie"));
+ putValue(Action.SMALL_ICON, img.addGreen());
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ chatEngine.addNewBuddie(session.getCurrentState().getGroup().getShortName());
+ NotifyUser.info("Added as buddie. Waiting buddie response");
+ setEnabled(false);
+ }
+
+ private boolean currentGroupsIsAsPerson(final StateAbstractDTO state) {
+ return state.getGroup().isPersonal();
+ }
+
+ private boolean isNotMe(final String groupName) {
+ return !session.getCurrentUser().getShortName().equals(groupName);
+ }
+
+ private void setState(final StateAbstractDTO state) {
+ final String groupName = state.getGroup().getShortName();
+ final boolean imLogged = session.isLogged();
+ final boolean isNotBuddie = !chatEngine.isBuddie(groupName);
+ if (imLogged && currentGroupsIsAsPerson(state) && isNotBuddie && isNotMe(groupName)) {
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
+ }
+ }
+
+ @Inject
+ public AddAsBuddieHeaderButton(final AddAsBuddieAction buddieAction, final EntityHeader entityHeader) {
+ final ButtonDescriptor button = new ButtonDescriptor(buddieAction);
+ button.setVisible(false);
+ button.setStyles("k-chat-add-as-buddie");
+ buddieAction.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(AbstractAction.ENABLED)) {
+ button.setVisible((Boolean) event.getNewValue());
+ }
+ }
+ });
+ entityHeader.addAction(button);
+ }
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/cc/kune/chat/client/actions/AddAsBuddieHeaderButton.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java (from rev 1267, trunk/src/main/java/cc/kune/chat/client/ChatSitebarActions.java)
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,164 @@
+package cc.kune.chat.client.actions;
+
+import cc.kune.chat.client.ChatClient;
+import cc.kune.chat.client.resources.ChatResources;
+import cc.kune.common.client.actions.AbstractAction;
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.MenuRadioItemDescriptor;
+import cc.kune.common.client.actions.ui.descrip.MenuSeparatorDescriptor;
+import cc.kune.common.client.actions.ui.descrip.MenuTitleItemDescriptor;
+import cc.kune.core.client.sitebar.SiteUserOptions;
+import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.calclab.emite.core.client.events.StateChangedEvent;
+import com.calclab.emite.core.client.events.StateChangedHandler;
+import com.calclab.emite.core.client.xmpp.session.XmppSession;
+import com.calclab.emite.core.client.xmpp.stanzas.Presence;
+import com.calclab.emite.core.client.xmpp.stanzas.Presence.Show;
+import com.calclab.emite.im.client.presence.PresenceManager;
+import com.calclab.emite.im.client.presence.events.OwnPresenceChangedEvent;
+import com.calclab.emite.im.client.presence.events.OwnPresenceChangedHandler;
+import com.calclab.suco.client.Suco;
+import com.google.gwt.resources.client.ImageResource;
+import com.google.inject.Inject;
+
+public class ChatSitebarActions {
+
+ public class ChangeOfflineStatusAction extends AbstractExtendedAction {
+ public ChangeOfflineStatusAction(final ImageResource icon) {
+ xmppSession.addSessionStateChangedHandler(true, new StateChangedHandler() {
+ @Override
+ public void onStateChanged(final StateChangedEvent event) {
+ if (!xmppSession.isReady()) {
+ SiteUserOptionsPresenter.LOGGED_USER_MENU.putValue(AbstractAction.SMALL_ICON, icon);
+ }
+ }
+ });
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ // presenceManager.changeOwnPresence(Presence.build(NO_STATUS,
+ // Show.xa));
+ xmppSession.logout();
+ }
+ }
+ public class ChangeOnlineStatusAction extends AbstractExtendedAction {
+ private final Presence thisPresence;
+
+ public ChangeOnlineStatusAction(final String statusText, final Show show, final ImageResource icon) {
+ thisPresence = Presence.build(statusText, show);
+ presenceManager.addOwnPresenceChangedHandler(new OwnPresenceChangedHandler() {
+
+ @Override
+ public void onOwnPresenceChanged(final OwnPresenceChangedEvent event) {
+ updateStatusIcon(icon, event.getCurrentPresence());
+ }
+
+ });
+ updateStatusIcon(icon, presenceManager.getOwnPresence());
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ if (!chatClient.loginIfNecessary()) {
+ presenceManager.changeOwnPresence(thisPresence);
+ }
+ nextPresence = thisPresence;
+ }
+
+ private void updateStatusIcon(final ImageResource icon, final Presence currentPresence) {
+ if (thisPresence.getShow().equals(currentPresence.getShow())
+ && ((currentPresence.getStatus() == null) || currentPresence.getStatus().equals(
+ thisPresence.getStatus()))) {
+ SiteUserOptionsPresenter.LOGGED_USER_MENU.putValue(AbstractAction.SMALL_ICON, icon);
+ }
+ }
+ }
+
+ private static final String CHAT_STATUS = "k-chat-status-group";
+ private static final String GROUP_CHAT_STATUS = "k-group-chat-status";
+ private static final String NO_STATUS = null;
+ private final ChatClient chatClient;
+ private final I18nTranslationService i18n;
+ private Presence nextPresence = Presence.build(NO_STATUS, Show.notSpecified);
+ private final PresenceManager presenceManager = Suco.get(PresenceManager.class);
+ private final ChatResources res;
+ private final Session session;
+ private final SiteUserOptions userOptions;
+ private final XmppSession xmppSession = Suco.get(XmppSession.class);
+
+ @Inject
+ public ChatSitebarActions(final Session session, final ChatClient chatClient, final SiteUserOptions userOptions,
+ final I18nTranslationService i18n, final ChatResources res) {
+ this.session = session;
+ this.chatClient = chatClient;
+ this.userOptions = userOptions;
+ this.i18n = i18n;
+ this.res = res;
+ createActions();
+ }
+
+ private void createActions() {
+ final MenuTitleItemDescriptor chatActionsTitle = new MenuTitleItemDescriptor(
+ SiteUserOptionsPresenter.LOGGED_USER_MENU, i18n.t("Set your chat status"));
+ userOptions.addAction(new MenuSeparatorDescriptor(SiteUserOptionsPresenter.LOGGED_USER_MENU));
+ userOptions.addAction(chatActionsTitle);
+ final MenuRadioItemDescriptor onlineItem = createChatStatusAction(res.online(), i18n.t("Available"),
+ onlineAction(NO_STATUS, Show.notSpecified, res.online()));
+ final MenuRadioItemDescriptor availableItem = createChatStatusAction(res.xa(), i18n.t("Available for chat"),
+ onlineAction(NO_STATUS, Show.chat, res.xa()));
+ final MenuRadioItemDescriptor awayItem = createChatStatusAction(res.away(), i18n.t("Away"),
+ onlineAction(NO_STATUS, Show.away, res.away()));
+ final MenuRadioItemDescriptor busyItem = createChatStatusAction(res.busy(), i18n.t("Busy"),
+ onlineAction(NO_STATUS, Show.dnd, res.busy()));
+ final MenuRadioItemDescriptor offlineItem = createChatStatusAction(res.offline(), i18n.t("Sign out of chat"),
+ new ChangeOfflineStatusAction(res.offline()));
+ userOptions.addAction(onlineItem);
+ userOptions.addAction(availableItem);
+ userOptions.addAction(awayItem);
+ userOptions.addAction(busyItem);
+ userOptions.addAction(offlineItem);
+ xmppSession.addSessionStateChangedHandler(false, new StateChangedHandler() {
+
+ @Override
+ public void onStateChanged(final StateChangedEvent event) {
+ if (xmppSession.isReady()) {
+ presenceManager.changeOwnPresence(nextPresence);
+ switch (nextPresence.getShow()) {
+ case notSpecified:
+ onlineItem.setChecked(true);
+ break;
+ case dnd:
+ busyItem.setChecked(true);
+ break;
+ case chat:
+ availableItem.setChecked(true);
+ break;
+ case away:
+ awayItem.setChecked(true);
+ break;
+ }
+ } else {
+ offlineItem.setChecked(true);
+ }
+ }
+ });
+ }
+
+ private MenuRadioItemDescriptor createChatStatusAction(final ImageResource icon, final String text,
+ final AbstractAction action) {
+ final MenuRadioItemDescriptor item = new MenuRadioItemDescriptor(SiteUserOptionsPresenter.LOGGED_USER_MENU,
+ action, GROUP_CHAT_STATUS);
+ item.putValue(AbstractAction.NAME, text);
+ item.putValue(AbstractAction.SMALL_ICON, icon);
+ return item;
+ }
+
+ private AbstractExtendedAction onlineAction(final String statusText, final Show show, final ImageResource icon) {
+ return new ChangeOnlineStatusAction(statusText, show, icon);
+ }
+}
Added: trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,117 @@
+package cc.kune.chat.client.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import cc.kune.chat.client.ChatClient;
+import cc.kune.chat.client.resources.ChatResources;
+import cc.kune.common.client.actions.Action;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.sn.actions.RolAction;
+import cc.kune.core.client.state.AccessRightsClientManager;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateChangedEvent;
+import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.dto.SocialNetworkDTO;
+import cc.kune.core.shared.dto.StateAbstractDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
+import com.calclab.emite.im.client.chat.ChatStates;
+import com.calclab.emite.xep.muc.client.Occupant;
+import com.calclab.emite.xep.muc.client.Room;
+import com.calclab.emite.xep.muc.client.RoomManager;
+import com.calclab.suco.client.Suco;
+import com.google.inject.Inject;
+
+public class OpenGroupPublicChatRoomAction extends RolAction {
+
+ private final ChatClient chatClient;
+ private final I18nTranslationService i18n;
+ private boolean inviteMembers;
+ private final RoomManager roomManager;
+ private final Session session;
+
+ @SuppressWarnings("deprecation")
+ @Inject
+ public OpenGroupPublicChatRoomAction(final Session session,
+ final AccessRightsClientManager accessRightsClientManager, final ChatClient chatClient,
+ final StateManager stateManager, final I18nTranslationService i18n, final ChatResources res) {
+ super(stateManager, session, accessRightsClientManager, AccessRolDTO.Editor, true, false, true);
+ this.session = session;
+ this.chatClient = chatClient;
+ this.i18n = i18n;
+ roomManager = Suco.get(RoomManager.class);
+ stateManager.onStateChanged(true, new StateChangedHandler() {
+ @Override
+ public void onStateChanged(final StateChangedEvent event) {
+ setState(session.getCurrentState());
+ }
+ });
+ putValue(Action.NAME, i18n.t("Group's public room"));
+ putValue(Action.SHORT_DESCRIPTION, i18n.t("Enter to this group public chat room"));
+ putValue(Action.SMALL_ICON, res.groupChat());
+ setInviteMembers(false);
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ final String currentGroupName = session.getCurrentGroupShortName();
+ final Room room = chatClient.joinRoom(currentGroupName, session.getCurrentUser().getShortName());
+ inviteMembers(room);
+ chatClient.show();
+ }
+
+ private void addGroup(final List<XmppURI> membersUris, final GroupDTO member) {
+ membersUris.add(chatClient.uriFrom(member.getShortName()));
+ }
+
+ private boolean currentGroupsIsAsPerson(final StateAbstractDTO state) {
+ return state.getGroup().isPersonal();
+ }
+
+ private void inviteMembers(final Room room) {
+ if (inviteMembers) {
+ room.addChatStateChangedHandler(true, new com.calclab.emite.core.client.events.StateChangedHandler() {
+ @Override
+ public void onStateChanged(final com.calclab.emite.core.client.events.StateChangedEvent event) {
+ if (event.getState().equals(ChatStates.ready)) {
+ // When ready we invite to the rest of members
+ final SocialNetworkDTO groupMembers = session.getCurrentState().getGroupMembers();
+ final List<XmppURI> membersUris = new ArrayList<XmppURI>();
+ for (final GroupDTO member : groupMembers.getAccessLists().getAdmins().getList()) {
+ addGroup(membersUris, member);
+ }
+ for (final GroupDTO member : groupMembers.getAccessLists().getEditors().getList()) {
+ addGroup(membersUris, member);
+ }
+ for (final Occupant occupant : room.getOccupants()) {
+ // Remove all member that are in the room
+ membersUris.remove(occupant.getJID());
+ }
+ for (final XmppURI memberNotPresent : membersUris) {
+ room.sendInvitationTo(memberNotPresent,
+ i18n.t("Join us in [%s] public room!", room.getURI().getNode()));
+ }
+ }
+ }
+ });
+ }
+ }
+
+ public void setInviteMembers(final boolean inviteMembers) {
+ this.inviteMembers = inviteMembers;
+ }
+
+ private void setState(final StateAbstractDTO state) {
+ final boolean imLogged = session.isLogged();
+ if (imLogged && !currentGroupsIsAsPerson(state)) {
+ setEnabled(true);
+ } else {
+ setEnabled(false);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomButton.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomButton.java (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomButton.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.chat.client.actions;
+
+import cc.kune.common.client.actions.AbstractAction;
+import cc.kune.common.client.actions.PropertyChangeEvent;
+import cc.kune.common.client.actions.PropertyChangeListener;
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.client.ws.entheader.EntityHeader;
+
+import com.google.inject.Inject;
+
+public class OpenGroupPublicChatRoomButton {
+
+ @Inject
+ public OpenGroupPublicChatRoomButton(final OpenGroupPublicChatRoomAction openRoomAction,
+ final EntityHeader entityHeader) {
+ final ButtonDescriptor button = new ButtonDescriptor(openRoomAction);
+ openRoomAction.setInviteMembers(false);
+ button.setVisible(false);
+ button.setStyles("k-chat-add-as-buddie");
+ openRoomAction.addPropertyChangeListener(new PropertyChangeListener() {
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getPropertyName().equals(AbstractAction.ENABLED)) {
+ button.setVisible((Boolean) event.getNewValue());
+ }
+ }
+ });
+ entityHeader.addAction(button);
+ }
+}
\ No newline at end of file
Property changes on: trunk/src/main/java/cc/kune/chat/client/actions/OpenGroupPublicChatRoomButton.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithMemberAction.java (from rev 1269, trunk/src/main/java/cc/kune/chat/client/StartChatWithMemberAction.java)
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithMemberAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithMemberAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,39 @@
+package cc.kune.chat.client.actions;
+
+import cc.kune.chat.client.ChatClient;
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.Action;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.noti.NotifyUser;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class StartChatWithMemberAction extends AbstractExtendedAction {
+ private final Provider<ChatClient> chatClient;
+ private final I18nTranslationService i18n;
+
+ @Inject
+ public StartChatWithMemberAction(final I18nTranslationService i18n, final CoreResources res,
+ final Provider<ChatClient> chatClient) {
+ this.i18n = i18n;
+ this.chatClient = chatClient;
+ putValue(NAME, i18n.t("Chat with this member"));
+ putValue(Action.SMALL_ICON, res.newChat());
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ chatClient.get().show();
+ if (chatClient.get().isLoggedIn()) {
+ chatClient.get().chat(XmppURI.jid(((GroupDTO) event.getTarget()).getShortName()));
+ } else {
+ NotifyUser.important(i18n.t("To start a chat you need to be 'online'"));
+ }
+ }
+
+}
Property changes on: trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithMemberAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithThisBuddieAction.java (from rev 1269, trunk/src/main/java/cc/kune/chat/client/StartChatWithThisBuddieAction.java)
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithThisBuddieAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithThisBuddieAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,17 @@
+package cc.kune.chat.client.actions;
+
+import cc.kune.chat.client.ChatClient;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class StartChatWithThisBuddieAction extends StartChatWithMemberAction {
+ @Inject
+ public StartChatWithThisBuddieAction(final I18nTranslationService i18n, final CoreResources res,
+ final Provider<ChatClient> chatClient) {
+ super(i18n, res, chatClient);
+ putValue(NAME, i18n.t("Chat with your buddie"));
+ }
+}
Copied: trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithUserAction.java (from rev 1269, trunk/src/main/java/cc/kune/chat/client/StartChatWithUserAction.java)
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithUserAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithUserAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,17 @@
+package cc.kune.chat.client.actions;
+
+import cc.kune.chat.client.ChatClient;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class StartChatWithUserAction extends StartChatWithMemberAction {
+ @Inject
+ public StartChatWithUserAction(final I18nTranslationService i18n, final CoreResources res,
+ final Provider<ChatClient> chatClient) {
+ super(i18n, res, chatClient);
+ putValue(NAME, i18n.t("Chat with this person"));
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/chat/client/actions/StartChatWithUserAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -74,10 +74,10 @@
import cc.kune.core.client.sn.UserSNPanel;
import cc.kune.core.client.sn.UserSNPresenter;
import cc.kune.core.client.sn.actions.registry.GroupSNAdminsMenuItemsRegistry;
-import cc.kune.core.client.sn.actions.registry.GroupSNBottomActionsRegistry;
import cc.kune.core.client.sn.actions.registry.GroupSNCollabsMenuItemsRegistry;
+import cc.kune.core.client.sn.actions.registry.GroupSNConfActions;
import cc.kune.core.client.sn.actions.registry.GroupSNPendingsMenuItemsRegistry;
-import cc.kune.core.client.sn.actions.registry.UserSNBottomActionsRegistry;
+import cc.kune.core.client.sn.actions.registry.UserSNConfActions;
import cc.kune.core.client.sn.actions.registry.UserSNMenuItemsRegistry;
import cc.kune.core.client.state.AccessRightsClientManager;
import cc.kune.core.client.state.ContentCache;
@@ -200,9 +200,9 @@
bind(GroupSNAdminsMenuItemsRegistry.class).in(Singleton.class);
bind(GroupSNCollabsMenuItemsRegistry.class).in(Singleton.class);
bind(GroupSNPendingsMenuItemsRegistry.class).in(Singleton.class);
- bind(GroupSNBottomActionsRegistry.class).in(Singleton.class);
- bind(UserSNBottomActionsRegistry.class).in(Singleton.class);
bind(UserSNMenuItemsRegistry.class).in(Singleton.class);
+ bind(GroupSNConfActions.class).in(Singleton.class);
+ bind(UserSNConfActions.class).in(Singleton.class);
bind(SiteUserOptionsPresenter.class).in(Singleton.class);
bind(SiteUserOptions.class).to(SiteUserOptionsPresenter.class).in(Singleton.class);
Modified: trunk/src/main/java/cc/kune/core/client/CoreParts.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreParts.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/CoreParts.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -5,7 +5,7 @@
import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
import cc.kune.core.client.sn.UserSNPresenter;
import cc.kune.core.client.sn.GroupSNPresenter;
-import cc.kune.core.client.sn.actions.registry.GroupMembersConfActions;
+import cc.kune.core.client.sn.actions.registry.GroupSNConfActions;
import cc.kune.core.client.sn.actions.registry.UserSNConfActions;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.ui.footer.license.EntityLicensePresenter;
@@ -18,7 +18,7 @@
@Inject
public CoreParts(final Session session, final Provider<GroupSNPresenter> groupMembersPresenter,
final Provider<UserSNPresenter> buddiesAndParticipationPresenter,
- final Provider<GroupMembersConfActions> groupMembersConfActions,
+ final Provider<GroupSNConfActions> groupMembersConfActions,
final Provider<UserSNConfActions> userSNConfActions, final Provider<SiteUserOptionsPresenter> userOptions,
final Provider<EntityLicensePresenter> licenseFooter) {
session.onInitDataReceived(true, new AppStartHandler() {
Modified: trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/GroupSNPresenter.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -5,8 +5,8 @@
import cc.kune.common.client.actions.ui.IsActionExtensible;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
import cc.kune.core.client.services.FileDownloadUtils;
+import cc.kune.core.client.sn.actions.registry.GroupSNConfActions;
import cc.kune.core.client.sn.actions.registry.GroupSNAdminsMenuItemsRegistry;
-import cc.kune.core.client.sn.actions.registry.GroupSNBottomActionsRegistry;
import cc.kune.core.client.sn.actions.registry.GroupSNCollabsMenuItemsRegistry;
import cc.kune.core.client.sn.actions.registry.GroupSNPendingsMenuItemsRegistry;
import cc.kune.core.client.state.Session;
@@ -71,7 +71,7 @@
void showOrphan();
}
- private final GroupSNBottomActionsRegistry actionsRegistry;
+ private final GroupSNConfActions actionsRegistry;
private final GroupSNAdminsMenuItemsRegistry adminsMenuItemsRegistry;
private final GroupSNCollabsMenuItemsRegistry collabsMenuItemsRegistry;
private final GroupSNPendingsMenuItemsRegistry pendingsMenuItemsRegistry;
@@ -82,7 +82,7 @@
final GroupSNAdminsMenuItemsRegistry adminsMenuItemsRegistry,
final GroupSNCollabsMenuItemsRegistry collabsMenuItemsRegistry,
final GroupSNPendingsMenuItemsRegistry pendingsMenuItemsRegistry,
- final GroupSNBottomActionsRegistry actionsRegistry) {
+ final GroupSNConfActions actionsRegistry) {
super(eventBus, view, proxy, downloadProvider);
this.adminsMenuItemsRegistry = adminsMenuItemsRegistry;
this.collabsMenuItemsRegistry = collabsMenuItemsRegistry;
Modified: trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/UserSNPresenter.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -7,7 +7,7 @@
import cc.kune.core.client.services.FileDownloadUtils;
import cc.kune.core.client.sn.UserSNPresenter.UserSNProxy;
import cc.kune.core.client.sn.UserSNPresenter.UserSNView;
-import cc.kune.core.client.sn.actions.registry.UserSNBottomActionsRegistry;
+import cc.kune.core.client.sn.actions.registry.UserSNConfActions;
import cc.kune.core.client.sn.actions.registry.UserSNMenuItemsRegistry;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.SocialNetworkChangedEvent;
@@ -67,7 +67,7 @@
void showBuddiesNotPublic();
}
- private final UserSNBottomActionsRegistry actionsRegistry;
+ private final UserSNConfActions confActionsRegistry;
private final I18nTranslationService i18n;
private final UserSNMenuItemsRegistry userMenuItemsRegistry;
@@ -75,11 +75,11 @@
public UserSNPresenter(final EventBus eventBus, final UserSNView view, final UserSNProxy proxy,
final I18nTranslationService i18n, final StateManager stateManager, final Session session,
final Provider<FileDownloadUtils> downloadProvider, final UserSNMenuItemsRegistry userMenuItemsRegistry,
- final UserSNBottomActionsRegistry actionsRegistry) {
+ final UserSNConfActions confActionsRegistry) {
super(eventBus, view, proxy, downloadProvider);
this.i18n = i18n;
this.userMenuItemsRegistry = userMenuItemsRegistry;
- this.actionsRegistry = actionsRegistry;
+ this.confActionsRegistry = confActionsRegistry;
stateManager.onStateChanged(true, new StateChangedEvent.StateChangedHandler() {
@Override
public void onStateChanged(final StateChangedEvent event) {
@@ -108,7 +108,7 @@
}
private void createActions() {
- getView().getBottomToolbar().addActions(actionsRegistry);
+ getView().getBottomToolbar().addActions(confActionsRegistry);
}
@Override
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -16,7 +16,7 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-public class JoinGroupAction extends RolAction {
+public class JoinGroupAction extends SNRolAction {
@Inject
public JoinGroupAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n,
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -2,8 +2,6 @@
import cc.kune.common.client.actions.AbstractExtendedAction;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
-import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync;
import cc.kune.core.client.state.AccessRightsChangedEvent;
import cc.kune.core.client.state.AccessRightsChangedEvent.AccessRightsChangedHandler;
import cc.kune.core.client.state.AccessRightsClientManager;
@@ -11,26 +9,19 @@
import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.domain.utils.AccessRights;
import cc.kune.core.shared.dto.AccessRolDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
import com.google.inject.Inject;
-import com.google.inject.Provider;
public abstract class RolAction extends AbstractExtendedAction {
- protected final I18nTranslationService i18n;
protected final Session session;
- protected final Provider<SocialNetworkServiceAsync> snServiceProvider;
protected final StateManager stateManager;
@Inject
- public RolAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n,
- final CoreResources res, final Provider<SocialNetworkServiceAsync> snServiceProvider,
+ public RolAction(final StateManager stateManager, final Session session,
final AccessRightsClientManager rightsManager, final AccessRolDTO rolRequired, final boolean authNeed,
final boolean visibleForNonMemb, final boolean visibleForMembers) {
this.stateManager = stateManager;
this.session = session;
- this.i18n = i18n;
- this.snServiceProvider = snServiceProvider;
rightsManager.onRightsChanged(true, new AccessRightsChangedHandler() {
@Override
public void onAccessRightsChanged(final AccessRightsChangedEvent event) {
Copied: trunk/src/main/java/cc/kune/core/client/sn/actions/SNRolAction.java (from rev 1267, trunk/src/main/java/cc/kune/core/client/sn/actions/RolAction.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/SNRolAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/SNRolAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,27 @@
+package cc.kune.core.client.sn.actions;
+
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.rpcservices.SocialNetworkServiceAsync;
+import cc.kune.core.client.state.AccessRightsClientManager;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public abstract class SNRolAction extends RolAction {
+ protected final I18nTranslationService i18n;
+ protected final Provider<SocialNetworkServiceAsync> snServiceProvider;
+
+ @Inject
+ public SNRolAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n,
+ final CoreResources res, final Provider<SocialNetworkServiceAsync> snServiceProvider,
+ final AccessRightsClientManager rightsManager, final AccessRolDTO rolRequired, final boolean authNeed,
+ final boolean visibleForNonMemb, final boolean visibleForMembers) {
+ super(stateManager, session, rightsManager, rolRequired, authNeed, visibleForNonMemb, visibleForMembers);
+ this.i18n = i18n;
+ this.snServiceProvider = snServiceProvider;
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/SNRolAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinGroupAction.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinGroupAction.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -17,7 +17,7 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-public class UnJoinGroupAction extends RolAction {
+public class UnJoinGroupAction extends SNRolAction {
@Inject
public UnJoinGroupAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n,
Deleted: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,33 +0,0 @@
-package cc.kune.core.client.sn.actions.conditions;
-
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
-import cc.kune.common.client.actions.ui.descrip.GuiAddCondition;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.shared.dto.StateAbstractDTO;
-import cc.kune.core.shared.dto.StateContainerDTO;
-import cc.kune.core.shared.dto.StateContentDTO;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
- at Singleton
-public class IsAdministrableCondition implements GuiAddCondition {
-
- private final Session session;
-
- @Inject
- public IsAdministrableCondition(final Session session) {
- this.session = session;
- }
-
- @Override
- public boolean mustBeAdded(final GuiActionDescrip descr) {
- final StateAbstractDTO currentState = session.getCurrentState();
- if (currentState instanceof StateContentDTO) {
- return ((StateContentDTO) currentState).getGroupRights().isAdministrable();
- } else {
- // session.getContainerState() instanceof StateContentDTO)
- return ((StateContainerDTO) currentState).getGroupRights().isAdministrable();
- }
- }
-}
Added: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAGroupCondition.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAGroupCondition.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAGroupCondition.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,24 @@
+package cc.kune.core.client.sn.actions.conditions;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.GuiAddCondition;
+import cc.kune.core.client.state.Session;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class IsCurrentStateAGroupCondition implements GuiAddCondition {
+
+ private final Session session;
+
+ @Inject
+ public IsCurrentStateAGroupCondition(final Session session) {
+ this.session = session;
+ }
+
+ @Override
+ public boolean mustBeAdded(final GuiActionDescrip descr) {
+ return session.isCurrentStateAGroup();
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAGroupCondition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAPersonCondition.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAPersonCondition.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAPersonCondition.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,24 @@
+package cc.kune.core.client.sn.actions.conditions;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.GuiAddCondition;
+import cc.kune.core.client.state.Session;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class IsCurrentStateAPersonCondition implements GuiAddCondition {
+
+ private final Session session;
+
+ @Inject
+ public IsCurrentStateAPersonCondition(final Session session) {
+ this.session = session;
+ }
+
+ @Override
+ public boolean mustBeAdded(final GuiActionDescrip descr) {
+ return session.isCurrentStateAPerson();
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAPersonCondition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAdministrableCondition.java (from rev 1262, trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsAdministrableCondition.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAdministrableCondition.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAdministrableCondition.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,33 @@
+package cc.kune.core.client.sn.actions.conditions;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.GuiAddCondition;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.dto.StateAbstractDTO;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class IsCurrentStateAdministrableCondition implements GuiAddCondition {
+
+ private final Session session;
+
+ @Inject
+ public IsCurrentStateAdministrableCondition(final Session session) {
+ this.session = session;
+ }
+
+ @Override
+ public boolean mustBeAdded(final GuiActionDescrip descr) {
+ final StateAbstractDTO currentState = session.getCurrentState();
+ if (currentState instanceof StateContentDTO) {
+ return ((StateContentDTO) currentState).getGroupRights().isAdministrable();
+ } else {
+ // session.getContainerState() instanceof StateContentDTO)
+ return ((StateContainerDTO) currentState).getGroupRights().isAdministrable();
+ }
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateAdministrableCondition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java (from rev 1262, trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsEditableCondition.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,38 @@
+package cc.kune.core.client.sn.actions.conditions;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.GuiAddCondition;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.dto.StateAbstractDTO;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.dto.StateContentDTO;
+
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class IsCurrentStateEditableCondition implements GuiAddCondition {
+
+ private final Session session;
+
+ @Inject
+ public IsCurrentStateEditableCondition(final Session session) {
+ this.session = session;
+ }
+
+ @Override
+ public boolean mustBeAdded(final GuiActionDescrip descr) {
+ final StateAbstractDTO currentState = session.getCurrentState();
+ if (currentState == null) {
+ return false;
+ } else {
+ if (currentState instanceof StateContentDTO) {
+ return ((StateContentDTO) currentState).getGroupRights().isEditable();
+ } else {
+ // session.getContainerState() instanceof StateContentDTO)
+ return ((StateContainerDTO) currentState).getGroupRights().isEditable();
+ }
+ }
+
+ }
+}
Property changes on: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsCurrentStateEditableCondition.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsEditableCondition.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsEditableCondition.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/conditions/IsEditableCondition.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,33 +0,0 @@
-package cc.kune.core.client.sn.actions.conditions;
-
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
-import cc.kune.common.client.actions.ui.descrip.GuiAddCondition;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.shared.dto.StateAbstractDTO;
-import cc.kune.core.shared.dto.StateContainerDTO;
-import cc.kune.core.shared.dto.StateContentDTO;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
- at Singleton
-public class IsEditableCondition implements GuiAddCondition {
-
- private final Session session;
-
- @Inject
- public IsEditableCondition(final Session session) {
- this.session = session;
- }
-
- @Override
- public boolean mustBeAdded(final GuiActionDescrip descr) {
- final StateAbstractDTO currentState = session.getCurrentState();
- if (currentState instanceof StateContentDTO) {
- return ((StateContentDTO) currentState).getGroupRights().isEditable();
- } else {
- // session.getContainerState() instanceof StateContentDTO)
- return ((StateContainerDTO) currentState).getGroupRights().isEditable();
- }
- }
-}
Deleted: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersConfActions.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersConfActions.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,103 +0,0 @@
-package cc.kune.core.client.sn.actions.registry;
-
-import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
-import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
-import cc.kune.common.client.actions.ui.descrip.MenuRadioItemDescriptor;
-import cc.kune.common.client.actions.ui.descrip.SubMenuDescriptor;
-import cc.kune.core.client.resources.CoreResources;
-import cc.kune.core.client.sn.actions.JoinGroupAction;
-import cc.kune.core.client.sn.actions.MembersModerationMenuItem;
-import cc.kune.core.client.sn.actions.MembersVisibilityMenuItem;
-import cc.kune.core.client.sn.actions.UnJoinGroupAction;
-import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
-import cc.kune.core.client.sn.actions.conditions.IsLoggedCondition;
-import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateChangedEvent;
-import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
-import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.domain.AdmissionType;
-import cc.kune.core.shared.domain.SocialNetworkVisibility;
-import cc.kune.core.shared.dto.GroupDTO;
-import cc.kune.core.shared.dto.StateAbstractDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.google.inject.Inject;
-import com.google.inject.Provider;
-
-public class GroupMembersConfActions {
-
- public static final SubMenuDescriptor MODERATION_SUBMENU = new SubMenuDescriptor();
- public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
- public static final SubMenuDescriptor VISIBILITY_SUBMENU = new SubMenuDescriptor();
-
- @Inject
- public GroupMembersConfActions(final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final GroupSNBottomActionsRegistry registry,
- final Provider<MembersVisibilityMenuItem> membersVisibility,
- final Provider<MembersModerationMenuItem> membersModeration, final CoreResources res,
- final IsLoggedCondition isLoggedCondition, final JoinGroupAction joinGroupAction,
- final IsGroupCondition isGroupCondition, final UnJoinGroupAction unJoinGroupAction) {
- OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowDownSitebar()).withStyles("k-sn-options-menu");
- final MenuRadioItemDescriptor anyoneItem = membersVisibility.get().withVisibility(
- SocialNetworkVisibility.anyone);
- final MenuRadioItemDescriptor onlyMembersItem = membersVisibility.get().withVisibility(
- SocialNetworkVisibility.onlymembers);
- final MenuRadioItemDescriptor onlyAdminsItem = membersVisibility.get().withVisibility(
- SocialNetworkVisibility.onlyadmins);
- final MenuRadioItemDescriptor closedItem = membersModeration.get().withModeration(AdmissionType.Closed);
- final MenuRadioItemDescriptor moderatedItem = membersModeration.get().withModeration(AdmissionType.Moderated);
- final MenuRadioItemDescriptor openItem = membersModeration.get().withModeration(AdmissionType.Open);
- registry.add(OPTIONS_MENU);
- registry.add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(OPTIONS_MENU));
- registry.add(MODERATION_SUBMENU.withText(i18n.t("New members policy")).withParent(OPTIONS_MENU));
- registry.add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
- registry.add(onlyMembersItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only members")));
- registry.add(onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins")));
- registry.add(moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join")));
- registry.add(openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join")));
- // registry.add(closedItem.withParent(MODERATION_SUBMENU).withText(
- // i18n.t("closed for new members")));
-
- final ButtonDescriptor joinBtn = new ButtonDescriptor(joinGroupAction);
- final ButtonDescriptor unJoinBtn = new ButtonDescriptor(unJoinGroupAction);
- unJoinBtn.add(isLoggedCondition);
- registry.add(joinBtn.withStyles("k-no-backimage"));
- registry.add(unJoinBtn.withStyles("k-no-backimage"));
-
- stateManager.onStateChanged(true, new StateChangedHandler() {
- @Override
- public void onStateChanged(final StateChangedEvent event) {
- final boolean administrable = event.getState().getGroupRights().isAdministrable();
- OPTIONS_MENU.setVisible(administrable);
- OPTIONS_MENU.setEnabled(administrable);
- final StateAbstractDTO state = event.getState();
- final GroupDTO currentGroup = state.getGroup();
- if (currentGroup.isNotPersonal()) {
- switch (state.getSocialNetworkData().getSocialNetworkVisibility()) {
- case anyone:
- anyoneItem.setChecked(true);
- break;
- case onlyadmins:
- onlyAdminsItem.setChecked(true);
- break;
- case onlymembers:
- onlyMembersItem.setChecked(true);
- break;
- }
- }
- switch (currentGroup.getAdmissionType()) {
- case Moderated:
- moderatedItem.setChecked(true);
- break;
- case Open:
- openItem.setChecked(true);
- break;
- case Closed:
- closedItem.setChecked(true);
- break;
- }
- unJoinBtn.setVisible(session.isLogged());
- }
- });
- }
-}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNAdminsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNAdminsMenuItemsRegistry.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNAdminsMenuItemsRegistry.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -9,7 +9,7 @@
import cc.kune.core.client.sn.actions.GotoMemberAction;
import cc.kune.core.client.sn.actions.GotoYourHomePageAction;
import cc.kune.core.client.sn.actions.RemoveMemberAction;
-import cc.kune.core.client.sn.actions.conditions.IsAdministrableCondition;
+import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAdministrableCondition;
import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
import cc.kune.core.client.sn.actions.conditions.IsLoggedCondition;
import cc.kune.core.client.sn.actions.conditions.IsMeCondition;
@@ -24,7 +24,7 @@
@Inject
public GroupSNAdminsMenuItemsRegistry(final Session session, final IsLoggedCondition isLogged,
- final IsAdministrableCondition isAdministrableCondition, final IsPersonCondition isPersonCondition,
+ final IsCurrentStateAdministrableCondition isAdministrableCondition, final IsPersonCondition isPersonCondition,
final IsGroupCondition isGroupCondition, final IsMeCondition isMe, final IsNotMeCondition isNotMe,
final ChangeToCollabAction changeToCollabAction, final ChangeToAdminAction changeToAdminAction,
final RemoveMemberAction removeMemberAction, final AcceptJoinGroupAction acceptJoinGroupAction,
Deleted: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNBottomActionsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNBottomActionsRegistry.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNBottomActionsRegistry.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,6 +0,0 @@
-package cc.kune.core.client.sn.actions.registry;
-
-
-public class GroupSNBottomActionsRegistry extends AbstractSNActionsRegistry {
-
-}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNCollabsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNCollabsMenuItemsRegistry.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNCollabsMenuItemsRegistry.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -9,7 +9,7 @@
import cc.kune.core.client.sn.actions.GotoMemberAction;
import cc.kune.core.client.sn.actions.GotoYourHomePageAction;
import cc.kune.core.client.sn.actions.RemoveMemberAction;
-import cc.kune.core.client.sn.actions.conditions.IsAdministrableCondition;
+import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAdministrableCondition;
import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
import cc.kune.core.client.sn.actions.conditions.IsMeCondition;
import cc.kune.core.client.sn.actions.conditions.IsNotMeCondition;
@@ -22,7 +22,7 @@
public class GroupSNCollabsMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
@Inject
- public GroupSNCollabsMenuItemsRegistry(final Session session, final IsAdministrableCondition isAdministrableCondition,
+ public GroupSNCollabsMenuItemsRegistry(final Session session, final IsCurrentStateAdministrableCondition isAdministrableCondition,
final IsPersonCondition isPersonCondition, final IsGroupCondition isGroupCondition,
final IsMeCondition isMe, final IsNotMeCondition isNotMe, final ChangeToCollabAction changeToCollabAction,
final ChangeToAdminAction changeToAdminAction, final RemoveMemberAction removeMemberAction,
Copied: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java (from rev 1271, trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupMembersConfActions.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,107 @@
+package cc.kune.core.client.sn.actions.registry;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.MenuDescriptor;
+import cc.kune.common.client.actions.ui.descrip.MenuRadioItemDescriptor;
+import cc.kune.common.client.actions.ui.descrip.MenuTitleItemDescriptor;
+import cc.kune.common.client.actions.ui.descrip.SubMenuDescriptor;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.sn.actions.JoinGroupAction;
+import cc.kune.core.client.sn.actions.MembersModerationMenuItem;
+import cc.kune.core.client.sn.actions.MembersVisibilityMenuItem;
+import cc.kune.core.client.sn.actions.UnJoinGroupAction;
+import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
+import cc.kune.core.client.sn.actions.conditions.IsLoggedCondition;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateChangedEvent;
+import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.AdmissionType;
+import cc.kune.core.shared.domain.SocialNetworkVisibility;
+import cc.kune.core.shared.dto.GroupDTO;
+import cc.kune.core.shared.dto.StateAbstractDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+ at SuppressWarnings("serial")
+public class GroupSNConfActions extends AbstractSNActionsRegistry {
+
+ public static final SubMenuDescriptor MODERATION_SUBMENU = new SubMenuDescriptor();
+ public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
+ public static final SubMenuDescriptor VISIBILITY_SUBMENU = new SubMenuDescriptor();
+
+ @Inject
+ public GroupSNConfActions(final Session session, final StateManager stateManager,
+ final I18nTranslationService i18n, final Provider<MembersVisibilityMenuItem> membersVisibility,
+ final Provider<MembersModerationMenuItem> membersModeration, final CoreResources res,
+ final IsLoggedCondition isLoggedCondition, final JoinGroupAction joinGroupAction,
+ final IsGroupCondition isGroupCondition, final UnJoinGroupAction unJoinGroupAction) {
+ OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowDownSitebar()).withStyles("k-sn-options-menu");
+ final GuiActionDescrip optionsTitle = new MenuTitleItemDescriptor(i18n.t("Options")).withParent(OPTIONS_MENU);
+ final MenuRadioItemDescriptor anyoneItem = membersVisibility.get().withVisibility(
+ SocialNetworkVisibility.anyone);
+ final MenuRadioItemDescriptor onlyMembersItem = membersVisibility.get().withVisibility(
+ SocialNetworkVisibility.onlymembers);
+ final MenuRadioItemDescriptor onlyAdminsItem = membersVisibility.get().withVisibility(
+ SocialNetworkVisibility.onlyadmins);
+ final MenuRadioItemDescriptor closedItem = membersModeration.get().withModeration(AdmissionType.Closed);
+ final MenuRadioItemDescriptor moderatedItem = membersModeration.get().withModeration(AdmissionType.Moderated);
+ final MenuRadioItemDescriptor openItem = membersModeration.get().withModeration(AdmissionType.Open);
+ add(OPTIONS_MENU);
+ add(optionsTitle);
+ add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(OPTIONS_MENU));
+ add(MODERATION_SUBMENU.withText(i18n.t("New members policy")).withParent(OPTIONS_MENU));
+ add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
+ add(onlyMembersItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only members")));
+ add(onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins")));
+ add(moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join")));
+ add(openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join")));
+ // add(closedItem.withParent(MODERATION_SUBMENU).withText(
+ // i18n.t("closed for new members")));
+
+ final ButtonDescriptor joinBtn = new ButtonDescriptor(joinGroupAction);
+ final ButtonDescriptor unJoinBtn = new ButtonDescriptor(unJoinGroupAction);
+ unJoinBtn.add(isLoggedCondition);
+ add(joinBtn.withStyles("k-no-backimage"));
+ add(unJoinBtn.withStyles("k-no-backimage"));
+
+ stateManager.onStateChanged(true, new StateChangedHandler() {
+ @Override
+ public void onStateChanged(final StateChangedEvent event) {
+ final boolean administrable = event.getState().getGroupRights().isAdministrable();
+ OPTIONS_MENU.setVisible(administrable);
+ OPTIONS_MENU.setEnabled(administrable);
+ final StateAbstractDTO state = event.getState();
+ final GroupDTO currentGroup = state.getGroup();
+ if (currentGroup.isNotPersonal()) {
+ switch (state.getSocialNetworkData().getSocialNetworkVisibility()) {
+ case anyone:
+ anyoneItem.setChecked(true);
+ break;
+ case onlyadmins:
+ onlyAdminsItem.setChecked(true);
+ break;
+ case onlymembers:
+ onlyMembersItem.setChecked(true);
+ break;
+ }
+ }
+ switch (currentGroup.getAdmissionType()) {
+ case Moderated:
+ moderatedItem.setChecked(true);
+ break;
+ case Open:
+ openItem.setChecked(true);
+ break;
+ case Closed:
+ closedItem.setChecked(true);
+ break;
+ }
+ unJoinBtn.setVisible(session.isLogged());
+ }
+ });
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNPendingsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNPendingsMenuItemsRegistry.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNPendingsMenuItemsRegistry.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -8,7 +8,7 @@
import cc.kune.core.client.sn.actions.GotoGroupAction;
import cc.kune.core.client.sn.actions.GotoPersonAction;
import cc.kune.core.client.sn.actions.RemoveMemberAction;
-import cc.kune.core.client.sn.actions.conditions.IsAdministrableCondition;
+import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAdministrableCondition;
import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
import cc.kune.core.client.sn.actions.conditions.IsPersonCondition;
import cc.kune.core.client.state.Session;
@@ -19,7 +19,7 @@
public class GroupSNPendingsMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
@Inject
- public GroupSNPendingsMenuItemsRegistry(final Session session, final IsAdministrableCondition isAdministrableCondition,
+ public GroupSNPendingsMenuItemsRegistry(final Session session, final IsCurrentStateAdministrableCondition isAdministrableCondition,
final IsPersonCondition isPersonCondition, final IsGroupCondition isGroupCondition,
final ChangeToCollabAction changeToCollabAction, final ChangeToAdminAction changeToAdminAction,
final RemoveMemberAction removeMemberAction, final AcceptJoinGroupAction acceptJoinGroupAction,
Deleted: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNBottomActionsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNBottomActionsRegistry.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNBottomActionsRegistry.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,6 +0,0 @@
-package cc.kune.core.client.sn.actions.registry;
-
-
-public class UserSNBottomActionsRegistry extends AbstractSNActionsRegistry {
-
-}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -20,35 +20,33 @@
import com.google.inject.Inject;
import com.google.inject.Provider;
-public class UserSNConfActions {
+ at SuppressWarnings("serial")
+public class UserSNConfActions extends AbstractSNActionsRegistry {
public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
public static final SubMenuDescriptor VISIBILITY_SUBMENU = new SubMenuDescriptor();
@Inject
public UserSNConfActions(final Session session, final StateManager stateManager, final I18nTranslationService i18n,
- final UserSNBottomActionsRegistry registry, final Provider<UserSNVisibilityMenuItem> userBuddiesVisibility,
- final CoreResources res, final IsGroupCondition isGroupCondition,
- final AddNewBuddiesAction addNewBuddiesAction) {
+ final Provider<UserSNVisibilityMenuItem> userBuddiesVisibility, final CoreResources res,
+ final IsGroupCondition isGroupCondition, final AddNewBuddiesAction addNewBuddiesAction) {
OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowDownSitebar()).withStyles("k-sn-options-menu");
- final MenuRadioItemDescriptor anyoneItem = userBuddiesVisibility.get().withVisibility(
- UserSNetVisibility.anyone);
+ final MenuRadioItemDescriptor anyoneItem = userBuddiesVisibility.get().withVisibility(UserSNetVisibility.anyone);
final MenuRadioItemDescriptor onlyYourBuddiesItem = userBuddiesVisibility.get().withVisibility(
UserSNetVisibility.yourbuddies);
- final MenuRadioItemDescriptor onlyYou = userBuddiesVisibility.get().withVisibility(
- UserSNetVisibility.onlyyou);
+ final MenuRadioItemDescriptor onlyYou = userBuddiesVisibility.get().withVisibility(UserSNetVisibility.onlyyou);
assert anyoneItem.getAction() != onlyYourBuddiesItem.getAction();
assert anyoneItem.getAction() != onlyYou.getAction();
- registry.add(OPTIONS_MENU);
- registry.add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view your network")).withParent(OPTIONS_MENU));
- registry.add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
- registry.add(onlyYourBuddiesItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only your buddies")));
- registry.add(onlyYou.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only you")));
+ add(OPTIONS_MENU);
+ add(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view your network")).withParent(OPTIONS_MENU));
+ add(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
+ add(onlyYourBuddiesItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only your buddies")));
+ add(onlyYou.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only you")));
final ButtonDescriptor addBuddieBtn = new ButtonDescriptor(addNewBuddiesAction);
- registry.add(addBuddieBtn.withStyles("k-no-backimage"));
+ add(addBuddieBtn.withStyles("k-no-backimage"));
stateManager.onStateChanged(true, new StateChangedHandler() {
@Override
@@ -57,8 +55,7 @@
final boolean administrable = state.getGroupRights().isAdministrable();
OPTIONS_MENU.setVisible(administrable);
OPTIONS_MENU.setEnabled(administrable);
- final GroupDTO currentGroup = state.getGroup();
- if (currentGroup.isPersonal()) {
+ if (state.getGroup().isPersonal()) {
final UserSNetVisibility visibility = state.getSocialNetworkData().getUserBuddiesVisibility();
switch (visibility) {
case anyone:
@@ -74,8 +71,8 @@
// NotifyUser.info(i18n.t("Visibility of your network is " +
// visibility.toString()));
}
- addBuddieBtn.setVisible(session.isLogged() && currentGroup.isPersonal()
- && session.getCurrentUser().getShortName().equals(currentGroup.getShortName()));
+ addBuddieBtn.setVisible(session.isLogged() && state.getGroup().isPersonal()
+ && session.getCurrentUser().getShortName().equals(state.getGroup().getShortName()));
}
});
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -10,7 +10,7 @@
import cc.kune.core.client.sn.actions.GotoYourHomePageAction;
import cc.kune.core.client.sn.actions.RemoveMemberAction;
import cc.kune.core.client.sn.actions.UnJoinGroupAction;
-import cc.kune.core.client.sn.actions.conditions.IsAdministrableCondition;
+import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAdministrableCondition;
import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
import cc.kune.core.client.sn.actions.conditions.IsLoggedCondition;
import cc.kune.core.client.sn.actions.conditions.IsMeCondition;
@@ -25,7 +25,7 @@
public class UserSNMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
@Inject
- public UserSNMenuItemsRegistry(final Session session, final IsAdministrableCondition isAdministrableCondition,
+ public UserSNMenuItemsRegistry(final Session session, final IsCurrentStateAdministrableCondition isAdministrableCondition,
final IsPersonCondition isPersonCondition, final IsGroupCondition isGroupCondition,
final IsLoggedCondition isLoggedCondition, final IsMeCondition isMe, final IsNotMeCondition isNotMe,
final ChangeToCollabAction changeToCollabAction, final ChangeToAdminAction changeToAdminAction,
Modified: trunk/src/main/java/cc/kune/core/client/state/Session.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/Session.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/state/Session.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -130,6 +130,8 @@
boolean isCurrentStateAGroup();
+ boolean isCurrentStateAPerson();
+
boolean isInCurrentUserSpace();
boolean isLogged();
Modified: trunk/src/main/java/cc/kune/core/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SessionDefault.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/main/java/cc/kune/core/client/state/SessionDefault.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -240,6 +240,11 @@
}
@Override
+ public boolean isCurrentStateAPerson() {
+ return currentState == null ? false : currentState.getGroup().isPersonal();
+ }
+
+ @Override
public boolean isInCurrentUserSpace() {
if (!isLogged()) {
return false;
Added: trunk/src/main/webapp/WEB-INF/web.xml.wiab-int-sample
===================================================================
--- trunk/src/main/webapp/WEB-INF/web.xml.wiab-int-sample (rev 0)
+++ trunk/src/main/webapp/WEB-INF/web.xml.wiab-int-sample 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app
+ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+
+<web-app>
+
+ <filter>
+ <filter-name>guiceFilter</filter-name>
+ <filter-class>com.example.CustomGuiceFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>guiceFilter</filter-name>
+ <url-pattern>/hw/*</url-pattern>
+ </filter-mapping>
+</web-app>
Deleted: trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolActionTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolActionTest.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolActionTest.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -1,102 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package org.ourproject.kune.workspace.client.socialnet;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.ourproject.kune.workspace.client.oldsn.RolAction;
-import org.ourproject.kune.workspace.client.oldsn.UIStatus;
-
-import cc.kune.core.shared.domain.utils.AccessRights;
-import cc.kune.core.shared.dto.AccessRolDTO;
-
-public class RolActionTest {
-
- private AccessRights adminRights;
- private AccessRights editorRights;
- private AccessRights viewerRights;
- private AccessRights noPermRights;
- private UIStatus ff;
- private UIStatus tt;
-
- @Before
- public void before() {
- adminRights = new AccessRights(true, true, true);
- editorRights = new AccessRights(false, true, true);
- viewerRights = new AccessRights(false, false, true);
- noPermRights = new AccessRights(false, false, false);
- ff = new UIStatus(false, false);
- tt = new UIStatus(true, true);
- }
-
- @Test
- public void testRefreshStatus() {
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, false, false, true, true, noPermRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, false, true, true, noPermRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, true, true, noPermRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, false, true, noPermRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, false, false, noPermRights));
-
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Viewer, false, false, true, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, false, true, true, viewerRights));
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, true, true, viewerRights));
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, false, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, false, false, viewerRights));
-
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, false, false, true, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, false, true, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, true, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, false, viewerRights));
-
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Editor, false, false, true, true, editorRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, false, true, true, editorRights));
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, true, true, editorRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, true, editorRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, false, editorRights));
-
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Editor, false, false, true, true, adminRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, false, true, true, adminRights));
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, true, true, adminRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, true, adminRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, false, adminRights));
-
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, false, false, true, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, false, true, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, true, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, true, viewerRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, false, viewerRights));
-
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, false, false, true, true, editorRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, false, true, true, editorRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, true, true, editorRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, true, editorRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, false, editorRights));
-
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Administrator, false, false, true, true, adminRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, false, true, true, adminRights));
- assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, true, true, adminRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, true, adminRights));
- assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, false, adminRights));
-
- }
-}
Copied: trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/SNRolActionTest.java (from rev 1262, trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/RolActionTest.java)
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/SNRolActionTest.java (rev 0)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/socialnet/SNRolActionTest.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -0,0 +1,102 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package org.ourproject.kune.workspace.client.socialnet;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.ourproject.kune.workspace.client.oldsn.RolAction;
+import org.ourproject.kune.workspace.client.oldsn.UIStatus;
+
+import cc.kune.core.shared.domain.utils.AccessRights;
+import cc.kune.core.shared.dto.AccessRolDTO;
+
+public class SNRolActionTest {
+
+ private AccessRights adminRights;
+ private AccessRights editorRights;
+ private AccessRights viewerRights;
+ private AccessRights noPermRights;
+ private UIStatus ff;
+ private UIStatus tt;
+
+ @Before
+ public void before() {
+ adminRights = new AccessRights(true, true, true);
+ editorRights = new AccessRights(false, true, true);
+ viewerRights = new AccessRights(false, false, true);
+ noPermRights = new AccessRights(false, false, false);
+ ff = new UIStatus(false, false);
+ tt = new UIStatus(true, true);
+ }
+
+ @Test
+ public void testRefreshStatus() {
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, false, false, true, true, noPermRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, false, true, true, noPermRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, true, true, noPermRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, false, true, noPermRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, false, false, noPermRights));
+
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Viewer, false, false, true, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, false, true, true, viewerRights));
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, true, true, viewerRights));
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, false, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Viewer, true, true, false, false, viewerRights));
+
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, false, false, true, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, false, true, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, true, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, false, viewerRights));
+
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Editor, false, false, true, true, editorRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, false, true, true, editorRights));
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, true, true, editorRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, true, editorRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, false, editorRights));
+
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Editor, false, false, true, true, adminRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, false, true, true, adminRights));
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, true, true, adminRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, true, adminRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Editor, true, true, false, false, adminRights));
+
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, false, false, true, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, false, true, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, true, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, true, viewerRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, false, viewerRights));
+
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, false, false, true, true, editorRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, false, true, true, editorRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, true, true, editorRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, true, editorRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, false, editorRights));
+
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Administrator, false, false, true, true, adminRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, false, true, true, adminRights));
+ assertEquals(tt, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, true, true, adminRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, true, adminRights));
+ assertEquals(ff, RolAction.refreshStatus(AccessRolDTO.Administrator, true, true, false, false, adminRights));
+
+ }
+}
Modified: trunk/src/test/java/testsuites/OthersTestSuite.java
===================================================================
--- trunk/src/test/java/testsuites/OthersTestSuite.java 2011-03-12 22:13:28 UTC (rev 1271)
+++ trunk/src/test/java/testsuites/OthersTestSuite.java 2011-03-13 14:44:03 UTC (rev 1272)
@@ -33,7 +33,7 @@
import org.ourproject.kune.wiki.server.WikiServerToolTest;
import org.ourproject.kune.workspace.client.entityheader.EntityLogoPresenterTest;
import org.ourproject.kune.workspace.client.licensewizard.LicenseWizardPresenterTest;
-import org.ourproject.kune.workspace.client.socialnet.RolActionTest;
+import org.ourproject.kune.workspace.client.socialnet.SNRolActionTest;
import org.ourproject.kune.workspace.client.socialnet.RolComparatorTest;
import org.ourproject.kune.workspace.client.tags.TagsSummaryPresenterTest;
import org.ourproject.kune.workspace.client.tool.ToolSelectorPresenterTest;
@@ -50,7 +50,7 @@
@RunWith(Suite.class)
@SuiteClasses({ ChatToolTest.class, XmppManagerTest.class, DocumentToolTest.class, DocumentServerToolTest.class,
GalleryServerToolTest.class, WikiServerToolTest.class, EntityLogoPresenterTest.class,
- ToolSelectorPresenterTest.class, TagsSummaryPresenterTest.class, RolActionTest.class, RolComparatorTest.class,
+ ToolSelectorPresenterTest.class, TagsSummaryPresenterTest.class, SNRolActionTest.class, RolComparatorTest.class,
LicenseWizardPresenterTest.class, BlogServerToolTest.class, TestRESTServiceDefinition.class,
TestRESTMethodFinder.class })
public class OthersTestSuite {
More information about the kune-commits
mailing list