kune-commits
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 1587 discussions
12 Dec '11
Author: vjrj_
Date: 2011-12-12 22:47:20 +0100 (Mon, 12 Dec 2011)
New Revision: 1638
Added:
trunk/src/main/java/cc/kune/wave/client/KuneParticipantController.java
Modified:
trunk/.classpath
trunk/pom.xml
trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/EntitySearchPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java
trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java
trunk/src/main/java/cc/kune/wave/client/WebClient.java
trunk/src/main/java/cc/kune/wave/server/WaveMain.java
trunk/src/main/resources/wave-server.properties
trunk/src/test/java/cc/kune/core/server/TestHelper.java
trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java
trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java
Log:
Wave code updated (several bug fixed). Wave participants patched (now the creator cannot be deleted). Better Wave-Kune integration.
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/.classpath 2011-12-12 21:47:20 UTC (rev 1638)
@@ -13,19 +13,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/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
<classpathentry kind="var" path="M2_REPO/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar" sourcepath="M2_REPO/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box/0.3.7/box-0.3.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box-src/0.3.7/box-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/box-src/0.3.7/box-src-0.3.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box/0.3.8/box-0.3.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/box-src/0.3.8/box-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/box-src/0.3.8/box-src-0.3.8-sources.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.7/client-0.3.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common/0.3.7/client-common-0.3.7.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common-src/0.3.7/client-common-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/client-common-src/0.3.7/client-common-src-0.3.7-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-scheduler-src/0.3.7/client-scheduler-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/client-scheduler-src/0.3.7/client-scheduler-src-0.3.7-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-src/0.3.7/client-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/client-src/0.3.7/client-src-0.3.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client/0.3.8/client-0.3.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common/0.3.8/client-common-0.3.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-common-src/0.3.8/client-common-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/client-common-src/0.3.8/client-common-src-0.3.8-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-scheduler-src/0.3.8/client-scheduler-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/client-scheduler-src/0.3.8/client-scheduler-src-0.3.8-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/client-src/0.3.8/client-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/client-src/0.3.8/client-src-0.3.8-sources.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.7/common-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/common-src/0.3.7/common-src-0.3.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/common-src/0.3.8/common-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/common-src/0.3.8/common-src-0.3.8-sources.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"/>
@@ -34,8 +34,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.7/communication-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/communication-src/0.3.7/communication-src-0.3.7-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/waveprotocol/concurrencycontrol-src/0.3.7/concurrencycontrol-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/concurrencycontrol-src/0.3.7/concurrencycontrol-src-0.3.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/communication-src/0.3.8/communication-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/communication-src/0.3.8/communication-src-0.3.8-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/concurrencycontrol-src/0.3.8/concurrencycontrol-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/concurrencycontrol-src/0.3.8/concurrencycontrol-src-0.3.8-sources.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"/>
<classpathentry kind="var" path="M2_REPO/net/sf/dozer/dozer/4.0/dozer-4.0.jar" sourcepath="M2_REPO/net/sf/dozer/dozer/4.0/dozer-4.0-sources.jar"/>
@@ -57,7 +57,7 @@
<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.7/gwt-util-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/gwt-util-src/0.3.7/gwt-util-src-0.3.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/gwt-util-src/0.3.8/gwt-util-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/gwt-util-src/0.3.8/gwt-util-src-0.3.8-sources.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/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"/>
@@ -114,16 +114,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.7/media-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/media-src/0.3.7/media-src-0.3.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/media-src/0.3.8/media-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/media-src/0.3.8/media-src-0.3.8-sources.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.7/model-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/model-src/0.3.7/model-src-0.3.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/model-src/0.3.8/model-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/model-src/0.3.8/model-src-0.3.8-sources.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.7/proto-msg-0.3.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/proto-msg/0.3.8/proto-msg-0.3.8.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.12.0/selenium-android-driver-2.12.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-android-driver/2.12.0/selenium-android-driver-2.12.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/seleniumhq/selenium/selenium-api/2.12.0/selenium-api-2.12.0.jar" sourcepath="M2_REPO/org/seleniumhq/selenium/selenium-api/2.12.0/selenium-api-2.12.0-sources.jar"/>
@@ -147,9 +147,9 @@
<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.7/util-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/util-src/0.3.7/util-src-0.3.7-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/util-src/0.3.8/util-src-0.3.8.jar" sourcepath="M2_REPO/org/waveprotocol/util-src/0.3.8/util-src-0.3.8-sources.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.7/waveinabox-server-0.3-0.3.7.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/waveprotocol/waveinabox-server-0.3/0.3.8/waveinabox-server-0.3-0.3.8.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"/>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/pom.xml 2011-12-12 21:47:20 UTC (rev 1638)
@@ -19,7 +19,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<slf4j.version>1.6.1</slf4j.version>
<openjpa.version>2.0.1</openjpa.version>
- <wiab.version>0.3.7</wiab.version>
+ <wiab.version>0.3.8</wiab.version>
<skipTests>true</skipTests>
</properties>
<repositories>
Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -84,7 +84,7 @@
final String msg = caught.getMessage();
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
i18n.t("You do not have rights to perform that action")
- + (!TextUtils.empty(msg) && msg.length() > 1 ? ". " + i18n.t(msg) : "")));
+ + (!TextUtils.empty(msg) && msg.length() > 2 ? ". " + i18n.t(msg) : "")));
goHome();
} else if (caught instanceof SessionExpiredException) {
logException(caught);
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/EntitySearchPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/EntitySearchPanel.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/EntitySearchPanel.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -71,7 +71,7 @@
dialog.getTitleText().setText(
i18n.t(searchOnlyUsers ? "Type the name of the user and select him/her:"
: "Type the name of the user or group and select it:"), i18n.getDirection());
- final MultivalueSuggestBox multivalueSBox = SearchBoxFactory.create(i18n, searchOnlyUsers, id,
+ final MultivalueSuggestBox multivalueSBox = SearchBoxFactory.create(i18n, searchOnlyUsers, true, id,
callback);
suggestBox = multivalueSBox.getSuggestBox();
searchTextBox = suggestBox.getTextBox();
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -311,9 +311,11 @@
if (totSize < 1) {
// if there were no suggestions, then it's an invalid value
updateFormFeedback(FormFeedback.ERROR, "Invalid: " + m_query);
- final OptionSuggestion sugg = new OptionSuggestion(i18n.t("No results"), "#",
- m_request.getQuery(), m_query);
- suggs.add(sugg);
+ if (showNoResult) {
+ final OptionSuggestion sugg = new OptionSuggestion(i18n.t("No results"), "#",
+ m_request.getQuery(), m_query);
+ suggs.add(sugg);
+ }
} else if (false && totSize == 1) {
// Patch to show always the suggestions
// it's an exact match, so do not bother with showing suggestions,
@@ -497,6 +499,8 @@
private final Map<String, String> mvalueMap;
+ private final boolean showNoResult;
+
// private final OnExactMatch onExactMatch;
/**
@@ -510,10 +514,14 @@
* @param isMultivalued
* - true for allowing multiple values
* @param onExactMatch
+ * @param showNoResult
+ * if we have to show noResult message when the search is empty or
+ * not
*/
- public MultivalueSuggestBox(final I18nUITranslationService i18n, final String restEndpointUrl,
- final boolean isMultivalued, final OnExactMatch onExactMatch) {
+ public MultivalueSuggestBox(final I18nUITranslationService i18n, final boolean showNoResult,
+ final String restEndpointUrl, final boolean isMultivalued, final OnExactMatch onExactMatch) {
this.i18n = i18n;
+ this.showNoResult = showNoResult;
mrestEndpointUrl = restEndpointUrl;
misMultivalued = isMultivalued;
// this.onExactMatch = onExactMatch;
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -31,9 +31,11 @@
public class SearchBoxFactory {
public static MultivalueSuggestBox create(final I18nUITranslationService i18n,
- final boolean searchOnlyUsers, final String id, final OnEntitySelectedInSearch callback) {
+ final boolean searchOnlyUsers, final boolean showNoResult, final String id,
+ final OnEntitySelectedInSearch callback) {
final MultivalueSuggestBox multivalueSBox = new MultivalueSuggestBox(
i18n,
+ showNoResult,
searchOnlyUsers ? SearcherConstants.USER_DATA_PROXY_URL : SearcherConstants.GROUP_DATA_PROXY_URL,
false, new OnExactMatch() {
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -53,7 +53,7 @@
final StateManager stateManager, final I18nUITranslationService i18n) {
searchButton = new PushButton(new Image(img.kuneSearchIco()), new Image(img.kuneSearchIcoPush()));
searchButton.ensureDebugId(SITE_SEARCH_BUTTON);
- final MultivalueSuggestBox multivalueSBox = SearchBoxFactory.create(i18n, false,
+ final MultivalueSuggestBox multivalueSBox = SearchBoxFactory.create(i18n, false, true,
SITE_SEARCH_TEXTBOX, new OnEntitySelectedInSearch() {
@Override
public void onSeleted(final String shortName) {
Modified: trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/core/client/state/StateManagerDefault.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -21,8 +21,8 @@
package cc.kune.core.client.state;
import org.waveprotocol.box.webclient.client.ClientEvents;
-import org.waveprotocol.box.webclient.client.HistorySupport;
import org.waveprotocol.box.webclient.client.events.WaveSelectionEvent;
+import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
import org.waveprotocol.wave.util.escapers.GwtWaverefEncoder;
import cc.kune.common.client.actions.BeforeActionCollection;
@@ -290,8 +290,12 @@
if (session.isLogged()) {
SpaceConfEvent.fire(eventBus, Space.userSpace, newHistoryToken);
SpaceSelectEvent.fire(eventBus, Space.userSpace);
- ClientEvents.get().fireEvent(
- new WaveSelectionEvent(HistorySupport.waveRefFromHistoryToken(newHistoryToken)));
+ try {
+ ClientEvents.get().fireEvent(
+ new WaveSelectionEvent(GwtWaverefEncoder.decodeWaveRefFromPath(newHistoryToken)));
+ } catch (final InvalidWaveRefException e) {
+ Log.error(nToken, e);
+ }
} else {
// Wave, but don't logged
history.newItem(TokenUtils.addRedirect(SiteTokens.SIGNIN, newHistoryToken));
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPanel.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -78,6 +78,7 @@
@UiField
DeckPanel deck;
private final GSpaceArmor gsArmor;
+ private final I18nTranslationService i18n;
private IdGenerator idGenerator;
private Element loading;
@UiField
@@ -85,6 +86,7 @@
private ProfileManager profiles;
/** The wave panel, if a wave is open. */
private KuneStagesProvider wave;
+
private final WaveClientProvider waveClientProv;
private ImplPanel waveHolder;
@@ -103,6 +105,7 @@
this.gsArmor = wsArmor;
this.waveClientProv = waveClient;
this.capabilitiesRegistry = capabilitiesRegistry;
+ this.i18n = i18n;
widget = uiBinder.createAndBindUi(this);
contentTitle = new ContentTitleWidget(i18n, gsArmor, capabilitiesRegistry.getIconsRegistry());
eventBus.addHandler(WaveClientClearEvent.getType(),
@@ -219,7 +222,7 @@
final Element holder = waveHolder.getElement().appendChild(Document.get().createDivElement());
final KuneStagesProvider wave = new KuneStagesProvider(holder, waveHolder, waveRef, channel,
idGenerator, profiles, waveStore, isNewWave,
- org.waveprotocol.box.webclient.client.Session.get().getDomain(), true);
+ org.waveprotocol.box.webclient.client.Session.get().getDomain(), true, i18n);
this.wave = wave;
wave.load(new Command() {
@Override
Added: trunk/src/main/java/cc/kune/wave/client/KuneParticipantController.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/KuneParticipantController.java (rev 0)
+++ trunk/src/main/java/cc/kune/wave/client/KuneParticipantController.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -0,0 +1,156 @@
+/**
+ * Copyright 2010 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.wave.client;
+
+import org.waveprotocol.wave.client.account.Profile;
+import org.waveprotocol.wave.client.account.ProfileManager;
+import org.waveprotocol.wave.client.common.safehtml.EscapeUtils;
+import org.waveprotocol.wave.client.wavepanel.WavePanel;
+import org.waveprotocol.wave.client.wavepanel.event.EventHandlerRegistry;
+import org.waveprotocol.wave.client.wavepanel.event.WaveClickHandler;
+import org.waveprotocol.wave.client.wavepanel.view.ParticipantView;
+import org.waveprotocol.wave.client.wavepanel.view.ParticipantsView;
+import org.waveprotocol.wave.client.wavepanel.view.View.Type;
+import org.waveprotocol.wave.client.wavepanel.view.dom.DomAsViewProvider;
+import org.waveprotocol.wave.client.wavepanel.view.dom.ModelAsViewProvider;
+import org.waveprotocol.wave.client.wavepanel.view.dom.full.TypeCodes;
+import org.waveprotocol.wave.client.widget.profile.ProfilePopupPresenter;
+import org.waveprotocol.wave.client.widget.profile.ProfilePopupView;
+import org.waveprotocol.wave.model.conversation.Conversation;
+import org.waveprotocol.wave.model.util.Pair;
+import org.waveprotocol.wave.model.wave.InvalidParticipantAddress;
+import org.waveprotocol.wave.model.wave.ParticipantId;
+
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Window;
+
+/**
+ * Installs the add/remove participant controls.
+ *
+ */
+public final class KuneParticipantController {
+ private static I18nTranslationService i18n;
+
+ /**
+ * Builds and installs the participant control feature.
+ */
+ public static void install(final WavePanel panel, final ModelAsViewProvider models,
+ final ProfileManager profiles, final String localDomain, final I18nTranslationService i18n) {
+ KuneParticipantController.i18n = i18n;
+ final KuneParticipantController controller = new KuneParticipantController(panel.getViewProvider(),
+ models, profiles, localDomain);
+ controller.install(panel.getHandlers());
+ }
+ private final String localDomain;
+ private final ModelAsViewProvider models;
+ private final ProfileManager profiles;
+
+ private final DomAsViewProvider views;
+
+ /**
+ * @param localDomain
+ * nullable. if provided, automatic suffixing will occur.
+ */
+ KuneParticipantController(final DomAsViewProvider views, final ModelAsViewProvider models,
+ final ProfileManager profiles, final String localDomain) {
+ this.views = views;
+ this.models = models;
+ this.profiles = profiles;
+ this.localDomain = localDomain;
+ }
+
+ /**
+ * Shows an add-participant popup.
+ */
+ private void handleAddButtonClicked(final Element context) {
+
+ ParticipantId p;
+ String address = Window.prompt("Add a participant: ", "");
+ if (address == null) {
+ return;
+ }
+ address = address.trim();
+ if (localDomain != null) {
+ if (!address.isEmpty() && address.indexOf("@") == -1) {
+ // If no domain was specified, assume that the participant is from the
+ // local domain.
+ address = address + "@" + localDomain;
+ } else if (address.equals("@")) {
+ // "@" is a shortcut for the shared domain participant.
+ address = address + localDomain;
+ }
+ }
+
+ try {
+ p = ParticipantId.of(address);
+ } catch (final InvalidParticipantAddress e) {
+ NotifyUser.error(i18n.t("Invalid address: [%s]", address));
+ return;
+ }
+
+ final ParticipantsView participantsUi = views.fromAddButton(context);
+ final Conversation conversation = models.getParticipants(participantsUi);
+ conversation.addParticipant(p);
+ }
+
+ /**
+ * Shows a participation popup for the clicked participant.
+ */
+ private void handleParticipantClicked(final Element context) {
+ final ParticipantView participantView = views.asParticipant(context);
+ final Pair<Conversation, ParticipantId> participation = models.getParticipant(participantView);
+ final Profile profile = profiles.getProfile(participation.second);
+
+ // Summon a popup view from a participant, and attach profile-popup logic to
+ // it.
+ final ProfilePopupView profileView = participantView.showParticipation();
+ final ProfilePopupPresenter profileUi = ProfilePopupPresenter.create(profile, profileView, profiles);
+ if (!participation.first.getParticipantIds().iterator().next().equals(participation.getSecond())) {
+ profileUi.addControl(EscapeUtils.fromSafeConstant("Remove"), new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ participation.first.removeParticipant(participation.second);
+ // The presenter is configured to destroy itself on view hide.
+ profileView.hide();
+ }
+ });
+ }
+ profileUi.show();
+ }
+
+ private void install(final EventHandlerRegistry handlers) {
+ handlers.registerClickHandler(TypeCodes.kind(Type.ADD_PARTICIPANT), new WaveClickHandler() {
+ @Override
+ public boolean onClick(final ClickEvent event, final Element context) {
+ handleAddButtonClicked(context);
+ return true;
+ }
+ });
+ handlers.registerClickHandler(TypeCodes.kind(Type.PARTICIPANT), new WaveClickHandler() {
+ @Override
+ public boolean onClick(final ClickEvent event, final Element context) {
+ handleParticipantClicked(context);
+ return true;
+ }
+ });
+ }
+}
Modified: trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/wave/client/KuneStagesProvider.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -32,14 +32,30 @@
import org.waveprotocol.wave.client.common.util.AsyncHolder;
import org.waveprotocol.wave.client.common.util.AsyncHolder.Accessor;
import org.waveprotocol.wave.client.common.util.LogicalPanel;
+import org.waveprotocol.wave.client.editor.EditorStaticDeps;
+import org.waveprotocol.wave.client.wavepanel.impl.WavePanelImpl;
+import org.waveprotocol.wave.client.wavepanel.impl.edit.Actions;
+import org.waveprotocol.wave.client.wavepanel.impl.edit.EditController;
+import org.waveprotocol.wave.client.wavepanel.impl.edit.EditSession;
+import org.waveprotocol.wave.client.wavepanel.impl.edit.KeepFocusInView;
+import org.waveprotocol.wave.client.wavepanel.impl.focus.FocusFramePresenter;
+import org.waveprotocol.wave.client.wavepanel.impl.indicator.ReplyIndicatorController;
+import org.waveprotocol.wave.client.wavepanel.impl.menu.MenuController;
+import org.waveprotocol.wave.client.wavepanel.impl.title.WaveTitleHandler;
+import org.waveprotocol.wave.client.wavepanel.impl.toolbar.ToolbarSwitcher;
import org.waveprotocol.wave.client.wavepanel.view.BlipView;
import org.waveprotocol.wave.client.wavepanel.view.dom.ModelAsViewProvider;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.BlipQueueRenderer;
import org.waveprotocol.wave.client.wavepanel.view.dom.full.DomRenderer;
+import org.waveprotocol.wave.client.widget.popup.PopupChromeFactory;
+import org.waveprotocol.wave.client.widget.popup.PopupFactory;
import org.waveprotocol.wave.model.conversation.ConversationView;
import org.waveprotocol.wave.model.id.IdGenerator;
+import org.waveprotocol.wave.model.wave.ParticipantId;
import org.waveprotocol.wave.model.waveref.WaveRef;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
import com.google.gwt.dom.client.Element;
/**
@@ -51,28 +67,30 @@
private final static AsyncHolder<Object> HALT = new AsyncHolder<Object>() {
@Override
- public void call(Accessor<Object> accessor) {
+ public void call(final Accessor<Object> accessor) {
// Never ready, so never notify the accessor.
}
};
- private final Element wavePanelElement;
- private final LogicalPanel rootPanel;
- private final WaveRef waveRef;
private final RemoteViewServiceMultiplexer channel;
+ private boolean closed;
+ private final I18nTranslationService i18n;
private final IdGenerator idGenerator;
- private final ProfileManager profiles;
- private final WaveStore waveStore;
private final boolean isNewWave;
private final String localDomain;
+ private StageOne one;
+ private final ProfileManager profiles;
+ private final LogicalPanel rootPanel;
- private boolean closed;
- private StageOne one;
+ private final boolean showParticipantsPanel;
+ private StageThree three;
private StageTwo two;
- private StageThree three;
private WaveContext wave;
- private boolean showParticipantsPanel;
+ private final Element wavePanelElement;
+ private final WaveRef waveRef;
+ private final WaveStore waveStore;
+
/**
* @param wavePanelElement The dom element to become the wave panel
* @param rootPanel A panel that this an ancestor of wavePanelElement. This is
@@ -83,9 +101,9 @@
* @param isNewWave true if the wave is a new client-created wave
* @param idGenerator
*/
- public KuneStagesProvider(Element wavePanelElement, LogicalPanel rootPanel, WaveRef waveRef,
- RemoteViewServiceMultiplexer channel, IdGenerator idGenerator, ProfileManager profiles,
- WaveStore store, boolean isNewWave, String localDomain, boolean showParticipantsPanel) {
+ public KuneStagesProvider(final Element wavePanelElement, final LogicalPanel rootPanel, final WaveRef waveRef,
+ final RemoteViewServiceMultiplexer channel, final IdGenerator idGenerator, final ProfileManager profiles,
+ final WaveStore store, final boolean isNewWave, final String localDomain, final boolean showParticipantsPanel, final I18nTranslationService i18n) {
this.wavePanelElement = wavePanelElement;
this.rootPanel = rootPanel;
this.waveRef = waveRef;
@@ -96,46 +114,21 @@
this.isNewWave = isNewWave;
this.localDomain = localDomain;
this.showParticipantsPanel = showParticipantsPanel;
+ this.i18n = i18n;
}
@Override
- protected AsyncHolder<StageZero> createStageZeroLoader() {
- return haltIfClosed(super.createStageZeroLoader());
- }
-
- @Override
- protected AsyncHolder<StageOne> createStageOneLoader(StageZero zero) {
+ protected AsyncHolder<StageOne> createStageOneLoader(final StageZero zero) {
return haltIfClosed(new StageOne.DefaultProvider(zero) {
@Override
- protected Element createWaveHolder() {
- return wavePanelElement;
- }
-
- @Override
protected LogicalPanel createWaveContainer() {
return rootPanel;
}
- });
- }
- @Override
- protected AsyncHolder<StageTwo> createStageTwoLoader(StageOne one) {
- return haltIfClosed(new StageTwoProvider(
- this.one = one, waveRef, channel, isNewWave, idGenerator, profiles) {
- // Kune patch
@Override
- protected DomRenderer createRenderer() {
- return KuneFullDomWaveRendererImpl.create(getConversations(), getProfileManager(),
- getBlipDetailer(), getViewIdMapper(), getBlipQueue(), getThreadReadStateMonitor(),
- createViewFactories(), showParticipantsPanel);
+ protected Element createWaveHolder() {
+ return wavePanelElement;
}
-
- // Warning: this run into issue #73
- // @Override
- // protected void installFeatures() {
- // WavePanelResourceLoader.loadCss();
- // // KuneWavePanelResourceLoader.loadCss();
- // }
});
}
@@ -147,7 +140,7 @@
// Prepend an init wave flow onto the stage continuation.
super.create(new Accessor<StageThree>() {
@Override
- public void use(StageThree x) {
+ public void use(final StageThree x) {
onStageThreeLoaded(x, whenReady);
}
});
@@ -157,41 +150,57 @@
protected String getLocalDomain() {
return localDomain;
}
+ @Override
+ protected void install() {
+ EditorStaticDeps.setPopupProvider(PopupFactory.getProvider());
+ EditorStaticDeps.setPopupChromeProvider(PopupChromeFactory.getProvider());
+
+ // Eagerly install some features.
+ final WavePanelImpl panel = stageTwo.getStageOne().getWavePanel();
+ final FocusFramePresenter focus = stageTwo.getStageOne().getFocusFrame();
+ final ParticipantId user = stageTwo.getSignedInUser();
+ final ModelAsViewProvider models = stageTwo.getModelAsViewProvider();
+ final ProfileManager profiles = stageTwo.getProfileManager();
+
+ final Actions actions = getEditActions();
+ final EditSession edit = getEditSession();
+ MenuController.install(actions, panel);
+ ToolbarSwitcher.install(stageTwo.getStageOne().getWavePanel(), getEditSession(),
+ getViewToolbar(), getEditToolbar());
+ WaveTitleHandler.install(edit, models);
+ ReplyIndicatorController.install(actions, edit, panel);
+ EditController.install(focus, actions, panel);
+ KuneParticipantController.install(panel, models, profiles, getLocalDomain(), i18n);
+ KeepFocusInView.install(edit, panel);
+ stageTwo.getDiffController().upgrade(edit);
+ }
});
}
- private void onStageThreeLoaded(StageThree x, Accessor<StageThree> whenReady) {
- if (closed) {
- // Stop the loading process.
- return;
- }
- three = x;
- if (isNewWave) {
- initNewWave(x);
- } else {
- handleExistingWave(x);
- }
- wave = new WaveContext(
- two.getWave(), two.getConversations(), two.getSupplement(), two.getReadMonitor());
- waveStore.add(wave);
- whenReady.use(x);
- }
+ @Override
+ protected AsyncHolder<StageTwo> createStageTwoLoader(final StageOne one) {
+ return haltIfClosed(new StageTwoProvider(
+ this.one = one, waveRef, channel, isNewWave, idGenerator, profiles) {
+ // Kune patch
+ @Override
+ protected DomRenderer createRenderer() {
+ return KuneFullDomWaveRendererImpl.create(getConversations(), getProfileManager(),
+ getBlipDetailer(), getViewIdMapper(), getBlipQueue(), getThreadReadStateMonitor(),
+ createViewFactories(), showParticipantsPanel);
+ }
- private void initNewWave(StageThree three) {
- // Do the new-wave flow.
- ModelAsViewProvider views = two.getModelAsViewProvider();
- BlipQueueRenderer blipQueue = two.getBlipQueue();
- ConversationView wave = two.getConversations();
-
- // Force rendering to finish.
- blipQueue.flush();
- BlipView blipUi = views.getBlipView(wave.getRoot().getRootThread().getFirstBlip());
- three.getEditActions().startEditing(blipUi);
+ // Warning: this run into issue #73
+ // @Override
+ // protected void installFeatures() {
+ // WavePanelResourceLoader.loadCss();
+ // // KuneWavePanelResourceLoader.loadCss();
+ // }
+ });
}
- private void handleExistingWave(StageThree three) {
- BlipQueueRenderer blipQueue = two.getBlipQueue();
- blipQueue.flush();
+ @Override
+ protected AsyncHolder<StageZero> createStageZeroLoader() {
+ return haltIfClosed(super.createStageZeroLoader());
}
public void destroy() {
@@ -219,7 +228,41 @@
* given provider.
*/
@SuppressWarnings("unchecked") // HALT is safe as a holder for any type
- private <T> AsyncHolder<T> haltIfClosed(AsyncHolder<T> provider) {
+ private <T> AsyncHolder<T> haltIfClosed(final AsyncHolder<T> provider) {
return closed ? (AsyncHolder<T>) HALT : provider;
}
+
+ private void handleExistingWave(final StageThree three) {
+ final BlipQueueRenderer blipQueue = two.getBlipQueue();
+ blipQueue.flush();
+ }
+
+ private void initNewWave(final StageThree three) {
+ // Do the new-wave flow.
+ final ModelAsViewProvider views = two.getModelAsViewProvider();
+ final BlipQueueRenderer blipQueue = two.getBlipQueue();
+ final ConversationView wave = two.getConversations();
+
+ // Force rendering to finish.
+ blipQueue.flush();
+ final BlipView blipUi = views.getBlipView(wave.getRoot().getRootThread().getFirstBlip());
+ three.getEditActions().startEditing(blipUi);
+ }
+
+ private void onStageThreeLoaded(final StageThree x, final Accessor<StageThree> whenReady) {
+ if (closed) {
+ // Stop the loading process.
+ return;
+ }
+ three = x;
+ if (isNewWave) {
+ initNewWave(x);
+ } else {
+ handleExistingWave(x);
+ }
+ wave = new WaveContext(
+ two.getWave(), two.getConversations(), two.getSupplement(), two.getReadMonitor());
+ waveStore.add(wave);
+ whenReady.use(x);
+ }
}
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -64,7 +64,9 @@
import org.waveprotocol.wave.model.id.IdGenerator;
import org.waveprotocol.wave.model.id.WaveId;
import org.waveprotocol.wave.model.wave.ParticipantId;
+import org.waveprotocol.wave.model.waveref.InvalidWaveRefException;
import org.waveprotocol.wave.model.waveref.WaveRef;
+import org.waveprotocol.wave.util.escapers.GwtWaverefEncoder;
import cc.kune.common.client.notify.NotifyUser;
import cc.kune.core.client.errors.DefaultException;
@@ -72,6 +74,7 @@
import cc.kune.core.client.sitebar.spaces.SpaceConfEvent;
import cc.kune.core.client.state.SiteTokens;
import cc.kune.core.client.state.TokenMatcher;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.wave.client.inboxcount.InboxCountPresenter;
import com.google.gwt.core.client.GWT;
@@ -225,13 +228,15 @@
private final EventBus eventBus;
+ private final I18nTranslationService i18n;
+
private IdGenerator idGenerator;
private final InboxCountPresenter inboxCount;
private final Element loading = new LoadingIndicator().getElement();
+ private ParticipantId loggedInUser;
- private ParticipantId loggedInUser;
@UiField
DebugMessagePanel logPanel;
@@ -257,7 +262,6 @@
ImplPanel waveHolder;
private final WaveStore waveStore = new SimpleWaveStore();
-
/**
* Create a remote websocket to talk to the server-side FedOne service.
*/
@@ -267,11 +271,12 @@
* This is the entry point method.
*/
@Inject
- public WebClient(final EventBus eventBus, final KuneWaveProfileManager profiles, final InboxCountPresenter inboxCount, final TokenMatcher tokenMatcher, final cc.kune.core.client.state.Session session) {
+ public WebClient(final EventBus eventBus, final KuneWaveProfileManager profiles, final InboxCountPresenter inboxCount, final TokenMatcher tokenMatcher, final cc.kune.core.client.state.Session session, final I18nTranslationService i18n) {
// Window.alert("webclient! " + new Date());
this.eventBus = eventBus;
this.profiles = profiles;
this.inboxCount = inboxCount;
+ this.i18n = i18n;
searchPanel = new SearchPanelWidget(new SearchPanelRenderer(profiles));
ErrorHandler.install();
@@ -427,7 +432,7 @@
waveHolder.getElement().appendChild(loading);
final Element holder = waveHolder.getElement().appendChild(Document.get().createDivElement());
final KuneStagesProvider wave = new KuneStagesProvider(
- holder, waveHolder, waveRef, channel, idGenerator, profiles, waveStore, isNewWave, Session.get().getDomain(), true);
+ holder, waveHolder, waveRef, channel, idGenerator, profiles, waveStore, isNewWave, Session.get().getDomain(), true, i18n);
this.wave = wave;
wave.load(new Command() {
@Override
@@ -438,8 +443,10 @@
final String encodedToken = History.getToken();
// Kune patch
if (encodedToken != null && !encodedToken.isEmpty() && !encodedToken.equals(SiteTokens.WAVEINBOX)) {
- final WaveRef fromWaveRef = HistorySupport.waveRefFromHistoryToken(encodedToken);
- if (waveRef == null) {
+ WaveRef fromWaveRef;
+ try {
+ fromWaveRef = GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken);
+ } catch (final InvalidWaveRefException e) {
LOG.info("History token contains invalid path: " + encodedToken);
return;
}
@@ -450,7 +457,7 @@
return;
}
}
- final String tokenFromWaveref = HistorySupport.historyTokenFromWaveref(waveRef);
+ final String tokenFromWaveref = GwtWaverefEncoder.encodeToUriPathSegment(waveRef);
SpaceConfEvent.fire(eventBus, Space.userSpace, tokenFromWaveref);
History.newItem(tokenFromWaveref, false);
}
Modified: trunk/src/main/java/cc/kune/wave/server/WaveMain.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/WaveMain.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/java/cc/kune/wave/server/WaveMain.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -140,6 +140,13 @@
boolean enableFederation = settingsInjector.getInstance(Key.get(Boolean.class,
Names.named(CoreSettings.ENABLE_FEDERATION)));
+ int listenerCount = settingsInjector.getInstance(Key.get(Integer.class,
+ Names.named(CoreSettings.LISTENER_EXECUTOR_THREAD_COUNT)));
+ int waveletLoadCount = settingsInjector.getInstance(Key.get(Integer.class,
+ Names.named(CoreSettings.WAVELET_LOAD_EXECUTOR_THREAD_COUNT)));
+ int deltaPersistCount = settingsInjector.getInstance(Key.get(Integer.class,
+ Names.named(CoreSettings.DELTA_PERSIST_EXECUTOR_THREAD_COUNT)));
+
if (enableFederation) {
Module federationSettings =
SettingsBinder.bindSettings(PROPERTIES_FILE_KEY, FederationSettings.class);
@@ -150,7 +157,8 @@
Module federationModule = buildFederationModule(settingsInjector, enableFederation);
PersistenceModule persistenceModule = settingsInjector.getInstance(PersistenceModule.class);
Injector injector =
- settingsInjector.createChildInjector(new ServerModule(enableFederation),
+ settingsInjector.createChildInjector(new ServerModule(enableFederation, listenerCount,
+ waveletLoadCount, deltaPersistCount),
new RobotApiModule(), federationModule, persistenceModule);
ServerRpcProvider server = injector.getInstance(ServerRpcProvider.class);
Modified: trunk/src/main/resources/wave-server.properties
===================================================================
--- trunk/src/main/resources/wave-server.properties 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/main/resources/wave-server.properties 2011-12-12 21:47:20 UTC (rev 1638)
@@ -71,11 +71,19 @@
admin_user = @local.net
# The wave id of the welcome template wave. (Without domain, for example: w+Fxjs_-ZPmmA).
-# If filled in then a copy of this wave (actually only the root blip) will be
+# If filled in then a copy of this wave (actually only the root blip) will be
# automatically added to the inbox of every new user.
# Default value: "" (empty)
-welcome_wave_id =
+welcome_wave_id =
+# Thread counts
+#The number of threads to listen on wavelet updates. Default value: 1
+listener_executor_thread_count = 1
+#The number of threads for loading wavelets. Default value: 2
+wavelet_load_executor_thread_count = 2
+#The number of threads to persist deltas. Default value: 2
+delta_persist_executor_thread_count = 2
+
# To enable federation, edit the server.federation.config file and include it here.
#include = server.federation.config
Modified: trunk/src/test/java/cc/kune/core/server/TestHelper.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/TestHelper.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/test/java/cc/kune/core/server/TestHelper.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -59,16 +59,16 @@
final PersistenceModule wavePersistModule = injector.getInstance(PersistenceModule.class);
final NoOpFederationModule federationModule = injector.getInstance(NoOpFederationModule.class);
final Injector childInjector = injector.createChildInjector(wavePersistModule, new ServerModule(
- false), new RobotApiModule(), federationModule, FinderRegistry.init(new JpaPersistModule(
- persistenceUnit)), module, new Module() {
- @Override
- public void configure(final Binder binder) {
- binder.bindScope(SessionScoped.class, Scopes.SINGLETON);
- binder.bindScope(RequestScoped.class, Scopes.SINGLETON);
- binder.bind(KuneProperties.class).toInstance(new KunePropertiesDefault(propetiesFileName));
- binder.bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
- }
- });
+ false, 1, 2, 2), new RobotApiModule(), federationModule,
+ FinderRegistry.init(new JpaPersistModule(persistenceUnit)), module, new Module() {
+ @Override
+ public void configure(final Binder binder) {
+ binder.bindScope(SessionScoped.class, Scopes.SINGLETON);
+ binder.bindScope(RequestScoped.class, Scopes.SINGLETON);
+ binder.bind(KuneProperties.class).toInstance(new KunePropertiesDefault(propetiesFileName));
+ binder.bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
+ }
+ });
try {
childInjector.getInstance(WaveServerImpl.class).initialize();
} catch (final WaveServerException e) {
Modified: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -65,8 +65,8 @@
final Injector childInjector = injector.createChildInjector(wavePersistModule,
FinderRegistry.init(new JpaPersistModule(TestConstants.PERSISTENCE_UNIT)),
new ListsServerModule(), new RobotApiModule(), new PlatformServerModule(),
- new DocumentServerModule(), new ChatServerModule(), new ServerModule(false), federationModule,
- new WikiServerModule(), new TaskServerModule(), new BarterServerModule(),
+ new DocumentServerModule(), new ChatServerModule(), new ServerModule(false, 1, 2, 2),
+ federationModule, new WikiServerModule(), new TaskServerModule(), new BarterServerModule(),
new EventsServerModule(), new AbstractModule() {
@Override
protected void configure() {
Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java 2011-12-07 12:18:53 UTC (rev 1637)
+++ trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java 2011-12-12 21:47:20 UTC (rev 1638)
@@ -32,6 +32,7 @@
import java.util.TreeSet;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.waveprotocol.wave.model.waveref.WaveRef;
@@ -57,6 +58,27 @@
ParticipantUtils participantUtils;
@Test
+ @Ignore
+ public void addAndDelMainParticipant() throws IOException {
+ doLogin();
+ final WaveRef waveletName = createTestWave();
+ assertNotNull(waveletName);
+ manager.addParticipants(waveletName, getSiteAdminShortName(), NEW_PARTICIPANT);
+
+ final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName());
+ assertNotNull(fetchWavelet);
+ assertEquals(2, fetchWavelet.getParticipants().size());
+ assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT));
+ assertTrue(manager.isParticipant(fetchWavelet, getSiteAdminShortName()));
+ // Del all
+ manager.delParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName());
+ // This fails because we don't have a way to access to than wave now ...
+ // @domain don't work neither
+ final Wavelet fetchedAfterDeleted = manager.fetchWave(waveletName, "");
+ assertNotNull(fetchedAfterDeleted);
+ }
+
+ @Test
public void addAndDelParticipantTwice() throws IOException {
doLogin();
final WaveRef waveletName = createTestWave();
@@ -72,7 +94,7 @@
assertEquals(2, fetchWavelet.getParticipants().size());
assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT));
assertTrue(manager.isParticipant(fetchWavelet, getSiteAdminShortName()));
- // Del all
+ // Del main editor
manager.delParticipants(waveletName, getSiteAdminShortName(), NEW_PARTICIPANT, NEW_PARTICIPANT,
getSiteAdminShortName(), getSiteAdminShortName());
}
1
0
r1637 - in trunk/src: main/java/cc/kune/gspace/client main/java/cc/kune/wave/server test/java/cc/kune/wave/server
by Vicente J. Ruiz Jurado 07 Dec '11
by Vicente J. Ruiz Jurado 07 Dec '11
07 Dec '11
Author: vjrj_
Date: 2011-12-07 13:18:53 +0100 (Wed, 07 Dec 2011)
New Revision: 1637
Modified:
trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java
trunk/src/main/java/cc/kune/wave/server/KuneWaveServiceDefault.java
trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java
Log:
CLOSED - # 177: List posts don't add participants correctly
http://kune.ourproject.org/issues/ticket/177
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java 2011-12-06 19:55:44 UTC (rev 1636)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmorImpl.java 2011-12-07 12:18:53 UTC (rev 1637)
@@ -127,7 +127,8 @@
@Override
public void clearBackImage() {
- DOM.setStyleAttribute(mainpanel.getElement(), CSS.A.BACKGROUND, "transparent");
+ final String bodyProp = "#FFFFFF";
+ DOM.setStyleAttribute(groupSpaceWrapper.getElement(), CSS.A.BACKGROUND, bodyProp);
}
@Override
Modified: trunk/src/main/java/cc/kune/wave/server/KuneWaveServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/KuneWaveServiceDefault.java 2011-12-06 19:55:44 UTC (rev 1636)
+++ trunk/src/main/java/cc/kune/wave/server/KuneWaveServiceDefault.java 2011-12-07 12:18:53 UTC (rev 1637)
@@ -20,6 +20,7 @@
package cc.kune.wave.server;
import java.net.URL;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -27,6 +28,7 @@
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.TreeSet;
import javax.annotation.Nonnull;
@@ -70,6 +72,7 @@
import com.google.wave.api.OperationQueue;
import com.google.wave.api.OperationRequest;
import com.google.wave.api.OperationRequest.Parameter;
+import com.google.wave.api.Participants;
import com.google.wave.api.ProtocolVersion;
import com.google.wave.api.Range;
import com.google.wave.api.Wavelet;
@@ -186,27 +189,22 @@
public void addParticipants(final WaveRef waveName, final String author, final String userWhoAdds,
final String... newLocalParticipants) {
final Wavelet wavelet = fetchWave(waveName, author);
- final OperationQueue opQueue = new OperationQueue();
-
- for (final String newLocalParticipant : newLocalParticipants) {
- final String newPartWithDomain = participantUtils.of(newLocalParticipant).toString();
- boolean mustAdd = true;
- for (final String current : wavelet.getParticipants()) {
- if (current.equals(newPartWithDomain)) {
- // Current user is a participant already (issue #73)
- mustAdd = false;
- break;
- }
- }
- if (mustAdd) {
+ final Participants currentParticipants = wavelet.getParticipants();
+ // Removing duplicates
+ for (final String participant : toSet(newLocalParticipants)) {
+ final String newPartWithDomain = participantUtils.of(participant).toString();
+ if (!currentParticipants.contains(newPartWithDomain)) {
+ // FIXME This is very costly. Seems like only one participant per
+ // opQueue is added (try to
+ // fix this in WAVE)
+ final OperationQueue opQueue = new OperationQueue();
+ LOG.debug("Adding as participant: " + newPartWithDomain);
opQueue.addParticipantToWavelet(wavelet, newPartWithDomain);
+ final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds
+ : author;
+ doOperation(whoAdd, opQueue, "add participant");
}
}
- if (opQueue.getPendingOperations().size() > 0) {
- final String whoAdd = wavelet.getParticipants().contains(participantUtils.of(userWhoAdds)) ? userWhoAdds
- : author;
- doOperation(whoAdd, opQueue, "add participant");
- }
}
@Override
@@ -307,38 +305,24 @@
return createWave(title, message, NO_WAVE_TO_COPY, gadgetUrl, participantsArray);
}
- // public void appendGadget(final WaveRef waveName, URL gadgetUrl, final
- // String author, boolean toRoot) {
- // final Wavelet wavelet = fetchWave(waveName, author);
- // final OperationQueue opQueue = new OperationQueue();
- // opQueue.
- // final Gadget gadget = new Gadget(gadgetUrl.toString());
- // Blip blip = toRoot? wavelet.getRootBlip():
- // opQueue.appendBlipToWavelet(wavelet, author);
- // blip.append(gadget);
- // }
-
@Override
- public void delParticipants(final WaveRef waveName, final String whoDel, final String... participants) {
+ public void delParticipants(final WaveRef waveName, final String whoDel,
+ final String... participantsToDel) {
final Wavelet wavelet = fetchWave(waveName, whoDel);
- final OperationQueue opQueue = new OperationQueue();
-
- for (final String participant : participants) {
+ final Participants currentParticipants = wavelet.getParticipants();
+ final Set<String> set = toSet(participantsToDel);
+ LOG.debug("Removing participants: " + set.toString());
+ for (final String participant : set) {
+ // FIXME Seems like only one participant per opQueue is added (try to fix
+ // this in WAVE)
final String partWithDomain = participantUtils.of(participant).toString();
- boolean mustDel = false;
- for (final String current : wavelet.getParticipants()) {
- if (current.equals(partWithDomain)) {
- mustDel = true;
- break;
- }
- }
- if (mustDel) {
+ if (currentParticipants.contains(partWithDomain)) {
+ final OperationQueue opQueue = new OperationQueue();
+ LOG.debug("Removing as participant: " + partWithDomain);
opQueue.removeParticipantFromWavelet(wavelet, partWithDomain);
+ doOperation(whoDel, opQueue, "del participant");
}
}
- if (opQueue.getPendingOperations().size() > 0) {
- doOperation(whoDel, opQueue, "add participant");
- }
}
private void doOperation(final String author, final OperationQueue opQueue, final String logComment) {
@@ -374,6 +358,17 @@
OperationUtil.submitDeltas(context, waveletProvider, listener);
}
+ // public void appendGadget(final WaveRef waveName, URL gadgetUrl, final
+ // String author, boolean toRoot) {
+ // final Wavelet wavelet = fetchWave(waveName, author);
+ // final OperationQueue opQueue = new OperationQueue();
+ // opQueue.
+ // final Gadget gadget = new Gadget(gadgetUrl.toString());
+ // Blip blip = toRoot? wavelet.getRootBlip():
+ // opQueue.appendBlipToWavelet(wavelet, author);
+ // blip.append(gadget);
+ // }
+
@Override
public Wavelet fetchWave(final WaveId waveId, final WaveletId waveletId, final String author) {
final OperationQueue opQueue = new OperationQueue();
@@ -389,6 +384,7 @@
onFailure(context.getResponse(reqId).getErrorMessage());
} else {
// Duplicate code from WaveService
+ assert response != null;
final WaveletData waveletData = (WaveletData) response.getData().get(ParamsProperty.WAVELET_DATA);
final Map<String, Blip> blips = new HashMap<String, Blip>();
final Map<String, BlipThread> threads = new HashMap<String, BlipThread>();
@@ -453,4 +449,10 @@
doOperation(author, opQueue, "set title");
}
+ private Set<String> toSet(final String[] array) {
+ final Set<String> set = new TreeSet<String>(Collections.reverseOrder());
+ set.addAll(Arrays.asList(array));
+ return set;
+ }
+
}
Modified: trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java 2011-12-06 19:55:44 UTC (rev 1636)
+++ trunk/src/test/java/cc/kune/wave/server/KuneWaveServiceDefaultTest.java 2011-12-07 12:18:53 UTC (rev 1637)
@@ -26,6 +26,10 @@
import java.io.IOException;
import java.net.URL;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.TreeSet;
import org.junit.Before;
import org.junit.Test;
@@ -42,6 +46,7 @@
private static final String MESSAGE = "testing";
private static final String NEW_PARTICIPANT = "newparti";
+ private static final String NEW_PARTICIPANT2 = "newparti2";
private static final String RICHTEXT_MESSAGE = "<b>" + MESSAGE + "</b>";
private static final String TEST_GADGET = "http://wave-api.appspot.com/public/gadgets/areyouin/gadget.xml";
private static final String TITLE = "title";
@@ -52,26 +57,51 @@
ParticipantUtils participantUtils;
@Test
+ public void addAndDelParticipantTwice() throws IOException {
+ doLogin();
+ final WaveRef waveletName = createTestWave();
+ assertNotNull(waveletName);
+ manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+ NEW_PARTICIPANT);
+ manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+ NEW_PARTICIPANT, NEW_PARTICIPANT);
+ manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+ NEW_PARTICIPANT, NEW_PARTICIPANT, NEW_PARTICIPANT);
+ final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName());
+ assertNotNull(fetchWavelet);
+ assertEquals(2, fetchWavelet.getParticipants().size());
+ assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT));
+ assertTrue(manager.isParticipant(fetchWavelet, getSiteAdminShortName()));
+ // Del all
+ manager.delParticipants(waveletName, getSiteAdminShortName(), NEW_PARTICIPANT, NEW_PARTICIPANT,
+ getSiteAdminShortName(), getSiteAdminShortName());
+ }
+
+ @Test
public void addAndRemoveParticipant() throws IOException {
doLogin();
final String whoDels = getSiteAdminShortName();
final WaveRef waveletName = createTestWave();
assertNotNull(waveletName);
- manager.addParticipants(waveletName, getSiteAdminShortName(), whoDels, NEW_PARTICIPANT);
+ manager.addParticipants(waveletName, getSiteAdminShortName(), whoDels, NEW_PARTICIPANT,
+ NEW_PARTICIPANT2);
final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName());
assertNotNull(fetchWavelet);
- assertEquals(2, fetchWavelet.getParticipants().size());
+ assertEquals(3, fetchWavelet.getParticipants().size());
assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT));
+ assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT2));
assertTrue(manager.isParticipant(fetchWavelet, getSiteAdminShortName()));
- manager.delParticipants(waveletName, whoDels, NEW_PARTICIPANT);
+ manager.delParticipants(waveletName, whoDels, NEW_PARTICIPANT, NEW_PARTICIPANT2);
final Wavelet fetchDelWavelet = manager.fetchWave(waveletName, getSiteAdminShortName());
assertNotNull(fetchDelWavelet);
assertEquals(1, fetchDelWavelet.getParticipants().size());
assertTrue(manager.isParticipant(fetchDelWavelet, getSiteAdminShortName()));
assertFalse(manager.isParticipant(fetchDelWavelet, NEW_PARTICIPANT));
- manager.addParticipants(waveletName, getSiteAdminShortName(), whoDels, NEW_PARTICIPANT);
- // Del all
- manager.delParticipants(waveletName, whoDels, getSiteAdminShortName(), NEW_PARTICIPANT);
+ assertFalse(manager.isParticipant(fetchDelWavelet, NEW_PARTICIPANT2));
+ manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
+ NEW_PARTICIPANT);
+ // Del all (the last, the whoDels...)
+ manager.delParticipants(waveletName, whoDels, NEW_PARTICIPANT, getSiteAdminShortName());
}
@Test
@@ -82,6 +112,17 @@
manager.addGadget(waveletName, getSiteAdminShortName(), new URL(TEST_GADGET));
}
+ @Test
+ public void addingToSetMaintainsOrder() throws IOException {
+ final String[] array = new String[] { NEW_PARTICIPANT, NEW_PARTICIPANT, NEW_PARTICIPANT2,
+ NEW_PARTICIPANT2 };
+ final Set<String> set = new TreeSet<String>(Arrays.asList(array));
+ assertTrue(set.size() == 2);
+ final Iterator<String> iterator = set.iterator();
+ assertTrue(iterator.next().equals(NEW_PARTICIPANT));
+ assertTrue(iterator.next().equals(NEW_PARTICIPANT2));
+ }
+
private void addParticipant(final String whoAdds) throws IOException {
doLogin();
final WaveRef waveletName = createTestWave();
@@ -95,24 +136,6 @@
}
@Test
- public void addParticipantTwice() throws IOException {
- doLogin();
- final WaveRef waveletName = createTestWave();
- assertNotNull(waveletName);
- manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
- NEW_PARTICIPANT);
- manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
- NEW_PARTICIPANT, NEW_PARTICIPANT);
- manager.addParticipants(waveletName, getSiteAdminShortName(), getSiteAdminShortName(),
- NEW_PARTICIPANT, NEW_PARTICIPANT, NEW_PARTICIPANT);
- final Wavelet fetchWavelet = manager.fetchWave(waveletName, getSiteAdminShortName());
- assertNotNull(fetchWavelet);
- assertEquals(2, fetchWavelet.getParticipants().size());
- assertTrue(manager.isParticipant(fetchWavelet, NEW_PARTICIPANT));
- assertTrue(manager.isParticipant(fetchWavelet, getSiteAdminShortName()));
- }
-
- @Test
public void authorAddParticipant() throws DefaultException, IOException {
final String whoAdds = getSiteAdminShortName();
addParticipant(whoAdds);
1
0
Author: vjrj_
Date: 2011-12-06 20:55:44 +0100 (Tue, 06 Dec 2011)
New Revision: 1636
Modified:
trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java
trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java
trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/actions/AcceptJoinGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/DenyJoinGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java
trunk/src/main/java/cc/kune/core/server/stats/StatsServiceDefault.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContentAction.java
trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
trunk/src/main/java/cc/kune/gspace/client/actions/SetAsHomePageMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java
trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeManager.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java
trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java
trunk/src/main/java/cc/kune/msgs/public/kune-message.css
trunk/src/main/webapp/ws.html
Log:
CLOSED - # 151: Add scrolls to user and group stats in home page
http://kune.ourproject.org/issues/ticket/151
CLOSED - # 86: No results in search, don't show any message
http://kune.ourproject.org/issues/ticket/86
CLOSED - # 87: Set browser window title when on Inbox and Home
http://kune.ourproject.org/issues/ticket/87
Modified: trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/chat/client/actions/NewRoomBtn.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -88,7 +88,7 @@
@Override
public void onClick(final ClickEvent event) {
if (diag.isValid()) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
final String groupShortName = session.getCurrentState().getGroup().getShortName();
final StateToken parentToken = session.getContainerState().getRootContainer().getStateToken();
contentService.get().addRoom(session.getUserHash(), parentToken,
Modified: trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -145,11 +145,12 @@
}
public static void showProgressLoading() {
+ // Better empty message
eventBus.fireEvent(new ProgressShowEvent());
}
- public static void showProgressProcessing() {
- eventBus.fireEvent(new ProgressShowEvent());
+ public static void showProgressSearching() {
+ eventBus.fireEvent(new ProgressShowEvent(i18n.t("Searching")));
}
public static void veryImportant(final String message) {
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterPresenter.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -102,7 +102,7 @@
public void doRegister() {
signInProvider.get().hide();
if (!session.isLogged()) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
getView().show();
// getView().center();
NotifyUser.hideProgress();
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-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/groups/newgroup/NewGroupPresenter.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -98,7 +98,7 @@
@Override
public void onSuccess(final Void result) {
if (session.isLogged()) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
getView().show();
getView().focusOnShorName();
NotifyUser.hideProgress();
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/MultivalueSuggestBox.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -42,6 +42,8 @@
import java.util.Map;
import cc.kune.common.client.log.Log;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.shared.SearcherConstants;
import com.google.gwt.event.dom.client.KeyUpEvent;
@@ -309,7 +311,9 @@
if (totSize < 1) {
// if there were no suggestions, then it's an invalid value
updateFormFeedback(FormFeedback.ERROR, "Invalid: " + m_query);
-
+ final OptionSuggestion sugg = new OptionSuggestion(i18n.t("No results"), "#",
+ m_request.getQuery(), m_query);
+ suggs.add(sugg);
} else if (false && totSize == 1) {
// Patch to show always the suggestions
// it's an exact match, so do not bother with showing suggestions,
@@ -420,7 +424,6 @@
if (query.length() > 0 && mvalueMap.get(query) == null) {
// JSUtil.println("getting Suggestions for: " + query);
updateFormFeedback(FormFeedback.LOADING, null);
-
queryOptions(query, mindexFrom, mindexTo, new RestSuggestCallback(mrequest, mcallback, query));
}
}
@@ -447,7 +450,7 @@
mtimer.schedule(DELAY);
}
}
- private static final int DELAY = 1000;
+ private static final int DELAY = 500;
private static final String DISPLAY_SEPARATOR = ", ";
private static final int FIND_EXACT_MATCH_QUERY_LIMIT = 20;
@@ -475,8 +478,10 @@
return str;
}
+ private final I18nUITranslationService i18n;
private final FormFeedback mfeedback;
private final SuggestBox mfield;
+
private int mfindExactMatchesFound = 0;
private final ArrayList<String> mfindExactMatchesNot = new ArrayList<String>();
@@ -488,8 +493,8 @@
private int mindexTo = 0;
private boolean misMultivalued = false;
+ private final String mrestEndpointUrl;
- private final String mrestEndpointUrl;
private final Map<String, String> mvalueMap;
// private final OnExactMatch onExactMatch;
@@ -497,6 +502,8 @@
/**
* Constructor.
*
+ * @param i18n
+ *
* @param the
* URL for the REST endpoint. This URL should accept the parameters q
* (for query), indexFrom and indexTo
@@ -504,8 +511,9 @@
* - true for allowing multiple values
* @param onExactMatch
*/
- public MultivalueSuggestBox(final String restEndpointUrl, final boolean isMultivalued,
- final OnExactMatch onExactMatch) {
+ public MultivalueSuggestBox(final I18nUITranslationService i18n, final String restEndpointUrl,
+ final boolean isMultivalued, final OnExactMatch onExactMatch) {
+ this.i18n = i18n;
mrestEndpointUrl = restEndpointUrl;
misMultivalued = isMultivalued;
// this.onExactMatch = onExactMatch;
@@ -917,8 +925,15 @@
final TextBoxBase textBox = mfield.getTextBox();
if (FormFeedback.LOADING == status) {
+ NotifyUser.showProgressSearching();
// textBox.setEnabled(false);
} else {
+ new Timer() {
+ @Override
+ public void run() {
+ NotifyUser.hideProgress();
+ }
+ }.schedule(1500);
// textBox.setEnabled(true);
textBox.setFocus(false); // Blur then focus b/c of a strange problem with
// the cursor or selection highlights no longer
@@ -927,5 +942,4 @@
textBox.setFocus(true);
}
}
-
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SearchBoxFactory.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -33,6 +33,7 @@
public static MultivalueSuggestBox create(final I18nUITranslationService i18n,
final boolean searchOnlyUsers, final String id, final OnEntitySelectedInSearch callback) {
final MultivalueSuggestBox multivalueSBox = new MultivalueSuggestBox(
+ i18n,
searchOnlyUsers ? SearcherConstants.USER_DATA_PROXY_URL : SearcherConstants.GROUP_DATA_PROXY_URL,
false, new OnExactMatch() {
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -31,6 +31,7 @@
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.ToggleButton;
import com.google.gwt.user.client.ui.UIObject;
@@ -154,6 +155,11 @@
}
@Override
+ public void setWindowTitle(final String title) {
+ Window.setTitle(title);
+ }
+
+ @Override
public void showGroupSpaceTooltip() {
groupSpaceTooltip.showTemporally();
}
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-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -86,6 +86,8 @@
void setUserBtnDown(boolean down);
+ void setWindowTitle(String title);
+
void showGroupSpaceTooltip();
void showHomeSpaceTooltip();
@@ -192,6 +194,7 @@
backManager.clearBackImage();
setDown(Space.homeSpace);
currentSpace = Space.homeSpace;
+ getView().setWindowTitle(i18n.t("Home"));
}
private void onPublicSpaceSelect(final boolean shouldRestoreToken) {
@@ -261,6 +264,7 @@
backManager.clearBackImage();
setDown(Space.userSpace);
currentSpace = Space.userSpace;
+ getView().setWindowTitle(i18n.t("Inbox"));
} else {
signIn.get().setErrorMessage(i18n.t("Sign in or create an account to access to your inbox"),
NotifyLevel.info);
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/AcceptJoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/AcceptJoinGroupAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/AcceptJoinGroupAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -36,36 +36,37 @@
import com.google.inject.Provider;
public class AcceptJoinGroupAction extends AbstractExtendedAction {
- private final I18nTranslationService i18n;
- private final Session session;
- private final Provider<SocialNetworkServiceAsync> snServiceProvider;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final Provider<SocialNetworkServiceAsync> snServiceProvider;
- private final StateManager stateManager;
+ private final StateManager stateManager;
- @Inject
- public AcceptJoinGroupAction(final StateManager stateManager, final Session session,
- final I18nTranslationService i18n, final CoreResources res,
- final Provider<SocialNetworkServiceAsync> snServiceProvider) {
- this.stateManager = stateManager;
- this.session = session;
- this.i18n = i18n;
- this.snServiceProvider = snServiceProvider;
- putValue(NAME, i18n.t("Accept this member"));
- putValue(Action.SMALL_ICON, res.accept());
- }
+ @Inject
+ public AcceptJoinGroupAction(final StateManager stateManager, final Session session,
+ final I18nTranslationService i18n, final CoreResources res,
+ final Provider<SocialNetworkServiceAsync> snServiceProvider) {
+ this.stateManager = stateManager;
+ this.session = session;
+ this.i18n = i18n;
+ this.snServiceProvider = snServiceProvider;
+ putValue(NAME, i18n.t("Accept this member"));
+ putValue(Action.SMALL_ICON, res.accept());
+ }
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
- snServiceProvider.get().acceptJoinGroup(session.getUserHash(), session.getCurrentState().getStateToken(),
- ((GroupDTO) event.getTarget()).getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() {
- @Override
- public void onSuccess(final SocialNetworkDataDTO result) {
- NotifyUser.hideProgress();
- NotifyUser.info(i18n.t("Member accepted"));
- stateManager.setSocialNetwork(result);
- }
- });
- }
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgress();
+ snServiceProvider.get().acceptJoinGroup(session.getUserHash(),
+ session.getCurrentState().getStateToken(), ((GroupDTO) event.getTarget()).getShortName(),
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ @Override
+ public void onSuccess(final SocialNetworkDataDTO result) {
+ NotifyUser.hideProgress();
+ NotifyUser.info(i18n.t("Member accepted"));
+ stateManager.setSocialNetwork(result);
+ }
+ });
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToAdminAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -55,7 +55,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
snServiceProvider.get().setCollabAsAdmin(session.getUserHash(),
session.getCurrentState().getStateToken(), ((GroupDTO) event.getTarget()).getShortName(),
new AsyncCallbackSimple<SocialNetworkDataDTO>() {
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/ChangeToCollabAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -36,35 +36,36 @@
import com.google.inject.Provider;
public class ChangeToCollabAction extends AbstractExtendedAction {
- private final I18nTranslationService i18n;
- private final Session session;
- private final Provider<SocialNetworkServiceAsync> snServiceProvider;
- private final StateManager stateManager;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final Provider<SocialNetworkServiceAsync> snServiceProvider;
+ private final StateManager stateManager;
- @Inject
- public ChangeToCollabAction(final StateManager stateManager, final Session session,
- final I18nTranslationService i18n, final CoreResources res,
- final Provider<SocialNetworkServiceAsync> snServiceProvider) {
- this.stateManager = stateManager;
- this.session = session;
- this.i18n = i18n;
- this.snServiceProvider = snServiceProvider;
- putValue(NAME, i18n.t("Change to collaborator"));
- putValue(Action.SMALL_ICON, res.arrowDownGreen());
- }
+ @Inject
+ public ChangeToCollabAction(final StateManager stateManager, final Session session,
+ final I18nTranslationService i18n, final CoreResources res,
+ final Provider<SocialNetworkServiceAsync> snServiceProvider) {
+ this.stateManager = stateManager;
+ this.session = session;
+ this.i18n = i18n;
+ this.snServiceProvider = snServiceProvider;
+ putValue(NAME, i18n.t("Change to collaborator"));
+ putValue(Action.SMALL_ICON, res.arrowDownGreen());
+ }
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
- snServiceProvider.get().setAdminAsCollab(session.getUserHash(), session.getCurrentState().getStateToken(),
- ((GroupDTO) event.getTarget()).getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() {
- @Override
- public void onSuccess(final SocialNetworkDataDTO result) {
- NotifyUser.hideProgress();
- NotifyUser.info(i18n.t("Member type changed"));
- stateManager.setSocialNetwork(result);
- }
- });
- }
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgress();
+ snServiceProvider.get().setAdminAsCollab(session.getUserHash(),
+ session.getCurrentState().getStateToken(), ((GroupDTO) event.getTarget()).getShortName(),
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ @Override
+ public void onSuccess(final SocialNetworkDataDTO result) {
+ NotifyUser.hideProgress();
+ NotifyUser.info(i18n.t("Member type changed"));
+ stateManager.setSocialNetwork(result);
+ }
+ });
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/DenyJoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/DenyJoinGroupAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/DenyJoinGroupAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -36,35 +36,36 @@
import com.google.inject.Provider;
public class DenyJoinGroupAction extends AbstractExtendedAction {
- private final I18nTranslationService i18n;
- private final Session session;
- private final Provider<SocialNetworkServiceAsync> snServiceProvider;
- private final StateManager stateManager;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final Provider<SocialNetworkServiceAsync> snServiceProvider;
+ private final StateManager stateManager;
- @Inject
- public DenyJoinGroupAction(final StateManager stateManager, final Session session,
- final I18nTranslationService i18n, final CoreResources res,
- final Provider<SocialNetworkServiceAsync> snServiceProvider) {
- this.stateManager = stateManager;
- this.session = session;
- this.i18n = i18n;
- this.snServiceProvider = snServiceProvider;
- putValue(NAME, i18n.t("Reject as member"));
- putValue(Action.SMALL_ICON, res.cancel());
- }
+ @Inject
+ public DenyJoinGroupAction(final StateManager stateManager, final Session session,
+ final I18nTranslationService i18n, final CoreResources res,
+ final Provider<SocialNetworkServiceAsync> snServiceProvider) {
+ this.stateManager = stateManager;
+ this.session = session;
+ this.i18n = i18n;
+ this.snServiceProvider = snServiceProvider;
+ putValue(NAME, i18n.t("Reject as member"));
+ putValue(Action.SMALL_ICON, res.cancel());
+ }
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
- snServiceProvider.get().denyJoinGroup(session.getUserHash(), session.getCurrentState().getStateToken(),
- ((GroupDTO) event.getTarget()).getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() {
- @Override
- public void onSuccess(final SocialNetworkDataDTO result) {
- NotifyUser.hideProgress();
- NotifyUser.info(i18n.t("Member rejected"));
- stateManager.setSocialNetwork(result);
- }
- });
- }
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgress();
+ snServiceProvider.get().denyJoinGroup(session.getUserHash(),
+ session.getCurrentState().getStateToken(), ((GroupDTO) event.getTarget()).getShortName(),
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ @Override
+ public void onSuccess(final SocialNetworkDataDTO result) {
+ NotifyUser.hideProgress();
+ NotifyUser.info(i18n.t("Member rejected"));
+ stateManager.setSocialNetwork(result);
+ }
+ });
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -70,7 +70,7 @@
@Override
public void onSuccess() {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
snServiceProvider.get().requestJoinGroup(session.getUserHash(),
session.getCurrentState().getStateToken(),
new AsyncCallbackSimple<SocialNetworkRequestResult>() {
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/RemoveMemberAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -36,35 +36,36 @@
import com.google.inject.Provider;
public class RemoveMemberAction extends AbstractExtendedAction {
- private final I18nTranslationService i18n;
- private final Session session;
- private final Provider<SocialNetworkServiceAsync> snServiceProvider;
- private final StateManager stateManager;
+ private final I18nTranslationService i18n;
+ private final Session session;
+ private final Provider<SocialNetworkServiceAsync> snServiceProvider;
+ private final StateManager stateManager;
- @Inject
- public RemoveMemberAction(final StateManager stateManager, final Session session,
- final I18nTranslationService i18n, final CoreResources res,
- final Provider<SocialNetworkServiceAsync> snServiceProvider) {
- this.stateManager = stateManager;
- this.session = session;
- this.i18n = i18n;
- this.snServiceProvider = snServiceProvider;
- putValue(NAME, i18n.t("Remove this member"));
- putValue(Action.SMALL_ICON, res.del());
- }
+ @Inject
+ public RemoveMemberAction(final StateManager stateManager, final Session session,
+ final I18nTranslationService i18n, final CoreResources res,
+ final Provider<SocialNetworkServiceAsync> snServiceProvider) {
+ this.stateManager = stateManager;
+ this.session = session;
+ this.i18n = i18n;
+ this.snServiceProvider = snServiceProvider;
+ putValue(NAME, i18n.t("Remove this member"));
+ putValue(Action.SMALL_ICON, res.del());
+ }
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
- snServiceProvider.get().deleteMember(session.getUserHash(), session.getCurrentState().getStateToken(),
- ((GroupDTO) event.getTarget()).getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() {
- @Override
- public void onSuccess(final SocialNetworkDataDTO result) {
- NotifyUser.hideProgress();
- NotifyUser.info(i18n.t("Member removed"));
- stateManager.refreshCurrentStateWithoutCache();
- }
- });
- }
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.showProgress();
+ snServiceProvider.get().deleteMember(session.getUserHash(),
+ session.getCurrentState().getStateToken(), ((GroupDTO) event.getTarget()).getShortName(),
+ new AsyncCallbackSimple<SocialNetworkDataDTO>() {
+ @Override
+ public void onSuccess(final SocialNetworkDataDTO result) {
+ NotifyUser.hideProgress();
+ NotifyUser.info(i18n.t("Member removed"));
+ stateManager.refreshCurrentStateWithoutCache();
+ }
+ });
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromCurrentGroupAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -56,7 +56,7 @@
new OnAcceptCallback() {
@Override
public void onSuccess() {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
snServiceProvider.get().unJoinGroup(session.getUserHash(),
session.getCurrentState().getStateToken(), new AsyncCallbackSimple<Void>() {
@Override
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/UnJoinFromThisGroupAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -71,7 +71,7 @@
new OnAcceptCallback() {
@Override
public void onSuccess() {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
snServiceProvider.get().unJoinGroup(session.getUserHash(),
((GroupDTO) event.getTarget()).getStateToken(), new AsyncCallbackSimple<Void>() {
@Override
Modified: trunk/src/main/java/cc/kune/core/server/stats/StatsServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/stats/StatsServiceDefault.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/core/server/stats/StatsServiceDefault.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -30,7 +30,7 @@
public class StatsServiceDefault implements StatsService {
- private static final int LIMIT = 6;
+ private static final int LIMIT = 20; // Before 6
private final ContentFinder contentFinder;
private final GroupFinder groupFinder;
private final UserFinder userFinder;
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerBtn.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -62,7 +62,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
stateManager.gotoStateToken(((HasContent) session.getCurrentState()).getContainer().getStateToken());
final String newName = (String) getValue(NEW_NAME);
final StateToken parentToken = session.getCurrentStateToken();
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -68,7 +68,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
stateManager.gotoStateToken(((HasContent) session.getCurrentState()).getContainer().getStateToken());
final String newName = (String) getValue(NEW_NAME);
final StateToken parentToken = session.getCurrentStateToken();
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContentAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContentAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContentAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -60,7 +60,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
// stateManager.gotoStateToken(((HasContent)
// session.getCurrentState()).getContainer().getStateToken());
final String newName = (String) getValue(NEW_NAME);
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -56,7 +56,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
contentService.get().addParticipant(session.getUserHash(), session.getCurrentStateToken(),
session.getCurrentUser().getShortName(), new AsyncCallbackSimple<Void>() {
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/SetAsHomePageMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/SetAsHomePageMenuItem.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/SetAsHomePageMenuItem.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -56,7 +56,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
final StateToken token = ((AbstractContentSimpleDTO) event.getTarget()).getStateToken();
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
contentService.get().setAsDefaultContent(session.getUserHash(), token,
new AsyncCallbackSimple<ContentSimpleDTO>() {
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/gspace/client/licensewizard/LicenseChangeAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -53,7 +53,7 @@
public void changeLicense(final StateToken token, final LicenseDTO license,
final SimpleResponseCallback callback) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
groupService.get().changeDefLicense(session.getUserHash(), token, license,
new AsyncCallbackSimple<Void>() {
@Override
Modified: trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeManager.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeManager.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/gspace/client/themes/GSpaceThemeManager.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -90,7 +90,7 @@
}
public void changeTheme(final StateToken token, final GSpaceTheme newTheme) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
groupServiceProvider.get().changeGroupWsTheme(session.getUserHash(), token, newTheme.getName(),
new AsyncCallbackSimple<Void>() {
@Override
@@ -104,7 +104,7 @@
}
protected void onChangeGroupWsTheme(final GSpaceTheme newTheme) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
groupServiceProvider.get().changeGroupWsTheme(session.getUserHash(),
session.getCurrentState().getStateToken(), newTheme.getName(), new AsyncCallbackSimple<Void>() {
@Override
Modified: trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -88,7 +88,7 @@
@Override
public void onClick(final ClickEvent event) {
if (diag.isValid()) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
diag.hide();
listsService.get().createList(session.getUserHash(), session.getCurrentStateToken(),
diag.getTextFieldValue(), ListsConstants.TYPE_LIST, true,
Modified: trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -94,7 +94,7 @@
@Override
public void onClick(final ClickEvent event) {
if (diag.isValid()) {
- NotifyUser.showProgressProcessing();
+ NotifyUser.showProgress();
diag.hide();
listsService.get().newPost(session.getUserHash(),
session.getCurrentStateToken().copy().clearDocument(), diag.getTextFieldValue(),
Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java 2011-12-06 19:55:44 UTC (rev 1636)
@@ -147,7 +147,7 @@
@Override
public void appendMsg(final String message) {
resetTimer();
- label.setHTML(sanitize(label.getHTML() + "<p>" + message + "</p>"));
+ label.setHTML(sanitize(label.getHTML() + "<p class='k-msg-topsep'>" + message + "</p>"));
}
@Override
Modified: trunk/src/main/java/cc/kune/msgs/public/kune-message.css
===================================================================
--- trunk/src/main/java/cc/kune/msgs/public/kune-message.css 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/java/cc/kune/msgs/public/kune-message.css 2011-12-06 19:55:44 UTC (rev 1636)
@@ -29,6 +29,10 @@
top: 0px;
}
+.k-msg-topsep {
+ border-top: solid 1px wheat;
+}
+
.k-msg-icon {
padding: 10px 10px 5px;
}
Modified: trunk/src/main/webapp/ws.html
===================================================================
--- trunk/src/main/webapp/ws.html 2011-12-06 02:42:39 UTC (rev 1635)
+++ trunk/src/main/webapp/ws.html 2011-12-06 19:55:44 UTC (rev 1636)
@@ -235,6 +235,9 @@
color: #8a5050;
font-size: 16px;
line-height: 1.5em;
+ height: 120px;
+ overflow-y: auto;
+ overflow-x: hidden;
}
.k-home-em-text {
1
0
r1635 - in trunk/src/main: java/cc/kune/chat/client java/cc/kune/chat/client/actions java/cc/kune/common/client/notify java/cc/kune/core/client/notify/msgs java/cc/kune/msgs/client webapp/others
by Vicente J. Ruiz Jurado 06 Dec '11
by Vicente J. Ruiz Jurado 06 Dec '11
06 Dec '11
Author: vjrj_
Date: 2011-12-06 03:42:39 +0100 (Tue, 06 Dec 2011)
New Revision: 1635
Modified:
trunk/src/main/java/cc/kune/chat/client/KuneChatNotifier.java
trunk/src/main/java/cc/kune/chat/client/KuneHablarSignals.java
trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifierViewImpl.java
trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifyEvent.java
trunk/src/main/java/cc/kune/msgs/client/UserMessage.java
trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java
trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.ui.xml
trunk/src/main/webapp/others/kune-client-actions.xml
Log:
CLOSED - # 58: NotifyUser messages with title has a bad bottom margin
http://kune.ourproject.org/issues/ticket/58
CLOSED - # 149: Improve the new chat notifications
http://kune.ourproject.org/issues/ticket/149
Modified: trunk/src/main/java/cc/kune/chat/client/KuneChatNotifier.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/KuneChatNotifier.java 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/chat/client/KuneChatNotifier.java 2011-12-06 02:42:39 UTC (rev 1635)
@@ -24,17 +24,23 @@
import cc.kune.core.shared.i18n.I18nTranslationService;
import com.calclab.hablar.signals.client.notifications.HablarNotifier;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.shared.EventBus;
import com.google.gwt.regexp.shared.MatchResult;
import com.google.gwt.regexp.shared.RegExp;
public class KuneChatNotifier implements HablarNotifier {
private final FileDownloadUtils downUtils;
+ private final EventBus eventBus;
private final I18nTranslationService i18n;
private final RegExp regExp;
- public KuneChatNotifier(final I18nTranslationService i18n, final FileDownloadUtils downUtils) {
+ public KuneChatNotifier(final I18nTranslationService i18n, final FileDownloadUtils downUtils,
+ final EventBus eventBus) {
this.i18n = i18n;
this.downUtils = downUtils;
+ this.eventBus = eventBus;
regExp = RegExp.compile("User (.*) says «(.*)»");
}
@@ -55,7 +61,12 @@
final MatchResult m = regExp.exec(userMessage);
final String user = m.getGroup(1);
NotifyUser.avatar(downUtils.getUserAvatar(user),
- i18n.t("User [%s] says «[%s]»", user, m.getGroup(2)));
+ i18n.t("User [%s] says «[%s]»", user, m.getGroup(2)), new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ ShowChatDialogEvent.fire(eventBus, true);
+ }
+ });
} else {
NotifyUser.info(userMessage);
}
Modified: trunk/src/main/java/cc/kune/chat/client/KuneHablarSignals.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/KuneHablarSignals.java 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/chat/client/KuneHablarSignals.java 2011-12-06 02:42:39 UTC (rev 1635)
@@ -99,7 +99,7 @@
// notificationManager.addNotifier((BrowserPopupHablarNotifier)
// GWT.create(BrowserPopupHablarNotifier.class),
// true);
- notificationManager.addNotifier(new KuneChatNotifier(i18n, downUtils), true);
+ notificationManager.addNotifier(new KuneChatNotifier(i18n, downUtils, kuneEventBus), true);
final SignalsPreferencesPresenter preferencesPage = new SignalsPreferencesPresenter(session,
storageManager, hablarEventBus, preferences, new SignalsPreferencesWidget(), notificationManager);
Modified: trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2011-12-06 02:42:39 UTC (rev 1635)
@@ -74,6 +74,7 @@
session.logout();
}
}
+
public class ChangeOnlineStatusAction extends AbstractExtendedAction {
private final ImageResource icon;
private final PresenceManager manager;
@@ -104,6 +105,7 @@
}
}
}
+ private static final int AWAY_TIMER_MILLSECS = 60000;
private static final String GROUP_CHAT_STATUS = "k-group-chat-status";
private static final String NO_STATUS = null;
@@ -203,7 +205,7 @@
}.schedule(1000);
}
} else {
- awayTimer.schedule(3000);
+ awayTimer.schedule(AWAY_TIMER_MILLSECS);
}
}
});
Modified: trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-12-06 02:42:39 UTC (rev 1635)
@@ -26,6 +26,7 @@
import cc.kune.core.client.notify.spiner.ProgressShowEvent;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.resources.client.ImageResource;
@@ -44,8 +45,10 @@
askConfirmation(null, title, message, callback);
}
- public static void avatar(final String url, final String message) {
- eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.avatar.url(url), message));
+ public static void avatar(final String url, final String message, final ClickHandler clickHandler) {
+ final UserNotifyEvent event = new UserNotifyEvent(NotifyLevel.avatar.url(url), message);
+ event.setClickHandler(clickHandler);
+ eventBus.fireEvent(event);
}
public static void error(final String message) {
Modified: trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifierViewImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifierViewImpl.java 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifierViewImpl.java 2011-12-06 02:42:39 UTC (rev 1635)
@@ -26,6 +26,7 @@
import cc.kune.msgs.client.UserMessagesPanel;
import cc.kune.msgs.client.UserMessagesPresenter;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.Widget;
@@ -62,6 +63,10 @@
popup.setCenterPosition();
}
});
+ final ClickHandler clickHandler = event.getClickHandler();
+ if (clickHandler != null) {
+ msg.addClickHandler(clickHandler);
+ }
event.setCloser(new UserNotifyEvent.UserNotifyCloser() {
@Override
public void close() {
Modified: trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifyEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifyEvent.java 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifyEvent.java 2011-12-06 02:42:39 UTC (rev 1635)
@@ -20,8 +20,8 @@
package cc.kune.core.client.notify.msgs;
import cc.kune.common.client.notify.NotifyLevel;
-import cc.kune.msgs.client.CloseCallback;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
@@ -69,8 +69,8 @@
return TYPE;
}
+ private ClickHandler clickHandler;
private final Boolean closeable;
- private CloseCallback closeCallback;
private UserNotifyCloser closer;
private java.lang.String id;
private final NotifyLevel level;
@@ -112,14 +112,14 @@
return TYPE;
}
+ public ClickHandler getClickHandler() {
+ return clickHandler;
+ }
+
public Boolean getCloseable() {
return closeable;
}
- public CloseCallback getCloseCallback() {
- return closeCallback;
- }
-
public UserNotifyCloser getCloser() {
return closer;
}
@@ -140,8 +140,8 @@
return title;
}
- public void setCloseCallback(final CloseCallback closeCallback) {
- this.closeCallback = closeCallback;
+ public void setClickHandler(final ClickHandler clickHandler) {
+ this.clickHandler = clickHandler;
}
public void setCloser(final UserNotifyCloser closer) {
Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessage.java
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessage.java 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessage.java 2011-12-06 02:42:39 UTC (rev 1635)
@@ -1,7 +1,9 @@
package cc.kune.msgs.client;
-public interface UserMessage {
+import com.google.gwt.event.dom.client.HasClickHandlers;
+public interface UserMessage extends HasClickHandlers {
+
void appendMsg(String message);
void close();
Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java 2011-12-06 02:42:39 UTC (rev 1635)
@@ -30,6 +30,8 @@
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.shared.HandlerRegistration;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
@@ -40,6 +42,7 @@
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.InlineHTML;
import com.google.gwt.user.client.ui.PushButton;
@@ -67,6 +70,7 @@
private static int fadeMills = 5000;
private static final MsgTemplate MSG_NO_TITLE = GWT.create(MsgTemplate.class);
+
private static final MsgWithTitleTemplate MSG_WITH_TITLE = GWT.create(MsgWithTitleTemplate.class);
private static UserMessageWidgetUiBinder uiBinder = GWT.create(UserMessageWidgetUiBinder.class);
@@ -89,6 +93,9 @@
@UiField
InlineHTML label;
+ @UiField
+ HorizontalPanel panel;
+
private Timer time;
public UserMessageWidget(final NotifyLevel level, final String title, final String message,
@@ -132,6 +139,12 @@
}
@Override
+ public HandlerRegistration addClickHandler(final ClickHandler handler) {
+ panel.addStyleName("k-pointer");
+ return addDomHandler(handler, ClickEvent.getType());
+ }
+
+ @Override
public void appendMsg(final String message) {
resetTimer();
label.setHTML(sanitize(label.getHTML() + "<p>" + message + "</p>"));
Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.ui.xml 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.ui.xml 2011-12-06 02:42:39 UTC (rev 1635)
@@ -17,7 +17,7 @@
</ui:style>
<ui:with field='img'
type='cc.kune.msgs.client.resources.UserMessageImages'/>
- <g:HorizontalPanel verticalAlignment="ALIGN_MIDDLE"
+ <g:HorizontalPanel ui:field="panel" verticalAlignment="ALIGN_MIDDLE"
addStyleNames="k-msg, k-3corners, {style.k-msg-width}">
<g:SimplePanel addStyleNames="k-msg-icon">
<g:Image width="100%" ui:field="icon" height="100%"/>
Modified: trunk/src/main/webapp/others/kune-client-actions.xml
===================================================================
--- trunk/src/main/webapp/others/kune-client-actions.xml 2011-12-06 01:42:07 UTC (rev 1634)
+++ trunk/src/main/webapp/others/kune-client-actions.xml 2011-12-06 02:42:39 UTC (rev 1635)
@@ -5,6 +5,18 @@
<!-- List of Wave extensions to use in Kune ===================== -->
<waveExtensions>
+
+ <extension>
+ <name>WavePlan</name>
+ <installerUrl>http://sh1.sg.securlogic.com/wave/waveplan/manifest.xml
+ </installerUrl>
+ <gadgetUrl>http://sh1.sg.securlogic.com/wave/waveplan/waveplan.xml
+ </gadgetUrl>
+ <iconUrl>http://sh1.sg.securlogic.com/wave/waveplan/waveplan.png
+ </iconUrl>
+ <iconCss></iconCss>
+ </extension>
+
<extension>
<name>Image</name>
<installerUrl>http://everybodywave.appspot.com/gadget/image/xt.xml
@@ -411,6 +423,40 @@
<participants>ask</participants>
</guiActionDescriptor>
+
+ <guiActionDescriptor>
+ <type>wave-gadget</type>
+ <extensionName>WavePlan</extensionName>
+ <name>New meet planer</name>
+ <path>New Gadget»Calendar</path>
+ <description>This gadget helps you to coordinate multi-participant schedules and make decisions in an intuitive manner.
+ </description>
+ <new-content-title>New meet planner</new-content-title>
+ <new-content-textintro></new-content-textintro>
+ <enabled>true</enabled>
+ <typeIds>
+ <typeId origTypeId="docs.folder" destTypeId="docs.doc"/>
+ <typeId origTypeId="docs.root" destTypeId="docs.doc"/>
+ <typeId origTypeId="blogs.blog" destTypeId="blogs.post"/>
+ <typeId origTypeId="lists.list" destTypeId="lists.post"/>
+ <!-- Add gadget in docs directly: -->
+ <typeId origTypeId="docs.doc" destTypeId="docs.doc"/>
+ <typeId origTypeId="blogs.post" destTypeId="blogs.post"/>
+ <typeId origTypeId="lists.post" destTypeId="lists.post"/>
+ <typeId origTypeId="wiki.wikipage" destTypeId="wiki.wikipage"/>
+ <typeId origTypeId="tasks.task" destTypeId="tasks.task"/>
+ </typeIds>
+ <rol>
+ <!-- Administrator, Editor, Viewer -->
+ <rolRequired>Editor</rolRequired>
+ <authNeed>true</authNeed>
+ </rol>
+ <!-- only for new waves: anyone, onlymembers, onlyadmins, ask (not
+ used yet) -->
+ <participants>ask</participants>
+ </guiActionDescriptor>
+
+
<!-- Media ================================================== -->
<guiActionDescriptor>
1
0
r1634 - in trunk/src: main/java/cc/kune/chat/client main/java/cc/kune/common/client/notify main/java/cc/kune/core/client/auth main/java/cc/kune/core/client/notify/msgs main/java/cc/kune/msgs main/java/cc/kune/msgs/client test/java/cc/kune test/java/cc/kune/msgs test/java/cc/kune/msgs/client
by Vicente J. Ruiz Jurado 06 Dec '11
by Vicente J. Ruiz Jurado 06 Dec '11
06 Dec '11
Author: vjrj_
Date: 2011-12-06 02:42:07 +0100 (Tue, 06 Dec 2011)
New Revision: 1634
Added:
trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java
trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.ui.xml
trunk/src/test/java/cc/kune/msgs/
trunk/src/test/java/cc/kune/msgs/client/
trunk/src/test/java/cc/kune/msgs/client/UserMessagesPresenterTest.java
Removed:
trunk/src/main/java/cc/kune/msgs/client/UserMessage.ui.xml
Modified:
trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java
trunk/src/main/java/cc/kune/chat/client/KuneChatNotifier.java
trunk/src/main/java/cc/kune/chat/client/KuneHablarSignals.java
trunk/src/main/java/cc/kune/common/client/notify/NotifyLevel.java
trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java
trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifierViewImpl.java
trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifyEvent.java
trunk/src/main/java/cc/kune/msgs/KuneMsgs.gwt.xml
trunk/src/main/java/cc/kune/msgs/client/UserMessage.java
trunk/src/main/java/cc/kune/msgs/client/UserMessagesPanel.java
trunk/src/main/java/cc/kune/msgs/client/UserMessagesPresenter.java
Log:
CLOSED - # 98: When using NotifyUser.info/etc messages of the same level must be show together
http://kune.ourproject.org/issues/ticket/98
CLOSED - # 97: Allow NotifyUser with images (useful for chat notifications)
http://kune.ourproject.org/issues/ticket/97
CLOSED - # 168: "You did not sign in" box remains after I've registered
http://kune.ourproject.org/issues/ticket/168
Modified: trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -44,6 +44,7 @@
import cc.kune.core.client.init.AppStartEvent;
import cc.kune.core.client.init.AppStopEvent;
import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.services.FileDownloadUtils;
import cc.kune.core.client.sitebar.SitebarActions;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.UserSignInEvent;
@@ -132,6 +133,7 @@
private final ChatOptions chatOptions;
private final ChatResources chatResources;
private Dialog dialog;
+ private final FileDownloadUtils downUtils;
private final I18nTranslationService i18n;
private final EventBus kuneEventBus;
private final CoreResources res;
@@ -141,16 +143,18 @@
private final GlobalShortcutRegister shorcutRegister;
private final SitebarActions siteActions;
private final SubscriptionManager subscriptionManager;
+
private final XmppSession xmppSession;
@Inject
public ChatClientDefault(final EventBus kuneEventBus, final I18nTranslationService i18n,
final SitebarActions siteActions, final Session session, final CoreResources res,
- final GlobalShortcutRegister shorcutRegister, final ChatOptions chatOptions,
- final ChatResources chatResources, final ChatInstances chatInstances) {
+ final FileDownloadUtils downUtils, final GlobalShortcutRegister shorcutRegister,
+ final ChatOptions chatOptions, final ChatResources chatResources, final ChatInstances chatInstances) {
this.kuneEventBus = kuneEventBus;
this.i18n = i18n;
this.res = res;
+ this.downUtils = downUtils;
this.chatInstances = chatInstances;
action = new ChatClientAction(chatResources);
this.siteActions = siteActions;
@@ -322,7 +326,7 @@
final KuneHablarWidget widget = new KuneHablarWidget(config.layout, config.tabHeaderSize);
final Hablar hablar = widget.getHablar();
HablarComplete.install(hablar, config);
- new KuneHablarSignals(kuneEventBus, xmppSession, hablar, action, chatInstances);
+ new KuneHablarSignals(kuneEventBus, xmppSession, hablar, action, chatInstances, i18n, downUtils);
if (htmlConfig.hasLogger) {
new HablarConsole(hablar);
}
Modified: trunk/src/main/java/cc/kune/chat/client/KuneChatNotifier.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/KuneChatNotifier.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/chat/client/KuneChatNotifier.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -20,24 +20,45 @@
package cc.kune.chat.client;
import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.services.FileDownloadUtils;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import com.calclab.hablar.signals.client.notifications.HablarNotifier;
+import com.google.gwt.regexp.shared.MatchResult;
+import com.google.gwt.regexp.shared.RegExp;
public class KuneChatNotifier implements HablarNotifier {
+ private final FileDownloadUtils downUtils;
+ private final I18nTranslationService i18n;
+ private final RegExp regExp;
- @Override
- public String getDisplayName() {
- return "Bottom notifier";
- }
+ public KuneChatNotifier(final I18nTranslationService i18n, final FileDownloadUtils downUtils) {
+ this.i18n = i18n;
+ this.downUtils = downUtils;
+ regExp = RegExp.compile("User (.*) says «(.*)»");
+ }
- @Override
- public String getId() {
- return "kuneChatNotifier";
- }
+ @Override
+ public String getDisplayName() {
+ return "Bottom notifier";
+ }
- @Override
- public void show(final String userMessage, final String messageType) {
- NotifyUser.info(userMessage);
+ @Override
+ public String getId() {
+ return "kuneChatNotifier";
+ }
+
+ @Override
+ public void show(final String userMessage, final String messageType) {
+ // FIXME Dirty hack while emite/hablar lib don't provide user info
+ if (regExp.test(userMessage)) {
+ final MatchResult m = regExp.exec(userMessage);
+ final String user = m.getGroup(1);
+ NotifyUser.avatar(downUtils.getUserAvatar(user),
+ i18n.t("User [%s] says «[%s]»", user, m.getGroup(2)));
+ } else {
+ NotifyUser.info(userMessage);
}
+ }
}
Modified: trunk/src/main/java/cc/kune/chat/client/KuneHablarSignals.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/KuneHablarSignals.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/chat/client/KuneHablarSignals.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -20,6 +20,8 @@
package cc.kune.chat.client;
import cc.kune.chat.client.ChatClientDefault.ChatClientAction;
+import cc.kune.core.client.services.FileDownloadUtils;
+import cc.kune.core.shared.i18n.I18nTranslationService;
import com.calclab.emite.core.client.xmpp.session.XmppSession;
import com.calclab.emite.xep.storage.client.PrivateStorageManager;
@@ -34,7 +36,6 @@
import com.calclab.hablar.signals.client.unattended.UnattendedPagesManager;
import com.calclab.hablar.signals.client.unattended.UnattendedPresenter;
import com.calclab.hablar.user.client.UserContainer;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasText;
@@ -70,7 +71,8 @@
// FIXME: move to gin
@SuppressWarnings("deprecation")
public KuneHablarSignals(final EventBus kuneEventBus, final XmppSession session, final Hablar hablar,
- final ChatClientAction action, final ChatInstances chatInstances) {
+ final ChatClientAction action, final ChatInstances chatInstances,
+ final I18nTranslationService i18n, final FileDownloadUtils downUtils) {
final HablarEventBus hablarEventBus = hablar.getEventBus();
final PrivateStorageManager storageManager = chatInstances.privateStorageManager;
@@ -97,11 +99,10 @@
// notificationManager.addNotifier((BrowserPopupHablarNotifier)
// GWT.create(BrowserPopupHablarNotifier.class),
// true);
- notificationManager.addNotifier((KuneChatNotifier) GWT.create(KuneChatNotifier.class), true);
+ notificationManager.addNotifier(new KuneChatNotifier(i18n, downUtils), true);
final SignalsPreferencesPresenter preferencesPage = new SignalsPreferencesPresenter(session,
storageManager, hablarEventBus, preferences, new SignalsPreferencesWidget(), notificationManager);
hablar.addPage(preferencesPage, UserContainer.ROL);
}
-
}
Modified: trunk/src/main/java/cc/kune/common/client/notify/NotifyLevel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/notify/NotifyLevel.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/common/client/notify/NotifyLevel.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -20,5 +20,24 @@
package cc.kune.common.client.notify;
public enum NotifyLevel {
- error, important, info, log, veryImportant
+ avatar, error, important, info, log, veryImportant;
+
+ private String url;
+
+ NotifyLevel() {
+ this(null);
+ }
+
+ NotifyLevel(final String url) {
+ this.url = url;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+
+ public NotifyLevel url(final String url) {
+ this.url = url;
+ return this;
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/common/client/notify/NotifyUser.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -44,6 +44,10 @@
askConfirmation(null, title, message, callback);
}
+ public static void avatar(final String url, final String message) {
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.avatar.url(url), message));
+ }
+
public static void error(final String message) {
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error, message));
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -19,26 +19,29 @@
*/
package cc.kune.core.client.auth;
-import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.notify.NotifyLevel;
import cc.kune.common.client.utils.TextUtils;
import cc.kune.core.client.cookies.CookiesManager;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.init.AppStartEvent;
import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
+import cc.kune.core.client.notify.msgs.UserNotifyEvent;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.SiteTokens;
import cc.kune.core.client.state.UserSignInEvent;
import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
+import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
public class AnonUsersManager {
public static final String ANON_MESSAGE_CLOSE_ICON = "k-anon-um-close-btn";
+ protected UserNotifyEvent notifyMsg;
@Inject
public AnonUsersManager(final Session session, final CookiesManager cookiesManager,
- final I18nUITranslationService i18n) {
+ final I18nUITranslationService i18n, final EventBus eventBus) {
session.onAppStart(true, new AppStartHandler() {
@Override
public void onAppStart(final AppStartEvent event) {
@@ -52,13 +55,16 @@
final String signin = TextUtils.generateHtmlLink("#" + SiteTokens.SIGNIN,
i18n.tWithNT("sign in", "register, in lowercase"), false);
final String siteCommonName = i18n.getSiteCommonName();
- NotifyUser.info(
+ notifyMsg = UserNotifyEvent.fire(
+ eventBus,
+ NotifyLevel.info,
"",
i18n.tWithNT(
"You did not sign-in, so you can just see some public contents in [%s], "
+ "but not edit or collaborate with others. Please [%s] or [%s] in order to get full access to [%s] tools and contents",
"This will be something like 'Please register or sign in in other to get full access to this site tools', but instead of %s some links",
- siteCommonName, register, signin, siteCommonName), ANON_MESSAGE_CLOSE_ICON, true);
+ siteCommonName, register, signin, siteCommonName), Boolean.TRUE);
+ notifyMsg.setId(ANON_MESSAGE_CLOSE_ICON);
} else {
if (Boolean.valueOf(anonCookie)) {
// Registered already: we set the cookie for some big period again
@@ -74,6 +80,10 @@
@Override
public void onUserSignIn(final UserSignInEvent event) {
cookiesManager.setAnonCookie(true);
+ if (notifyMsg != null) {
+ // Isue #168, after register/sign-in the message not remains visible
+ notifyMsg.getCloser().close();
+ }
}
});
}
Modified: trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifierViewImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifierViewImpl.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifierViewImpl.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -22,6 +22,7 @@
import cc.kune.common.client.ui.PopupBottomPanel;
import cc.kune.core.client.notify.msgs.UserNotifierPresenter.UserNotifierView;
import cc.kune.msgs.client.CloseCallback;
+import cc.kune.msgs.client.UserMessage;
import cc.kune.msgs.client.UserMessagesPanel;
import cc.kune.msgs.client.UserMessagesPresenter;
@@ -32,36 +33,45 @@
import com.gwtplatform.mvp.client.PopupViewImpl;
public class UserNotifierViewImpl extends PopupViewImpl implements UserNotifierView {
- private final UserMessagesPresenter msgs;
- private final PopupBottomPanel popup;
+ private final UserMessagesPresenter msgs;
+ private final PopupBottomPanel popup;
- @Inject
- public UserNotifierViewImpl(final EventBus eventBus, final UserMessagesPresenter msgs, final UserMessagesPanel panel) {
- super(eventBus);
- this.msgs = msgs;
- msgs.init(panel);
- panel.setWidth("370px");
- popup = new PopupBottomPanel(false, false);
- popup.add(panel);
- popup.show();
- }
+ @Inject
+ public UserNotifierViewImpl(final EventBus eventBus, final UserMessagesPresenter msgs,
+ final UserMessagesPanel panel) {
+ super(eventBus);
+ this.msgs = msgs;
+ msgs.init(panel);
+ panel.setWidth("370px");
+ popup = new PopupBottomPanel(false, false);
+ popup.add(panel);
+ popup.show();
+ }
- @Override
- public Widget asWidget() {
- return popup;
- }
+ @Override
+ public Widget asWidget() {
+ return popup;
+ }
- @Override
- public void notify(final UserNotifyEvent event) {
- msgs.add(event.getLevel(), event.getTitle(), event.getMessage(), event.getId(), event.getCloseable(),
- new CloseCallback() {
- @Override
- public void onClose() {
- popup.setCenterPosition();
- }
- });
- popup.setCenterPosition();
- DOM.setStyleAttribute(popup.getElement(), "zIndex", "100000");
- }
+ @Override
+ public void notify(final UserNotifyEvent event) {
+ final UserMessage msg = msgs.add(event.getLevel(), event.getTitle(), event.getMessage(),
+ event.getId(), event.getCloseable(), new CloseCallback() {
+ @Override
+ public void onClose() {
+ popup.setCenterPosition();
+ }
+ });
+ event.setCloser(new UserNotifyEvent.UserNotifyCloser() {
+ @Override
+ public void close() {
+ if (msg.isAttached()) {
+ msg.close();
+ }
+ }
+ });
+ popup.setCenterPosition();
+ DOM.setStyleAttribute(popup.getElement(), "zIndex", "100000");
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifyEvent.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifyEvent.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/core/client/notify/msgs/UserNotifyEvent.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -20,6 +20,7 @@
package cc.kune.core.client.notify.msgs;
import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.msgs.client.CloseCallback;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
@@ -28,101 +29,127 @@
public class UserNotifyEvent extends GwtEvent<UserNotifyEvent.UserNotifyHandler> {
- public interface HasUserNotifyHandlers extends HasHandlers {
- HandlerRegistration addUserNotifyHandler(UserNotifyHandler handler);
- }
+ public interface HasUserNotifyHandlers extends HasHandlers {
+ HandlerRegistration addUserNotifyHandler(UserNotifyHandler handler);
+ }
- public interface UserNotifyHandler extends EventHandler {
- public void onUserNotify(UserNotifyEvent event);
- }
+ public interface UserNotifyCloser {
+ public void close();
+ }
- private static final Type<UserNotifyHandler> TYPE = new Type<UserNotifyHandler>();
+ public interface UserNotifyHandler extends EventHandler {
+ public void onUserNotify(UserNotifyEvent event);
+ }
- public static void fire(final HasHandlers source, final NotifyLevel level, final java.lang.String message) {
- source.fireEvent(new UserNotifyEvent(level, "", message));
- }
+ private static final Type<UserNotifyHandler> TYPE = new Type<UserNotifyHandler>();
- public static void fire(final HasHandlers source, final NotifyLevel level, final java.lang.String message,
- final Boolean closeable) {
- source.fireEvent(new UserNotifyEvent(level, "", message, closeable));
- }
+ public static void fire(final HasHandlers source, final NotifyLevel level,
+ final java.lang.String message) {
+ source.fireEvent(new UserNotifyEvent(level, "", message));
+ }
- public static void fire(final HasHandlers source, final NotifyLevel level, final java.lang.String title,
- final java.lang.String message) {
- source.fireEvent(new UserNotifyEvent(level, title, message));
- }
+ public static void fire(final HasHandlers source, final NotifyLevel level,
+ final java.lang.String message, final Boolean closeable) {
+ source.fireEvent(new UserNotifyEvent(level, "", message, closeable));
+ }
- public static void fire(final HasHandlers source, final NotifyLevel level, final java.lang.String title,
- final java.lang.String message, final Boolean closeable) {
- source.fireEvent(new UserNotifyEvent(level, title, message, closeable));
- }
+ public static void fire(final HasHandlers source, final NotifyLevel level,
+ final java.lang.String title, final java.lang.String message) {
+ source.fireEvent(new UserNotifyEvent(level, title, message));
+ }
- public static Type<UserNotifyHandler> getType() {
- return TYPE;
- }
+ public static UserNotifyEvent fire(final HasHandlers source, final NotifyLevel level,
+ final java.lang.String title, final java.lang.String message, final Boolean closeable) {
+ final UserNotifyEvent event = new UserNotifyEvent(level, title, message, closeable);
+ source.fireEvent(event);
+ return event;
+ }
- private final Boolean closeable;
- private java.lang.String id;
- private final NotifyLevel level;
- private final java.lang.String message;
- private final java.lang.String title;
+ public static Type<UserNotifyHandler> getType() {
+ return TYPE;
+ }
- public UserNotifyEvent(final NotifyLevel level, final java.lang.String message) {
- this(level, "", message, false);
- }
+ private final Boolean closeable;
+ private CloseCallback closeCallback;
+ private UserNotifyCloser closer;
+ private java.lang.String id;
+ private final NotifyLevel level;
+ private final java.lang.String message;
+ private final java.lang.String title;
- public UserNotifyEvent(final NotifyLevel level, final java.lang.String message, final Boolean closeable) {
- this(level, "", message, closeable);
- }
+ public UserNotifyEvent(final NotifyLevel level, final java.lang.String message) {
+ this(level, "", message, false);
+ }
- public UserNotifyEvent(final NotifyLevel level, final java.lang.String title, final java.lang.String message) {
- this(level, title, message, false);
- }
+ public UserNotifyEvent(final NotifyLevel level, final java.lang.String message, final Boolean closeable) {
+ this(level, "", message, closeable);
+ }
- public UserNotifyEvent(final NotifyLevel level, final java.lang.String title, final java.lang.String message,
- final Boolean closeable) {
- this.level = level;
- this.title = title;
- this.message = message;
- this.closeable = closeable;
- }
+ public UserNotifyEvent(final NotifyLevel level, final java.lang.String title,
+ final java.lang.String message) {
+ this(level, title, message, false);
+ }
- public UserNotifyEvent(final String message) {
- this(NotifyLevel.info, message);
- }
+ public UserNotifyEvent(final NotifyLevel level, final java.lang.String title,
+ final java.lang.String message, final Boolean closeable) {
+ this.level = level;
+ this.title = title;
+ this.message = message;
+ this.closeable = closeable;
+ }
- @Override
- protected void dispatch(final UserNotifyHandler handler) {
- handler.onUserNotify(this);
- }
+ public UserNotifyEvent(final String message) {
+ this(NotifyLevel.info, message);
+ }
- @Override
- public Type<UserNotifyHandler> getAssociatedType() {
- return TYPE;
- }
+ @Override
+ protected void dispatch(final UserNotifyHandler handler) {
+ handler.onUserNotify(this);
+ }
- public Boolean getCloseable() {
- return closeable;
- }
+ @Override
+ public Type<UserNotifyHandler> getAssociatedType() {
+ return TYPE;
+ }
- public java.lang.String getId() {
- return id;
- }
+ public Boolean getCloseable() {
+ return closeable;
+ }
- public NotifyLevel getLevel() {
- return level;
- }
+ public CloseCallback getCloseCallback() {
+ return closeCallback;
+ }
- public java.lang.String getMessage() {
- return message;
- }
+ public UserNotifyCloser getCloser() {
+ return closer;
+ }
- public java.lang.String getTitle() {
- return title;
- }
+ public java.lang.String getId() {
+ return id;
+ }
- public void setId(final String id) {
- this.id = id;
- }
+ public NotifyLevel getLevel() {
+ return level;
+ }
+ public java.lang.String getMessage() {
+ return message;
+ }
+
+ public java.lang.String getTitle() {
+ return title;
+ }
+
+ public void setCloseCallback(final CloseCallback closeCallback) {
+ this.closeCallback = closeCallback;
+ }
+
+ public void setCloser(final UserNotifyCloser closer) {
+ this.closer = closer;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
}
Modified: trunk/src/main/java/cc/kune/msgs/KuneMsgs.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/msgs/KuneMsgs.gwt.xml 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/msgs/KuneMsgs.gwt.xml 2011-12-06 01:42:07 UTC (rev 1634)
@@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<!-- Inherit the core Web Toolkit stuff. -->
- <inherits name='com.google.gwt.user.User' />
- <inherits name="org.adamtacy.GWTEffects" />
- <inherits name="cc.kune.common.KuneCommon" />
+ <inherits name='com.google.gwt.user.User'/>
+ <inherits name="org.adamtacy.GWTEffects"/>
+ <inherits name="cc.kune.common.KuneCommon"/>
<!-- Other module inherits -->
<!-- Specify the app entry point class. -->
<!-- <entry-point class='cc.kune.msgs.client.KuneMessagesSampleEntryPoint'
/> -->
<!-- Specify the paths for translatable code -->
- <source path='client' />
- <public path="public" />
+ <source path='client'
+ excludes="**/*Test.java,**/*Tests.java,**/*MockProvider.java"/>
+ <public path="public"/>
</module>
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessage.java
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessage.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessage.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -1,168 +1,10 @@
-/*
- *
- * 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.msgs.client;
-import org.adamtacy.client.ui.effects.events.EffectCompletedEvent;
-import org.adamtacy.client.ui.effects.events.EffectCompletedHandler;
-import org.adamtacy.client.ui.effects.examples.Fade;
-import org.adamtacy.client.ui.effects.examples.Show;
+public interface UserMessage {
-import cc.kune.common.client.notify.NotifyLevel;
-import cc.kune.common.client.utils.TextUtils;
-import cc.kune.msgs.client.resources.UserMessageImagesUtil;
+ void appendMsg(String message);
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.safehtml.client.SafeHtmlTemplates;
-import com.google.gwt.safehtml.shared.SafeHtml;
-import com.google.gwt.safehtml.shared.SafeHtmlUtils;
-import com.google.gwt.safehtml.shared.SimpleHtmlSanitizer;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HasText;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.InlineHTML;
-import com.google.gwt.user.client.ui.PushButton;
-import com.google.gwt.user.client.ui.Widget;
+ void close();
-public class UserMessage extends Composite implements HasText {
-
- interface MessageUiBinder extends UiBinder<Widget, UserMessage> {
- }
-
- public interface MsgTemplate extends SafeHtmlTemplates {
- @Template("<span>{0}</span>")
- SafeHtml format(SafeHtml message);
- }
-
- public interface MsgWithTitleTemplate extends SafeHtmlTemplates {
- @Template("<span><span class=\"k-msg-title\">{0}</span><p>{1}</p></span>")
- SafeHtml format(SafeHtml title, SafeHtml message);
- }
-
- private static String closeTitle = "Close";
-
- private static int fadeMills = 5000;
-
- private static final MsgTemplate MSG_NO_TITLE = GWT.create(MsgTemplate.class);
- private static final MsgWithTitleTemplate MSG_WITH_TITLE = GWT.create(MsgWithTitleTemplate.class);
-
- private static MessageUiBinder uiBinder = GWT.create(MessageUiBinder.class);
-
- public static void setCloseTitle(final String title) {
- closeTitle = title;
- }
-
- public static void setFadeMills(final int mills) {
- fadeMills = mills;
- }
-
- @UiField
- PushButton close;
-
- private final CloseCallback closeCallback;
-
- @UiField
- Image icon;
-
- @UiField
- InlineHTML label;
-
- public UserMessage(final NotifyLevel level, final String title, final String message, final String id,
- final boolean closeable, final CloseCallback closeCallback) {
- this.closeCallback = closeCallback;
- initWidget(uiBinder.createAndBindUi(this));
- if (TextUtils.notEmpty(id)) {
- close.ensureDebugId(id);
- }
- if (TextUtils.notEmpty(message)) {
- if (TextUtils.notEmpty(title)) {
- label.setHTML(MSG_WITH_TITLE.format(SimpleHtmlSanitizer.sanitizeHtml(title), sanitize(message)));
- } else {
- label.setHTML(MSG_NO_TITLE.format(sanitize(message)));
- }
- close.setVisible(closeable);
- close.setTitle(closeTitle);
- if (!closeable) {
- final Timer time = new Timer() {
- @Override
- public void run() {
- close();
- }
- };
- time.schedule(fadeMills);
- }
- icon.setResource(UserMessageImagesUtil.getIcon(level));
- final Show anim = new Show(this.getElement());
- anim.setDuration(0.5);
- anim.play();
- }
- }
-
- public UserMessage(final String message, final CloseCallback closeCallback) {
- this("", message, false, closeCallback);
- }
-
- public UserMessage(final String title, final String message, final boolean closeable,
- final CloseCallback closeCallback) {
- this(NotifyLevel.info, title, message, "", closeable, closeCallback);
- }
-
- public UserMessage(final String title, final String message, final CloseCallback closeCallback) {
- this(title, message, false, closeCallback);
- }
-
- private void close() {
- final Fade fade = new Fade(this.getElement());
- fade.setDuration(0.7);
- fade.play();
- fade.addEffectCompletedHandler(new EffectCompletedHandler() {
-
- @Override
- public void onEffectCompleted(final EffectCompletedEvent event) {
- removeFromParent();
- closeCallback.onClose();
- }
- });
- }
-
- @Override
- public String getText() {
- return label.getText();
- }
-
- @UiHandler("close")
- void handleClick(final ClickEvent e) {
- close();
- }
-
- private SafeHtml sanitize(final String message) {
- return SafeHtmlUtils.fromTrustedString(message);
- }
-
- @Override
- public void setText(final String text) {
- label.setText(text);
- }
-
+ boolean isAttached();
}
Deleted: trunk/src/main/java/cc/kune/msgs/client/UserMessage.ui.xml
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessage.ui.xml 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessage.ui.xml 2011-12-06 01:42:07 UTC (rev 1634)
@@ -1,36 +0,0 @@
-<!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>
- @if user.agent safari {
- .k-msg-width {
- width: 0px;
- }
- }
-
- @else {
- .k-msg-width {
- width: auto;
- }
- }
- </ui:style>
- <ui:with field='img'
- type='cc.kune.msgs.client.resources.UserMessageImages'/>
- <g:HorizontalPanel verticalAlignment="ALIGN_MIDDLE"
- height="42px" addStyleNames="k-msg, k-3corners, {style.k-msg-width}">
- <g:SimplePanel addStyleNames="k-msg-icon">
- <g:Image width="100%" ui:field="icon" height="100%"/>
- </g:SimplePanel>
- <g:Cell width="100%">
- <g:InlineHTML ui:field="label" width="100%"
- styleName="k-msg-label"/>
- </g:Cell>
- <g:PushButton ui:field="close" styleName="k-msg-close"
- width="22px">
- <g:upFace image='{img.remove}'/>
- <g:downFace image='{img.removeOver}'/>
- <g:upHoveringFace image='{img.removeGrey}'/>
- </g:PushButton>
- </g:HorizontalPanel>
-</ui:UiBinder>
Copied: trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java (from rev 1630, trunk/src/main/java/cc/kune/msgs/client/UserMessage.java)
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java (rev 0)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -0,0 +1,198 @@
+/*
+ *
+ * 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.msgs.client;
+
+import org.adamtacy.client.ui.effects.events.EffectCompletedEvent;
+import org.adamtacy.client.ui.effects.events.EffectCompletedHandler;
+import org.adamtacy.client.ui.effects.examples.Fade;
+import org.adamtacy.client.ui.effects.examples.Show;
+
+import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.common.client.utils.TextUtils;
+import cc.kune.msgs.client.resources.UserMessageImagesUtil;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.safehtml.client.SafeHtmlTemplates;
+import com.google.gwt.safehtml.shared.SafeHtml;
+import com.google.gwt.safehtml.shared.SafeHtmlUtils;
+import com.google.gwt.safehtml.shared.SimpleHtmlSanitizer;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HasText;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.InlineHTML;
+import com.google.gwt.user.client.ui.PushButton;
+import com.google.gwt.user.client.ui.Widget;
+
+public class UserMessageWidget extends Composite implements HasText, UserMessage {
+
+ public interface MsgTemplate extends SafeHtmlTemplates {
+ @Template("<span>{0}</span>")
+ SafeHtml format(SafeHtml message);
+ }
+
+ public interface MsgWithTitleTemplate extends SafeHtmlTemplates {
+ @Template("<span><span class=\"k-msg-title\">{0}</span><p>{1}</p></span>")
+ SafeHtml format(SafeHtml title, SafeHtml message);
+ }
+
+ interface UserMessageWidgetUiBinder extends UiBinder<Widget, UserMessageWidget> {
+ }
+
+ private static final String AVATAR_SIZE = "40px";
+
+ private static String closeTitle = "Close";
+
+ private static int fadeMills = 5000;
+
+ private static final MsgTemplate MSG_NO_TITLE = GWT.create(MsgTemplate.class);
+ private static final MsgWithTitleTemplate MSG_WITH_TITLE = GWT.create(MsgWithTitleTemplate.class);
+ private static UserMessageWidgetUiBinder uiBinder = GWT.create(UserMessageWidgetUiBinder.class);
+
+ public static void setCloseTitle(final String title) {
+ closeTitle = title;
+ }
+
+ public static void setFadeMills(final int mills) {
+ fadeMills = mills;
+ }
+
+ @UiField
+ PushButton close;
+
+ private final CloseCallback closeCallback;
+
+ @UiField
+ Image icon;
+
+ @UiField
+ InlineHTML label;
+
+ private Timer time;
+
+ public UserMessageWidget(final NotifyLevel level, final String title, final String message,
+ final String id, final boolean closeable, final CloseCallback closeCallback) {
+ this.closeCallback = closeCallback;
+ initWidget(uiBinder.createAndBindUi(this));
+ if (TextUtils.notEmpty(id)) {
+ close.ensureDebugId(id);
+ }
+ if (TextUtils.notEmpty(message)) {
+ setMsg(title, message);
+ close.setVisible(closeable);
+ close.setTitle(closeTitle);
+ if (!closeable) {
+ time = new Timer() {
+ @Override
+ public void run() {
+ close();
+ }
+ };
+ time.schedule(fadeMills);
+ }
+ setIcon(level);
+ final Show anim = new Show(this.getElement());
+ anim.setDuration(0.5);
+ anim.play();
+ }
+ }
+
+ public UserMessageWidget(final String message, final CloseCallback closeCallback) {
+ this("", message, false, closeCallback);
+ }
+
+ public UserMessageWidget(final String title, final String message, final boolean closeable,
+ final CloseCallback closeCallback) {
+ this(NotifyLevel.info, title, message, "", closeable, closeCallback);
+ }
+
+ public UserMessageWidget(final String title, final String message, final CloseCallback closeCallback) {
+ this(title, message, false, closeCallback);
+ }
+
+ @Override
+ public void appendMsg(final String message) {
+ resetTimer();
+ label.setHTML(sanitize(label.getHTML() + "<p>" + message + "</p>"));
+ }
+
+ @Override
+ public void close() {
+ final Fade fade = new Fade(this.getElement());
+ fade.setDuration(0.7);
+ fade.play();
+ fade.addEffectCompletedHandler(new EffectCompletedHandler() {
+
+ @Override
+ public void onEffectCompleted(final EffectCompletedEvent event) {
+ removeFromParent();
+ closeCallback.onClose();
+ }
+ });
+ }
+
+ @Override
+ public String getText() {
+ return label.getText();
+ }
+
+ @UiHandler("close")
+ void handleClick(final ClickEvent e) {
+ close();
+ }
+
+ private void resetTimer() {
+ if (time != null) {
+ // More time to read it!
+ time.schedule(fadeMills);
+ }
+ }
+
+ private SafeHtml sanitize(final String message) {
+ return SafeHtmlUtils.fromTrustedString(message);
+ }
+
+ private void setIcon(final NotifyLevel level) {
+ if (level.equals(NotifyLevel.avatar)) {
+ icon.setUrl(level.getUrl());
+ icon.setSize(AVATAR_SIZE, AVATAR_SIZE);
+ } else {
+ icon.setResource(UserMessageImagesUtil.getIcon(level));
+ }
+ }
+
+ private void setMsg(final String title, final String message) {
+ if (TextUtils.notEmpty(title)) {
+ label.setHTML(MSG_WITH_TITLE.format(SimpleHtmlSanitizer.sanitizeHtml(title), sanitize(message)));
+ } else {
+ label.setHTML(MSG_NO_TITLE.format(sanitize(message)));
+ }
+ }
+
+ @Override
+ public void setText(final String text) {
+ label.setText(text);
+ }
+
+}
Copied: trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.ui.xml (from rev 1630, trunk/src/main/java/cc/kune/msgs/client/UserMessage.ui.xml)
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.ui.xml (rev 0)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessageWidget.ui.xml 2011-12-06 01:42:07 UTC (rev 1634)
@@ -0,0 +1,36 @@
+<!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>
+ @if user.agent safari {
+ .k-msg-width {
+ width: 0px;
+ }
+ }
+
+ @else {
+ .k-msg-width {
+ width: auto;
+ }
+ }
+ </ui:style>
+ <ui:with field='img'
+ type='cc.kune.msgs.client.resources.UserMessageImages'/>
+ <g:HorizontalPanel verticalAlignment="ALIGN_MIDDLE"
+ addStyleNames="k-msg, k-3corners, {style.k-msg-width}">
+ <g:SimplePanel addStyleNames="k-msg-icon">
+ <g:Image width="100%" ui:field="icon" height="100%"/>
+ </g:SimplePanel>
+ <g:Cell width="100%">
+ <g:InlineHTML ui:field="label" width="100%"
+ styleName="k-msg-label"/>
+ </g:Cell>
+ <g:PushButton ui:field="close" styleName="k-msg-close"
+ width="22px">
+ <g:upFace image='{img.remove}'/>
+ <g:downFace image='{img.removeOver}'/>
+ <g:upHoveringFace image='{img.removeGrey}'/>
+ </g:PushButton>
+ </g:HorizontalPanel>
+</ui:UiBinder>
Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessagesPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessagesPanel.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessagesPanel.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -40,8 +40,7 @@
@UiField
FlowPanel bottom;
- private NotifyLevel currentLevel;
- private UserMessage currentMsg;
+
@UiField
VerticalPanel panel;
@@ -50,12 +49,11 @@
}
@Override
- public void add(final NotifyLevel level, final String title, final String message, final String id,
- final boolean closeable, final CloseCallback closeCallback) {
+ public UserMessage add(final NotifyLevel level, final String title, final String message,
+ final String id, final Boolean closeable, final CloseCallback closeCallback) {
- final UserMessage msg = new UserMessage(level, title, message, id, closeable, closeCallback);
- currentMsg = msg;
- currentLevel = level;
+ final UserMessageWidget msg = new UserMessageWidget(level, title, message, id, closeable,
+ closeCallback);
// msg.getText().
@@ -71,5 +69,10 @@
}
}
});
+ return msg;
}
+
+ public int getCurrentMsgCount() {
+ return panel.getWidgetCount();
+ }
}
Modified: trunk/src/main/java/cc/kune/msgs/client/UserMessagesPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/msgs/client/UserMessagesPresenter.java 2011-12-05 20:42:43 UTC (rev 1633)
+++ trunk/src/main/java/cc/kune/msgs/client/UserMessagesPresenter.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -23,21 +23,56 @@
public class UserMessagesPresenter {
- public interface UserMessagesView {
- void add(NotifyLevel level, String title, String message, String id, boolean closable, CloseCallback callback);
- }
+ public interface UserMessagesView {
+ UserMessage add(NotifyLevel level, String title, String message, String id, Boolean closable,
+ CloseCallback callback);
+ }
- private UserMessagesView view;
+ private boolean currentClosable;
+ private String currentId;
+ private NotifyLevel currentLevel;
+ private UserMessage currentMsg;
+ private String currentTitle;
+ private UserMessagesView view;
- public UserMessagesPresenter() {
- }
+ public UserMessagesPresenter() {
+ }
- public void add(final NotifyLevel level, final String title, final String message, final String id,
- final boolean closable, final CloseCallback closeCallback) {
- view.add(level, title, message, id, closable, closeCallback);
+ public UserMessage add(final NotifyLevel level, final String title, final String message,
+ final String id, final boolean closable, final CloseCallback closeCallback) {
+ if ((currentMsg != null && !currentMsg.isAttached()) || !level.equals(currentLevel)
+ || !same(title, currentTitle) || !same(id, currentId) || closable != currentClosable) {
+ currentMsg = view.add(level, title, message, id, closable, closeCallback);
+ } else {
+ // Similar message, so, I'll reuse the widget
+ assert (currentMsg != null);
+ currentMsg.appendMsg(message);
}
+ currentLevel = level;
+ currentTitle = title;
+ currentId = id;
+ currentClosable = closable;
+ return currentMsg;
+ }
- public void init(final UserMessagesView view) {
- this.view = view;
+ public void init(final UserMessagesView view) {
+ this.view = view;
+ }
+
+ private boolean same(final Object object, final Object otherObj) {
+ if (object == otherObj) {
+ return true;
}
+ if (otherObj == null) {
+ return false;
+ }
+ if (object == null) {
+ if (otherObj != null) {
+ return false;
+ }
+ } else if (!object.equals(otherObj)) {
+ return false;
+ }
+ return true;
+ }
}
Added: trunk/src/test/java/cc/kune/msgs/client/UserMessagesPresenterTest.java
===================================================================
--- trunk/src/test/java/cc/kune/msgs/client/UserMessagesPresenterTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/msgs/client/UserMessagesPresenterTest.java 2011-12-06 01:42:07 UTC (rev 1634)
@@ -0,0 +1,131 @@
+package cc.kune.msgs.client;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import cc.kune.common.client.notify.NotifyLevel;
+import cc.kune.msgs.client.UserMessagesPresenter.UserMessagesView;
+
+public class UserMessagesPresenterTest {
+
+ private static final String ID_1 = "id1";
+ private static final String ID_2 = "id2";
+ private static final String MESSAGE_1 = "message 1";
+ private static final String MESSAGE_2 = "message 2";
+ private static final String TITLE_1 = "title 1";
+ private static final String TITLE_2 = "title 2";
+ private CloseCallback closeCallback;
+ private UserMessage msg;
+ private UserMessagesPresenter presenter;
+ private UserMessagesView view;
+
+ @Test
+ public void basicMsg() {
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false,
+ closeCallback);
+ }
+
+ @Before
+ public void before() {
+ presenter = new UserMessagesPresenter();
+ view = Mockito.mock(UserMessagesView.class);
+ closeCallback = Mockito.mock(CloseCallback.class);
+ presenter.init(view);
+ msg = Mockito.mock(UserMessage.class);
+ // Mockito.when(msg.getText()).thenReturn(MESSAGE_1);
+ Mockito.when(
+ view.add((NotifyLevel) Mockito.anyObject(), Mockito.anyString(), Mockito.anyString(),
+ Mockito.anyString(), Mockito.anyBoolean(), (CloseCallback) Mockito.anyObject())).thenReturn(
+ msg);
+ }
+
+ @Test
+ public void twoBasicAvatarMsg() {
+ final NotifyLevel avatar = NotifyLevel.avatar.url("image1.png");
+ presenter.add(avatar, TITLE_1, MESSAGE_1, null, false, closeCallback);
+ Mockito.when(msg.isAttached()).thenReturn(true);
+ presenter.add(avatar, TITLE_1, MESSAGE_2, null, false, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(avatar, TITLE_1, MESSAGE_1, null, false, closeCallback);
+ Mockito.verify(msg, Mockito.times(1)).appendMsg(MESSAGE_2);
+ }
+
+ @Test
+ public void twoBasicDiffAvatarMsg() {
+ final NotifyLevel avatar1 = NotifyLevel.avatar.url("image1.png");
+ presenter.add(avatar1, TITLE_1, MESSAGE_1, ID_1, false, closeCallback);
+ final NotifyLevel avatar2 = NotifyLevel.avatar.url("image2.png");
+ presenter.add(avatar2, TITLE_1, MESSAGE_1, ID_1, true, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(avatar1, TITLE_1, MESSAGE_1, ID_1, false, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(avatar2, TITLE_1, MESSAGE_1, ID_1, true, closeCallback);
+ Mockito.verify(msg, Mockito.never()).appendMsg(MESSAGE_1);
+ }
+
+ @Test
+ public void twoBasicDiffCloseableMsg() {
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, ID_1, false, closeCallback);
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, ID_1, true, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, ID_1, false,
+ closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, ID_1, true,
+ closeCallback);
+ Mockito.verify(msg, Mockito.never()).appendMsg(MESSAGE_1);
+ }
+
+ @Test
+ public void twoBasicDiffIdMsg() {
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, ID_1, false, closeCallback);
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, ID_2, false, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, ID_1, false,
+ closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, ID_2, false,
+ closeCallback);
+ Mockito.verify(msg, Mockito.never()).appendMsg(MESSAGE_1);
+ }
+
+ @Test
+ public void twoBasicDiffLevelMsg() {
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false, closeCallback);
+ presenter.add(NotifyLevel.error, TITLE_1, MESSAGE_2, null, false, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false,
+ closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.error, TITLE_1, MESSAGE_2, null, false,
+ closeCallback);
+ Mockito.verify(msg, Mockito.never()).appendMsg(MESSAGE_2);
+ }
+
+ @Test
+ public void twoBasicDiffTitleMsg() {
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false, closeCallback);
+ presenter.add(NotifyLevel.info, TITLE_2, MESSAGE_1, null, false, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false,
+ closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_2, MESSAGE_1, null, false,
+ closeCallback);
+ Mockito.verify(msg, Mockito.never()).appendMsg(MESSAGE_1);
+ }
+
+ @Test
+ public void twoBasicMsg() {
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false, closeCallback);
+ Mockito.when(msg.isAttached()).thenReturn(true);
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_2, null, false, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false,
+ closeCallback);
+ Mockito.verify(msg, Mockito.times(1)).appendMsg(MESSAGE_2);
+ }
+
+ @Test
+ public void twoBasicMsgButAfterFirstClosed() {
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false, closeCallback);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false,
+ closeCallback);
+ presenter.add(NotifyLevel.info, TITLE_1, MESSAGE_2, null, false, closeCallback);
+ Mockito.when(msg.isAttached()).thenReturn(false);
+ Mockito.verify(view, Mockito.times(1)).add(NotifyLevel.info, TITLE_1, MESSAGE_1, null, false,
+ closeCallback);
+ Mockito.verify(msg, Mockito.never()).appendMsg(MESSAGE_2);
+ }
+
+}
1
0
05 Dec '11
Author: vjrj_
Date: 2011-12-05 21:42:43 +0100 (Mon, 05 Dec 2011)
New Revision: 1633
Modified:
trunk/INSTALL
trunk/pom.xml
trunk/script/server.sh
trunk/src/main/java/cc/kune/Kune.gwt.xml
trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPresenter.java
trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java
trunk/src/main/java/cc/kune/core/client/init/AppStarterDefault.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/general/GroupOptGeneralPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java
Log:
CLOSED - # 176: Ask for confirmation before reload to change the UI to your language
http://kune.ourproject.org/issues/ticket/176
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/INSTALL 2011-12-05 20:42:43 UTC (rev 1633)
@@ -171,7 +171,7 @@
==Production environment instructions==
With
- mvn package
+ mvn assembly:assembly
an executable target/kune-VERSION-jar-with-dependencies.jar is generated in target directory. That you can use to start kune:
bin/server.sh -j kune.jar
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/pom.xml 2011-12-05 20:42:43 UTC (rev 1633)
@@ -927,6 +927,7 @@
</descriptorRefs>
<dependencySets>
<dependencySet>
+ <outputDirectory>/</outputDirectory>
<scope>runtime</scope>
<unpackOptions>
<excludes>
@@ -936,9 +937,23 @@
<exclude>**extjs**</exclude>
<exclude>**gxt**</exclude>
</excludes>
+ <includes>
+ <include>${basedir}/target/kune-0.1.0-SNAPSHOT/ws/**</include>
+ <include>${basedir}/src/main/webapp/**</include>
+ </includes>
</unpackOptions>
</dependencySet>
</dependencySets>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/target/kune-0.1.0-SNAPSHOT/ws/**</include>
+ <include>**src/main/webapp**</include>
+ </includes>
+ </fileSet>
+ </fileSets>
</configuration>
</plugin>
<plugin>
Modified: trunk/script/server.sh
===================================================================
--- trunk/script/server.sh 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/script/server.sh 2011-12-05 20:42:43 UTC (rev 1633)
@@ -7,7 +7,7 @@
Example: $0 -j target/kune-0.1.0-SNAPSHOT-jar-with-dependencies.jar -l IGNORE -d -p -u 20000
Options:
--j <jar file> : runs jar file generated via mvn package -Dmaven.test.skip=true
+-j <jar file> : runs jar file generated via mvn assembly:assembly
-a: run as a daemon (only root user)
-l LOGLEVEL : IGNORE|DEBUG|INFO|WARN
Modified: trunk/src/main/java/cc/kune/Kune.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/Kune.gwt.xml 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/Kune.gwt.xml 2011-12-05 20:42:43 UTC (rev 1633)
@@ -56,9 +56,12 @@
<set-configuration-property name="CssResource.style"
value="pretty" />
<!-- I18n ===================================================== -->
- <extend-property name="locale" values="en" />
- <extend-property name="locale" values="es" />
- <extend-property name="locale" values="fr" />
+ <!-- http://bit.ly/uCiBDm -->
+ <extend-property name="locale" values="en,es,fr" />
+ <set-property-fallback name="locale" value="en"/>
+
+ <set-property name="locale" value="en,es,fr"/>
+
<!-- Hardcoded locale (to override emite italian support) ===== -->
<!-- <set-property name="locale" value="en" /> -->
<!-- Hardcoded log level ====================================== -->
Modified: trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPresenter.java 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/core/client/auth/SignInAbstractPresenter.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -21,6 +21,7 @@
import cc.kune.core.client.cookies.CookiesManager;
import cc.kune.core.client.i18n.I18nUITranslationService;
+import cc.kune.core.client.i18n.I18nUITranslationService.I18nLanguageChangeNeeded;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
import cc.kune.core.shared.domain.utils.StateToken;
@@ -93,13 +94,22 @@
session.setCurrentUserInfo(userInfoDTO);
final I18nLanguageDTO language = userInfoDTO.getLanguage();
session.setCurrentLanguage(language);
- if (!i18n.changeToLanguageIfNecessary(language.getCode())) {
- if (gotoHomePage) {
- stateManager.gotoStateToken(new StateToken(userInfoDTO.getHomePage()).clearDocument());
- } else {
- stateManager.redirectOrRestorePreviousToken();
- }
- }
+ i18n.changeToLanguageIfNecessary(language.getCode(), language.getEnglishName(),
+ new I18nLanguageChangeNeeded() {
+
+ @Override
+ public void onChangeNeeded() {
+ }
+
+ @Override
+ public void onChangeNotNeeded() {
+ if (gotoHomePage) {
+ stateManager.gotoStateToken(new StateToken(userInfoDTO.getHomePage()).clearDocument());
+ } else {
+ stateManager.redirectOrRestorePreviousToken();
+ }
+ }
+ });
}
protected void saveAutocompleteLoginData(final String nickOrEmail, final String password) {
Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -84,7 +84,7 @@
final String msg = caught.getMessage();
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
i18n.t("You do not have rights to perform that action")
- + (TextUtils.empty(msg) ? "" : ". " + i18n.t(msg))));
+ + (!TextUtils.empty(msg) && msg.length() > 1 ? ". " + i18n.t(msg) : "")));
goHome();
} else if (caught instanceof SessionExpiredException) {
logException(caught);
Modified: trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/core/client/i18n/I18nUITranslationService.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -27,9 +27,11 @@
import java.util.Set;
import cc.kune.common.client.log.Log;
+import cc.kune.common.client.notify.NotifyUser;
import cc.kune.common.client.utils.Location;
import cc.kune.common.client.utils.MetaUtils;
import cc.kune.common.client.utils.Pair;
+import cc.kune.common.client.utils.SimpleResponseCallback;
import cc.kune.common.client.utils.TextUtils;
import cc.kune.common.client.utils.WindowUtils;
import cc.kune.core.client.rpcservices.I18nServiceAsync;
@@ -48,6 +50,11 @@
import com.google.inject.Inject;
public class I18nUITranslationService extends I18nTranslationService {
+ public interface I18nLanguageChangeNeeded {
+ void onChangeNeeded();
+
+ void onChangeNotNeeded();
+ }
private I18nLanguageDTO currentLang;
private String currentLanguageCode;
private final Set<Pair<String, String>> earlyTexts;
@@ -57,6 +64,7 @@
private final KuneConstants kuneConstants;
private HashMap<String, String> lexicon;
private final Session session;
+
private String siteCommonName;
@Inject
@@ -101,11 +109,20 @@
+ ", isRTL: " + currentLang.getDirection() + " use properties: "
+ shouldIuseProperties());
- if (!changeToLanguageIfNecessary(getCurrentGWTlanguage(), currentLang.getCode())) {
- isCurrentLangRTL = currentLang.getDirection().equals(RTL);
- eventBus.fireEvent(new I18nReadyEvent());
- }
- I18nStyles.setRTL(isCurrentLangRTL);
+ changeToLanguageIfNecessary(getCurrentGWTlanguage(), currentLang.getCode(),
+ currentLang.getEnglishName(), new I18nLanguageChangeNeeded() {
+
+ @Override
+ public void onChangeNeeded() {
+ }
+
+ @Override
+ public void onChangeNotNeeded() {
+ isCurrentLangRTL = currentLang.getDirection().equals(RTL);
+ eventBus.fireEvent(new I18nReadyEvent());
+ I18nStyles.setRTL(isCurrentLangRTL);
+ }
+ });
}
});
session.onUserSignIn(true, new UserSignInHandler() {
@@ -162,8 +179,9 @@
changeHref("http://" + WindowUtils.getLocation().getHost() + newUrl);
}
- public boolean changeToLanguageIfNecessary(final String wantedLang) {
- return changeToLanguageIfNecessary(currentLang.getCode(), wantedLang);
+ public void changeToLanguageIfNecessary(final String wantedLang, final String wantedLangEnglishName,
+ final I18nLanguageChangeNeeded listener) {
+ changeToLanguageIfNecessary(currentLang.getCode(), wantedLang, wantedLangEnglishName, listener);
}
/**
@@ -172,13 +190,29 @@
* to check and to change to
* @return true if we should reload the client with the new language
*/
- public boolean changeToLanguageIfNecessary(final String currentLang, final String wantedLang) {
- if (!currentLang.equals(wantedLang) && isInConstantProperties(wantedLang)) {
- setCurrentLanguage(wantedLang);
- changeLanguageInUrl(wantedLang);
- return true;
+ private void changeToLanguageIfNecessary(final String currentLangCode, final String wantedLang,
+ final String wantedLangEnglishName, final I18nLanguageChangeNeeded listener) {
+ if (!currentLangCode.equals(wantedLang) && isInConstantProperties(wantedLang)) {
+ NotifyUser.askConfirmation(t("Confirm please"),
+ t("Do you want to reload this page to use '[%s]' language?", wantedLangEnglishName),
+ new SimpleResponseCallback() {
+ @Override
+ public void onCancel() {
+ // User no accepted to change the language...
+ listener.onChangeNotNeeded();
+ }
+
+ @Override
+ public void onSuccess() {
+ // User accepted to change the language...
+ listener.onChangeNeeded();
+ setCurrentLanguage(wantedLang);
+ changeLanguageInUrl(wantedLang);
+ }
+ });
+ } else {
+ listener.onChangeNotNeeded();
}
- return false;
}
public String formatDateWithLocale(final Date date) {
Modified: trunk/src/main/java/cc/kune/core/client/init/AppStarterDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/init/AppStarterDefault.java 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/core/client/init/AppStarterDefault.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -66,11 +66,13 @@
}
private void checkNavigatorCompatibility(final NavigatorSupport navSupport) {
- if (Navigator.getUserAgent().toLowerCase().contains("msie")
- || Navigator.getUserAgent().toLowerCase().contains("opera")) {
+ // http://www.useragentstring.com/pages/useragentstring.php
+ final String userAgent = Navigator.getUserAgent().toLowerCase();
+ Log.info("User agent: " + userAgent);
+ if (userAgent.contains("chrome") || userAgent.contains("gecko")) {
+ navSupport.onSupported();
+ } else {
navSupport.onNotSupported();
- } else {
- navSupport.onSupported();
}
}
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-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -145,7 +145,13 @@
view.getGroupBtn().addClickHandler(new ClickHandler() {
@Override
public void onClick(final ClickEvent event) {
- restoreToken(groupToken);
+ if (groupToken.equals(SiteTokens.GROUP_HOME)) {
+ // as current home is equal to "no content" token, we shall go to
+ // group space def home page
+ stateManager.gotoDefaultHomepage();
+ } else {
+ restoreToken(groupToken);
+ }
setDown(Space.groupSpace);
}
});
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/ParticipateInContentBtn.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -76,7 +76,7 @@
final IsCurrentStateEditableCondition isEditable,
final IsNotParticipantOfCurrentStateCondition isNotParticipant, final CoreResources res) {
super(action);
- this.withText(i18n.t("Edit")).withToolTip("Participate in the edition of this page").withIcon(
+ this.withText(i18n.t("Participate")).withToolTip("Participate in the edition of this page").withIcon(
res.contentEdit()).withStyles("k-def-docbtn, k-fl");
super.add(isLogged);
super.add(isEditable);
Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralPresenter.java 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralPresenter.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -19,9 +19,9 @@
*/
package cc.kune.gspace.client.options.general;
+import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.options.EntityOptions;
import cc.kune.gspace.client.options.logo.CurrentEntityChangedEvent;
@@ -34,13 +34,13 @@
protected final EntityOptions entityOptions;
private final EventBus eventBus;
- protected final I18nTranslationService i18n;
+ protected final I18nUITranslationService i18n;
protected final Session session;
protected final StateManager stateManager;
protected EntityOptGeneralView view;
public EntityOptGeneralPresenter(final Session session, final StateManager stateManager,
- final EventBus eventBus, final I18nTranslationService i18n, final EntityOptions entityOptions) {
+ final EventBus eventBus, final I18nUITranslationService i18n, final EntityOptions entityOptions) {
this.session = session;
this.stateManager = stateManager;
this.eventBus = eventBus;
Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/GroupOptGeneralPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/GroupOptGeneralPresenter.java 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/GroupOptGeneralPresenter.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -20,6 +20,7 @@
package cc.kune.gspace.client.options.general;
import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.GroupServiceAsync;
import cc.kune.core.client.state.GroupChangedEvent;
@@ -29,7 +30,6 @@
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.GroupDTO;
import cc.kune.core.shared.dto.StateAbstractDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.options.GroupOptions;
import com.google.gwt.event.shared.EventBus;
@@ -43,7 +43,7 @@
@Inject
public GroupOptGeneralPresenter(final StateManager stateManager, final Session session,
- final EventBus eventBus, final I18nTranslationService i18n, final GroupOptions entityOptions,
+ final EventBus eventBus, final I18nUITranslationService i18n, final GroupOptions entityOptions,
final Provider<GroupServiceAsync> groupService, final GroupOptGeneralView view) {
super(session, stateManager, eventBus, i18n, entityOptions);
this.groupService = groupService;
Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java 2011-11-30 01:31:04 UTC (rev 1632)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java 2011-12-05 20:42:43 UTC (rev 1633)
@@ -20,6 +20,8 @@
package cc.kune.gspace.client.options.general;
import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.client.i18n.I18nUITranslationService;
+import cc.kune.core.client.i18n.I18nUITranslationService.I18nLanguageChangeNeeded;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.UserServiceAsync;
import cc.kune.core.client.state.Session;
@@ -30,7 +32,6 @@
import cc.kune.core.shared.dto.StateAbstractDTO;
import cc.kune.core.shared.dto.UserDTO;
import cc.kune.core.shared.dto.UserSimpleDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
import cc.kune.gspace.client.options.UserOptions;
import com.google.gwt.event.shared.EventBus;
@@ -44,7 +45,7 @@
@Inject
public UserOptGeneralPresenter(final Session session, final StateManager stateManager,
- final EventBus eventBus, final I18nTranslationService i18n, final UserOptions entityOptions,
+ final EventBus eventBus, final I18nUITranslationService i18n, final UserOptions entityOptions,
final Provider<UserServiceAsync> userService, final UserOptGeneralView view) {
super(session, stateManager, eventBus, i18n, entityOptions);
this.userService = userService;
@@ -84,13 +85,25 @@
user.setId(currentUser.getId());
final String longName = userView.getLongName();
user.setName(longName);
+ final I18nLanguageSimpleDTO lang = userView.getLanguage();
userService.get().updateUser(session.getUserHash(), user, userView.getLanguage(),
new AsyncCallbackSimple<StateAbstractDTO>() {
@Override
public void onSuccess(final StateAbstractDTO result) {
NotifyUser.hideProgress();
- stateManager.setRetrievedStateAndGo(result);
- sendChangeEntityEvent();
+ // Change language to new one if needed
+ i18n.changeToLanguageIfNecessary(lang.getCode(), lang.getEnglishName(),
+ new I18nLanguageChangeNeeded() {
+ @Override
+ public void onChangeNeeded() {
+ }
+
+ @Override
+ public void onChangeNotNeeded() {
+ stateManager.setRetrievedStateAndGo(result);
+ sendChangeEntityEvent();
+ }
+ });
};
}
1
0
Author: vjrj_
Date: 2011-11-30 02:31:04 +0100 (Wed, 30 Nov 2011)
New Revision: 1632
Added:
trunk/src/main/java/cc/kune/core/server/rack/AdminThread.java
trunk/src/main/java/cc/kune/events/client/actions/AbstractCalendarViewSelectBtn.java
trunk/src/main/java/cc/kune/events/client/actions/Calendar1DayViewSelectBtn.java
trunk/src/main/java/cc/kune/events/client/actions/Calendar3DaysViewSelectBtn.java
trunk/src/main/java/cc/kune/events/client/actions/Calendar7DaysViewSelectBtn.java
trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextAction.java
trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextBtn.java
trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevAction.java
trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevBtn.java
trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayAction.java
trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayBtn.java
trunk/src/main/java/cc/kune/events/client/actions/CalendarMonthViewSelectBtn.java
trunk/src/main/java/cc/kune/events/client/actions/CalendarViewSelectAction.java
trunk/src/main/java/cc/kune/events/client/viewer/
trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java
trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java
trunk/src/main/java/cc/kune/events/server/CalendarServerUtils.java
trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerView.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ToolbarStyles.java
trunk/src/test/java/cc/kune/events/
trunk/src/test/java/cc/kune/events/server/
trunk/src/test/java/cc/kune/events/server/CalendarServerUtilsTest.java
Modified:
trunk/.classpath
trunk/pom.xml
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/events/KuneEvents.gwt.xml
trunk/src/main/java/cc/kune/events/client/EventsGinModule.java
trunk/src/main/java/cc/kune/events/client/EventsGinjector.java
trunk/src/main/java/cc/kune/events/client/EventsParts.java
trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
Log:
CLOSED - # 163: Empty messages in Views where not logged shoul be different to logged
http://kune.ourproject.org/issues/ticket/163
NEW - # 158: Add a Calendar view to event tool
http://kune.ourproject.org/issues/ticket/158
Modified: trunk/.classpath
===================================================================
--- trunk/.classpath 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/.classpath 2011-11-30 01:31:04 UTC (rev 1632)
@@ -12,6 +12,7 @@
<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar" sourcepath="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar"/>
<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/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar"/>
+ <classpathentry kind="var" path="M2_REPO/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar" sourcepath="M2_REPO/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/waveprotocol/box/0.3.7/box-0.3.7.jar"/>
<classpathentry kind="var" path="M2_REPO/org/waveprotocol/box-src/0.3.7/box-src-0.3.7.jar" sourcepath="M2_REPO/org/waveprotocol/box-src/0.3.7/box-src-0.3.7-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar"/>
@@ -49,6 +50,7 @@
<classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-assisted-inject/2.0/guice-assisted-inject-2.0.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-persist/3.0/guice-persist-3.0.jar" sourcepath="M2_REPO/com/google/inject/extensions/guice-persist/3.0/guice-persist-3.0-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/inject/extensions/guice-servlet/3.0/guice-servlet-3.0.jar" sourcepath="M2_REPO/com/google/inject/extensions/guice-servlet/3.0/guice-servlet-3.0-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/com/bradrydzewski/gwt-cal/0.9.3-dndCreation/gwt-cal-0.9.3-dndCreation.jar"/>
<classpathentry kind="var" path="M2_REPO/com/allen_sauer/gwt/dnd/gwt-dnd/gwt-dnd/3.0.1/gwt-dnd-3.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/adamtacy/gwt-fx/r464/gwt-fx-r464.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/gwt/gwt-gin/1.0-r137/gwt-gin-1.0-r137.jar"/>
@@ -83,6 +85,7 @@
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.1.2/httpclient-4.1.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.1.2/httpcore-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpcore/4.1.2/httpcore-4.1.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpmime/4.1.2/httpmime-4.1.2.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpmime/4.1.2/httpmime-4.1.2-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/mnode/ical4j/ical4j/1.0.2/ical4j-1.0.2.jar" sourcepath="M2_REPO/org/mnode/ical4j/ical4j/1.0.2/ical4j-1.0.2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javassist/javassist/3.4.GA/javassist-3.4.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.1/jcl-over-slf4j-1.6.1.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.6.1/jcl-over-slf4j-1.6.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/beust/jcommander/1.12/jcommander-1.12.jar" sourcepath="M2_REPO/com/beust/jcommander/1.12/jcommander-1.12-sources.jar"/>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/pom.xml 2011-11-30 01:31:04 UTC (rev 1632)
@@ -694,6 +694,17 @@
<artifactId>mail</artifactId>
<version>1.4.4</version>
</dependency>
+ <!-- calendar -->
+ <dependency>
+ <groupId>com.bradrydzewski</groupId>
+ <artifactId>gwt-cal</artifactId>
+ <version>0.9.3-dndCreation</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mnode.ical4j</groupId>
+ <artifactId>ical4j</artifactId>
+ <version>1.0.2</version>
+ </dependency>
</dependencies>
<!-- <dependency> -->
@@ -805,13 +816,13 @@
<key>kune.server.config</key>
<value>src/main/resources/kune.properties</value>
</systemProperty>
-<!-- <systemProperty> -->
-<!-- <key>kune.db.persistence.name</key> -->
- <!-- Persistence name, choose between: production, development,
- test_db (testing environment using mysql db), test (testing environment using
- h2 db). See persistence.xml -->
-<!-- <value>development</value> -->
-<!-- </systemProperty> -->
+ <!-- <systemProperty> -->
+ <!-- <key>kune.db.persistence.name</key> -->
+ <!-- Persistence name, choose between: production, development,
+ test_db (testing environment using mysql db), test (testing environment using
+ h2 db). See persistence.xml -->
+ <!-- <value>development</value> -->
+ <!-- </systemProperty> -->
<systemProperty>
<key>wave.server.config</key>
<value>src/main/resources/wave-server.properties</value>
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-11-30 01:31:04 UTC (rev 1632)
@@ -1558,4 +1558,17 @@
.k-dotted-tabpanel .gwt-TabLayoutPanelTab-selected {
background-color: #dd8a3d;
+}
+
+/* Calendar */
+
+.gwt-cal-MonthView {
+ bottom: 0 !important;
+ height: auto !important;
+ left: 0 !important;
+ overflow: auto !important;
+ position: absolute !important;
+ right: 0 !important;
+ top: 0 !important;
+ width: auto !important;
}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/core/server/rack/AdminThread.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rack/AdminThread.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/rack/AdminThread.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,41 @@
+package cc.kune.core.server.rack;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+import com.google.inject.Singleton;
+
+@Singleton
+public class AdminThread extends Thread {
+
+ private ServerSocket socket;
+
+ public AdminThread() {
+ setDaemon(true);
+ setName("StopMonitor");
+ try {
+ socket = new ServerSocket(8079, 1, InetAddress.getByName("127.0.0.1"));
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void run() {
+ System.out.println("*** running jetty 'stop' thread");
+ Socket accept;
+ try {
+ accept = socket.accept();
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(accept.getInputStream()));
+ reader.readLine();
+ System.out.println("*** stopping jetty embedded server");
+ accept.close();
+ socket.close();
+ } catch (final Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/events/KuneEvents.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/events/KuneEvents.gwt.xml 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/KuneEvents.gwt.xml 2011-11-30 01:31:04 UTC (rev 1632)
@@ -1,6 +1,9 @@
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.1.0//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.1.0/distro-source/core/…">
<module>
- <inherits name="cc.kune.core.KuneCore" />
- <source path="client" />
- <source path="shared" />
+ <inherits name="cc.kune.core.KuneCore"/>
+ <source path="client"/>
+ <source path="shared"/>
+ <inherits name='com.bradrydzewski.gwt.calendar.Calendar'/>
+ <inherits name='com.bradrydzewski.gwt.calendar.theme.google.Google'/>
+ <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
</module>
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/events/client/EventsGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/EventsGinModule.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/client/EventsGinModule.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -19,17 +19,37 @@
*/
package cc.kune.events.client;
+import cc.kune.common.client.ExtendedGinModule;
+import cc.kune.events.client.actions.Calendar1DayViewSelectBtn;
+import cc.kune.events.client.actions.Calendar3DaysViewSelectBtn;
+import cc.kune.events.client.actions.Calendar7DaysViewSelectBtn;
+import cc.kune.events.client.actions.CalendarGoNextBtn;
+import cc.kune.events.client.actions.CalendarGoPrevBtn;
+import cc.kune.events.client.actions.CalendarGoTodayBtn;
+import cc.kune.events.client.actions.CalendarMonthViewSelectBtn;
import cc.kune.events.client.actions.EventsClientActions;
+import cc.kune.events.client.viewer.CalendarViewer;
+import cc.kune.events.client.viewer.CalendarViewerPanel;
+import cc.kune.events.client.viewer.CalendarViewerPresenter;
import com.google.inject.Singleton;
-import com.gwtplatform.mvp.client.gin.AbstractPresenterModule;
-public class EventsGinModule extends AbstractPresenterModule {
+public class EventsGinModule extends ExtendedGinModule {
@Override
protected void configure() {
- bind(EventsClientTool.class).in(Singleton.class);
- bind(EventsClientActions.class).in(Singleton.class);
+ s(EventsClientTool.class);
+ s(EventsClientActions.class);
+ s(Calendar1DayViewSelectBtn.class);
+ s(Calendar3DaysViewSelectBtn.class);
+ s(Calendar7DaysViewSelectBtn.class);
+ s(CalendarMonthViewSelectBtn.class);
+ s(CalendarGoPrevBtn.class);
+ s(CalendarGoNextBtn.class);
+ s(CalendarGoTodayBtn.class);
+ bindPresenter(CalendarViewerPresenter.class, CalendarViewerPresenter.CalendarViewerView.class,
+ CalendarViewerPanel.class, CalendarViewerPresenter.CalendarViewerProxy.class);
+ bind(CalendarViewer.class).to(CalendarViewerPresenter.class).in(Singleton.class);
}
}
Modified: trunk/src/main/java/cc/kune/events/client/EventsGinjector.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/EventsGinjector.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/client/EventsGinjector.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -19,10 +19,14 @@
*/
package cc.kune.events.client;
+import cc.kune.events.client.viewer.CalendarViewerPresenter;
+
+import com.google.gwt.inject.client.AsyncProvider;
import com.google.gwt.inject.client.Ginjector;
public interface EventsGinjector extends Ginjector {
+ AsyncProvider<CalendarViewerPresenter> getCalendarViewerPresenter();
+
EventsParts getMeetingsParts();
-
}
Modified: trunk/src/main/java/cc/kune/events/client/EventsParts.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/EventsParts.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/client/EventsParts.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -21,10 +21,10 @@
import cc.kune.core.client.state.Session;
import cc.kune.events.client.actions.EventsClientActions;
+import cc.kune.events.client.viewer.CalendarViewer;
import cc.kune.events.shared.EventsConstants;
import cc.kune.gspace.client.tool.ContentViewerSelector;
import cc.kune.gspace.client.viewers.ContentViewerPresenter;
-import cc.kune.gspace.client.viewers.FolderViewerPresenter;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -34,9 +34,10 @@
@Inject
public EventsParts(final Session session, final Provider<EventsClientTool> clientTool,
final ContentViewerSelector viewerSelector, final EventsClientActions meetsActions,
- final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
+ final ContentViewerPresenter contentViewer, final CalendarViewer calendarViewer) {
clientTool.get();
+ // remove this...
viewerSelector.register(contentViewer, true, EventsConstants.TYPE_MEETING);
- viewerSelector.register(folderViewer, true, EventsConstants.TYPE_ROOT);
+ viewerSelector.register(calendarViewer, true, EventsConstants.TYPE_ROOT);
}
}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/events/client/actions/AbstractCalendarViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/AbstractCalendarViewSelectBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/AbstractCalendarViewSelectBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,18 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.gspace.client.viewers.ToolbarStyles;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+
+public class AbstractCalendarViewSelectBtn extends ButtonDescriptor {
+
+ public AbstractCalendarViewSelectBtn(final CalendarViewSelectAction action, final String text,
+ final int days, final CalendarViews view) {
+ super(text, action);
+ action.setDays(days);
+ action.setView(view);
+ this.withStyles(ToolbarStyles.CSSBTNC);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/Calendar1DayViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/Calendar1DayViewSelectBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/Calendar1DayViewSelectBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,16 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class Calendar1DayViewSelectBtn extends AbstractCalendarViewSelectBtn {
+
+ @Inject
+ public Calendar1DayViewSelectBtn(final CalendarViewSelectAction action,
+ final I18nTranslationService i18n) {
+ super(action, i18n.t("1 Day"), 1, CalendarViews.DAY);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/Calendar3DaysViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/Calendar3DaysViewSelectBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/Calendar3DaysViewSelectBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,16 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class Calendar3DaysViewSelectBtn extends AbstractCalendarViewSelectBtn {
+
+ @Inject
+ public Calendar3DaysViewSelectBtn(final CalendarViewSelectAction action,
+ final I18nTranslationService i18n) {
+ super(action, i18n.t("3 Days"), 3, CalendarViews.DAY);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/Calendar7DaysViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/Calendar7DaysViewSelectBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/Calendar7DaysViewSelectBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,16 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class Calendar7DaysViewSelectBtn extends AbstractCalendarViewSelectBtn {
+
+ @Inject
+ public Calendar7DaysViewSelectBtn(final CalendarViewSelectAction action,
+ final I18nTranslationService i18n) {
+ super(action, i18n.t("7 Days"), 7, CalendarViews.DAY);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextAction.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextAction.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,24 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.google.inject.Inject;
+
+public class CalendarGoNextAction extends RolAction {
+
+ private final CalendarViewer calViewer;
+
+ @Inject
+ public CalendarGoNextAction(final CalendarViewer calViewer) {
+ super(AccessRolDTO.Viewer, false);
+ this.calViewer = calViewer;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ calViewer.increment();
+ }
+}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoNextBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,17 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.ToolbarStyles;
+
+import com.google.inject.Inject;
+
+public class CalendarGoNextBtn extends ButtonDescriptor {
+
+ @Inject
+ public CalendarGoNextBtn(final CalendarGoNextAction action, final I18nTranslationService i18n) {
+ super("»", action);
+ this.withToolTip(i18n.t("Next")).withStyles(ToolbarStyles.CSSBTNR);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevAction.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevAction.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,24 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.google.inject.Inject;
+
+public class CalendarGoPrevAction extends RolAction {
+
+ private final CalendarViewer calViewer;
+
+ @Inject
+ public CalendarGoPrevAction(final CalendarViewer calViewer) {
+ super(AccessRolDTO.Viewer, false);
+ this.calViewer = calViewer;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ calViewer.decrement();
+ }
+}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoPrevBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,17 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.ToolbarStyles;
+
+import com.google.inject.Inject;
+
+public class CalendarGoPrevBtn extends ButtonDescriptor {
+
+ @Inject
+ public CalendarGoPrevBtn(final CalendarGoPrevAction action, final I18nTranslationService i18n) {
+ super("«", action);
+ this.withToolTip(i18n.t("Previous")).withStyles(ToolbarStyles.CSSBTNL);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayAction.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayAction.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,24 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.google.inject.Inject;
+
+public class CalendarGoTodayAction extends RolAction {
+
+ private final CalendarViewer calViewer;
+
+ @Inject
+ public CalendarGoTodayAction(final CalendarViewer calViewer) {
+ super(AccessRolDTO.Viewer, false);
+ this.calViewer = calViewer;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ calViewer.goToday();
+ }
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarGoTodayBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,17 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.viewers.ToolbarStyles;
+
+import com.google.inject.Inject;
+
+public class CalendarGoTodayBtn extends ButtonDescriptor {
+
+ @Inject
+ public CalendarGoTodayBtn(final CalendarGoTodayAction action, final I18nTranslationService i18n) {
+ super(i18n.t("Today"), action);
+ this.withToolTip(i18n.t("Go To Today")).withStyles(ToolbarStyles.CSSBTN);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarMonthViewSelectBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarMonthViewSelectBtn.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarMonthViewSelectBtn.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,16 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class CalendarMonthViewSelectBtn extends AbstractCalendarViewSelectBtn {
+
+ @Inject
+ public CalendarMonthViewSelectBtn(final CalendarViewSelectAction action,
+ final I18nTranslationService i18n) {
+ super(action, i18n.t("Month"), 1, CalendarViews.MONTH);
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/actions/CalendarViewSelectAction.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/CalendarViewSelectAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/actions/CalendarViewSelectAction.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,39 @@
+package cc.kune.events.client.actions;
+
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.core.client.actions.RolAction;
+import cc.kune.core.shared.dto.AccessRolDTO;
+import cc.kune.events.client.viewer.CalendarViewer;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.google.inject.Inject;
+
+public class CalendarViewSelectAction extends RolAction {
+
+ private final CalendarViewer calViewer;
+ private int days;
+ private CalendarViews view;
+
+ @Inject
+ public CalendarViewSelectAction(final CalendarViewer calViewer) {
+ super(AccessRolDTO.Viewer, false);
+ this.calViewer = calViewer;
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ if (days != 0) {
+ calViewer.setView(view, days);
+ } else {
+ calViewer.setView(view);
+ }
+ }
+
+ public void setDays(final int days) {
+ this.days = days;
+ }
+
+ public void setView(final CalendarViews view) {
+ this.view = view;
+ }
+}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/events/client/actions/EventsClientActions.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -49,16 +49,36 @@
final Provider<DelMeetingMenuItem> delContentMenuItem,
final Provider<ContentViewerOptionsMenu> optionsMenuContent,
final Provider<ParticipateInContentBtn> participateBtn,
- final Provider<RefreshContentMenuItem> refresh) {
+ final Provider<Calendar1DayViewSelectBtn> cal1DayBtn,
+ final Provider<Calendar3DaysViewSelectBtn> cal3DaysBtn,
+ final Provider<Calendar7DaysViewSelectBtn> cal7DaysBtn,
+ final Provider<CalendarMonthViewSelectBtn> calMonthBtn,
+ final Provider<CalendarGoPrevBtn> calPrevBtn, final Provider<CalendarGoNextBtn> calNextBtn,
+ final Provider<CalendarGoTodayBtn> goToday, final Provider<RefreshContentMenuItem> refresh) {
super(session, stateManager, i18n, registry);
actionsRegistry.addAction(ActionGroups.TOOLBAR, optionsMenuContent, all);
actionsRegistry.addAction(ActionGroups.TOOLBAR, refresh, all);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, newMeetingsBtn, containers);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn, contents);
- actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, all);
- actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, contents);
- actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem, containersNoRoot);
- actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem, contents);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, goToday, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, calPrevBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, cal1DayBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, cal3DaysBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, cal7DaysBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, calMonthBtn, containers);
+ actionsRegistry.addAction(ActionGroups.TOOLBAR, calNextBtn, containers);
+
+ // For now, commented:
+ // actionsRegistry.addAction(ActionGroups.TOOLBAR, newMeetingsBtn,
+ // containers);
+ // actionsRegistry.addAction(ActionGroups.TOOLBAR, participateBtn,
+ // contents);
+ // actionsRegistry.addAction(ActionGroups.TOOLBAR, folderGoUp, all);
+ // actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem,
+ // contents);
+ // actionsRegistry.addAction(ActionGroups.ITEM_MENU, openContentMenuItem,
+ // containersNoRoot);
+ // actionsRegistry.addAction(ActionGroups.ITEM_MENU, delContentMenuItem,
+ // contents);
+
}
@Override
Added: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewer.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,23 @@
+package cc.kune.events.client.viewer;
+
+import java.util.Date;
+
+import cc.kune.gspace.client.tool.ContentViewer;
+
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+
+public interface CalendarViewer extends ContentViewer {
+ void decrement();
+
+ Date getDate();
+
+ void goToday();
+
+ void increment();
+
+ void setDate(Date date);
+
+ void setView(CalendarViews view);
+
+ void setView(CalendarViews view, int days);
+}
Added: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPanel.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,208 @@
+package cc.kune.events.client.viewer;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.core.client.dnd.FolderViewerDropController;
+import cc.kune.core.client.dnd.KuneDragController;
+import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.events.client.viewer.CalendarViewerPresenter.CalendarViewerView;
+import cc.kune.gspace.client.GSpaceArmor;
+import cc.kune.gspace.client.viewers.AbstractFolderViewerPanel;
+import cc.kune.gspace.client.viewers.FolderItemDescriptor;
+
+import com.bradrydzewski.gwt.calendar.client.Appointment;
+import com.bradrydzewski.gwt.calendar.client.AppointmentStyle;
+import com.bradrydzewski.gwt.calendar.client.Calendar;
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.bradrydzewski.gwt.calendar.client.event.CreateHandler;
+import com.bradrydzewski.gwt.calendar.client.event.DateRequestHandler;
+import com.bradrydzewski.gwt.calendar.client.event.DeleteHandler;
+import com.bradrydzewski.gwt.calendar.client.event.MouseOverHandler;
+import com.bradrydzewski.gwt.calendar.client.event.TimeBlockClickHandler;
+import com.bradrydzewski.gwt.calendar.client.event.UpdateHandler;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.gwt.event.logical.shared.OpenHandler;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class CalendarViewerPanel extends AbstractFolderViewerPanel implements CalendarViewerView {
+
+ private final Calendar calendar;
+
+ @Inject
+ public CalendarViewerPanel(final GSpaceArmor gsArmor, final I18nTranslationService i18n,
+ final GuiProvider guiProvider, final CoreResources res,
+ final ContentCapabilitiesRegistry capabilitiesRegistry, final KuneDragController dragController,
+ final Provider<FolderViewerDropController> dropControllerProv) {
+ super(gsArmor, i18n, capabilitiesRegistry, dragController, dropControllerProv);
+ calendar = new Calendar();
+ // calendar.setWidth("auto");
+ // calendar.setHeight("auto");
+ widget = calendar;
+ }
+
+ @Override
+ public void addAppointment(final Appointment appointment) {
+ calendar.addAppointment(appointment);
+ }
+
+ @Override
+ public void addAppointment(final String title, final Date date) {
+ // Should this be used or serialize from server side?
+ final Appointment appt = new Appointment();
+ appt.setStart(date);
+ appt.setEnd(date);
+ appt.setTitle(title);
+ appt.setStyle(AppointmentStyle.ORANGE);
+ calendar.addAppointment(appt);
+ // FIXME NotiUser
+ }
+
+ @Override
+ public void addAppointments(final ArrayList<Appointment> appointments) {
+ calendar.addAppointments(appointments);
+ }
+
+ @Override
+ public HandlerRegistration addCreateHandler(final CreateHandler<Appointment> handler) {
+ return calendar.addCreateHandler(handler);
+ }
+
+ @Override
+ public HandlerRegistration addDateRequestHandler(final DateRequestHandler<Date> handler) {
+ return calendar.addDateRequestHandler(handler);
+ }
+
+ @Override
+ public HandlerRegistration addDeleteHandler(final DeleteHandler<Appointment> handler) {
+ return calendar.addDeleteHandler(handler);
+ }
+
+ @Override
+ public void addItem(final FolderItemDescriptor item, final ClickHandler clickHandler,
+ final DoubleClickHandler doubleClickHandler) {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public HandlerRegistration addMouseOverHandler(final MouseOverHandler<Appointment> handler) {
+ return calendar.addMouseOverHandler(handler);
+ }
+
+ @Override
+ public HandlerRegistration addOpenHandler(final OpenHandler<Appointment> handler) {
+ return calendar.addOpenHandler(handler);
+ }
+
+ @Override
+ public HandlerRegistration addSelectionHandler(final SelectionHandler<Appointment> handler) {
+ return calendar.addSelectionHandler(handler);
+ }
+
+ @Override
+ public HandlerRegistration addTimeBlockClickHandler(final TimeBlockClickHandler<Date> handler) {
+ return calendar.addTimeBlockClickHandler(handler);
+ }
+
+ @Override
+ public HandlerRegistration addUpdateHandler(final UpdateHandler<Appointment> handler) {
+ return calendar.addUpdateHandler(handler);
+ }
+
+ @Override
+ public void attach() {
+ super.attach();
+ gsArmor.enableCenterScroll(false);
+ }
+
+ @Override
+ public void clearAppointments() {
+ calendar.clearAppointments();
+ }
+
+ @Override
+ public void doLayout() {
+ calendar.doLayout();
+ }
+
+ @Override
+ public void fireEvent(final GwtEvent<?> event) {
+ calendar.fireEvent(event);
+ }
+
+ @Override
+ public Date getDate() {
+ return calendar.getDate();
+ }
+
+ @Override
+ public Appointment getSelectedAppointment() {
+ return calendar.getSelectedAppointment();
+ }
+
+ @Override
+ public void goToday() {
+ calendar.setDate(new Date()); // calendar date, not required
+ }
+
+ @Override
+ public boolean hasAppointmentSelected() {
+ return calendar.hasAppointmentSelected();
+ }
+
+ @Override
+ public void removeAppointment(final Appointment appointment) {
+ calendar.removeAppointment(appointment);
+ }
+
+ @Override
+ public void removeAppointment(final Appointment appointment, final boolean fireEvents) {
+ calendar.removeAppointment(appointment, fireEvents);
+ }
+
+ @Override
+ public void resumeLayout() {
+ calendar.resumeLayout();
+ }
+
+ @Override
+ public void setDate(final Date date) {
+ calendar.setDate(date);
+ }
+
+ @Override
+ public void setSelectedAppointment(final Appointment appointment) {
+ calendar.setSelectedAppointment(appointment);
+ }
+
+ @Override
+ public void setSelectedAppointment(final Appointment appointment, final boolean fireEvents) {
+ calendar.setSelectedAppointment(appointment, fireEvents);
+ }
+
+ @Override
+ public void setView(final CalendarViews view) {
+ calendar.setView(view);
+ calendar.scrollToHour(6);
+ }
+
+ @Override
+ public void setView(final CalendarViews view, final int days) {
+ calendar.setView(view, days);
+ calendar.scrollToHour(6);
+ }
+
+ @Override
+ public void suspendLayout() {
+ calendar.suspendLayout();
+ }
+
+}
Added: trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/client/viewer/CalendarViewerPresenter.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,176 @@
+package cc.kune.events.client.viewer;
+
+import java.util.Date;
+
+import javax.annotation.Nonnull;
+
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.core.shared.dto.HasContent;
+import cc.kune.gspace.client.viewers.AbstractFolderViewerView;
+import cc.kune.gspace.client.viewers.FolderViewerUtils;
+
+import com.bradrydzewski.gwt.calendar.client.Appointment;
+import com.bradrydzewski.gwt.calendar.client.CalendarViews;
+import com.bradrydzewski.gwt.calendar.client.HasAppointments;
+import com.bradrydzewski.gwt.calendar.client.HasLayout;
+import com.bradrydzewski.gwt.calendar.client.event.CreateHandler;
+import com.bradrydzewski.gwt.calendar.client.event.HasDateRequestHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.HasDeleteHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.HasMouseOverHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.HasTimeBlockClickHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.HasUpdateHandlers;
+import com.bradrydzewski.gwt.calendar.client.event.TimeBlockClickEvent;
+import com.bradrydzewski.gwt.calendar.client.event.TimeBlockClickHandler;
+import com.google.gwt.event.logical.shared.HasOpenHandlers;
+import com.google.gwt.event.logical.shared.HasSelectionHandlers;
+import com.google.gwt.event.logical.shared.SelectionEvent;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.datepicker.client.CalendarUtil;
+import com.google.inject.Inject;
+import com.gwtplatform.mvp.client.Presenter;
+import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
+import com.gwtplatform.mvp.client.proxy.Proxy;
+import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
+
+public class CalendarViewerPresenter extends
+ Presenter<CalendarViewerPresenter.CalendarViewerView, CalendarViewerPresenter.CalendarViewerProxy>
+ implements CalendarViewer {
+
+ @ProxyCodeSplit
+ public interface CalendarViewerProxy extends Proxy<CalendarViewerPresenter> {
+ }
+
+ public interface CalendarViewerView extends HasSelectionHandlers<Appointment>,
+ HasDeleteHandlers<Appointment>, HasOpenHandlers<Appointment>, HasTimeBlockClickHandlers<Date>,
+ HasUpdateHandlers<Appointment>, HasDateRequestHandlers<Date>, HasMouseOverHandlers<Appointment>,
+ HasLayout, HasAppointments, AbstractFolderViewerView {
+
+ void addAppointment(String title, Date date);
+
+ HandlerRegistration addCreateHandler(CreateHandler<Appointment> handler);
+
+ Date getDate();
+
+ void goToday();
+
+ void setDate(Date date);
+
+ void setView(CalendarViews view);
+
+ void setView(CalendarViews view, int days);
+
+ }
+
+ private static final CalendarViews DEF_VIEW = CalendarViews.DAY;
+ private CalendarViews currentCalView;
+ private int currentDaysView = 7;
+ private final FolderViewerUtils folderViewerUtils;
+
+ @Inject
+ public CalendarViewerPresenter(final EventBus eventBus, final CalendarViewerView view,
+ final CalendarViewerProxy proxy, final FolderViewerUtils folderViewerUtils) {
+ super(eventBus, view, proxy);
+ this.folderViewerUtils = folderViewerUtils;
+ addListeners();
+ setViewImpl(DEF_VIEW, currentDaysView);
+ }
+
+ private void addListeners() {
+ getView().addTimeBlockClickHandler(new TimeBlockClickHandler<Date>() {
+ @Override
+ public void onTimeBlockClick(final TimeBlockClickEvent<Date> event) {
+ getView().addAppointment("Only a test", event.getTarget());
+ NotifyUser.info("Appointment added but not yet saved (this is under development)");
+ }
+ });
+ getView().addSelectionHandler(new SelectionHandler<Appointment>() {
+ @Override
+ public void onSelection(final SelectionEvent<Appointment> event) {
+ // getView().removeAppointment(event.getSelectedItem());
+ }
+ });
+ }
+
+ @Override
+ public void attach() {
+ getView().attach();
+ }
+
+ @Override
+ public void decrement() {
+ incrementDate(false);
+ }
+
+ @Override
+ public void detach() {
+ getView().detach();
+ }
+
+ @Override
+ public Date getDate() {
+ return getView().getDate();
+ }
+
+ @Override
+ public void goToday() {
+ getView().goToday();
+ }
+
+ @Override
+ public void increment() {
+ incrementDate(true);
+ }
+
+ private void incrementDate(final boolean positive) {
+ final Date date = getDate();
+ switch (currentCalView) {
+ case DAY:
+ case AGENDA:
+ CalendarUtil.addDaysToDate(date, currentDaysView * (positive ? 1 : -1));
+ break;
+ case MONTH:
+ CalendarUtil.addMonthsToDate(date, (positive ? 1 : -1));
+ break;
+ }
+ setDate(date);
+ }
+
+ @Override
+ protected void revealInParent() {
+ RevealRootContentEvent.fire(this, this);
+ }
+
+ @Override
+ public void setContent(@Nonnull final HasContent state) {
+ folderViewerUtils.setContent(getView(), state);
+ }
+
+ @Override
+ public void setDate(final Date date) {
+ getView().setDate(date);
+ }
+
+ @Override
+ public void setView(final CalendarViews calView) {
+ setViewImpl(calView);
+ }
+
+ @Override
+ public void setView(final CalendarViews calView, final int days) {
+ setViewImpl(calView, days);
+ }
+
+ private void setViewImpl(final CalendarViews calView) {
+ this.currentCalView = calView;
+ this.currentDaysView = 1;
+ getView().setView(calView);
+ }
+
+ private void setViewImpl(final CalendarViews calView, final int days) {
+ this.currentCalView = calView;
+ this.currentDaysView = days;
+ getView().setView(calView, days);
+ }
+}
Added: trunk/src/main/java/cc/kune/events/server/CalendarServerUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/events/server/CalendarServerUtils.java (rev 0)
+++ trunk/src/main/java/cc/kune/events/server/CalendarServerUtils.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,71 @@
+package cc.kune.events.server;
+
+import net.fortuna.ical4j.model.Date;
+import net.fortuna.ical4j.model.DateTime;
+import net.fortuna.ical4j.model.Property;
+import net.fortuna.ical4j.model.TimeZone;
+import net.fortuna.ical4j.model.TimeZoneRegistry;
+import net.fortuna.ical4j.model.TimeZoneRegistryFactory;
+import net.fortuna.ical4j.model.component.VEvent;
+import net.fortuna.ical4j.model.component.VTimeZone;
+import net.fortuna.ical4j.model.parameter.Value;
+import net.fortuna.ical4j.model.property.Description;
+import net.fortuna.ical4j.model.property.DtEnd;
+import net.fortuna.ical4j.model.property.DtStart;
+import net.fortuna.ical4j.model.property.Location;
+import net.fortuna.ical4j.model.property.Summary;
+
+import com.bradrydzewski.gwt.calendar.client.Appointment;
+
+public class CalendarServerUtils {
+
+ public static VEvent from(final Appointment app) {
+ final TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
+ final TimeZone timezone = registry.getTimeZone("GMT");
+ final VTimeZone tz = timezone.getVTimeZone();
+
+ // FIXME here v timezone!!!
+ final DateTime start = new DateTime(app.getStart().getTime());
+ start.setTimeZone(timezone);
+ final DateTime end = new DateTime(app.getEnd().getTime());
+ end.setTimeZone(timezone);
+ VEvent event;
+ if (app.isAllDay()) {
+ event = new VEvent();
+ event.getProperties().add(new DtStart(new Date(app.getStart().getTime())));
+ event.getProperties().add(new DtEnd(new Date(app.getEnd().getTime())));
+ event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE);
+ event.getProperties().getProperty(Property.DTEND).getParameters().add(Value.DATE);
+ } else {
+ event = new VEvent(start, end, app.getTitle());
+ event.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE_TIME);
+ event.getProperties().getProperty(Property.DTEND).getParameters().add(Value.DATE_TIME);
+ }
+ event.getProperties().add(new Summary(app.getTitle()));
+ event.getProperties().add(new Description(app.getDescription()));
+ event.getProperties().add(new Location(app.getLocation()));
+ // FIXME uid
+ // event.getProperties().add( new UidGenerator()app.getId()));
+ return event;
+ }
+
+ public static Appointment to(final VEvent event) {
+ final Appointment app = new Appointment();
+
+ // FIXME: see spec
+ app.setDescription(event.getDescription().getValue());
+ app.setStart(new java.util.Date(event.getStartDate().getDate().getTime()));
+ app.setEnd(new java.util.Date(event.getEndDate().getDate().getTime()));
+
+ // FIXME: see spec
+ app.setLocation(event.getLocation().getValue());
+ // final Uid uid = event.getUid();
+ // if (uid != null) {
+ // app.setId(uid.getValue());
+ // }
+ app.setAllDay(!(event.getStartDate().getDate() instanceof DateTime));
+ app.setTitle(event.getSummary().getValue());
+ return app;
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceArmor.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -35,7 +35,7 @@
ForIsWidget getDocFooter();
- IsActionExtensible getEntityFooterToolbar();
+ IsActionExtensible getDocFooterToolbar();
ForIsWidget getDocHeader();
@@ -43,6 +43,8 @@
ForIsWidget getEntityFooter();
+ IsActionExtensible getEntityFooterToolbar();
+
ForIsWidget getEntityHeader();
ForIsWidget getEntityToolsCenter();
@@ -51,8 +53,6 @@
ForIsWidget getEntityToolsSouth();
- IsActionExtensible getDocFooterToolbar();
-
IsActionExtensible getHeaderToolbar();
SimplePanel getHomeSpace();
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -114,6 +114,7 @@
import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerAsTablePanel;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
+import cc.kune.gspace.client.viewers.FolderViewerUtils;
import cc.kune.gspace.client.viewers.NoHomePageViewer;
import cc.kune.gspace.client.viewers.PathToolbarUtils;
@@ -129,7 +130,7 @@
@Override
protected void configure() {
s(PathToolbarUtils.class);
-
+ s(FolderViewerUtils.class);
bindPresenter(EntityLicensePresenter.class, EntityLicensePresenter.EntityLicenseView.class,
EntityLicensePanel.class, EntityLicensePresenter.EntityLicenseProxy.class);
bindPresenter(TagsSummaryPresenter.class, TagsSummaryPresenter.TagsSummaryView.class,
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -74,8 +74,10 @@
final Provider<GiveUsFeedbackBtn> giveUsFeedback,
final Provider<I18nToTranslateGridPanel> toTrans,
final Provider<I18nTranslatorTabsCollection> gtranslator,
- final Provider<WriteToBuddyHeaderButton> writeToBuddie) {
+ final Provider<WriteToBuddyHeaderButton> writeToBuddie
+ ) {
+
session.onAppStart(true, new AppStartHandler() {
@Override
public void onAppStart(final AppStartEvent event) {
Added: trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerView.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerView.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/AbstractFolderViewerView.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,36 @@
+package cc.kune.gspace.client.viewers;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.ui.HasEditHandler;
+import cc.kune.core.shared.dto.StateContainerDTO;
+
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.gwtplatform.mvp.client.View;
+
+public interface AbstractFolderViewerView extends View {
+ void addItem(FolderItemDescriptor item, ClickHandler clickHandler,
+ DoubleClickHandler doubleClickHandler);
+
+ void attach();
+
+ void clear();
+
+ void detach();
+
+ void editTitle();
+
+ HasEditHandler getEditTitle();
+
+ void highlightTitle();
+
+ void setContainer(StateContainerDTO state);
+
+ void setEditableTitle(String title);
+
+ void setFooterActions(GuiActionDescCollection actions);
+
+ void setSubheaderActions(GuiActionDescCollection actions);
+
+ void showEmptyMsg(String message);
+}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerPresenter.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -21,44 +21,20 @@
import javax.annotation.Nonnull;
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
import cc.kune.common.client.ui.EditEvent;
import cc.kune.common.client.ui.EditEvent.EditHandler;
-import cc.kune.common.client.ui.HasEditHandler;
-import cc.kune.common.client.utils.TextUtils;
-import cc.kune.core.client.actions.ActionRegistryByType;
-import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
-import cc.kune.core.client.registry.IconsRegistry;
-import cc.kune.core.client.services.FileDownloadUtils;
-import cc.kune.core.client.services.ImageSize;
import cc.kune.core.client.state.Session;
-import cc.kune.core.client.state.StateManager;
-import cc.kune.core.shared.domain.ContentStatus;
-import cc.kune.core.shared.domain.utils.AccessRights;
import cc.kune.core.shared.domain.utils.StateToken;
-import cc.kune.core.shared.dto.AbstractContentSimpleDTO;
-import cc.kune.core.shared.dto.BasicMimeTypeDTO;
-import cc.kune.core.shared.dto.ContainerDTO;
-import cc.kune.core.shared.dto.ContainerSimpleDTO;
-import cc.kune.core.shared.dto.ContentSimpleDTO;
import cc.kune.core.shared.dto.HasContent;
-import cc.kune.core.shared.dto.StateContainerDTO;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-import cc.kune.gspace.client.actions.ActionGroups;
import cc.kune.gspace.client.actions.RenameAction;
import cc.kune.gspace.client.actions.RenameListener;
import cc.kune.gspace.client.tool.ContentViewer;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.DoubleClickEvent;
-import com.google.gwt.event.dom.client.DoubleClickHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.inject.Inject;
import com.google.inject.Provider;
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;
@@ -71,103 +47,25 @@
public interface FolderViewerProxy extends Proxy<FolderViewerPresenter> {
}
- public interface FolderViewerView extends View {
-
+ public interface FolderViewerView extends AbstractFolderViewerView {
long NO_DATE = 0;
-
- void addItem(FolderItemDescriptor item, ClickHandler clickHandler,
- DoubleClickHandler doubleClickHandler);
-
- void attach();
-
- void clear();
-
- void detach();
-
- void editTitle();
-
- HasEditHandler getEditTitle();
-
- void highlightTitle();
-
- void setContainer(StateContainerDTO state);
-
- void setEditableTitle(String title);
-
- void setFooterActions(GuiActionDescCollection actions);
-
- void setSubheaderActions(GuiActionDescCollection actions);
-
- void showEmptyMsg(String message);
}
- private final ActionRegistryByType actionsRegistry;
- private final ContentCapabilitiesRegistry capabilitiesRegistry;
- private final Provider<FileDownloadUtils> downloadUtilsProvider;
private HandlerRegistration editHandler;
- private final I18nTranslationService i18n;
- private final IconsRegistry iconsRegistry;
- private final PathToolbarUtils pathToolbarUtils;
+ private final FolderViewerUtils folderViewerUtils;
private final Provider<RenameAction> renameAction;
private final Session session;
- private final StateManager stateManager;
- private final boolean useGenericImageIcon;
@Inject
public FolderViewerPresenter(final EventBus eventBus, final FolderViewerView view,
- final FolderViewerProxy proxy, final Session session, final StateManager stateManager,
- final I18nTranslationService i18n, final ActionRegistryByType actionsRegistry,
- final Provider<FileDownloadUtils> downloadUtilsProvider,
- final Provider<RenameAction> renameAction, final ContentCapabilitiesRegistry capabilitiesRegistry,
- final PathToolbarUtils pathToolbarUtils) {
+ final FolderViewerProxy proxy, final Session session, final Provider<RenameAction> renameAction,
+ final FolderViewerUtils folderViewerUtils) {
super(eventBus, view, proxy);
this.session = session;
- this.stateManager = stateManager;
- this.i18n = i18n;
- this.actionsRegistry = actionsRegistry;
- this.downloadUtilsProvider = downloadUtilsProvider;
- this.capabilitiesRegistry = capabilitiesRegistry;
- this.pathToolbarUtils = pathToolbarUtils;
- iconsRegistry = capabilitiesRegistry.getIconsRegistry();
- useGenericImageIcon = false;
+ this.folderViewerUtils = folderViewerUtils;
this.renameAction = renameAction;
}
- private void addItem(final AbstractContentSimpleDTO content, final BasicMimeTypeDTO mimeType,
- final ContentStatus status, final StateToken parentStateToken, final AccessRights rights,
- final long modifiedOn) {
- final StateToken stateToken = content.getStateToken();
- final String typeId = content.getTypeId();
- final String name = content.getName();
- final Object icon = mimeType != null ? getIcon(stateToken, typeId, mimeType) : getIcon(stateToken,
- typeId, status);
- final String tooltip = getTooltip(stateToken, mimeType, capabilitiesRegistry.isDragable(typeId)
- && rights.isAdministrable());
- if (status.equals(ContentStatus.inTheDustbin)
- && (!capabilitiesRegistry.showDeleted(typeId) && !session.getShowDeletedContent())) {
- // Don't show
- // NotifyUser.info("Deleted, don't show");
- } else {
- final FolderItemDescriptor item = new FolderItemDescriptor(genId(stateToken),
- genId(parentStateToken), icon, name, tooltip, status, stateToken, modifiedOn,
- capabilitiesRegistry.isDragable(typeId) && rights.isAdministrable(),
- capabilitiesRegistry.isDropable(typeId) && rights.isAdministrable(),
- actionsRegistry.getCurrentActions(content, typeId, status, session.isLogged(), rights,
- ActionGroups.ITEM_MENU));
- getView().addItem(item, new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- stateManager.gotoStateToken(stateToken);
- }
- }, new DoubleClickHandler() {
- @Override
- public void onDoubleClick(final DoubleClickEvent event) {
- stateManager.gotoStateToken(stateToken);
- }
- });
- }
- }
-
@Override
public void attach() {
getView().attach();
@@ -176,33 +74,6 @@
}
}
- private void createChildItems(final ContainerDTO container, final AccessRights containerRights) {
- if (container.getContents().size() + container.getChilds().size() == 0) {
- String msg = null;
- final String typeId = container.getTypeId();
- if (session.isLogged()) {
- msg = capabilitiesRegistry.getEmptyMessagesRegistry().getContentTypeIcon(typeId);
- } else {
- msg = capabilitiesRegistry.getEmptyMessagesRegistryNotLogged().getContentTypeIcon(typeId);
- }
- final String emptyMessage = TextUtils.empty(msg) ? i18n.t("This is empty.") : i18n.t(msg);
- getView().showEmptyMsg(emptyMessage);
- } else {
- // Folders
- for (final ContainerSimpleDTO childFolder : container.getChilds()) {
- addItem(childFolder, null, ContentStatus.publishedOnline,
- childFolder.getStateToken().copy().setFolder(childFolder.getParentFolderId()),
- containerRights, FolderViewerView.NO_DATE);
- }
- // Other contents (docs, etc)
- for (final ContentSimpleDTO content : container.getContents()) {
- assert content != null;
- addItem(content, content.getMimeType(), content.getStatus(),
- content.getStateToken().copy().clearDocument(), content.getRights(), content.getModifiedOn());
- }
- }
- }
-
private void createEditHandler() {
// Duplicate in DocViewerPresenter
editHandler = getView().getEditTitle().addEditHandler(new EditHandler() {
@@ -233,34 +104,6 @@
getView().editTitle();
}
- private String genId(final StateToken token) {
- return "k-cnav-" + token.toString().replace(StateToken.SEPARATOR, "-");
- }
-
- private Object getIcon(final StateToken token, final String contentTypeId,
- final BasicMimeTypeDTO mimeType) {
- if (!useGenericImageIcon && mimeType != null && mimeType.getType().equals("image")) {
- return downloadUtilsProvider.get().getImageResizedUrl(token, ImageSize.ico);
- } else {
- return iconsRegistry.getContentTypeIcon(contentTypeId, mimeType);
- }
- }
-
- private Object getIcon(final StateToken stateToken, final String typeId, final ContentStatus status) {
- return iconsRegistry.getContentTypeIcon(typeId, status);
- }
-
- private String getTooltip(final StateToken token, final BasicMimeTypeDTO mimeType,
- final boolean draggable) {
- if (mimeType != null && (mimeType.isImage() || mimeType.isPdf())) {
- // Used for previews
- return null;
- } else {
- return draggable ? i18n.t("Double click to open. Drag and drop to move this to another place")
- : i18n.t("Double click to open");
- }
- }
-
public void highlightTitle() {
getView().highlightTitle();
}
@@ -276,17 +119,6 @@
@Override
public void setContent(@Nonnull final HasContent state) {
- getView().clear();
- final StateContainerDTO stateContainer = (StateContainerDTO) state;
- getView().setContainer(stateContainer);
- final AccessRights rights = stateContainer.getContainerRights();
- // NotifyUser.info("Rights: " + rights, true);
- final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContainer.getGroup(),
- stateContainer.getTypeId(), session.isLogged(), rights, ActionGroups.TOOLBAR);
- final ContainerDTO container = stateContainer.getContainer();
- final GuiActionDescCollection pathActions = pathToolbarUtils.createPath(container, true);
- getView().setSubheaderActions(actions);
- getView().setFooterActions(pathActions);
- createChildItems(container, stateContainer.getContainerRights());
+ folderViewerUtils.setContent(getView(), state);
}
}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/FolderViewerUtils.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,171 @@
+package cc.kune.gspace.client.viewers;
+
+import javax.annotation.Nonnull;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.utils.TextUtils;
+import cc.kune.core.client.actions.ActionRegistryByType;
+import cc.kune.core.client.registry.ContentCapabilitiesRegistry;
+import cc.kune.core.client.registry.IconsRegistry;
+import cc.kune.core.client.services.FileDownloadUtils;
+import cc.kune.core.client.services.ImageSize;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.domain.ContentStatus;
+import cc.kune.core.shared.domain.utils.AccessRights;
+import cc.kune.core.shared.domain.utils.StateToken;
+import cc.kune.core.shared.dto.AbstractContentSimpleDTO;
+import cc.kune.core.shared.dto.BasicMimeTypeDTO;
+import cc.kune.core.shared.dto.ContainerDTO;
+import cc.kune.core.shared.dto.ContainerSimpleDTO;
+import cc.kune.core.shared.dto.ContentSimpleDTO;
+import cc.kune.core.shared.dto.HasContent;
+import cc.kune.core.shared.dto.StateContainerDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.actions.ActionGroups;
+import cc.kune.gspace.client.viewers.FolderViewerPresenter.FolderViewerView;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickEvent;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+
+public class FolderViewerUtils {
+
+ private final ActionRegistryByType actionsRegistry;
+ private final ContentCapabilitiesRegistry capabilitiesRegistry;
+ private final Provider<FileDownloadUtils> downloadUtilsProvider;
+ private final I18nTranslationService i18n;
+ private final IconsRegistry iconsRegistry;
+ private final PathToolbarUtils pathToolbarUtils;
+ private final Session session;
+ private final StateManager stateManager;
+ private AbstractFolderViewerView view;
+
+ @Inject
+ public FolderViewerUtils(final ContentCapabilitiesRegistry capabilitiesRegistry,
+ final Session session, final Provider<FileDownloadUtils> downloadUtilsProvider,
+ final I18nTranslationService i18n, final ActionRegistryByType actionsRegistry,
+ final StateManager stateManager, final PathToolbarUtils pathToolbarUtils) {
+ this.capabilitiesRegistry = capabilitiesRegistry;
+ this.session = session;
+ this.downloadUtilsProvider = downloadUtilsProvider;
+ this.i18n = i18n;
+ this.actionsRegistry = actionsRegistry;
+ this.stateManager = stateManager;
+ this.iconsRegistry = capabilitiesRegistry.getIconsRegistry();
+ this.pathToolbarUtils = pathToolbarUtils;
+ }
+
+ private void addItem(final AbstractContentSimpleDTO content, final BasicMimeTypeDTO mimeType,
+ final ContentStatus status, final StateToken parentStateToken, final AccessRights rights,
+ final long modifiedOn) {
+ final StateToken stateToken = content.getStateToken();
+ final String typeId = content.getTypeId();
+ final String name = content.getName();
+ final Object icon = mimeType != null ? getIcon(stateToken, typeId, mimeType) : getIcon(stateToken,
+ typeId, status);
+ final String tooltip = getTooltip(stateToken, mimeType, capabilitiesRegistry.isDragable(typeId)
+ && rights.isAdministrable());
+ if (status.equals(ContentStatus.inTheDustbin)
+ && (!capabilitiesRegistry.showDeleted(typeId) && !session.getShowDeletedContent())) {
+ // Don't show
+ // NotifyUser.info("Deleted, don't show");
+ } else {
+ final FolderItemDescriptor item = new FolderItemDescriptor(genId(stateToken),
+ genId(parentStateToken), icon, name, tooltip, status, stateToken, modifiedOn,
+ capabilitiesRegistry.isDragable(typeId) && rights.isAdministrable(),
+ capabilitiesRegistry.isDropable(typeId) && rights.isAdministrable(),
+ actionsRegistry.getCurrentActions(content, typeId, status, session.isLogged(), rights,
+ ActionGroups.ITEM_MENU));
+ getView().addItem(item, new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ stateManager.gotoStateToken(stateToken);
+ }
+ }, new DoubleClickHandler() {
+ @Override
+ public void onDoubleClick(final DoubleClickEvent event) {
+ stateManager.gotoStateToken(stateToken);
+ }
+ });
+ }
+ }
+
+ private void createChildItems(final ContainerDTO container, final AccessRights containerRights) {
+ if (container.getContents().size() + container.getChilds().size() == 0) {
+ String msg = null;
+ final String typeId = container.getTypeId();
+ if (session.isLogged()) {
+ msg = capabilitiesRegistry.getEmptyMessagesRegistry().getContentTypeIcon(typeId);
+ } else {
+ msg = capabilitiesRegistry.getEmptyMessagesRegistryNotLogged().getContentTypeIcon(typeId);
+ }
+ final String emptyMessage = TextUtils.empty(msg) ? i18n.t("This is empty.") : i18n.t(msg);
+ getView().showEmptyMsg(emptyMessage);
+ } else {
+ // Folders
+ for (final ContainerSimpleDTO childFolder : container.getChilds()) {
+ addItem(childFolder, null, ContentStatus.publishedOnline,
+ childFolder.getStateToken().copy().setFolder(childFolder.getParentFolderId()),
+ containerRights, FolderViewerView.NO_DATE);
+ }
+ // Other contents (docs, etc)
+ for (final ContentSimpleDTO content : container.getContents()) {
+ assert content != null;
+ addItem(content, content.getMimeType(), content.getStatus(),
+ content.getStateToken().copy().clearDocument(), content.getRights(), content.getModifiedOn());
+ }
+ }
+ }
+
+ private String genId(final StateToken token) {
+ return "k-cnav-" + token.toString().replace(StateToken.SEPARATOR, "-");
+ }
+
+ private Object getIcon(final StateToken token, final String contentTypeId,
+ final BasicMimeTypeDTO mimeType) {
+ if (mimeType != null && mimeType.getType().equals("image")) {
+ return downloadUtilsProvider.get().getImageResizedUrl(token, ImageSize.ico);
+ } else {
+ return iconsRegistry.getContentTypeIcon(contentTypeId, mimeType);
+ }
+ }
+
+ private Object getIcon(final StateToken stateToken, final String typeId, final ContentStatus status) {
+ return iconsRegistry.getContentTypeIcon(typeId, status);
+ }
+
+ private String getTooltip(final StateToken token, final BasicMimeTypeDTO mimeType,
+ final boolean draggable) {
+ if (mimeType != null && (mimeType.isImage() || mimeType.isPdf())) {
+ // Used for previews
+ return null;
+ } else {
+ return draggable ? i18n.t("Double click to open. Drag and drop to move this to another place")
+ : i18n.t("Double click to open");
+ }
+ }
+
+ private AbstractFolderViewerView getView() {
+ return view;
+ }
+
+ public void setContent(final AbstractFolderViewerView view, @Nonnull final HasContent state) {
+ this.view = view;
+ getView().clear();
+ final StateContainerDTO stateContainer = (StateContainerDTO) state;
+ getView().setContainer(stateContainer);
+ final AccessRights rights = stateContainer.getContainerRights();
+ // NotifyUser.info("Rights: " + rights, true);
+ final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContainer.getGroup(),
+ stateContainer.getTypeId(), session.isLogged(), rights, ActionGroups.TOOLBAR);
+ final ContainerDTO container = stateContainer.getContainer();
+ final GuiActionDescCollection pathActions = pathToolbarUtils.createPath(container, true);
+ getView().setSubheaderActions(actions);
+ getView().setFooterActions(pathActions);
+ createChildItems(container, stateContainer.getContainerRights());
+ }
+}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/PathToolbarUtils.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -37,11 +37,6 @@
public class PathToolbarUtils {
- protected static final String CSSBTN = "k-button, k-fl";
- protected static final String CSSBTNC = "k-button, k-button-center, k-fl";
- protected static final String CSSBTNL = "k-button, k-button-left, k-fl";
- protected static final String CSSBTNR = "k-button, k-button-right, k-fl";
-
private final Provider<FolderViewerDropController> dropController;
private final EventBus eventBus;
private final I18nTranslationService i18n;
@@ -61,15 +56,15 @@
String calculateStyle(final int pos, final int length) {
if (length == 1) {
- return CSSBTN;
+ return ToolbarStyles.CSSBTN;
}
if (pos == 0) {
- return CSSBTNL;
+ return ToolbarStyles.CSSBTNL;
}
if (pos == length - 1) {
- return CSSBTNR;
+ return ToolbarStyles.CSSBTNR;
}
- return CSSBTNC;
+ return ToolbarStyles.CSSBTNC;
}
public GuiActionDescCollection createPath(final ContainerDTO container, final boolean withDrop) {
Added: trunk/src/main/java/cc/kune/gspace/client/viewers/ToolbarStyles.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ToolbarStyles.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ToolbarStyles.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,8 @@
+package cc.kune.gspace.client.viewers;
+
+public class ToolbarStyles {
+ public static final String CSSBTN = "k-button, k-fl";
+ public static final String CSSBTNC = "k-button, k-button-center, k-fl";
+ public static final String CSSBTNL = "k-button, k-button-left, k-fl";
+ public static final String CSSBTNR = "k-button, k-button-right, k-fl";
+}
\ No newline at end of file
Added: trunk/src/test/java/cc/kune/events/server/CalendarServerUtilsTest.java
===================================================================
--- trunk/src/test/java/cc/kune/events/server/CalendarServerUtilsTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/events/server/CalendarServerUtilsTest.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -0,0 +1,81 @@
+package cc.kune.events.server;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+
+import net.fortuna.ical4j.model.DateTime;
+import net.fortuna.ical4j.model.component.VEvent;
+import net.fortuna.ical4j.util.Dates;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+import com.bradrydzewski.gwt.calendar.client.Appointment;
+
+public class CalendarServerUtilsTest {
+
+ private static final String DESCRIPTION = "some description";
+ private static final String ID = "some id";
+ private static final String TITLE = "some title";
+
+ private void checkConversionFromAndTo(final Appointment initialApp, final boolean allDay) {
+ final VEvent vevent = CalendarServerUtils.from(initialApp);
+ assertEquals(initialApp.getDescription(), vevent.getDescription().getValue());
+ assertEquals(initialApp.getTitle(), vevent.getSummary().getValue());
+ if (allDay) {
+ final Date start = initialApp.getStart();
+ start.setHours(0);
+ start.setMinutes(0);
+ start.setSeconds(0);
+ assertEquals(start, new Date(vevent.getStartDate().getDate().getTime()));
+ assertEquals(initialApp.getEnd(), vevent.getEndDate().getDate());
+ } else {
+ assertEquals(initialApp.getStart().getTime(), vevent.getStartDate().getDate().getTime());
+ assertEquals(initialApp.getEnd().getTime(), vevent.getEndDate().getDate().getTime());
+ }
+ assertEquals(allDay, initialApp.isAllDay());
+ assertEquals(allDay, !(vevent.getStartDate().getDate() instanceof DateTime));
+ // final Uid uid = vevent.getUid();
+ // assertEquals(initialApp.getId(), uid != null ? uid.getValue() : null);
+ final Appointment reconvertedApp = CalendarServerUtils.to(vevent);
+ assertEquals(initialApp.getTitle(), reconvertedApp.getTitle());
+ assertEquals(initialApp.getDescription(), reconvertedApp.getDescription());
+ // assertEquals(initialApp.getId(), endApp.getId());
+ assertEquals(allDay, reconvertedApp.isAllDay());
+ assertEquals(initialApp.getStart().getTime(), reconvertedApp.getStart().getTime());
+ assertEquals(initialApp.getEnd().getTime(), reconvertedApp.getEnd().getTime());
+ assertTrue(initialApp.compareTo(reconvertedApp) == 0);
+ }
+
+ @Test
+ public void testFromToFrom() {
+ final Appointment initialApp = new Appointment();
+ initialApp.setTitle(TITLE);
+ initialApp.setDescription(DESCRIPTION);
+ initialApp.setStart(new Date(Dates.getCurrentTimeRounded()));
+ initialApp.setEnd(new Date(Dates.getCurrentTimeRounded()));
+ initialApp.setId(ID);
+ final boolean allDay = false;
+ initialApp.setAllDay(allDay);
+
+ checkConversionFromAndTo(initialApp, allDay);
+ }
+
+ @Ignore
+ @Test
+ public void testFromToFromAllDay() {
+ final Appointment initialApp = new Appointment();
+ initialApp.setTitle(TITLE);
+ initialApp.setDescription(DESCRIPTION);
+ initialApp.setStart(new Date(Dates.getCurrentTimeRounded()));
+ initialApp.setEnd(new Date(Dates.getCurrentTimeRounded()));
+ initialApp.setId(ID);
+ final boolean allDay = true;
+ initialApp.setAllDay(allDay);
+
+ checkConversionFromAndTo(initialApp, allDay);
+ }
+
+}
Modified: trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java
===================================================================
--- trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java 2011-11-29 01:15:20 UTC (rev 1631)
+++ trunk/src/test/java/cc/kune/gspace/client/viewers/FolderViewerPresenterTest.java 2011-11-30 01:31:04 UTC (rev 1632)
@@ -19,10 +19,6 @@
*/
package cc.kune.gspace.client.viewers;
-import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTN;
-import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNC;
-import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNL;
-import static cc.kune.gspace.client.viewers.PathToolbarUtils.CSSBTNR;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
@@ -43,27 +39,27 @@
@Test
public void with1() {
- assertEquals(CSSBTN, presenter.calculateStyle(0, 1));
+ assertEquals(ToolbarStyles.CSSBTN, presenter.calculateStyle(0, 1));
}
@Test
public void with2() {
- assertEquals(CSSBTNL, presenter.calculateStyle(0, 2));
- assertEquals(CSSBTNR, presenter.calculateStyle(1, 2));
+ assertEquals(ToolbarStyles.CSSBTNL, presenter.calculateStyle(0, 2));
+ assertEquals(ToolbarStyles.CSSBTNR, presenter.calculateStyle(1, 2));
}
@Test
public void with3() {
- assertEquals(CSSBTNL, presenter.calculateStyle(0, 3));
- assertEquals(CSSBTNC, presenter.calculateStyle(1, 3));
- assertEquals(CSSBTNR, presenter.calculateStyle(2, 3));
+ assertEquals(ToolbarStyles.CSSBTNL, presenter.calculateStyle(0, 3));
+ assertEquals(ToolbarStyles.CSSBTNC, presenter.calculateStyle(1, 3));
+ assertEquals(ToolbarStyles.CSSBTNR, presenter.calculateStyle(2, 3));
}
@Test
public void with4() {
- assertEquals(CSSBTNL, presenter.calculateStyle(0, 4));
- assertEquals(CSSBTNC, presenter.calculateStyle(1, 4));
- assertEquals(CSSBTNC, presenter.calculateStyle(2, 4));
- assertEquals(CSSBTNR, presenter.calculateStyle(3, 4));
+ assertEquals(ToolbarStyles.CSSBTNL, presenter.calculateStyle(0, 4));
+ assertEquals(ToolbarStyles.CSSBTNC, presenter.calculateStyle(1, 4));
+ assertEquals(ToolbarStyles.CSSBTNC, presenter.calculateStyle(2, 4));
+ assertEquals(ToolbarStyles.CSSBTNR, presenter.calculateStyle(3, 4));
}
}
1
0
29 Nov '11
Author: vjrj_
Date: 2011-11-29 02:15:20 +0100 (Tue, 29 Nov 2011)
New Revision: 1631
Modified:
trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
Log:
CLOSED - # 172: Remove "available for chat" status
http://kune.ourproject.org/issues/ticket/172
Modified: trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2011-11-28 16:19:48 UTC (rev 1630)
+++ trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2011-11-29 01:15:20 UTC (rev 1631)
@@ -19,15 +19,21 @@
*/
package cc.kune.chat.client.actions;
+import org.waveprotocol.box.webclient.client.ClientEvents;
+import org.waveprotocol.box.webclient.client.events.NetworkStatusEvent;
+import org.waveprotocol.box.webclient.client.events.NetworkStatusEventHandler;
+
import cc.kune.chat.client.ChatClient;
import cc.kune.chat.client.ChatInstances;
import cc.kune.chat.client.resources.ChatResources;
import cc.kune.common.client.actions.AbstractAction;
import cc.kune.common.client.actions.AbstractExtendedAction;
import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.common.client.actions.ui.descrip.MenuRadioItemDescriptor;
import cc.kune.common.client.actions.ui.descrip.MenuSeparatorDescriptor;
import cc.kune.common.client.actions.ui.descrip.MenuTitleItemDescriptor;
+import cc.kune.core.client.events.WindowFocusEvent;
import cc.kune.core.client.sitebar.SiteUserOptions;
import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
import cc.kune.core.client.state.Session;
@@ -41,7 +47,9 @@
import com.calclab.emite.im.client.presence.PresenceManager;
import com.calclab.emite.im.client.presence.events.OwnPresenceChangedEvent;
import com.calclab.emite.im.client.presence.events.OwnPresenceChangedHandler;
+import com.google.gwt.event.shared.EventBus;
import com.google.gwt.resources.client.ImageResource;
+import com.google.gwt.user.client.Timer;
import com.google.inject.Inject;
public class ChatSitebarActions {
@@ -63,39 +71,32 @@
@Override
public void actionPerformed(final ActionEvent event) {
- // presenceManager.changeOwnPresence(Presence.build(NO_STATUS,
- // Show.xa));
session.logout();
}
}
public class ChangeOnlineStatusAction extends AbstractExtendedAction {
+ private final ImageResource icon;
private final PresenceManager manager;
private final Presence thisPresence;
public ChangeOnlineStatusAction(final PresenceManager presenceManager, final String statusText,
final Show show, final ImageResource icon) {
this.manager = presenceManager;
+ this.icon = icon;
thisPresence = Presence.build(statusText, show);
- presenceManager.addOwnPresenceChangedHandler(new OwnPresenceChangedHandler() {
-
- @Override
- public void onOwnPresenceChanged(final OwnPresenceChangedEvent event) {
- updateStatusIcon(icon, event.getCurrentPresence());
- }
-
- });
- updateStatusIcon(icon, presenceManager.getOwnPresence());
+ updateStatusIcon(presenceManager.getOwnPresence());
}
@Override
public void actionPerformed(final ActionEvent event) {
if (!chatClient.loginIfNecessary()) {
+ awayTimer.cancel();
manager.changeOwnPresence(thisPresence);
}
nextPresence = thisPresence;
}
- private void updateStatusIcon(final ImageResource icon, final Presence currentPresence) {
+ public void updateStatusIcon(final Presence currentPresence) {
if (thisPresence.getShow().equals(currentPresence.getShow())
&& ((currentPresence.getStatus() == null) || currentPresence.getStatus().equals(
thisPresence.getStatus()))) {
@@ -104,12 +105,17 @@
}
}
- private static final String CHAT_STATUS = "k-chat-status-group";
private static final String GROUP_CHAT_STATUS = "k-group-chat-status";
private static final String NO_STATUS = null;
+ private MenuRadioItemDescriptor awayItem;
+ private Timer awayTimer;
+ private MenuRadioItemDescriptor busyItem;
private final ChatClient chatClient;
+ private final EventBus eventBus;
private final I18nTranslationService i18n;
private Presence nextPresence = Presence.build(NO_STATUS, Show.notSpecified);
+ private MenuRadioItemDescriptor offlineItem;
+ private MenuRadioItemDescriptor onlineItem;
private final PresenceManager presenceManager;
private final ChatResources res;
private final SiteUserOptions userOptions;
@@ -118,14 +124,16 @@
@Inject
public ChatSitebarActions(final Session session, final ChatClient chatClient,
final SiteUserOptions userOptions, final I18nTranslationService i18n, final ChatResources res,
- final ChatInstances chatInstances) {
+ final ChatInstances chatInstances, final EventBus eventBus) {
this.chatClient = chatClient;
this.userOptions = userOptions;
this.i18n = i18n;
this.res = res;
+ this.eventBus = eventBus;
xmppSession = chatInstances.xmppSession;
presenceManager = chatInstances.presenceManager;
createActions();
+ createListener();
}
private void createActions() {
@@ -133,54 +141,120 @@
SiteUserOptionsPresenter.LOGGED_USER_MENU, i18n.t("Set your chat status"));
userOptions.addAction(new MenuSeparatorDescriptor(SiteUserOptionsPresenter.LOGGED_USER_MENU));
userOptions.addAction(chatActionsTitle);
- final MenuRadioItemDescriptor onlineItem = createChatStatusAction(res.online(), i18n.t("Available"),
+ onlineItem = createChatStatusAction(res.online(), i18n.t("Available"),
onlineAction(NO_STATUS, Show.notSpecified, res.online()));
- final MenuRadioItemDescriptor availableItem = createChatStatusAction(res.xa(),
- i18n.t("Available for chat"), onlineAction(NO_STATUS, Show.chat, res.xa()));
- final MenuRadioItemDescriptor awayItem = createChatStatusAction(res.away(), i18n.t("Away"),
+ awayItem = createChatStatusAction(res.away(), i18n.t("Away"),
onlineAction(NO_STATUS, Show.away, res.away()));
- final MenuRadioItemDescriptor busyItem = createChatStatusAction(res.busy(), i18n.t("Busy"),
+ busyItem = createChatStatusAction(res.busy(), i18n.t("Busy"),
onlineAction(NO_STATUS, Show.dnd, res.busy()));
- final MenuRadioItemDescriptor offlineItem = createChatStatusAction(res.offline(),
- i18n.t("Sign out of chat"), new ChangeOfflineStatusAction(xmppSession, res.offline()));
- xmppSession.addSessionStateChangedHandler(false, new StateChangedHandler() {
+ offlineItem = createChatStatusAction(res.offline(), i18n.t("Sign out of chat"),
+ new ChangeOfflineStatusAction(xmppSession, res.offline()));
+ }
+ private MenuRadioItemDescriptor createChatStatusAction(final ImageResource icon, final String text,
+ final AbstractAction action) {
+ final MenuRadioItemDescriptor item = new MenuRadioItemDescriptor(
+ SiteUserOptionsPresenter.LOGGED_USER_MENU, action, GROUP_CHAT_STATUS);
+ item.putValue(AbstractAction.NAME, text);
+ item.putValue(AbstractAction.SMALL_ICON, icon);
+ return item;
+ }
+
+ private void createListener() {
+ awayTimer = new Timer() {
@Override
+ public void run() {
+ final Presence awayPresence = Presence.build(NO_STATUS, Show.away);
+ if (chatClient.isLoggedIn()) {
+ presenceManager.changeOwnPresence(awayPresence);
+ updateMenuPresence(awayPresence);
+ }
+ }
+ };
+ xmppSession.addSessionStateChangedHandler(false, new StateChangedHandler() {
+ @Override
public void onStateChanged(final StateChangedEvent event) {
if (xmppSession.isReady()) {
+ awayTimer.cancel();
presenceManager.changeOwnPresence(nextPresence);
- switch (nextPresence.getShow()) {
- case notSpecified:
- onlineItem.setChecked(true);
- break;
- case dnd:
- busyItem.setChecked(true);
- break;
- case chat:
- availableItem.setChecked(true);
- break;
- case away:
- awayItem.setChecked(true);
- break;
- }
+ updateMenuPresence(nextPresence);
} else {
offlineItem.setChecked(true);
}
}
});
+ presenceManager.addOwnPresenceChangedHandler(new OwnPresenceChangedHandler() {
+ @Override
+ public void onOwnPresenceChanged(final OwnPresenceChangedEvent event) {
+ updateMenuPresence(event.getCurrentPresence());
+ }
+ });
+ eventBus.addHandler(WindowFocusEvent.getType(), new WindowFocusEvent.WindowFocusHandler() {
+ @Override
+ public void onWindowFocus(final WindowFocusEvent event) {
+ if (event.isHasFocus()) {
+ awayTimer.cancel();
+ if (chatClient.isLoggedIn()) {
+ new Timer() {
+ @Override
+ public void run() {
+ presenceManager.changeOwnPresence(nextPresence);
+ }
+ }.schedule(1000);
+ }
+ } else {
+ awayTimer.schedule(3000);
+ }
+ }
+ });
+ ClientEvents.get().addNetworkStatusEventHandler(new NetworkStatusEventHandler() {
+ @Override
+ public void onNetworkStatus(final NetworkStatusEvent event) {
+ switch (event.getStatus()) {
+ case CONNECTED:
+ case RECONNECTED:
+ new Timer() {
+ @Override
+ public void run() {
+ ChatSitebarActions.this.chatClient.loginIfNecessary();
+ }
+ }.schedule(2000);
+ break;
+ case DISCONNECTED:
+ case RECONNECTING:
+ break;
+ }
+ }
+ });
}
- private MenuRadioItemDescriptor createChatStatusAction(final ImageResource icon, final String text,
- final AbstractAction action) {
- final MenuRadioItemDescriptor item = new MenuRadioItemDescriptor(
- SiteUserOptionsPresenter.LOGGED_USER_MENU, action, GROUP_CHAT_STATUS);
- item.putValue(AbstractAction.NAME, text);
- item.putValue(AbstractAction.SMALL_ICON, icon);
- return item;
- }
-
private AbstractExtendedAction onlineAction(final String statusText, final Show show,
final ImageResource icon) {
return new ChangeOnlineStatusAction(presenceManager, statusText, show, icon);
}
+
+ private void updateMenuPresence(final Presence presence) {
+ switch (presence.getShow()) {
+ case notSpecified:
+ onlineItem.setChecked(true);
+ updateSitebarIconPresence(presence, onlineItem);
+ break;
+ case dnd:
+ busyItem.setChecked(true);
+ updateSitebarIconPresence(presence, busyItem);
+ break;
+ case chat:
+ onlineItem.setChecked(true);
+ updateSitebarIconPresence(presence, onlineItem);
+ break;
+ case away:
+ awayItem.setChecked(true);
+ updateSitebarIconPresence(presence, awayItem);
+ break;
+ }
+ }
+
+ private void updateSitebarIconPresence(final Presence presence, final MenuItemDescriptor itemDescriptor) {
+ ((ChatSitebarActions.ChangeOnlineStatusAction) itemDescriptor.getAction()).updateStatusIcon(presence);
+ }
}
1
0
Author: vjrj_
Date: 2011-11-28 17:19:48 +0100 (Mon, 28 Nov 2011)
New Revision: 1630
Modified:
trunk/script/server.sh
Log:
server.sh improved
Modified: trunk/script/server.sh
===================================================================
--- trunk/script/server.sh 2011-11-27 17:47:15 UTC (rev 1629)
+++ trunk/script/server.sh 2011-11-28 16:19:48 UTC (rev 1630)
@@ -20,12 +20,18 @@
# Default values
+
+if [ -z $KUNE_HOME ]
+then
+ KUNE_HOME=/etc/kune
+fi
+
# See src/main/resources/kune.properties in svn
-KUNE_CONFIG=/etc/kune.properties
+KUNE_CONFIG=$KUNE_HOME/kune.properties
# See src/main/resources/wave-server.properties in svn
-WAVE_CONFIG=/etc/kune/wave-server.properties
+WAVE_CONFIG=$KUNE_HOME/wave-server.properties
# See src/main/resources/jaas.config in svn
-JAAS_CONFIG=src/main/resources/jaas.config
+JAAS_CONFIG=$KUNE_HOME/jaas.config
SUSPEND="n"
DEBUG=""
@@ -55,7 +61,13 @@
;;
p)
# Debug port
- DEBUG_PORT=,address=$OPTARG
+ PORT=$OPTARG
+ if ! [[ $PORT =~ ^[0-9]+$ ]]
+ then
+ usage
+ exit 1
+ fi
+ DEBUG_PORT=",address=$PORT"
;;
u)
SUSPEND="y"
@@ -99,7 +111,7 @@
if [[ -z $JAR ]]
then
# Just run kune using the code and mave
- mvn exec:java
+ mvn exec:java -Dexec.args="$DEBUG_FLAGS"
else
if [[ -n $DAEMON ]]
then
@@ -121,4 +133,4 @@
-Dwave.server.config=$WAVE_CONFIG \
-jar $JAR
fi
-fi
\ No newline at end of file
+fi
1
0
r1629 - in trunk: . src/main/java/cc/kune/core/server src/main/java/cc/kune/core/server/init src/main/java/cc/kune/core/server/properties src/main/resources src/main/resources/META-INF src/test/java/cc/kune/core/server src/test/java/cc/kune/core/server/integration
by Vicente J. Ruiz Jurado 27 Nov '11
by Vicente J. Ruiz Jurado 27 Nov '11
27 Nov '11
Author: vjrj_
Date: 2011-11-27 18:47:15 +0100 (Sun, 27 Nov 2011)
New Revision: 1629
Added:
trunk/src/main/java/cc/kune/core/server/init/KuneJpaPersistModule.java
Removed:
trunk/src/main/java/cc/kune/core/server/properties/PropertiesFileName.java
Modified:
trunk/INSTALL
trunk/TROUBLESHOOT
trunk/pom.xml
trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java
trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java
trunk/src/main/java/cc/kune/core/server/properties/KunePropertiesDefault.java
trunk/src/main/resources/META-INF/persistence.xml
trunk/src/main/resources/kune.properties
trunk/src/test/java/cc/kune/core/server/TestHelper.java
trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java
Log:
CLOSED - # 160: Document and make more easy the way to select persistence units
http://kune.ourproject.org/issues/ticket/160
Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/INSTALL 2011-11-27 17:47:15 UTC (rev 1629)
@@ -14,7 +14,7 @@
===MYSQL configuration===
-====Before db creation====
+====Before db creation====
You have to configure mysql to support UTF8 by editing your c:\Windows\my.ini or /etc/mysql/my.cnf (on Unix) file and adding something like:
@@ -65,7 +65,7 @@
- src/main/resources/META-INF/persistence.xml
- src/main/webapp/WEB-INF/publicspace/config/database.yml
-also if you want to select the database used (by default kune_dev). The db used in runtime is hardcoded (by now) in KuneRackModule.java
+also if you want to select the database used (by default kune_dev) you have to configure it in kune.properties.
===Source code (if you are installing Kune for development)===
@@ -75,7 +75,7 @@
# (in the trunk directory)
mvn compile -Dliquibase.should.run=false && mvn gwt:compile
-NOTE: If you change the previous db passwords after this compiling, you have to repeat the "mvn compile" because if not, probably you will use an old persistence.xml. See TROUBLESHOOT for more details.
+NOTE: If you change the previous db passwords after this compiling, you have to repeat the "mvn compile" because if not, probably you will use an old kune.properties. See TROUBLESHOOT for more details.
===Configure directories===
@@ -148,11 +148,11 @@
bin/server.sh -j kune.jar # -h for more options
-Once started for the first time the db is initialized. Then you should stop (Ctrl-C) and start the db migration process:
+Once started for the first time the db is initialized. Then you should stop (Ctrl-C) and start the db migration process:
./script/liquibase-migrate.sh
-=== Normal kune server start (after initialization) ===
+=== Normal kune server start (after initialization) ===
After that, you can start the server using the script:
@@ -170,8 +170,8 @@
==Production environment instructions==
-With
- mvn package
+With
+ mvn package
an executable target/kune-VERSION-jar-with-dependencies.jar is generated in target directory. That you can use to start kune:
bin/server.sh -j kune.jar
@@ -182,9 +182,9 @@
Copy and adapt as much as possible to your needs these files:
-- src/main/resources/kune.properties
-- src/main/resources/wave-server.properties
-- src/main/resources/log4j.properties
+- src/main/resources/kune.properties
+- src/main/resources/wave-server.properties
+- src/main/resources/log4j.properties
- src/main/webapp/ws.html
The best way to configure kune is to copy that files (for instance in /etc/kune/), to create a custom directory for ws.html and other of your custom html stuff (for instance /var/www/kune/), and add that directory to resources_base in wave-server.properties, for instance:
@@ -231,7 +231,7 @@
Configure the 'Group chat service' (in Group Chat > Group Chat Settings tab) with "rooms" additionally or instead of "conference" (or change kune.chat.roomHost in <trunk>/src/main/resources/kune.properties)
Change in 'Server > Server Manager > System Properties':
- provider.auth.className to org.jivesoftware.openfire.auth.JDBCAuthProvider instead of
+ provider.auth.className to org.jivesoftware.openfire.auth.JDBCAuthProvider instead of
org.jivesoftware.openfire.auth.DefaultAuthProvider
provider.user.className to org.jivesoftware.openfire.user.JDBCUserProvider instead of
org.jivesoftware.openfire.user.DefaultUserProvider
@@ -247,7 +247,7 @@
* In debian (with a .deb installation) you can to edit the configuration in /etc/openfire directory.
* In Mac: /usr/local/openfire/conf
-Add these lines to conf/openfire.xml and check that the user/passwd of the db is the same here and in the persistence.xml:
+Add these lines to conf/openfire.xml and check that the user/passwd of the db is the same here and in kune.properties (the ones configured before):
<pre>
<jive>
@@ -284,7 +284,7 @@
</jive>
</pre>
-Instead of:
+Instead of:
<jdbcAuthProvider/>
<jdbcUserProvider/>
<admin/>
@@ -297,7 +297,7 @@
Also you'll most likely want to change which usernames are authorized to login to the admin console adding then to <authorizedUsernames>.
Restart openfire: /etc/init.d/openfire restart
-after that the previous values will be incorpored to Server > Server Manager > System Properties
+after that the previous values will be incorpored to Server > Server Manager > System Properties
After the section 'Run the server for the first time' you'll be able to use the password of the admin user of the kune instalation (specified in kune.properties), or other admin new users you want to register using kune and configure in the authorizedUsernames attribute.
@@ -337,7 +337,7 @@
<Files *.nocache.*>
ExpiresActive Off
- </Files>
+ </Files>
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
@@ -351,11 +351,11 @@
You should configure a SMTP server for use by Kune. See kune.site.smtp.* in kune.properties and check that your email system works propertly. For instance test something like:
- echo "Bests," | mailx -s "Testing mail in kune instalation" PUT_HERE@YOUR_EMAIL # or something similar
+ echo "Bests," | mailx -s "Testing mail in kune instalation" PUT_HERE@YOUR_EMAIL # or something similar
http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#Protoco…
http://java.sun.com/developer/onlineTraining/JavaMail/contents.html#JavaMai…
-And:
+And:
http://javamail.kenai.com/nonav/javadocs/com/sun/mail/smtp/package-summary.…
for more specific configuration parameters that maybe you need with your smtp server.
Modified: trunk/TROUBLESHOOT
===================================================================
--- trunk/TROUBLESHOOT 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/TROUBLESHOOT 2011-11-27 17:47:15 UTC (rev 1629)
@@ -75,9 +75,9 @@
== Mysql: Caused by: java.sql.SQLException: Access denied for user 'kune'@'localhost' (using password: YES) ==
-Check that the password you have use in the database creation it's the same like the src/main/resources/META-INF/persistence.xml. If it's wrong maybe you have to remove the mysql user (DROP USER) and repeat the GRANT sentences of the INSTALL.
+Check that the password you have use in the database creation it's the same like the kune.properties. If it's wrong maybe you have to remove the mysql user (DROP USER) and repeat the GRANT sentences of the INSTALL.
-Also, be sure you do a "mvn compile" if you change the persistence.xml file to not use the old one.
+Also, be sure you do a "mvn compile" if you are running kune from the source and you change the kune.properties file to not use the old one.
If you have this problem with openfire it's not enough to change the password in openfire.xml because probably it's already stored in the ofProperty openfire table and you need to change the password there.
@@ -89,16 +89,11 @@
A check list:
- these files should be the same:
+ diff src/main/resources/kune.properties target/kune-0.1.0-SNAPSHOT/WEB-INF/classes/kune.properties
+ and:
diff src/main/resources/META-INF/persistence.xml target/kune-0.1.0-SNAPSHOT/WEB-INF/classes/META-INF/persistence.xml
-if not "mvn compile -Dliquibase.should.run=false"
-- the persistence-unit you use, that is hardcoded (by now) in
-src/main/java/cc/kune/core/server/KuneRackModule.java
-(...)
- public KuneRackModule() {
- this("production", "/ws", null);
- }
-(...)
-find that name in persistence.xml (we are using production, but can be other). The db user/password configured in persistence.xml for that name should be the same to that one you used in the GRANT sentence of mysql database creation.
+ if not "mvn compile -Dliquibase.should.run=false"
+also check the persistence unit that you are using and find that name in persistence.xml (we are using development, but can be other). The db user/password configured in kune.properties for that name should be the same to that one you used in the GRANT sentence of mysql database creation.
To debug mysql logs, you can uncomment:
#general_log_file = /var/log/mysql/mysql.log
@@ -141,7 +136,7 @@
Set M2_REPO to eclipse in Preferences > Java > Build Path > Classpath Variable (normally to /home/youruser/.m2/repository/)
-== Error generating CoreResources ==
+== Error generating CoreResources ==
[INFO] Computing all possible rebind results for 'cc.kune.core.client.resources.CoreResources' [INFO] Rebinding cc.kune.core.client.resources.CoreResources [INFO] Invoking generator com.google.gwt.resources.rebind.context.StaticClientBundleGenerator [INFO] [ERROR] Generator 'com.google.gwt.resources.rebind.context.StaticClientBundleGenerator' threw an exception while rebinding 'cc.kune.cor
[INFO] at com.google.gwt.dev.util.Util.computeStrongName(Util.java:170) [INFO] at com.google.gwt.dev.util.Util.computeStrongName(Util.java:145) [INFO] at com.google.gwt.resources.rebind.context.StaticResourceContext.deploy(StaticResourceContext.java:61)
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/pom.xml 2011-11-27 17:47:15 UTC (rev 1629)
@@ -805,6 +805,13 @@
<key>kune.server.config</key>
<value>src/main/resources/kune.properties</value>
</systemProperty>
+<!-- <systemProperty> -->
+<!-- <key>kune.db.persistence.name</key> -->
+ <!-- Persistence name, choose between: production, development,
+ test_db (testing environment using mysql db), test (testing environment using
+ h2 db). See persistence.xml -->
+<!-- <value>development</value> -->
+<!-- </systemProperty> -->
<systemProperty>
<key>wave.server.config</key>
<value>src/main/resources/wave-server.properties</value>
Modified: trunk/src/main/java/cc/kune/core/server/KuneRackModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/main/java/cc/kune/core/server/KuneRackModule.java 2011-11-27 17:47:15 UTC (rev 1629)
@@ -19,6 +19,8 @@
*/
package cc.kune.core.server;
+import java.util.Properties;
+
import org.apache.commons.configuration.SystemConfiguration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -41,7 +43,8 @@
import cc.kune.core.server.manager.file.FileGwtUploadServlet;
import cc.kune.core.server.manager.file.FileUploadManager;
import cc.kune.core.server.manager.file.UserLogoDownloadManager;
-import cc.kune.core.server.properties.PropertiesFileName;
+import cc.kune.core.server.properties.KuneProperties;
+import cc.kune.core.server.properties.KunePropertiesDefault;
import cc.kune.core.server.rack.RackBuilder;
import cc.kune.core.server.rack.RackModule;
import cc.kune.core.server.rack.filters.ForwardFilter;
@@ -75,24 +78,44 @@
public static final Log LOG = LogFactory.getLog(KuneRackModule.class);
private final Module configModule;
private final String suffix;
+ final SystemConfiguration sysConf = new SystemConfiguration();
public KuneRackModule() {
- this("development", "/ws", null);
+ this(null, "/ws", null);
}
- public KuneRackModule(final String jpaUnit, final String suffix, final Scope sessionScope) {
-
+ public KuneRackModule(final String settedJpaUnit, final String suffix, final Scope sessionScope) {
this.suffix = suffix;
- final SystemConfiguration sysConf = new SystemConfiguration();
final String kuneConfig = sysConf.getString("kune.server.config");
-
configModule = new AbstractModule() {
@Override
public void configure() {
- install(FinderRegistry.init(new JpaPersistModule(jpaUnit)));
+ final KunePropertiesDefault kuneProperties = new KunePropertiesDefault(kuneConfig);
+ bind(KuneProperties.class).toInstance(kuneProperties);
+ final String configuredJpaUnit = kuneProperties.get(KuneProperties.SITE_DB_PERSISTENCE_NAME);
+
+ // precedence method param > properties
+ final String jpaUnit = settedJpaUnit != null ? settedJpaUnit
+ : configuredJpaUnit != null ? configuredJpaUnit : "development";
+ LOG.info("Using persistence unit: " + jpaUnit);
+
+ final JpaPersistModule jpaPersistModule = new JpaPersistModule(jpaUnit);
+
+ if (!jpaUnit.equals("test")) {
+ final Properties dbProperties = new Properties();
+ dbProperties.setProperty("hibernate.connection.url",
+ kuneProperties.get(KuneProperties.SITE_DB_URL));
+ dbProperties.setProperty("hibernate.connection.username",
+ kuneProperties.get(KuneProperties.SITE_DB_USER));
+ dbProperties.setProperty("hibernate.connection.password",
+ kuneProperties.get(KuneProperties.SITE_DB_PASSWORD));
+ jpaPersistModule.properties(dbProperties);
+ }
+
+ install(FinderRegistry.init(jpaPersistModule));
bindInterceptor(Matchers.annotatedWith(LogThis.class), new NotInObject(),
new LoggerMethodInterceptor());
- bindConstant().annotatedWith(PropertiesFileName.class).to(kuneConfig);
+ // bindConstant().annotatedWith(PropertiesFileName.class).to(kuneConfig);
if (sessionScope != null) {
bindScope(SessionScoped.class, sessionScope);
}
Modified: trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/main/java/cc/kune/core/server/PlatformServerModule.java 2011-11-27 17:47:15 UTC (rev 1629)
@@ -85,8 +85,6 @@
import cc.kune.core.server.manager.impl.UserManagerDefault;
import cc.kune.core.server.mapper.DozerMapper;
import cc.kune.core.server.mapper.Mapper;
-import cc.kune.core.server.properties.KuneProperties;
-import cc.kune.core.server.properties.KunePropertiesDefault;
import cc.kune.core.server.rpc.ContentRPC;
import cc.kune.core.server.rpc.GroupRPC;
import cc.kune.core.server.rpc.I18nRPC;
@@ -179,7 +177,7 @@
bindManagers();
bindRPC();
bindServices();
- bind(KuneProperties.class).to(KunePropertiesDefault.class);
+ // bind(KuneProperties.class).to(KunePropertiesDefault.class);
bind(Mapper.class).to(DozerMapper.class);
bind(ServerToolRegistry.class);
// bind(FileUploadManager.class).in(ServletScopes.REQUEST);
Added: trunk/src/main/java/cc/kune/core/server/init/KuneJpaPersistModule.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/init/KuneJpaPersistModule.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/init/KuneJpaPersistModule.java 2011-11-27 17:47:15 UTC (rev 1629)
@@ -0,0 +1,5 @@
+package cc.kune.core.server.init;
+
+public class KuneJpaPersistModule {
+
+}
Modified: trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java 2011-11-27 17:47:15 UTC (rev 1629)
@@ -43,6 +43,10 @@
String SITE_ADMIN_PASSWD = "kune.admin.password";
String SITE_ADMIN_SHORTNAME = "kune.admin.shortName";
String SITE_COMMON_NAME = "kune.default.site.commonname";
+ String SITE_DB_PASSWORD = "kune.db.password";
+ String SITE_DB_PERSISTENCE_NAME = "kune.db.persistence.name";
+ String SITE_DB_URL = "kune.db.url";
+ String SITE_DB_USER = "kune.db.user";
String SITE_DEF_LICENSE = "kune.default.license";
String SITE_DOMAIN = "kune.site.domain";
String SITE_GROUP_AVAILABLE_TOOLS = "kune.tools.groupSiteAvailableTools";
Modified: trunk/src/main/java/cc/kune/core/server/properties/KunePropertiesDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/properties/KunePropertiesDefault.java 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/main/java/cc/kune/core/server/properties/KunePropertiesDefault.java 2011-11-27 17:47:15 UTC (rev 1629)
@@ -38,7 +38,7 @@
private final String fileName;
@Inject
- public KunePropertiesDefault(@PropertiesFileName final String fileName) {
+ public KunePropertiesDefault(final String fileName) {
this.fileName = fileName;
try {
config = new CompositeConfiguration();
Deleted: trunk/src/main/java/cc/kune/core/server/properties/PropertiesFileName.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/properties/PropertiesFileName.java 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/main/java/cc/kune/core/server/properties/PropertiesFileName.java 2011-11-27 17:47:15 UTC (rev 1629)
@@ -1,31 +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.core.server.properties;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import com.google.inject.BindingAnnotation;
-
-@BindingAnnotation
-(a)Retention(RetentionPolicy.RUNTIME)
-public @interface PropertiesFileName {
-
-}
Modified: trunk/src/main/resources/META-INF/persistence.xml
===================================================================
--- trunk/src/main/resources/META-INF/persistence.xml 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/main/resources/META-INF/persistence.xml 2011-11-27 17:47:15 UTC (rev 1629)
@@ -38,9 +38,13 @@
<property name="use_sql_comments" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
+
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost/kune_prod?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8"/>
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.username" value="kune"/>
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.password" value="db4kune"/>
<!-- http://stackoverflow.com/questions/221379/hibernate-hbm2ddl-auto-update-in-…
@@ -97,9 +101,12 @@
<property name="use_sql_comments" value="true"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost/kune_dev?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8"/>
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.username" value="kune"/>
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.password" value="db4kune"/>
<!-- http://stackoverflow.com/questions/221379/hibernate-hbm2ddl-auto-update-in-…
@@ -154,9 +161,12 @@
<property name="use_sql_comments" value="false"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.url"
value="jdbc:mysql://localhost/kune_test?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8"/>
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.username" value="kune"/>
+ <!-- Configured and overrided by kune.properties -->
<property name="hibernate.connection.password" value="db4kune"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<!-- <property name="hibernate.hbm2ddl.auto" value="create" /> -->
Modified: trunk/src/main/resources/kune.properties
===================================================================
--- trunk/src/main/resources/kune.properties 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/main/resources/kune.properties 2011-11-27 17:47:15 UTC (rev 1629)
@@ -22,14 +22,30 @@
# ws.html has a similar value for UI client
kune.default.site.commonname = this site
-# Email
+### Email
+
kune.site.smtp.host = localhost
kune.site.smtp.defaultfrom = noreply@localhost
# If we should avoid the use of smtp (use only for avoid emails during development)
kune.site.smtp.skip = true
-### licenses
+### Database
+# Persistence name, choose between:
+# - production : production environment
+# - development: development enviroment
+# - test_db: testing environment using mysql db
+# - test: testing environment using h2 db (memory)
+kune.db.persistence.name = development
+
+# check that the db, user and passwd exists and has the correct rights (see INSTALL)
+# This only used in production/develoment & test_db environment (not with h2 db):
+kune.db.url = jdbc:mysql://localhost/kune_dev?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8
+kune.db.user = kune
+kune.db.password = db4kune
+
+### Licenses
+
kune.default.license = by-sa-v3.0
# Current CC version, see license table and shortname field (for instance by-sa-v3.0)
kune.currentccversion = v3.0
Modified: trunk/src/test/java/cc/kune/core/server/TestHelper.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/TestHelper.java 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/test/java/cc/kune/core/server/TestHelper.java 2011-11-27 17:47:15 UTC (rev 1629)
@@ -35,7 +35,8 @@
import cc.kune.core.server.init.FinderRegistry;
import cc.kune.core.server.integration.HttpServletRequestMocked;
-import cc.kune.core.server.properties.PropertiesFileName;
+import cc.kune.core.server.properties.KuneProperties;
+import cc.kune.core.server.properties.KunePropertiesDefault;
import cc.kune.wave.server.CustomSettingsBinder;
import com.google.inject.Binder;
@@ -64,7 +65,7 @@
public void configure(final Binder binder) {
binder.bindScope(SessionScoped.class, Scopes.SINGLETON);
binder.bindScope(RequestScoped.class, Scopes.SINGLETON);
- binder.bindConstant().annotatedWith(PropertiesFileName.class).to(propetiesFileName);
+ binder.bind(KuneProperties.class).toInstance(new KunePropertiesDefault(propetiesFileName));
binder.bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
}
});
Modified: trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2011-11-27 14:01:08 UTC (rev 1628)
+++ trunk/src/test/java/cc/kune/core/server/integration/IntegrationTestHelper.java 2011-11-27 17:47:15 UTC (rev 1629)
@@ -36,7 +36,8 @@
import cc.kune.core.server.PlatformServerModule;
import cc.kune.core.server.TestConstants;
import cc.kune.core.server.init.FinderRegistry;
-import cc.kune.core.server.properties.PropertiesFileName;
+import cc.kune.core.server.properties.KuneProperties;
+import cc.kune.core.server.properties.KunePropertiesDefault;
import cc.kune.docs.server.DocumentServerModule;
import cc.kune.events.server.EventsServerModule;
import cc.kune.lists.server.ListsServerModule;
@@ -71,7 +72,7 @@
protected void configure() {
bindScope(SessionScoped.class, Scopes.SINGLETON);
bindScope(RequestScoped.class, Scopes.SINGLETON);
- bindConstant().annotatedWith(PropertiesFileName.class).to("kune.properties");
+ bind(KuneProperties.class).toInstance(new KunePropertiesDefault("kune.properties"));
bind(HttpServletRequest.class).to(HttpServletRequestMocked.class);
}
});
1
0