[kune-commits] r940 - in trunk/src: main/java/org/ourproject/kune/app/public/css/img main/java/org/ourproject/kune/chat/client main/java/org/ourproject/kune/chat/client/cnt main/java/org/ourproject/kune/chat/client/cnt/info main/java/org/ourproject/kune/chat/client/cnt/room main/java/org/ourproject/kune/chat/client/ctx main/java/org/ourproject/kune/chat/client/ctx/room main/java/org/ourproject/kune/docs/client main/java/org/ourproject/kune/docs/client/cnt main/java/org/ourproject/kune/docs/client/cnt/viewer main/java/org/ourproject/kune/platf/client/actions main/java/org/ourproject/kune/platf/client/services main/java/org/ourproject/kune/platf/client/state main/java/org/ourproject/kune/platf/client/tool main/java/org/ourproject/kune/platf/client/ui main/java/org/ourproject/kune/platf/client/ui/gridmenu main/java/org/ourproject/kune/platf/public/images main/java/org/ourproject/kune/workspace/client/editor main/java/org/ourproject/kune/workspace/client/sitebar/sitesign main/java/org/ourproject/kune/workspace/client/socialnet main/java/org/ourproject/kune/workspace/client/title test/java/org/ourproject/kune/platf/client/state test/java/org/ourproject/kune/workspace/client/editor

vjrj vjrj at ourproject.org
Wed Nov 5 23:07:11 CET 2008


Author: vjrj
Date: 2008-11-05 23:07:07 +0100 (Wed, 05 Nov 2008)
New Revision: 940

Added:
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java
   trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionListener.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java
Removed:
   trunk/src/main/java/org/ourproject/kune/app/public/css/img/chat.gif
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewListener.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewPanel.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/info/ui/
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPresenter.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlView.java
   trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdmin.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdminPresenter.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReader.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderView.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/ui/
   trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/gwtcustom/
   trunk/src/main/java/org/ourproject/kune/platf/public/images/chat.png
Modified:
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
   trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLink.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java
   trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
   trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
Log:
Complete - task ChatEngine/Tool refactorization 

Incomplete - task UI tools & workspace refactorization 

Complete - task Implements beforeSignOut (to prevent unsaved docs or chat opened)

Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/chat.gif
===================================================================
(Binary files differ)

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientActions.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -35,15 +35,19 @@
 public class ChatClientActions {
 
     private final Session session;
-    private final Provider<ChatClientTool> chatClientToolProvider;
+    private final Provider<ChatEngine> chatEngineProvider;
     private final ContentActionRegistry contentActionRegistry;
+    private final I18nUITranslationService i18n;
+    private final ContextActionRegistry contextActionRegistry;
 
     public ChatClientActions(final I18nUITranslationService i18n, final Session session,
             final ContentActionRegistry contentActionRegistry, final ContextActionRegistry contextActionRegistry,
-            final Provider<ChatClientTool> chatClientToolProvider) {
+            final Provider<ChatEngine> chatEngine) {
+        this.i18n = i18n;
         this.session = session;
         this.contentActionRegistry = contentActionRegistry;
-        this.chatClientToolProvider = chatClientToolProvider;
+        this.contextActionRegistry = contextActionRegistry;
+        this.chatEngineProvider = chatEngine;
         createActions();
     }
 
@@ -51,9 +55,9 @@
         final ActionToolbarButtonDescriptor<StateToken> chatAbout = new ActionToolbarButtonDescriptor<StateToken>(
                 AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
                     public void onEvent(final StateToken token) {
-                        chatClientToolProvider.get().getChat().joinRoom(token.toString().replaceAll("\\.", "-"),
+                        chatEngineProvider.get().joinRoom(token.toString().replaceAll("\\.", "-"),
                                 session.getCurrentUserInfo().getShortName());
-                        chatClientToolProvider.get().getChat().show();
+                        chatEngineProvider.get().show();
                     }
                 });
         // chatAbout.setTextDescription(i18n.t("Chat about"));
@@ -61,10 +65,33 @@
         chatAbout.setToolTip("Chat and comment this");
         chatAbout.setLeftSeparator(ActionToolbarButtonSeparator.fill);
 
+        ActionToolbarButtonDescriptor<StateToken> joinRoom = new ActionToolbarButtonDescriptor<StateToken>(
+                AccessRolDTO.Viewer, ActionToolbarPosition.topbar, new Listener<StateToken>() {
+                    public void onEvent(StateToken token) {
+                        chatEngineProvider.get().joinRoom(session.getContainerState().getContainer().getName(),
+                                session.getCurrentUserInfo().getShortName());
+                    }
+                });
+        joinRoom.setTextDescription(i18n.t("Enter room"));
+        joinRoom.setToolTip(i18n.t("Enter in this chat room"));
+        joinRoom.setMustBeAuthenticated(true);
+
+        ActionToolbarButtonDescriptor<StateToken> addRoom = new ActionToolbarButtonDescriptor<StateToken>(
+                AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() {
+                    public void onEvent(StateToken token) {
+
+                    }
+                });
+        addRoom.setTextDescription(i18n.t("New room"));
+        addRoom.setToolTip(i18n.t("Create a new chat room"));
+        addRoom.setMustBeAuthenticated(true);
+
         contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_DOCUMENT);
         contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_GALLERY);
         contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_WIKIPAGE);
         contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_POST);
         contentActionRegistry.addAction(chatAbout, DocumentClientTool.TYPE_UPLOADEDFILE);
+
+        contextActionRegistry.addAction(joinRoom, ChatClientTool.TYPE_ROOT);
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -23,17 +23,16 @@
 import org.ourproject.kune.chat.client.cnt.info.ChatInfo;
 import org.ourproject.kune.chat.client.cnt.info.ChatInfoPanel;
 import org.ourproject.kune.chat.client.cnt.room.ChatRoom;
-import org.ourproject.kune.chat.client.cnt.room.ChatRoomControl;
-import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlPanel;
-import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlPresenter;
 import org.ourproject.kune.chat.client.cnt.room.ChatRoomPanel;
 import org.ourproject.kune.chat.client.cnt.room.ChatRoomPresenter;
 import org.ourproject.kune.chat.client.ctx.ChatContext;
 import org.ourproject.kune.chat.client.ctx.ChatContextPresenter;
-import org.ourproject.kune.chat.client.ctx.rooms.RoomsAdmin;
-import org.ourproject.kune.chat.client.ctx.rooms.RoomsAdminPresenter;
+import org.ourproject.kune.chat.client.ctx.room.RoomAdmin;
+import org.ourproject.kune.chat.client.ctx.room.RoomAdminPresenter;
 import org.ourproject.kune.platf.client.actions.ContentActionRegistry;
+import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
 import org.ourproject.kune.platf.client.actions.ContextActionRegistry;
+import org.ourproject.kune.platf.client.actions.DragDropContentRegistry;
 import org.ourproject.kune.platf.client.app.Application;
 import org.ourproject.kune.platf.client.app.ToolGroup;
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
@@ -43,7 +42,6 @@
 import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummary;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
 import com.calclab.emiteuimodule.client.EmiteUIDialog;
@@ -60,16 +58,16 @@
             @Override
             public ChatClientActions create() {
                 return new ChatClientActions($(I18nUITranslationService.class), $(Session.class),
-                        $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatClientTool.class));
+                        $(ContentActionRegistry.class), $(ContextActionRegistry.class), $$(ChatEngine.class));
             }
         });
 
         register(ToolGroup.class, new Factory<ChatClientTool>(ChatClientTool.class) {
             @Override
             public ChatClientTool create() {
-                return new ChatClientTool($(Session.class), $(Application.class), $(I18nUITranslationService.class),
-                        $(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $$(GroupMembersSummary.class),
-                        $(ToolSelector.class), $(WsThemePresenter.class), $$(ChatContent.class), $$(ChatContext.class));
+                return new ChatClientTool($(I18nUITranslationService.class), $(WorkspaceSkeleton.class),
+                        $(ToolSelector.class), $(WsThemePresenter.class), $(ContentIconsRegistry.class),
+                        $(DragDropContentRegistry.class));
             }
         });
 
@@ -92,19 +90,16 @@
         register(Singleton.class, new Factory<ChatContext>(ChatContext.class) {
             @Override
             public ChatContext create() {
-                final ChatContextPresenter presenter = new ChatContextPresenter($$(RoomsAdmin.class));
+                final ChatContextPresenter presenter = new ChatContextPresenter($$(RoomAdmin.class));
                 return presenter;
             }
         });
 
-        register(Singleton.class, new Factory<ChatRoomControl>(ChatRoomControl.class) {
+        register(Singleton.class, new Factory<ChatEngine>(ChatEngine.class) {
             @Override
-            public ChatRoomControl create() {
-                final ChatRoomControlPresenter presenter = new ChatRoomControlPresenter();
-                final ChatRoomControlPanel panel = new ChatRoomControlPanel($(I18nUITranslationService.class),
-                        presenter);
-                presenter.init(panel);
-                return presenter;
+            public ChatEngine create() {
+                return new ChatEngineDefault($(I18nUITranslationService.class), $(WorkspaceSkeleton.class),
+                        $(Application.class), $(Session.class), $$(EmiteUIDialog.class));
             }
         });
 
@@ -117,10 +112,10 @@
             }
         });
 
-        register(Singleton.class, new Factory<RoomsAdmin>(RoomsAdmin.class) {
+        register(Singleton.class, new Factory<RoomAdmin>(RoomAdmin.class) {
             @Override
-            public RoomsAdmin create() {
-                final RoomsAdminPresenter presenter = new RoomsAdminPresenter($(ContextNavigator.class),
+            public RoomAdmin create() {
+                final RoomAdminPresenter presenter = new RoomAdminPresenter($(ContextNavigator.class),
                         $(I18nUITranslationService.class), $$(StateManager.class), $(Session.class),
                         $$(ContentServiceAsync.class));
                 return presenter;

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -19,109 +19,33 @@
  */
 package org.ourproject.kune.chat.client;
 
-import org.ourproject.kune.chat.client.cnt.ChatContent;
-import org.ourproject.kune.chat.client.ctx.ChatContext;
-import org.ourproject.kune.platf.client.app.Application;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
-import org.ourproject.kune.platf.client.dto.InitDataDTO;
-import org.ourproject.kune.platf.client.dto.StateContainerDTO;
-import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
+import org.ourproject.kune.platf.client.actions.DragDropContentRegistry;
 import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.tool.AbstractClientTool;
+import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool;
 import org.ourproject.kune.platf.client.tool.ToolSelector;
-import org.ourproject.kune.platf.client.ui.MenuItem;
-import org.ourproject.kune.platf.client.ui.WindowUtils;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-import org.ourproject.kune.workspace.client.socialnet.GroupMembersSummary;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
-import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
-import com.calclab.emiteuimodule.client.EmiteUIDialog;
-import com.calclab.suco.client.ioc.Provider;
-import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener0;
-
-public class ChatClientTool extends AbstractClientTool {
+public class ChatClientTool extends FoldableAbstractClientTool {
     public static final String NAME = "chats";
     public static final String TYPE_ROOT = "chat.root";
     public static final String TYPE_ROOM = "chat.room";
     public static final String TYPE_CHAT = "chat.chat";
-    private ChatEngine chat;
-    private final Provider<ChatContext> chatContextProvider;
-    private final Provider<ChatContent> chatContentProvider;
 
-    public ChatClientTool(final Session session, final Application application, final I18nTranslationService i18n,
-            final EmiteUIDialog emiteUIDialog, final WorkspaceSkeleton ws,
-            final Provider<GroupMembersSummary> groupMembersSummaryProvider, final ToolSelector toolSelector,
-            final WsThemePresenter wsThemePresenter, final Provider<ChatContent> chatContentProvider,
-            final Provider<ChatContext> chatContextProvider) {
-        super(NAME, i18n.t("chat rooms"), toolSelector, wsThemePresenter, ws);
-        this.chatContentProvider = chatContentProvider;
-        this.chatContextProvider = chatContextProvider;
-        session.onInitDataReceived(new Listener<InitDataDTO>() {
-            public void onEvent(final InitDataDTO initData) {
-                checkChatDomain(initData.getChatDomain());
-                final ChatConnectionOptions chatOptions = new ChatConnectionOptions(initData.getChatHttpBase(),
-                        initData.getChatDomain(), initData.getChatRoomHost());
-                chat = new ChatEngineXmpp(emiteUIDialog, chatOptions, i18n, ws);
-                groupMembersSummaryProvider.get().addUserOperation(
-                        new MenuItem<GroupDTO>("images/new-chat.gif", i18n.t("Start a chat with this member"),
-                                new Listener<GroupDTO>() {
-                                    public void onEvent(final GroupDTO group) {
-                                        emiteUIDialog.show();
-                                        if (emiteUIDialog.isLoggedIn()) {
-                                            emiteUIDialog.chat(XmppURI.jid(group.getShortName() + "@"
-                                                    + initData.getChatDomain()));
-                                        } else {
-                                            ws.showAlertMessage(i18n.t("Error"),
-                                                    i18n.t("To start a chat you need to be 'online'."));
-                                        }
-                                    }
-                                }), true);
-            }
-
-            private void checkChatDomain(final String chatDomain) {
-                final String httpDomain = WindowUtils.getLocation().getHostName();
-                if (!chatDomain.equals(httpDomain)) {
-                    Log.error("Your http domain (" + httpDomain + ") is different from the chat domain (" + chatDomain
-                            + "). This will produce problems with the chat functionality. "
-                            + "Check kune.properties on the server.");
-                }
-            }
-        });
-        application.onApplicationStop(new Listener0() {
-            public void onEvent() {
-                chat.stop();
-            }
-        });
-        session.onUserSignOut(new Listener0() {
-            public void onEvent() {
-                chat.logout();
-            }
-        });
-        session.onUserSignIn(new Listener<UserInfoDTO>() {
-            public void onEvent(final UserInfoDTO user) {
-                chat.login(user.getChatName(), user.getChatPassword());
-            }
-        });
+    public ChatClientTool(final I18nTranslationService i18n, final WorkspaceSkeleton ws,
+            final ToolSelector toolSelector, final WsThemePresenter wsThemePresenter,
+            final ContentIconsRegistry contentIconsRegistry, final DragDropContentRegistry dragDropContentRegistry) {
+        super(NAME, i18n.t("chat rooms"), toolSelector, wsThemePresenter, ws, contentIconsRegistry,
+                dragDropContentRegistry);
     }
 
-    public ChatEngine getChat() {
-        return chat;
-    }
-
     public String getName() {
         return NAME;
     }
 
-    public void setContent(final StateContainerDTO state) {
-        chatContentProvider.get().setState(state);
+    @Override
+    protected void registerIcons() {
+        contentIconsRegistry.registerContentTypeIcon(TYPE_ROOM, "public/images/emite-room.png");
     }
-
-    public void setContext(final StateContainerDTO state) {
-        chatContextProvider.get().setState(state);
-    }
-
 }

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngine.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -19,11 +19,18 @@
  */
 package org.ourproject.kune.chat.client;
 
+import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
+
 public interface ChatEngine {
+
     void addNewBuddie(String shortName);
 
+    void chat(XmppURI jid);
+
     ChatConnectionOptions getChatOptions();
 
+    boolean isLoggedIn();
+
     void joinRoom(String roomName, String userAlias);
 
     void login(String jid, String passwd);
@@ -33,4 +40,5 @@
     void show();
 
     void stop();
+
 }

Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java (from rev 939, trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,207 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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.chat.client;
+
+import java.util.Date;
+
+import org.ourproject.kune.platf.client.app.Application;
+import org.ourproject.kune.platf.client.dto.InitDataDTO;
+import org.ourproject.kune.platf.client.dto.UserInfoDTO;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.ui.WindowUtils;
+import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
+import com.calclab.emiteuimodule.client.EmiteUIDialog;
+import com.calclab.emiteuimodule.client.SubscriptionMode;
+import com.calclab.emiteuimodule.client.UserChatOptions;
+import com.calclab.emiteuimodule.client.params.AvatarProvider;
+import com.calclab.emiteuimodule.client.status.OwnPresence.OwnStatus;
+import com.calclab.suco.client.ioc.Provider;
+import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
+import com.google.gwt.user.client.Window;
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.ToolbarButton;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+
+class ChatEngineDefault implements ChatEngine {
+    private ChatConnectionOptions chatOptions;
+    private final I18nTranslationService i18n;
+    private final WorkspaceSkeleton ws;
+    private ToolbarButton traybarButton;
+    private final Provider<EmiteUIDialog> emiteUIProvider;
+
+    public ChatEngineDefault(final I18nTranslationService i18n, final WorkspaceSkeleton ws, Application application,
+            Session session, final Provider<EmiteUIDialog> emiteUIProvider) {
+        this.i18n = i18n;
+        this.ws = ws;
+        this.emiteUIProvider = emiteUIProvider;
+        session.onInitDataReceived(new Listener<InitDataDTO>() {
+            public void onEvent(final InitDataDTO initData) {
+                checkChatDomain(initData.getChatDomain());
+                chatOptions = new ChatConnectionOptions(initData.getChatHttpBase(), initData.getChatDomain(),
+                        initData.getChatRoomHost());
+            }
+
+            private void checkChatDomain(final String chatDomain) {
+                final String httpDomain = WindowUtils.getLocation().getHostName();
+                if (!chatDomain.equals(httpDomain)) {
+                    Log.error("Your http domain (" + httpDomain + ") is different from the chat domain (" + chatDomain
+                            + "). This will produce problems with the chat functionality. "
+                            + "Check kune.properties on the server.");
+                }
+            }
+        });
+        session.onUserSignOut(new Listener0() {
+            public void onEvent() {
+                logout();
+            }
+        });
+        session.onUserSignIn(new Listener<UserInfoDTO>() {
+            public void onEvent(final UserInfoDTO user) {
+                login(user.getChatName(), user.getChatPassword());
+            }
+        });
+        application.onApplicationStop(new Listener0() {
+            public void onEvent() {
+                stop();
+            }
+        });
+    }
+
+    public void addNewBuddie(String shortName) {
+        Site.important("In development (emite)");
+    }
+
+    public void chat(XmppURI jid) {
+        emiteUIProvider.get().chat(jid);
+    }
+
+    public ChatConnectionOptions getChatOptions() {
+        return chatOptions;
+    }
+
+    public boolean isLoggedIn() {
+        return emiteUIProvider.get().isLoggedIn();
+    }
+
+    public void joinRoom(final String roomName, final String userAlias) {
+        if (emiteUIProvider.get().isLoggedIn()) {
+            final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/"
+                    + chatOptions.userOptions.getUserJid().getNode());
+            emiteUIProvider.get().joinRoom(roomURI);
+        } else {
+            ws.showAlertMessage(i18n.t("Error"), i18n.t("To join a chatroom you need to be 'online'."));
+        }
+    }
+
+    public void login(final String jid, final String passwd) {
+        final UserChatOptions userChatOptions = getUserChatOptions(jid, passwd);
+        // FIXME: Avatar provider
+        final AvatarProvider avatarProvider = new AvatarProvider() {
+            public String getAvatarURL(XmppURI userURI) {
+                return "images/person-def.gif";
+            }
+        };
+        final String initialWindowTitle = Window.getTitle();
+        chatOptions.userOptions = userChatOptions;
+        if (emiteUIProvider.get().isDialogNotStarted()) {
+            emiteUIProvider.get().start(userChatOptions, chatOptions.httpBase, chatOptions.roomHost,
+                    initialWindowTitle, avatarProvider, i18n.t("Chat"));
+        } else {
+            emiteUIProvider.get().setEnableStatusUI(true);
+            emiteUIProvider.get().refreshUserInfo(chatOptions.userOptions);
+        }
+        emiteUIProvider.get().show(OwnStatus.online);
+        if (traybarButton == null) {
+            traybarButton = new ToolbarButton();
+            traybarButton.setTooltip(i18n.t("Show/hide the chat window"));
+            // traybarButton.setIcon("images/emite-chat.gif");
+            traybarButton.setIcon("images/e-icon.gif");
+            traybarButton.addListener(new ButtonListenerAdapter() {
+                @Override
+                public void onClick(final Button button, final EventObject e) {
+                    if (emiteUIProvider.get().isVisible()) {
+                        emiteUIProvider.get().hide();
+                    } else {
+                        emiteUIProvider.get().show();
+                    }
+                }
+            });
+            ws.getSiteTraybar().addButton(traybarButton);
+            emiteUIProvider.get().onChatAttended(new Listener<String>() {
+                public void onEvent(final String parameter) {
+                    traybarButton.setIcon("images/e-icon.gif");
+                }
+            });
+            emiteUIProvider.get().onChatUnattendedWithActivity(new Listener<String>() {
+                public void onEvent(final String parameter) {
+                    traybarButton.setIcon("images/e-icon-a.gif");
+                }
+            });
+        }
+        emiteUIProvider.get().hide();
+        emiteUIProvider.get().onChatAttended(new Listener<String>() {
+            public void onEvent(final String parameter) {
+                Window.setTitle(initialWindowTitle);
+            }
+        });
+        emiteUIProvider.get().onChatUnattendedWithActivity(new Listener<String>() {
+            public void onEvent(final String chatTitle) {
+                Window.setTitle("(* " + chatTitle + ") " + initialWindowTitle);
+            }
+        });
+    }
+
+    public void logout() {
+        if (!emiteUIProvider.get().isDialogNotStarted()) {
+            emiteUIProvider.get().setOwnPresence(OwnStatus.offline);
+            chatOptions.userOptions = getUserChatOptions("reset at example.com", "");
+            emiteUIProvider.get().refreshUserInfo(chatOptions.userOptions);
+            emiteUIProvider.get().setEnableStatusUI(false);
+        }
+    }
+
+    public void show() {
+        emiteUIProvider.get().show();
+    }
+
+    public void stop() {
+        if (!emiteUIProvider.get().isDialogNotStarted()) {
+            emiteUIProvider.get().destroy();
+        }
+        if (emiteUIProvider.get().getSession().isLoggedIn()) {
+            emiteUIProvider.get().getSession().logout();
+        }
+    }
+
+    private UserChatOptions getUserChatOptions(final String jid, final String passwd) {
+        final String resource = "emiteui-" + new Date().getTime() + "-kune"; // +
+        // getGwtMetaProperty(GWT_PROPERTY_RELEASE);
+        // FIXME, get this from user profile
+        return new UserChatOptions(jid + "@" + chatOptions.domain, passwd, resource, "blue",
+                SubscriptionMode.autoAcceptAll, true);
+    }
+}


Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineDefault.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,161 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client;
-
-import java.util.Date;
-
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.workspace.client.site.Site;
-import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
-
-import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
-import com.calclab.emiteuimodule.client.EmiteUIDialog;
-import com.calclab.emiteuimodule.client.SubscriptionMode;
-import com.calclab.emiteuimodule.client.UserChatOptions;
-import com.calclab.emiteuimodule.client.params.AvatarProvider;
-import com.calclab.emiteuimodule.client.status.OwnPresence.OwnStatus;
-import com.calclab.suco.client.listener.Listener;
-import com.google.gwt.user.client.Window;
-import com.gwtext.client.core.EventObject;
-import com.gwtext.client.widgets.Button;
-import com.gwtext.client.widgets.ToolbarButton;
-import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-
-class ChatEngineXmpp implements ChatEngine {
-    private final ChatConnectionOptions chatOptions;
-    private final EmiteUIDialog emiteDialog;
-    private final I18nTranslationService i18n;
-    private final WorkspaceSkeleton ws;
-    private ToolbarButton traybarButton;
-
-    public ChatEngineXmpp(final EmiteUIDialog emiteUIDialog, final ChatConnectionOptions chatOptions,
-            final I18nTranslationService i18n, final WorkspaceSkeleton ws) {
-        this.emiteDialog = emiteUIDialog;
-        this.chatOptions = chatOptions;
-        this.i18n = i18n;
-        this.ws = ws;
-    }
-
-    public void addNewBuddie(String shortName) {
-        Site.important("In development (emite)");
-    }
-
-    public ChatConnectionOptions getChatOptions() {
-        return chatOptions;
-    }
-
-    public void joinRoom(final String roomName, final String userAlias) {
-        if (emiteDialog.isLoggedIn()) {
-            final XmppURI roomURI = XmppURI.uri(roomName + "@" + chatOptions.roomHost + "/"
-                    + chatOptions.userOptions.getUserJid().getNode());
-            emiteDialog.joinRoom(roomURI);
-        } else {
-            ws.showAlertMessage(i18n.t("Error"), i18n.t("To join a chatroom you need to be 'online'."));
-        }
-    }
-
-    public void login(final String jid, final String passwd) {
-        final UserChatOptions userChatOptions = getUserChatOptions(jid, passwd);
-        // FIXME: Avatar provider
-        final AvatarProvider avatarProvider = new AvatarProvider() {
-            public String getAvatarURL(XmppURI userURI) {
-                return "images/person-def.gif";
-            }
-        };
-        final String initialWindowTitle = Window.getTitle();
-        chatOptions.userOptions = userChatOptions;
-        if (emiteDialog.isDialogNotStarted()) {
-            emiteDialog.start(userChatOptions, chatOptions.httpBase, chatOptions.roomHost, initialWindowTitle,
-                    avatarProvider, i18n.t("Chat"));
-        } else {
-            emiteDialog.setEnableStatusUI(true);
-            emiteDialog.refreshUserInfo(chatOptions.userOptions);
-        }
-        emiteDialog.show(OwnStatus.online);
-        if (traybarButton == null) {
-            traybarButton = new ToolbarButton();
-            traybarButton.setTooltip(i18n.t("Show/hide the chat window"));
-            // traybarButton.setIcon("images/emite-chat.gif");
-            traybarButton.setIcon("images/e-icon.gif");
-            traybarButton.addListener(new ButtonListenerAdapter() {
-                @Override
-                public void onClick(final Button button, final EventObject e) {
-                    if (emiteDialog.isVisible()) {
-                        emiteDialog.hide();
-                    } else {
-                        emiteDialog.show();
-                    }
-                }
-            });
-            ws.getSiteTraybar().addButton(traybarButton);
-            emiteDialog.onChatAttended(new Listener<String>() {
-                public void onEvent(final String parameter) {
-                    traybarButton.setIcon("images/e-icon.gif");
-                }
-            });
-            emiteDialog.onChatUnattendedWithActivity(new Listener<String>() {
-                public void onEvent(final String parameter) {
-                    traybarButton.setIcon("images/e-icon-a.gif");
-                }
-            });
-        }
-        emiteDialog.hide();
-        emiteDialog.onChatAttended(new Listener<String>() {
-            public void onEvent(final String parameter) {
-                Window.setTitle(initialWindowTitle);
-            }
-        });
-        emiteDialog.onChatUnattendedWithActivity(new Listener<String>() {
-            public void onEvent(final String chatTitle) {
-                Window.setTitle("(* " + chatTitle + ") " + initialWindowTitle);
-            }
-        });
-    }
-
-    public void logout() {
-        if (!emiteDialog.isDialogNotStarted()) {
-            emiteDialog.setOwnPresence(OwnStatus.offline);
-            chatOptions.userOptions = getUserChatOptions("reset at example.com", "");
-            emiteDialog.refreshUserInfo(chatOptions.userOptions);
-            emiteDialog.setEnableStatusUI(false);
-        }
-    }
-
-    public void show() {
-        emiteDialog.show();
-    }
-
-    public void stop() {
-        if (!emiteDialog.isDialogNotStarted()) {
-            emiteDialog.destroy();
-        }
-        if (emiteDialog.getSession().isLoggedIn()) {
-            emiteDialog.getSession().logout();
-        }
-    }
-
-    private UserChatOptions getUserChatOptions(final String jid, final String passwd) {
-        final String resource = "emiteui-" + new Date().getTime() + "-kune"; // +
-        // getGwtMetaProperty(GWT_PROPERTY_RELEASE);
-        // FIXME, get this from user profile
-        return new UserChatOptions(jid + "@" + chatOptions.domain, passwd, resource, "blue",
-                SubscriptionMode.autoAcceptAll, true);
-    }
-}

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewListener.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewListener.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,26 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client.cnt;
-
-public interface RoomViewListener {
-
-    void onEnterRoom();
-
-}

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewPanel.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/RoomViewPanel.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,46 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client.cnt;
-
-import org.ourproject.kune.platf.client.View;
-
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class RoomViewPanel extends VerticalPanel implements View {
-
-    public RoomViewPanel(final RoomViewListener listener) {
-        FlowPanel flow = new FlowPanel();
-        Button btnEnter = new Button("entrar", new ClickListener() {
-            public void onClick(Widget arg0) {
-                listener.onEnterRoom();
-            }
-        });
-        flow.add(btnEnter);
-        Label label = new Label("panel del chat: contenido por defecto");
-
-        add(flow);
-        add(label);
-    }
-}

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControl.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,24 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client.cnt.room;
-
-public interface ChatRoomControl {
-
-}

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPanel.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,46 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client.cnt.room;
-
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.ui.CustomPushButton;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class ChatRoomControlPanel extends HorizontalPanel implements ChatRoomControlView {
-    private final CustomPushButton enterRoomBtn;
-
-    public ChatRoomControlPanel(final I18nTranslationService i18n, final ChatRoomControlPresenter presenter) {
-        enterRoomBtn = new CustomPushButton(i18n.t("Enter room"), new ClickListener() {
-            public void onClick(final Widget sender) {
-                presenter.onEnterRoom();
-            }
-        });
-        add(enterRoomBtn);
-        setEnterRoomEnabled(true);
-    }
-
-    public void setEnterRoomEnabled(final boolean isEnabled) {
-        enterRoomBtn.setEnabled(isEnabled);
-    }
-
-}
\ No newline at end of file

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,41 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client.cnt.room;
-
-import org.ourproject.kune.platf.client.View;
-
-public class ChatRoomControlPresenter implements ChatRoomControl {
-
-    private ChatRoomControlView view;
-
-    public View getView() {
-        return view;
-    }
-
-    public void init(final ChatRoomControlView view) {
-        this.view = view;
-    }
-
-    public void onEnterRoom() {
-        // TODO Auto-generated method stub
-
-    }
-
-}

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlView.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ChatRoomControlView.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,26 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client.cnt.room;
-
-import org.ourproject.kune.platf.client.View;
-
-public interface ChatRoomControlView extends View {
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/ChatContextPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -19,21 +19,21 @@
  */
 package org.ourproject.kune.chat.client.ctx;
 
-import org.ourproject.kune.chat.client.ctx.rooms.RoomsAdmin;
+import org.ourproject.kune.chat.client.ctx.room.RoomAdmin;
 import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 
 import com.calclab.suco.client.ioc.Provider;
 
 public class ChatContextPresenter implements ChatContext {
 
-    private final Provider<RoomsAdmin> roomAdminsProvider;
+    private final Provider<RoomAdmin> roomAdminsProvider;
 
-    public ChatContextPresenter(final Provider<RoomsAdmin> roomAdminsProvider) {
+    public ChatContextPresenter(final Provider<RoomAdmin> roomAdminsProvider) {
         this.roomAdminsProvider = roomAdminsProvider;
     }
 
     public void setState(final StateContainerDTO state) {
-        final RoomsAdmin rooms = roomAdminsProvider.get();
+        final RoomAdmin rooms = roomAdminsProvider.get();
         rooms.showRoom(state.getStateToken(), state.getContainer(), state.getContainerRights());
     }
 }

Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms)


Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdmin.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdmin.java	2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,28 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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.chat.client.ctx.room;
+
+import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
+import org.ourproject.kune.platf.client.dto.ContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+
+public interface RoomAdmin {
+    void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights);
+}


Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdmin.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java (from rev 934, trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java	2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,77 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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.chat.client.ctx.room;
+
+import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
+import org.ourproject.kune.platf.client.dto.ContainerDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.state.Session;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class RoomAdminPresenter implements RoomAdmin {
+    private final ContextNavigator contextNavigator;
+
+    public RoomAdminPresenter(final ContextNavigator contextNavigator, final I18nTranslationService i18n,
+            final Provider<StateManager> stateManagerProvider, final Session session,
+            final Provider<ContentServiceAsync> contentServiceProvider) {
+        this.contextNavigator = contextNavigator;
+        // final ContextNavigatorImages images =
+        // ContextNavigatorImages.App.getInstance();
+        // contextNavigator.registerType(ChatClientTool.TYPE_CHAT,
+        // images.page());
+        // contextNavigator.registerType(ChatClientTool.TYPE_ROOM,
+        // images.chatGreen());
+        // contextNavigator.canCreate(i18n.t("New chat room"), i18n.t("Add a
+        // chat room"), new Listener<String>() {
+        // public void onEvent(final String name) {
+        // Site.showProgressProcessing();
+        // final String groupShortName =
+        // session.getCurrentState().getGroup().getShortName();
+        // final Long containerId =
+        // session.getCurrentState().getFolder().getId();
+        // contentServiceProvider.get().addRoom(session.getUserHash(),
+        // groupShortName, containerId,
+        // groupShortName + "-" + name, new AsyncCallbackSimple<StateDTO>() {
+        // public void onSuccess(final StateDTO state) {
+        // final StateManager stateManager = stateManagerProvider.get();
+        // stateManager.setRetrievedState(state);
+        // // FIXME: Isn't using cache (same in Add folder)
+        // stateManager.reloadContextAndTitles();
+        // Site.hideProgress();
+        // }
+        // });
+        // }
+        // });
+    }
+
+    public void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights) {
+        // contextNavigator.showContainer(token, container, rights);
+        // final String type = container.getTypeId();
+        // if (type.equals(ChatClientTool.TYPE_ROOM)) {
+        // contextNavigator.setControlsVisible(false);
+        // }
+    }
+
+}


Property changes on: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomAdminPresenter.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdmin.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdmin.java	2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdmin.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,31 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client.ctx.rooms;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
-import org.ourproject.kune.platf.client.dto.ContainerDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-
-public interface RoomsAdmin {
-    View getView();
-
-    void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights);
-}

Deleted: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdminPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java	2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/RoomsAdminPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,82 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.chat.client.ctx.rooms;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
-import org.ourproject.kune.platf.client.dto.ContainerDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
-import org.ourproject.kune.platf.client.services.I18nTranslationService;
-import org.ourproject.kune.platf.client.state.Session;
-import org.ourproject.kune.platf.client.state.StateManager;
-import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class RoomsAdminPresenter implements RoomsAdmin {
-    private final ContextNavigator contextNavigator;
-
-    public RoomsAdminPresenter(final ContextNavigator contextNavigator, final I18nTranslationService i18n,
-            final Provider<StateManager> stateManagerProvider, final Session session,
-            final Provider<ContentServiceAsync> contentServiceProvider) {
-        this.contextNavigator = contextNavigator;
-        // final ContextNavigatorImages images =
-        // ContextNavigatorImages.App.getInstance();
-        // contextNavigator.registerType(ChatClientTool.TYPE_CHAT,
-        // images.page());
-        // contextNavigator.registerType(ChatClientTool.TYPE_ROOM,
-        // images.chatGreen());
-        // contextNavigator.canCreate(i18n.t("New chat room"), i18n.t("Add a
-        // chat room"), new Listener<String>() {
-        // public void onEvent(final String name) {
-        // Site.showProgressProcessing();
-        // final String groupShortName =
-        // session.getCurrentState().getGroup().getShortName();
-        // final Long containerId =
-        // session.getCurrentState().getFolder().getId();
-        // contentServiceProvider.get().addRoom(session.getUserHash(),
-        // groupShortName, containerId,
-        // groupShortName + "-" + name, new AsyncCallbackSimple<StateDTO>() {
-        // public void onSuccess(final StateDTO state) {
-        // final StateManager stateManager = stateManagerProvider.get();
-        // stateManager.setRetrievedState(state);
-        // // FIXME: Isn't using cache (same in Add folder)
-        // stateManager.reloadContextAndTitles();
-        // Site.hideProgress();
-        // }
-        // });
-        // }
-        // });
-    }
-
-    public View getView() {
-        return contextNavigator.getView();
-    }
-
-    public void showRoom(final StateToken token, final ContainerDTO container, final AccessRightsDTO rights) {
-        // contextNavigator.showContainer(token, container, rights);
-        // final String type = container.getTypeId();
-        // if (type.equals(ChatClientTool.TYPE_ROOM)) {
-        // contextNavigator.setControlsVisible(false);
-        // }
-    }
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -25,10 +25,10 @@
 import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewerPanel;
 import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewerPresenter;
 import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewerView;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewer;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerPanel;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerPresenter;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewerView;
+import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewer;
+import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerPanel;
+import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerPresenter;
+import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewerView;
 import org.ourproject.kune.docs.client.ctx.DocumentContext;
 import org.ourproject.kune.docs.client.ctx.DocumentContextPresenter;
 import org.ourproject.kune.docs.client.ctx.admin.DocContextEditor;

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -22,14 +22,13 @@
 import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
 import org.ourproject.kune.platf.client.actions.DragDropContentRegistry;
 import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.tool.AbstractClientTool;
+import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool;
 import org.ourproject.kune.platf.client.tool.ToolSelector;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
-
-public class DocumentClientTool extends AbstractClientTool {
+public class DocumentClientTool extends FoldableAbstractClientTool {
     public static final String TYPE_ROOT = "docs.root";
     public static final String TYPE_FOLDER = "docs.folder";
     public static final String TYPE_DOCUMENT = "docs.doc";
@@ -39,28 +38,21 @@
     public static final String TYPE_WIKI = "docs.wiki";
     public static final String TYPE_WIKIPAGE = "docs.wikipage";
     public static final String TYPE_UPLOADEDFILE = "docs.uploaded";
-
     public static final String NAME = "docs";
 
-    private final DragDropContentRegistry dragDropContentRegistry;
-    private final ContentIconsRegistry contentIconsRegistry;
-
     public DocumentClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
             final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
-            final DragDropContentRegistry dragDropContentRegistry,
-            final ContentIconsRegistry contentIconsRegistry) {
-        super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws);
-        this.dragDropContentRegistry = dragDropContentRegistry;
-        this.contentIconsRegistry = contentIconsRegistry;
-        registerDragDropTypes();
-        registerIcons();
+            final DragDropContentRegistry dragDropContentRegistry, final ContentIconsRegistry contentIconsRegistry) {
+        super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws, contentIconsRegistry,
+                dragDropContentRegistry);
     }
 
     public String getName() {
         return NAME;
     }
 
-    private void registerDragDropTypes() {
+    @Override
+    protected void registerDragDropTypes() {
         dragDropContentRegistry.registerDraggableType(TYPE_DOCUMENT);
         dragDropContentRegistry.registerDraggableType(TYPE_FOLDER);
         dragDropContentRegistry.registerDraggableType(TYPE_UPLOADEDFILE);
@@ -70,7 +62,8 @@
         dragDropContentRegistry.registerDroppableType(TYPE_GALLERY);
     }
 
-    private void registerIcons() {
+    @Override
+    protected void registerIcons() {
         contentIconsRegistry.registerContentTypeIcon(TYPE_FOLDER, "images/nav/folder.png");
         contentIconsRegistry.registerContentTypeIcon(TYPE_BLOG, "images/nav/blog.png");
         contentIconsRegistry.registerContentTypeIcon(TYPE_GALLERY, "images/nav/gallery.png");

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/DocumentContentPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -21,7 +21,7 @@
 
 import org.ourproject.kune.docs.client.DocumentClientTool;
 import org.ourproject.kune.docs.client.cnt.folder.viewer.FolderViewer;
-import org.ourproject.kune.docs.client.cnt.reader.DocumentViewer;
+import org.ourproject.kune.docs.client.cnt.viewer.DocumentViewer;
 import org.ourproject.kune.platf.client.actions.ActionItemCollection;
 import org.ourproject.kune.platf.client.actions.ActionRegistry;
 import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;

Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer (from rev 934, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader)


Property changes on: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReader.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReader.java	2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReader.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,31 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.docs.client.cnt.reader;
-
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-
-public interface DocumentReader {
-
-    View getView();
-
-    void showDocument(StateToken token, String text, String typeId, BasicMimeTypeDTO mimeType);
-}

Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderPresenter.java	2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,62 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.docs.client.cnt.reader;
-
-import org.ourproject.kune.docs.client.DocumentClientTool;
-import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
-import org.ourproject.kune.platf.client.ui.download.ImageSize;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class DocumentReaderPresenter implements DocumentReader {
-    private final DocumentReaderView view;
-    private final Provider<FileDownloadUtils> downloadProvider;
-
-    public DocumentReaderPresenter(final DocumentReaderView view, final Provider<FileDownloadUtils> downloadProvider) {
-        this.view = view;
-        this.downloadProvider = downloadProvider;
-    }
-
-    public View getView() {
-        return view;
-    }
-
-    public void showDocument(final StateToken token, final String text, final String typeId,
-            final BasicMimeTypeDTO mimeType) {
-        if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
-            if (mimeType != null) {
-                FileDownloadUtils fileDownloadUtils = downloadProvider.get();
-                if (mimeType.getType().equals("image")) {
-                    view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
-                            ImageSize.sized));
-                } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
-                    view.setContent(text);
-                } else {
-                    view.setContent("");
-                }
-            }
-        } else {
-            view.setContent(text);
-        }
-    }
-}

Deleted: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentReaderView.java	2008-10-28 15:40:27 UTC (rev 934)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentReaderView.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,30 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2008 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.docs.client.cnt.reader;
-
-import org.ourproject.kune.platf.client.View;
-
-public interface DocumentReaderView extends View {
-
-    void setContent(String content);
-
-    void showImage(String imageUrl, String imageResizedUrl);
-
-}

Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewer.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewer.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewer.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,31 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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.docs.client.cnt.viewer;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+
+public interface DocumentViewer {
+
+    View getView();
+
+    void showDocument(StateToken token, String text, String typeId, BasicMimeTypeDTO mimeType);
+}

Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPanel.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPanel.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPanel.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,73 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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.docs.client.cnt.viewer;
+
+import org.ourproject.kune.platf.client.services.I18nTranslationService;
+import org.ourproject.kune.platf.client.ui.KuneUiUtils;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.Widget;
+
+public class DocumentViewerPanel implements DocumentViewerView {
+
+    private final WorkspaceSkeleton ws;
+    private final I18nTranslationService i18n;
+
+    public DocumentViewerPanel(final WorkspaceSkeleton ws, I18nTranslationService i18n) {
+        this.ws = ws;
+        this.i18n = i18n;
+    }
+
+    public void setContent(final String content) {
+        final HTML html = new HTML(content);
+        setDefStyle(html);
+        ws.getEntityWorkspace().setContent(html);
+    }
+
+    public void showImage(String imageUrl, String imageResizedUrl) {
+        final Image imgOrig = new Image(imageUrl);
+        final Image imgResized = new Image(imageResizedUrl);
+        KuneUiUtils.setQuickTip(imgOrig, i18n.t("Click to zoom out"));
+        KuneUiUtils.setQuickTip(imgResized, i18n.t("Click to zoom in"));
+        setDefStyle(imgOrig);
+        setDefStyle(imgResized);
+        imgOrig.addStyleName("kune-pointer");
+        imgResized.addStyleName("kune-pointer");
+        imgResized.addClickListener(new ClickListener() {
+            public void onClick(Widget sender) {
+                ws.getEntityWorkspace().setContent(imgOrig);
+            }
+        });
+        imgOrig.addClickListener(new ClickListener() {
+            public void onClick(Widget sender) {
+                ws.getEntityWorkspace().setContent(imgResized);
+            }
+        });
+        ws.getEntityWorkspace().setContent(imgResized);
+    }
+
+    private void setDefStyle(final Widget widget) {
+        widget.setStyleName("kune-Content-Main");
+        widget.addStyleName("kune-Margin-7-trbl");
+    }
+}

Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPresenter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerPresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,62 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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.docs.client.cnt.viewer;
+
+import org.ourproject.kune.docs.client.DocumentClientTool;
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils;
+import org.ourproject.kune.platf.client.ui.download.ImageSize;
+
+import com.calclab.suco.client.ioc.Provider;
+
+public class DocumentViewerPresenter implements DocumentViewer {
+    private final DocumentViewerView view;
+    private final Provider<FileDownloadUtils> downloadProvider;
+
+    public DocumentViewerPresenter(final DocumentViewerView view, final Provider<FileDownloadUtils> downloadProvider) {
+        this.view = view;
+        this.downloadProvider = downloadProvider;
+    }
+
+    public View getView() {
+        return view;
+    }
+
+    public void showDocument(final StateToken token, final String text, final String typeId,
+            final BasicMimeTypeDTO mimeType) {
+        if (typeId.equals(DocumentClientTool.TYPE_UPLOADEDFILE)) {
+            if (mimeType != null) {
+                FileDownloadUtils fileDownloadUtils = downloadProvider.get();
+                if (mimeType.getType().equals("image")) {
+                    view.showImage(fileDownloadUtils.getImageUrl(token), fileDownloadUtils.getImageResizedUrl(token,
+                            ImageSize.sized));
+                } else if (mimeType.toString().equals("text/plain") || mimeType.toString().equals("application/pdf")) {
+                    view.setContent(text);
+                } else {
+                    view.setContent("");
+                }
+            }
+        } else {
+            view.setContent(text);
+        }
+    }
+}

Copied: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java (from rev 939, trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerView.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/DocumentViewerView.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/viewer/DocumentViewerView.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,30 @@
+/*
+ *
+ * Copyright (C) 2007-2008 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.docs.client.cnt.viewer;
+
+import org.ourproject.kune.platf.client.View;
+
+public interface DocumentViewerView extends View {
+
+    void setContent(String content);
+
+    void showImage(String imageUrl, String imageResizedUrl);
+
+}

Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java (from rev 939, trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,18 @@
+package org.ourproject.kune.platf.client.actions;
+
+import java.util.ArrayList;
+
+public class BeforeActionCollection extends ArrayList<BeforeActionListener> {
+
+    private static final long serialVersionUID = 1L;
+
+    public boolean checkBeforeAction() {
+        for (BeforeActionListener listener : this) {
+            if (!listener.beforeAction()) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+}


Property changes on: trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionCollection.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionListener.java (from rev 939, trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/BeforeActionListener.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,7 @@
+package org.ourproject.kune.platf.client.actions;
+
+public interface BeforeActionListener {
+
+    boolean beforeAction();
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageDescriptor.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -19,5 +19,5 @@
  */package org.ourproject.kune.platf.client.services;
 
 public enum ImageDescriptor {
-    accept, add, addGreen, alert, anybody, arrowDownBlack, arrowDownGreen, arrowDownWhite, arrowLeftGreen, arrowRightBlack, arrowRightGreen, arrowRightWhite, arrowUpGreen, bulletAdd, bulletBlack, bulletBlue, bulletDelete, bulletGreen, bulletPink, bulletPurple, bulletRed, bulletStar, bulletToggleMinus, bulletTogglePlus, bulletYellow, button15cblue, button15cdark, button15clight, button15cxlight, button15lblue, button15ldark, button15llight, button15lxlight, button15rblue, button15rdark, button15rlight, button15rxlight, button17cblue, button17cdark, button17clight, button17cxlight, button17lblue, button17ldark, button17llight, button17lxlight, button17rblue, button17rdark, button17rlight, button17rxlight, button20cblue, button20cdark, button20clight, button20cxlight, button20lblue, button20ldark, button20llight, button20lxlight, button20rblue, button20rdark, button20rlight, button20rxlight, buttonArrowDown, buttonHelpBlue, buttonHelpDark, buttonHelpLight, buttonSitebarArrowDown, by80x15, bync80x15, byncnd80x15, byncsa80x15, bynd80x15, bysa80x15, cancel, chat, clear, copyleft, cross, crossDark, del, emblemImportant, error, everybody, fullscreen, gnuFdl, groupDefIcon, groupHome, important, info, infoLight, kuneClose, kuneExternalWindow, kuneHelpTranslationIcon, kuneIcon16, kuneLogo16px, kunePreferences, kuneSearchIco, kuneSearchIcoPush, language, nobody, noCopyleft, nt, opentriangle, personDef, remove, rssIcon, searchIco, spinKuneThundGreen, splitterVertBar, star10, star20, star30, star40, star50, star60, star70, star80, star90, starGrey, starSmallYellow, starVsmallYellow, starYellow, step1, step2, step3, step4, step5, themeChoose, triangle
+    accept, add, addGreen, alert, anybody, arrowDownBlack, arrowDownGreen, arrowDownWhite, arrowLeftGreen, arrowRightBlack, arrowRightGreen, arrowRightWhite, arrowUpGreen, bulletAdd, bulletBlack, bulletBlue, bulletDelete, bulletGreen, bulletPink, bulletPurple, bulletRed, bulletStar, bulletToggleMinus, bulletTogglePlus, bulletYellow, button15cblue, button15cdark, button15clight, button15cxlight, button15lblue, button15ldark, button15llight, button15lxlight, button15rblue, button15rdark, button15rlight, button15rxlight, button17cblue, button17cdark, button17clight, button17cxlight, button17lblue, button17ldark, button17llight, button17lxlight, button17rblue, button17rdark, button17rlight, button17rxlight, button20cblue, button20cdark, button20clight, button20cxlight, button20lblue, button20ldark, button20llight, button20lxlight, button20rblue, button20rdark, button20rlight, button20rxlight, buttonArrowDown, buttonHelpBlue, buttonHelpDark, buttonHelpLight, buttonSitebarArrowDown, by80x15, bync80x15, byncnd80x15, byncsa80x15, bynd80x15, bysa80x15, cancel, clear, copyleft, cross, crossDark, del, emblemImportant, error, everybody, fullscreen, gnuFdl, groupDefIcon, groupHome, important, info, infoLight, kuneClose, kuneExternalWindow, kuneHelpTranslationIcon, kuneIcon16, kuneLogo16px, kunePreferences, kuneSearchIco, kuneSearchIcoPush, language, nobody, noCopyleft, nt, opentriangle, personDef, remove, rssIcon, searchIco, spinKuneThundGreen, splitterVertBar, star10, star20, star30, star40, star50, star60, star70, star80, star90, starGrey, starSmallYellow, starVsmallYellow, starYellow, step1, step2, step3, step4, step5, themeChoose, triangle
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ImageUtils.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -249,9 +249,6 @@
         case cancel: {
             return img.cancel();
         }
-        case chat: {
-            return img.chat();
-        }
         case clear: {
             return img.clear();
         }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Images.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -255,9 +255,6 @@
     @Resource("org/ourproject/kune/platf/public/images/cancel.png")
     AbstractImagePrototype cancel();
 
-    @Resource("org/ourproject/kune/platf/public/images/chat.png")
-    AbstractImagePrototype chat();
-
     @Resource("org/ourproject/kune/platf/public/images/clear.png")
     AbstractImagePrototype clear();
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -102,6 +102,7 @@
 import org.ourproject.kune.workspace.client.site.SiteToken;
 import org.ourproject.kune.workspace.client.site.rpc.UserService;
 import org.ourproject.kune.workspace.client.site.rpc.UserServiceAsync;
+import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
 import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 import org.ourproject.kune.workspace.client.title.EntityTitle;
@@ -348,7 +349,7 @@
                         contentNavigatorToolbar);
 
                 final TextEditorPresenter presenter = new TextEditorPresenter(true, toolbar,
-                        $(I18nUITranslationService.class), $(StateManager.class));
+                        $(I18nUITranslationService.class), $(StateManager.class), $(SiteSignOutLink.class));
                 final TextEditorPanel panel = new TextEditorPanel(presenter, $(I18nTranslationService.class),
                         $(WorkspaceSkeleton.class), $(ColorWebSafePalette.class));
                 presenter.init(panel);

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneWorkspaceModule.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -18,7 +18,7 @@
  *
  */package org.ourproject.kune.platf.client.services;
 
-import org.ourproject.kune.chat.client.ChatClientTool;
+import org.ourproject.kune.chat.client.ChatEngine;
 import org.ourproject.kune.platf.client.actions.ActionManager;
 import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
 import org.ourproject.kune.platf.client.actions.UserActionRegistry;
@@ -334,7 +334,7 @@
                 final GroupMembersSummaryPresenter presenter = new GroupMembersSummaryPresenter(
                         $(I18nUITranslationService.class), $(StateManager.class), $(ImageUtils.class),
                         $(Session.class), $$(SocialNetworkServiceAsync.class), $$(GroupLiveSearcher.class),
-                        $(WsThemePresenter.class));
+                        $(WsThemePresenter.class), $$(ChatEngine.class));
                 final GroupMembersSummaryView view = new GroupMembersSummaryPanel(presenter,
                         $(I18nUITranslationService.class), $(WorkspaceSkeleton.class));
                 presenter.init(view);
@@ -359,7 +359,7 @@
             public BuddiesSummary create() {
                 final BuddiesSummaryPresenter presenter = new BuddiesSummaryPresenter($(StateManager.class),
                         $(Session.class), $(UserActionRegistry.class), $(I18nTranslationService.class),
-                        $$(ChatClientTool.class));
+                        $$(ChatEngine.class));
                 final BuddiesSummaryPanel panel = new BuddiesSummaryPanel(presenter, $(WorkspaceSkeleton.class),
                         $(I18nTranslationService.class), $(ActionManager.class));
                 presenter.init(panel);

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeActionListener.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,7 +0,0 @@
-package org.ourproject.kune.platf.client.state;
-
-public interface BeforeActionListener {
-
-    boolean beforeAction();
-
-}

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/BeforeStateChangeCollection.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -1,9 +0,0 @@
-package org.ourproject.kune.platf.client.state;
-
-import java.util.ArrayList;
-
-public class BeforeStateChangeCollection extends ArrayList<BeforeActionListener> {
-
-    private static final long serialVersionUID = 1L;
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -19,6 +19,7 @@
  */
 package org.ourproject.kune.platf.client.state;
 
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -21,6 +21,8 @@
 
 import java.util.HashMap;
 
+import org.ourproject.kune.platf.client.actions.BeforeActionCollection;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
 import org.ourproject.kune.platf.client.app.HistoryWrapper;
 import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
@@ -55,7 +57,7 @@
     private final Event<StateAbstractDTO> onSocialNetworkChanged;
     private final Event2<String, String> onToolChanged;
     private final Event2<String, String> onGroupChanged;
-    private final BeforeStateChangeCollection beforeStateChangeCollection;
+    private final BeforeActionCollection beforeStateChangeCollection;
 
     public StateManagerDefault(final ContentProvider contentProvider, final Session session,
             final HistoryWrapper history) {
@@ -84,7 +86,7 @@
             }
         });
         siteTokens = new HashMap<String, Listener0>();
-        beforeStateChangeCollection = new BeforeStateChangeCollection();
+        beforeStateChangeCollection = new BeforeActionCollection();
     }
 
     public void addBeforeStateChangeListener(BeforeActionListener listener) {
@@ -109,7 +111,7 @@
     }
 
     public void onHistoryChanged(final String historyToken) {
-        if (beforeStateListenersAllowChange()) {
+        if (beforeStateChangeCollection.checkBeforeAction()) {
             final Listener0 tokenListener = siteTokens.get(historyToken);
             Log.debug("StateManager: history token changed (" + historyToken + ")");
             if (tokenListener == null) {
@@ -199,15 +201,6 @@
         previousToken = newState.getStateToken();
     }
 
-    private boolean beforeStateListenersAllowChange() {
-        for (BeforeActionListener listener : beforeStateChangeCollection) {
-            if (!listener.beforeAction()) {
-                return false;
-            }
-        }
-        return true;
-    }
-
     private void checkGroupAndToolChange(final StateAbstractDTO newState) {
         final String previousGroup = previousToken == null ? "" : previousToken.getGroup();
         final String newGroup = newState.getStateToken().getGroup();

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -0,0 +1,27 @@
+package org.ourproject.kune.platf.client.tool;
+
+import org.ourproject.kune.platf.client.actions.ContentIconsRegistry;
+import org.ourproject.kune.platf.client.actions.DragDropContentRegistry;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
+
+public abstract class FoldableAbstractClientTool extends AbstractClientTool {
+    protected final DragDropContentRegistry dragDropContentRegistry;
+    protected final ContentIconsRegistry contentIconsRegistry;
+
+    public FoldableAbstractClientTool(String shortName, String longName, ToolSelector toolSelector,
+            WsThemePresenter wsThemePresenter, WorkspaceSkeleton ws, final ContentIconsRegistry contentIconsRegistry,
+            final DragDropContentRegistry dragDropContentRegistry) {
+        super(shortName, longName, toolSelector, wsThemePresenter, ws);
+        this.dragDropContentRegistry = dragDropContentRegistry;
+        this.contentIconsRegistry = contentIconsRegistry;
+        registerDragDropTypes();
+        registerIcons();
+    }
+
+    protected void registerDragDropTypes() {
+    }
+
+    protected void registerIcons() {
+    }
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -244,15 +244,13 @@
     @Override
     public void setHeight(final int height) {
         super.setHeight(height);
-        // grid.setHeight(height);
         doLayoutIfNeeded();
     }
 
     @Override
     public void setWidth(final int width) {
         // grid.setWidth(width - 27);
-        grid.setWidth(width - 27);
-        // super.setWidth(width - 11);
+        super.setWidth(width);
         doLayoutIfNeeded();
     }
 

Deleted: trunk/src/main/java/org/ourproject/kune/platf/public/images/chat.png
===================================================================
(Binary files differ)

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -24,12 +24,13 @@
 import org.ourproject.kune.platf.client.actions.ActionItemCollection;
 import org.ourproject.kune.platf.client.actions.ActionToolbarButtonDescriptor;
 import org.ourproject.kune.platf.client.actions.ActionToolbarPosition;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
 import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
 import org.ourproject.kune.platf.client.dto.AccessRolDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
-import org.ourproject.kune.platf.client.state.BeforeActionListener;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
 
 import com.calclab.suco.client.listener.Listener;
 import com.calclab.suco.client.listener.Listener0;
@@ -52,13 +53,15 @@
     private final I18nUITranslationService i18n;
     private final BeforeActionListener beforeStateChangeListener;
     private final StateManager stateManager;
+    private final SiteSignOutLink siteSignOutLink;
 
     public TextEditorPresenter(final boolean isAutoSave, final ActionToolbar<StateToken> toolbar,
-            final I18nUITranslationService i18n, StateManager stateManager) {
+            final I18nUITranslationService i18n, StateManager stateManager, SiteSignOutLink siteSignOutLink) {
         this.toolbar = toolbar;
         autoSave = isAutoSave;
         this.i18n = i18n;
         this.stateManager = stateManager;
+        this.siteSignOutLink = siteSignOutLink;
         savePending = false;
         editingHtml = false;
         saveAndCloseConfirmed = false;
@@ -78,6 +81,7 @@
         view.attach();
         setContent(content);
         stateManager.addBeforeStateChangeListener(beforeStateChangeListener);
+        siteSignOutLink.addBeforeSignOut(beforeStateChangeListener);
     }
 
     public String getContent() {
@@ -142,6 +146,7 @@
 
     protected void onCancelConfirmed() {
         stateManager.removeBeforeStateChangeListener(beforeStateChangeListener);
+        siteSignOutLink.removeBeforeSignOut(beforeStateChangeListener);
         stateManager.resumeTokenChange();
         reset();
         view.detach();

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLink.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLink.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLink.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -18,6 +18,12 @@
  *
  */package org.ourproject.kune.workspace.client.sitebar.sitesign;
 
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
+
 public interface SiteSignOutLink {
 
+    void addBeforeSignOut(BeforeActionListener listener);
+
+    void removeBeforeSignOut(BeforeActionListener listener);
+
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -21,6 +21,8 @@
 import java.util.Date;
 
 import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.actions.BeforeActionCollection;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
 import org.ourproject.kune.platf.client.errors.SessionExpiredException;
 import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
@@ -41,6 +43,7 @@
     private SiteSignOutLinkView view;
     private final Session session;
     private final Provider<UserServiceAsync> userServiceProvider;
+    private final BeforeActionCollection beforeSignOutCollection;
 
     public SiteSignOutLinkPresenter(final Session session, final Provider<UserServiceAsync> userServiceProvider,
             final Provider<KuneErrorHandler> kuneErrorHandlerProvider) {
@@ -61,31 +64,39 @@
                 clientUIsignOut();
             }
         });
+        beforeSignOutCollection = new BeforeActionCollection();
     }
 
+    public void addBeforeSignOut(BeforeActionListener listener) {
+        beforeSignOutCollection.add(listener);
+    }
+
     public void doSignOut() {
-        final AsyncCallback<Object> callback = new AsyncCallback<Object>() {
-            public void onFailure(final Throwable caught) {
-                Site.hideProgress();
-                try {
-                    throw caught;
-                } catch (final SessionExpiredException e) {
+        if (beforeSignOutCollection.checkBeforeAction()) {
+            userServiceProvider.get().logout(session.getUserHash(), new AsyncCallback<Object>() {
+                public void onFailure(final Throwable caught) {
+                    Site.hideProgress();
+                    try {
+                        throw caught;
+                    } catch (final SessionExpiredException e) {
+                        clientUIsignOut();
+                    } catch (final UserMustBeLoggedException e) {
+                        clientUIsignOut();
+                    } catch (final Throwable e) {
+                        GWT.log("Other kind of exception in doLogout", null);
+                        throw new RuntimeException();
+                    }
+                }
+
+                public void onSuccess(final Object arg0) {
+                    Site.hideProgress();
                     clientUIsignOut();
-                } catch (final UserMustBeLoggedException e) {
-                    clientUIsignOut();
-                } catch (final Throwable e) {
-                    GWT.log("Other kind of exception in doLogout", null);
-                    throw new RuntimeException();
                 }
-            }
 
-            public void onSuccess(final Object arg0) {
-                Site.hideProgress();
-                clientUIsignOut();
-            }
-
-        };
-        userServiceProvider.get().logout(session.getUserHash(), callback);
+            });
+        } else {
+            Site.hideProgress();
+        }
     }
 
     public View getView() {
@@ -97,6 +108,10 @@
         view.setVisible(false);
     }
 
+    public void removeBeforeSignOut(BeforeActionListener listener) {
+        beforeSignOutCollection.remove(listener);
+    }
+
     private void clientUIsignOut() {
         // FIXME: Remove cookie doesn't works in all browsers, know
         // issue:

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -20,7 +20,7 @@
 
 import java.util.List;
 
-import org.ourproject.kune.chat.client.ChatClientTool;
+import org.ourproject.kune.chat.client.ChatEngine;
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.actions.ActionEnableCondition;
 import org.ourproject.kune.platf.client.actions.ActionMenuItemDescriptor;
@@ -46,16 +46,16 @@
     private final StateManager stateManager;
     private final UserActionRegistry actionRegistry;
     private final I18nTranslationService i18n;
-    private final Provider<ChatClientTool> chatClientToolProvider;
+    private final Provider<ChatEngine> chatEngineProvider;
     private final Session session;
 
     public BuddiesSummaryPresenter(StateManager stateManager, final Session session, UserActionRegistry actionRegistry,
-            I18nTranslationService i18n, final Provider<ChatClientTool> chatClientToolProvider) {
+            I18nTranslationService i18n, final Provider<ChatEngine> chatEngineProvider) {
         this.stateManager = stateManager;
         this.session = session;
         this.actionRegistry = actionRegistry;
         this.i18n = i18n;
-        this.chatClientToolProvider = chatClientToolProvider;
+        this.chatEngineProvider = chatEngineProvider;
         stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
             public void onEvent(StateAbstractDTO state) {
                 setState(state);
@@ -118,7 +118,7 @@
         final ActionToolbarButtonAndItemDescriptor<UserSimpleDTO> addAsBuddie = new ActionToolbarButtonAndItemDescriptor<UserSimpleDTO>(
                 AccessRolDTO.Viewer, ActionToolbarPosition.bottombar, new Listener<UserSimpleDTO>() {
                     public void onEvent(final UserSimpleDTO group) {
-                        chatClientToolProvider.get().getChat().addNewBuddie(group.getShortName());
+                        chatEngineProvider.get().addNewBuddie(group.getShortName());
                     }
                 });
         addAsBuddie.setMustBeAuthenticated(true);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -20,10 +20,12 @@
 
 import java.util.List;
 
+import org.ourproject.kune.chat.client.ChatEngine;
 import org.ourproject.kune.platf.client.dto.AccessListsDTO;
 import org.ourproject.kune.platf.client.dto.AccessRightsDTO;
 import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.GroupType;
+import org.ourproject.kune.platf.client.dto.InitDataDTO;
 import org.ourproject.kune.platf.client.dto.LinkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
@@ -34,6 +36,7 @@
 import org.ourproject.kune.platf.client.services.ImageUtils;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.ui.MenuItem;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridButton;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
@@ -42,6 +45,7 @@
 import org.ourproject.kune.workspace.client.themes.WsTheme;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
 
+import com.calclab.emite.core.client.xmpp.stanzas.XmppURI;
 import com.calclab.suco.client.ioc.Provider;
 import com.calclab.suco.client.listener.Listener;
 import com.calclab.suco.client.listener.Listener2;
@@ -61,7 +65,8 @@
     public GroupMembersSummaryPresenter(final I18nUITranslationService i18n, final StateManager stateManager,
             final ImageUtils imageUtils, final Session session,
             final Provider<SocialNetworkServiceAsync> snServiceProvider,
-            final Provider<GroupLiveSearcher> liveSearcherProvider, final WsThemePresenter wsThemePresenter) {
+            final Provider<GroupLiveSearcher> liveSearcherProvider, final WsThemePresenter wsThemePresenter,
+            final Provider<ChatEngine> chatEngineProvider) {
         super(i18n, stateManager, imageUtils, session, snServiceProvider);
         this.i18n = i18n;
         this.stateManager = stateManager;
@@ -79,6 +84,22 @@
                 view.setTheme(oldTheme, newTheme);
             }
         });
+        session.onInitDataReceived(new Listener<InitDataDTO>() {
+            public void onEvent(final InitDataDTO initData) {
+                addUserOperation(new MenuItem<GroupDTO>("images/new-chat.gif", i18n.t("Start a chat with this member"),
+                        new Listener<GroupDTO>() {
+                            public void onEvent(final GroupDTO group) {
+                                chatEngineProvider.get().show();
+                                if (chatEngineProvider.get().isLoggedIn()) {
+                                    chatEngineProvider.get().chat(
+                                            XmppURI.jid(group.getShortName() + "@" + initData.getChatDomain()));
+                                } else {
+                                    Site.important(i18n.t("To start a chat you need to be 'online'."));
+                                }
+                            }
+                        }), true);
+            }
+        });
         final String adminsTitle = i18n.t("Admins");
         final String collabsTitle = i18n.t("Collaborators");
         final String pendingTitle = i18n.t("Pending");

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/EntitySubTitlePresenter.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -44,6 +44,9 @@
                     setState((StateContentDTO) state);
                 } else if (state instanceof StateContainerDTO) {
                     setState((StateContainerDTO) state);
+                } else {
+                    view.setContentSubTitleLeftVisible(false);
+                    view.setContentSubTitleRightVisible(false);
                 }
             }
         });

Modified: trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -5,6 +5,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
+import org.ourproject.kune.platf.client.actions.BeforeActionListener;
 import org.ourproject.kune.platf.client.app.HistoryWrapper;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;

Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java	2008-11-04 15:07:14 UTC (rev 939)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java	2008-11-05 22:07:07 UTC (rev 940)
@@ -9,6 +9,7 @@
 import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.sitebar.sitesign.SiteSignOutLink;
 
 import com.calclab.suco.testing.listener.MockListener;
 import com.calclab.suco.testing.listener.MockListener0;
@@ -21,6 +22,7 @@
     @SuppressWarnings("unchecked")
     private ActionToolbar toolbar;
     private StateManager stateManager;
+    private SiteSignOutLink signOutLink;
 
     @SuppressWarnings("unchecked")
     @Before
@@ -28,7 +30,8 @@
         I18nUITranslationService i18n = Mockito.mock(I18nUITranslationService.class);
         stateManager = Mockito.mock(StateManager.class);
         toolbar = Mockito.mock(ActionToolbar.class);
-        presenter = new TextEditorPresenter(true, toolbar, i18n, stateManager);
+        signOutLink = Mockito.mock(SiteSignOutLink.class);
+        presenter = new TextEditorPresenter(true, toolbar, i18n, stateManager, signOutLink);
         view = Mockito.mock(TextEditorView.class);
         presenter.init(view);
         saveListener = new MockListener<String>();




More information about the kune-commits mailing list