[kune-commits] r1533 - in trunk: . script src/main/java/cc/kune/chat/client src/main/java/cc/kune/chat/client/snd src/main/java/cc/kune/client src/main/java/cc/kune/common/client/utils src/main/java/cc/kune/core/client src/main/java/cc/kune/core/client/events src/main/java/cc/kune/core/client/groups/newgroup src/main/java/cc/kune/core/client/state src/main/java/cc/kune/core/client/sub src/main/java/cc/kune/wave/client/inboxcount src/main/resources src/test/java/cc/kune/core/client/state
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Mon Sep 26 14:45:05 CEST 2011
Author: vjrj_
Date: 2011-09-26 14:45:04 +0200 (Mon, 26 Sep 2011)
New Revision: 1533
Added:
trunk/src/main/java/cc/kune/common/client/utils/Base64Utils.java
trunk/src/main/java/cc/kune/core/client/events/SndClickEvent.java
trunk/src/main/java/cc/kune/core/client/sub/
trunk/src/main/java/cc/kune/core/client/sub/SubtitlesManager.java
trunk/src/main/java/cc/kune/core/client/sub/SubtitlesWidget.java
trunk/src/main/java/cc/kune/core/client/sub/SubtitlesWidget.ui.xml
Removed:
trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java
Modified:
trunk/.classpath
trunk/pom.xml
trunk/script/mvn-eclipse.sh
trunk/src/main/java/cc/kune/chat/client/KuneUnattendedPresenter.java
trunk/src/main/java/cc/kune/chat/client/snd/KuneSoundManager.java
trunk/src/main/java/cc/kune/client/KuneGinjector.java
trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
trunk/src/main/java/cc/kune/core/client/state/HistoryTokenCallback.java
trunk/src/main/java/cc/kune/core/client/state/SiteTokenListeners.java
trunk/src/main/java/cc/kune/core/client/state/SiteTokens.java
trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPresenter.java
trunk/src/main/resources/kune.properties
trunk/src/test/java/cc/kune/core/client/state/StateManagerDefaultTest.java
Log:
NEW - # 127: Generate some screencast while doing automate testing
http://kune.ourproject.org/issues/ticket/127
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/.classpath 2011-09-26 12:45:04 UTC (rev 1533)
@@ -11,19 +11,19 @@
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/appengine/appengine-api-1.0-sdk/1.3.1/appengine-api-1.0-sdk-1.3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box/0.3.2-SNAPSHOT/box-0.3.2-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box-src/0.3.2-SNAPSHOT/box-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box/0.3.2/box-0.3.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box-src/0.3.2/box-src-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
<classpathentry kind="var" path="M2_REPO/c3p0/c3p0/0.9.1/c3p0-0.9.1.jar" sourcepath="M2_REPO/c3p0/c3p0/0.9.1/c3p0-0.9.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar" sourcepath="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client/0.3.2-SNAPSHOT/client-0.3.2-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common/0.3.2-SNAPSHOT/client-common-0.3.2-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common-src/0.3.2-SNAPSHOT/client-common-src-0.3.2-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-scheduler-src/0.3.2-SNAPSHOT/client-scheduler-src-0.3.2-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-src/0.3.2-SNAPSHOT/client-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client/0.3.2/client-0.3.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common/0.3.2/client-common-0.3.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common-src/0.3.2/client-common-src-0.3.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-scheduler-src/0.3.2/client-scheduler-src-0.3.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-src/0.3.2/client-src-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/cobogw/gwt/cobogw/1.3.1/cobogw-1.3.1.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/common-src/0.3.2-SNAPSHOT/common-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/common-src/0.3.2/common-src-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar" sourcepath="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-cli/commons-cli/1.2/commons-cli-1.2.jar" sourcepath="M2_REPO/commons-cli/commons-cli/1.2/commons-cli-1.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4-sources.jar"/>
@@ -32,8 +32,8 @@
<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.3.1/commons-io-1.3.1.jar" sourcepath="M2_REPO/commons-io/commons-io/1.3.1/commons-io-1.3.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.5/commons-lang-2.5.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.5/commons-lang-2.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/communication-src/0.3.2-SNAPSHOT/communication-src-0.3.2-SNAPSHOT.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/concurrencycontrol-src/0.3.2-SNAPSHOT/concurrencycontrol-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/communication-src/0.3.2/communication-src-0.3.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/concurrencycontrol-src/0.3.2/concurrencycontrol-src-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/htmlunit/crawl_htmlunit/r5662-gae/crawl_htmlunit-r5662-gae.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5.jar" sourcepath="M2_REPO/net/sourceforge/cssparser/cssparser/0.9.5/cssparser-0.9.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
@@ -55,10 +55,8 @@
<classpathentry kind="var" path="M2_REPO/com/allen_sauer/gwt/log/gwt-log/gwt-log/3.0.1/gwt-log-3.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/gwt/gwt-servlet/2.1.1/gwt-servlet-2.1.1.jar" sourcepath="M2_REPO/com/google/gwt/gwt-servlet/2.1.1/gwt-servlet-2.1.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/gwt/gwt-user/2.1.1/gwt-user-2.1.1.jar" sourcepath="M2_REPO/com/google/gwt/gwt-user/2.1.1/gwt-user-2.1.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/gwt-util-src/0.3.2-SNAPSHOT/gwt-util-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/gwt-util-src/0.3.2/gwt-util-src-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/com/allen_sauer/gwt/voices/gwt-voices/gwt-voices/2.0.0/gwt-voices-2.0.0.jar"/>
- <classpathentry kind="var" path="M2_REPO/com/gwtext/gwtext/2.0.5/gwtext-2.0.5.jar"/>
- <classpathentry kind="var" path="M2_REPO/com/gwtextux/gwtextux/0.4.0.924/gwtextux-0.4.0.924.jar"/>
<classpathentry kind="var" path="M2_REPO/com/gwtplatform/gwtp-all/0.5/gwtp-all-0.5.jar" sourcepath="M2_REPO/com/gwtplatform/gwtp-all/0.5/gwtp-all-0.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/gwtplatform/gwtp-clients-common/0.5/gwtp-clients-common-0.5.jar" sourcepath="M2_REPO/com/gwtplatform/gwtp-clients-common/0.5/gwtp-clients-common-0.5-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/gwtplatform/gwtp-crawler/0.5/gwtp-crawler-0.5.jar" sourcepath="M2_REPO/com/gwtplatform/gwtp-crawler/0.5/gwtp-crawler-0.5-sources.jar"/>
@@ -113,16 +111,16 @@
<classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-profile/2.0/maven-profile-2.0.jar" sourcepath="M2_REPO/org/apache/maven/maven-profile/2.0/maven-profile-2.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0/maven-project-2.0.jar" sourcepath="M2_REPO/org/apache/maven/maven-project/2.0/maven-project-2.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0.jar" sourcepath="M2_REPO/org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/media-src/0.3.2-SNAPSHOT/media-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/media-src/0.3.2/media-src-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mockito/mockito-core/1.8.5/mockito-core-1.8.5.jar" sourcepath="M2_REPO/org/mockito/mockito-core/1.8.5/mockito-core-1.8.5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/model-src/0.3.2-SNAPSHOT/model-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/model-src/0.3.2/model-src-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mvel/mvel2/2.0.16/mvel2-2.0.16.jar" sourcepath="M2_REPO/org/mvel/mvel2/2.0.16/mvel2-2.0.16-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/mysql/mysql-connector-java/5.1.13/mysql-connector-java-5.1.13.jar"/>
<classpathentry kind="var" path="M2_REPO/net/sourceforge/nekohtml/nekohtml/1.9.15/nekohtml-1.9.15.jar" sourcepath="M2_REPO/net/sourceforge/nekohtml/nekohtml/1.9.15/nekohtml-1.9.15-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/objenesis/objenesis/1.0/objenesis-1.0.jar" sourcepath="M2_REPO/org/objenesis/objenesis/1.0/objenesis-1.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.jar" sourcepath="M2_REPO/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar" sourcepath="M2_REPO/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/proto-msg/0.3.2-SNAPSHOT/proto-msg-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/proto-msg/0.3.2/proto-msg-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/w3c/css/sac/1.3/sac-1.3.jar" sourcepath="M2_REPO/org/w3c/css/sac/1.3/sac-1.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-android-driver/2.6.0/selenium-android-driver-2.6.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-android-driver/2.6.0/selenium-android-driver-2.6.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-api/2.6.0/selenium-api-2.6.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-api/2.6.0/selenium-api-2.6.0-sources.jar"/>
@@ -144,16 +142,14 @@
<classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/testng/testng/6.2.1/testng-6.2.1.jar" sourcepath="M2_REPO/org/testng/testng/6.2.1/testng-6.2.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/tigase/tigase-xmltools/3.3.5/tigase-xmltools-3.3.5.jar" sourcepath="M2_REPO/tigase/tigase-xmltools/3.3.5/tigase-xmltools-3.3.5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/util-src/0.3.2-SNAPSHOT/util-src-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/util-src/0.3.2/util-src-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.jar" sourcepath="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/waveinabox-server-0.3/0.3.2-SNAPSHOT/waveinabox-server-0.3-0.3.2-SNAPSHOT.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/waveinabox-server-0.3/0.3.2/waveinabox-server-0.3-0.3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1.jar" sourcepath="M2_REPO/xalan/xalan/2.7.1/xalan-2.7.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.9.1/xercesImpl-2.9.1.jar"/>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/xpp3/xpp3_min/1.1.3.4.O/xpp3_min-1.1.3.4.O.jar"/>
<classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2.jar" sourcepath="M2_REPO/com/thoughtworks/xstream/xstream/1.2.2/xstream-1.2.2-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/xwiki/platform/xwiki-web-gwt-dom/2.3-rc-1/xwiki-web-gwt-dom-2.3-rc-1.jar" sourcepath="M2_REPO/org/xwiki/platform/xwiki-web-gwt-dom/2.3-rc-1/xwiki-web-gwt-dom-2.3-rc-1-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-
<classpathentry kind="src" path=".apt_generated" including="**/*.java"/> <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
-</classpath>
+</classpath>
\ No newline at end of file
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/pom.xml 2011-09-26 12:45:04 UTC (rev 1533)
@@ -115,30 +115,6 @@
<url>http://kune.ourproject.org/mavenrepo/</url>
</repository>
<repository>
- <id>xwiki-releases</id>
- <name>XWiki Maven2 Remote Repository for Releases</name>
- <url>http://maven.xwiki.org/releases</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>xwiki</id>
- <name>XWiki Repository</name>
- <url>http://maven.xwiki.org/snapshots</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>daily</updatePolicy>
- <checksumPolicy>warn</checksumPolicy>
- </snapshots>
- </repository>
- <repository>
<id>tigase</id>
<name>Tigase Repository</name>
<url>http://maven.tigase.org</url>
@@ -271,16 +247,6 @@
<artifactId>gxt-uibinder</artifactId> <version>0.6</version> </dependency> -->
<!-- cc -->
<dependency>
- <groupId>com.gwtext</groupId>
- <artifactId>gwtext</artifactId>
- <version>2.0.5</version>
- </dependency>
- <dependency>
- <groupId>com.gwtextux</groupId>
- <artifactId>gwtextux</artifactId>
- <version>0.4.0.924</version>
- </dependency>
- <dependency>
<groupId>com.allen_sauer.gwt.log.gwt-log</groupId>
<artifactId>gwt-log</artifactId>
<version>3.0.1</version>
@@ -308,14 +274,6 @@
<artifactId>jmagick</artifactId>
<version>6.2.6-0</version>
</dependency>
- <dependency>
- <groupId>org.xwiki.platform</groupId>
- <artifactId>xwiki-web-gwt-dom</artifactId>
- <version>2.3-rc-1</version>
- <!-- <version>2.0-SNAPSHOT-g164</version> -->
- <!-- <version>2.0-SNAPSHOT</version> -->
- <!-- <version>2.0-SNAPSHOT-g20s</version> -->
- </dependency>
<!-- xmpp -->
<dependency>
<groupId>com.calclab.emite</groupId>
Modified: trunk/script/mvn-eclipse.sh
===================================================================
--- trunk/script/mvn-eclipse.sh 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/script/mvn-eclipse.sh 2011-09-26 12:45:04 UTC (rev 1533)
@@ -1,3 +1,4 @@
+#mvn eclipse:eclipse -Dgwt.compiler.skip=true -o
mvn eclipse:eclipse -Dgwt.compiler.skip=true
RESULT=$?
perl -p -i -e 's/<\/classpath>//g' .classpath
Modified: trunk/src/main/java/cc/kune/chat/client/KuneUnattendedPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/KuneUnattendedPresenter.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/chat/client/KuneUnattendedPresenter.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -20,7 +20,7 @@
package cc.kune.chat.client;
import cc.kune.chat.client.ChatClientDefault.ChatClientAction;
-import cc.kune.chat.client.snd.SndClickEvent;
+import cc.kune.core.client.events.SndClickEvent;
import com.calclab.hablar.core.client.mvp.HablarEventBus;
import com.calclab.hablar.signals.client.SignalPreferences;
Modified: trunk/src/main/java/cc/kune/chat/client/snd/KuneSoundManager.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/snd/KuneSoundManager.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/chat/client/snd/KuneSoundManager.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -19,6 +19,8 @@
*/
package cc.kune.chat.client.snd;
+import cc.kune.core.client.events.SndClickEvent;
+
import com.calclab.hablar.signals.sound.client.SoundManager;
import com.calclab.hablar.signals.sound.client.SoundSignalsConfig;
import com.google.gwt.event.shared.EventBus;
Deleted: trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -1,74 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
- * This file is part of kune.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-package cc.kune.chat.client.snd;
-
-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 SndClickEvent extends GwtEvent<SndClickEvent.SndClickHandler> {
-
- public interface HasSndClickHandlers extends HasHandlers {
- HandlerRegistration addSndClickHandler(SndClickHandler handler);
- }
-
- public interface SndClickHandler extends EventHandler {
- public void onClick(SndClickEvent event);
- }
-
- private static final Type<SndClickHandler> TYPE = new Type<SndClickHandler>();
-
- public static void fire(final HasHandlers source) {
- source.fireEvent(new SndClickEvent());
- }
-
- public static Type<SndClickHandler> getType() {
- return TYPE;
- }
-
- public SndClickEvent() {
- }
-
- @Override
- protected void dispatch(final SndClickHandler handler) {
- handler.onClick(this);
- }
-
- @Override
- public boolean equals(final Object obj) {
- return super.equals(obj);
- }
-
- @Override
- public Type<SndClickHandler> getAssociatedType() {
- return TYPE;
- }
-
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- @Override
- public String toString() {
- return "SndClickEvent[" + "]";
- }
-}
Modified: trunk/src/main/java/cc/kune/client/KuneGinjector.java
===================================================================
--- trunk/src/main/java/cc/kune/client/KuneGinjector.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/client/KuneGinjector.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -49,13 +49,14 @@
import cc.kune.core.client.state.SiteTokenListeners;
import cc.kune.core.client.state.StateManager;
import cc.kune.core.client.state.TokenMatcher;
+import cc.kune.core.client.sub.SubtitlesManager;
import cc.kune.core.client.ws.CorePresenter;
import cc.kune.core.client.ws.entheader.EntityHeaderPresenter;
import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.docs.client.DocsGinModule;
import cc.kune.docs.client.DocsGinjector;
+import cc.kune.events.client.EventsGinModule;
import cc.kune.events.client.EventsGinjector;
-import cc.kune.events.client.EventsGinModule;
import cc.kune.gspace.client.GSpaceGinModule;
import cc.kune.gspace.client.GSpaceGinjector;
import cc.kune.lists.client.ListsGinModule;
@@ -143,6 +144,8 @@
StateManager getStateManager();
+ AsyncProvider<SubtitlesManager> getSubtitlesPresenter();
+
TokenMatcher getTokenMatcher();
AsyncProvider<UserConfirmPresenter> getUserConfirmPresenter();
@@ -152,4 +155,5 @@
WaveParts getWaveParts();
XMLActionsParser getXmlActionsParser();
+
}
Added: trunk/src/main/java/cc/kune/common/client/utils/Base64Utils.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/utils/Base64Utils.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/utils/Base64Utils.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2009 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package cc.kune.common.client.utils;
+
+/**
+ * A utility to decode and encode byte arrays as Strings, using only "safe"
+ * characters.
+ */
+public class Base64Utils {
+
+ /**
+ * An array mapping size but values to the characters that will be used to
+ * represent them. Note that this is not identical to the set of characters
+ * used by MIME-Base64.
+ */
+ private static final char[] base64Chars = new char[] {
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
+ 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b',
+ 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
+ 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
+ '4', '5', '6', '7', '8', '9', '$', '_'};
+
+ /**
+ * An array mapping legal base 64 characters [a-zA-Z0-9$_] to their associated
+ * 6-bit values. The source indices will be given by 7-bit ASCII characters,
+ * thus the array size needs to be 128 (actually 123 would suffice for the
+ * given set of characters in use).
+ */
+ private static final byte[] base64Values = new byte[128];
+
+ /**
+ * Initialize the base 64 encoder values.
+ */
+ static {
+ // Invert the mapping (i -> base64Chars[i])
+ for (int i = 0; i < base64Chars.length; i++) {
+ base64Values[base64Chars[i]] = (byte) i;
+ }
+ }
+
+ /**
+ * Decode a base64 string into a byte array.
+ *
+ * @param data the encoded data.
+ * @return a byte array.
+ * @see #fromBase64(String)
+ */
+ public static byte[] fromBase64(String data) {
+ if (data == null) {
+ return null;
+ }
+
+ int len = data.length();
+ assert (len % 4) == 0;
+
+ if (len == 0) {
+ return new byte[0];
+ }
+
+ char[] chars = new char[len];
+ data.getChars(0, len, chars, 0);
+
+ int olen = 3 * (len / 4);
+ if (chars[len - 2] == '=') {
+ --olen;
+ }
+ if (chars[len - 1] == '=') {
+ --olen;
+ }
+
+ byte[] bytes = new byte[olen];
+
+ int iidx = 0;
+ int oidx = 0;
+ while (iidx < len) {
+ int c0 = base64Values[chars[iidx++] & 0xff];
+ int c1 = base64Values[chars[iidx++] & 0xff];
+ int c2 = base64Values[chars[iidx++] & 0xff];
+ int c3 = base64Values[chars[iidx++] & 0xff];
+ int c24 = (c0 << 18) | (c1 << 12) | (c2 << 6) | c3;
+
+ bytes[oidx++] = (byte) (c24 >> 16);
+ if (oidx == olen) {
+ break;
+ }
+ bytes[oidx++] = (byte) (c24 >> 8);
+ if (oidx == olen) {
+ break;
+ }
+ bytes[oidx++] = (byte) c24;
+ }
+
+ return bytes;
+ }
+
+ /**
+ * Decode a base64 string into a long value.
+ */
+ public static long longFromBase64(String value) {
+ int pos = 0;
+ long longVal = base64Values[value.charAt(pos++)];
+ int len = value.length();
+ while (pos < len) {
+ longVal <<= 6;
+ longVal |= base64Values[value.charAt(pos++)];
+ }
+ return longVal;
+ }
+
+ /**
+ * Converts a byte array into a base 64 encoded string. Null is encoded as
+ * null, and an empty array is encoded as an empty string. Otherwise, the byte
+ * data is read 3 bytes at a time, with bytes off the end of the array padded
+ * with zeros. Each 24-bit chunk is encoded as 4 characters from the sequence
+ * [A-Za-z0-9$_]. If one of the source positions consists entirely of padding
+ * zeros, an '=' character is used instead.
+ *
+ * @param data a byte array, which may be null or empty
+ * @return a String
+ */
+ public static String toBase64(byte[] data) {
+ if (data == null) {
+ return null;
+ }
+
+ int len = data.length;
+ if (len == 0) {
+ return "";
+ }
+
+ int olen = 4 * ((len + 2) / 3);
+ char[] chars = new char[olen];
+
+ int iidx = 0;
+ int oidx = 0;
+ int charsLeft = len;
+ while (charsLeft > 0) {
+ int b0 = data[iidx++] & 0xff;
+ int b1 = (charsLeft > 1) ? data[iidx++] & 0xff : 0;
+ int b2 = (charsLeft > 2) ? data[iidx++] & 0xff : 0;
+ int b24 = (b0 << 16) | (b1 << 8) | b2;
+
+ int c0 = (b24 >> 18) & 0x3f;
+ int c1 = (b24 >> 12) & 0x3f;
+ int c2 = (b24 >> 6) & 0x3f;
+ int c3 = b24 & 0x3f;
+
+ chars[oidx++] = base64Chars[c0];
+ chars[oidx++] = base64Chars[c1];
+ chars[oidx++] = (charsLeft > 1) ? base64Chars[c2] : '=';
+ chars[oidx++] = (charsLeft > 2) ? base64Chars[c3] : '=';
+
+ charsLeft -= 3;
+ }
+
+ return new String(chars);
+ }
+
+ /**
+ * Return a string containing a base-64 encoded version of the given long
+ * value. Leading groups of all zero bits are omitted.
+ */
+ public static String toBase64(long value) {
+ // Convert to ints early to avoid need for long ops
+ int low = (int) (value & 0xffffffff);
+ int high = (int) (value >> 32);
+
+ StringBuilder sb = new StringBuilder();
+ boolean haveNonZero = base64Append(sb, (high >> 28) & 0xf, false);
+ haveNonZero = base64Append(sb, (high >> 22) & 0x3f, haveNonZero);
+ haveNonZero = base64Append(sb, (high >> 16) & 0x3f, haveNonZero);
+ haveNonZero = base64Append(sb, (high >> 10) & 0x3f, haveNonZero);
+ haveNonZero = base64Append(sb, (high >> 4) & 0x3f, haveNonZero);
+ int v = ((high & 0xf) << 2) | ((low >> 30) & 0x3);
+ haveNonZero = base64Append(sb, v, haveNonZero);
+ haveNonZero = base64Append(sb, (low >> 24) & 0x3f, haveNonZero);
+ haveNonZero = base64Append(sb, (low >> 18) & 0x3f, haveNonZero);
+ haveNonZero = base64Append(sb, (low >> 12) & 0x3f, haveNonZero);
+ base64Append(sb, (low >> 6) & 0x3f, haveNonZero);
+ base64Append(sb, low & 0x3f, true);
+
+ return sb.toString();
+ }
+
+ private static boolean base64Append(StringBuilder sb, int digit,
+ boolean haveNonZero) {
+ if (digit > 0) {
+ haveNonZero = true;
+ }
+ if (haveNonZero) {
+ sb.append(base64Chars[digit]);
+ }
+ return haveNonZero;
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/CoreGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/core/client/CoreGinModule.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -102,6 +102,8 @@
import cc.kune.core.client.state.StateManager;
import cc.kune.core.client.state.StateManagerDefault;
import cc.kune.core.client.state.TokenMatcher;
+import cc.kune.core.client.sub.SubtitlesManager;
+import cc.kune.core.client.sub.SubtitlesWidget;
import cc.kune.core.client.ws.CorePresenter;
import cc.kune.core.client.ws.CoreViewImpl;
import cc.kune.core.client.ws.entheader.EntityHeader;
@@ -175,6 +177,8 @@
RegisterPresenter.RegisterProxy.class);
bindPresenter(UserConfirmPresenter.class, UserConfirmPresenter.UserConfirmView.class,
UserConfirmPanel.class, UserConfirmPresenter.UserConfirmProxy.class);
+ bindPresenter(SubtitlesManager.class, SubtitlesManager.SubtitlesView.class,
+ SubtitlesWidget.class, SubtitlesManager.SubtitlesProxy.class);
bind(UserPassAutocompleteManager.class).to(UserPassAutocompleteManagerImpl.class).in(Singleton.class);
bind(SignIn.class).to(SignInPresenter.class).in(Singleton.class);
Copied: trunk/src/main/java/cc/kune/core/client/events/SndClickEvent.java (from rev 1531, trunk/src/main/java/cc/kune/chat/client/snd/SndClickEvent.java)
===================================================================
--- trunk/src/main/java/cc/kune/core/client/events/SndClickEvent.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/events/SndClickEvent.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -0,0 +1,74 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.client.events;
+
+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 SndClickEvent extends GwtEvent<SndClickEvent.SndClickHandler> {
+
+ public interface HasSndClickHandlers extends HasHandlers {
+ HandlerRegistration addSndClickHandler(SndClickHandler handler);
+ }
+
+ public interface SndClickHandler extends EventHandler {
+ public void onClick(SndClickEvent event);
+ }
+
+ private static final Type<SndClickHandler> TYPE = new Type<SndClickHandler>();
+
+ public static void fire(final HasHandlers source) {
+ source.fireEvent(new SndClickEvent());
+ }
+
+ public static Type<SndClickHandler> getType() {
+ return TYPE;
+ }
+
+ public SndClickEvent() {
+ }
+
+ @Override
+ protected void dispatch(final SndClickHandler handler) {
+ handler.onClick(this);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ public Type<SndClickHandler> getAssociatedType() {
+ return TYPE;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "SndClickEvent[" + "]";
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -86,7 +86,7 @@
this.groupOptions = groupOptions;
stateManager.addSiteToken(SiteTokens.NEWGROUP, new HistoryTokenCallback() {
@Override
- public void onHistoryToken() {
+ public void onHistoryToken(final String token) {
doNewGroup();
}
});
Modified: trunk/src/main/java/cc/kune/core/client/state/HistoryTokenCallback.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/HistoryTokenCallback.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/core/client/state/HistoryTokenCallback.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -21,6 +21,6 @@
public interface HistoryTokenCallback {
- void onHistoryToken();
+ void onHistoryToken(String token);
}
Modified: trunk/src/main/java/cc/kune/core/client/state/SiteTokenListeners.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SiteTokenListeners.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/core/client/state/SiteTokenListeners.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -27,6 +27,7 @@
import cc.kune.core.client.sitebar.AboutKuneDialog;
import cc.kune.core.client.sitebar.spaces.Space;
import cc.kune.core.client.sitebar.spaces.SpaceSelectEvent;
+import cc.kune.core.client.sub.SubtitlesManager;
import cc.kune.gspace.client.i18n.I18nTranslator;
import com.google.gwt.event.shared.EventBus;
@@ -40,56 +41,58 @@
private final Provider<NewGroup> newGroup;
private final Provider<Register> register;
private final Provider<SignIn> signIn;
+ private final Provider<SubtitlesManager> subProvider;
private final Provider<I18nTranslator> translator;
@Inject
public SiteTokenListeners(final Session session, final EventBus eventBus,
final Provider<SignIn> signIn, final Provider<Register> register,
final Provider<NewGroup> newGroup, final Provider<AboutKuneDialog> aboutKuneDialog,
- final Provider<I18nTranslator> translator) {
+ final Provider<I18nTranslator> translator, final Provider<SubtitlesManager> subProvider) {
this.eventBus = eventBus;
this.signIn = signIn;
this.register = register;
this.newGroup = newGroup;
this.aboutKuneDialog = aboutKuneDialog;
this.translator = translator;
+ this.subProvider = subProvider;
putValues();
}
private void putValues() {
put(SiteTokens.HOME, new HistoryTokenCallback() {
@Override
- public void onHistoryToken() {
+ public void onHistoryToken(final String token) {
SpaceSelectEvent.fire(eventBus, Space.homeSpace);
}
});
put(SiteTokens.WAVEINBOX, new HistoryTokenCallback() {
@Override
- public void onHistoryToken() {
+ public void onHistoryToken(final String token) {
SpaceSelectEvent.fire(eventBus, Space.userSpace);
}
});
put(SiteTokens.SIGNIN, new HistoryTokenCallback() {
@Override
- public void onHistoryToken() {
+ public void onHistoryToken(final String token) {
signIn.get().showSignInDialog();
}
});
put(SiteTokens.REGISTER, new HistoryTokenCallback() {
@Override
- public void onHistoryToken() {
+ public void onHistoryToken(final String token) {
register.get().doRegister();
}
});
put(SiteTokens.NEWGROUP, new HistoryTokenCallback() {
@Override
- public void onHistoryToken() {
+ public void onHistoryToken(final String token) {
newGroup.get().doNewGroup();
}
});
put(SiteTokens.ABOUTKUNE, new HistoryTokenCallback() {
@Override
- public void onHistoryToken() {
+ public void onHistoryToken(final String token) {
// FIXME, something to come back
aboutKuneDialog.get().showCentered();
}
@@ -97,9 +100,15 @@
put(SiteTokens.TRANSLATE, new HistoryTokenCallback() {
// FIXME, something to come back
@Override
- public void onHistoryToken() {
+ public void onHistoryToken(final String token) {
translator.get().show();
}
});
+ put(SiteTokens.SUBTITLES, new HistoryTokenCallback() {
+ @Override
+ public void onHistoryToken(final String token) {
+ subProvider.get().show(token);
+ }
+ });
}
}
Modified: trunk/src/main/java/cc/kune/core/client/state/SiteTokens.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SiteTokens.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/core/client/state/SiteTokens.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -28,26 +28,28 @@
*
*/
public final class SiteTokens {
- public static final String ABOUTKUNE = "about";
- public final static String GROUP_HOME = "";
- public final static String HOME = "home";
- public final static String NEWGROUP = "newgroup";
- public static final String PREVIEW = "preview";
- public final static String REGISTER = "register";
- public final static String SIGNIN = "signin";
- public final static String TRANSLATE = "translate";
- public final static String WAVEINBOX = "inbox";
+ public static final String ABOUTKUNE = "about";
+ public final static String GROUP_HOME = "";
+ public final static String HOME = "home";
+ public final static String NEWGROUP = "newgroup";
+ public static final String PREVIEW = "preview";
+ public final static String REGISTER = "register";
+ public final static String SIGNIN = "signin";
+ public final static String SUBTITLES = "sub";
+ public final static String TRANSLATE = "translate";
+ public final static String WAVEINBOX = "inbox";
- @Inject
- public SiteTokens(final ReservedWordsRegistryDTO reserverdWords) {
- reserverdWords.add(ABOUTKUNE);
- reserverdWords.add(GROUP_HOME);
- reserverdWords.add(HOME);
- reserverdWords.add(NEWGROUP);
- reserverdWords.add(PREVIEW);
- reserverdWords.add(REGISTER);
- reserverdWords.add(SIGNIN);
- reserverdWords.add(TRANSLATE);
- reserverdWords.add(WAVEINBOX);
- }
+ @Inject
+ public SiteTokens(final ReservedWordsRegistryDTO reserverdWords) {
+ reserverdWords.add(ABOUTKUNE);
+ reserverdWords.add(GROUP_HOME);
+ reserverdWords.add(HOME);
+ reserverdWords.add(NEWGROUP);
+ reserverdWords.add(PREVIEW);
+ reserverdWords.add(REGISTER);
+ reserverdWords.add(SIGNIN);
+ reserverdWords.add(TRANSLATE);
+ reserverdWords.add(WAVEINBOX);
+ reserverdWords.add(SUBTITLES);
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -266,8 +266,11 @@
SpaceConfEvent.fire(eventBus, Space.groupSpace, sndToken);
SpaceConfEvent.fire(eventBus, Space.publicSpace, TokenUtils.preview(sndToken));
onHistoryChanged(new StateToken(sndToken));
+ } else if (firstToken.equals(SiteTokens.SUBTITLES)) {
+ siteTokens.get(SiteTokens.SUBTITLES).onHistoryToken(
+ tokenMatcher.getRedirect(newHistoryToken).getRight());
} else if (firstToken.equals(SiteTokens.NEWGROUP)) {
- siteTokens.get(SiteTokens.NEWGROUP).onHistoryToken();
+ siteTokens.get(SiteTokens.NEWGROUP).onHistoryToken(newHistoryToken);
} else if (firstToken.equals(SiteTokens.SIGNIN)) {
if (session.isLogged()) {
// We are logged, then redirect:
@@ -275,7 +278,7 @@
processHistoryToken(sndToken);
} else {
// We have to loggin
- siteTokens.get(SiteTokens.SIGNIN).onHistoryToken();
+ siteTokens.get(SiteTokens.SIGNIN).onHistoryToken(newHistoryToken);
}
}
} else if (tokenMatcher.isWaveToken(newHistoryToken)) {
@@ -312,7 +315,7 @@
// SpaceSelectEvent.fire(eventBus, Space.groupSpace);
}
// Fire the listener of this #hash token
- tokenListener.onHistoryToken();
+ tokenListener.onHistoryToken(newHistoryToken);
}
} else {
resumedHistoryToken = newHistoryToken;
Added: trunk/src/main/java/cc/kune/core/client/sub/SubtitlesManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sub/SubtitlesManager.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sub/SubtitlesManager.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -0,0 +1,51 @@
+package cc.kune.core.client.sub;
+
+import cc.kune.common.client.utils.Base64Utils;
+import cc.kune.core.client.state.StateManager;
+
+import com.google.gwt.event.shared.EventBus;
+import com.google.inject.Inject;
+import com.gwtplatform.mvp.client.Presenter;
+import com.gwtplatform.mvp.client.View;
+import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
+import com.gwtplatform.mvp.client.proxy.Proxy;
+import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
+
+public class SubtitlesManager extends
+ Presenter<SubtitlesManager.SubtitlesView, SubtitlesManager.SubtitlesProxy> {
+
+ @ProxyCodeSplit
+ public interface SubtitlesProxy extends Proxy<SubtitlesManager> {
+ }
+
+ public interface SubtitlesView extends View {
+
+ void setDescription(String descr);
+
+ void setTitleText(String text);
+
+ void show();
+
+ }
+ private final StateManager stateManager;
+
+ @Inject
+ public SubtitlesManager(final EventBus eventBus, final SubtitlesView view, final SubtitlesProxy proxy,
+ final StateManager stateManager) {
+ super(eventBus, view, proxy);
+ this.stateManager = stateManager;
+ }
+
+ @Override
+ protected void revealInParent() {
+ RevealRootContentEvent.fire(this, this);
+ }
+
+ public void show(final String token) {
+ final String[] params = token.split("\\|");
+ getView().setTitleText(new String(Base64Utils.fromBase64(params[0])));
+ getView().setDescription(new String(Base64Utils.fromBase64(params[1])));
+ getView().show();
+ stateManager.gotoHistoryToken(params[2]);
+ }
+}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/core/client/sub/SubtitlesWidget.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sub/SubtitlesWidget.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sub/SubtitlesWidget.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -0,0 +1,108 @@
+package cc.kune.core.client.sub;
+
+import org.adamtacy.client.ui.effects.events.EffectCompletedEvent;
+import org.adamtacy.client.ui.effects.events.EffectCompletedHandler;
+import org.adamtacy.client.ui.effects.examples.Show;
+import org.adamtacy.client.ui.effects.examples.SlideRight;
+
+import cc.kune.core.client.sub.SubtitlesManager.SubtitlesView;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.logical.shared.ResizeEvent;
+import com.google.gwt.event.logical.shared.ResizeHandler;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.InlineLabel;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.gwtplatform.mvp.client.ViewImpl;
+
+public class SubtitlesWidget extends ViewImpl implements SubtitlesView {
+
+ interface SubtitlesWidgetUiBinder extends UiBinder<Widget, SubtitlesWidget> {
+ }
+
+ public static final String SUBTITLE_MANAGER_ID = "k-subt-widget";
+
+ private static SubtitlesWidgetUiBinder uiBinder = GWT.create(SubtitlesWidgetUiBinder.class);
+
+ @UiField
+ InlineLabel description;
+ private final PopupPanel popup;
+ private boolean showing;
+ @UiField
+ InlineLabel title;
+ private final Widget widget;
+
+ public SubtitlesWidget() {
+ popup = new PopupPanel(false, false);
+ popup.ensureDebugId(SUBTITLE_MANAGER_ID);
+ widget = uiBinder.createAndBindUi(this);
+ popup.addDomHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ if (showing) {
+ final SlideRight slideAtEnd = new SlideRight(popup.getElement());
+ slideAtEnd.invert();
+ slideAtEnd.setDuration(2);
+ slideAtEnd.play();
+ // final Fade fadeAtEnd = new Fade(popup.getElement());
+ // fadeAtEnd.setDuration(2);
+ // fadeAtEnd.play();
+ slideAtEnd.addEffectCompletedHandler(new EffectCompletedHandler() {
+ @Override
+ public void onEffectCompleted(final EffectCompletedEvent event) {
+ popup.hide();
+ }
+ });
+ showing = false;
+ }
+ }
+ }, ClickEvent.getType());
+ Window.addResizeHandler(new ResizeHandler() {
+ @Override
+ public void onResize(final ResizeEvent event) {
+ setSize(event.getWidth(), event.getHeight());
+ }
+ });
+ }
+
+ @Override
+ public Widget asWidget() {
+ return popup;
+ }
+
+ @Override
+ public void setDescription(final String descr) {
+ description.setText(descr);
+ }
+
+ private void setSize(final int width, final int height) {
+ popup.setSize(width + "px", height + "px");
+ }
+
+ @Override
+ public void setTitleText(final String text) {
+ title.setText(text);
+ }
+
+ @Override
+ public void show() {
+ popup.setWidget(widget);
+ setSize(Window.getClientWidth(), Window.getClientHeight());
+ popup.show();
+ final Show showAtIni = new Show(popup.getElement());
+ showAtIni.setDuration(3);
+ showAtIni.play();
+ final SlideRight slideAtIni = new SlideRight(popup.getElement());
+ slideAtIni.setDuration(3);
+ slideAtIni.play();
+ popup.sinkEvents(Event.MOUSEEVENTS);
+ this.showing = true;
+ }
+
+}
Added: trunk/src/main/java/cc/kune/core/client/sub/SubtitlesWidget.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sub/SubtitlesWidget.ui.xml (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sub/SubtitlesWidget.ui.xml 2011-09-26 12:45:04 UTC (rev 1533)
@@ -0,0 +1,80 @@
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
+ xmlns:g="urn:import:com.google.gwt.user.client.ui">
+ <ui:style>
+ .mask {
+
+ }
+
+ .k-subtitles-title {
+ font-size: 48px;
+ color: #FFF; /* #C87137; */
+ font-weight: bold;
+ float: left;
+ padding-left: 40px;
+ }
+
+ .k-subtitles-panel {
+ background: none repeat scroll 0 0 #69312F;
+ border-radius: 0px 5px 50px 0px;
+ display: table;
+ position: relative;
+ overflow: hidden;
+ }
+
+ .k-sutitles-child-panel {
+ top: 50%;
+ display: table-cell;
+ vertical-align: middle;
+ }
+
+ .k-sutitles-center-panel {
+ position: relative;
+ top: -50%;
+ }
+
+ .k-subtitles-description {
+ clear: both;
+ float: left;
+ font-size: 36px;
+ color: white;
+ padding-left: 40px;
+ }
+
+ /* http://stackoverflow.com/questions/637921/opacity-of-background-but-not-the-text */
+ .k-subtitles-mask {
+ background-color: rgb(255, 255, 255);
+ -moz-opacity: 0.78 !important;
+ -khtml-opacity: 0.78 !important;
+ opacity: 0.78 !important;
+ }
+ </ui:style>
+
+
+ <g:LayoutPanel width="100%" height="100%" ui:field="mainPanel">
+ <g:layer left="0px" width="100.0pct" top="0px" height="100.0pct">
+ <g:SimplePanel styleName="{style.mask}" ui:field="frame"
+ width="100%" height="100%"/>
+ </g:layer>
+ <g:layer left="0px" width="100.0pct" top="0px" height="100.0pct">
+ <g:HTMLPanel ui:field="mask" styleName="{style.k-subtitles-mask}"
+ width="100%" height="100%"/>
+ </g:layer>
+ <g:layer left="0" width="90%" height="120px" bottom="80px">
+ <g:FlowPanel width="100%" height="120px" ui:field="messagePanel"
+ addStyleNames="{style.k-subtitles-panel}">
+ <g:FlowPanel styleName="{style.k-sutitles-child-panel}">
+ <g:FlowPanel styleName="{style.k-sutitles-center-panel}">
+ <g:SimplePanel addStyleNames="k-subtitles-icon">
+ <g:Image ui:field="icon"/>
+ </g:SimplePanel>
+ <g:InlineLabel ui:field="title"
+ addStyleNames="{style.k-subtitles-title}"/>
+ <g:InlineLabel ui:field="description"
+ addStyleNames="{style.k-subtitles-description}"/>
+ </g:FlowPanel>
+ </g:FlowPanel>
+ </g:FlowPanel>
+ </g:layer>
+ </g:LayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPresenter.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/java/cc/kune/wave/client/inboxcount/InboxCountPresenter.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -7,8 +7,8 @@
import org.waveprotocol.box.webclient.search.Search;
import org.waveprotocol.box.webclient.search.Search.Listener;
-import cc.kune.chat.client.snd.SndClickEvent;
import cc.kune.core.client.events.NewUserRegisteredEvent;
+import cc.kune.core.client.events.SndClickEvent;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.UserSignInOrSignOutEvent;
import cc.kune.core.client.state.UserSignInOrSignOutEvent.UserSignInOrSignOutHandler;
Modified: trunk/src/main/resources/kune.properties
===================================================================
--- trunk/src/main/resources/kune.properties 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/main/resources/kune.properties 2011-09-26 12:45:04 UTC (rev 1533)
@@ -36,8 +36,8 @@
### Other params
-# Reserved words to avoid it's use in the client side for user and group names
-kune.server.names.reservedwords = root,adm,kune,fuck
+# Reserved words to avoid it's use in the client side for user and group names (see client tokens used in SiteTokens)
+kune.server.names.reservedwords = root,adm,kune,fuck,about,home,newgroup,preview,register,signin,translate,inbox,sub
# If defined create a copy of this wave as welcome to new users
# kune.site.welcomewave = w+rtackLTkDCA
Modified: trunk/src/test/java/cc/kune/core/client/state/StateManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/client/state/StateManagerDefaultTest.java 2011-09-24 18:53:50 UTC (rev 1532)
+++ trunk/src/test/java/cc/kune/core/client/state/StateManagerDefaultTest.java 2011-09-26 12:45:04 UTC (rev 1533)
@@ -43,248 +43,277 @@
public class StateManagerDefaultTest {
- private static final String HASH = "someUserHash";
- private BeforeActionListener beforeChangeListener1;
- private BeforeActionListener beforeChangeListener2;
- private ContentCache contentProvider;
- private EventBusTester eventBus;
- private GroupChangedHandler groupChangeHandler;
- private HistoryWrapper history;
- private Session session;
- private SiteTokenListeners siteTokens;
- private StateAbstractDTO state;
- private StateChangedHandler stateChangeHandler;
- private StateManagerDefault stateManager;
- private TokenMatcher tokenMatcher;
- private ToolChangedHandler toolChangeHandler;
+ private static final String HASH = "someUserHash";
+ private BeforeActionListener beforeChangeListener1;
+ private BeforeActionListener beforeChangeListener2;
+ private ContentCache contentProvider;
+ private EventBusTester eventBus;
+ private GroupChangedHandler groupChangeHandler;
+ private HistoryWrapper history;
+ private Session session;
+ private SiteTokenListeners siteTokens;
+ private StateAbstractDTO state;
+ private StateChangedHandler stateChangeHandler;
+ private StateManagerDefault stateManager;
+ private TokenMatcher tokenMatcher;
+ private ToolChangedHandler toolChangeHandler;
- @Before
- public void before() {
- contentProvider = Mockito.mock(ContentCache.class);
- session = Mockito.mock(Session.class);
- history = Mockito.mock(HistoryWrapper.class);
- tokenMatcher = Mockito.mock(TokenMatcher.class);
- siteTokens = Mockito.mock(SiteTokenListeners.class);
- eventBus = new EventBusTester();
- Mockito.when(session.getUserHash()).thenReturn(HASH);
- Mockito.doAnswer(new Answer<Object>() {
- @Override
- public Object answer(final InvocationOnMock invocation) throws Throwable {
- eventBus.addHandler(UserSignInEvent.getType(), (UserSignInHandler) invocation.getArguments()[1]);
- return null;
- }
- }).when(session).onUserSignIn(anyBoolean(), (UserSignInHandler) Mockito.anyObject());
- Mockito.doAnswer(new Answer<Object>() {
- @Override
- public Object answer(final InvocationOnMock invocation) throws Throwable {
- eventBus.addHandler(UserSignOutEvent.getType(), (UserSignOutHandler) invocation.getArguments()[1]);
- return null;
- }
- }).when(session).onUserSignOut(anyBoolean(), (UserSignOutHandler) Mockito.anyObject());
- Mockito.doAnswer(new Answer<Object>() {
- @Override
- public Object answer(final InvocationOnMock invocation) throws Throwable {
- eventBus.addHandler(AppStartEvent.getType(), (AppStartHandler) invocation.getArguments()[1]);
- return null;
- }
- }).when(session).onAppStart(anyBoolean(), (AppStartHandler) Mockito.anyObject());
- state = Mockito.mock(StateAbstractDTO.class);
- stateManager = new StateManagerDefault(contentProvider, session, history, tokenMatcher, eventBus, siteTokens);
- stateChangeHandler = Mockito.mock(StateChangedHandler.class);
- groupChangeHandler = Mockito.mock(GroupChangedHandler.class);
- toolChangeHandler = Mockito.mock(ToolChangedHandler.class);
- beforeChangeListener1 = Mockito.mock(BeforeActionListener.class);
- beforeChangeListener2 = Mockito.mock(BeforeActionListener.class);
- eventBus.addHandler(StateChangedEvent.getType(), stateChangeHandler);
- eventBus.addHandler(GroupChangedEvent.getType(), groupChangeHandler);
- eventBus.addHandler(ToolChangedEvent.getType(), toolChangeHandler);
- // new NotifyUser(null, null);
- }
+ @Before
+ public void before() {
+ contentProvider = Mockito.mock(ContentCache.class);
+ session = Mockito.mock(Session.class);
+ history = Mockito.mock(HistoryWrapper.class);
+ tokenMatcher = Mockito.mock(TokenMatcher.class);
+ siteTokens = Mockito.mock(SiteTokenListeners.class);
+ eventBus = new EventBusTester();
+ Mockito.when(session.getUserHash()).thenReturn(HASH);
+ Mockito.doAnswer(new Answer<Object>() {
+ @Override
+ public Object answer(final InvocationOnMock invocation) throws Throwable {
+ eventBus.addHandler(UserSignInEvent.getType(), (UserSignInHandler) invocation.getArguments()[1]);
+ return null;
+ }
+ }).when(session).onUserSignIn(anyBoolean(), (UserSignInHandler) Mockito.anyObject());
+ Mockito.doAnswer(new Answer<Object>() {
+ @Override
+ public Object answer(final InvocationOnMock invocation) throws Throwable {
+ eventBus.addHandler(UserSignOutEvent.getType(),
+ (UserSignOutHandler) invocation.getArguments()[1]);
+ return null;
+ }
+ }).when(session).onUserSignOut(anyBoolean(), (UserSignOutHandler) Mockito.anyObject());
+ Mockito.doAnswer(new Answer<Object>() {
+ @Override
+ public Object answer(final InvocationOnMock invocation) throws Throwable {
+ eventBus.addHandler(AppStartEvent.getType(), (AppStartHandler) invocation.getArguments()[1]);
+ return null;
+ }
+ }).when(session).onAppStart(anyBoolean(), (AppStartHandler) Mockito.anyObject());
+ state = Mockito.mock(StateAbstractDTO.class);
+ stateManager = new StateManagerDefault(contentProvider, session, history, tokenMatcher, eventBus,
+ siteTokens);
+ stateChangeHandler = Mockito.mock(StateChangedHandler.class);
+ groupChangeHandler = Mockito.mock(GroupChangedHandler.class);
+ toolChangeHandler = Mockito.mock(ToolChangedHandler.class);
+ beforeChangeListener1 = Mockito.mock(BeforeActionListener.class);
+ beforeChangeListener2 = Mockito.mock(BeforeActionListener.class);
+ eventBus.addHandler(StateChangedEvent.getType(), stateChangeHandler);
+ eventBus.addHandler(GroupChangedEvent.getType(), groupChangeHandler);
+ eventBus.addHandler(ToolChangedEvent.getType(), toolChangeHandler);
+ // new NotifyUser(null, null);
+ }
- @Test
- public void changeGroupWithNoTool() {
- changeState("group1", "group2");
- Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged((StateChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(2)).onGroupChanged((GroupChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(2)).onGroupChanged((GroupChangedEvent) Mockito.anyObject());
- }
+ @Test
+ public void changeGroupWithNoTool() {
+ changeState("group1", "group2");
+ Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged(
+ (StateChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(2)).onGroupChanged(
+ (GroupChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(2)).onGroupChanged(
+ (GroupChangedEvent) Mockito.anyObject());
+ }
- private void changeState(final String... tokens) {
- for (final String token : tokens) {
- Mockito.when(state.getStateToken()).thenReturn(new StateToken(token));
- stateManager.setState(state);
- }
+ private void changeState(final String... tokens) {
+ for (final String token : tokens) {
+ Mockito.when(state.getStateToken()).thenReturn(new StateToken(token));
+ stateManager.setState(state);
}
+ }
- @Test
- public void changeStateWithDifferentAndGroupsToolsMustFireListener() {
- changeState("group2.tool1", "group1.tool2");
- Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged((StateChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(2)).onGroupChanged((GroupChangedEvent) Mockito.anyObject());
- Mockito.verify(toolChangeHandler, Mockito.times(2)).onToolChanged((ToolChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(new GroupChangedEvent("", "group2"));
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(new GroupChangedEvent("group2", "group1"));
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("tool1", "tool2"));
- }
+ @Test
+ public void changeStateWithDifferentAndGroupsToolsMustFireListener() {
+ changeState("group2.tool1", "group1.tool2");
+ Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged(
+ (StateChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(2)).onGroupChanged(
+ (GroupChangedEvent) Mockito.anyObject());
+ Mockito.verify(toolChangeHandler, Mockito.times(2)).onToolChanged(
+ (ToolChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ new GroupChangedEvent("", "group2"));
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ new GroupChangedEvent("group2", "group1"));
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(
+ new ToolChangedEvent("tool1", "tool2"));
+ }
- @Test
- public void changeStateWithDifferentGroupsMustFireListener() {
- changeState("group1.tool1", "group2.tool1");
- // assertTrue(stateChangeListener.isCalled(2));
- // assertTrue(groupChangeListener.isCalledWithEquals("", "group1",
- // "group1", "group2"));
- // assertTrue(toolChangeListener.isCalledWithEquals("", "tool1"));
- Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged((StateChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(2)).onGroupChanged((GroupChangedEvent) Mockito.anyObject());
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged((ToolChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(new GroupChangedEvent("", "group1"));
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(new GroupChangedEvent("group1", "group2"));
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
+ @Test
+ public void changeStateWithDifferentGroupsMustFireListener() {
+ changeState("group1.tool1", "group2.tool1");
+ // assertTrue(stateChangeListener.isCalled(2));
+ // assertTrue(groupChangeListener.isCalledWithEquals("", "group1",
+ // "group1", "group2"));
+ // assertTrue(toolChangeListener.isCalledWithEquals("", "tool1"));
+ Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged(
+ (StateChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(2)).onGroupChanged(
+ (GroupChangedEvent) Mockito.anyObject());
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(
+ (ToolChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ new GroupChangedEvent("", "group1"));
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ new GroupChangedEvent("group1", "group2"));
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
- }
+ }
- @Test
- public void changeStateWithDifferentToolsMustFireListener() {
- changeState("group1.tool1", "group1.tool2");
- Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged((StateChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged((GroupChangedEvent) Mockito.anyObject());
- Mockito.verify(toolChangeHandler, Mockito.times(2)).onToolChanged((ToolChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(new GroupChangedEvent("", "group1"));
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("tool1", "tool2"));
- }
+ @Test
+ public void changeStateWithDifferentToolsMustFireListener() {
+ changeState("group1.tool1", "group1.tool2");
+ Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged(
+ (StateChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ (GroupChangedEvent) Mockito.anyObject());
+ Mockito.verify(toolChangeHandler, Mockito.times(2)).onToolChanged(
+ (ToolChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ new GroupChangedEvent("", "group1"));
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(
+ new ToolChangedEvent("tool1", "tool2"));
+ }
- @Test
- public void changeToNoTool() {
- changeState("group1.tool1", "group1");
- Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged((StateChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged((GroupChangedEvent) Mockito.anyObject());
- Mockito.verify(toolChangeHandler, Mockito.times(2)).onToolChanged((ToolChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(new GroupChangedEvent("", "group1"));
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("tool1", ""));
- }
+ @Test
+ public void changeToNoTool() {
+ changeState("group1.tool1", "group1");
+ Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged(
+ (StateChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ (GroupChangedEvent) Mockito.anyObject());
+ Mockito.verify(toolChangeHandler, Mockito.times(2)).onToolChanged(
+ (ToolChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ new GroupChangedEvent("", "group1"));
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("tool1", ""));
+ }
- @Test
- public void changeToSameToken() {
- changeState("group1.tool1", "group1.tool1");
- Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged((StateChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged((GroupChangedEvent) Mockito.anyObject());
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged((ToolChangedEvent) Mockito.anyObject());
- Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(new GroupChangedEvent("", "group1"));
- Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
- }
+ @Test
+ public void changeToSameToken() {
+ changeState("group1.tool1", "group1.tool1");
+ Mockito.verify(stateChangeHandler, Mockito.times(2)).onStateChanged(
+ (StateChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ (GroupChangedEvent) Mockito.anyObject());
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(
+ (ToolChangedEvent) Mockito.anyObject());
+ Mockito.verify(groupChangeHandler, Mockito.times(1)).onGroupChanged(
+ new GroupChangedEvent("", "group1"));
+ Mockito.verify(toolChangeHandler, Mockito.times(1)).onToolChanged(new ToolChangedEvent("", "tool1"));
+ }
- private String confBeforeStateChangeListeners(final boolean value, final boolean value2) {
- stateManager.addBeforeStateChangeListener(beforeChangeListener1);
- stateManager.addBeforeStateChangeListener(beforeChangeListener2);
- final String newToken = "something";
- Mockito.when(beforeChangeListener1.beforeAction()).thenReturn(value);
- Mockito.when(beforeChangeListener2.beforeAction()).thenReturn(value2);
- return newToken;
- }
+ private String confBeforeStateChangeListeners(final boolean value, final boolean value2) {
+ stateManager.addBeforeStateChangeListener(beforeChangeListener1);
+ stateManager.addBeforeStateChangeListener(beforeChangeListener2);
+ final String newToken = "something";
+ Mockito.when(beforeChangeListener1.beforeAction()).thenReturn(value);
+ Mockito.when(beforeChangeListener2.beforeAction()).thenReturn(value2);
+ return newToken;
+ }
- @SuppressWarnings("unchecked")
- @Test
- public void getDefGroup() {
- stateManager.processHistoryToken("site.docs");
- verifyGetServerContent();
- }
+ @SuppressWarnings("unchecked")
+ @Test
+ public void getDefGroup() {
+ stateManager.processHistoryToken("site.docs");
+ verifyGetServerContent();
+ }
- public void getWaveToken() {
- stateManager.processHistoryToken("example.com/w+abcd/~/conv+root/b+45kg");
- }
+ public void getWaveToken() {
+ stateManager.processHistoryToken("example.com/w+abcd/~/conv+root/b+45kg");
+ }
- @SuppressWarnings("unchecked")
- @Test
- public void normalStartLoggedUser() {
- // When a user enter reload state, also if the application is starting
- // (and the user was logged)
- Mockito.when(history.getToken()).thenReturn("");
- stateManager.refreshCurrentState();
- verifyGetServerContent();
- }
+ @SuppressWarnings("unchecked")
+ @Test
+ public void normalStartLoggedUser() {
+ // When a user enter reload state, also if the application is starting
+ // (and the user was logged)
+ Mockito.when(history.getToken()).thenReturn("");
+ stateManager.refreshCurrentState();
+ verifyGetServerContent();
+ }
- @SuppressWarnings("unchecked")
- @Test
- public void oneBeforeStateChangeListenerAddAndRemove() {
- final String newToken = confBeforeStateChangeListeners(false, false);
- stateManager.processHistoryToken(newToken);
- removeBeforeStateChangeListener();
- stateManager.processHistoryToken(newToken);
- verifyGetServerContent();
- }
+ @SuppressWarnings("unchecked")
+ @Test
+ public void oneBeforeStateChangeListenerAddAndRemove() {
+ final String newToken = confBeforeStateChangeListeners(false, false);
+ stateManager.processHistoryToken(newToken);
+ removeBeforeStateChangeListener();
+ stateManager.processHistoryToken(newToken);
+ verifyGetServerContent();
+ }
- @Test
- public void oneBeforeStateChangeListenerFalseAndResume() {
- final String token = confBeforeStateChangeListeners(false, true);
- stateManager.processHistoryToken(token);
- Mockito.verify(history, Mockito.never()).newItem(token);
- removeBeforeStateChangeListener();
- stateManager.resumeTokenChange();
- Mockito.verify(history, Mockito.times(1)).newItem(token);
- }
+ @Test
+ public void oneBeforeStateChangeListenerFalseAndResume() {
+ final String token = confBeforeStateChangeListeners(false, true);
+ stateManager.processHistoryToken(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() {
- stateManager.processHistoryToken(confBeforeStateChangeListeners(true, false));
- Mockito.verify(contentProvider, Mockito.never()).getContent(Mockito.anyString(),
- (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
- }
+ @SuppressWarnings("unchecked")
+ @Test
+ public void oneBeforeStateChangeListenerReturnFalse() {
+ stateManager.processHistoryToken(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.processHistoryToken(confBeforeStateChangeListeners(false, false));
- Mockito.verify(contentProvider, Mockito.never()).getContent(Mockito.anyString(),
- (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
- }
+ @SuppressWarnings("unchecked")
+ @Test
+ public void oneBeforeStateChangeListenerReturnFalseWithTwo() {
+ stateManager.processHistoryToken(confBeforeStateChangeListeners(false, false));
+ Mockito.verify(contentProvider, Mockito.never()).getContent(Mockito.anyString(),
+ (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
+ }
- @SuppressWarnings("unchecked")
- @Test
- public void oneBeforeStateChangeListenerReturnTrue() {
- stateManager.processHistoryToken(confBeforeStateChangeListeners(true, true));
- verifyGetServerContent();
- }
+ @SuppressWarnings("unchecked")
+ @Test
+ public void oneBeforeStateChangeListenerReturnTrue() {
+ stateManager.processHistoryToken(confBeforeStateChangeListeners(true, true));
+ verifyGetServerContent();
+ }
- private void removeBeforeStateChangeListener() {
- stateManager.removeBeforeStateChangeListener(beforeChangeListener1);
- stateManager.removeBeforeStateChangeListener(beforeChangeListener2);
- }
+ private void removeBeforeStateChangeListener() {
+ stateManager.removeBeforeStateChangeListener(beforeChangeListener1);
+ stateManager.removeBeforeStateChangeListener(beforeChangeListener2);
+ }
- @SuppressWarnings("unchecked")
- @Test
- public void siteTokenFirstLoadDefContentAndFireListener() {
- final HistoryTokenCallback listener = Mockito.mock(HistoryTokenCallback.class);
- final String token = SiteTokens.SIGNIN;
- stateManager.addSiteToken(token, listener);
- Mockito.when(siteTokens.get(SiteTokens.SIGNIN)).thenReturn(listener);
- stateManager.processHistoryToken(token);
- Mockito.verify(listener, Mockito.times(1)).onHistoryToken();
- verifyGetServerContent();
- }
+ @SuppressWarnings("unchecked")
+ @Test
+ public void siteTokenFirstLoadDefContentAndFireListener() {
+ final HistoryTokenCallback listener = Mockito.mock(HistoryTokenCallback.class);
+ final String token = SiteTokens.SIGNIN;
+ stateManager.addSiteToken(token, listener);
+ Mockito.when(siteTokens.get(SiteTokens.SIGNIN)).thenReturn(listener);
+ stateManager.processHistoryToken(token);
+ Mockito.verify(listener, Mockito.times(1)).onHistoryToken(Mockito.anyString());
+ verifyGetServerContent();
+ }
- @Test
- public void siteTokenTest() {
- final HistoryTokenCallback listener = Mockito.mock(HistoryTokenCallback.class);
- stateManager.addSiteToken(SiteTokens.SIGNIN, listener);
- Mockito.when(siteTokens.get(SiteTokens.SIGNIN)).thenReturn(listener);
- stateManager.processHistoryToken("signIn");
- Mockito.verify(listener, Mockito.times(1)).onHistoryToken();
- }
+ @Test
+ public void siteTokenTest() {
+ final HistoryTokenCallback listener = Mockito.mock(HistoryTokenCallback.class);
+ stateManager.addSiteToken(SiteTokens.SIGNIN, listener);
+ Mockito.when(siteTokens.get(SiteTokens.SIGNIN)).thenReturn(listener);
+ stateManager.processHistoryToken("signIn");
+ Mockito.verify(listener, Mockito.times(1)).onHistoryToken(Mockito.anyString());
+ }
- @Test
- public void startMustLoadContent() {
- final InitDataDTO initData = Mockito.mock(InitDataDTO.class);
- Mockito.when(history.getToken()).thenReturn("");
- eventBus.fireEvent(new AppStartEvent(initData));
- verifyGetServerContent();
- }
+ @Test
+ public void startMustLoadContent() {
+ final InitDataDTO initData = Mockito.mock(InitDataDTO.class);
+ Mockito.when(history.getToken()).thenReturn("");
+ eventBus.fireEvent(new AppStartEvent(initData));
+ verifyGetServerContent();
+ }
- private void verifyGetServerContent() {
- Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
- (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
- }
+ private void verifyGetServerContent() {
+ Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
+ (StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
+ }
}
More information about the kune-commits
mailing list