[kune-commits] r1280 - in trunk: . src/main/java/cc/kune/core/client/auth src/main/java/cc/kune/core/client/errors src/main/java/cc/kune/core/client/sitebar/logo src/main/java/cc/kune/core/client/sitebar/spaces src/main/java/cc/kune/core/client/state
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Wed Mar 16 02:10:46 CET 2011
Author: vjrj_
Date: 2011-03-16 02:10:10 +0100 (Wed, 16 Mar 2011)
New Revision: 1280
Added:
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/Space.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectEvent.java
Modified:
trunk/.classpath
trunk/.project
trunk/pom.xml
trunk/src/main/java/cc/kune/core/client/auth/SignIn.java
trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java
trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
trunk/src/main/java/cc/kune/core/client/sitebar/logo/SiteLogoPresenter.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorUiHandlers.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java
trunk/src/main/java/cc/kune/core/client/state/SiteCommonTokens.java
trunk/src/main/java/cc/kune/core/client/state/SiteTokenListeners.java
trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
Log:
NEW - # 35: Spaces selector integration with login/logout and history
http://kune.ourproject.org/issues/ticket/35
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/.classpath 2011-03-16 01:10:10 UTC (rev 1280)
@@ -118,5 +118,10 @@
<attribute name="javadoc_location" value="file:/home/vjrj/bin/eclipse64-hel-new/plugins/com.google.gwt.eclipse.sdkbundle.2.1.1_2.1.1.v201012170127/gwt-2.1.1/doc/javadoc/"/>
</attributes>
</classpathentry>
+ <classpathentry kind="src" path=".apt_generated">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="target/kune-0.0.7/WEB-INF/classes"/>
</classpath>
Modified: trunk/.project
===================================================================
--- trunk/.project 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/.project 2011-03-16 01:10:10 UTC (rev 1280)
@@ -1,34 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>kune</name>
- <comment>kune free/open/libre collaboration platform. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
- <projects/>
- <buildSpec>
- <buildCommand>
- <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
- </buildCommand>
- <buildCommand>
- <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.common.project.facet.core.builder</name>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.wst.validation.validationbuilder</name>
- </buildCommand>
- <buildCommand>
- <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
- <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
- <nature>org.eclipse.ajdt.ui.ajnature</nature>
- <nature>com.google.gwt.eclipse.core.gwtNature</nature>
- <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
- </natures>
-</projectDescription>
\ No newline at end of file
+ <name>kune</name>
+ <comment>kune free/open/libre collaboration platform. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.instantiations.assist.eclipse.coverage.instrumentationBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.ajdt.ui.ajnature</nature>
+ <nature>com.google.gwt.eclipse.core.gwtNature</nature>
+ <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
+ <nature>com.instantiations.assist.eclipse.coverage.codeCoverageNature</nature>
+ </natures>
+</projectDescription>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/pom.xml 2011-03-16 01:10:10 UTC (rev 1280)
@@ -11,6 +11,8 @@
<properties>
<!-- Available versions: http://repo1.maven.org/maven2/com/google/gwt/gwt-dev/ -->
<gwt.version>2.1.1</gwt.version>
+ <!-- <gwtmaven.version>2.2.0</gwtmaven.version> -->
+ <gwtmaven.version>2.1.0-1</gwtmaven.version>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -724,7 +726,7 @@
</executions>
<configuration>
<mainClass>cc.kune.wave.server.WaveMain</mainClass>
- <commandlineArgs>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001</commandlineArgs>
+ <commandlineArgs>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8001</commandlineArgs>
<systemProperties>
<systemProperty>
<key>wave.server.config</key>
@@ -903,11 +905,11 @@
<!-- =roo -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
- <version>2.1.0-1</version>
+ <version>${gwtmaven.version}</version>
<configuration>
+ <compileReport>true</compileReport>
<logLevel>INFO</logLevel>
<style>OBF</style>
- <soyc>false</soyc>
<gwtVersion>${gwt.version}</gwtVersion>
<runTarget>/ws/ws.html?log_level=DEBUG</runTarget>
<hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
@@ -930,18 +932,18 @@
</goals>
</execution>
</executions>
- <dependencies>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-dev</artifactId>
- <version>${gwt.version}</version>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <version>${gwt.version}</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <version>${gwt.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${gwt.version}</version>
+ </dependency>
+ </dependencies>
</plugin>
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>deb-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <configuration> <description>kune free/open/libre
@@ -1122,6 +1124,18 @@
<reporting>
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>${gwtmaven.version}</version>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>compile-report</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignIn.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignIn.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignIn.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -19,6 +19,8 @@
*/
package cc.kune.core.client.auth;
+import cc.kune.common.client.noti.NotifyLevel;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface SignIn {
@@ -29,4 +31,6 @@
void showSignInDialog();
+ void setErrorMessage(String message, NotifyLevel level);
+
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInPresenter.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -56,6 +56,7 @@
@ProxyCodeSplit
public interface SignInProxy extends Proxy<SignInPresenter> {
}
+
private final EventBus eventBus;
private final Provider<Register> registerProvider;
private final TimerWrapper timer;
@@ -190,6 +191,10 @@
}
}
+ public void setErrorMessage(String message, NotifyLevel level) {
+ getView().setErrorMessage(message, level);
+ }
+
@Override
protected void revealInParent() {
RevealRootContentEvent.fire(this, this);
Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -55,7 +55,7 @@
}
private void goHome() {
- stateManager.gotoToken(SiteCommonTokens.HOME);
+ stateManager.gotoToken(SiteCommonTokens.GROUP_HOME);
}
private void logException(final Throwable caught) {
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/logo/SiteLogoPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/logo/SiteLogoPresenter.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/logo/SiteLogoPresenter.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -61,7 +61,7 @@
@Override
public void onClick() {
- stateManager.gotoToken(SiteCommonTokens.HOME);
+ stateManager.gotoToken(SiteCommonTokens.GROUP_HOME);
}
@Override
Added: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/Space.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/Space.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/Space.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -0,0 +1,5 @@
+package cc.kune.core.client.sitebar.spaces;
+
+public enum Space {
+ homeSpace, userSpace, groupSpace, publicSpace
+}
Added: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectEvent.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectEvent.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -0,0 +1,80 @@
+package cc.kune.core.client.sitebar.spaces;
+
+import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.event.shared.HasHandlers;
+
+public class SpaceSelectEvent extends GwtEvent<SpaceSelectEvent.SpaceSelectHandler> {
+
+ public interface HasSpaceSelectHandlers extends HasHandlers {
+ HandlerRegistration addSpaceSelectHandler(SpaceSelectHandler handler);
+ }
+
+ public interface SpaceSelectHandler extends EventHandler {
+ public void onSpaceSelect(SpaceSelectEvent event);
+ }
+
+ private static final Type<SpaceSelectHandler> TYPE = new Type<SpaceSelectHandler>();
+
+ public static void fire(HasHandlers source, cc.kune.core.client.sitebar.spaces.Space space) {
+ source.fireEvent(new SpaceSelectEvent(space));
+ }
+
+ public static Type<SpaceSelectHandler> getType() {
+ return TYPE;
+ }
+
+ private cc.kune.core.client.sitebar.spaces.Space space;
+
+ public SpaceSelectEvent(cc.kune.core.client.sitebar.spaces.Space space) {
+ this.space = space;
+ }
+
+ protected SpaceSelectEvent() {
+ // Possibly for serialization.
+ }
+
+ @Override
+ public Type<SpaceSelectHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ public cc.kune.core.client.sitebar.spaces.Space getSpace() {
+ return space;
+ }
+
+ @Override
+ protected void dispatch(SpaceSelectHandler handler) {
+ handler.onSpaceSelect(this);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SpaceSelectEvent other = (SpaceSelectEvent) obj;
+ if (space == null) {
+ if (other.space != null)
+ return false;
+ } else if (!space.equals(other.space))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hashCode = 23;
+ hashCode = (hashCode * 37) + (space == null ? 1 : space.hashCode());
+ return hashCode;
+ }
+
+ @Override
+ public String toString() {
+ return "SpaceSelectEvent[" + space + "]";
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -19,17 +19,18 @@
*/
package cc.kune.core.client.sitebar.spaces;
-import cc.kune.common.client.noti.NotifyUser;
+import cc.kune.common.client.noti.NotifyLevel;
import cc.kune.core.client.auth.SignIn;
import cc.kune.core.client.init.AppStartEvent;
import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.UserSignInEvent;
+import cc.kune.core.client.state.UserSignOutEvent;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
import com.google.inject.Provider;
-import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
@@ -38,14 +39,13 @@
import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
public class SpaceSelectorPresenter extends
- Presenter<SpaceSelectorPresenter.SpaceSelectorView, SpaceSelectorPresenter.SpaceSelectorProxy> implements
- SpaceSelectorUiHandlers {
+ Presenter<SpaceSelectorPresenter.SpaceSelectorView, SpaceSelectorPresenter.SpaceSelectorProxy> {
@ProxyCodeSplit
public interface SpaceSelectorProxy extends Proxy<SpaceSelectorPresenter> {
}
- public interface SpaceSelectorView extends View, HasUiHandlers<SpaceSelectorUiHandlers> {
+ public interface SpaceSelectorView extends View {
void setGroupBtnDown(boolean down);
@@ -60,6 +60,8 @@
private final I18nTranslationService i18n;
private final Session session;
private final Provider<SignIn> signIn;
+ private Space currentSpace;
+ private boolean nextUserSpace;
@Inject
public SpaceSelectorPresenter(final EventBus eventBus, final SpaceSelectorView view,
@@ -70,57 +72,96 @@
this.session = session;
this.signIn = sigIn;
this.i18n = i18n;
- getView().setUiHandlers(this);
+ nextUserSpace = false;
}
@ProxyEvent
+ public void onUserSignIn(UserSignInEvent event) {
+ if (nextUserSpace) {
+ onUserSpaceSelect();
+ nextUserSpace = false;
+ }
+ }
+
+ @ProxyEvent
+ public void onUserSignOut(UserSignOutEvent event) {
+ if (currentSpace == Space.groupSpace)
+ onGroupSpaceSelect();
+ }
+
+ @ProxyEvent
+ public void onSpaceSelect(SpaceSelectEvent event) {
+ switch (event.getSpace()) {
+ case homeSpace:
+ onHomeSpaceSelect();
+ break;
+ case userSpace:
+ onUserSpaceSelect();
+ break;
+ case groupSpace:
+ onGroupSpaceSelect();
+ break;
+ case publicSpace:
+ onPublicSpaceSelect();
+ break;
+ default:
+ break;
+ }
+ }
+
+ @ProxyEvent
public void onAppStart(final AppStartEvent event) {
getView().setHomeBtnDown(false);
getView().setUserBtnDown(false);
getView().setGroupBtnDown(false);
getView().setPublicBtnDown(false);
- onGroupSpaceSelect();
+ onHomeSpaceSelect();
}
- @Override
- public void onGroupSpaceSelect() {
+ private void onGroupSpaceSelect() {
armor.selectGroupSpace();
getView().setHomeBtnDown(false);
getView().setUserBtnDown(false);
getView().setGroupBtnDown(true);
getView().setPublicBtnDown(false);
+ currentSpace = Space.groupSpace;
+ nextUserSpace = false;
}
- @Override
- public void onHomeSpaceSelect() {
+ private void onHomeSpaceSelect() {
armor.selectHomeSpace();
getView().setHomeBtnDown(true);
getView().setUserBtnDown(false);
getView().setGroupBtnDown(false);
getView().setPublicBtnDown(false);
+ currentSpace = Space.homeSpace;
+ nextUserSpace = false;
}
- @Override
- public void onPublicSpaceClick() {
+ private void onPublicSpaceSelect() {
armor.selectPublicSpace();
getView().setHomeBtnDown(false);
getView().setUserBtnDown(false);
getView().setGroupBtnDown(false);
getView().setPublicBtnDown(true);
+ currentSpace = Space.publicSpace;
+ nextUserSpace = false;
}
- @Override
- public void onUserSpaceSelect() {
+ private void onUserSpaceSelect() {
if (session.isLogged()) {
armor.selectUserSpace();
getView().setHomeBtnDown(false);
getView().setUserBtnDown(true);
getView().setGroupBtnDown(false);
getView().setPublicBtnDown(false);
+ currentSpace = Space.userSpace;
+ nextUserSpace = false;
} else {
signIn.get().showSignInDialog();
getView().setUserBtnDown(false);
- NotifyUser.info(i18n.t("Sign in to access to your workspace"));
+ signIn.get().setErrorMessage("Sign in to access to your workspace", NotifyLevel.info);
+ nextUserSpace = true;
}
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorUiHandlers.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorUiHandlers.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorUiHandlers.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -28,5 +28,5 @@
void onGroupSpaceSelect();
- void onPublicSpaceClick();
+ void onPublicSpaceSelect();
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorViewImpl.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -20,11 +20,14 @@
package cc.kune.core.client.sitebar.spaces;
import cc.kune.core.client.sitebar.spaces.SpaceSelectorPresenter.SpaceSelectorView;
+import cc.kune.core.client.state.SiteCommonTokens;
+import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.WsArmor;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.shared.EventBus;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
@@ -32,9 +35,9 @@
import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
-import com.gwtplatform.mvp.client.ViewWithUiHandlers;
+import com.gwtplatform.mvp.client.ViewImpl;
-public class SpaceSelectorViewImpl extends ViewWithUiHandlers<SpaceSelectorUiHandlers> implements SpaceSelectorView {
+public class SpaceSelectorViewImpl extends ViewImpl implements SpaceSelectorView {
interface SpaceSelectorViewImplUiBinder extends UiBinder<Widget, SpaceSelectorViewImpl> {
}
private static SpaceSelectorViewImplUiBinder uiBinder = GWT.create(SpaceSelectorViewImplUiBinder.class);
@@ -49,9 +52,13 @@
@UiField
ToggleButton userButton;
+ private final StateManager stateManager;
+ private final EventBus eventBus;
@Inject
- public SpaceSelectorViewImpl(final WsArmor armor, final I18nTranslationService i18n) {
+ public SpaceSelectorViewImpl(final WsArmor armor, final I18nTranslationService i18n, StateManager stateManager, EventBus eventBus) {
+ this.stateManager = stateManager;
+ this.eventBus = eventBus;
armor.getSitebar().insert(uiBinder.createAndBindUi(this), 0);
homeButton.setTitle(i18n.t("Home page of this site"));
userButton.setTitle(i18n.t("User space: Waves (docs) in which you participate"));
@@ -66,22 +73,22 @@
@UiHandler("groupButton")
void onGroupSpaceClick(final ClickEvent event) {
- getUiHandlers().onGroupSpaceSelect();
- }
+ SpaceSelectEvent.fire(eventBus, Space.groupSpace);
+ }
@UiHandler("homeButton")
void onHomeSpaceClick(final ClickEvent event) {
- getUiHandlers().onHomeSpaceSelect();
+ stateManager.gotoToken(SiteCommonTokens.HOME);
}
@UiHandler("publicButton")
void onPublicSpaceClick(final ClickEvent event) {
- getUiHandlers().onPublicSpaceClick();
+ SpaceSelectEvent.fire(eventBus, Space.publicSpace);
}
@UiHandler("userButton")
void onUserSpaceClick(final ClickEvent event) {
- getUiHandlers().onUserSpaceSelect();
+ SpaceSelectEvent.fire(eventBus, Space.userSpace);
}
@Override
Modified: trunk/src/main/java/cc/kune/core/client/state/SiteCommonTokens.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SiteCommonTokens.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/state/SiteCommonTokens.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -21,15 +21,16 @@
/**
* Some common history tokens like {@link #SIGNIN} and {@link #NEWGROUP}
- *
+ *
*/
public final class SiteCommonTokens {
public static final String ABOUTKUNE = "about";
- public final static String HOME = "";
+ public final static String GROUP_HOME = "";
public final static String NEWGROUP = "newgroup";
public final static String REGISTER = "register";
public final static String SIGNIN = "signin";
public final static String TRANSLATE = "translate";
+ public final static String HOME = "home";
private SiteCommonTokens() {
}
Modified: trunk/src/main/java/cc/kune/core/client/state/SiteTokenListeners.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SiteTokenListeners.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/state/SiteTokenListeners.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -25,6 +25,8 @@
import cc.kune.core.client.init.AppStartEvent;
import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
import cc.kune.core.client.sitebar.AboutKuneDialog;
+import cc.kune.core.client.sitebar.spaces.Space;
+import cc.kune.core.client.sitebar.spaces.SpaceSelectEvent;
import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
@@ -38,12 +40,14 @@
private final Provider<Register> register;
private final Provider<SignIn> signIn;
private final Provider<StateManager> stateManager;
+ private final EventBus eventBus;
@Inject
public SiteTokenListeners(final Session session, final EventBus eventBus,
final Provider<StateManager> stateManager, final Provider<SignIn> signIn,
final Provider<Register> register, final Provider<NewGroup> newGroup,
final Provider<AboutKuneDialog> aboutKuneDialog) {
+ this.eventBus = eventBus;
this.stateManager = stateManager;
this.signIn = signIn;
this.register = register;
@@ -59,6 +63,12 @@
}
private void init() {
+ stateManager.get().addSiteToken(SiteCommonTokens.HOME, new HistoryTokenCallback() {
+ @Override
+ public void onHistoryToken() {
+ SpaceSelectEvent.fire(eventBus, Space.homeSpace);
+ }
+ });
stateManager.get().addSiteToken(SiteCommonTokens.SIGNIN, new HistoryTokenCallback() {
@Override
public void onHistoryToken() {
Modified: trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2011-03-15 20:11:19 UTC (rev 1279)
+++ trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2011-03-16 01:10:10 UTC (rev 1280)
@@ -30,6 +30,8 @@
import cc.kune.common.client.log.Log;
import cc.kune.core.client.notify.spiner.ProgressHideEvent;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.sitebar.spaces.Space;
+import cc.kune.core.client.sitebar.spaces.SpaceSelectEvent;
import cc.kune.core.client.state.GroupChangedEvent.GroupChangedHandler;
import cc.kune.core.client.state.SocialNetworkChangedEvent.SocialNetworkChangedHandler;
import cc.kune.core.client.state.StateChangedEvent.StateChangedHandler;
@@ -59,8 +61,6 @@
private final Session session;
private final HashMap<String, HistoryTokenCallback> siteTokens;
- // private final SpaceSelectorPresenter spaceSelector;
-
@Inject
public StateManagerDefault(final ContentCache contentProvider, final Session session, final HistoryWrapper history,
final EventBus eventBus) {
@@ -68,7 +68,6 @@
this.contentProvider = contentProvider;
this.session = session;
this.history = history;
- // this.spaceSelector = spaceSelector;
this.previousToken = null;
this.resumedToken = null;
siteTokens = new HashMap<String, HistoryTokenCallback>();
@@ -176,6 +175,7 @@
// Non wave token
onHistoryChanged(new StateToken(historyToken));
} else {
+ SpaceSelectEvent.fire(eventBus, Space.userSpace);
// Wave token
// spaceSelector.onUserSpaceSelect();
if (session.isNotLogged()) {
More information about the kune-commits
mailing list