[kune-commits] r824 - in trunk: script src/main/java/org/ourproject/kune/app/public src/main/java/org/ourproject/kune/app/public/css src/main/java/org/ourproject/kune/chat/client src/main/java/org/ourproject/kune/docs/client src/main/java/org/ourproject/kune/platf/client src/main/java/org/ourproject/kune/platf/client/app src/main/java/org/ourproject/kune/platf/client/dto src/main/java/org/ourproject/kune/platf/client/services src/main/java/org/ourproject/kune/platf/client/state src/main/java/org/ourproject/kune/platf/client/tool src/main/java/org/ourproject/kune/platf/client/ui src/main/java/org/ourproject/kune/platf/server/manager/impl src/main/java/org/ourproject/kune/workspace/client/i18n src/main/java/org/ourproject/kune/workspace/client/newgroup src/main/java/org/ourproject/kune/workspace/client/socialnet src/main/java/org/ourproject/kune/workspace/client/ui/newtmp src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel src/main/java/org/ourproject/kune/workspace/client/workspace src/main/java/org/ourproject/kune/workspace/client/workspace/ui src/test/java/org/ourproject/kune/platf/client src/test/java/org/ourproject/kune/platf/client/state src/test/java/org/ourproject/kune/platf/client/tool src/test/java/org/ourproject/kune/platf/integration/content src/test/java/org/ourproject/kune/platf/server/finders src/test/java/org/ourproject/kune/platf/server/manager

vjrj vjrj at ourproject.org
Sun Aug 3 23:45:46 CEST 2008


Author: vjrj
Date: 2008-08-03 23:45:16 +0200 (Sun, 03 Aug 2008)
New Revision: 824

Added:
   trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPanel.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorView.java
   trunk/src/test/java/org/ourproject/kune/platf/client/tool/
   trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
Removed:
   trunk/src/main/java/org/ourproject/kune/platf/client/ToolState.java
   trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperImpl.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java
Modified:
   trunk/script/generateBasicUIElements.sh
   trunk/src/main/java/org/ourproject/kune/app/public/Kune.html
   trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
   trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
   trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
   trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
   trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java
   trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.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/tool/AbstractClientTool.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java
   trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
   trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspacePresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java
   trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java
   trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
   trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java
Log:
Complete - task 36: New ToolSelector classes 

Complete - task 24: Tests problems in SNMTest (close of transaction issue) 

Incomplete - task 21: Session timeout problems (cookies issue?) 


Modified: trunk/script/generateBasicUIElements.sh
===================================================================
--- trunk/script/generateBasicUIElements.sh	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/script/generateBasicUIElements.sh	2008-08-03 21:45:16 UTC (rev 824)
@@ -14,7 +14,7 @@
   fi
 
 # DO
-PACKAGE=`echo $DIR | cut -d "/" -f 4- | sed 's/\//\./g'`
+PACKAGE=`echo $DIR | cut -d "/" -f 4- | sed 's/\//\./g' | sed 's/.$//g'`
 
 if [[ ! -d $DIR ]]
 then
@@ -85,12 +85,12 @@
 import $PACKAGE.${NAME}Panel;
 import $PACKAGE.${NAME};
 
-builder.registerProvider(${NAME}.class, new Provider<${NAME}>() {
-    public ${NAME} get() {
+register(SingletonScope.class, new Factory<${NAME}>(${NAME}.class) {
+    public ${NAME} create() {
 	final ${NAME}Presenter presenter = new ${NAME}Presenter();
 	final ${NAME}Panel panel = new ${NAME}Panel(presenter, ws);
 	presenter.init(panel);
 	return presenter;
     }
-}, SingletonScope.class);
+});
 EOF

Modified: trunk/src/main/java/org/ourproject/kune/app/public/Kune.html
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/Kune.html	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/app/public/Kune.html	2008-08-03 21:45:16 UTC (rev 824)
@@ -19,111 +19,6 @@
 <link rel="shortcut icon" href="images/favicon.ico" />
 <title>Kune</title>
 
-<script type="text/javascript" language="javascript">
-var defaultKuneTheme = {
-  themeName: "Default",
-  toolSelected: "#DD8A3D",
-  toolUnselected: "#FFE9A5",
-  contentMainBorder: "#DD8A3D",
-  contentTitle: "#F1BB59",
-  contentTitleText: "#69312F",
-  contentSubTitleText: "#FFF",
-  contentBottomText: "#FFF",
-  context: "#FFD09D",
-  splitter: "#DEAA87",
-  groupMembersDD: "#DF5244",
-  participationDD: "#CA5842",
-  summaryDD: "#9F734B",
-  tagsDD: "#87501E"
-};
-
-var greenKuneTheme = {
-  themeName: "Green",
-  toolSelected: "#5FD35F",
-  toolUnselected: "#D6F4D6",
-  contentMainBorder: "#5FD35F",
-  contentTitle: "#AFA",
-  contentTitleText: "#250",
-  contentSubTitleText: "#FFF",
-  contentBottomText: "#FFF",
-  context: "#CFA",
-  splitter: "#DCE8AB",
-  groupMembersDD: "#008000",
-  participationDD: "#00AA00",
-  summaryDD: "#4CE14C",
-  tagsDD: "#00D400"
-};
-
-var blueKuneTheme = {
-  themeName: "Blue",
-  toolSelected: "#0066FF",
-  toolUnselected: "#D7D7F4",
-  contentMainBorder: "#0066FF",
-  contentTitle: "#AFDDE9",
-  contentTitleText: "#000080",
-  contentSubTitleText: "#FFF",
-  contentBottomText: "#FFF",
-  context: "#AACCFF",
-  splitter: "#D5D5FF",
-  groupMembersDD: "#5500D4",
-  participationDD: "#6600FF",
-  summaryDD: "#69A5FF",
-  tagsDD: "#9955FF"
-};
-
-var greyKuneTheme = {
-  themeName: "Grey",
-  toolSelected: "#4D4D4D",
-  toolUnselected: "#E6E6E6",
-  contentMainBorder: "#4D4D4D",
-  contentTitle: "#CCCCCC",
-  contentTitleText: "#1A1A1A",
-  contentSubTitleText: "#FFF",
-  contentBottomText: "#FFF",
-  context: "#B3B3B3",
-  splitter: "#999999",
-  groupMembersDD: "#4D4D4D",
-  participationDD: "#666666",
-  summaryDD: "#A6A6A6",
-  tagsDD: "#808080"
-};
-
-var purpleKuneTheme = {
-  themeName: "Purple",
-  toolSelected: "#660080",
-  toolUnselected: "#EED7F4",
-  contentMainBorder: "#660080",
-  contentTitle: "#DDAFE9",
-  contentTitleText: "#440055",
-  contentSubTitleText: "#FFF",
-  contentBottomText: "#FFF",
-  context: "#DDAFE9",
-  splitter: "#A793AC",
-  groupMembersDD: "#672178",
-  participationDD: "#892CA0",
-  summaryDD: "#C473D8",
-  tagsDD: "#AB37C8"
-};
-
-var redKuneTheme = {
-  themeName: "Red",
-  toolSelected: "#D40000",
-  toolUnselected: "#FFD5D5",
-  contentMainBorder: "#D40000",
-  contentTitle: "#FF8080",
-  contentTitleText: "#800000",
-  contentSubTitleText: "#FFF",
-  contentBottomText: "#FFF",
-  context: "#FFAAAA",
-  splitter: "#FF5555",
-  groupMembersDD: "#A02C2C",
-  participationDD: "#C83737",
-  summaryDD: "#E08F8F",
-  tagsDD: "#D35F5F"
-};
-
-</script>
-
 </head>
 <body>
 <script type="text/javascript" language="javascript"

Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css	2008-08-03 21:45:16 UTC (rev 824)
@@ -3172,27 +3172,27 @@
     color: #FFF;
 }
 
-.k-entity-bottom-rd-default, .k-entity-bottom-default {
+.k-entity-bottom-rd-default, .k-entity-bottom-default, .k-toolselectoritem-sel-default {
     background: #DD8A3D;
 }
 
-.k-entity-bottom-rd-green, .k-entity-bottom-green {
+.k-entity-bottom-rd-green, .k-entity-bottom-green, .k-toolselectoritem-sel-green {
     background: #5FD35F;
 }
 
-.k-entity-bottom-rd-blue, .k-entity-bottom-blue {
+.k-entity-bottom-rd-blue, .k-entity-bottom-blue, .k-toolselectoritem-sel-blue {
     background: #0066FF;
 }
 
-.k-entity-bottom-rd-grey, .k-entity-bottom-grey {
+.k-entity-bottom-rd-grey, .k-entity-bottom-grey, .k-toolselectoritem-sel-grey {
     background: #4D4D4D;
 }
 
-.k-entity-bottom-rd-purple, .k-entity-bottom-purple {
+.k-entity-bottom-rd-purple, .k-entity-bottom-purple, .k-toolselectoritem-sel-purple {
     background: #660080;
 }
 
-.k-entity-bottom-rd-red, .k-entity-bottom-red {
+.k-entity-bottom-rd-red, .k-entity-bottom-red, .k-toolselectoritem-sel-red {
     background: #D40000;
 }
 
@@ -3435,3 +3435,62 @@
     background: red;
 }
 
+/* Tool selector items */
+
+.k-toolselectoritem {
+  width: auto;
+  margin-bottom: 5px;	
+  cursor: pointer;
+}
+
+.k-toolselectoritem-sel {
+}
+
+.k-toolselectoritem-notsel-default {
+	background: #FFE9A5;
+}
+
+.k-toolselectoritem-notsel-green {
+    background: #D6F4D6;
+}
+
+.k-toolselectoritem-notsel-blue {
+    background: #D7D7F4;
+}
+
+.k-toolselectoritem-notsel-grey {
+    background: #E6E6E6;
+}
+
+.k-toolselectoritem-notsel-purple {
+    background: #EED7F4;
+}
+
+.k-toolselectoritem-notsel-red {
+    background: #FFD5D5;
+}
+
+.k-toolselectoritem-sel a {
+  color: #FFF;
+  padding: 0 9px;
+  text-decoration: none;
+}
+
+.k-toolselectoritem-sel a:hover {
+  text-decoration: none;
+}
+
+.k-toolselectoritem-notsel {
+}
+
+.k-toolselectoritem-notsel a {
+  color: blue;
+  padding: 0 9px;
+  text-decoration: none;
+}
+
+.k-toolselectoritem-notsel a:hover {
+  text-decoration: none;
+}
+
+

Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css	2008-08-03 21:45:16 UTC (rev 824)
@@ -306,27 +306,27 @@
     color: #FFF;
 }
 
-.k-entity-bottom-rd-default, .k-entity-bottom-default {
+.k-entity-bottom-rd-default, .k-entity-bottom-default, .k-toolselectoritem-sel-default {
     background: #DD8A3D;
 }
 
-.k-entity-bottom-rd-green, .k-entity-bottom-green {
+.k-entity-bottom-rd-green, .k-entity-bottom-green, .k-toolselectoritem-sel-green {
     background: #5FD35F;
 }
 
-.k-entity-bottom-rd-blue, .k-entity-bottom-blue {
+.k-entity-bottom-rd-blue, .k-entity-bottom-blue, .k-toolselectoritem-sel-blue {
     background: #0066FF;
 }
 
-.k-entity-bottom-rd-grey, .k-entity-bottom-grey {
+.k-entity-bottom-rd-grey, .k-entity-bottom-grey, .k-toolselectoritem-sel-grey {
     background: #4D4D4D;
 }
 
-.k-entity-bottom-rd-purple, .k-entity-bottom-purple {
+.k-entity-bottom-rd-purple, .k-entity-bottom-purple, .k-toolselectoritem-sel-purple {
     background: #660080;
 }
 
-.k-entity-bottom-rd-red, .k-entity-bottom-red {
+.k-entity-bottom-rd-red, .k-entity-bottom-red, .k-toolselectoritem-sel-red {
     background: #D40000;
 }
 
@@ -567,4 +567,62 @@
 
 .k-wstheme-icon-red {
     background: red;
-}
\ No newline at end of file
+}
+
+/* Tool selector items */
+
+.k-toolselectoritem {
+  width: auto;
+  margin-bottom: 5px;	
+  cursor: pointer;
+}
+
+.k-toolselectoritem-sel {
+}
+
+.k-toolselectoritem-notsel-default {
+	background: #FFE9A5;
+}
+
+.k-toolselectoritem-notsel-green {
+    background: #D6F4D6;
+}
+
+.k-toolselectoritem-notsel-blue {
+    background: #D7D7F4;
+}
+
+.k-toolselectoritem-notsel-grey {
+    background: #E6E6E6;
+}
+
+.k-toolselectoritem-notsel-purple {
+    background: #EED7F4;
+}
+
+.k-toolselectoritem-notsel-red {
+    background: #FFD5D5;
+}
+
+.k-toolselectoritem-sel a {
+  color: #FFF;
+  padding: 0 9px;
+  text-decoration: none;
+}
+
+.k-toolselectoritem-sel a:hover {
+  text-decoration: none;
+}
+
+.k-toolselectoritem-notsel {
+}
+
+.k-toolselectoritem-notsel a {
+  color: blue;
+  padding: 0 9px;
+  text-decoration: none;
+}
+
+.k-toolselectoritem-notsel a:hover {
+  text-decoration: none;
+}

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientNewModule.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -5,8 +5,10 @@
 import org.ourproject.kune.platf.client.rpc.ContentServiceAsync;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.tool.ToolSelector;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
 import org.ourproject.kune.workspace.client.workspace.GroupMembersSummary;
 
 import com.calclab.emiteuimodule.client.EmiteUIDialog;
@@ -26,7 +28,8 @@
 	    public ChatClientTool create() {
 		return new ChatClientTool($(Session.class), $(Application.class), $(I18nUITranslationService.class),
 			$(EmiteUIDialog.class), $(WorkspaceSkeleton.class), $p(GroupMembersSummary.class),
-			$p(StateManager.class), $p(ContentServiceAsync.class));
+			$p(StateManager.class), $p(ContentServiceAsync.class), $(ToolSelector.class),
+			$(WsThemePresenter.class));
 	    }
 	});
 

Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -30,15 +30,18 @@
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.platf.client.tool.AbstractClientTool;
+import org.ourproject.kune.platf.client.tool.ToolSelector;
 import org.ourproject.kune.platf.client.ui.gridmenu.GridMenuItem;
 import org.ourproject.kune.workspace.client.component.WorkspaceComponent;
 import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
 import org.ourproject.kune.workspace.client.workspace.GroupMembersSummary;
 
 import com.calclab.emite.client.xmpp.stanzas.XmppURI;
 import com.calclab.emiteuimodule.client.EmiteUIDialog;
 import com.calclab.suco.client.container.Provider;
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
 
 public class ChatClientTool extends AbstractClientTool implements ChatProvider {
     public static final String NAME = "chats";
@@ -47,17 +50,14 @@
     public static final String TYPE_CHAT = "chat.chat";
     private final ChatToolComponents components;
     private ChatEngine chat;
-    private final Provider<StateManager> stateManagerProvider;
-    private final Provider<ContentServiceAsync> contentServiceProvider;
 
     public ChatClientTool(final Session session, final Application application, final I18nTranslationService i18n,
 	    final EmiteUIDialog emiteUIDialog, final WorkspaceSkeleton ws,
 	    final Provider<GroupMembersSummary> groupMembersSummaryProvider,
 	    final Provider<StateManager> stateManagerProvider,
-	    final Provider<ContentServiceAsync> contentServiceProvider) {
-	super(i18n.t("chat rooms"));
-	this.stateManagerProvider = stateManagerProvider;
-	this.contentServiceProvider = contentServiceProvider;
+	    final Provider<ContentServiceAsync> contentServiceProvider, final ToolSelector toolSelector,
+	    final WsThemePresenter wsThemePresenter) {
+	super(NAME, i18n.t("chat rooms"), toolSelector, wsThemePresenter, ws);
 	components = new ChatToolComponents(emiteUIDialog, i18n, stateManagerProvider, session, contentServiceProvider);
 	session.onInitDataReceived(new Slot<InitDataDTO>() {
 	    public void onEvent(final InitDataDTO initData) {
@@ -75,13 +75,13 @@
 				}), true);
 	    }
 	});
-	application.onApplicationStop(new Slot<Object>() {
-	    public void onEvent(final Object parameter) {
+	application.onApplicationStop(new Slot0() {
+	    public void onEvent() {
 		chat.logout();
 	    }
 	});
-	session.onUserSignOut(new Slot<Object>() {
-	    public void onEvent(final Object parameter) {
+	session.onUserSignOut(new Slot0() {
+	    public void onEvent() {
 		chat.logout();
 	    }
 	});

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -5,9 +5,11 @@
 import org.ourproject.kune.platf.client.app.Application;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.platf.client.tool.ToolSelector;
 import org.ourproject.kune.platf.client.ui.rate.RateIt;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
 import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
 import org.ourproject.kune.workspace.client.workspace.TagsSummary;
 
 import com.calclab.suco.client.modules.AbstractModule;
@@ -32,7 +34,8 @@
 	register(SingletonScope.class, new Factory<DocumentClientTool>(DocumentClientTool.class) {
 	    public DocumentClientTool create() {
 		final DocumentFactory factory = $(DocumentFactory.class);
-		return new DocumentClientTool(factory, $(I18nUITranslationService.class));
+		return new DocumentClientTool(factory, $(I18nUITranslationService.class), $(ToolSelector.class),
+			$(WsThemePresenter.class), $(WorkspaceSkeleton.class));
 	    }
 	});
 

Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -26,8 +26,11 @@
 import org.ourproject.kune.docs.client.ui.DocumentFactory;
 import org.ourproject.kune.platf.client.dto.StateDTO;
 import org.ourproject.kune.platf.client.tool.AbstractClientTool;
+import org.ourproject.kune.platf.client.tool.ToolSelector;
 import org.ourproject.kune.workspace.client.component.WorkspaceComponent;
 import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
 
 public class DocumentClientTool extends AbstractClientTool implements DocumentContentListener {
     public static final String TYPE_ROOT = "docs.root";
@@ -36,42 +39,43 @@
     public static final String NAME = "docs";
     private final DocToolComponents components;
 
-    public DocumentClientTool(final DocumentFactory documentFactory, final I18nUITranslationService i18n) {
-        super(i18n.t("documents"));
-        components = new DocToolComponents(documentFactory, this);
+    public DocumentClientTool(final DocumentFactory documentFactory, final I18nUITranslationService i18n,
+	    final ToolSelector toolSelector, final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws) {
+	super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws);
+	components = new DocToolComponents(documentFactory, this);
     }
 
     public WorkspaceComponent getContent() {
-        return components.getContent();
+	return components.getContent();
     }
 
     public WorkspaceComponent getContext() {
-        return components.getContext();
+	return components.getContext();
     }
 
     public String getName() {
-        return NAME;
+	return NAME;
     }
 
     public void onCancel() {
-        components.getContext().showFolders();
+	components.getContext().showFolders();
     }
 
     public void onEdit() {
-        components.getContext().showAdmin();
+	components.getContext().showAdmin();
     }
 
     public void setContent(final StateDTO state) {
-        DocumentContent docContent = components.getContent();
-        docContent.setContent(state);
+	final DocumentContent docContent = components.getContent();
+	docContent.setContent(state);
 
-        // TODO: check trigger interface (setState)
-        trigger.setState(state.getStateToken().toString());
+	// TODO: check trigger interface (setState)
+	// trigger.setState(state.getStateToken().toString());
     }
 
     public void setContext(final StateDTO state) {
-        DocumentContext context = components.getContext();
-        context.setContext(state);
+	final DocumentContext context = components.getContext();
+	context.setContext(state);
     }
 
 }

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ToolState.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ToolState.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ToolState.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -1,25 +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.platf.client;
-
-public class ToolState {
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/Application.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -28,7 +28,7 @@
 import org.ourproject.kune.platf.client.tool.ClientTool;
 import org.ourproject.kune.workspace.client.workspace.Workspace;
 
-import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
 
 public interface Application {
 
@@ -38,12 +38,10 @@
 
     void init(StateManager stateManager, HashMap<String, ClientTool> tools);
 
-    void onApplicationStart(Slot<Object> slot);
+    void onApplicationStart(Slot0 slot);
 
-    void onApplicationStop(Slot<Object> slot);
+    void onApplicationStop(Slot0 slot);
 
-    void setGroupState(String groupShortName);
-
     void start();
 
     void stop();

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -41,8 +41,8 @@
 import org.ourproject.kune.workspace.client.workspace.Workspace;
 
 import com.allen_sauer.gwt.log.client.Log;
-import com.calclab.suco.client.signal.Signal;
-import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Signal0;
+import com.calclab.suco.client.signal.Slot0;
 import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.WindowCloseListener;
@@ -52,8 +52,8 @@
     // private final Workspace workspace;
     private Map<String, ClientTool> tools;
     private final Session session;
-    private final Signal<Object> onApplicationStart;
-    private final Signal<Object> onApplicationStop;
+    private final Signal0 onApplicationStart;
+    private final Signal0 onApplicationStop;
     private StateManager stateManager;
 
     public ApplicationDefault(final Session session, final KuneErrorHandler errorHandler, final WorkspaceSkeleton ws) {
@@ -61,8 +61,8 @@
 	// workspace = WorkspaceFactory.createWorkspace(session,
 	// extensionPointManager, i18n, errorHandler);
 	tools = new HashMap<String, ClientTool>();
-	this.onApplicationStart = new Signal<Object>("onApplicationStart");
-	this.onApplicationStop = new Signal<Object>("onApplicationStop");
+	this.onApplicationStart = new Signal0("onApplicationStart");
+	this.onApplicationStop = new Signal0("onApplicationStop");
 	Window.addWindowCloseListener(new WindowCloseListener() {
 	    public void onWindowClosed() {
 		stop();
@@ -88,24 +88,16 @@
 	this.tools = tools;
     }
 
-    public void onApplicationStart(final Slot<Object> slot) {
+    public void onApplicationStart(final Slot0 slot) {
 	onApplicationStart.add(slot);
     }
 
-    public void onApplicationStop(final Slot<Object> slot) {
+    public void onApplicationStop(final Slot0 slot) {
 	onApplicationStop.add(slot);
     }
 
-    public void setGroupState(final String groupShortName) {
-	final Iterator<ClientTool> iterator = tools.values().iterator();
-	while (iterator.hasNext()) {
-	    final ClientTool tool = iterator.next();
-	    tool.setGroupState(groupShortName);
-	}
-    }
-
     public void start() {
-	onApplicationStart.fire(null);
+	onApplicationStart.fire();
 	PrefetchUtilities.preFetchImpImages();
 	getInitData();
 	final Timer prefetchTimer = new Timer() {
@@ -117,7 +109,7 @@
     }
 
     public void stop() {
-	onApplicationStop.fire(null);
+	onApplicationStop.fire();
     }
 
     public void subscribeActions(final ArrayList<ActionEvent<?>> actions) {

Copied: trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperDefault.java (from rev 792, trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperImpl.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperImpl.java	2008-07-06 13:51:18 UTC (rev 792)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperDefault.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.platf.client.app;
+
+import com.google.gwt.user.client.History;
+
+public class HistoryWrapperDefault implements HistoryWrapper {
+
+    public String getToken() {
+	return History.getToken();
+    }
+
+    public void newItem(final String historyToken) {
+	History.newItem(historyToken);
+    }
+
+}

Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperImpl.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/app/HistoryWrapperImpl.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -1,37 +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.platf.client.app;
-
-import com.google.gwt.user.client.History;
-
-public class HistoryWrapperImpl implements HistoryWrapper {
-
-    public HistoryWrapperImpl() {
-    }
-
-    public void newItem(final String historyToken) {
-        History.newItem(historyToken);
-    }
-
-    public String getToken() {
-        return History.getToken();
-    }
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -27,158 +27,163 @@
 public class StateToken implements IsSerializable {
     private static final String[] EMPTY = new String[0];
     private static final String DOT = ".";
+
+    public static String encode(final String group, final String tool, final String folder, final String document) {
+	String encoded = "";
+	if (group != null) {
+	    encoded += group;
+	}
+	if (tool != null) {
+	    encoded += DOT + tool;
+	}
+	if (folder != null) {
+	    encoded += DOT + folder;
+	}
+	if (document != null) {
+	    encoded += DOT + document;
+	}
+	return encoded;
+    }
     private String group;
     private String tool;
     private String folder;
     private String document;
+
     private String encoded;
 
-    public StateToken(final String group, final String tool, final String folder, final String document) {
-        this.setGroup(group);
-        this.setTool(tool);
-        this.setFolder(folder);
-        this.setDocument(document);
-        encoded = null;
+    public StateToken() {
+	this(null, null, null, null);
     }
 
-    public StateToken() {
-        this(null, null, null, null);
+    public StateToken(final String encoded) {
+	String[] splitted;
+	if (encoded != null && encoded.length() > 0) {
+	    splitted = encoded.split("\\.");
+	} else {
+	    splitted = EMPTY;
+	}
+	setGroup(conditionalAssign(0, splitted));
+	setTool(conditionalAssign(1, splitted));
+	setFolder(conditionalAssign(2, splitted));
+	setDocument(conditionalAssign(3, splitted));
     }
 
-    public String toString() {
-        return getEncoded();
+    public StateToken(final String group, final String tool) {
+	this(group, tool, null, null);
     }
 
-    public String getEncoded() {
-        if (encoded == null) {
-            encoded = StateToken.encode(getGroup(), getTool(), getFolder(), getDocument());
-        }
-        return encoded;
+    public StateToken(final String group, final String tool, final String folder, final String document) {
+	this.setGroup(group);
+	this.setTool(tool);
+	this.setFolder(folder);
+	this.setDocument(document);
+	encoded = null;
     }
 
-    @Override
-    public int hashCode() {
-        return getEncoded().hashCode();
+    public String getDocument() {
+	return document;
     }
 
-    public StateToken(final String encoded) {
-        String[] splitted;
-        if (encoded != null && encoded.length() > 0) {
-            splitted = encoded.split("\\.");
-        } else {
-            splitted = EMPTY;
-        }
-        setGroup(conditionalAssign(0, splitted));
-        setTool(conditionalAssign(1, splitted));
-        setFolder(conditionalAssign(2, splitted));
-        setDocument(conditionalAssign(3, splitted));
+    public String getEncoded() {
+	if (encoded == null) {
+	    encoded = StateToken.encode(getGroup(), getTool(), getFolder(), getDocument());
+	}
+	return encoded;
     }
 
-    private String conditionalAssign(final int index, final String[] splitted) {
-        if (splitted.length > index) {
-            return splitted[index];
-        } else {
-            return null;
-        }
+    public String getFolder() {
+	return folder;
     }
 
-    public static String encode(final String group, final String tool, final String folder, final String document) {
-        String encoded = "";
-        if (group != null) {
-            encoded += group;
-        }
-        if (tool != null) {
-            encoded += DOT + tool;
-        }
-        if (folder != null) {
-            encoded += DOT + folder;
-        }
-        if (document != null) {
-            encoded += DOT + document;
-        }
-        return encoded;
+    public String getGroup() {
+	return group;
     }
 
-    public boolean isComplete() {
-        return getDocument() != null;
+    public String getPublicUrl() {
+	String publicUrl = "http://";
+
+	if (group != null) {
+	    publicUrl += group + DOT;
+	}
+
+	// FIXME: Maybe get from InitData the site.domain
+	publicUrl += WindowUtils.getLocation().getHostName() + "/";
+
+	if (tool != null) {
+	    publicUrl += tool;
+	}
+	if (folder != null) {
+	    publicUrl += DOT + folder;
+	}
+	if (document != null) {
+	    publicUrl += DOT + document;
+	}
+
+	return publicUrl;
     }
 
+    public String getTool() {
+	return tool;
+    }
+
     public boolean hasAll() {
-        return getGroup() != null && getTool() != null && getFolder() != null && getDocument() != null;
+	return getGroup() != null && getTool() != null && getFolder() != null && getDocument() != null;
     }
 
-    public boolean hasGroupToolAndFolder() {
-        return getGroup() != null && getTool() != null && getFolder() != null;
+    public boolean hasGroup() {
+	return getGroup() != null;
     }
 
     public boolean hasGroupAndTool() {
-        return getGroup() != null && getTool() != null;
+	return getGroup() != null && getTool() != null;
     }
 
-    public boolean hasGroup() {
-        return getGroup() != null;
+    public boolean hasGroupToolAndFolder() {
+	return getGroup() != null && getTool() != null && getFolder() != null;
     }
 
-    public boolean hasNothing() {
-        return getGroup() == null && getTool() == null && getFolder() == null && getDocument() == null;
+    @Override
+    public int hashCode() {
+	return getEncoded().hashCode();
     }
 
-    public void setGroup(final String group) {
-        this.group = group;
-        encoded = null;
+    public boolean hasNothing() {
+	return getGroup() == null && getTool() == null && getFolder() == null && getDocument() == null;
     }
 
-    public String getGroup() {
-        return group;
+    public boolean isComplete() {
+	return getDocument() != null;
     }
 
-    public void setTool(final String tool) {
-        this.tool = tool;
-        encoded = null;
+    public void setDocument(final String document) {
+	this.document = document;
+	encoded = null;
     }
 
-    public String getTool() {
-        return tool;
-    }
-
     public void setFolder(final String folder) {
-        this.folder = folder;
-        encoded = null;
+	this.folder = folder;
+	encoded = null;
     }
 
-    public String getFolder() {
-        return folder;
+    public void setGroup(final String group) {
+	this.group = group;
+	encoded = null;
     }
 
-    public void setDocument(final String document) {
-        this.document = document;
-        encoded = null;
+    public void setTool(final String tool) {
+	this.tool = tool;
+	encoded = null;
     }
 
-    public String getDocument() {
-        return document;
+    public String toString() {
+	return getEncoded();
     }
 
-    public String getPublicUrl() {
-        String publicUrl = "http://";
-
-        if (group != null) {
-            publicUrl += group + DOT;
-        }
-
-        // FIXME: Maybe get from InitData the site.domain
-        publicUrl += WindowUtils.getLocation().getHostName() + "/";
-
-        if (tool != null) {
-            publicUrl += tool;
-        }
-        if (folder != null) {
-            publicUrl += DOT + folder;
-        }
-        if (document != null) {
-            publicUrl += DOT + document;
-        }
-
-        return publicUrl;
+    private String conditionalAssign(final int index, final String[] splitted) {
+	if (splitted.length > index) {
+	    return splitted[index];
+	} else {
+	    return null;
+	}
     }
 }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -34,15 +34,15 @@
 
 import com.allen_sauer.gwt.log.client.Log;
 import com.calclab.suco.client.container.Provider;
-import com.calclab.suco.client.signal.Signal;
-import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Signal0;
+import com.calclab.suco.client.signal.Slot0;
 import com.google.gwt.core.client.GWT;
 
 public class KuneErrorHandler {
     private final Session session;
     private final I18nTranslationService i18n;
     private final Provider<WorkspaceSkeleton> wsProvider;
-    private final Signal<Object> onSessionExpired;
+    private final Signal0 onSessionExpired;
     private final Provider<StateManager> stateManagerProvider;
 
     public KuneErrorHandler(final Session session, final I18nTranslationService i18n,
@@ -51,14 +51,14 @@
 	this.i18n = i18n;
 	this.wsProvider = wsProvider;
 	this.stateManagerProvider = stateManagerProvider;
-	this.onSessionExpired = new Signal<Object>("onSessionExpired");
+	this.onSessionExpired = new Signal0("onSessionExpired");
     }
 
     public WorkspaceSkeleton getWorkspaceSkeleton() {
 	return wsProvider.get();
     }
 
-    public void onSessionExpired(final Slot<Object> slot) {
+    public void onSessionExpired(final Slot0 slot) {
 	onSessionExpired.add(slot);
     }
 
@@ -107,7 +107,7 @@
     }
 
     private void doSessionExpired() {
-	onSessionExpired.fire(null);
+	onSessionExpired.fire();
 	getWorkspaceSkeleton().showAlertMessage(i18n.t("Session expired"),
 		i18n.t("Your session has expired. Please login again."));
     }

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-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -6,7 +6,7 @@
 import org.ourproject.kune.platf.client.app.Application;
 import org.ourproject.kune.platf.client.app.ApplicationDefault;
 import org.ourproject.kune.platf.client.app.HistoryWrapper;
-import org.ourproject.kune.platf.client.app.HistoryWrapperImpl;
+import org.ourproject.kune.platf.client.app.HistoryWrapperDefault;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 import org.ourproject.kune.platf.client.rpc.ContentService;
@@ -23,6 +23,9 @@
 import org.ourproject.kune.platf.client.state.SessionImpl;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.platf.client.state.StateManagerDefault;
+import org.ourproject.kune.platf.client.tool.ToolSelector;
+import org.ourproject.kune.platf.client.tool.ToolSelectorPanel;
+import org.ourproject.kune.platf.client.tool.ToolSelectorPresenter;
 import org.ourproject.kune.platf.client.ui.QuickTipsHelper;
 import org.ourproject.kune.platf.client.ui.rate.RateIt;
 import org.ourproject.kune.platf.client.ui.rate.RateItPanel;
@@ -214,7 +217,7 @@
 
 	register(SingletonScope.class, new Factory<HistoryWrapper>(HistoryWrapper.class) {
 	    public HistoryWrapper create() {
-		return new HistoryWrapperImpl();
+		return new HistoryWrapperDefault();
 	    }
 	}, new Factory<ContentProvider>(ContentProvider.class) {
 	    public ContentProvider create() {
@@ -545,6 +548,16 @@
 	    }
 	});
 
+	register(SingletonScope.class, new Factory<ToolSelector>(ToolSelector.class) {
+	    public ToolSelector create() {
+		final ToolSelectorPresenter presenter = new ToolSelectorPresenter($(StateManager.class),
+			$(WsThemePresenter.class));
+		final ToolSelectorPanel panel = new ToolSelectorPanel(presenter, ws);
+		presenter.init(panel);
+		return presenter;
+	    }
+	});
+
 	load(new EmiteUIModule(), new DocumentClientNewModule(), new ChatClientNewModule());
 
 	$(SitePublicSpaceLink.class);

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -31,6 +31,7 @@
 import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
 
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
 
 public interface Session {
 
@@ -73,7 +74,7 @@
 
     void onUserSignIn(Slot<UserInfoDTO> slot);
 
-    void onUserSignOut(Slot<Object> slot);
+    void onUserSignOut(Slot0 slot);
 
     void setCurrentUserInfo(UserInfoDTO currentUserInfo);
 

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionImpl.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -36,7 +36,9 @@
 import com.allen_sauer.gwt.log.client.Log;
 import com.calclab.suco.client.container.Provider;
 import com.calclab.suco.client.signal.Signal;
+import com.calclab.suco.client.signal.Signal0;
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
 
 public class SessionImpl implements Session {
     private String userHash;
@@ -49,7 +51,7 @@
     private I18nLanguageDTO currentLanguage;
     private final Signal<InitDataDTO> onInitDataReceived;
     private final Signal<UserInfoDTO> onUserSignIn;
-    private final Signal<Object> onUserSignOut;
+    private final Signal0 onUserSignOut;
     private final Provider<UserServiceAsync> userServiceProvider;
 
     public SessionImpl(final String userHash, final Provider<UserServiceAsync> userServiceProvider) {
@@ -58,7 +60,7 @@
 	languagesArray = null;
 	this.onInitDataReceived = new Signal<InitDataDTO>("initDataReceived");
 	this.onUserSignIn = new Signal<UserInfoDTO>("onUserSignIn");
-	this.onUserSignOut = new Signal<Object>("onUserSignOut");
+	this.onUserSignOut = new Signal0("onUserSignOut");
     }
 
     public void check(final AsyncCallbackSimple<?> callback) {
@@ -127,7 +129,7 @@
 	onUserSignIn.add(slot);
     }
 
-    public void onUserSignOut(final Slot<Object> slot) {
+    public void onUserSignOut(final Slot0 slot) {
 	onUserSignOut.add(slot);
     }
 
@@ -148,7 +150,7 @@
 	if (currentUserInfo != null) {
 	    onUserSignIn.fire(currentUserInfo);
 	} else {
-	    onUserSignOut.fire(null);
+	    onUserSignOut.fire();
 	}
     }
 

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-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -25,6 +25,7 @@
 import org.ourproject.kune.platf.client.dto.StateToken;
 
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot2;
 import com.google.gwt.user.client.HistoryListener;
 
 public interface StateManager extends HistoryListener {
@@ -35,10 +36,14 @@
 
     void gotoToken(String token);
 
+    void onGroupChanged(Slot2<String, String> slot);
+
     void onSocialNetworkChanged(Slot<StateDTO> slot);
 
     void onStateChanged(Slot<StateDTO> slot);
 
+    void onToolChanged(Slot2<String, String> slot);
+
     void reload();
 
     void reloadContextAndTitles();

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -34,7 +34,10 @@
 
 import com.allen_sauer.gwt.log.client.Log;
 import com.calclab.suco.client.signal.Signal;
+import com.calclab.suco.client.signal.Signal2;
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
+import com.calclab.suco.client.signal.Slot2;
 
 public class StateManagerDefault implements StateManager {
     private final ContentProvider contentProvider;
@@ -44,6 +47,8 @@
     private final HashMap<String, Slot<StateToken>> siteTokens;
     private final Signal<StateDTO> onStateChanged;
     private final Signal<StateDTO> onSocialNetworkChanged;
+    private final Signal2<String, String> onToolChanged;
+    private final Signal2<String, String> onGroupChanged;
 
     public StateManagerDefault(final ContentProvider contentProvider, final Session session,
 	    final HistoryWrapper history) {
@@ -52,14 +57,16 @@
 	this.history = history;
 	this.oldState = null;
 	this.onStateChanged = new Signal<StateDTO>("onStateChanged");
+	this.onGroupChanged = new Signal2<String, String>("onGroupChanged");
+	this.onToolChanged = new Signal2<String, String>("onToolChanged");
 	this.onSocialNetworkChanged = new Signal<StateDTO>("onSocialNetworkChanged");
 	session.onUserSignIn(new Slot<UserInfoDTO>() {
 	    public void onEvent(final UserInfoDTO parameter) {
 		restorePreviousState();
 	    }
 	});
-	session.onUserSignOut(new Slot<Object>() {
-	    public void onEvent(final Object parameter) {
+	session.onUserSignOut(new Slot0() {
+	    public void onEvent() {
 		reload();
 	    }
 	});
@@ -81,6 +88,10 @@
 	setState(new StateToken(token));
     }
 
+    public void onGroupChanged(final Slot2<String, String> slot) {
+	onGroupChanged.add(slot);
+    }
+
     public void onHistoryChanged(final String historyToken) {
 	final Slot<StateToken> tokenSlot = siteTokens.get(historyToken);
 	Log.debug("history token: " + historyToken);
@@ -107,6 +118,10 @@
 	onStateChanged.add(slot);
     }
 
+    public void onToolChanged(final Slot2<String, String> slot) {
+	onToolChanged.add(slot);
+    }
+
     /**
      * <p>
      * Reload current state (using client cache if available)
@@ -157,6 +172,20 @@
 	history.newItem(state.getEncoded());
     }
 
+    private void checkGroupAndToolChange(final StateDTO oldState, final StateDTO newState) {
+	final String oldGroupName = oldState != null ? oldState.getGroup().getShortName() : null;
+	final String newGroupName = newState.getGroup().getShortName();
+	final String oldToolName = oldState != null ? oldState.getToolName() : null;
+	final String newToolName = newState.getToolName();
+	if (oldState == null || !oldGroupName.equals(newGroupName)) {
+	    onGroupChanged.fire(oldGroupName, newGroupName);
+	}
+	if (oldState == null || !oldToolName.equals(newToolName)) {
+	    onToolChanged.fire(oldToolName, newToolName);
+	}
+
+    }
+
     private void loadContent(final StateDTO state) {
 	session.setCurrent(state);
 	onStateChanged.fire(state);
@@ -196,9 +225,10 @@
 
     private void onHistoryChanged(final StateToken newState) {
 	contentProvider.getContent(session.getUserHash(), newState, new AsyncCallbackSimple<StateDTO>() {
-	    public void onSuccess(final StateDTO newStateDTO) {
-		loadContent(newStateDTO);
-		oldState = newStateDTO;
+	    public void onSuccess(final StateDTO newState) {
+		loadContent(newState);
+		checkGroupAndToolChange(oldState, newState);
+		oldState = newState;
 	    }
 	});
     }
@@ -207,6 +237,8 @@
 	if (oldState == null) {
 	    onHistoryChanged(new StateToken());
 	} else {
+	    final StateDTO currentState = session.getCurrentState();
+	    checkGroupAndToolChange(oldState, currentState);
 	    loadContent(oldState);
 	}
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -18,23 +18,19 @@
  *
  */
 
-package org.ourproject.kune.platf.client.tool;
-
-import org.ourproject.kune.platf.client.dto.StateToken;
-
-public abstract class AbstractClientTool implements ClientTool {
-    protected final ToolTriggerDefault trigger;
-
-    public AbstractClientTool(final String label) {
-	trigger = new ToolTriggerDefault(getName(), label);
-    }
-
-    public ToolTrigger getTrigger() {
-	return trigger;
-    }
-
-    public void setGroupState(final String groupShortName) {
-	trigger.setState(new StateToken(groupShortName, getName(), null, null));
-    }
-
-}
+package org.ourproject.kune.platf.client.tool;
+
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
+
+public abstract class AbstractClientTool implements ClientTool {
+
+    public AbstractClientTool(final String shortName, final String longName, final ToolSelector toolSelector,
+	    final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws) {
+	final ToolSelectorItemPresenter presenter = new ToolSelectorItemPresenter(shortName, longName, toolSelector,
+		wsThemePresenter);
+	final ToolSelectorItemPanel panel = new ToolSelectorItemPanel(presenter, ws);
+	presenter.init(panel);
+    }
+
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -24,18 +24,15 @@
 import org.ourproject.kune.workspace.client.component.WorkspaceComponent;
 
 public interface ClientTool {
-    String getName();
 
-    ToolTrigger getTrigger();
+    WorkspaceComponent getContent();
 
     WorkspaceComponent getContext();
 
-    WorkspaceComponent getContent();
+    String getName();
 
     void setContent(StateDTO state);
 
     void setContext(StateDTO state);
 
-    void setGroupState(String groupShortName);
-
 }

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,8 @@
+package org.ourproject.kune.platf.client.tool;
+
+
+public interface ToolSelector {
+
+    public void addTool(ToolSelectorItem item);
+
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,11 @@
+package org.ourproject.kune.platf.client.tool;
+
+public interface ToolSelectorItem {
+
+    String getShortName();
+
+    void setGroupShortName(String groupShortName);
+
+    void setSelected(boolean selected);
+
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,50 @@
+package org.ourproject.kune.platf.client.tool;
+
+import org.ourproject.kune.platf.client.ui.RoundedPanel;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.Hyperlink;
+
+public class ToolSelectorItemPanel extends RoundedPanel implements ToolSelectorItemView {
+    private final Hyperlink hl;
+
+    public ToolSelectorItemPanel(final ToolSelectorItemPresenter presenter, final WorkspaceSkeleton ws) {
+	super(RoundedPanel.RIGHT, 2);
+	hl = new Hyperlink();
+	super.setWidget(hl);
+	ws.getEntitySummary().addInTools(this);
+	super.sinkEvents(Event.ONCLICK);
+	super.addStyleName("k-toolselectoritem");
+    }
+
+    @Override
+    public void onBrowserEvent(final Event event) {
+	super.onBrowserEvent(event);
+    }
+
+    public void setLink(final String text, final String targetHistoryToken) {
+	hl.setText(text);
+	hl.setTargetHistoryToken(targetHistoryToken);
+    }
+
+    public void setSelected(final boolean selected) {
+	if (selected) {
+	    hl.setStylePrimaryName("k-toolselectoritem-sel");
+	} else {
+	    hl.setStylePrimaryName("k-toolselectoritem-notsel");
+	}
+	super.setCornerStyleName(hl.getStyleName());
+    }
+
+    public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+	if (oldTheme != null) {
+	    final String oldName = oldTheme.getName();
+	    hl.removeStyleDependentName(oldName);
+	}
+	final String newName = newTheme.getName();
+	hl.addStyleDependentName(newName);
+	super.setCornerStyleName(hl.getStyleName());
+    }
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,57 @@
+package org.ourproject.kune.platf.client.tool;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
+
+import com.calclab.suco.client.signal.Slot2;
+
+public class ToolSelectorItemPresenter implements ToolSelectorItem {
+
+    private ToolSelectorItemView view;
+    private final ToolSelector toolSelector;
+    private final WsThemePresenter wsThemePresenter;
+    private final String shortName;
+    private final String longName;
+
+    public ToolSelectorItemPresenter(final String shortName, final String longName, final ToolSelector toolSelector,
+	    final WsThemePresenter wsThemePresenter) {
+	this.shortName = shortName;
+	this.longName = longName;
+	this.toolSelector = toolSelector;
+	this.wsThemePresenter = wsThemePresenter;
+    }
+
+    public String getShortName() {
+	return shortName;
+    }
+
+    public View getView() {
+	return view;
+    }
+
+    public void init(final ToolSelectorItemView view) {
+	this.view = view;
+	toolSelector.addTool(this);
+	wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+	    public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+		setTheme(oldTheme, newTheme);
+	    }
+	});
+    }
+
+    public void setGroupShortName(final String groupShortName) {
+	final StateToken token = new StateToken(groupShortName, getShortName(), null, null);
+	view.setLink(longName, token.toString());
+    }
+
+    public void setSelected(final boolean selected) {
+	view.setSelected(selected);
+    }
+
+    private void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+	view.setTheme(oldTheme, newTheme);
+    }
+
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,13 @@
+package org.ourproject.kune.platf.client.tool;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+
+public interface ToolSelectorItemView extends View {
+
+    void setLink(String text, String targetHistoryToken);
+
+    void setSelected(boolean selected);
+
+    void setTheme(WsTheme oldTheme, WsTheme newTheme);
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPanel.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPanel.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,94 @@
+package org.ourproject.kune.platf.client.tool;
+
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.ourproject.kune.platf.client.tool.ToolTrigger.TriggerListener;
+import org.ourproject.kune.platf.client.ui.HasColor;
+import org.ourproject.kune.platf.client.ui.RoundedBorderDecorator;
+import org.ourproject.kune.workspace.client.ui.newtmp.skel.WorkspaceSkeleton;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+
+import com.google.gwt.user.client.ui.Hyperlink;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Widget;
+
+public class ToolSelectorPanel extends VerticalPanel implements ToolSelectorView {
+
+    private static final String ITEM_SELECTED = "kune-GroupToolsBar-itemSelected";
+    private static final String ITEM_NOT_SELECTED = "kune-GroupToolsBar-itemNotSelected";
+    private Widget currentTab;
+    private final HashMap<String, Widget> tabs;
+
+    public ToolSelectorPanel(final ToolSelectorPresenter presenter, final WorkspaceSkeleton ws) {
+	tabs = new HashMap<String, Widget>();
+	currentTab = null;
+	addStyleName("kune-GroupToolsBar");
+	ws.getEntitySummary().addInTools(this);
+    }
+
+    public void addItem(final ToolTrigger trigger) {
+	final int nextIndex = this.getWidgetCount();
+	final Widget menuItem = createItem(nextIndex, trigger);
+	setTabSelected(menuItem, false);
+	tabs.put(trigger.getName(), menuItem);
+	this.add(menuItem);
+    }
+
+    public void selectItem(final String toolName) {
+	if (currentTab != null) {
+	    setTabSelected(currentTab, false);
+	}
+	currentTab = getWidget(toolName);
+	setTabSelected(currentTab, true);
+    }
+
+    public void setTabsColors(final String selectedColor, final String unSelectedColor) {
+	final Iterator<Widget> iter = tabs.values().iterator();
+	while (iter.hasNext()) {
+	    final Widget w = iter.next();
+	    if (w == currentTab) {
+		((HasColor) w).setColor(selectedColor);
+	    } else {
+		((HasColor) w).setColor(unSelectedColor);
+	    }
+	}
+    }
+
+    public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) {
+	// TODO Auto-generated method stub
+
+    }
+
+    private Widget createItem(final int index, final ToolTrigger trigger) {
+	final SimplePanel menuItem = new SimplePanel();
+	addStyleName("Tab");
+	final Hyperlink hl = new Hyperlink(trigger.getLabel(), "");
+	trigger.setListener(new TriggerListener() {
+	    public void onStateChanged(final String encoded) {
+		hl.setTargetHistoryToken(encoded);
+	    }
+	});
+	menuItem.add(hl);
+	return new RoundedBorderDecorator(menuItem, RoundedBorderDecorator.RIGHT);
+    }
+
+    private Widget getWidget(final String toolName) {
+	return tabs.get(toolName);
+    }
+
+    private void setTabSelected(final Widget tab, final boolean isSelected) {
+	if (isSelected) {
+	    tab.removeStyleName(ITEM_NOT_SELECTED);
+	    tab.addStyleName(ITEM_SELECTED);
+	} else {
+	    tab.removeStyleName(ITEM_SELECTED);
+	    tab.addStyleName(ITEM_NOT_SELECTED);
+	}
+	// tring color = isSelected ? colorTheme.getToolSelected() :
+	// colorTheme.getToolUnselected();
+	// ((HasColor) tab).setColor(color);
+    }
+
+}
\ No newline at end of file

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,69 @@
+package org.ourproject.kune.platf.client.tool;
+
+import java.util.HashMap;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
+
+import com.calclab.suco.client.signal.Slot2;
+
+public class ToolSelectorPresenter implements ToolSelector {
+
+    private ToolSelectorView view;
+    private final HashMap<String, ToolSelectorItem> tools;
+
+    public ToolSelectorPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
+	tools = new HashMap<String, ToolSelectorItem>();
+	stateManager.onGroupChanged(new Slot2<String, String>() {
+	    public void onEvent(final String oldGroupName, final String newGroupName) {
+		onGroupChanged(newGroupName);
+	    }
+	});
+	stateManager.onToolChanged(new Slot2<String, String>() {
+	    public void onEvent(final String oldTool, final String newTool) {
+		onToolChanged(oldTool, newTool);
+	    }
+	});
+	wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
+	    public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
+		view.setTheme(oldTheme, newTheme);
+	    }
+	});
+    }
+
+    public void addTool(final ToolSelectorItem item) {
+	final String name = item.getShortName();
+	if (name == null) {
+	    throw new RuntimeException("You cannot add a tool without a name");
+	}
+	if (tools.get(name) != null) {
+	    throw new RuntimeException("A tool with the same name already added");
+	}
+	tools.put(name, item);
+	item.setSelected(false);
+    }
+
+    public View getView() {
+	return view;
+    }
+
+    public void init(final ToolSelectorView view) {
+	this.view = view;
+    }
+
+    void onGroupChanged(final String newGroupName) {
+	for (final String name : tools.keySet()) {
+	    tools.get(name).setGroupShortName(newGroupName);
+	}
+    }
+
+    void onToolChanged(final String oldTool, final String newTool) {
+	if (oldTool != null) {
+	    tools.get(oldTool).setSelected(false);
+	}
+	tools.get(newTool).setSelected(true);
+    }
+
+}

Added: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorView.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorView.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,9 @@
+package org.ourproject.kune.platf.client.tool;
+
+import org.ourproject.kune.platf.client.View;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsTheme;
+
+public interface ToolSelectorView extends View {
+
+    void setTheme(WsTheme oldTheme, WsTheme newTheme);
+}

Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DefaultBorderLayout.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -15,7 +15,7 @@
 
     public static final int DEF_TOOLBAR_HEIGHT = 26;
 
-    private static final int NO_SIZE = -1;
+    private static final int NO_SIZE = -666;
 
     private static RegionPosition[] regionPositions = new RegionPosition[] { RegionPosition.NORTH,
 	    RegionPosition.CENTER, RegionPosition.SOUTH, RegionPosition.EAST, RegionPosition.WEST };
@@ -66,10 +66,11 @@
     public void add(final Panel panel, final Widget widget) {
 	panel.add(widget);
 	if (panel.isRendered()) {
-	    panel.syncSize();
-	    panel.doLayout();
+	    mainPanel.doLayout(false);
+	    // panel.syncSize();
+	    // panel.doLayout();
 	}
-	doLayoutIfNeeded();
+	// doLayoutIfNeeded();
     }
 
     public void addStyle(final String style) {
@@ -110,6 +111,12 @@
 	}
     }
 
+    public void doLayoutIfNeeded(final boolean includeChilds) {
+	if (mainPanel.isRendered()) {
+	    mainPanel.doLayout(!includeChilds);
+	}
+    }
+
     public Panel getPanel() {
 	return mainPanel;
     }

Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -27,16 +27,28 @@
 import org.apache.lucene.search.Query;
 import org.hibernate.search.jpa.FullTextEntityManager;
 import org.hibernate.search.jpa.FullTextQuery;
+import org.hibernate.search.jpa.Search;
 
 import com.google.inject.Provider;
 
 public abstract class DefaultManager<T, K> {
     private final Provider<EntityManager> provider;
+    private final Provider<FullTextEntityManager> fullTextEntityManagerProvider;
     private final Class<T> entityClass;
 
     public DefaultManager(final Provider<EntityManager> provider, final Class<T> entityClass) {
 	this.provider = provider;
 	this.entityClass = entityClass;
+	fullTextEntityManagerProvider = new Provider<FullTextEntityManager>() {
+	    private FullTextEntityManager searchManager;
+
+	    public FullTextEntityManager get() {
+		if (searchManager == null) {
+		    searchManager = Search.createFullTextEntityManager(getEntityManager());
+		}
+		return searchManager;
+	    }
+	};
     }
 
     public T find(final Long primaryKey) {
@@ -63,9 +75,7 @@
 
     @SuppressWarnings("unchecked")
     public void reIndex() {
-	// TODO: Inject this
-	final FullTextEntityManager fullTextEm = org.hibernate.search.jpa.Search
-		.createFullTextEntityManager(getEntityManager());
+	final FullTextEntityManager fullTextEm = fullTextEntityManagerProvider.get();
 	fullTextEm.purgeAll(entityClass);
 	fullTextEm.getTransaction().commit();
 	fullTextEm.getTransaction().begin();
@@ -83,10 +93,7 @@
 
     @SuppressWarnings("unchecked")
     public SearchResult<T> search(final Query query, final Integer firstResult, final Integer maxResults) {
-	// TODO: Inject this?
-	final FullTextEntityManager fullTextEm = org.hibernate.search.jpa.Search
-		.createFullTextEntityManager(getEntityManager());
-	final FullTextQuery emQuery = fullTextEm.createFullTextQuery(query, entityClass);
+	final FullTextQuery emQuery = fullTextEntityManagerProvider.get().createFullTextQuery(query, entityClass);
 	if (firstResult != null && maxResults != null) {
 	    emQuery.setFirstResult(firstResult);
 	    emQuery.setMaxResults(maxResults);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nUITranslationService.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -141,16 +141,19 @@
 	    }
 	} else {
 	    // Not translated and not in db, make a petition for translation
-	    i18nService.getTranslation(session.getUserHash(), currentLanguageCode, text, new AsyncCallback<String>() {
-		public void onFailure(final Throwable caught) {
-		}
+	    if (session.isLogged()) {
+		i18nService.getTranslation(session.getUserHash(), currentLanguageCode, text,
+			new AsyncCallback<String>() {
+			    public void onFailure(final Throwable caught) {
+			    }
 
-		public void onSuccess(final String result) {
-		}
-	    });
-	    Log.debug("Registering in db '" + text + "' as pending translation");
+			    public void onSuccess(final String result) {
+			    }
+			});
+		Log.debug("Registering in db '" + text + "' as pending translation");
+		lexicon.put(encodeText, UNTRANSLATED_VALUE);
+	    }
 	    translation = removeNT(encodeText);
-	    lexicon.put(encodeText, UNTRANSLATED_VALUE);
 	}
 	return decodeHtml(translation);
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -31,8 +31,10 @@
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.newgroup.ui.SiteErrorType;
 import org.ourproject.kune.workspace.client.sitebar.Site;
+import org.ourproject.kune.workspace.client.sitebar.SiteToken;
 
 import com.calclab.suco.client.container.Provider;
+import com.calclab.suco.client.signal.Slot;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
@@ -50,10 +52,15 @@
 	this.session = session;
 	this.stateManager = stateManager;
 	this.groupServiceProvider = groupServiceProvider;
+	stateManager.addSiteToken(SiteToken.newgroup.toString(), new Slot<StateToken>() {
+	    public void onEvent(final StateToken previousStateToken) {
+		doNewGroup(previousStateToken);
+	    }
+	});
     }
 
-    public void doNewGroup(final StateToken previousTokenOrig) {
-	previousToken = previousTokenOrig;
+    public void doNewGroup(final StateToken previousToken) {
+	this.previousToken = previousToken;
 	session.check(new AsyncCallbackSimple<Object>() {
 	    public void onSuccess(final Object result) {
 		if (session.isLogged()) {
@@ -62,7 +69,7 @@
 		    view.center();
 		    Site.hideProgress();
 		} else {
-		    stateManager.setState(previousTokenOrig);
+		    stateManager.setState(previousToken);
 		    Site.info(i18n.t("Sign in or register to create a group"));
 		}
 	    }

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-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -49,11 +49,13 @@
 	this.stateManager = stateManager;
 	this.session = session;
 	this.snServiceProvider = snServiceProvider;
-	stateManager.onStateChanged(new Slot<StateDTO>() {
-	    public void onEvent(final StateDTO state) {
+	final Slot<StateDTO> setStateSlot = new Slot<StateDTO>() {
+	    public void onEvent(StateDTO state) {
 		setState(state);
 	    }
-	});
+	};
+	stateManager.onStateChanged(setStateSlot);
+	stateManager.onSocialNetworkChanged(setStateSlot);
 	wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
 	    public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
 		view.setTheme(oldTheme, newTheme);

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationSummaryPresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -58,11 +58,13 @@
 	collabOnlyCategory = new GridGroup(i18n.t("collaborator in:"), " ", i18n.t("Collaborate in these groups"),
 		false);
 	super.addGroupOperation(gotoGroupMenuItem, false);
-	stateManager.onStateChanged(new Slot<StateDTO>() {
-	    public void onEvent(final StateDTO state) {
+	final Slot<StateDTO> setStateSlot = new Slot<StateDTO>() {
+	    public void onEvent(StateDTO state) {
 		setState(state);
 	    }
-	});
+	};
+	stateManager.onStateChanged(setStateSlot);
+	stateManager.onSocialNetworkChanged(setStateSlot);
 	wsThemePresenter.onThemeChanged(new Slot2<WsTheme, WsTheme>() {
 	    public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) {
 		view.setTheme(oldTheme, newTheme);

Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/WorkspaceManager.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -1,54 +0,0 @@
-package org.ourproject.kune.workspace.client.ui.newtmp;
-
-import org.ourproject.kune.platf.client.ui.rate.RateIt;
-import org.ourproject.kune.platf.client.ui.rate.RatePresenter;
-import org.ourproject.kune.workspace.client.ui.newtmp.licensefoot.EntityLicensePresenter;
-import org.ourproject.kune.workspace.client.ui.newtmp.sitebar.sitepublic.SitePublicSpaceLink;
-import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
-import org.ourproject.kune.workspace.client.ui.newtmp.title.EntitySubTitlePresenter;
-import org.ourproject.kune.workspace.client.ui.newtmp.title.EntityTitlePresenter;
-import org.ourproject.kune.workspace.client.workspace.GroupMembersSummary;
-import org.ourproject.kune.workspace.client.workspace.GroupSummary;
-import org.ourproject.kune.workspace.client.workspace.ParticipationSummary;
-import org.ourproject.kune.workspace.client.workspace.TagsSummary;
-import org.ourproject.kune.workspace.client.workspace.ui.EntityLogo;
-
-import com.calclab.suco.client.container.Provider;
-
-public class WorkspaceManager {
-
-    private final EntityLogo entityLogo;
-    private final EntityTitlePresenter entityTitlePresenter;
-    private final WsThemePresenter wsThemePresenter;
-    private final EntityLicensePresenter entityLicensePresenter;
-    private final EntitySubTitlePresenter entitySubTitlePresenter;
-    private final Provider<TagsSummary> tagsProvider;
-    private final Provider<GroupMembersSummary> groupMembersSummaryProvider;
-    private final Provider<ParticipationSummary> participationSummaryProvider;
-    private final Provider<GroupSummary> groupSummaryProvider;
-    private final SitePublicSpaceLink publicSpaceLink;
-    private final Provider<RateIt> rateItProvider;
-    private final Provider<RatePresenter> ratePresenterProvider;
-
-    public WorkspaceManager(final SitePublicSpaceLink publicSpaceLink, final EntityLogo entityLogo,
-	    final EntityTitlePresenter entityTitlePresenter, final EntitySubTitlePresenter entitySubTitlePresenter,
-	    final WsThemePresenter wsThemePresenter, final EntityLicensePresenter entityLicensePresenter,
-	    final Provider<GroupMembersSummary> groupMembersSummaryProvider,
-	    final Provider<ParticipationSummary> participationSummaryProvider,
-	    final Provider<TagsSummary> tagsSummaryProvider, final Provider<GroupSummary> groupSummaryProvider,
-	    final Provider<RateIt> rateItProvider, final Provider<RatePresenter> rateProvider) {
-	this.publicSpaceLink = publicSpaceLink;
-	this.entityLogo = entityLogo;
-	this.entityTitlePresenter = entityTitlePresenter;
-	this.entitySubTitlePresenter = entitySubTitlePresenter;
-	this.entityLicensePresenter = entityLicensePresenter;
-	this.wsThemePresenter = wsThemePresenter;
-	this.groupMembersSummaryProvider = groupMembersSummaryProvider;
-	this.participationSummaryProvider = participationSummaryProvider;
-	this.tagsProvider = tagsSummaryProvider;
-	this.groupSummaryProvider = groupSummaryProvider;
-	this.rateItProvider = rateItProvider;
-	this.ratePresenterProvider = rateProvider;
-    }
-
-}

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPresenter.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignInLinkPresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -5,6 +5,7 @@
 import org.ourproject.kune.platf.client.state.Session;
 
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
 
 public class SiteSignInLinkPresenter implements SiteSignInLink {
 
@@ -16,8 +17,8 @@
 		view.setVisible(false);
 	    }
 	});
-	session.onUserSignOut(new Slot<Object>() {
-	    public void onEvent(final Object parameter) {
+	session.onUserSignOut(new Slot0() {
+	    public void onEvent() {
 		view.setVisible(true);
 	    }
 	});

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPresenter.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/sitesign/SiteSignOutLinkPresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -13,6 +13,7 @@
 
 import com.calclab.suco.client.container.Provider;
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.Cookies;
 import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -32,13 +33,13 @@
 		view.setVisible(true);
 	    }
 	});
-	session.onUserSignOut(new Slot<Object>() {
-	    public void onEvent(final Object parameter) {
+	session.onUserSignOut(new Slot0() {
+	    public void onEvent() {
 		view.setVisible(false);
 	    }
 	});
-	kuneErrorHandlerProvider.get().onSessionExpired(new Slot<Object>() {
-	    public void onEvent(final Object parameter) {
+	kuneErrorHandlerProvider.get().onSessionExpired(new Slot0() {
+	    public void onEvent() {
 		clientUIsignOut();
 	    }
 	});

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/sitebar/siteusermenu/SiteUserMenuPresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -5,6 +5,7 @@
 import org.ourproject.kune.platf.client.state.Session;
 
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot0;
 
 public class SiteUserMenuPresenter implements SiteUserMenu {
 
@@ -18,8 +19,8 @@
 		view.setUseGroupsIsMember(userInfoDTO.getGroupsIsAdmin(), userInfoDTO.getGroupsIsCollab());
 	    }
 	});
-	session.onUserSignOut(new Slot<Object>() {
-	    public void onEvent(final Object parameter) {
+	session.onUserSignOut(new Slot0() {
+	    public void onEvent() {
 		view.setVisible(false);
 		view.setLoggedUserName("");
 	    }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/newtmp/skel/EntitySummary.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -16,6 +16,7 @@
     public EntitySummary() {
 	mainPanel = new DefaultBorderLayout();
 	entityTools = new Panel();
+	entityTools.setAutoHeight(true);
 	entitySummary = new Panel();
 	entitySummary.setCls("k-entity-summary");
 	entityTools.setBorder(false);
@@ -23,7 +24,7 @@
 	entityTools.setAutoScroll(false);
 	entitySummary.setAutoScroll(true);
 	trayBar = mainPanel.createBottomBar(entitySummary, "k-site-traybar");
-	mainPanel.add(entityTools, DefaultBorderLayout.Position.NORTH, 30);
+	mainPanel.add(entityTools, DefaultBorderLayout.Position.NORTH);
 	mainPanel.add(entitySummary, DefaultBorderLayout.Position.CENTER);
 	trayBar.addFill();
     }
@@ -35,7 +36,7 @@
 
     public void addInTools(final Widget widget) {
 	entityTools.add(widget);
-	mainPanel.doLayoutIfNeeded();
+	mainPanel.doLayoutIfNeeded(true);
     }
 
     public void addListener(final ContainerListener listener) {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspacePresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspacePresenter.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/WorkspacePresenter.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -58,7 +58,7 @@
 	ClientTool clientTool;
 	while (iterator.hasNext()) {
 	    clientTool = iterator.next();
-	    view.addTab(clientTool.getTrigger());
+	    // view.addTab(clientTool.getTrigger());
 	}
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -176,7 +176,7 @@
     }
 
     public void addTab(final ToolTrigger trigger) {
-	groupToolsBar.addItem(trigger);
+	// groupToolsBar.addItem(trigger);
     }
 
     public void adjustSize(final int windowWidth, final int windowHeight) {

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-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -9,6 +9,7 @@
 import org.ourproject.kune.workspace.client.sitebar.SiteToken;
 
 import com.calclab.suco.client.signal.Slot;
+import com.calclab.suco.client.signal.Slot2;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 public class StateManagerTest {
@@ -21,6 +22,28 @@
 
     @SuppressWarnings("unchecked")
     @Test
+    public void changeStateWithDifferentGroupsMustFireSlot() {
+	final Slot2<String, String> groupSlot = Mockito.mock(Slot2.class);
+	stateManager.onGroupChanged(groupSlot);
+	stateManager.onHistoryChanged("group1.tool1");
+	stateManager.onHistoryChanged("group2.tool1");
+	// TODO, think how to test this
+	// Mockito.verify(groupSlot).onEvent("group1", "group2");
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void changeStateWithDifferentToolsMustFireSlot() {
+	final Slot2<String, String> toolSlot = Mockito.mock(Slot2.class);
+	stateManager.onToolChanged(toolSlot);
+	stateManager.gotoToken("group1.tool1");
+	stateManager.gotoToken("group1.tool2");
+	// TODO, think how to test this
+	// Mockito.verify(toolSlot).onEvent("tool1", "tool2");
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
     public void getDefGroup() {
 	stateManager.onHistoryChanged("site.docs");
 	Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),

Added: trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -0,0 +1,92 @@
+package org.ourproject.kune.platf.client.tool;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.ourproject.kune.platf.client.state.StateManager;
+import org.ourproject.kune.workspace.client.ui.newtmp.themes.WsThemePresenter;
+
+public class ToolSelectorPresenterTest {
+
+    private static final String TOOL1_NAME = "tool1";
+    private static final String TOOL2_NAME = "tool2";
+    private static final String GROUP1_NAME = "group1";
+    private ToolSelectorPresenter toolSelector;
+    private ToolSelectorItem toolSelectorItem1;
+    private ToolSelectorItem toolSelectorItem2;
+
+    @Test
+    public void addFirstToolMustNotSelect() {
+	setToolNames();
+	toolSelector.addTool(toolSelectorItem1);
+	Mockito.verify(toolSelectorItem1).setSelected(false);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void addToolWithoutNameMustGiveException() {
+	toolSelector.addTool(toolSelectorItem1);
+    }
+
+    @Test
+    public void addTwoToolsMustSelectNothing() {
+	setToolNames();
+	toolSelector.addTool(toolSelectorItem1);
+	toolSelector.addTool(toolSelectorItem2);
+	Mockito.verify(toolSelectorItem1).setSelected(false);
+	Mockito.verify(toolSelectorItem2).setSelected(false);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void addTwoToolsWithSameNameMustGiveException() {
+	setToolNames();
+	final ToolSelectorItem toolSelectorItemCopy = Mockito.mock(ToolSelectorItem.class);
+	Mockito.stub(toolSelectorItemCopy.getShortName()).toReturn(TOOL1_NAME);
+	toolSelector.addTool(toolSelectorItem1);
+	toolSelector.addTool(toolSelectorItemCopy);
+    }
+
+    @Before
+    public void begin() {
+	final StateManager stateManager = Mockito.mock(StateManager.class);
+	final WsThemePresenter themePresenter = Mockito.mock(WsThemePresenter.class);
+	toolSelector = new ToolSelectorPresenter(stateManager, themePresenter);
+	toolSelectorItem1 = Mockito.mock(ToolSelectorItem.class);
+	toolSelectorItem2 = Mockito.mock(ToolSelectorItem.class);
+    }
+
+    @Test
+    public void setStateFirstMustSelect() {
+	setToolNames();
+	toolSelector.addTool(toolSelectorItem1);
+	toolSelector.onToolChanged(null, TOOL1_NAME);
+	Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(false);
+	Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(true);
+    }
+
+    @Test
+    public void setStateWithADifferentGroupMustSetLink() {
+	setToolNames();
+	toolSelector.addTool(toolSelectorItem1);
+	toolSelector.addTool(toolSelectorItem2);
+	toolSelector.onGroupChanged(GROUP1_NAME);
+	Mockito.verify(toolSelectorItem1, Mockito.times(1)).setGroupShortName(GROUP1_NAME);
+	Mockito.verify(toolSelectorItem2, Mockito.times(1)).setGroupShortName(GROUP1_NAME);
+    }
+
+    @Test
+    public void setStateWithADifferentToolNameMustSelectAndUnSelectTheOlder() {
+	setToolNames();
+	toolSelector.addTool(toolSelectorItem1);
+	toolSelector.addTool(toolSelectorItem2);
+	toolSelector.onToolChanged(TOOL1_NAME, TOOL2_NAME);
+	Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(false);
+	Mockito.verify(toolSelectorItem1, Mockito.times(2)).setSelected(false);
+	Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(true);
+    }
+
+    public void setToolNames() {
+	Mockito.stub(toolSelectorItem1.getShortName()).toReturn(TOOL1_NAME);
+	Mockito.stub(toolSelectorItem2.getShortName()).toReturn(TOOL2_NAME);
+    }
+
+}

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceSaveTest.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -15,34 +15,34 @@
 
     @Before
     public void init() throws Exception {
-        new IntegrationTestHelper(this);
+	new IntegrationTestHelper(this);
 
-        defaultContent = getDefaultContent();
-        groupName = defaultContent.getGroup().getShortName();
-        doLogin();
+	defaultContent = getDefaultContent();
+	groupName = defaultContent.getGroup().getShortName();
+	doLogin();
     }
 
     @Test
     public void testSaveAndRetrieve() throws Exception {
-        final String text = "Lorem ipsum dolor sit amet";
-        final int version = defaultContent.getVersion();
-        final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
-        assertEquals(version + 2, currentVersion);
-        final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
-        assertEquals(text, again.getContent());
-        assertEquals(0, (int) again.getRateByUsers());
-        assertEquals(0, (double) again.getRate());
+	final String text = "Lorem ipsum dolor sit amet";
+	final int version = defaultContent.getVersion();
+	final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
+	assertEquals(version + 2, currentVersion);
+	final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
+	assertEquals(text, again.getContent());
+	assertEquals(0, (int) again.getRateByUsers());
+	assertEquals(new Double(0), again.getRate());
     }
 
     @Test
     public void testSaveAndRetrieveBig() throws Exception {
-        final String text = TestDomainHelper.createBigText();
-        ;
-        final int version = defaultContent.getVersion();
-        final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
-        assertEquals(version + 2, currentVersion);
-        final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
-        assertEquals(text, again.getContent());
+	final String text = TestDomainHelper.createBigText();
+	;
+	final int version = defaultContent.getVersion();
+	final int currentVersion = contentService.save(getHash(), groupName, defaultContent.getDocumentId(), text);
+	assertEquals(version + 2, currentVersion);
+	final StateDTO again = contentService.getContent(getHash(), groupName, defaultContent.getStateToken());
+	assertEquals(text, again.getContent());
     }
 
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -22,166 +22,166 @@
 
     @Test
     public void addRemoveAuthor() throws Exception {
-        final List<UserSimpleDTO> authors = defaultContent.getAuthors();
-        assertEquals(1, authors.size());
-        final UserSimpleDTO author = authors.get(0);
-        final String authorShortName = author.getShortName();
-        contentService.removeAuthor(getHash(), groupShortName, defDocument, authorShortName);
-        final List<UserSimpleDTO> authors2 = getDefaultContent().getAuthors();
-        assertEquals(0, authors2.size());
-        contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
-        final List<UserSimpleDTO> authors3 = getDefaultContent().getAuthors();
-        assertEquals(1, authors3.size());
-        contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
-        final List<UserSimpleDTO> authors4 = getDefaultContent().getAuthors();
-        assertEquals(1, authors4.size());
+	final List<UserSimpleDTO> authors = defaultContent.getAuthors();
+	assertEquals(1, authors.size());
+	final UserSimpleDTO author = authors.get(0);
+	final String authorShortName = author.getShortName();
+	contentService.removeAuthor(getHash(), groupShortName, defDocument, authorShortName);
+	final List<UserSimpleDTO> authors2 = getDefaultContent().getAuthors();
+	assertEquals(0, authors2.size());
+	contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
+	final List<UserSimpleDTO> authors3 = getDefaultContent().getAuthors();
+	assertEquals(1, authors3.size());
+	contentService.addAuthor(getHash(), groupShortName, defDocument, authorShortName);
+	final List<UserSimpleDTO> authors4 = getDefaultContent().getAuthors();
+	assertEquals(1, authors4.size());
     }
 
     @Test
     public void contentRateAndRetrieve() throws Exception {
-        contentService.rateContent(getHash(), groupShortName, defDocument, 4.5);
-        final StateDTO again = contentService.getContent(getHash(), groupShortName, defaultContent.getStateToken());
-        assertEquals(true, again.isRateable());
-        assertEquals(4.5, (double) again.getCurrentUserRate());
-        assertEquals(4.5, (double) again.getRate());
-        assertEquals(1, (double) again.getRateByUsers());
+	contentService.rateContent(getHash(), groupShortName, defDocument, 4.5);
+	final StateDTO again = contentService.getContent(getHash(), groupShortName, defaultContent.getStateToken());
+	assertEquals(true, again.isRateable());
+	assertEquals(new Double(4.5), again.getCurrentUserRate());
+	assertEquals(new Double(4.5), again.getRate());
+	assertEquals(new Integer(1), again.getRateByUsers());
     }
 
     @Test
     public void contentSetLanguage() throws Exception {
-        contentService.setLanguage(getHash(), groupShortName, defDocument, "es");
-        final StateDTO contentRetrieved = contentService.getContent(getHash(), groupShortName, defaultContent
-                .getStateToken());
-        assertEquals("es", contentRetrieved.getLanguage().getCode());
+	contentService.setLanguage(getHash(), groupShortName, defDocument, "es");
+	final StateDTO contentRetrieved = contentService.getContent(getHash(), groupShortName, defaultContent
+		.getStateToken());
+	assertEquals("es", contentRetrieved.getLanguage().getCode());
     }
 
     @Test
     public void folderRename() throws Exception {
-        doLogin();
-        defaultContent = getDefaultContent();
-        final ContainerDTO folder = defaultContent.getFolder();
+	doLogin();
+	defaultContent = getDefaultContent();
+	final ContainerDTO folder = defaultContent.getFolder();
 
-        final String oldTitle = "some title";
-        String newTitle = "folder new name";
-        final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
+	final String oldTitle = "some title";
+	String newTitle = "folder new name";
+	final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
 
-        final ContainerDTO newFolder = newState.getFolder().getChilds().get(0);
+	final ContainerDTO newFolder = newState.getFolder().getChilds().get(0);
 
-        assertEquals(oldTitle, newFolder.getName());
+	assertEquals(oldTitle, newFolder.getName());
 
-        final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
-                newFolder.getId().toString(), null);
-        String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
+	final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
+		newFolder.getId().toString(), null);
+	String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
 
-        assertEquals(newTitle, result);
+	assertEquals(newTitle, result);
 
-        final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
-                newFolder.getId().toString(), null);
-        StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+	final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
+		newFolder.getId().toString(), null);
+	StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
 
-        assertEquals(newTitle, folderAgain.getFolder().getName());
+	assertEquals(newTitle, folderAgain.getFolder().getName());
 
-        newTitle = "folder last name";
+	newTitle = "folder last name";
 
-        result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
+	result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
 
-        folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+	folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
 
-        assertEquals(newTitle, folderAgain.getFolder().getName());
+	assertEquals(newTitle, folderAgain.getFolder().getName());
 
     }
 
     @Test(expected = AccessViolationException.class)
     public void folderRenameOtherGroupFails() throws Exception {
-        doLogin();
-        defaultContent = getDefaultContent();
-        final ContainerDTO folder = defaultContent.getFolder();
-        final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
-                .getId().toString(), null);
+	doLogin();
+	defaultContent = getDefaultContent();
+	final ContainerDTO folder = defaultContent.getFolder();
+	final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
+		.getId().toString(), null);
 
-        final String newTitle = "folder new name";
-        contentService.rename(getHash(), super.getSiteAdminShortName(), folderToken.getEncoded(), newTitle);
+	final String newTitle = "folder new name";
+	contentService.rename(getHash(), super.getSiteAdminShortName(), folderToken.getEncoded(), newTitle);
     }
 
     @Test(expected = RuntimeException.class)
     public void folderRootRenameMustFail() throws Exception {
-        doLogin();
-        defaultContent = getDefaultContent();
-        final ContainerDTO folder = defaultContent.getFolder();
+	doLogin();
+	defaultContent = getDefaultContent();
+	final ContainerDTO folder = defaultContent.getFolder();
 
-        final String newTitle = "folder new name";
-        final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
-                .getId().toString(), null);
-        final String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
+	final String newTitle = "folder new name";
+	final StateToken folderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(), folder
+		.getId().toString(), null);
+	final String result = contentService.rename(getHash(), groupShortName, folderToken.getEncoded(), newTitle);
 
-        assertEquals(newTitle, result);
+	assertEquals(newTitle, result);
 
-        final ContainerDTO folderAgain = getDefaultContent().getFolder();
+	final ContainerDTO folderAgain = getDefaultContent().getFolder();
 
-        assertEquals(newTitle, folderAgain.getName());
+	assertEquals(newTitle, folderAgain.getName());
     }
 
     @Before
     public void init() throws Exception {
-        new IntegrationTestHelper(this);
-        doLogin();
-        defaultContent = getDefaultContent();
-        groupShortName = defaultContent.getStateToken().getGroup();
-        defDocument = defaultContent.getStateToken().getDocument();
+	new IntegrationTestHelper(this);
+	doLogin();
+	defaultContent = getDefaultContent();
+	groupShortName = defaultContent.getStateToken().getGroup();
+	defDocument = defaultContent.getStateToken().getDocument();
     }
 
     @Test
     public void setTagsAndResults() throws Exception {
-        contentService.setTags(getHash(), groupShortName, defDocument, "bfoo cfoa afoo2");
-        final List<TagResultDTO> summaryTags = contentService.getSummaryTags(getHash(), groupShortName);
-        assertEquals(3, summaryTags.size());
+	contentService.setTags(getHash(), groupShortName, defDocument, "bfoo cfoa afoo2");
+	final List<TagResultDTO> summaryTags = contentService.getSummaryTags(getHash(), groupShortName);
+	assertEquals(3, summaryTags.size());
 
-        TagResultDTO tagResultDTO = summaryTags.get(0);
-        assertEquals("afoo2", tagResultDTO.getName());
-        assertEquals(1, (long) tagResultDTO.getCount());
+	TagResultDTO tagResultDTO = summaryTags.get(0);
+	assertEquals("afoo2", tagResultDTO.getName());
+	assertEquals(1, (long) tagResultDTO.getCount());
 
-        tagResultDTO = summaryTags.get(1);
-        assertEquals("bfoo", tagResultDTO.getName());
-        assertEquals(1, (long) tagResultDTO.getCount());
+	tagResultDTO = summaryTags.get(1);
+	assertEquals("bfoo", tagResultDTO.getName());
+	assertEquals(1, (long) tagResultDTO.getCount());
 
-        tagResultDTO = summaryTags.get(2);
-        assertEquals("cfoa", tagResultDTO.getName());
-        assertEquals(1, (long) tagResultDTO.getCount());
+	tagResultDTO = summaryTags.get(2);
+	assertEquals("cfoa", tagResultDTO.getName());
+	assertEquals(1, (long) tagResultDTO.getCount());
     }
 
     @Test
     public void setTagsAndRetrieve() throws Exception {
-        contentService.setTags(getHash(), groupShortName, defDocument, "foo foa foo");
-        final String tagsRetrieved = getDefaultContent().getTags();
-        assertEquals("foo foa", tagsRetrieved);
+	contentService.setTags(getHash(), groupShortName, defDocument, "foo foa foo");
+	final String tagsRetrieved = getDefaultContent().getTags();
+	assertEquals("foo foa", tagsRetrieved);
     }
 
     @Test
     public void tokenRename() throws Exception {
-        doLogin();
-        defaultContent = getDefaultContent();
-        final ContainerDTO folder = defaultContent.getFolder();
+	doLogin();
+	defaultContent = getDefaultContent();
+	final ContainerDTO folder = defaultContent.getFolder();
 
-        final String oldTitle = "some title";
-        String newTitle = "folder new name";
-        final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
+	final String oldTitle = "some title";
+	String newTitle = "folder new name";
+	final StateDTO newState = contentService.addFolder(session.getHash(), groupShortName, folder.getId(), oldTitle);
 
-        final ContainerDTO newFolder = newState.getFolder().getChilds().get(0);
+	final ContainerDTO newFolder = newState.getFolder().getChilds().get(0);
 
-        assertEquals(oldTitle, newFolder.getName());
+	assertEquals(oldTitle, newFolder.getName());
 
-        final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
-                newFolder.getId().toString(), null);
+	final StateToken newFolderToken = new StateToken(groupShortName, defaultContent.getStateToken().getTool(),
+		newFolder.getId().toString(), null);
 
-        newTitle = "folder last name";
+	newTitle = "folder last name";
 
-        final String result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
+	final String result = contentService.rename(getHash(), groupShortName, newFolderToken.getEncoded(), newTitle);
 
-        assertEquals(newTitle, result);
+	assertEquals(newTitle, result);
 
-        final StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
+	final StateDTO folderAgain = contentService.getContent(getHash(), groupShortName, newFolderToken);
 
-        assertEquals(newTitle, folderAgain.getFolder().getName());
+	assertEquals(newTitle, folderAgain.getFolder().getName());
     }
 
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -34,75 +34,75 @@
 
     @After
     public void close() {
-        if (getTransaction().isActive()) {
-            getTransaction().rollback();
-        }
+	if (getTransaction().isActive()) {
+	    getTransaction().rollback();
+	}
     }
 
     @Before
     public void insertData() throws Exception {
-        english = new I18nLanguage(new Long(1819), "English", "English", "en");
-        languageManager.persist(english);
-        gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
-        countryManager.persist(gb);
+	english = new I18nLanguage(new Long(1819), "English", "English", "en");
+	languageManager.persist(english);
+	gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
+	countryManager.persist(gb);
     }
 
     @Test
     public void testContentNotRated() {
-        final EntityManager manager = openTransaction();
+	final EntityManager manager = openTransaction();
 
-        final Content cd = new Content();
-        cd.setLanguage(english);
-        cd.setPublishedOn(new Date());
-        manager.persist(cd);
+	final Content cd = new Content();
+	cd.setLanguage(english);
+	cd.setPublishedOn(new Date());
+	manager.persist(cd);
 
-        closeTransaction();
-        final Double rate = rateFinder.calculateRate(cd);
-        final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
-        assertEquals(0, (long) rateByUsers);
+	closeTransaction();
+	final Double rate = rateFinder.calculateRate(cd);
+	final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
+	assertEquals(0, (long) rateByUsers);
 
-        // FIXME: Why null? in other tests this return zero
-        assertEquals(null, rate);
+	// FIXME: Why null? in other tests this return zero
+	assertEquals(null, rate);
     }
 
     @Test
     public void testContentRateAverage() {
-        final EntityManager manager = openTransaction();
+	final EntityManager manager = openTransaction();
 
-        final User user1 = TestDomainHelper.createUser(1);
-        final User user2 = TestDomainHelper.createUser(2);
+	final User user1 = TestDomainHelper.createUser(1);
+	final User user2 = TestDomainHelper.createUser(2);
 
-        user1.setLanguage(english);
-        user2.setLanguage(english);
+	user1.setLanguage(english);
+	user2.setLanguage(english);
 
-        user1.setCountry(gb);
-        user2.setCountry(gb);
+	user1.setCountry(gb);
+	user2.setCountry(gb);
 
-        manager.persist(user1);
-        manager.persist(user2);
+	manager.persist(user1);
+	manager.persist(user2);
 
-        final Content cd = new Content();
-        cd.setLanguage(english);
-        cd.setPublishedOn(new Date());
-        manager.persist(cd);
+	final Content cd = new Content();
+	cd.setLanguage(english);
+	cd.setPublishedOn(new Date());
+	manager.persist(cd);
 
-        manager.persist(new Rate(user1, cd, 1.3));
-        manager.persist(new Rate(user2, cd, 3.3));
-        // same user and content other rate
-        final Rate rateFinded = rateFinder.find(user2, cd);
-        rateFinded.setValue(4.3);
-        manager.persist(rateFinded);
+	manager.persist(new Rate(user1, cd, 1.3));
+	manager.persist(new Rate(user2, cd, 3.3));
+	// same user and content other rate
+	final Rate rateFinded = rateFinder.find(user2, cd);
+	rateFinded.setValue(4.3);
+	manager.persist(rateFinded);
 
-        closeTransaction();
-        final Double rate = rateFinder.calculateRate(cd);
-        final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
-        final Double average = (1.3 + 4.3) / 2;
-        assertEquals(average, rate);
-        assertEquals(new Long(2), rateByUsers);
-        final Rate newRate1 = rateFinder.find(user1, cd);
-        final Rate newRate2 = rateFinder.find(user2, cd);
-        assertEquals(1.3, (double) newRate1.getValue());
-        assertEquals(4.3, (double) newRate2.getValue());
+	closeTransaction();
+	final Double rate = rateFinder.calculateRate(cd);
+	final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
+	final Double average = (1.3 + 4.3) / 2;
+	assertEquals(average, rate);
+	assertEquals(new Long(2), rateByUsers);
+	final Rate newRate1 = rateFinder.find(user1, cd);
+	final Rate newRate2 = rateFinder.find(user2, cd);
+	assertEquals(new Double(1.3), newRate1.getValue());
+	assertEquals(new Double(4.3), newRate2.getValue());
     }
 
 }

Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java	2008-08-01 10:53:22 UTC (rev 823)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/SocialNetworkManagerTest.java	2008-08-03 21:45:16 UTC (rev 824)
@@ -29,6 +29,7 @@
     private User user;
     private User admin;
     private User otherUser;
+    private DomainContext ctx;
 
     @Test
     public void acceptJoinGroup() throws Exception {
@@ -163,7 +164,7 @@
     @Before
     public void init() {
 	openTransaction();
-	final DomainContext ctx = new DomainContext();
+	ctx = new DomainContext();
 	ctx.createUsers("user1");
 	ctx.createUsers("admin");
 	ctx.createUsers("otheruser");




More information about the kune-commits mailing list