[kune-commits] r938 - in trunk/src: main/java/org/ourproject/kune/platf/client/services main/java/org/ourproject/kune/platf/client/state main/java/org/ourproject/kune/platf/client/tool main/java/org/ourproject/kune/workspace/client/editor main/java/org/ourproject/kune/workspace/client/entitylogo main/java/org/ourproject/kune/workspace/client/newgroup main/java/org/ourproject/kune/workspace/client/signin test/java/org/ourproject/kune/platf/client/state test/java/org/ourproject/kune/platf/client/tool test/java/org/ourproject/kune/workspace/client/editor

vjrj vjrj at ourproject.org
Tue Nov 4 13:32:37 CET 2008


Author: vjrj
Date: 2008-11-04 13:32:31 +0100 (Tue, 04 Nov 2008)
New Revision: 938

Modified:
   trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java
   trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java
   trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroup.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/signin/Register.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignIn.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPresenter.java
   trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
   trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java
   trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java
   trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
Log:
Complete - task TextEditor intercepts token change and ask for save before closing the editor 

Complete - task StateManager refactor 


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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -109,7 +109,6 @@
 import com.calclab.suco.client.ioc.decorator.Singleton;
 import com.calclab.suco.client.ioc.module.AbstractModule;
 import com.calclab.suco.client.ioc.module.Factory;
-import com.calclab.suco.client.listener.Listener;
 import com.calclab.suco.client.listener.Listener0;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.Cookies;
@@ -443,26 +442,26 @@
         });
 
         // Register of tokens like "signin", "newgroup", "translate" etcetera
-        $(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Listener<StateToken>() {
-            public void onEvent(final StateToken previousStateToken) {
-                $(SignIn.class).doSignIn(previousStateToken);
+        $(StateManager.class).addSiteToken(SiteToken.signin.toString(), new Listener0() {
+            public void onEvent() {
+                $(SignIn.class).doSignIn();
             }
         });
 
-        $(StateManager.class).addSiteToken(SiteToken.register.toString(), new Listener<StateToken>() {
-            public void onEvent(final StateToken previousStateToken) {
-                $(Register.class).doRegister(previousStateToken);
+        $(StateManager.class).addSiteToken(SiteToken.register.toString(), new Listener0() {
+            public void onEvent() {
+                $(Register.class).doRegister();
             }
         });
 
-        $(StateManager.class).addSiteToken(SiteToken.newgroup.toString(), new Listener<StateToken>() {
-            public void onEvent(final StateToken previousStateToken) {
-                $(NewGroup.class).doNewGroup(previousStateToken);
+        $(StateManager.class).addSiteToken(SiteToken.newgroup.toString(), new Listener0() {
+            public void onEvent() {
+                $(NewGroup.class).doNewGroup();
             }
         });
 
-        $(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Listener<StateToken>() {
-            public void onEvent(final StateToken previousStateToken) {
+        $(StateManager.class).addSiteToken(SiteToken.translate.toString(), new Listener0() {
+            public void onEvent() {
                 $(I18nTranslator.class).doShowTranslator();
             }
         });

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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManager.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -19,26 +19,25 @@
  */
 package org.ourproject.kune.platf.client.state;
 
-import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 
 import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
 import com.calclab.suco.client.listener.Listener2;
-import com.google.gwt.user.client.HistoryListener;
 
-public interface StateManager extends HistoryListener {
+public interface StateManager {
 
     void addBeforeStateChangeListener(BeforeStateChangeListener listener);
 
-    void addSiteToken(String token, Listener<StateToken> whenToken);
+    void addSiteToken(String token, Listener0 whenToken);
 
     void gotoToken(StateToken newToken);
 
     void gotoToken(String newToken);
 
-    void onGroupChanged(Listener2<GroupDTO, GroupDTO> listener);
+    void onGroupChanged(Listener2<String, String> listener);
 
     void onSocialNetworkChanged(Listener<StateAbstractDTO> listener);
 
@@ -52,8 +51,10 @@
 
     void removeSiteToken(String token);
 
-    void restorePreviousState();
+    void restorePreviousToken();
 
+    void resumeTokenChange();
+
     void setRetrievedState(StateAbstractDTO state);
 
     void setSocialNetwork(SocialNetworkResultDTO socialNet);

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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -22,12 +22,10 @@
 import java.util.HashMap;
 
 import org.ourproject.kune.platf.client.app.HistoryWrapper;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.ParticipationDataDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkDTO;
 import org.ourproject.kune.platf.client.dto.SocialNetworkResultDTO;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
-import org.ourproject.kune.platf.client.dto.StateContainerDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserBuddiesDataDTO;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
@@ -40,17 +38,23 @@
 import com.calclab.suco.client.listener.Listener;
 import com.calclab.suco.client.listener.Listener0;
 import com.calclab.suco.client.listener.Listener2;
+import com.google.gwt.user.client.HistoryListener;
 
-public class StateManagerDefault implements StateManager {
+public class StateManagerDefault implements StateManager, HistoryListener {
     private final ContentProvider contentProvider;
-    private StateAbstractDTO oldState;
+    private StateToken previousToken;
+    /**
+     * When a historyChanged is interrupted (for instance because you are
+     * editing something), the new token is stored here
+     */
+    private StateToken resumedToken;
     private final Session session;
     private final HistoryWrapper history;
-    private final HashMap<String, Listener<StateToken>> siteTokens;
+    private final HashMap<String, Listener0> siteTokens;
     private final Event<StateAbstractDTO> onStateChanged;
     private final Event<StateAbstractDTO> onSocialNetworkChanged;
     private final Event2<String, String> onToolChanged;
-    private final Event2<GroupDTO, GroupDTO> onGroupChanged;
+    private final Event2<String, String> onGroupChanged;
     private final BeforeStateChangeCollection beforeStateChangeCollection;
 
     public StateManagerDefault(final ContentProvider contentProvider, final Session session,
@@ -58,17 +62,19 @@
         this.contentProvider = contentProvider;
         this.session = session;
         this.history = history;
-        this.oldState = null;
+        this.previousToken = null;
+        this.resumedToken = null;
         this.onStateChanged = new Event<StateAbstractDTO>("onStateChanged");
-        this.onGroupChanged = new Event2<GroupDTO, GroupDTO>("onGroupChanged");
+        this.onGroupChanged = new Event2<String, String>("onGroupChanged");
         this.onToolChanged = new Event2<String, String>("onToolChanged");
         this.onSocialNetworkChanged = new Event<StateAbstractDTO>("onSocialNetworkChanged");
         session.onUserSignIn(new Listener<UserInfoDTO>() {
             public void onEvent(final UserInfoDTO parameter) {
-                if (oldState != null) {
-                    restorePreviousState();
+                if (previousToken == null) {
+                    // starting up
+                    reload();
                 } else {
-                    reload();
+                    // do nothing, SigInPresent calls goto;
                 }
             }
         });
@@ -77,7 +83,7 @@
                 reload();
             }
         });
-        siteTokens = new HashMap<String, Listener<StateToken>>();
+        siteTokens = new HashMap<String, Listener0>();
         beforeStateChangeCollection = new BeforeStateChangeCollection();
     }
 
@@ -85,13 +91,12 @@
         beforeStateChangeCollection.add(listener);
     }
 
-    public void addSiteToken(final String token, final Listener<StateToken> listener) {
+    public void addSiteToken(final String token, final Listener0 listener) {
         siteTokens.put(token, listener);
     }
 
     public void gotoToken(final StateToken newToken) {
         Log.debug("StateManager: history goto-token newItem (" + newToken + ")");
-
         history.newItem(newToken.getEncoded());
     }
 
@@ -99,28 +104,28 @@
         gotoToken(new StateToken(token));
     }
 
-    public void onGroupChanged(final Listener2<GroupDTO, GroupDTO> listener) {
+    public void onGroupChanged(final Listener2<String, String> listener) {
         onGroupChanged.add(listener);
     }
 
     public void onHistoryChanged(final String historyToken) {
         if (beforeStateListenersAllowChange(historyToken)) {
-            final Listener<StateToken> tokenListener = siteTokens.get(historyToken);
+            final Listener0 tokenListener = siteTokens.get(historyToken);
             Log.debug("StateManager: history token changed (" + historyToken + ")");
             if (tokenListener == null) {
+                // Ok, normal token change
                 onHistoryChanged(new StateToken(historyToken));
             } else {
-                StateToken stateToken;
-                if (oldState == null) {
+                // token is one of #newgroup #signin #translate ...
+                if (previousToken == null) {
                     // Starting with some token like "signin": load defContent
                     // also
-                    stateToken = new StateToken();
-                    onHistoryChanged(stateToken);
-                } else {
-                    stateToken = oldState.getStateToken();
+                    onHistoryChanged("");
                 }
-                tokenListener.onEvent(stateToken);
+                tokenListener.onEvent();
             }
+        } else {
+            resumedToken = previousToken;
         }
     }
 
@@ -153,13 +158,15 @@
         siteTokens.remove(token);
     }
 
-    public void restorePreviousState() {
-        if (oldState == null) {
-            onHistoryChanged(new StateToken());
-        } else {
-            final StateAbstractDTO newState = oldState;
-            oldState = session.getCurrentState();
-            setState(newState);
+    public void restorePreviousToken() {
+        gotoToken(previousToken);
+    }
+
+    public void resumeTokenChange() {
+        if (resumedToken != null) {
+            reload();
+            gotoToken(resumedToken);
+            clearResumedToken();
         }
     }
 
@@ -184,6 +191,14 @@
         }
     }
 
+    void setState(final StateAbstractDTO newState) {
+        session.setCurrentState(newState);
+        onStateChanged.fire(newState);
+        Site.hideProgress();
+        checkGroupAndToolChange(newState);
+        previousToken = newState.getStateToken();
+    }
+
     private boolean beforeStateListenersAllowChange(String newToken) {
         for (BeforeStateChangeListener listener : beforeStateChangeCollection) {
             if (!listener.beforeChange(newToken)) {
@@ -193,26 +208,26 @@
         return true;
     }
 
-    private void checkGroupAndToolChange(final StateAbstractDTO oldState, final StateAbstractDTO newState) {
-        final GroupDTO oldGroup = oldState != null ? oldState.getGroup() : null;
-        final GroupDTO newGroup = newState.getGroup();
-        if (oldState == null || !oldGroup.equals(newGroup)) {
-            onGroupChanged.fire(oldGroup, newGroup);
+    private void checkGroupAndToolChange(final StateAbstractDTO newState) {
+        final String previousGroup = previousToken == null ? "" : previousToken.getGroup();
+        final String newGroup = newState.getStateToken().getGroup();
+        if (previousToken == null || !previousGroup.equals(newGroup)) {
+            onGroupChanged.fire(previousGroup, newGroup);
         }
-        // TODO field with oldToolName
-        String oldToolName = null;
-        String newToolName = null;
-        if (oldState instanceof StateContainerDTO) {
-            oldToolName = oldState != null ? ((StateContainerDTO) oldState).getToolName() : null;
+        String previousTokenTool = previousToken == null ? "" : previousToken.getTool();
+        String newTokenTool = newState.getStateToken().getTool();
+        String previousToolName = previousTokenTool == null ? "" : previousTokenTool;
+        String newToolName = newTokenTool == null ? "" : newTokenTool;
+
+        if (previousToken == null || previousToolName == null || !previousToolName.equals(newToolName)) {
+            onToolChanged.fire(previousToolName, newToolName);
         }
-        if (newState instanceof StateContainerDTO) {
-            newToolName = ((StateContainerDTO) newState).getToolName();
-        }
-        if (oldState == null || oldToolName == null || !oldToolName.equals(newToolName)) {
-            onToolChanged.fire(oldToolName, newToolName);
-        }
     }
 
+    private void clearResumedToken() {
+        resumedToken = null;
+    }
+
     private void onHistoryChanged(final StateToken newState) {
         contentProvider.getContent(session.getUserHash(), newState, new AsyncCallbackSimple<StateAbstractDTO>() {
             public void onSuccess(final StateAbstractDTO newState) {
@@ -220,12 +235,4 @@
             }
         });
     }
-
-    private void setState(final StateAbstractDTO newState) {
-        session.setCurrentState(newState);
-        onStateChanged.fire(newState);
-        Site.hideProgress();
-        checkGroupAndToolChange(oldState, newState);
-        oldState = newState;
-    }
 }

Modified: 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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -21,7 +21,6 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.state.StateManager;
 import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
@@ -47,9 +46,9 @@
                 }
             }
         });
-        stateManager.onGroupChanged(new Listener2<GroupDTO, GroupDTO>() {
-            public void onEvent(final GroupDTO oldGroup, final GroupDTO newGroup) {
-                onGroupChanged(newGroup.getShortName());
+        stateManager.onGroupChanged(new Listener2<String, String>() {
+            public void onEvent(final String oldGroup, final String newGroup) {
+                onGroupChanged(newGroup);
             }
         });
         stateManager.onToolChanged(new Listener2<String, String>() {
@@ -78,10 +77,10 @@
     }
 
     void onToolChanged(final String oldTool, final String newTool) {
-        if (oldTool != null) {
+        if (!oldTool.equals("")) {
             tools.get(oldTool).setSelected(false);
         }
-        if (newTool != null) {
+        if (!newTool.equals("")) {
             tools.get(newTool).setSelected(true);
         }
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -35,6 +35,7 @@
 public class TextEditorPanel implements TextEditorView {
     private static final String BACKCOLOR_ENABLED = "#FFF";
     private static final String BACKCOLOR_DISABLED = "#CCC";
+    public static final String TEXT_AREA = "k-tep-ta";
     private final RichTextArea gwtRTarea;
     private final TextEditorToolbar textEditorToolbar;
     private final TextEditorPresenter presenter;
@@ -54,6 +55,7 @@
         gwtRTarea = new RichTextArea();
         gwtRTarea.setWidth("97%");
         gwtRTarea.addStyleName("kune-TexEditorPanel-TextArea");
+        gwtRTarea.ensureDebugId(TEXT_AREA);
 
         final Toolbar editorTopBar = new Toolbar();
         editorTopBar.getPanel().setWidth("auto");

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenter.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -51,7 +51,6 @@
     private ActionToolbarButtonDescriptor<StateToken> close;
     private final I18nUITranslationService i18n;
     private final BeforeStateChangeListener beforeStateChangeListener;
-    private String newTokenAfterSave;
     private final StateManager stateManager;
 
     public TextEditorPresenter(final boolean isAutoSave, final ActionToolbar<StateToken> toolbar,
@@ -67,7 +66,7 @@
 
         beforeStateChangeListener = new BeforeStateChangeListener() {
             public boolean beforeChange(String newToken) {
-                return beforeTokenChange(newToken);
+                return beforeTokenChange();
             }
         };
     }
@@ -79,7 +78,6 @@
         view.attach();
         setContent(content);
         stateManager.addBeforeStateChangeListener(beforeStateChangeListener);
-        newTokenAfterSave = null;
     }
 
     public String getContent() {
@@ -131,7 +129,6 @@
         savePending = false;
         saveAndCloseConfirmed = false;
         toolbar.setEnableAction(save, false);
-        newTokenAfterSave = null;
     }
 
     protected void onCancel() {
@@ -145,7 +142,7 @@
 
     protected void onCancelConfirmed() {
         stateManager.removeBeforeStateChangeListener(beforeStateChangeListener);
-        gotoNewTokenIfNecessary();
+        stateManager.resumeTokenChange();
         reset();
         view.detach();
         toolbar.detach();
@@ -172,9 +169,8 @@
         onSave.onEvent(view.getHTML());
     }
 
-    boolean beforeTokenChange(String newToken) {
+    boolean beforeTokenChange() {
         if (savePending) {
-            newTokenAfterSave = newToken;
             onCancel();
             return false;
         } else {
@@ -210,13 +206,6 @@
         toolbar.setActions(collection);
     }
 
-    private void gotoNewTokenIfNecessary() {
-        if (newTokenAfterSave != null) {
-            stateManager.reload();
-            stateManager.gotoToken(newTokenAfterSave);
-        }
-    }
-
     private void setContent(final String html) {
         this.view.setHTML(html);
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entitylogo/EntityLogoPresenter.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -39,9 +39,9 @@
     public EntityLogoPresenter(final StateManager stateManager, final WsThemePresenter theme, final Session session) {
         this.session = session;
 
-        stateManager.onGroupChanged(new Listener2<GroupDTO, GroupDTO>() {
-            public void onEvent(final GroupDTO oldGroup, final GroupDTO newGroup) {
-                setGroupLogo(newGroup);
+        stateManager.onGroupChanged(new Listener2<String, String>() {
+            public void onEvent(final String oldGroup, final String newGroup) {
+                setGroupLogo(session.getCurrentState().getGroup());
             }
         });
         stateManager.onStateChanged(new Listener<StateAbstractDTO>() {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroup.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroup.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -19,10 +19,9 @@
  */
 package org.ourproject.kune.workspace.client.newgroup;
 
-import org.ourproject.kune.platf.client.dto.StateToken;
 
 public interface NewGroup {
 
-    void doNewGroup(StateToken previousToken);
+    void doNewGroup();
 
 }

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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -34,7 +34,7 @@
 import org.ourproject.kune.workspace.client.site.SiteToken;
 
 import com.calclab.suco.client.ioc.Provider;
-import com.calclab.suco.client.listener.Listener;
+import com.calclab.suco.client.listener.Listener0;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
@@ -43,7 +43,6 @@
     public static final String REGISTER_TO_CREATE_A_GROUP = "Sign in or register to create a group";
     private NewGroupView view;
     private final I18nTranslationService i18n;
-    private StateToken previousToken;
     private final Session session;
     private final StateManager stateManager;
     private final Provider<GroupServiceAsync> groupServiceProvider;
@@ -54,15 +53,14 @@
         this.session = session;
         this.stateManager = stateManager;
         this.groupServiceProvider = groupServiceProvider;
-        stateManager.addSiteToken(SiteToken.newgroup.toString(), new Listener<StateToken>() {
-            public void onEvent(final StateToken previousStateToken) {
-                doNewGroup(previousStateToken);
+        stateManager.addSiteToken(SiteToken.newgroup.toString(), new Listener0() {
+            public void onEvent() {
+                doNewGroup();
             }
         });
     }
 
-    public void doNewGroup(final StateToken previousToken) {
-        this.previousToken = previousToken;
+    public void doNewGroup() {
         session.check(new AsyncCallbackSimple<Object>() {
             public void onSuccess(final Object result) {
                 if (session.isLogged()) {
@@ -71,7 +69,7 @@
                     view.center();
                     Site.hideProgress();
                 } else {
-                    stateManager.gotoToken(previousToken);
+                    stateManager.restorePreviousToken();
                     Site.info(i18n.t(REGISTER_TO_CREATE_A_GROUP));
                 }
             }
@@ -96,12 +94,12 @@
     public void onCancel() {
         view.hide();
         reset();
-        stateManager.gotoToken(previousToken);
+        stateManager.restorePreviousToken();
     }
 
     public void onClose() {
         reset();
-        stateManager.gotoToken(previousToken);
+        stateManager.restorePreviousToken();
     }
 
     public void onFinish() {

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/Register.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/Register.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/Register.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -1,10 +1,9 @@
 package org.ourproject.kune.workspace.client.signin;
 
-import org.ourproject.kune.platf.client.dto.StateToken;
 
 public interface Register {
 
-    void doRegister(StateToken previousStateToken);
+    void doRegister();
 
     void hide();
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPanel.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -99,7 +99,8 @@
                 i18n.t("Now you can participate more actively in this site with other people and groups. "
                         + "You can also use your personal space to publish contents. "
                         + "Your email is not verified, please follow the instructions you will receive by email."),
-                i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 400, 210);
+                i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 380, 210);
+        welcomeDialog.setId(WELCOME_DIALOG);
         welcomeDialog.show();
     }
 
@@ -107,7 +108,7 @@
         InfoDialog welcomeDialog = new InfoDialog(i18n.t("Welcome"), i18n.t("Thanks for registering"),
                 i18n.t("Now you can participate more actively in this site with other people and groups. "
                         + "Your email is not verified, please follow the instructions you will receive by email."),
-                i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 400, 210);
+                i18n.t("Ok"), WELCOME_OK_BUTTON, true, true, 380, 210);
         welcomeDialog.setId(WELCOME_DIALOG);
         welcomeDialog.show();
     }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -3,7 +3,6 @@
 import org.ourproject.kune.platf.client.View;
 import org.ourproject.kune.platf.client.dto.I18nCountryDTO;
 import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.TimeZoneDTO;
 import org.ourproject.kune.platf.client.dto.UserDTO;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
@@ -36,8 +35,7 @@
         this.signInProvider = signInProvider;
     }
 
-    public void doRegister(StateToken previousStateToken) {
-        this.previousStateToken = previousStateToken;
+    public void doRegister() {
         signInProvider.get().hide();
         if (!session.isLogged()) {
             Site.showProgressProcessing();
@@ -45,7 +43,7 @@
             view.center();
             Site.hideProgress();
         } else {
-            stateManager.gotoToken(previousStateToken);
+            stateManager.restorePreviousToken();
         }
     }
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignIn.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignIn.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignIn.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -1,10 +1,9 @@
 package org.ourproject.kune.workspace.client.signin;
 
-import org.ourproject.kune.platf.client.dto.StateToken;
 
 public interface SignIn {
 
-    void doSignIn(StateToken previousStateToken);
+    void doSignIn();
 
     void hide();
 

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPresenter.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInAbstractPresenter.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -1,7 +1,6 @@
 package org.ourproject.kune.workspace.client.signin;
 
 import org.ourproject.kune.platf.client.dto.I18nLanguageDTO;
-import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
 import org.ourproject.kune.platf.client.state.Session;
 import org.ourproject.kune.platf.client.state.StateManager;
@@ -12,7 +11,6 @@
     protected final Session session;
     protected final StateManager stateManager;
     protected final I18nUITranslationService i18n;
-    protected StateToken previousStateToken;
     protected SignInAbstractView view;
 
     public SignInAbstractPresenter(Session session, StateManager stateManager, I18nUITranslationService i18n) {
@@ -29,14 +27,14 @@
         view.reset();
         view.hideMessages();
         view.hide();
-        stateManager.gotoToken(previousStateToken);
+        stateManager.restorePreviousToken();
     }
 
     public void onClose() {
         view.reset();
         view.hideMessages();
         if (!session.isLogged()) {
-            stateManager.gotoToken(previousStateToken);
+            stateManager.restorePreviousToken();
         }
     }
 
@@ -49,6 +47,7 @@
         final I18nLanguageDTO language = userInfoDTO.getLanguage();
         i18n.changeCurrentLanguage(language.getCode());
         session.setCurrentLanguage(language);
+        stateManager.restorePreviousToken();
     }
 
 }

Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -1,7 +1,6 @@
 package org.ourproject.kune.workspace.client.signin;
 
 import org.ourproject.kune.platf.client.View;
-import org.ourproject.kune.platf.client.dto.StateToken;
 import org.ourproject.kune.platf.client.dto.UserDTO;
 import org.ourproject.kune.platf.client.dto.UserInfoDTO;
 import org.ourproject.kune.platf.client.errors.UserAuthException;
@@ -31,8 +30,7 @@
         this.registerProvider = registerProvider;
     }
 
-    public void doSignIn(StateToken previousStateToken) {
-        this.previousStateToken = previousStateToken;
+    public void doSignIn() {
         registerProvider.get().hide();
         if (!session.isLogged()) {
             Site.showProgressProcessing();
@@ -41,7 +39,7 @@
             Site.hideProgress();
             view.focusOnNickname();
         } else {
-            stateManager.gotoToken(previousStateToken);
+            stateManager.restorePreviousToken();
         }
     }
 
@@ -88,7 +86,7 @@
 
                 public void onSuccess(final UserInfoDTO userInfoDTO) {
                     onSignIn(userInfoDTO);
-                    stateManager.gotoToken(previousStateToken);
+                    stateManager.restorePreviousToken();
                     view.hide();
                     view.unMask();
                 }

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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -1,16 +1,21 @@
 package org.ourproject.kune.platf.client.state;
 
+import static org.junit.Assert.assertTrue;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.ourproject.kune.platf.client.app.HistoryWrapper;
-import org.ourproject.kune.platf.client.dto.GroupDTO;
 import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
 import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.site.Site;
 import org.ourproject.kune.workspace.client.site.SiteToken;
+import org.ourproject.kune.workspace.client.sitebar.siteprogress.SiteProgress;
 
-import com.calclab.suco.client.listener.Listener;
-import com.calclab.suco.client.listener.Listener2;
+import com.calclab.suco.testing.listener.MockListener;
+import com.calclab.suco.testing.listener.MockListener0;
+import com.calclab.suco.testing.listener.MockListener2;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 public class StateManagerTest {
@@ -20,29 +25,83 @@
     private HistoryWrapper history;
     private ContentProvider contentProvider;
     private Session session;
+    private MockListener2<String, String> toolChangeListener;
+    private MockListener2<String, String> groupChangeListener;
+    private MockListener<StateAbstractDTO> stateChangeListener;
+    private StateAbstractDTO state;
+    private BeforeStateChangeListener beforeChangeListener1;
+    private BeforeStateChangeListener beforeChangeListener2;
 
-    @SuppressWarnings("unchecked")
+    @Before
+    public void before() {
+        contentProvider = Mockito.mock(ContentProvider.class);
+        session = Mockito.mock(Session.class);
+        history = Mockito.mock(HistoryWrapper.class);
+        stateManager = new StateManagerDefault(contentProvider, session, history);
+        Mockito.stub(session.getUserHash()).toReturn(HASH);
+        state = Mockito.mock(StateAbstractDTO.class);
+        stateChangeListener = new MockListener<StateAbstractDTO>();
+        groupChangeListener = new MockListener2<String, String>();
+        toolChangeListener = new MockListener2<String, String>();
+        beforeChangeListener1 = Mockito.mock(BeforeStateChangeListener.class);
+        beforeChangeListener2 = Mockito.mock(BeforeStateChangeListener.class);
+        stateManager.onStateChanged(stateChangeListener);
+        stateManager.onGroupChanged(groupChangeListener);
+        stateManager.onToolChanged(toolChangeListener);
+        new Site(Mockito.mock(I18nUITranslationService.class), Mockito.mock(SiteProgress.class), null);
+    }
+
     @Test
+    public void changeGroupWithNoTool() {
+        changeState("group1", "group2");
+        assertTrue(groupChangeListener.isCalledWithEquals("", "group1", "group1", "group2"));
+        assertTrue(toolChangeListener.isCalledWithEquals("", ""));
+        assertTrue(groupChangeListener.isCalled(2));
+        assertTrue(stateChangeListener.isCalled(2));
+    }
+
+    @Test
+    public void changeStateWithDifferentAndGroupsToolsMustFireListener() {
+        changeState("group2.tool1", "group1.tool2");
+        assertTrue(stateChangeListener.isCalled(2));
+        assertTrue(groupChangeListener.isCalledWithEquals("", "group2", "group2", "group1"));
+        assertTrue(toolChangeListener.isCalledWithEquals("", "tool1", "tool1", "tool2"));
+    }
+
+    @Test
     public void changeStateWithDifferentGroupsMustFireListener() {
-        final Listener2<GroupDTO, GroupDTO> groupListener = Mockito.mock(Listener2.class);
-        stateManager.onGroupChanged(groupListener);
-        stateManager.onHistoryChanged("group1.tool1");
-        stateManager.onHistoryChanged("group2.tool1");
-        // TODO, think how to test this
-        // Mockito.verify(groupListener).onEvent("group1", "group2");
+        changeState("group1.tool1", "group2.tool1");
+        assertTrue(stateChangeListener.isCalled(2));
+        assertTrue(groupChangeListener.isCalledWithEquals("", "group1", "group1", "group2"));
+        assertTrue(toolChangeListener.isCalledWithEquals("", "tool1"));
     }
 
-    @SuppressWarnings("unchecked")
     @Test
     public void changeStateWithDifferentToolsMustFireListener() {
-        final Listener2<String, String> toolListener = Mockito.mock(Listener2.class);
-        stateManager.onToolChanged(toolListener);
-        stateManager.gotoToken("group1.tool1");
-        stateManager.gotoToken("group1.tool2");
-        // TODO, think how to test this
-        // Mockito.verify(toolListener).onEvent("tool1", "tool2");
+        changeState("group1.tool1", "group1.tool2");
+        assertTrue(stateChangeListener.isCalled(2));
+        assertTrue(toolChangeListener.isCalledWithEquals("", "tool1", "tool1", "tool2"));
+        assertTrue(groupChangeListener.isCalledWithEquals("", "group1"));
     }
 
+    @Test
+    public void changeToNoTool() {
+        changeState("group1.tool1", "group1");
+        assertTrue(groupChangeListener.isCalledWithEquals("", "group1"));
+        assertTrue(toolChangeListener.isCalledWithEquals("", "tool1", "tool1", ""));
+        assertTrue(groupChangeListener.isCalledOnce());
+        assertTrue(stateChangeListener.isCalled(2));
+    }
+
+    @Test
+    public void changeToSameToken() {
+        changeState("group1.tool1", "group1.tool1");
+        assertTrue(groupChangeListener.isCalledWithEquals("", "group1"));
+        assertTrue(toolChangeListener.isCalledWithEquals("", "tool1"));
+        assertTrue(groupChangeListener.isCalledOnce());
+        assertTrue(stateChangeListener.isCalled(2));
+    }
+
     @SuppressWarnings("unchecked")
     @Test
     public void getDefGroup() {
@@ -51,15 +110,6 @@
                 (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
     }
 
-    @Before
-    public void init() {
-        contentProvider = Mockito.mock(ContentProvider.class);
-        session = Mockito.mock(Session.class);
-        history = Mockito.mock(HistoryWrapper.class);
-        stateManager = new StateManagerDefault(contentProvider, session, history);
-        Mockito.stub(session.getUserHash()).toReturn(HASH);
-    }
-
     @SuppressWarnings("unchecked")
     @Test
     public void normalStartLoggedUser() {
@@ -74,47 +124,44 @@
     @SuppressWarnings("unchecked")
     @Test
     public void oneBeforeStateChangeListenerAddAndRemove() {
-        BeforeStateChangeListener listener1 = Mockito.mock(BeforeStateChangeListener.class);
-        BeforeStateChangeListener listener2 = Mockito.mock(BeforeStateChangeListener.class);
-        String newToken = "something";
-        Mockito.stub(listener1.beforeChange(newToken)).toReturn(false);
-        Mockito.stub(listener2.beforeChange(newToken)).toReturn(false);
-        stateManager.addBeforeStateChangeListener(listener1);
-        stateManager.addBeforeStateChangeListener(listener2);
-        stateManager.removeBeforeStateChangeListener(listener1);
-        stateManager.removeBeforeStateChangeListener(listener2);
+        String newToken = confBeforeStateChangeListeners(false, false);
         stateManager.onHistoryChanged(newToken);
+        removeBeforeStateChangeListener();
+        stateManager.onHistoryChanged(newToken);
         Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
                 (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
+    }
 
+    @Test
+    public void oneBeforeStateChangeListenerFalseAndResume() {
+        String token = confBeforeStateChangeListeners(false, true);
+        stateManager.onHistoryChanged(token);
+        Mockito.verify(history, Mockito.never()).newItem(token);
+        removeBeforeStateChangeListener();
+        stateManager.resumeTokenChange();
+        Mockito.verify(history, Mockito.times(1)).newItem(token);
     }
 
     @SuppressWarnings("unchecked")
     @Test
     public void oneBeforeStateChangeListenerReturnFalse() {
-        BeforeStateChangeListener listener1 = Mockito.mock(BeforeStateChangeListener.class);
-        BeforeStateChangeListener listener2 = Mockito.mock(BeforeStateChangeListener.class);
-        String newToken = "something";
-        Mockito.stub(listener1.beforeChange(newToken)).toReturn(true);
-        Mockito.stub(listener2.beforeChange(newToken)).toReturn(false);
-        stateManager.addBeforeStateChangeListener(listener1);
-        stateManager.addBeforeStateChangeListener(listener2);
-        stateManager.onHistoryChanged(newToken);
+        stateManager.onHistoryChanged(confBeforeStateChangeListeners(true, false));
         Mockito.verify(contentProvider, Mockito.never()).getContent(Mockito.anyString(),
                 (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
     }
 
     @SuppressWarnings("unchecked")
     @Test
+    public void oneBeforeStateChangeListenerReturnFalseWithTwo() {
+        stateManager.onHistoryChanged(confBeforeStateChangeListeners(false, false));
+        Mockito.verify(contentProvider, Mockito.never()).getContent(Mockito.anyString(),
+                (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
+    }
+
+    @SuppressWarnings("unchecked")
+    @Test
     public void oneBeforeStateChangeListenerReturnTrue() {
-        BeforeStateChangeListener listener1 = Mockito.mock(BeforeStateChangeListener.class);
-        BeforeStateChangeListener listener2 = Mockito.mock(BeforeStateChangeListener.class);
-        String newToken = "something";
-        Mockito.stub(listener1.beforeChange(newToken)).toReturn(true);
-        Mockito.stub(listener2.beforeChange(newToken)).toReturn(true);
-        stateManager.addBeforeStateChangeListener(listener1);
-        stateManager.addBeforeStateChangeListener(listener2);
-        stateManager.onHistoryChanged(newToken);
+        stateManager.onHistoryChanged(confBeforeStateChangeListeners(true, true));
         Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
                 (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
     }
@@ -122,13 +169,41 @@
     @SuppressWarnings("unchecked")
     @Test
     public void siteTokenFirstLoadDefContentAndFireListener() {
-        final Listener listener = Mockito.mock(Listener.class);
+        final MockListener0 listener = new MockListener0();
         final String token = SiteToken.signin.toString();
         stateManager.addSiteToken(token, listener);
         stateManager.onHistoryChanged(token);
-        Mockito.verify(listener, Mockito.times(1)).onEvent(Mockito.anyObject());
+        assertTrue(listener.isCalledOnce());
         Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
                 (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
     }
 
+    @Test
+    public void siteTokenTest() {
+        MockListener0 siteTokenListener = new MockListener0();
+        stateManager.addSiteToken("signin", siteTokenListener);
+        stateManager.onHistoryChanged("signIn");
+        siteTokenListener.isCalledOnce();
+    }
+
+    private void changeState(String... tokens) {
+        for (String token : tokens) {
+            Mockito.stub(state.getStateToken()).toReturn(new StateToken(token));
+            stateManager.setState(state);
+        }
+    }
+
+    private String confBeforeStateChangeListeners(boolean value, boolean value2) {
+        stateManager.addBeforeStateChangeListener(beforeChangeListener1);
+        stateManager.addBeforeStateChangeListener(beforeChangeListener2);
+        String newToken = "something";
+        Mockito.stub(beforeChangeListener1.beforeChange(newToken)).toReturn(value);
+        Mockito.stub(beforeChangeListener2.beforeChange(newToken)).toReturn(value2);
+        return newToken;
+    }
+
+    private void removeBeforeStateChangeListener() {
+        stateManager.removeBeforeStateChangeListener(beforeChangeListener1);
+        stateManager.removeBeforeStateChangeListener(beforeChangeListener2);
+    }
 }

Modified: 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-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -58,7 +58,7 @@
     public void setStateFirstMustSelect() {
         setToolNames();
         toolSelector.addTool(toolSelectorItem1);
-        toolSelector.onToolChanged(null, TOOL1_NAME);
+        toolSelector.onToolChanged("", TOOL1_NAME);
         Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(false);
         Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(true);
     }
@@ -89,7 +89,7 @@
         setToolNames();
         toolSelector.addTool(toolSelectorItem1);
         toolSelector.addTool(toolSelectorItem2);
-        toolSelector.onToolChanged(TOOL1_NAME, null);
+        toolSelector.onToolChanged(TOOL1_NAME, "");
         Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(false);
         Mockito.verify(toolSelectorItem1, Mockito.times(2)).setSelected(false);
         Mockito.verify(toolSelectorItem2, Mockito.never()).setSelected(true);

Modified: trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java	2008-10-30 17:13:18 UTC (rev 937)
+++ trunk/src/test/java/org/ourproject/kune/workspace/client/editor/TextEditorPresenterTest.java	2008-11-04 12:32:31 UTC (rev 938)
@@ -38,7 +38,7 @@
     @Test
     public void historyChangeWithoutPendingMustAccept() {
         presenter.editContent("Text to edit", saveListener, cancelListener);
-        boolean change = presenter.beforeTokenChange("somegroup");
+        boolean change = presenter.beforeTokenChange();
         assertTrue(change);
         Mockito.verify(view, Mockito.never()).showSaveBeforeDialog();
         Mockito.verify(toolbar, Mockito.times(1)).detach();
@@ -46,19 +46,19 @@
 
     @Test
     public void historyChangeWithPendingSaveAndCancelMustPosponeIt() {
-        String newToken = editAndChangeHistoryToken();
+        editAndChangeHistoryToken();
         presenter.onCancelConfirmed();
         assertTrue(saveListener.isNotCalled());
-        Mockito.verify(stateManager, Mockito.times(1)).gotoToken(newToken);
+        Mockito.verify(stateManager, Mockito.times(1)).resumeTokenChange();
     }
 
     @Test
     public void historyChangeWithPendingSaveMustPosponeIt() {
-        String newToken = editAndChangeHistoryToken();
+        editAndChangeHistoryToken();
         presenter.onSaveAndClose();
         presenter.onSaved();
         assertTrue(saveListener.isCalledOnce());
-        Mockito.verify(stateManager, Mockito.times(1)).gotoToken(newToken);
+        Mockito.verify(stateManager, Mockito.times(1)).resumeTokenChange();
     }
 
     @Test
@@ -118,7 +118,7 @@
         presenter.editContent("Text to edit", saveListener, cancelListener);
         presenter.onEdit();
         String newToken = "somegroup";
-        boolean change = presenter.beforeTokenChange(newToken);
+        boolean change = presenter.beforeTokenChange();
         assertFalse(change);
         Mockito.verify(view, Mockito.times(1)).showSaveBeforeDialog();
         return newToken;




More information about the kune-commits mailing list