[kune-commits] r1478 - in trunk: . src/main/java/cc/kune/chat/client src/main/java/cc/kune/chat/client/actions src/main/java/cc/kune/common/client/actions/ui src/main/java/cc/kune/common/client/actions/ui/descrip src/main/java/cc/kune/common/client/tooltip src/main/java/cc/kune/common/client/ui/dialogs/tabbed src/main/java/cc/kune/common/client/utils src/main/java/cc/kune/core/client/actions/xml src/main/java/cc/kune/core/client/i18n src/main/java/cc/kune/core/client/sitebar src/main/java/cc/kune/core/client/sn src/main/java/cc/kune/core/client/sn/actions/registry src/main/java/cc/kune/core/public src/main/java/cc/kune/core/public/images src/main/java/cc/kune/docs/client src/main/java/cc/kune/docs/client/actions src/main/java/cc/kune/gspace/client src/main/java/cc/kune/gspace/client/actions src/main/java/cc/kune/gspace/client/i18n src/main/java/cc/kune/gspace/client/options src/main/java/cc/kune/gspace/client/viewers src/main/java/com/example/client src/main/java/org/ourproject/kune/app/public/css/img src/main/java/org/ourproject/kune/platf/client/ui src/main/java/org/ourproject/kune/workspace/client/i18n src/main/java/org/ourproject/kune/workspace/client/search src/main/resources src/test/java/cc/kune/core/client src/test/java/cc/kune/core/client/i18n
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Wed Aug 3 19:07:44 CEST 2011
Author: vjrj_
Date: 2011-08-03 19:07:42 +0200 (Wed, 03 Aug 2011)
New Revision: 1478
Added:
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractParentGuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/HasChilds.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java
trunk/src/main/java/cc/kune/core/client/i18n/I18nConstants.java
trunk/src/main/java/cc/kune/core/client/i18n/I18nUtils.java
trunk/src/main/java/cc/kune/core/client/sitebar/SiteOptions.java
trunk/src/main/java/cc/kune/core/public/images/alert.gif
trunk/src/main/java/cc/kune/core/public/images/arrow-down-black.gif
trunk/src/main/java/cc/kune/core/public/images/arrow-down-white.gif
trunk/src/main/java/cc/kune/core/public/images/arrow-right-black.gif
trunk/src/main/java/cc/kune/core/public/images/arrow-right-white.gif
trunk/src/main/java/cc/kune/core/public/images/colors.gif
trunk/src/main/java/cc/kune/core/public/images/copyleft.png
trunk/src/main/java/cc/kune/core/public/images/emblem-system.gif
trunk/src/main/java/cc/kune/core/public/images/film.png
trunk/src/main/java/cc/kune/core/public/images/info.gif
trunk/src/main/java/cc/kune/core/public/images/language.gif
trunk/src/main/java/cc/kune/core/public/images/link.gif
trunk/src/main/java/cc/kune/core/public/images/picture.png
trunk/src/main/java/cc/kune/core/public/images/specialchars.png
trunk/src/main/java/cc/kune/core/public/images/splitter-vert-bar.png
trunk/src/main/java/cc/kune/gspace/client/i18n/
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPanel.java
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPresenter.java
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslator.java
trunk/src/main/java/cc/kune/gspace/client/i18n/LanguageSelectorPanel.java
trunk/src/main/java/cc/kune/gspace/client/i18n/SiteOptionsI18nTranslatorAction.java
trunk/src/main/java/cc/kune/gspace/client/i18n/TranslatorTabsCollection.java
trunk/src/main/resources/ConstantsTest_en.properties
trunk/src/main/resources/ConstantsTest_es.properties
trunk/src/test/java/cc/kune/core/client/i18n/
trunk/src/test/java/cc/kune/core/client/i18n/ConstantsTest.java
trunk/src/test/java/cc/kune/core/client/i18n/I18nUtilsTest.java
Removed:
trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogView.java
trunk/src/main/java/org/ourproject/kune/app/public/css/img/alert.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-down-black.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-down-white.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-right-black.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-right-white.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/colors.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/copyleft.png
trunk/src/main/java/org/ourproject/kune/app/public/css/img/emblem-system.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/film.png
trunk/src/main/java/org/ourproject/kune/app/public/css/img/info.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/language.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/link.gif
trunk/src/main/java/org/ourproject/kune/app/public/css/img/picture.png
trunk/src/main/java/org/ourproject/kune/app/public/css/img/specialchars.png
trunk/src/main/java/org/ourproject/kune/app/public/css/img/splitter-vert-bar.png
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelector.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorView.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java
Modified:
trunk/TODO
trunk/TODO_done
trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java
trunk/src/main/java/cc/kune/chat/client/ChatParts.java
trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractComposedGuiItem.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractSeparatorDescriptor.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescCollection.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuItemDescriptor.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuSeparatorDescriptor.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/SubMenuDescriptor.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/ToolbarDescriptor.java
trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/ToolbarSeparatorDescriptor.java
trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialog.java
trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java
trunk/src/main/java/cc/kune/common/client/utils/TextUtils.java
trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java
trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptions.java
trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActions.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignOutLink.java
trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java
trunk/src/main/java/cc/kune/docs/client/actions/GoParentFolderBtn.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/actions/NewContainerMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/actions/NewContentMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/options/EntityOptions.java
trunk/src/main/java/cc/kune/gspace/client/options/EntityOptionsView.java
trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java
trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
trunk/src/main/java/com/example/client/HelloWorldActions.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java
Log:
Actions hierarchy revisited
NEW - # 79: I18n refactorization
http://kune.ourproject.org/issues/ticket/79
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/TODO 2011-08-03 17:07:42 UTC (rev 1478)
@@ -19,106 +19,6 @@
**** Editors (view plain --> create new --> ask for participation)
**** Viewers (view plain --> ask for participation)
*** Not logged (view plain wave)
-
-** Perms in WIAB :ARCHIVE:
-27-abr-2011 16:59:01 org.waveprotocol.box.server.robots.OperationContextImpl openWavelet
-GRAVE: admin at localhost tried to open [WaveletName localhost/w+1v66qilgtl2o6E/localhost/conv+root] which it isn't participating in
-27-abr-2011 16:59:01 org.waveprotocol.box.server.robots.util.OperationUtil executeOperation
-ADVERTENCIA: Operation {'method':'robot.fetchWave','id':'op16','waveId':'localhost!w+1v66qilgtl2o6E','waveletId':'localhost!conv+root','blipId':'null','parameters':{WAVELET_ID=localhost!conv+root, WAVE_ID=localhost!w+1v66qilgtl2o6E}} failed to execute
-com.google.wave.api.InvalidRequestException: Wavelet [WaveletName localhost/w+1v66qilgtl2o6E/localhost/conv+root] couldn't be retrieved
- at org.waveprotocol.box.server.robots.OperationContextImpl.openWavelet(OperationContextImpl.java:231)
- at org.waveprotocol.box.server.robots.OperationContextImpl.openWavelet(OperationContextImpl.java:247)
- at org.waveprotocol.box.server.robots.operations.FetchWaveService.execute(FetchWaveService.java:52)
- at org.waveprotocol.box.server.robots.util.OperationUtil.executeOperation(OperationUtil.java:171)
- at cc.kune.wave.server.KuneWaveManagerDefault.fetchWavelet(KuneWaveManagerDefault.java:138)
- at cc.kune.wave.server.KuneWaveManagerDefault$$EnhancerByGuice$$eb69153f.CGLIB$fetchWavelet$2(<generated>)
- at cc.kune.wave.server.KuneWaveManagerDefault$$EnhancerByGuice$$eb69153f$$FastClassByGuice$$53f72476.invoke(<generated>)
- at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at cc.kune.core.server.LoggerMethodInterceptor.invoke(LoggerMethodInterceptor.java:87)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
- at cc.kune.wave.server.KuneWaveManagerDefault$$EnhancerByGuice$$eb69153f.fetchWavelet(<generated>)
- at cc.kune.core.server.state.StateServiceDefault.create(StateServiceDefault.java:111)
- at cc.kune.core.server.state.StateServiceDefault$$EnhancerByGuice$$9d4970d0.CGLIB$create$1(<generated>)
- at cc.kune.core.server.state.StateServiceDefault$$EnhancerByGuice$$9d4970d0$$FastClassByGuice$$9a3402d2.invoke(<generated>)
- at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at cc.kune.core.server.LoggerMethodInterceptor.invoke(LoggerMethodInterceptor.java:87)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
- at cc.kune.core.server.state.StateServiceDefault$$EnhancerByGuice$$9d4970d0.create(<generated>)
- at cc.kune.core.server.rpc.ContentRPC.getContentOrDefContent(ContentRPC.java:263)
- at cc.kune.core.server.rpc.ContentRPC.getContent(ContentRPC.java:246)
- at cc.kune.core.server.rpc.ContentRPC$$EnhancerByGuice$$9d633676.CGLIB$getContent$1(<generated>)
- at cc.kune.core.server.rpc.ContentRPC$$EnhancerByGuice$$9d633676$$FastClassByGuice$$8c7047c.invoke(<generated>)
- at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at cc.kune.core.server.LoggerMethodInterceptor.invoke(LoggerMethodInterceptor.java:87)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at cc.kune.core.server.auth.AuthenticatedMethodInterceptor.invoke(AuthenticatedMethodInterceptor.java:84)
- at cc.kune.core.server.OutermostCallInterceptor.invoke(OutermostCallInterceptor.java:66)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
- at cc.kune.core.server.rpc.ContentRPC$$EnhancerByGuice$$9d633676.getContent(<generated>)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:616)
- at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
- at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:544)
- at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:504)
- at cc.kune.core.server.rack.filters.gwts.DelegatedRemoteServlet.processCall(DelegatedRemoteServlet.java:45)
- at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
- at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
- at cc.kune.core.server.rack.filters.gwts.GWTServiceFilter.doFilter(GWTServiceFilter.java:61)
- at cc.kune.core.server.rack.RackServletFilter$DockChain.execute(RackServletFilter.java:70)
- at cc.kune.core.server.rack.RackServletFilter$DockChain.doFilter(RackServletFilter.java:63)
- at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:66)
- at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
- at com.google.inject.servlet.ManagedFilterPipeline$$EnhancerByGuice$$1af97b76.CGLIB$dispatch$0(<generated>)
- at com.google.inject.servlet.ManagedFilterPipeline$$EnhancerByGuice$$1af97b76$$FastClassByGuice$$57398af4.invoke(<generated>)
- at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at cc.kune.core.server.LoggerMethodInterceptor.invoke(LoggerMethodInterceptor.java:87)
- at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
- at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
- at com.google.inject.servlet.ManagedFilterPipeline$$EnhancerByGuice$$1af97b76.dispatch(<generated>)
- at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
- at cc.kune.core.server.rack.RackServletFilter$DockChain.execute(RackServletFilter.java:70)
- at cc.kune.core.server.rack.RackServletFilter$DockChain.doFilter(RackServletFilter.java:63)
- at cc.kune.core.server.rack.filters.LogFilter.doFilter(LogFilter.java:46)
- at cc.kune.core.server.rack.RackServletFilter$DockChain.execute(RackServletFilter.java:70)
- at cc.kune.core.server.rack.RackServletFilter$DockChain.doFilter(RackServletFilter.java:63)
- at cc.kune.core.server.rack.RackServletFilter.doFilter(RackServletFilter.java:105)
- at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
- at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:421)
- at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
- at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
- at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
- at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:930)
- at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
- at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
- at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:866)
- at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
- at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
- at org.eclipse.jetty.server.Server.handle(Server.java:351)
- at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:594)
- at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1059)
- at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:764)
- at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217)
- at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:424)
- at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:506)
- at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
- at java.lang.Thread.run(Thread.java:679)
-2011-04-27 16:59:01,904 [qtp2042579307-41] ERROR - Wavelet [WaveletName localhost/w+1v66qilgtl2o6E/localhost/conv+root] couldn't be retrieved
-** TODO Server side extensions configuration menu
-A way to specify the default extensions in a client of a wave server.
-** TODO style injection:
- http://www.hunlock.com/blogs/Howto_Dynamically_Insert_Javascript_And_CSS
- https://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f4c4fb9b4c5bb28f
** TODO >> Delete host/room conf in ws.html
** TODO >> kune.properties from cmd line
** TODO HelloWord with samples of extensions: sitebar, sitebar options menu, siteuseroptions, sn, ...
Modified: trunk/TODO_done
===================================================================
--- trunk/TODO_done 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/TODO_done 2011-08-03 17:07:42 UTC (rev 1478)
@@ -131,7 +131,136 @@
* @return The corresponding WaveRef object, or null if the path was invalid.
* @throws InvalidWaveRefException If the path contains less than 2 tokens or 3 tokens.
*/
+* TODO style injection:
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2011-07-30 sáb 00:35
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :ARCHIVE_TODO: TODO
+ :END:
+ http://www.hunlock.com/blogs/Howto_Dynamically_Insert_Javascript_And_CSS
+ https://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f4c4fb9b4c5bb28f
+* TODO style injection:
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2011-07-30 sáb 00:35
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :ARCHIVE_TODO: TODO
+ :END:
+ http://www.hunlock.com/blogs/Howto_Dynamically_Insert_Javascript_And_CSS
+ https://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/f4c4fb9b4c5bb28f
+* TODO Server side extensions configuration menu
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2011-07-30 sáb 00:35
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :ARCHIVE_TODO: TODO
+ :END:
+A way to specify the default extensions in a client of a wave server.
+* Perms in WIAB :ARCHIVE:
+ :PROPERTIES:
+ :ARCHIVE_TIME: 2011-07-30 sáb 00:36
+ :ARCHIVE_FILE: ~/proyectos/dev/kune/trunk/TODO
+ :ARCHIVE_OLPATH: SHORT-TERM (URGENT)
+ :ARCHIVE_CATEGORY: TODO
+ :END:
+27-abr-2011 16:59:01 org.waveprotocol.box.server.robots.OperationContextImpl openWavelet
+GRAVE: admin at localhost tried to open [WaveletName localhost/w+1v66qilgtl2o6E/localhost/conv+root] which it isn't participating in
+27-abr-2011 16:59:01 org.waveprotocol.box.server.robots.util.OperationUtil executeOperation
+ADVERTENCIA: Operation {'method':'robot.fetchWave','id':'op16','waveId':'localhost!w+1v66qilgtl2o6E','waveletId':'localhost!conv+root','blipId':'null','parameters':{WAVELET_ID=localhost!conv+root, WAVE_ID=localhost!w+1v66qilgtl2o6E}} failed to execute
+com.google.wave.api.InvalidRequestException: Wavelet [WaveletName localhost/w+1v66qilgtl2o6E/localhost/conv+root] couldn't be retrieved
+ at org.waveprotocol.box.server.robots.OperationContextImpl.openWavelet(OperationContextImpl.java:231)
+ at org.waveprotocol.box.server.robots.OperationContextImpl.openWavelet(OperationContextImpl.java:247)
+ at org.waveprotocol.box.server.robots.operations.FetchWaveService.execute(FetchWaveService.java:52)
+ at org.waveprotocol.box.server.robots.util.OperationUtil.executeOperation(OperationUtil.java:171)
+ at cc.kune.wave.server.KuneWaveManagerDefault.fetchWavelet(KuneWaveManagerDefault.java:138)
+ at cc.kune.wave.server.KuneWaveManagerDefault$$EnhancerByGuice$$eb69153f.CGLIB$fetchWavelet$2(<generated>)
+ at cc.kune.wave.server.KuneWaveManagerDefault$$EnhancerByGuice$$eb69153f$$FastClassByGuice$$53f72476.invoke(<generated>)
+ at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at cc.kune.core.server.LoggerMethodInterceptor.invoke(LoggerMethodInterceptor.java:87)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
+ at cc.kune.wave.server.KuneWaveManagerDefault$$EnhancerByGuice$$eb69153f.fetchWavelet(<generated>)
+ at cc.kune.core.server.state.StateServiceDefault.create(StateServiceDefault.java:111)
+ at cc.kune.core.server.state.StateServiceDefault$$EnhancerByGuice$$9d4970d0.CGLIB$create$1(<generated>)
+ at cc.kune.core.server.state.StateServiceDefault$$EnhancerByGuice$$9d4970d0$$FastClassByGuice$$9a3402d2.invoke(<generated>)
+ at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at cc.kune.core.server.LoggerMethodInterceptor.invoke(LoggerMethodInterceptor.java:87)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
+ at cc.kune.core.server.state.StateServiceDefault$$EnhancerByGuice$$9d4970d0.create(<generated>)
+ at cc.kune.core.server.rpc.ContentRPC.getContentOrDefContent(ContentRPC.java:263)
+ at cc.kune.core.server.rpc.ContentRPC.getContent(ContentRPC.java:246)
+ at cc.kune.core.server.rpc.ContentRPC$$EnhancerByGuice$$9d633676.CGLIB$getContent$1(<generated>)
+ at cc.kune.core.server.rpc.ContentRPC$$EnhancerByGuice$$9d633676$$FastClassByGuice$$8c7047c.invoke(<generated>)
+ at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at cc.kune.core.server.LoggerMethodInterceptor.invoke(LoggerMethodInterceptor.java:87)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at com.google.inject.persist.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:66)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at cc.kune.core.server.auth.AuthenticatedMethodInterceptor.invoke(AuthenticatedMethodInterceptor.java:84)
+ at cc.kune.core.server.OutermostCallInterceptor.invoke(OutermostCallInterceptor.java:66)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
+ at cc.kune.core.server.rpc.ContentRPC$$EnhancerByGuice$$9d633676.getContent(<generated>)
+ at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+ at java.lang.reflect.Method.invoke(Method.java:616)
+ at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)
+ at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:544)
+ at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:504)
+ at cc.kune.core.server.rack.filters.gwts.DelegatedRemoteServlet.processCall(DelegatedRemoteServlet.java:45)
+ at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:243)
+ at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
+ at cc.kune.core.server.rack.filters.gwts.GWTServiceFilter.doFilter(GWTServiceFilter.java:61)
+ at cc.kune.core.server.rack.RackServletFilter$DockChain.execute(RackServletFilter.java:70)
+ at cc.kune.core.server.rack.RackServletFilter$DockChain.doFilter(RackServletFilter.java:63)
+ at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:66)
+ at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
+ at com.google.inject.servlet.ManagedFilterPipeline$$EnhancerByGuice$$1af97b76.CGLIB$dispatch$0(<generated>)
+ at com.google.inject.servlet.ManagedFilterPipeline$$EnhancerByGuice$$1af97b76$$FastClassByGuice$$57398af4.invoke(<generated>)
+ at com.google.inject.internal.cglib.proxy.$MethodProxy.invokeSuper(MethodProxy.java:228)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at cc.kune.core.server.LoggerMethodInterceptor.invoke(LoggerMethodInterceptor.java:87)
+ at com.google.inject.internal.InterceptorStackCallback$InterceptedMethodInvocation.proceed(InterceptorStackCallback.java:64)
+ at com.google.inject.internal.InterceptorStackCallback.intercept(InterceptorStackCallback.java:44)
+ at com.google.inject.servlet.ManagedFilterPipeline$$EnhancerByGuice$$1af97b76.dispatch(<generated>)
+ at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
+ at cc.kune.core.server.rack.RackServletFilter$DockChain.execute(RackServletFilter.java:70)
+ at cc.kune.core.server.rack.RackServletFilter$DockChain.doFilter(RackServletFilter.java:63)
+ at cc.kune.core.server.rack.filters.LogFilter.doFilter(LogFilter.java:46)
+ at cc.kune.core.server.rack.RackServletFilter$DockChain.execute(RackServletFilter.java:70)
+ at cc.kune.core.server.rack.RackServletFilter$DockChain.doFilter(RackServletFilter.java:63)
+ at cc.kune.core.server.rack.RackServletFilter.doFilter(RackServletFilter.java:105)
+ at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1187)
+ at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:421)
+ at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
+ at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
+ at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
+ at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:930)
+ at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
+ at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
+ at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:866)
+ at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
+ at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
+ at org.eclipse.jetty.server.Server.handle(Server.java:351)
+ at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:594)
+ at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1059)
+ at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:764)
+ at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:217)
+ at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:424)
+ at org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:506)
+ at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
+ at java.lang.Thread.run(Thread.java:679)
+2011-04-27 16:59:01,904 [qtp2042579307-41] ERROR - Wavelet [WaveletName localhost/w+1v66qilgtl2o6E/localhost/conv+root] couldn't be retrieved
@@ -141,3 +270,8 @@
+
+
+
+
+
Modified: trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/chat/client/ChatClientDefault.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -45,7 +45,6 @@
import cc.kune.core.client.init.AppStopEvent;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.client.sitebar.SitebarActions;
-import cc.kune.core.client.sitebar.SitebarActionsPresenter;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.UserSignInEvent;
import cc.kune.core.client.state.UserSignInEvent.UserSignInHandler;
@@ -252,6 +251,7 @@
private void createActionIfNeeded() {
if (chatIcon == null) {
chatIcon = new IconLabelDescriptor(action);
+ chatIcon.setParent(siteActions.getLeftToolbar());
chatIcon.setId(CHAT_CLIENT_ICON_ID);
chatIcon.setStyles("k-no-backimage, k-btn-sitebar, k-chat-icon");
chatIcon.putValue(Action.NAME, i18n.t(CHAT_TITLE));
@@ -260,13 +260,9 @@
shorcutRegister.put(shortcut, action);
action.setShortcut(shortcut);
chatIcon.setVisible(session.isLogged());
- siteActions.getLeftToolbar().add(
- new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
- siteActions.getLeftToolbar().add(
- new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
- siteActions.getLeftToolbar().add(
- new ToolbarSeparatorDescriptor(Type.spacer, SitebarActionsPresenter.LEFT_TOOLBAR));
- siteActions.getLeftToolbar().add(chatIcon);
+ ToolbarSeparatorDescriptor.build(Type.spacer, siteActions.getLeftToolbar());
+ ToolbarSeparatorDescriptor.build(Type.spacer, siteActions.getLeftToolbar());
+ ToolbarSeparatorDescriptor.build(Type.spacer, siteActions.getLeftToolbar());
}
}
Modified: trunk/src/main/java/cc/kune/chat/client/ChatParts.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/ChatParts.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/chat/client/ChatParts.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -157,7 +157,7 @@
userItemsRegistry.get().add(startChatWithBuddieItem);
userItemsRegistry.get().add(startChatWithPersonItem);
userItemsRegistry.get().add(addAsBuddieItem);
- groupConfActions.get().add(startAssembly.get());
+ startAssembly.get();
buddieButton.get();
groupSN.get().refreshActions();
// openGroupRoom.get();
Modified: trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -143,11 +143,6 @@
onlineAction(NO_STATUS, Show.dnd, res.busy()));
final MenuRadioItemDescriptor offlineItem = createChatStatusAction(res.offline(),
i18n.t("Sign out of chat"), new ChangeOfflineStatusAction(xmppSession, res.offline()));
- userOptions.addAction(onlineItem);
- userOptions.addAction(availableItem);
- userOptions.addAction(awayItem);
- userOptions.addAction(busyItem);
- userOptions.addAction(offlineItem);
xmppSession.addSessionStateChangedHandler(false, new StateChangedHandler() {
@Override
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractComposedGuiItem.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractComposedGuiItem.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/AbstractComposedGuiItem.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -23,8 +23,10 @@
import cc.kune.common.client.actions.ui.bind.GuiBinding;
import cc.kune.common.client.actions.ui.bind.GuiProvider;
+import cc.kune.common.client.actions.ui.descrip.AbstractParentGuiActionDescrip;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.HasChilds;
import cc.kune.common.client.errors.UIException;
import com.google.gwt.user.client.ui.Composite;
@@ -80,12 +82,19 @@
} else {
final AbstractGuiItem item = binding.create(descrip);
if (binding.shouldBeAdded()) {
+ // TODO Change this ^ to shouldBeAttached
if (descrip.getPosition() == GuiActionDescrip.NO_POSITION) {
addWidget(item);
} else {
insertWidget(item, descrip.getPosition());
}
}
+ if (descrip instanceof HasChilds) {
+ for (final GuiActionDescrip child : ((AbstractParentGuiActionDescrip) descrip).getChilds()) {
+ // Log.info("Child added: " + child.getValue(Action.NAME));
+ add(child);
+ }
+ }
}
}
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractGuiActionDescrip.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -194,6 +194,14 @@
@Override
public void setParent(final GuiActionDescrip parent) {
+ setParent(parent, true);
+ }
+
+ @Override
+ public void setParent(final GuiActionDescrip parent, final boolean addToParent) {
+ if (parent != NO_PARENT && addToParent) {
+ ((AbstractParentGuiActionDescrip) parent).add(this);
+ }
this.parent = parent;
}
@@ -268,6 +276,12 @@
}
@Override
+ public GuiActionDescrip withParent(final GuiActionDescrip parent, final boolean addToParent) {
+ setParent(parent, addToParent);
+ return this;
+ }
+
+ @Override
public GuiActionDescrip withShortcut(final KeyStroke shortcut) {
putValue(Action.ACCELERATOR_KEY, shortcut);
return this;
Added: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractParentGuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractParentGuiActionDescrip.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractParentGuiActionDescrip.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,23 @@
+package cc.kune.common.client.actions.ui.descrip;
+
+import cc.kune.common.client.actions.AbstractAction;
+
+public abstract class AbstractParentGuiActionDescrip extends AbstractGuiActionDescrip implements
+ HasChilds {
+
+ private final GuiActionDescCollection childs;
+
+ public AbstractParentGuiActionDescrip(final AbstractAction action) {
+ super(action);
+ childs = new GuiActionDescCollection();
+ }
+
+ public void add(final GuiActionDescrip... descriptors) {
+ childs.add(descriptors);
+ }
+
+ public GuiActionDescCollection getChilds() {
+ return childs;
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractSeparatorDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractSeparatorDescriptor.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/AbstractSeparatorDescriptor.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -23,8 +23,8 @@
public abstract class AbstractSeparatorDescriptor extends AbstractGuiActionDescrip {
- public AbstractSeparatorDescriptor() {
- super(AbstractAction.NO_ACTION);
- }
+ public AbstractSeparatorDescriptor() {
+ super(AbstractAction.NO_ACTION);
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescCollection.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescCollection.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescCollection.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -24,12 +24,14 @@
// @PMD:REVIEWED:AtLeastOneConstructor: by vjrj on 26/05/09 12:31
public class GuiActionDescCollection extends ArrayList<GuiActionDescrip> {
- private static final long serialVersionUID = 6759723760404227737L;
+ private static final long serialVersionUID = 6759723760404227737L;
- public void add(final GuiActionDescrip... descriptors) {
- for (final GuiActionDescrip descriptor : descriptors) {
- super.add(descriptor);
- }
+ public void add(final GuiActionDescrip... descriptors) {
+ for (final GuiActionDescrip descriptor : descriptors) {
+ if (!super.contains(descriptor)) {
+ super.add(descriptor);
+ }
}
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/GuiActionDescrip.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -93,6 +93,15 @@
void setParent(final GuiActionDescrip parent);
+ /**
+ * @param parent
+ * @param addToParent
+ * if yes, the action will be added directly to the parent, useful to
+ * attach menu items (or other child actions) directly to its parent
+ * without any other check (for instance session status, etc)
+ */
+ void setParent(GuiActionDescrip parent, boolean addToParent);
+
void setPosition(final int position);
void setStyles(final String styles);
@@ -113,6 +122,15 @@
GuiActionDescrip withParent(GuiActionDescrip parent);
+ /**
+ * @param parent
+ * @param addToParent
+ * if yes, the action will be added directly to the parent, useful to
+ * attach menu items (or other child actions) directly to its parent
+ * without any other check (for instance session status, etc)
+ */
+ GuiActionDescrip withParent(GuiActionDescrip parent, boolean addToParent);
+
GuiActionDescrip withShortcut(KeyStroke keystroke);
GuiActionDescrip withStyles(String styles);
Added: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/HasChilds.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/HasChilds.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/HasChilds.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,4 @@
+package cc.kune.common.client.actions.ui.descrip;
+
+public interface HasChilds {
+}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuDescriptor.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -25,7 +25,7 @@
import com.google.gwt.resources.client.ImageResource;
-public class MenuDescriptor extends AbstractGuiActionDescrip {
+public class MenuDescriptor extends AbstractParentGuiActionDescrip {
public static final String MENU_CLEAR = "menuclear";
public static final String MENU_HIDE = "hidemenu";
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuItemDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuItemDescriptor.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuItemDescriptor.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -23,35 +23,63 @@
public class MenuItemDescriptor extends AbstractGuiActionDescrip {
- /**
- * A simple menu item definition.
- *
- * You must define a menu item with its parent menu. Only use this
- * constructor if you'll set the parent menu in the future (before render)
- *
- * @param action
- */
- public MenuItemDescriptor(final AbstractAction action) {
- super(action);
- }
+ public static MenuItemDescriptor build(final AbstractAction action) {
+ return new MenuItemDescriptor(action);
+ }
- /**
- *
- * A simple menu item definition.
- *
- * This is the preferred and more common used constructor.
- *
- * @param parent
- * menu
- * @param action
- */
- public MenuItemDescriptor(final MenuDescriptor parent, final AbstractAction action) {
- super(action);
- setParent(parent);
- }
+ public static MenuItemDescriptor build(final MenuDescriptor parent, final AbstractAction action) {
+ return new MenuItemDescriptor(parent, action);
+ }
- @Override
- public Class<?> getType() {
- return MenuItemDescriptor.class;
- }
+ /**
+ * A simple menu item definition.
+ *
+ * You must define a menu item with its parent menu. Only use this constructor
+ * if you'll set the parent menu in the future (before render)
+ *
+ * @param action
+ */
+ public MenuItemDescriptor(final AbstractAction action) {
+ super(action);
+ }
+
+ /**
+ *
+ * A simple menu item definition.
+ *
+ * This is the preferred and more common used constructor.
+ *
+ * @param parent
+ * menu
+ * @param action
+ */
+ public MenuItemDescriptor(final MenuDescriptor parent, final AbstractAction action) {
+ super(action);
+ setParent(parent);
+ }
+
+ /**
+ *
+ * A simple menu item definition.
+ *
+ * This is the preferred and more common used constructor.
+ *
+ * @param parent
+ * menu
+ * @param addToParent
+ * if yes, the action will be added directly to the parent, useful to
+ * attach menu items (or other child actions) directly to its parent
+ * without any other check (for instance session status, etc)
+ * @param action
+ */
+ public MenuItemDescriptor(final MenuDescriptor parent, final boolean addToParent,
+ final AbstractAction action) {
+ super(action);
+ setParent(parent, addToParent);
+ }
+
+ @Override
+ public Class<?> getType() {
+ return MenuItemDescriptor.class;
+ }
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuSeparatorDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuSeparatorDescriptor.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/MenuSeparatorDescriptor.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -21,13 +21,17 @@
public class MenuSeparatorDescriptor extends AbstractSeparatorDescriptor {
- public MenuSeparatorDescriptor(final MenuDescriptor parent) {
- super();
- setParent(parent);
- }
+ public static MenuSeparatorDescriptor build(final MenuDescriptor parent) {
+ return new MenuSeparatorDescriptor(parent);
+ }
- @Override
- public Class<?> getType() {
- return MenuSeparatorDescriptor.class;
- }
+ public MenuSeparatorDescriptor(final MenuDescriptor parent) {
+ super();
+ setParent(parent);
+ }
+
+ @Override
+ public Class<?> getType() {
+ return MenuSeparatorDescriptor.class;
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/SubMenuDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/SubMenuDescriptor.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/SubMenuDescriptor.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -26,6 +26,10 @@
public class SubMenuDescriptor extends MenuDescriptor {
+ public static SubMenuDescriptor build() {
+ return new SubMenuDescriptor();
+ }
+
public SubMenuDescriptor() {
this(new BaseAction(null, null));
}
@@ -43,6 +47,11 @@
putValue(MENU_STANDALONE, false);
}
+ public SubMenuDescriptor(final GuiActionDescrip parent, final boolean addToParent, final String text) {
+ this(text);
+ setParent(parent, addToParent);
+ }
+
public SubMenuDescriptor(final GuiActionDescrip parent, final String text) {
this(text);
setParent(parent);
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/ToolbarDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/ToolbarDescriptor.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/ToolbarDescriptor.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -22,28 +22,32 @@
import cc.kune.common.client.actions.Action;
import cc.kune.common.client.actions.BaseAction;
-public class ToolbarDescriptor extends AbstractGuiActionDescrip {
+public class ToolbarDescriptor extends AbstractParentGuiActionDescrip {
- public static final String TOOLBAR_CLEAR = "menuclear";
+ public static final String TOOLBAR_CLEAR = "menuclear";
- public ToolbarDescriptor() {
- super(new BaseAction(null, null));
- super.getAction().putValue(TOOLBAR_CLEAR, false);
- }
+ public static ToolbarDescriptor build() {
+ return new ToolbarDescriptor();
+ }
- public void clear() {
- // Action detects changes in values, then we fire a change (whatever) to
- // fire this method in the UI
- putValue(TOOLBAR_CLEAR, !((Boolean) getValue(TOOLBAR_CLEAR)));
- }
+ public ToolbarDescriptor() {
+ super(new BaseAction(null, null));
+ super.getAction().putValue(TOOLBAR_CLEAR, false);
+ }
- @Override
- public Class<?> getType() {
- return ToolbarDescriptor.class;
- }
+ public void clear() {
+ // Action detects changes in values, then we fire a change (whatever) to
+ // fire this method in the UI
+ putValue(TOOLBAR_CLEAR, !((Boolean) getValue(TOOLBAR_CLEAR)));
+ }
- public void setText(final String text) {
- putValue(Action.NAME, text);
- }
+ @Override
+ public Class<?> getType() {
+ return ToolbarDescriptor.class;
+ }
+ public void setText(final String text) {
+ putValue(Action.NAME, text);
+ }
+
}
Modified: trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/ToolbarSeparatorDescriptor.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/ToolbarSeparatorDescriptor.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/actions/ui/descrip/ToolbarSeparatorDescriptor.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -19,28 +19,31 @@
*/
package cc.kune.common.client.actions.ui.descrip;
-
public class ToolbarSeparatorDescriptor extends AbstractSeparatorDescriptor {
- public enum Type {
- spacer, separator, fill
- }
+ public enum Type {
+ fill, separator, spacer
+ }
- private final Type type;
+ public static ToolbarSeparatorDescriptor build(final Type type, final ToolbarDescriptor parent) {
+ return new ToolbarSeparatorDescriptor(type, parent);
+ }
- public ToolbarSeparatorDescriptor(final Type type, final ToolbarDescriptor parent) {
- super();
- this.type = type;
- setParent(parent);
- }
+ private final Type type;
- public Type getSeparatorType() {
- return type;
- }
+ public ToolbarSeparatorDescriptor(final Type type, final ToolbarDescriptor parent) {
+ super();
+ this.type = type;
+ setParent(parent);
+ }
- @Override
- public Class<?> getType() {
- return ToolbarSeparatorDescriptor.class;
- }
+ public Type getSeparatorType() {
+ return type;
+ }
+ @Override
+ public Class<?> getType() {
+ return ToolbarSeparatorDescriptor.class;
+ }
+
}
Modified: trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/tooltip/Tooltip.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -33,6 +33,8 @@
import com.google.gwt.event.dom.client.MouseOutHandler;
import com.google.gwt.event.dom.client.MouseOverEvent;
import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.logical.shared.AttachEvent;
+import com.google.gwt.event.logical.shared.AttachEvent.Handler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.Window;
@@ -59,6 +61,15 @@
final Tooltip tip = new Tooltip();
tip.to(widget);
tip.setText(text);
+ widget.addAttachHandler(new Handler() {
+ @Override
+ public void onAttachOrDetach(final AttachEvent event) {
+ if (!event.isAttached()) {
+ tip.hide();
+ }
+ }
+
+ });
return tip;
}
return null;
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialog.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialog.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialog.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -25,16 +25,18 @@
public interface AbstractTabbedDialog {
- void activateTab(int index);
+ void activateTab(int index);
- void addTab(IsWidget tab, IsWidget tabTitle);
+ void addTab(IsWidget tab, IsWidget tabTitle);
- public void hideMessages();
+ void hide();
- void insertTab(IsWidget tab, IsWidget tabTitle, int position);
+ public void hideMessages();
- public void setErrorMessage(String message, NotifyLevel level);
+ void insertTab(IsWidget tab, IsWidget tabTitle, int position);
- void show();
+ public void setErrorMessage(String message, NotifyLevel level);
+ void show();
+
}
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -19,11 +19,15 @@
*/
package cc.kune.common.client.ui.dialogs.tabbed;
+import cc.kune.common.client.ProvidersCollection;
import cc.kune.common.client.notify.NotifyLevel;
import cc.kune.common.client.notify.NotifyLevelImages;
import cc.kune.common.client.ui.dialogs.BasicTopDialog;
import cc.kune.common.client.ui.dialogs.MessageToolbar;
+import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter.AbstractTabbedDialogView;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.logical.shared.HasCloseHandlers;
import com.google.gwt.resources.client.ImageResource;
@@ -42,6 +46,7 @@
private final NotifyLevelImages images;
private MessageToolbar messageErrorBar;
private final boolean modal;
+ private final ProvidersCollection provCollection;
private final String sndBtnId;
private final String sndBtnTitle;
private DecoratedTabPanel tabPanel;
@@ -50,7 +55,8 @@
public AbstractTabbedDialogPanel(final String dialogId, final String title, final boolean modal,
final NotifyLevelImages images, final String errorLabelId, final String firstBtnTitle,
- final String firstBtnId, final String sndBtnTitle, final String sndBtnId) {
+ final String firstBtnId, final String sndBtnTitle, final String sndBtnId,
+ final ProvidersCollection provCollection) {
this.dialogId = dialogId;
this.title = title;
this.modal = modal;
@@ -60,13 +66,15 @@
this.firstBtnId = firstBtnId;
this.sndBtnTitle = sndBtnTitle;
this.sndBtnId = sndBtnId;
+ this.provCollection = provCollection;
}
public AbstractTabbedDialogPanel(final String dialogId, final String title, final int width,
final int height, final boolean modal, final NotifyLevelImages images, final String errorLabelId,
final String firstBtnTitle, final String firstBtnId, final String sndBtnTitle,
- final String sndBtnId) {
- this(dialogId, title, modal, images, errorLabelId, firstBtnTitle, firstBtnId, sndBtnTitle, sndBtnId);
+ final String sndBtnId, final ProvidersCollection provCollection) {
+ this(dialogId, title, modal, images, errorLabelId, firstBtnTitle, firstBtnId, sndBtnTitle, sndBtnId,
+ provCollection);
this.width = width;
this.height = height;
}
@@ -84,9 +92,9 @@
}
@Override
- public void createAndShow() {
- show();
- setFirstTabActive();
+ public Widget asWidget() {
+ createDialogIfNecessary();
+ return dialog;
}
private void createDialog() {
@@ -97,6 +105,13 @@
tabPanel = new DecoratedTabPanel();
tabPanel.getDeckPanel().setSize(String.valueOf(width), String.valueOf(height));
dialog.getInnerPanel().add(tabPanel);
+ dialog.getFirstBtn().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ hide();
+ }
+ });
+ provCollection.createAll();
}
private void createDialogIfNecessary() {
@@ -128,11 +143,6 @@
return dialog.getSecondBtn();
}
- public Widget getWidget() {
- createDialogIfNecessary();
- return dialog;
- }
-
@Override
public void hide() {
if (dialog != null) {
@@ -187,8 +197,16 @@
}
}
+ @Override
public void show() {
+ showImpl();
+ setFirstTabActive();
+ }
+
+ private void showImpl() {
createDialogIfNecessary();
+ hideMessages();
dialog.showCentered();
}
+
}
Deleted: trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1,73 +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.common.client.ui.dialogs.tabbed;
-
-import cc.kune.common.client.notify.NotifyLevel;
-
-import com.google.gwt.user.client.ui.IsWidget;
-
-public abstract class AbstractTabbedDialogPresenter implements AbstractTabbedDialog {
-
- private AbstractTabbedDialogView view;
-
- @Override
- public void activateTab(final int index) {
- view.activateTab(index);
- }
-
- @Override
- public void addTab(final IsWidget tab, final IsWidget tabTitle) {
- view.addTab(tab, tabTitle);
- }
-
- public IsWidget getView() {
- return view;
- }
-
- public void hide() {
- view.hide();
- }
-
- @Override
- public void hideMessages() {
- view.hideMessages();
- }
-
- public void init(final AbstractTabbedDialogView view) {
- this.view = view;
- }
-
- @Override
- public void insertTab(final IsWidget tab, final IsWidget tabTitle, final int index) {
- view.insertTab(tab, tabTitle, index);
- }
-
- @Override
- public void setErrorMessage(final String message, final NotifyLevel level) {
- view.setErrorMessage(message, level);
- }
-
- @Override
- public void show() {
- hideMessages();
- view.createAndShow();
- }
-
-}
Added: trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java (rev 0)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,93 @@
+/*
+ *
+ * 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.common.client.ui.dialogs.tabbed;
+
+import cc.kune.common.client.notify.NotifyLevel;
+
+import com.google.gwt.user.client.ui.IsWidget;
+
+public abstract class AbstractTabbedDialogPresenter implements AbstractTabbedDialog {
+
+ public interface AbstractTabbedDialogView extends IsWidget {
+
+ void activateTab(int index);
+
+ void addTab(IsWidget tab, IsWidget tabTitle);
+
+ void destroy();
+
+ void hide();
+
+ void hideMessages();
+
+ void insertTab(IsWidget tab, IsWidget tabTitle, int position);
+
+ void setErrorMessage(final String message, final NotifyLevel level);
+
+ void show();
+ }
+
+ private AbstractTabbedDialogView view;
+
+ @Override
+ public void activateTab(final int index) {
+ view.activateTab(index);
+ }
+
+ @Override
+ public void addTab(final IsWidget tab, final IsWidget tabTitle) {
+ view.addTab(tab, tabTitle);
+ }
+
+ public IsWidget getView() {
+ return view;
+ }
+
+ @Override
+ public void hide() {
+ view.hide();
+ }
+
+ @Override
+ public void hideMessages() {
+ view.hideMessages();
+ }
+
+ public void init(final AbstractTabbedDialogView view) {
+ this.view = view;
+ }
+
+ @Override
+ public void insertTab(final IsWidget tab, final IsWidget tabTitle, final int index) {
+ view.insertTab(tab, tabTitle, index);
+ }
+
+ @Override
+ public void setErrorMessage(final String message, final NotifyLevel level) {
+ view.setErrorMessage(message, level);
+ }
+
+ @Override
+ public void show() {
+ hideMessages();
+ view.show();
+ }
+
+}
Deleted: trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogView.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogView.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogView.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1,44 +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.common.client.ui.dialogs.tabbed;
-
-import cc.kune.common.client.notify.NotifyLevel;
-
-import com.google.gwt.user.client.ui.IsWidget;
-
-public interface AbstractTabbedDialogView extends IsWidget {
-
- void activateTab(int index);
-
- void addTab(IsWidget tab, IsWidget tabTitle);
-
- void createAndShow();
-
- void destroy();
-
- void hide();
-
- void hideMessages();
-
- void insertTab(IsWidget tab, IsWidget tabTitle, int position);
-
- void setErrorMessage(final String message, final NotifyLevel level);
-
-}
Modified: trunk/src/main/java/cc/kune/common/client/utils/TextUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/utils/TextUtils.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/common/client/utils/TextUtils.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -21,115 +21,221 @@
import java.util.ArrayList;
+import org.apache.commons.lang.WordUtils;
+
+import cc.kune.common.client.errors.NotImplementedException;
+
import com.google.gwt.safehtml.shared.SimpleHtmlSanitizer;
public class TextUtils {
- // Original regexp from http://www.regular-expressions.info/email.html
- public static final String EMAIL_REGEXP = "[-!#$%&\'*+/=?_`{|}~a-z0-9^]+(\\.[-!#$%&\'*+/=?_`{|}~a-z0-9^]+)*@(localhost|([a-z0-9]([-a-z0-9]*[a-z0-9])?\\.)+[a-z0-9]([-a-z0-9]*[a-z0-9]))?";
- public static final String IN_DEVELOPMENT = "In development";
+ // Original regexp from http://www.regular-expressions.info/email.html
+ public static final String EMAIL_REGEXP = "[-!#$%&\'*+/=?_`{|}~a-z0-9^]+(\\.[-!#$%&\'*+/=?_`{|}~a-z0-9^]+)*@(localhost|([a-z0-9]([-a-z0-9]*[a-z0-9])?\\.)+[a-z0-9]([-a-z0-9]*[a-z0-9]))?";
+ public static final String IN_DEVELOPMENT = "In development";
- public static final String IN_DEVELOPMENT_P = " (in development)";
+ public static final String IN_DEVELOPMENT_P = " (in development)";
- public static final String NUM_REGEXP = "^[0-9]+$";
+ public static final String NUM_REGEXP = "^[0-9]+$";
- public static final String UNIX_NAME = "^[a-z0-9_\\-]+$";
+ public static final String UNIX_NAME = "^[a-z0-9_\\-]+$";
- // Original regexp from http://snippets.dzone.com/posts/show/452
- public static final String URL_REGEXP = "((ftp|http|https|mailto):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?)";
+ // Original regexp from http://snippets.dzone.com/posts/show/452
+ public static final String URL_REGEXP = "((ftp|http|https|mailto):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?)";
- public static String br() {
- return "<br/>";
+ /**
+ * @see WordUtils#abbreviate
+ */
+ public static String abbreviate(final String str, int lower, int upper, final String appendToEnd) {
+ // initial parameter checks
+ if (str == null) {
+ return null;
}
-
- public static String brbr() {
- return "<br/><br/>";
+ if (str.length() == 0) {
+ return "";
}
- public static String ellipsis(final String text, final int length) {
- return text == null ? "" : length <= 0 ? text : text.length() > length ? text.substring(0, length - 3) + "..."
- : text;
+ // if the lower value is greater than the length of the string,
+ // set to the length of the string
+ if (lower > str.length()) {
+ lower = str.length();
}
+ // if the upper value is -1 (i.e. no limit) or is greater
+ // than the length of the string, set to the length of the string
+ if (upper == -1 || upper > str.length()) {
+ upper = str.length();
+ }
+ // if upper is less than lower, raise it to lower
+ if (upper < lower) {
+ upper = lower;
+ }
- public static boolean empty(final String string) {
- return !notEmpty(string);
+ final StringBuffer result = new StringBuffer();
+ final int index = str.indexOf(" ", lower);
+ if (index == -1) {
+ result.append(str.substring(0, upper));
+ // only if abbreviation has occured do we append the appendToEnd value
+ if (upper != str.length()) {
+ result.append(defaultString(appendToEnd));
+ }
+ } else if (index > upper) {
+ result.append(str.substring(0, upper));
+ result.append(defaultString(appendToEnd));
+ } else {
+ result.append(str.substring(0, index));
+ result.append(defaultString(appendToEnd));
}
+ return result.toString();
+ }
- /**
- * This method escape only some dangerous html chars
- *
- * Try to use {@link SimpleHtmlSanitizer} better
- *
- */
- @Deprecated
- public static String escapeHtmlLight(final String source) {
- String result = source;
- if (source != null) {
- result = result.replaceAll("&", "&");
- result = result.replaceAll("\"", """);
- // text = text.replaceAll("\'", "'");
- result = result.replaceAll("<", "<");
- result = result.replaceAll(">", ">");
- }
- return result;
+ public static String br() {
+ return "<br/>";
+ }
+
+ public static String brbr() {
+ return "<br/><br/>";
+ }
+
+ /**
+ * @see WordUtils#capitalize(String, char[])
+ * @return
+ */
+ public static String capitalize(final String str, final char[] delimiters) {
+ final int delimLen = (delimiters == null ? -1 : delimiters.length);
+ if (str == null || str.length() == 0 || delimLen == 0) {
+ return str;
}
+ final int strLen = str.length();
+ final StringBuffer buffer = new StringBuffer(strLen);
+ boolean capitalizeNext = true;
+ for (int i = 0; i < strLen; i++) {
+ final char ch = str.charAt(i);
- /**
- * FIXME: Is this safe? Try to use {@link SimpleHtmlSanitizer} also in the
- * method
- *
- */
- @Deprecated
- public static String generateHtmlLink(final String href, final String text) {
- return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>";
+ if (isDelimiter(ch, delimiters)) {
+ buffer.append(ch);
+ capitalizeNext = true;
+ } else if (capitalizeNext) {
+ // Original:in WordUtils buffer.append(Character.toTitleCase(ch));
+ buffer.append(String.valueOf(ch).toUpperCase());
+ capitalizeNext = false;
+ } else {
+ buffer.append(ch);
+ }
}
+ return buffer.toString();
+ }
- public static boolean notEmpty(final String string) {
- return string != null && string.length() > 0;
+ /**
+ * @see WordUtils#capitalizeFully(String)
+ */
+ public static String capitalizeFully(String str, final char[] delimiters) {
+ final int delimLen = (delimiters == null ? -1 : delimiters.length);
+ if (str == null || str.length() == 0 || delimLen == 0) {
+ return str;
}
+ str = str.toLowerCase();
+ return capitalize(str, delimiters);
+ }
- public static String removeLastSlash(final String text) {
- return text.replaceFirst("/$", "");
+ private static String defaultString(final String str) {
+ return str == null ? "" : str;
+ }
+
+ public static String ellipsis(final String text, final int length) {
+ return text == null ? "" : length <= 0 ? text : text.length() > length ? text.substring(0,
+ length - 3) + "..." : text;
+ }
+
+ public static boolean empty(final String string) {
+ return !notEmpty(string);
+ }
+
+ /**
+ * This method escape only some dangerous html chars
+ *
+ * Try to use {@link SimpleHtmlSanitizer} better
+ *
+ */
+ @Deprecated
+ public static String escapeHtmlLight(final String source) {
+ String result = source;
+ if (source != null) {
+ result = result.replaceAll("&", "&");
+ result = result.replaceAll("\"", """);
+ // text = text.replaceAll("\'", "'");
+ result = result.replaceAll("<", "<");
+ result = result.replaceAll(">", ">");
}
+ return result;
+ }
- public static ArrayList<String> splitTags(final String tagsString) {
- final ArrayList<String> tagsList = new ArrayList<String>();
- String tagsCopy = tagsString;
- // remove commas and quotes
- if (tagsString == null) {
- return tagsList;
- }
- tagsCopy = tagsCopy.replaceAll(",", " ");
- tagsCopy = tagsCopy.replaceAll("\"", "");
- tagsCopy = tagsCopy.replaceAll("\'", "");
- final String[] splitted = tagsCopy.split("\\s+");
- for (String tag : splitted) {
- tag = tag.replaceAll("\\s$", "");
- if (tag.length() > 0) {
- tagsList.add(tag);
- }
- }
- return tagsList;
+ /**
+ * FIXME: Is this safe? Try to use {@link SimpleHtmlSanitizer} also in the
+ * method
+ *
+ */
+ @Deprecated
+ public static String generateHtmlLink(final String href, final String text) {
+ return "<a href=\"" + href + "\" target=\"_blank\">" + text + "</a>";
+ }
+
+ private static boolean isDelimiter(final char ch, final char[] delimiters) {
+ if (delimiters == null) {
+ throw new NotImplementedException();
+ // return Character.isWhitespace(ch);
}
+ for (final char delimiter : delimiters) {
+ if (ch == delimiter) {
+ return true;
+ }
+ }
+ return false;
+ }
- /*
- * This method unescape only some dangerous html chars for use in GWT Html
- * widget for instance
- */
- public static String unescape(final String source) {
- if (source == null) {
- return null;
- }
- String result = source;
- result = result.replaceAll("&", "&");
- result = result.replaceAll(""", "\"");
- result = result.replaceAll("'", "\'");
- result = result.replaceAll("<", "<");
- result = result.replaceAll(">", ">");
- return result;
+ public static boolean notEmpty(final String string) {
+ return string != null && string.length() > 0;
+ }
+
+ public static String removeLastSlash(final String text) {
+ return text.replaceFirst("/$", "");
+ }
+
+ public static ArrayList<String> splitTags(final String tagsString) {
+ final ArrayList<String> tagsList = new ArrayList<String>();
+ String tagsCopy = tagsString;
+ // remove commas and quotes
+ if (tagsString == null) {
+ return tagsList;
}
+ tagsCopy = tagsCopy.replaceAll(",", " ");
+ tagsCopy = tagsCopy.replaceAll("\"", "");
+ tagsCopy = tagsCopy.replaceAll("\'", "");
+ final String[] splitted = tagsCopy.split("\\s+");
+ for (String tag : splitted) {
+ tag = tag.replaceAll("\\s$", "");
+ if (tag.length() > 0) {
+ tagsList.add(tag);
+ }
+ }
+ return tagsList;
+ }
- public TextUtils() {
+ /*
+ * This method unescape only some dangerous html chars for use in GWT Html
+ * widget for instance
+ */
+ public static String unescape(final String source) {
+ if (source == null) {
+ return null;
}
+ String result = source;
+ result = result.replaceAll("&", "&");
+ result = result.replaceAll(""", "\"");
+ result = result.replaceAll("'", "\'");
+ result = result.replaceAll("<", "<");
+ result = result.replaceAll(">", ">");
+ return result;
+ }
+ public TextUtils() {
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/actions/xml/XMLActionsParser.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -112,7 +112,7 @@
if (subMenuDescriptor == null) {
final GuiActionDescrip parent = (i == 0 ? menu : submenus.get(getSubPathId(typeId, path, i - 1)));
assert parent != null;
- subMenuDescriptor = new SubMenuDescriptor(parent, i18n.t(name));
+ subMenuDescriptor = new SubMenuDescriptor(parent, false, i18n.t(name));
// subMenuDescriptor.setVisible(false);
submenus.put(subpathId, subMenuDescriptor);
actionRegistry.addAction(ActionGroups.TOOLBAR, subMenuDescriptor, typeId);
@@ -158,7 +158,7 @@
public GuiActionDescrip get() {
final MenuItemDescriptor menuItem = new MenuItemDescriptor(action);
menuItem.withText(descrip.getDescName()).withToolTip(descrip.getDescription());
- menuItem.setParent(TextUtils.notEmpty(path) ? submenu : menu);
+ menuItem.setParent(TextUtils.notEmpty(path) ? submenu : menu, false);
return menuItem;
}
};
Added: trunk/src/main/java/cc/kune/core/client/i18n/I18nConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/I18nConstants.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/i18n/I18nConstants.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,7 @@
+package cc.kune.core.client.i18n;
+
+import com.google.gwt.i18n.client.ConstantsWithLookup;
+
+public interface I18nConstants extends ConstantsWithLookup {
+
+}
Added: trunk/src/main/java/cc/kune/core/client/i18n/I18nUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/i18n/I18nUtils.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/i18n/I18nUtils.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,25 @@
+package cc.kune.core.client.i18n;
+
+import cc.kune.common.client.utils.TextUtils;
+
+/**
+ * Copied some methods from org.apache.commons.lang.WordUtils
+ *
+ */
+public class I18nUtils {
+
+ public static String convertMethodName(final String name) {
+ String result = name;
+ result = result.replaceAll("\\[%d\\]", "N");
+ result = result.replaceAll("\\[%s\\]", "Param");
+ final char[] delimiters = { ' ', '.', '?', ',', ';', '&', '(', ')', '"', '$', '!', '/', '\'', '-',
+ '%', ':', '{', '}', '[', ']' };
+ result = TextUtils.capitalizeFully(result, delimiters);
+ result = result.replaceAll("[ \\.\\?,;&\\(\\)\"\\$!\\/\\'\\-%:{}\\[\\]]", "");
+ return TextUtils.abbreviate(
+ new StringBuffer(result.length()).append(Character.toLowerCase(result.charAt(0))).append(
+ result.substring(1)).toString(), 0, 100, "");
+
+ }
+
+}
\ No newline at end of file
Added: trunk/src/main/java/cc/kune/core/client/sitebar/SiteOptions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SiteOptions.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SiteOptions.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,7 @@
+package cc.kune.core.client.sitebar;
+
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+
+public interface SiteOptions {
+ void addAction(GuiActionDescrip descriptor);
+}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptions.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptions.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -19,10 +19,6 @@
*/
package cc.kune.core.client.sitebar;
-import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+public interface SiteUserOptions extends SiteOptions {
-public interface SiteUserOptions {
-
- void addAction(GuiActionDescrip descriptor);
-
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SiteUserOptionsPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -58,14 +58,13 @@
private final CoreResources res;
private ToolbarSeparatorDescriptor separator;
private final Session session;
- private final SitebarActionsPresenter siteOptions;
+ private final SitebarActions siteOptions;
private final StateManager stateManager;
@Inject
public SiteUserOptionsPresenter(final Session session, final StateManager stateManager,
final Provider<FileDownloadUtils> downloadProvider, final I18nTranslationService i18n,
- final CoreResources img, final SitebarActionsPresenter siteOptions,
- final GotoGroupAction gotoGroupAction) {
+ final CoreResources img, final SitebarActions siteOptions, final GotoGroupAction gotoGroupAction) {
super();
this.session = session;
this.stateManager = stateManager;
@@ -100,7 +99,6 @@
private void addActionImpl(final GuiActionDescrip descriptor) {
descriptor.setParent(LOGGED_USER_MENU);
- siteOptions.getRightToolbar().add(descriptor);
}
private void addPartipation(final GroupDTO group) {
@@ -110,17 +108,14 @@
participant.putValue(Action.NAME, group.getLongName());
participant.putValue(Action.SMALL_ICON, logoImageUrl);
participant.setParent(partiMenu);
- siteOptions.getRightToolbar().add(participant);
}
private void createActions() {
LOGGED_USER_MENU.setId(LOGGED_USER_MENU_ID);
- LOGGED_USER_MENU.setParent(SitebarActionsPresenter.RIGHT_TOOLBAR);
+ LOGGED_USER_MENU.setParent(siteOptions.getRightToolbar());
LOGGED_USER_MENU.setStyles("k-no-backimage, k-btn-sitebar");
LOGGED_USER_MENU.setRightIcon(res.arrowdownsitebar());
- siteOptions.getRightToolbar().add(LOGGED_USER_MENU);
- separator = new ToolbarSeparatorDescriptor(Type.separator, SitebarActionsPresenter.RIGHT_TOOLBAR);
- siteOptions.getRightToolbar().add(separator);
+ separator = new ToolbarSeparatorDescriptor(Type.separator, siteOptions.getRightToolbar());
partiMenu = new SubMenuDescriptor(i18n.t("Your groups"));
addActionImpl(partiMenu);
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActions.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActions.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -19,12 +19,12 @@
*/
package cc.kune.core.client.sitebar;
-import cc.kune.common.client.actions.ui.IsActionExtensible;
+import cc.kune.common.client.actions.ui.descrip.ToolbarDescriptor;
public interface SitebarActions {
- IsActionExtensible getLeftToolbar();
+ ToolbarDescriptor getLeftToolbar();
- IsActionExtensible getRightToolbar();
+ ToolbarDescriptor getRightToolbar();
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarActionsPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -64,10 +64,9 @@
void showErrorDialog();
}
- public static final ToolbarDescriptor LEFT_TOOLBAR = new ToolbarDescriptor();
-
- public static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
- public static final ToolbarDescriptor RIGHT_TOOLBAR = new ToolbarDescriptor();
+ private static final ToolbarDescriptor LEFT_TOOLBAR = new ToolbarDescriptor();
+ private static final MenuDescriptor OPTIONS_MENU = new MenuDescriptor();
+ private static final ToolbarDescriptor RIGHT_TOOLBAR = new ToolbarDescriptor();
public static final String SITE_OPTIONS_MENU = "kune-sop-om";
private final I18nTranslationService i18n;
@@ -93,9 +92,22 @@
init();
}
+ private MenuItemDescriptor createGotoKune() {
+ final MenuItemDescriptor gotoKuneDevSite = new MenuItemDescriptor(OPTIONS_MENU,
+ new AbstractAction() {
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ KuneWindowUtils.open("http://kune.ourproject.org/");
+ }
+ });
+ gotoKuneDevSite.putValue(Action.NAME, i18n.t("kune development site"));
+ gotoKuneDevSite.putValue(Action.SMALL_ICON, icons.kuneIcon16());
+ return gotoKuneDevSite;
+ }
+
@Override
- public IsActionExtensible getLeftToolbar() {
- return getView().getLeftBar();
+ public ToolbarDescriptor getLeftToolbar() {
+ return LEFT_TOOLBAR;
}
public MenuDescriptor getOptionsMenu() {
@@ -103,30 +115,21 @@
}
@Override
- public IsActionExtensible getRightToolbar() {
- return getView().getRightBar();
+ public ToolbarDescriptor getRightToolbar() {
+ return RIGHT_TOOLBAR;
}
private void init() {
OPTIONS_MENU.withId(SITE_OPTIONS_MENU);
- getView().getLeftBar().add(LEFT_TOOLBAR);
- getView().getRightBar().add(RIGHT_TOOLBAR);
}
@ProxyEvent
public void onAppStart(final AppStartEvent event) {
- final IsActionExtensible right = getView().getRightBar();
OPTIONS_MENU.putValue(Action.NAME, i18n.t("Options"));
OPTIONS_MENU.putValue(Action.SMALL_ICON, res.arrowdownsitebar());
- OPTIONS_MENU.setParent(RIGHT_TOOLBAR);
OPTIONS_MENU.setStyles("k-no-backimage, k-btn-sitebar");
OPTIONS_MENU.putValue(AbstractGxtMenuGui.MENU_POSITION, AbstractGxtMenuGui.MenuPosition.bl);
- final ToolbarSeparatorDescriptor separator = new ToolbarSeparatorDescriptor(Type.separator,
- RIGHT_TOOLBAR);
- final ToolbarSeparatorDescriptor separator2 = new ToolbarSeparatorDescriptor(Type.separator,
- RIGHT_TOOLBAR);
- final MenuSeparatorDescriptor menuSeparator = new MenuSeparatorDescriptor(OPTIONS_MENU);
final AbstractExtendedAction bugsAction = new AbstractExtendedAction() {
@Override
public void actionPerformed(final ActionEvent event) {
@@ -135,7 +138,6 @@
};
bugsAction.putValue(Action.NAME, i18n.t("Report Kune issues/problems"));
bugsAction.putValue(Action.SMALL_ICON, icons.bug());
- final MenuItemDescriptor reportBugs = new MenuItemDescriptor(OPTIONS_MENU, bugsAction);
final AbstractExtendedAction errorAction = new AbstractExtendedAction() {
@Override
@@ -157,15 +159,6 @@
KuneWindowUtils.open("http://incubator.apache.org/wave/");
}
};
- final MenuItemDescriptor gotoKuneDevSite = new MenuItemDescriptor(OPTIONS_MENU,
- new AbstractAction() {
- @Override
- public void actionPerformed(final ActionEvent event) {
- KuneWindowUtils.open("http://kune.ourproject.org/");
- }
- });
- gotoKuneDevSite.putValue(Action.NAME, i18n.t("kune development site"));
- gotoKuneDevSite.putValue(Action.SMALL_ICON, icons.kuneIcon16());
wavePowered.putValue(Action.NAME, i18n.t("Apache Wave powered"));
wavePowered.putValue(Action.SMALL_ICON, res.waveIcon());
@@ -176,18 +169,20 @@
// aboutAction.setShortcut(shortcut);
// shortcutReg.put(shortcut, aboutAction);
- right.add(signInLink.get());
- right.add(signOutLink.get());
- right.add(separator2);
- right.add(newGroupLink.get());
- right.add(separator);
- right.add(OPTIONS_MENU);
- right.add(gotoKuneDevSite);
- right.add(reportBugs);
- right.add(new MenuItemDescriptor(OPTIONS_MENU, errorAction));
- right.add(new MenuItemDescriptor(OPTIONS_MENU, aboutAction));
- right.add(menuSeparator);
- right.add(new MenuItemDescriptor(OPTIONS_MENU, wavePowered));
+ signInLink.get();
+ signOutLink.get();
+ new ToolbarSeparatorDescriptor(Type.separator, RIGHT_TOOLBAR);
+ newGroupLink.get();
+ new ToolbarSeparatorDescriptor(Type.separator, RIGHT_TOOLBAR);
+ createGotoKune();
+ MenuItemDescriptor.build(OPTIONS_MENU, bugsAction);
+ MenuItemDescriptor.build(OPTIONS_MENU, errorAction);
+ MenuItemDescriptor.build(OPTIONS_MENU, aboutAction);
+ MenuSeparatorDescriptor.build(OPTIONS_MENU);
+ MenuItemDescriptor.build(OPTIONS_MENU, wavePowered);
+ OPTIONS_MENU.setParent(RIGHT_TOOLBAR);
+ getView().getLeftBar().add(LEFT_TOOLBAR);
+ getView().getRightBar().add(RIGHT_TOOLBAR);
}
@Override
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -31,28 +31,28 @@
public class SitebarNewGroupLink extends ButtonDescriptor {
- public static class SitebarNewGroupAction extends AbstractExtendedAction {
+ public static class SitebarNewGroupAction extends AbstractExtendedAction {
- private final StateManager stateManager;
+ private final StateManager stateManager;
- @Inject
- public SitebarNewGroupAction(final StateManager stateManager, final I18nTranslationService i18n) {
- super();
- this.stateManager = stateManager;
- putValue(Action.NAME, i18n.t("Create New Group"));
- }
+ @Inject
+ public SitebarNewGroupAction(final StateManager stateManager, final I18nTranslationService i18n) {
+ super();
+ this.stateManager = stateManager;
+ putValue(Action.NAME, i18n.t("Create New Group"));
+ }
- @Override
- public void actionPerformed(final ActionEvent event) {
- stateManager.gotoHistoryTokenButRedirectToCurrent(SiteTokens.NEWGROUP);
- }
-
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ stateManager.gotoHistoryTokenButRedirectToCurrent(SiteTokens.NEWGROUP);
}
- @Inject
- public SitebarNewGroupLink(final SitebarNewGroupAction action) {
- super(action);
- setStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
- setParent(SitebarActionsPresenter.RIGHT_TOOLBAR);
- }
+ }
+
+ @Inject
+ public SitebarNewGroupLink(final SitebarNewGroupAction action, final SitebarActions sitebarActions) {
+ super(action);
+ setStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
+ setParent(sitebarActions.getRightToolbar());
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -37,45 +37,46 @@
public class SitebarSignInLink extends ButtonDescriptor {
- public static class SitebarSignInAction extends AbstractExtendedAction {
+ public static class SitebarSignInAction extends AbstractExtendedAction {
- private final StateManager stateManager;
+ private final StateManager stateManager;
- @Inject
- public SitebarSignInAction(final StateManager stateManager, final I18nTranslationService i18n) {
- super();
- this.stateManager = stateManager;
- putValue(Action.NAME, i18n.t("Sign in to collaborate"));
- }
+ @Inject
+ public SitebarSignInAction(final StateManager stateManager, final I18nTranslationService i18n) {
+ super();
+ this.stateManager = stateManager;
+ putValue(Action.NAME, i18n.t("Sign in to collaborate"));
+ }
- @Override
- public void actionPerformed(final ActionEvent event) {
- stateManager.gotoHistoryTokenButRedirectToCurrent(SiteTokens.SIGNIN);
- }
-
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ stateManager.gotoHistoryTokenButRedirectToCurrent(SiteTokens.SIGNIN);
}
- public static final String SITE_SIGN_IN = "kune-ssilp-hy";
+ }
- @Inject
- public SitebarSignInLink(final SitebarSignInAction action, final EventBus eventBus, final Session session) {
- super(action);
- // setParent(SitebarActionsPresenter.RIGHT_TOOLBAR);
- setId(SITE_SIGN_IN);
- setVisible(!session.isLogged());
- setStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
- setParent(SitebarActionsPresenter.RIGHT_TOOLBAR);
- session.onUserSignIn(true, new UserSignInHandler() {
- @Override
- public void onUserSignIn(final UserSignInEvent event) {
- SitebarSignInLink.this.setVisible(false);
- }
- });
- session.onUserSignOut(true, new UserSignOutHandler() {
- @Override
- public void onUserSignOut(final UserSignOutEvent event) {
- SitebarSignInLink.this.setVisible(true);
- }
- });
- }
+ public static final String SITE_SIGN_IN = "kune-ssilp-hy";
+
+ @Inject
+ public SitebarSignInLink(final SitebarSignInAction action, final EventBus eventBus,
+ final Session session, final SitebarActions sitebarActions) {
+ super(action);
+ // setParent(SitebarActionsPresenter.RIGHT_TOOLBAR);
+ setId(SITE_SIGN_IN);
+ setVisible(!session.isLogged());
+ setStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
+ setParent(sitebarActions.getRightToolbar());
+ session.onUserSignIn(true, new UserSignInHandler() {
+ @Override
+ public void onUserSignIn(final UserSignInEvent event) {
+ SitebarSignInLink.this.setVisible(false);
+ }
+ });
+ session.onUserSignOut(true, new UserSignOutHandler() {
+ @Override
+ public void onUserSignOut(final UserSignOutEvent event) {
+ SitebarSignInLink.this.setVisible(true);
+ }
+ });
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignOutLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignOutLink.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignOutLink.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -123,10 +123,10 @@
@Inject
public SitebarSignOutLink(final SitebarSignOutAction action, final EventBus eventBus,
- final ErrorHandler errorHandler, final Session session) {
+ final ErrorHandler errorHandler, final Session session, final SitebarActions sitebarActions) {
super(action);
setId(SITE_SIGN_OUT);
- setParent(SitebarActionsPresenter.RIGHT_TOOLBAR);
+ setParent(sitebarActions.getRightToolbar());
setVisible(session.isLogged());
setStyles("k-no-backimage, k-btn-sitebar, k-fl, k-noborder, k-nobackcolor");
session.onUserSignIn(true, new UserSignInHandler() {
Modified: trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sn/AbstractSNPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -149,7 +149,7 @@
item.setParent(menu);
}
actions.add(menu);
- actions.add(menuitems);
+ // (Not needed after setParent Recursive) actions.add(menuitems);
}
thumb.hideTooltip();
menu.show(thumb);
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -69,7 +69,6 @@
final IsGroupCondition isGroupCondition, final UnJoinFromCurrentGroupAction unJoinGroupAction) {
OPTIONS_MENU.withToolTip(i18n.t("Options")).withIcon(res.arrowdownsitebar()).withStyles(
OPTIONS_STYLES);
- final GuiActionDescrip optionsTitle = new MenuTitleItemDescriptor(i18n.t("Options")).withParent(OPTIONS_MENU);
final MenuRadioItemDescriptor anyoneItem = membersVisibility.get().withVisibility(
SocialNetworkVisibility.anyone);
final MenuRadioItemDescriptor onlyMembersItem = membersVisibility.get().withVisibility(
@@ -83,17 +82,17 @@
final MenuRadioItemDescriptor openItem = membersModeration.get().withModeration(AdmissionType.Open);
addImpl(OPTIONS_MENU);
- addImpl(optionsTitle);
- addImpl(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(
- OPTIONS_MENU));
- addImpl(MODERATION_SUBMENU.withText(i18n.t("New members policy")).withParent(OPTIONS_MENU));
- addImpl(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
- addImpl(onlyMembersItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only members")));
- addImpl(onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins")));
- addImpl(moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join")));
- addImpl(openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join")));
- addImpl(closedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("closed for new members")));
+ new MenuTitleItemDescriptor(i18n.t("Options")).withParent(OPTIONS_MENU);
+ VISIBILITY_SUBMENU.withText(i18n.t("Those who can view this member list")).withParent(OPTIONS_MENU);
+ MODERATION_SUBMENU.withText(i18n.t("New members policy")).withParent(OPTIONS_MENU);
+ anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone"));
+ onlyMembersItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only members"));
+ onlyAdminsItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only admins"));
+ moderatedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("moderate request to join"));
+ openItem.withParent(MODERATION_SUBMENU).withText(i18n.t("auto accept request to join"));
+ closedItem.withParent(MODERATION_SUBMENU).withText(i18n.t("closed for new members"));
+
final ButtonDescriptor joinBtn = new ButtonDescriptor(joinGroupAction);
final ButtonDescriptor unJoinBtn = new ButtonDescriptor(unJoinGroupAction);
// unJoinBtn.add(isLoggedCondition);
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNConfActions.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -69,11 +69,10 @@
assert anyoneItem.getAction() != onlyYourBuddiesItem.getAction();
assert anyoneItem.getAction() != onlyYou.getAction();
addImpl(OPTIONS_MENU);
- addImpl(VISIBILITY_SUBMENU.withText(i18n.t("Those who can view your network")).withParent(
- OPTIONS_MENU));
- addImpl(anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone")));
- addImpl(onlyYourBuddiesItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only your buddies")));
- addImpl(onlyYou.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only you")));
+ VISIBILITY_SUBMENU.withText(i18n.t("Those who can view your network")).withParent(OPTIONS_MENU);
+ anyoneItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("anyone"));
+ onlyYourBuddiesItem.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only your buddies"));
+ onlyYou.withParent(VISIBILITY_SUBMENU).withText(i18n.t("only you"));
final ButtonDescriptor addBuddieBtn = new ButtonDescriptor(addNewBuddiesAction);
Copied: trunk/src/main/java/cc/kune/core/public/images/alert.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/alert.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/arrow-down-black.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-down-black.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/arrow-down-white.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-down-white.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/arrow-right-black.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-right-black.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/arrow-right-white.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-right-white.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/colors.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/colors.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/copyleft.png (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/copyleft.png)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/emblem-system.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/emblem-system.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/film.png (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/film.png)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/info.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/info.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/language.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/language.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/link.gif (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/link.gif)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/picture.png (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/picture.png)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/specialchars.png (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/specialchars.png)
===================================================================
(Binary files differ)
Copied: trunk/src/main/java/cc/kune/core/public/images/splitter-vert-bar.png (from rev 1445, trunk/src/main/java/org/ourproject/kune/app/public/css/img/splitter-vert-bar.png)
===================================================================
(Binary files differ)
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1431,4 +1431,41 @@
button.k-drop-allowed-hover,
.k-drop-allowed-hover {
border: dashed 2px #3a9fd6 !important;
-}
\ No newline at end of file
+}
+
+.k-link-icon {
+ background-image: url(images/link.gif) !important;
+}
+
+.k-options-icon {
+ background-image: url(images/emblem-system.gif) !important;
+}
+
+.k-copyleft-icon {
+ background-image: url(images/copyleft.png) !important;
+}
+
+.k-picture-icon {
+ background-image: url(images/picture.png) !important;
+}
+
+.k-film-icon {
+ background-image: url(images/film.png) !important;
+}
+
+.k-specialchars-icon {
+ background-image: url(images/specialchars.png) !important;
+}
+
+.k-info-icon {
+ background-image: url(images/info.gif) !important;
+}
+
+.k-newgroup-icon {
+ background-image: url(images/kune-icon16.png) !important;
+}
+
+.k-colors-icon {
+ background-image: url(images/colors.gif) !important;
+}
+
Modified: trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/docs/client/DocsGinModule.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -31,5 +31,4 @@
s(DocsClientActions.class);
s(DocsFolderNewMenu.class);
}
-
}
Modified: trunk/src/main/java/cc/kune/docs/client/actions/GoParentFolderBtn.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/actions/GoParentFolderBtn.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/docs/client/actions/GoParentFolderBtn.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -27,9 +27,10 @@
public class GoParentFolderBtn extends GoParentContainerBtn {
- @Inject
- public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action, final CoreResources res) {
- super(i18n, action, res);
- }
+ @Inject
+ public GoParentFolderBtn(final I18nTranslationService i18n, final GoParentContainerAction action,
+ final CoreResources res) {
+ super(i18n, action, res);
+ }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceGinModule.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -24,6 +24,10 @@
import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
import cc.kune.gspace.client.actions.ContentViewerOptionsMenu;
import cc.kune.gspace.client.actions.RenameAction;
+import cc.kune.gspace.client.i18n.I18nNewTranslatorPanel;
+import cc.kune.gspace.client.i18n.I18nNewTranslatorPresenter;
+import cc.kune.gspace.client.i18n.I18nNewTranslatorPresenter.I18nNewTranslatorView;
+import cc.kune.gspace.client.i18n.SiteOptionsI18nTranslatorAction;
import cc.kune.gspace.client.licensewizard.LicenseChangeAction;
import cc.kune.gspace.client.licensewizard.LicenseWizard;
import cc.kune.gspace.client.licensewizard.LicenseWizardPanel;
@@ -169,5 +173,10 @@
s(LicenseWizardTrdFormView.class, LicenseWizardTrdForm.class);
s(LicenseWizardFrdFormView.class, LicenseWizardFrdForm.class);
s(LicenseChangeAction.class);
+
+ // I18nTranslator
+ s(I18nNewTranslatorView.class, I18nNewTranslatorPanel.class);
+ s(I18nNewTranslatorPresenter.class);
+ s(SiteOptionsI18nTranslatorAction.class);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -23,6 +23,7 @@
import cc.kune.core.client.init.AppStartEvent.AppStartHandler;
import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
import cc.kune.core.client.state.Session;
+import cc.kune.gspace.client.i18n.SiteOptionsI18nTranslatorAction;
import cc.kune.gspace.client.options.GroupOptions;
import cc.kune.gspace.client.options.GroupOptionsCollection;
import cc.kune.gspace.client.options.UserOptions;
@@ -59,7 +60,8 @@
final Provider<GroupOptStyle> gps, final Provider<GroupOptLogo> gl,
final Provider<GroupOptTools> gtc, final Provider<UserOptDefLicense> udl,
final Provider<UserOptStyle> ups, final Provider<UserOptLogo> ul,
- final Provider<UserOptTools> utc, final Provider<SitebarSearchPresenter> siteSearch) {
+ final Provider<UserOptTools> utc, final Provider<SitebarSearchPresenter> siteSearch,
+ final Provider<SiteOptionsI18nTranslatorAction> transAction) {
session.onAppStart(true, new AppStartHandler() {
@Override
@@ -85,6 +87,9 @@
// Init
go.get();
uo.get();
+
+ // i18n
+ transAction.get();
}
});
}
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContainerMenuItem.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -93,7 +93,7 @@
final ImageResource icon, final String title, final String tooltip, final String newName,
final String id, final @Nonnull MenuDescriptor parent) {
super(action);
- setParent(parent);
+ setParent(parent, false);
// The name given to this new content
action.putValue(NEW_NAME, newName);
action.putValue(ID, id);
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/NewContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/NewContentMenuItem.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/NewContentMenuItem.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -93,7 +93,7 @@
public NewContentMenuItem(final I18nTranslationService i18n, final NewContentAction action,
final ImageResource icon, final GlobalShortcutRegister shorcutReg, final String title,
final String tooltip, final String newName, final String id, @Nonnull final MenuDescriptor parent) {
- super(parent, action);
+ super(parent, false, action);
// The name given to this new content
action.putValue(NEW_NAME, newName);
action.putValue(ID, id);
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/RefreshContentMenuItem.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -30,27 +30,27 @@
public class RefreshContentMenuItem extends MenuItemDescriptor {
- public static class GoParentContainerAction extends AbstractExtendedAction {
+ public static class GoParentContainerAction extends AbstractExtendedAction {
- private final StateManager stateManager;
+ private final StateManager stateManager;
- @Inject
- public GoParentContainerAction(final StateManager stateManager) {
- this.stateManager = stateManager;
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- stateManager.refreshCurrentStateWithoutCache();
- }
-
+ @Inject
+ public GoParentContainerAction(final StateManager stateManager) {
+ this.stateManager = stateManager;
}
- @Inject
- public RefreshContentMenuItem(final I18nTranslationService i18n, final GoParentContainerAction action,
- final ContentViewerOptionsMenu optionsMenu, final NavResources res) {
- super(action);
- this.withText(i18n.t("Reload current page")).withIcon(res.refresh()).withParent(optionsMenu);
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ stateManager.refreshCurrentStateWithoutCache();
}
+ }
+
+ @Inject
+ public RefreshContentMenuItem(final I18nTranslationService i18n, final GoParentContainerAction action,
+ final ContentViewerOptionsMenu optionsMenu, final NavResources res) {
+ super(action);
+ this.withText(i18n.t("Reload current page")).withIcon(res.refresh()).withParent(optionsMenu, false);
+ }
+
}
Added: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPanel.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,33 @@
+package cc.kune.gspace.client.i18n;
+
+
+import cc.kune.common.client.notify.NotifyLevelImages;
+import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogPanel;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.i18n.I18nNewTranslatorPresenter.I18nNewTranslatorView;
+
+import com.google.inject.Inject;
+
+public class I18nNewTranslatorPanel extends AbstractTabbedDialogPanel implements I18nNewTranslatorView {
+
+ private static final int HEIGHT = 400;
+ private static final String TRANSLATOR_ERROR_ID = "i18n-trans-panel-error";
+ private static final String TRANSLATOR_PANEL_ID = "i18n-trans-panel";
+ private static final int WIDTH = 270;
+
+ @Inject
+ public I18nNewTranslatorPanel(final I18nTranslationService i18n, final NotifyLevelImages images,
+ final TranslatorTabsCollection transGroup) {
+ super(TRANSLATOR_PANEL_ID, "", WIDTH, HEIGHT + 80, false, images, TRANSLATOR_ERROR_ID,
+ i18n.t("Close"), null, null, null, transGroup);
+ super.setIconCls("k-options-icon");
+ super.setTitle(i18n.t("Help to translate kune"));
+ }
+
+ @Override
+ public void hideTranslatorAndIcon() {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPresenter.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,37 @@
+package cc.kune.gspace.client.i18n;
+
+
+import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialog;
+import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter;
+
+import com.google.inject.Inject;
+
+public class I18nNewTranslatorPresenter extends AbstractTabbedDialogPresenter implements
+ AbstractTabbedDialog, I18nTranslator {
+
+ public interface I18nNewTranslatorView extends AbstractTabbedDialogView {
+
+ @Override
+ void hide();
+
+ void hideTranslatorAndIcon();
+
+ @Override
+ void show();
+ }
+ private I18nNewTranslatorView view;
+
+ @Inject
+ public I18nNewTranslatorPresenter() {
+ }
+
+ @Override
+ public void doShowTranslator() {
+ view.show();
+ }
+
+ public void init(final I18nNewTranslatorView view) {
+ super.init(view);
+ this.view = view;
+ }
+}
Copied: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslator.java (from rev 1445, trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslator.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslator.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.gspace.client.i18n;
+
+public interface I18nTranslator {
+
+ void doShowTranslator();
+
+}
Copied: trunk/src/main/java/cc/kune/gspace/client/i18n/LanguageSelectorPanel.java (from rev 1445, trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/LanguageSelectorPanel.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/LanguageSelectorPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,141 @@
+/*
+ *
+ * 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.gspace.client.i18n;
+
+import cc.kune.common.client.utils.SimpleCallback;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.dto.I18nLanguageSimpleDTO;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.extjs.gxt.ui.client.data.BaseModel;
+import com.extjs.gxt.ui.client.event.BaseEvent;
+import com.extjs.gxt.ui.client.event.Events;
+import com.extjs.gxt.ui.client.event.Listener;
+import com.extjs.gxt.ui.client.store.ListStore;
+import com.extjs.gxt.ui.client.widget.form.ComboBox;
+import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
+import com.extjs.gxt.ui.client.widget.form.FormPanel;
+import com.google.inject.Inject;
+
+public class LanguageSelectorPanel extends FormPanel {
+
+ @SuppressWarnings("serial")
+ public class LanguageData extends BaseModel {
+
+ private static final String CODE = "code";
+ private static final String ENGLISH_NAME = "englishName";
+
+ public LanguageData(final String code, final String englishName) {
+ set(CODE, code);
+ set(ENGLISH_NAME, englishName);
+ }
+
+ public String getCode() {
+ return get(CODE);
+ }
+
+ public String getEnglishName() {
+ return get(ENGLISH_NAME);
+ }
+ }
+
+ public static final String LANG_FIELD = "k-langsp-lf";
+
+ private final I18nTranslationService i18n;
+ private ComboBox<LanguageData> langCombo;
+ private final Session session;
+
+ @Inject
+ public LanguageSelectorPanel(final I18nTranslationService i18n, final Session session) {
+ super();
+ this.i18n = i18n;
+ this.session = session;
+ setBorders(false);
+ createLangCombo();
+ super.add(langCombo);
+ }
+
+ public void addChangeListener(final SimpleCallback onChange) {
+ langCombo.addListener(Events.Select, new Listener<BaseEvent>() {
+ @Override
+ public void handleEvent(final BaseEvent be) {
+ onChange.onCallback();
+ }
+ });
+ }
+
+ private void createLangCombo() {
+ // Field.setMsgTarget("side");
+ langCombo = new ComboBox<LanguageData>();
+ langCombo.setName(LANG_FIELD);
+ langCombo.setMinChars(1);
+ // langCombo.setMode(ComboBox.LOCAL);
+ langCombo.setStore(createStore());
+ langCombo.setDisplayField("language");
+ langCombo.setTriggerAction(TriggerAction.ALL);
+ langCombo.setEmptyText(i18n.t("Enter language"));
+ langCombo.setLoadingText(i18n.t("Searching..."));
+ langCombo.setDisplayField(LanguageData.ENGLISH_NAME);
+ langCombo.setValueField(LanguageData.CODE);
+ langCombo.setTypeAhead(true);
+ langCombo.setTypeAheadDelay(1000);
+ langCombo.setSelectOnFocus(false);
+ langCombo.setWidth(140);
+ langCombo.setPageSize(7);
+ langCombo.setForceSelection(true);
+ langCombo.setAllowBlank(false);
+ }
+
+ private ListStore<LanguageData> createStore() {
+ final ListStore<LanguageData> list = new ListStore<LanguageData>();
+
+ for (final I18nLanguageSimpleDTO lang : session.getLanguages()) {
+ list.add(new LanguageData(lang.getCode(), lang.getEnglishName()));
+ }
+ return list;
+ }
+
+ public String getLanguageCode() {
+ return langCombo.getValue().getCode();
+ }
+
+ public String getLanguageEnglishName() {
+ return langCombo.getValue().getEnglishName();
+ }
+
+ @Override
+ public void reset() {
+ langCombo.reset();
+ }
+
+ public void setLangTitle(final String langFieldTitle) {
+ if (langFieldTitle == null) {
+ setHideLabels(true);
+ } else {
+ if (langFieldTitle != null) {
+ langCombo.setFieldLabel(langFieldTitle);
+ }
+ }
+ }
+
+ public void setLanguage(final String languageCode) {
+ langCombo.setRawValue(languageCode);
+ }
+}
Copied: trunk/src/main/java/cc/kune/gspace/client/i18n/SiteOptionsI18nTranslatorAction.java (from rev 1445, trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java)
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/SiteOptionsI18nTranslatorAction.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/SiteOptionsI18nTranslatorAction.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,62 @@
+/*
+ *
+ * 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.gspace.client.i18n;
+
+import cc.kune.common.client.actions.AbstractExtendedAction;
+import cc.kune.common.client.actions.Action;
+import cc.kune.common.client.actions.ActionEvent;
+import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
+import cc.kune.core.client.resources.CoreResources;
+import cc.kune.core.client.sitebar.SitebarActionsPresenter;
+import cc.kune.core.shared.i18n.I18nTranslationService;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class SiteOptionsI18nTranslatorAction extends AbstractExtendedAction {
+ private I18nTranslator translator;
+ private final Provider<I18nNewTranslatorPanel> translatorPanel;
+ private final Provider<I18nNewTranslatorPresenter> translatorPresenter;
+
+ @Inject
+ public SiteOptionsI18nTranslatorAction(final I18nTranslationService i18n, final CoreResources img,
+ final Provider<I18nNewTranslatorPresenter> translatorPresenter,
+ final Provider<I18nNewTranslatorPanel> translatorPanel, final SitebarActionsPresenter siteOptions) {
+ super();
+ this.translatorPresenter = translatorPresenter;
+ this.translatorPanel = translatorPanel;
+ putValue(Action.NAME, i18n.t("Help with the translation"));
+ putValue(Action.SMALL_ICON, img.language());
+ final MenuItemDescriptor item = new MenuItemDescriptor(siteOptions.getOptionsMenu(), this);
+ // item.setPosition(1);
+ }
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ if (translator == null) {
+ final I18nNewTranslatorPresenter presenter = translatorPresenter.get();
+ presenter.init(translatorPanel.get());
+ translator = presenter;
+ }
+ translator.doShowTranslator();
+ }
+}
Added: trunk/src/main/java/cc/kune/gspace/client/i18n/TranslatorTabsCollection.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/TranslatorTabsCollection.java (rev 0)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/TranslatorTabsCollection.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.gspace.client.i18n;
+
+import cc.kune.common.client.ProvidersCollection;
+
+import com.google.inject.Singleton;
+
+ at SuppressWarnings("serial")
+ at Singleton
+public class TranslatorTabsCollection extends ProvidersCollection {
+}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/EntityOptions.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/EntityOptions.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/options/EntityOptions.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -19,22 +19,12 @@
*/
package cc.kune.gspace.client.options;
-import cc.kune.common.client.notify.NotifyLevel;
import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialog;
import com.google.gwt.user.client.ui.IsWidget;
public interface EntityOptions extends AbstractTabbedDialog {
- public IsWidget getView();
+ public IsWidget getView();
- @Override
- public void hideMessages();
-
- @Override
- public void setErrorMessage(String message, NotifyLevel level);
-
- @Override
- public void show();
-
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/EntityOptionsView.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/EntityOptionsView.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/options/EntityOptionsView.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -19,7 +19,7 @@
*/
package cc.kune.gspace.client.options;
-import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogView;
+import cc.kune.common.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter.AbstractTabbedDialogView;
public interface EntityOptionsView extends AbstractTabbedDialogView {
Modified: trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -26,9 +26,6 @@
import cc.kune.core.client.ws.entheader.EntityHeader;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
public class GroupOptionsPanel extends AbstractTabbedDialogPanel implements GroupOptionsView {
@@ -36,15 +33,13 @@
public static final String GROUP_OP_PANEL_ID = "k-gop-diagpan";
public static final String GROUP_OPTIONS_ERROR_ID = "k-gop-err-mess";
private final EntityHeader entityHeader;
- private final GroupOptionsCollection entityPreferencesGroup;
@Inject
public GroupOptionsPanel(final EntityHeader entityHeader, final I18nTranslationService i18n,
final NotifyLevelImages images, final GroupOptionsCollection entityOptionsGroup) {
super(GROUP_OP_PANEL_ID, "", WIDTH, HEIGHT + 80, false, images, GROUP_OPTIONS_ERROR_ID,
- i18n.t("Close"), null, null, null);
+ i18n.t("Close"), null, null, null, entityOptionsGroup);
this.entityHeader = entityHeader;
- this.entityPreferencesGroup = entityOptionsGroup;
super.setIconCls("k-options-icon");
super.setTitle(i18n.t(CoreMessages.GROUP_OPTIONS_DIALOG_TITLE));
}
@@ -54,24 +49,4 @@
entityHeader.addAction(descriptor);
}
- @Override
- public Widget asWidget() {
- return super.getWidget();
- }
-
- @Override
- public void createAndShow() {
- createAndShowItImpl();
- }
-
- private void createAndShowItImpl() {
- super.getFirstBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- hide();
- }
- });
- entityPreferencesGroup.createAll();
- super.createAndShow();
- }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -25,9 +25,7 @@
import cc.kune.core.client.ws.entheader.EntityHeader;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.event.shared.HandlerRegistration;
import com.google.inject.Inject;
public class UserOptionsPanel extends AbstractTabbedDialogPanel implements UserOptionsView {
@@ -35,36 +33,17 @@
public static final String USER_OP_PANEL_ID = "k-uop-diagpan";
public static final String USER_OPTIONS_ERROR_ID = "k-uop-err-mess";
+ private HandlerRegistration addClickHandler;
private final UserOptionsCollection userPreferencesGroup;
@Inject
public UserOptionsPanel(final EntityHeader entityHeader, final I18nTranslationService i18n,
final NotifyLevelImages images, final UserOptionsCollection userOptionsGroup) {
super(USER_OP_PANEL_ID, "", WIDTH, HEIGHT + 80, false, images, USER_OPTIONS_ERROR_ID,
- i18n.t("Close"), null, null, null);
+ i18n.t("Close"), null, null, null, userOptionsGroup);
this.userPreferencesGroup = userOptionsGroup;
super.setIconCls("k-options-icon");
super.setTitle(i18n.t(CoreMessages.USER_OPTIONS_DIALOG_TITLE));
}
- @Override
- public Widget asWidget() {
- return super.getWidget();
- }
-
- @Override
- public void createAndShow() {
- createAndShowItImpl();
- }
-
- private void createAndShowItImpl() {
- super.getFirstBtn().addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent event) {
- hide();
- }
- });
- userPreferencesGroup.createAll();
- super.createAndShow();
- }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -61,7 +61,9 @@
init(view);
}
- private void createActions() {
+ private void init(final UserOptionsView view) {
+ super.init(view);
+ this.view = view;
final AbstractExtendedAction userPrefsAction = new AbstractExtendedAction() {
@Override
@@ -78,10 +80,4 @@
prefsItem.setPosition(1);
userOptions.addAction(prefsItem);
}
-
- private void init(final UserOptionsView view) {
- super.init(view);
- this.view = view;
- createActions();
- }
}
Modified: trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/cc/kune/gspace/client/viewers/ContentViewerPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -22,6 +22,8 @@
import javax.annotation.Nonnull;
import cc.kune.common.client.actions.ui.descrip.GuiActionDescCollection;
+import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
+import cc.kune.common.client.actions.ui.descrip.HasChilds;
import cc.kune.common.client.errors.UIException;
import cc.kune.common.client.ui.EditEvent;
import cc.kune.common.client.ui.EditEvent.EditHandler;
@@ -188,6 +190,14 @@
}
final GuiActionDescCollection actions = actionsRegistry.getCurrentActions(stateContent.getGroup(),
stateContent.getTypeId(), session.isLogged(), rights, ActionGroups.TOOLBAR);
- getView().setActions(actions);
+ final GuiActionDescCollection actionsToAttach = new GuiActionDescCollection();
+ for (final GuiActionDescrip action : actions) {
+ // The previous actionsRegistry creates childs actions already via
+ // Provider.get()
+ if (action instanceof HasChilds) {
+ actionsToAttach.add(action);
+ }
+ }
+ getView().setActions(actionsToAttach);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/com/example/client/HelloWorldActions.java
===================================================================
--- trunk/src/main/java/com/example/client/HelloWorldActions.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/com/example/client/HelloWorldActions.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -13,45 +13,44 @@
public class HelloWorldActions {
- public class HelloWorldAction extends AbstractExtendedAction {
+ public class HelloWorldAction extends AbstractExtendedAction {
- @Override
- public void actionPerformed(final ActionEvent event) {
- NotifyUser.info("Hello world!");
- }
-
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ NotifyUser.info("Hello world!");
}
- @Inject
- public HelloWorldActions(final CoreResources coreResources, final SitebarActions sitebarActions,
- final SiteUserOptions siteUserOptions) {
+ }
- // We can share the action if we don't want to create several (and for
- // instance it doesn't store any value)
- final HelloWorldAction sharedAction = new HelloWorldAction();
+ @Inject
+ public HelloWorldActions(final CoreResources coreResources, final SitebarActions sitebarActions,
+ final SiteUserOptions siteUserOptions) {
- // An action in the sitebar
- final ButtonDescriptor siteBarBtn = new ButtonDescriptor(sharedAction);
- siteBarBtn.withText("HWorld!").withIcon(coreResources.info());
- // FIXME setParent as in siteUsOp
- sitebarActions.getLeftToolbar().add(siteBarBtn);
+ // We can share the action if we don't want to create several (and for
+ // instance it doesn't store any value)
+ final HelloWorldAction sharedAction = new HelloWorldAction();
- // Other action in the sitebar options menu
+ // An action in the sitebar
+ final ButtonDescriptor siteBarBtn = new ButtonDescriptor(sharedAction);
+ siteBarBtn.withText("HWorld!").withIcon(coreResources.info());
+ siteBarBtn.setParent(sitebarActions.getLeftToolbar());
- // An action in the user options menu
- final MenuItemDescriptor menuItem = new MenuItemDescriptor(sharedAction);
- menuItem.withText("HWorld!").withIcon(coreResources.alert());
- siteUserOptions.addAction(menuItem);
+ // Other action in the sitebar options menu
- // Another action in the SocialNet menu
+ // An action in the user options menu
+ final MenuItemDescriptor menuItem = new MenuItemDescriptor(sharedAction);
+ menuItem.withText("HWorld!").withIcon(coreResources.alert());
+ siteUserOptions.addAction(menuItem);
- // Something added directly in the Skeleton (esto en el Panel)
+ // Another action in the SocialNet menu
- // IMPORTANT: If you want to add something in a part a don't find how,
- // please ask! Maybe we need a extension point or we need to document
- // better
+ // Something added directly in the Skeleton (esto en el Panel)
- // Do something with Chat
+ // IMPORTANT: If you want to add something in a part a don't find how,
+ // please ask! Maybe we need a extension point or we need to document
+ // better
- }
+ // Do something with Chat
+
+ }
}
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/alert.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-down-black.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-down-white.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-right-black.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/arrow-right-white.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/colors.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/copyleft.png
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/emblem-system.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/film.png
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/info.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/language.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/link.gif
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/picture.png
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/specialchars.png
===================================================================
(Binary files differ)
Deleted: trunk/src/main/java/org/ourproject/kune/app/public/css/img/splitter-vert-bar.png
===================================================================
(Binary files differ)
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -19,67 +19,129 @@
*/
package org.ourproject.kune.platf.client.ui;
+import java.util.Map;
import cc.kune.core.shared.i18n.I18nTranslationService;
-import com.gwtext.client.core.Connection;
-import com.gwtext.client.core.UrlParam;
-import com.gwtext.client.data.FieldDef;
-import com.gwtext.client.data.HttpProxy;
-import com.gwtext.client.data.JsonReader;
-import com.gwtext.client.data.RecordDef;
-import com.gwtext.client.data.Store;
-import com.gwtext.client.widgets.PagingToolbar;
-import com.gwtext.client.widgets.grid.GridPanel;
-import com.gwtext.client.widgets.grid.RowSelectionModel;
+import com.extjs.gxt.ui.client.data.BaseListLoader;
+import com.extjs.gxt.ui.client.data.BasePagingLoadConfig;
+import com.extjs.gxt.ui.client.data.HttpProxy;
+import com.extjs.gxt.ui.client.data.JsonLoadResultReader;
+import com.extjs.gxt.ui.client.data.ListLoadResult;
+import com.extjs.gxt.ui.client.data.ModelData;
+import com.extjs.gxt.ui.client.data.ModelType;
+import com.extjs.gxt.ui.client.data.PagingLoadConfig;
+import com.extjs.gxt.ui.client.event.Events;
+import com.extjs.gxt.ui.client.event.GridEvent;
+import com.extjs.gxt.ui.client.event.Listener;
+import com.extjs.gxt.ui.client.store.ListStore;
+import com.extjs.gxt.ui.client.store.Store;
+import com.extjs.gxt.ui.client.store.StoreFilter;
+import com.extjs.gxt.ui.client.widget.grid.Grid;
+import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
+import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar;
+import com.extjs.gxt.ui.client.widget.toolbar.PagingToolBar.PagingToolBarMessages;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.http.client.RequestBuilder;
public class AbstractSearcherPanel {
- protected static final int PAGINATION_SIZE = 10;
- protected final I18nTranslationService i18n;
+ protected static final int PAGINATION_SIZE = 10;
+ protected final I18nTranslationService i18n;
- public AbstractSearcherPanel(final I18nTranslationService i18n) {
- this.i18n = i18n;
- }
+ public AbstractSearcherPanel(final I18nTranslationService i18n) {
+ this.i18n = i18n;
+ }
- protected void createPagingToolbar(final Store store, final GridPanel grid) {
- final PagingToolbar pag = new PagingToolbar(store);
- pag.setPageSize(PAGINATION_SIZE);
- pag.setDisplayInfo(true);
- pag.setDisplayMsg(i18n.tWithNT("Displaying results {0} - {1} of {2}", "Respect {} values in translations. "
- + "This will produce: 'Displaying results 1 - 25 of 95465' for instance"));
- pag.setEmptyMsg(i18n.t("No results to display"));
- pag.setAfterPageText(i18n.tWithNT("of {0}", "Used to show multiple results: '1 of 30'"));
- pag.setBeforePageText(i18n.t("Page"));
- pag.setFirstText(i18n.t("First Page"));
- pag.setLastText(i18n.t("Last Page"));
- pag.setNextText(i18n.t("Next Page"));
- pag.setPrevText(i18n.t("Previous Page"));
- pag.setRefreshText(i18n.t("Refresh"));
- grid.setBottomToolbar(pag);
- grid.setLoadMask(true);
- grid.setLoadMask(i18n.t("Searching"));
- grid.setSelectionModel(new RowSelectionModel());
- grid.setBorder(false);
- grid.setFrame(true);
- grid.setStripeRows(true);
- }
+ protected void createPagingToolbar(final Store store, final Grid grid) {
+ final PagingToolBar pag = new PagingToolBar(PAGINATION_SIZE);
+ final PagingToolBarMessages msgs = new PagingToolBarMessages();
- protected Store createStore(final FieldDef[] fieldDefs, final String url, final String id) {
- final JsonReader reader = new JsonReader(new RecordDef(fieldDefs));
- reader.setRoot("list");
- reader.setTotalProperty("size");
- reader.setId(id);
- final HttpProxy proxy = new HttpProxy(url, Connection.POST);
- return new Store(proxy, reader, true);
- }
+ msgs.setDisplayMsg(i18n.tWithNT("Displaying results {0} - {1} of {2}",
+ "Respect {} values in translations. "
+ + "This will produce: 'Displaying results 1 - 25 of 95465' for instance"));
+ msgs.setEmptyMsg(i18n.t("No results to display"));
+ msgs.setFirstText(i18n.t("First Page"));
+ msgs.setAfterPageText(i18n.tWithNT("of {0}", "Used to show multiple results: '1 of 30'"));
+ msgs.setBeforePageText(i18n.t("Page"));
+ msgs.setLastText(i18n.t("Last Page"));
+ msgs.setNextText(i18n.t("Next Page"));
+ msgs.setPrevText(i18n.t("Previous Page"));
+ msgs.setRefreshText(i18n.t("Refresh"));
+ pag.setMessages(msgs);
+ // pag.setStore(store);
+ // pag.setDisplayInfo(true);
+ // grid.setBottomToolbar(pag);
+ grid.setLoadMask(true);
+ // grid.setLoadMask(i18n.t("Searching"));
+ grid.setSelectionModel(new GridSelectionModel());
+ grid.setBorders(false);
+ // grid.setFrame(true);
+ grid.setStripeRows(true);
+ }
- protected void query(final Store store, final GridPanel grid, final String query) {
- final UrlParam[] newParams = new UrlParam[] { new UrlParam("query", query) };
- store.setBaseParams(newParams);
- store.load(0, PAGINATION_SIZE);
- // see bind/unbind in:
- // http://groups.google.com/group/gwt-ext/browse_thread/thread/ae0badb8114b30cd?hl=en
- }
+ protected Store createStore(final ModelType type, final String url, final String id, final Grid grid) {
+ final String path = GWT.getHostPageBaseURL() + url;
+ // use a http proxy to get the data
+ final RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, path);
+ final HttpProxy<String> proxy = new HttpProxy<String>(builder);
+
+ // need a loader, proxy, and reader
+ final JsonLoadResultReader<ListLoadResult<ModelData>> reader = new JsonLoadResultReader<ListLoadResult<ModelData>>(
+ type);
+
+ final BaseListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(
+ proxy, reader);
+ loader.setRemoteSort(true);
+
+ final ListStore<ModelData> store = new ListStore<ModelData>(loader);
+ grid.addListener(Events.Attach, new Listener<GridEvent<ModelData>>() {
+ @Override
+ public void handleEvent(final GridEvent<ModelData> be) {
+ final PagingLoadConfig config = new BasePagingLoadConfig();
+ config.setOffset(0);
+ config.setLimit(PAGINATION_SIZE);
+
+ final Map<String, Object> state = grid.getState();
+ if (state.containsKey("offset")) {
+ final int offset = (Integer) state.get("offset");
+ final int limit = (Integer) state.get("limit");
+ config.setOffset(offset);
+ config.setLimit(limit);
+ }
+ // if (state.containsKey("sortField")) {
+ // config.setSortField((String) state.get("sortField"));
+ // config.setSortDir(SortDir.valueOf((String) state.get("sortDir")));
+ // }
+ loader.load(config);
+ }
+ });
+
+ // this goes to Model...
+ // reader.setRoot("list");
+ // reader.setTotalProperty("size");
+ // reader.setId(id);
+ // final HttpProxy proxy = new HttpProxy(url, Connection.POST);
+ // return new Store(proxy, reader, true);
+
+ return store;
+ }
+
+ protected void query(final Store store, final Grid grid, final String query) {
+ // final UrlParam[] newParams = new UrlParam[] { new UrlParam("query",
+ // query) };
+ // store.setBaseParams(newParams);
+ // store.load(0, PAGINATION_SIZE);
+ store.clearFilters();
+ store.addFilter(new StoreFilter<ModelData>() {
+ @Override
+ public boolean select(final Store<ModelData> store, final ModelData parent, final ModelData item,
+ final String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+ });
+ }
+
}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslator.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1,26 +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 org.ourproject.kune.workspace.client.i18n;
-
-public interface I18nTranslator {
-
- void doShowTranslator();
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -22,14 +22,16 @@
import org.ourproject.kune.platf.client.services.Images;
import org.ourproject.kune.platf.client.ui.AbstractSearcherPanel;
import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog;
-import org.ourproject.kune.platf.client.ui.noti.OldNotifyUser;
import org.ourproject.kune.workspace.client.search.SiteBottomTrayButton;
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+import cc.kune.common.client.notify.NotifyUser;
+import cc.kune.common.client.utils.SimpleCallback;
import cc.kune.common.client.utils.TextUtils;
import cc.kune.core.shared.SearcherConstants;
import cc.kune.core.shared.dto.I18nLanguageDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
+import cc.kune.gspace.client.i18n.LanguageSelectorPanel;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.HorizontalPanel;
@@ -48,9 +50,7 @@
import com.gwtext.client.widgets.Window;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.event.WindowListenerAdapter;
-import com.gwtext.client.widgets.form.ComboBox;
import com.gwtext.client.widgets.form.TextField;
-import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
import com.gwtext.client.widgets.grid.CellMetadata;
import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
@@ -65,264 +65,272 @@
public class I18nTranslatorPanel extends AbstractSearcherPanel implements I18nTranslatorView {
- public static final String TRANSLATOR_DIALOG = "k-i18n-trans";
- private Window dialog;
- private final I18nTranslatorPresenter presenter;
- private LanguageSelectorPanel languageSelectorPanel;
- private Store unTransStore;
- private Store transStore;
- private GridPanel transGrid;
- private GridPanel unTransGrid;
- private final LanguageSelector languageSelector;
- private final WorkspaceSkeleton ws;
- private SiteBottomTrayButton traybarButton;
- private final Images img;
+ public static final String TRANSLATOR_DIALOG = "k-i18n-trans";
+ private Window dialog;
+ private final Images img;
+ private final LanguageSelectorPanel languageSelector;
+ private LanguageSelectorPanel languageSelectorPanel;
+ private final I18nTranslatorPresenter presenter;
+ private GridPanel transGrid;
+ private Store transStore;
+ private SiteBottomTrayButton traybarButton;
+ private GridPanel unTransGrid;
+ private Store unTransStore;
+ private final WorkspaceSkeleton ws;
- public I18nTranslatorPanel(final I18nTranslatorPresenter initPresenter, final I18nTranslationService i18n,
- final LanguageSelector languageSelector, final WorkspaceSkeleton ws, final Images img) {
- super(i18n);
- this.presenter = initPresenter;
- this.languageSelector = languageSelector;
- this.ws = ws;
- this.img = img;
- }
+ public I18nTranslatorPanel(final I18nTranslatorPresenter initPresenter,
+ final I18nTranslationService i18n, final LanguageSelectorPanel languageSelector,
+ final WorkspaceSkeleton ws, final Images img) {
+ super(i18n);
+ this.presenter = initPresenter;
+ this.languageSelector = languageSelector;
+ this.ws = ws;
+ this.img = img;
+ }
- public void close() {
- dialog.hide();
- }
+ @Override
+ public void close() {
+ dialog.hide();
+ }
- public void hide() {
- dialog.hide();
- }
+ private Window createDialog() {
+ final Panel north = new Panel();
+ north.setBorder(false);
- public void hideTranslatorAndIcon() {
- if (dialog.isRendered()) {
- dialog.hide();
- }
- if (traybarButton != null) {
- traybarButton.destroy();
- traybarButton = null;
- }
- }
+ final Panel center = new TabPanel();
+ center.setAutoScroll(false);
+ center.setClosable(false);
+ center.setBorder(false);
- public void show() {
- if (dialog == null) {
- dialog = createDialog();
- }
- // By default we use the user lang to help in translation
- final I18nLanguageDTO lang = presenter.getLanguage();
- setLanguage(lang);
- final String languageNativeNameIfAvailable = lang.getNativeName().length() > 0 ? lang.getNativeName()
- : lang.getEnglishName();
- dialog.setTitle(i18n.t("Help to translate kune to [%s]", languageNativeNameIfAvailable));
- dialog.show();
- dialog.expand();
- dialog.center();
- if (traybarButton == null) {
- traybarButton = new SiteBottomTrayButton("images/language.gif", i18n.t("Show/hide translator"), dialog, ws);
- }
- }
+ final Window dialog = new BasicDialog(TRANSLATOR_DIALOG, "", false, false, 620, 330);
+ // dialog.setResizable(false);
+ dialog.setIconCls("i18n-icon");
- private Window createDialog() {
- final Panel north = new Panel();
- north.setBorder(false);
+ final Button close = new Button();
+ close.setText(i18n.tWithNT("Close", "used in button"));
+ close.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ presenter.doClose();
+ }
+ });
+ dialog.addButton(close);
- final Panel center = new TabPanel();
- center.setAutoScroll(false);
- center.setClosable(false);
- center.setBorder(false);
+ final Panel unTransCenterPanel = new Panel(i18n.t("Untranslated"));
+ unTransCenterPanel.setAutoScroll(false);
+ unTransCenterPanel.setLayout(new FitLayout());
- final Window dialog = new BasicDialog(TRANSLATOR_DIALOG, "", false, false, 620, 330);
- // dialog.setResizable(false);
- dialog.setIconCls("i18n-icon");
+ final Panel transCenterPanel = new Panel(i18n.t("Translated"));
+ transCenterPanel.setAutoScroll(false);
+ transCenterPanel.setLayout(new FitLayout());
- final Button close = new Button();
- close.setText(i18n.tWithNT("Close", "used in button"));
- close.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(final Button button, final EventObject e) {
- presenter.doClose();
- }
- });
- dialog.addButton(close);
+ final Panel recommendationPanel = new Panel(i18n.t("Recommendations"));
+ recommendationPanel.setAutoScroll(true);
+ recommendationPanel.setLayout(new FitLayout());
- final Panel unTransCenterPanel = new Panel(i18n.t("Untranslated"));
- unTransCenterPanel.setAutoScroll(false);
- unTransCenterPanel.setLayout(new FitLayout());
+ transGrid = createGridPanel(true);
+ unTransGrid = createGridPanel(false);
+ final HorizontalPanel hp = new HorizontalPanel();
+ languageSelectorPanel.addChangeListener(new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ setLanguage(languageSelectorPanel.getLanguageCode());
+ dialog.setTitle(i18n.t("Help to translate kune to [%s]",
+ languageSelectorPanel.getLanguageEnglishName()));
+ }
+ });
+ hp.add(languageSelectorPanel);
+ hp.addStyleName("kune-Margin-Large-trbl");
+ north.add(hp);
- final Panel transCenterPanel = new Panel(i18n.t("Translated"));
- transCenterPanel.setAutoScroll(false);
- transCenterPanel.setLayout(new FitLayout());
+ unTransCenterPanel.add(unTransGrid);
+ transCenterPanel.add(transGrid);
+ final Frame recommFrame = new Frame("html/i18n-recom.html");
+ recommFrame.setHeight("auto");
+ recommendationPanel.add(recommFrame);
- final Panel recommendationPanel = new Panel(i18n.t("Recommendations"));
- recommendationPanel.setAutoScroll(true);
- recommendationPanel.setLayout(new FitLayout());
+ center.add(unTransCenterPanel);
+ center.add(transCenterPanel);
+ center.add(recommendationPanel);
+ dialog.add(north, new BorderLayoutData(RegionPosition.NORTH));
+ dialog.add(center, new BorderLayoutData(RegionPosition.CENTER));
- transGrid = createGridPanel(true);
- unTransGrid = createGridPanel(false);
- final HorizontalPanel hp = new HorizontalPanel();
- languageSelectorPanel = (LanguageSelectorPanel) languageSelector.getView();
- languageSelectorPanel.addChangeListener(new ComboBoxListenerAdapter() {
- @Override
- public void onSelect(final ComboBox comboBox, final Record record, final int index) {
- setLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID));
- dialog.setTitle(i18n.t("Help to translate kune to [%s]", record.getAsString("language")));
- }
- });
- hp.add(languageSelectorPanel);
- hp.addStyleName("kune-Margin-Large-trbl");
- north.add(hp);
+ center.setActiveItemID(unTransCenterPanel.getId());
+ dialog.addListener(new WindowListenerAdapter() {
+ private void checkPosition(final BoxComponent component, final int x, final int y) {
+ if (y < 0) {
+ component.setPagePosition(x, 0);
+ }
+ }
- unTransCenterPanel.add(unTransGrid);
- transCenterPanel.add(transGrid);
- final Frame recommFrame = new Frame("html/i18n-recom.html");
- recommFrame.setHeight("auto");
- recommendationPanel.add(recommFrame);
+ @Override
+ public void onMove(final BoxComponent component, final int x, final int y) {
+ checkPosition(component, x, y);
+ }
- center.add(unTransCenterPanel);
- center.add(transCenterPanel);
- center.add(recommendationPanel);
- dialog.add(north, new BorderLayoutData(RegionPosition.NORTH));
- dialog.add(center, new BorderLayoutData(RegionPosition.CENTER));
+ @Override
+ public void onShow(final Component component) {
+ checkPosition(dialog, component.getAbsoluteLeft(), component.getAbsoluteTop());
+ }
+ });
+ return dialog;
+ }
- center.setActiveItemID(unTransCenterPanel.getId());
- dialog.addListener(new WindowListenerAdapter() {
- @Override
- public void onMove(final BoxComponent component, final int x, final int y) {
- checkPosition(component, x, y);
- }
+ private GridPanel createGridPanel(final boolean translated) {
- @Override
- public void onShow(final Component component) {
- checkPosition(dialog, component.getAbsoluteLeft(), component.getAbsoluteTop());
- }
+ final Renderer renderNT = new Renderer() {
+ @Override
+ public String render(final Object value, final CellMetadata cellMetadata, final Record record,
+ final int rowIndex, final int colNum, final Store store) {
+ String renderer;
+ final String[] splitted = splitNT((String) value);
+ if (splitted.length > 1) {
+ renderer = "{0} " + img.nt().getHTML();
+ final String tip = "<div style='min-width: 75px'>" + splitted[1] + "</div>";
+ cellMetadata.setHtmlAttribute("ext:qtip=\"" + tip + "\" ext:qtitle=\"Note for translators\"");
+ } else {
+ renderer = "{0}";
+ }
+ return Format.format(renderer, splitted);
+ }
+ };
- private void checkPosition(final BoxComponent component, final int x, final int y) {
- if (y < 0) {
- component.setPagePosition(x, 0);
- }
- }
- });
- return dialog;
+ Store store;
+ final String id = "id";
+ final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef("trKey"),
+ new StringFieldDef("text"), new StringFieldDef(id) };
+
+ if (translated) {
+ final String url = SearcherConstants.I18N_JSON_SERVICE_TRANSLATED;
+ // transStore = createStore(fieldDefs, url, id);
+ store = transStore;
+ } else {
+ final String url = SearcherConstants.I18N_JSON_SERVICE;
+ // unTransStore = createStore(fieldDefs, url, id);
+ store = unTransStore;
}
- private GridPanel createGridPanel(final boolean translated) {
+ final ColumnConfig trKeyColumn = new ColumnConfig() {
+ {
+ setHeader(i18n.t("Text to translate"));
+ setDataIndex("trKey");
+ setWidth(285);
+ setTooltip(i18n.t("Click to sort"));
+ setRenderer(renderNT);
+ }
+ };
- final Renderer renderNT = new Renderer() {
- public String render(final Object value, final CellMetadata cellMetadata, final Record record,
- final int rowIndex, final int colNum, final Store store) {
- String renderer;
- final String[] splitted = splitNT((String) value);
- if (splitted.length > 1) {
- renderer = "{0} " + img.nt().getHTML();
- final String tip = "<div style='min-width: 75px'>" + splitted[1] + "</div>";
- cellMetadata.setHtmlAttribute("ext:qtip=\"" + tip + "\" ext:qtitle=\"Note for translators\"");
- } else {
- renderer = "{0}";
- }
- return Format.format(renderer, splitted);
- }
- };
+ final GridEditor textColumnEditor = new GridEditor(new TextField());
- Store store;
- final String id = "id";
- final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef("trKey"), new StringFieldDef("text"),
- new StringFieldDef(id) };
+ final ColumnConfig textColumn = new ColumnConfig() {
+ {
+ setHeader(i18n.t("Translation (click to edit)"));
+ setDataIndex("text");
+ setWidth(285);
+ setEditor(textColumnEditor);
+ }
+ };
- if (translated) {
- final String url = SearcherConstants.I18N_JSON_SERVICE_TRANSLATED;
- transStore = createStore(fieldDefs, url, id);
- store = transStore;
- } else {
- final String url = SearcherConstants.I18N_JSON_SERVICE;
- unTransStore = createStore(fieldDefs, url, id);
- store = unTransStore;
- }
+ final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { trKeyColumn, textColumn });
- final ColumnConfig trKeyColumn = new ColumnConfig() {
- {
- setHeader(i18n.t("Text to translate"));
- setDataIndex("trKey");
- setWidth(285);
- setTooltip(i18n.t("Click to sort"));
- setRenderer(renderNT);
- }
- };
+ columnModel.setDefaultSortable(true);
- final GridEditor textColumnEditor = new GridEditor(new TextField());
+ final EditorGridPanel grid = new EditorGridPanel((translated ? "grid-translated"
+ : "grid-untranslated"), 595, 180, store, columnModel);
+ // createPagingToolbar(store, grid);
- final ColumnConfig textColumn = new ColumnConfig() {
- {
- setHeader(i18n.t("Translation (click to edit)"));
- setDataIndex("text");
- setWidth(285);
- setEditor(textColumnEditor);
- }
- };
+ grid.setClicksToEdit(1);
- final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { trKeyColumn, textColumn });
+ grid.addEditorGridListener(new EditorGridListenerAdapter() {
+ @Override
+ public void onAfterEdit(final GridPanel grid, final Record record, final String field,
+ final Object newValue, final Object oldValue, final int rowIndex, final int colIndex) {
+ final String idValue = record.getAsString(id);
+ final String trKey = record.getAsString("trKey");
+ presenter.doTranslation(idValue, trKey, (String) newValue);
+ record.set(field, TextUtils.escapeHtmlLight((String) newValue));
+ }
+ });
- columnModel.setDefaultSortable(true);
+ grid.addGridCellListener(new GridCellListenerAdapter() {
+ @Override
+ public void onCellDblClick(final GridPanel grid, final int rowIndex, final int colIndex,
+ final EventObject e) {
+ final Record record = unTransStore.getRecordAt(rowIndex);
+ final String idValue = record.getAsString(id);
+ final String trKey = record.getAsString("trKey");
+ final String text = record.getAsString("text");
+ if (text == null || text.length() == 0) {
+ final String trWithoutNT = removeNT(trKey);
+ record.set("text", trWithoutNT);
+ presenter.doTranslation(idValue, trKey, trWithoutNT);
+ }
+ }
+ });
- final EditorGridPanel grid = new EditorGridPanel((translated ? "grid-translated" : "grid-untranslated"), 595,
- 180, store, columnModel);
- createPagingToolbar(store, grid);
+ return grid;
+ }
- grid.setClicksToEdit(1);
+ @Override
+ public void hide() {
+ dialog.hide();
+ }
- grid.addEditorGridListener(new EditorGridListenerAdapter() {
- @Override
- public void onAfterEdit(final GridPanel grid, final Record record, final String field,
- final Object newValue, final Object oldValue, final int rowIndex, final int colIndex) {
- final String idValue = record.getAsString(id);
- final String trKey = record.getAsString("trKey");
- presenter.doTranslation(idValue, trKey, (String) newValue);
- record.set(field, TextUtils.escapeHtmlLight((String) newValue));
- }
- });
+ @Override
+ public void hideTranslatorAndIcon() {
+ if (dialog.isRendered()) {
+ dialog.hide();
+ }
+ if (traybarButton != null) {
+ traybarButton.destroy();
+ traybarButton = null;
+ }
+ }
- grid.addGridCellListener(new GridCellListenerAdapter() {
- @Override
- public void onCellDblClick(final GridPanel grid, final int rowIndex, final int colIndex, final EventObject e) {
- final Record record = unTransStore.getRecordAt(rowIndex);
- final String idValue = record.getAsString(id);
- final String trKey = record.getAsString("trKey");
- final String text = record.getAsString("text");
- if (text == null || text.length() == 0) {
- final String trWithoutNT = removeNT(trKey);
- record.set("text", trWithoutNT);
- presenter.doTranslation(idValue, trKey, trWithoutNT);
- }
- }
- });
+ private String removeNT(final String string) {
+ return i18n.removeNT(string);
+ }
- return grid;
- }
+ private void setLanguage(final I18nLanguageDTO language) {
+ languageSelectorPanel.setLanguage(language.getCode());
+ setLanguage(language.getCode());
+ }
- private String removeNT(final String string) {
- return i18n.removeNT(string);
- }
+ private void setLanguage(final String language) {
+ NotifyUser.showProgressLoading();
+ // query(unTransStore, unTransGrid, language);
+ // query(transStore, transGrid, language);
+ NotifyUser.hideProgress();
+ }
- private void setLanguage(final I18nLanguageDTO language) {
- languageSelectorPanel.setLanguage(language.getCode());
- setLanguage(language.getCode());
+ @Override
+ public void show() {
+ if (dialog == null) {
+ dialog = createDialog();
}
-
- private void setLanguage(final String language) {
- OldNotifyUser.showProgressLoading();
- query(unTransStore, unTransGrid, language);
- query(transStore, transGrid, language);
- OldNotifyUser.hideProgress();
+ // By default we use the user lang to help in translation
+ final I18nLanguageDTO lang = presenter.getLanguage();
+ setLanguage(lang);
+ final String languageNativeNameIfAvailable = lang.getNativeName().length() > 0 ? lang.getNativeName()
+ : lang.getEnglishName();
+ dialog.setTitle(i18n.t("Help to translate kune to [%s]", languageNativeNameIfAvailable));
+ dialog.show();
+ dialog.expand();
+ dialog.center();
+ if (traybarButton == null) {
+ traybarButton = new SiteBottomTrayButton("images/language.gif", i18n.t("Show/hide translator"),
+ dialog, ws);
}
+ }
- private String[] splitNT(final String textWithNT) {
- String[] nt;
- final String[] splitted = textWithNT.split(" \\[%NT ");
- if (splitted.length > 1) {
- nt = splitted[1].split("\\]$");
- splitted[1] = nt[0];
- }
- return splitted;
+ private String[] splitNT(final String textWithNT) {
+ String[] nt;
+ final String[] splitted = textWithNT.split(" \\[%NT ");
+ if (splitted.length > 1) {
+ nt = splitted[1].split("\\]$");
+ splitted[1] = nt[0];
}
+ return splitted;
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -26,6 +26,7 @@
import cc.kune.core.client.rpcservices.I18nServiceAsync;
import cc.kune.core.client.state.Session;
import cc.kune.core.shared.dto.I18nLanguageDTO;
+import cc.kune.gspace.client.i18n.I18nTranslator;
import com.calclab.suco.client.events.Listener0;
import com.google.gwt.user.client.rpc.AsyncCallback;
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelector.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelector.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelector.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1,34 +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 org.ourproject.kune.workspace.client.i18n;
-
-import org.ourproject.kune.platf.client.View;
-
-import cc.kune.core.shared.dto.I18nLanguageDTO;
-
-public interface LanguageSelector {
-
- String getSelectedLanguage();
-
- View getView();
-
- void setLanguage(I18nLanguageDTO language);
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1,104 +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 org.ourproject.kune.workspace.client.i18n;
-
-
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.gwtext.client.data.SimpleStore;
-import com.gwtext.client.data.Store;
-import com.gwtext.client.widgets.form.ComboBox;
-import com.gwtext.client.widgets.form.Field;
-import com.gwtext.client.widgets.form.FormPanel;
-import com.gwtext.client.widgets.form.event.ComboBoxListener;
-
-public class LanguageSelectorPanel extends FormPanel implements LanguageSelectorView {
-
- public static final String LANG_ID = "abbr";
- public static final String LANG_FIELD = "k-langsp-lf";
-
- private ComboBox langCombo;
- private final LanguageSelectorPresenter presenter;
- private final I18nTranslationService i18n;
-
- public LanguageSelectorPanel(final LanguageSelectorPresenter presenter, final I18nTranslationService i18n) {
- this(presenter, null, i18n);
- }
-
- public LanguageSelectorPanel(final LanguageSelectorPresenter presenter, final String langFieldTitle,
- final I18nTranslationService i18n) {
- super();
- this.i18n = i18n;
- super.setBorder(false);
- if (langFieldTitle == null) {
- setHideLabels(true);
- }
- this.presenter = presenter;
- createLangCombo(langFieldTitle);
- super.add(langCombo);
- }
-
- public void addChangeListener(final ComboBoxListener listener) {
- langCombo.addListener(listener);
- }
-
- public String getLanguage() {
- return langCombo.getValueAsString();
- }
-
- public void reset() {
- langCombo.reset();
- }
-
- public void setLanguage(final String languageCode) {
- langCombo.setValue(languageCode);
- }
-
- private void createLangCombo(final String langFieldTitle) {
- final Store langStore = new SimpleStore(new String[] { LANG_ID, "language" }, getLanguages());
- langStore.load();
-
- Field.setMsgTarget("side");
- langCombo = new ComboBox();
- langCombo.setName(LANG_FIELD);
- langCombo.setMinChars(1);
- if (langFieldTitle != null) {
- langCombo.setFieldLabel(langFieldTitle);
- }
- langCombo.setStore(langStore);
- langCombo.setDisplayField("language");
- langCombo.setMode(ComboBox.LOCAL);
- langCombo.setTriggerAction(ComboBox.ALL);
- langCombo.setEmptyText(i18n.t("Enter language"));
- langCombo.setLoadingText(i18n.t("Searching..."));
- langCombo.setTypeAhead(true);
- langCombo.setTypeAheadDelay(1000);
- langCombo.setSelectOnFocus(false);
- langCombo.setWidth(140);
- langCombo.setValueField(LANG_ID);
- langCombo.setPageSize(7);
- langCombo.setForceSelection(true);
- langCombo.setAllowBlank(false);
- }
-
- private Object[][] getLanguages() {
- return presenter.getLanguages();
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPresenter.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorPresenter.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1,55 +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 org.ourproject.kune.workspace.client.i18n;
-
-import org.ourproject.kune.platf.client.View;
-
-import cc.kune.core.client.state.Session;
-import cc.kune.core.shared.dto.I18nLanguageDTO;
-
-public class LanguageSelectorPresenter implements LanguageSelector {
-
- private LanguageSelectorView view;
- private final Session session;
-
- public LanguageSelectorPresenter(final Session session) {
- this.session = session;
- }
-
- public Object[][] getLanguages() {
- return session.getLanguagesArray();
- }
-
- public String getSelectedLanguage() {
- return view.getLanguage();
- }
-
- public View getView() {
- return view;
- }
-
- public void init(final LanguageSelectorView view) {
- this.view = view;
- }
-
- public void setLanguage(final I18nLanguageDTO language) {
- view.setLanguage(language.getCode());
- }
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorView.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorView.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/LanguageSelectorView.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1,32 +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 org.ourproject.kune.workspace.client.i18n;
-
-import org.ourproject.kune.platf.client.View;
-
-public interface LanguageSelectorView extends View {
-
- void reset();
-
- String getLanguage();
-
- void setLanguage(String code);
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/SiteOptionsI18nTranslatorAction.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -1,51 +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 org.ourproject.kune.workspace.client.i18n;
-
-import org.ourproject.kune.platf.client.actions.Action;
-import org.ourproject.kune.platf.client.actions.ActionEvent;
-import org.ourproject.kune.platf.client.actions.OldAbstractAction;
-import org.ourproject.kune.platf.client.actions.ui.OldMenuItemDescriptor;
-
-import cc.kune.core.client.resources.icons.IconResources;
-import cc.kune.core.shared.i18n.I18nTranslationService;
-
-import com.calclab.suco.client.ioc.Provider;
-
-public class SiteOptionsI18nTranslatorAction extends OldAbstractAction {
- private final Provider<I18nTranslator> translator;
-
- public SiteOptionsI18nTranslatorAction(final I18nTranslationService i18n, final IconResources img,
- final Provider<I18nTranslator> translator) {
- super();
- this.translator = translator;
- putValue(Action.NAME, i18n.t("Help with the translation"));
- putValue(Action.SMALL_ICON, img.language());
- final OldMenuItemDescriptor item = new OldMenuItemDescriptor(this);
- item.setPosition(1);
- // siteOptions.addAction(item);
- }
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- translator.get().doShowTranslator();
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java 2011-07-29 21:04:15 UTC (rev 1477)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -24,7 +24,6 @@
import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
import cc.kune.common.client.errors.UIException;
-import cc.kune.core.shared.SearcherConstants;
import cc.kune.core.shared.i18n.I18nTranslationService;
import com.allen_sauer.gwt.log.client.Log;
@@ -59,239 +58,249 @@
public class SiteSearcherPanel extends AbstractSearcherPanel implements SiteSearcherView {
- public static final String SITE_SEARCHER_DIALOG = "k-site-searcher-dialog";
- private final Window dialog;
- private final SiteSearcherPresenter presenter;
- private Store groupStore;
- private TextField searchField;
- private Store contentStore;
- private GridPanel groupsGrid;
- private GridPanel contentGrid;
- private final WorkspaceSkeleton ws;
- private SiteBottomTrayButton traybarButton;
+ public static final String SITE_SEARCHER_DIALOG = "k-site-searcher-dialog";
+ private GridPanel contentGrid;
+ private Store contentStore;
+ private final Window dialog;
+ private GridPanel groupsGrid;
+ private Store groupStore;
+ private final SiteSearcherPresenter presenter;
+ private TextField searchField;
+ private SiteBottomTrayButton traybarButton;
+ private final WorkspaceSkeleton ws;
- public SiteSearcherPanel(final SiteSearcherPresenter initPresenter, final I18nTranslationService i18n,
- final WorkspaceSkeleton ws) {
- super(i18n);
- this.presenter = initPresenter;
- this.ws = ws;
- dialog = createDialog();
- }
+ public SiteSearcherPanel(final SiteSearcherPresenter initPresenter, final I18nTranslationService i18n,
+ final WorkspaceSkeleton ws) {
+ super(i18n);
+ this.presenter = initPresenter;
+ this.ws = ws;
+ dialog = createDialog();
+ }
- public String getTextToSearch() {
- return searchField.getValueAsString();
- }
+ private Window createDialog() {
+ final Panel north = new Panel();
+ north.setHeight(50);
+ north.setBorder(false);
- public void hide() {
- dialog.hide();
- }
+ final TabPanel centerPanel = new TabPanel();
+ centerPanel.setActiveTab(0);
+ centerPanel.setAutoScroll(true);
+ centerPanel.setClosable(false);
+ centerPanel.setBorder(false);
- public void search(final String text, final SiteSearcherType type) {
- searchField.setValue(text);
- switch (type) {
- case group_user:
- query(groupStore, groupsGrid, text);
- break;
- case content:
- query(contentStore, contentGrid, text);
- break;
- default:
- break;
- }
- }
+ final BasicDialog dialog = new BasicDialog(SITE_SEARCHER_DIALOG, i18n.t("Search"), false, false,
+ 500, 400);
+ // dialog.setResizable(false);
+ dialog.setIconCls("search-icon");
+ final Button closeButton = new Button(i18n.tWithNT("Close", "used in button"));
+ closeButton.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ presenter.doClose();
+ }
+ });
+ dialog.addButton(closeButton);
- public void setTextToSearch(final String text) {
- searchField.setValue(text);
- }
+ final Panel searchPanel = createSearchForm(presenter);
+ final Panel groupsPanel = new Panel("Groups & Users");
+ final Panel contentPanel = new Panel("Content");
+ groupsPanel.setLayout(new FitLayout());
+ contentPanel.setLayout(new FitLayout());
- public void show() {
- dialog.show();
- dialog.expand();
- dialog.center();
- if (traybarButton == null) {
- traybarButton = new SiteBottomTrayButton("images/kune-search-ico-push.gif",
- i18n.t("Show/hide search engine"), dialog, ws);
- }
- }
+ groupsGrid = createSearchPanel(SiteSearcherType.group_user);
+ contentGrid = createSearchPanel(SiteSearcherType.content);
+ groupsPanel.add(groupsGrid);
+ contentPanel.add(contentGrid);
+ centerPanel.add(groupsPanel);
+ centerPanel.add(contentPanel);
+ dialog.add(searchPanel, new BorderLayoutData(RegionPosition.NORTH));
+ dialog.add(centerPanel, new BorderLayoutData(RegionPosition.CENTER));
- private Window createDialog() {
- final Panel north = new Panel();
- north.setHeight(50);
- north.setBorder(false);
+ groupsPanel.addListener(new PanelListenerAdapter() {
+ @Override
+ public void onActivate(final Panel panel) {
+ dialog.setTitle(i18n.t("Search users and groups"));
+ presenter.doSearch(SiteSearcherType.group_user);
+ }
+ });
- final TabPanel centerPanel = new TabPanel();
- centerPanel.setActiveTab(0);
- centerPanel.setAutoScroll(true);
- centerPanel.setClosable(false);
- centerPanel.setBorder(false);
+ contentPanel.addListener(new PanelListenerAdapter() {
+ @Override
+ public void onActivate(final Panel panel) {
+ dialog.setTitle(i18n.t("Search contents"));
+ presenter.doSearch(SiteSearcherType.content);
+ }
+ });
- final BasicDialog dialog = new BasicDialog(SITE_SEARCHER_DIALOG, i18n.t("Search"), false, false, 500, 400);
- // dialog.setResizable(false);
- dialog.setIconCls("search-icon");
- final Button closeButton = new Button(i18n.tWithNT("Close", "used in button"));
- closeButton.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(final Button button, final EventObject e) {
- presenter.doClose();
- }
- });
- dialog.addButton(closeButton);
+ final String panelId = groupsPanel.getId();
+ centerPanel.setActiveItemID(panelId);
- final Panel searchPanel = createSearchForm(presenter);
- final Panel groupsPanel = new Panel("Groups & Users");
- final Panel contentPanel = new Panel("Content");
- groupsPanel.setLayout(new FitLayout());
- contentPanel.setLayout(new FitLayout());
+ dialog.setCloseAction(Window.HIDE);
+ dialog.addListener(new WindowListenerAdapter() {
+ private void checkPosition(final BoxComponent component, final int x, final int y) {
+ if (y < 0) {
+ component.setPagePosition(x, 0);
+ }
+ }
- groupsGrid = createSearchPanel(SiteSearcherType.group_user);
- contentGrid = createSearchPanel(SiteSearcherType.content);
- groupsPanel.add(groupsGrid);
- contentPanel.add(contentGrid);
- centerPanel.add(groupsPanel);
- centerPanel.add(contentPanel);
- dialog.add(searchPanel, new BorderLayoutData(RegionPosition.NORTH));
- dialog.add(centerPanel, new BorderLayoutData(RegionPosition.CENTER));
+ @Override
+ public void onMove(final BoxComponent component, final int x, final int y) {
+ checkPosition(component, x, y);
+ }
- groupsPanel.addListener(new PanelListenerAdapter() {
- @Override
- public void onActivate(final Panel panel) {
- dialog.setTitle(i18n.t("Search users and groups"));
- presenter.doSearch(SiteSearcherType.group_user);
- }
- });
+ @Override
+ public void onShow(final Component component) {
+ checkPosition(dialog, component.getAbsoluteLeft(), component.getAbsoluteTop());
+ }
+ });
+ return dialog;
+ }
- contentPanel.addListener(new PanelListenerAdapter() {
- @Override
- public void onActivate(final Panel panel) {
- dialog.setTitle(i18n.t("Search contents"));
- presenter.doSearch(SiteSearcherType.content);
- }
- });
+ private Panel createSearchForm(final SiteSearcherPresenter presenter) {
+ final Panel searchPanel = new Panel();
+ searchPanel.setBorder(false);
- final String panelId = groupsPanel.getId();
- centerPanel.setActiveItemID(panelId);
+ final HorizontalPanel hp = new HorizontalPanel();
- dialog.setCloseAction(Window.HIDE);
- dialog.addListener(new WindowListenerAdapter() {
- @Override
- public void onMove(final BoxComponent component, final int x, final int y) {
- checkPosition(component, x, y);
- }
+ final FormPanel form = new FormPanel();
+ form.setBorder(false);
+ form.setWidth(330);
+ form.setHideLabels(true);
- @Override
- public void onShow(final Component component) {
- checkPosition(dialog, component.getAbsoluteLeft(), component.getAbsoluteTop());
- }
+ searchField = new TextField();
+ searchField.setWidth(300);
+ searchField.addListener(new FieldListenerAdapter() {
- private void checkPosition(final BoxComponent component, final int x, final int y) {
- if (y < 0) {
- component.setPagePosition(x, 0);
- }
- }
- });
- return dialog;
- }
+ @Override
+ public void onSpecialKey(final Field field, final EventObject event) {
+ if (event.getKey() == KeyCodes.KEY_ENTER) {
+ presenter.doSearch(field.getValueAsString());
+ }
+ event.stopEvent();
+ }
- private Panel createSearchForm(final SiteSearcherPresenter presenter) {
- final Panel searchPanel = new Panel();
- searchPanel.setBorder(false);
+ });
+ form.add(searchField);
- final HorizontalPanel hp = new HorizontalPanel();
+ final Button searchBtn = new Button(i18n.tWithNT("Search", "used in button"));
+ searchBtn.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ presenter.doSearch(searchField.getValueAsString());
+ }
+ });
+ hp.add(form);
+ hp.add(searchBtn);
+ hp.setSpacing(7);
+ hp.addStyleName("kune-Margin-Large-trbl");
+ searchPanel.add(hp);
+ return searchPanel;
+ }
- final FormPanel form = new FormPanel();
- form.setBorder(false);
- form.setWidth(330);
- form.setHideLabels(true);
+ private GridPanel createSearchPanel(final SiteSearcherType type) {
+ final String id = "shortName";
+ final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef(id),
+ new StringFieldDef("longName"), new StringFieldDef("link"), new StringFieldDef("iconUrl") };
+ final Store store;
- searchField = new TextField();
- searchField.setWidth(300);
- searchField.addListener(new FieldListenerAdapter() {
+ switch (type) {
+ case group_user:
+ store = groupStore = null; // createStore(fieldDefs,
+ // SearcherConstants.GROUP_DATA_PROXY_URL, id);
+ break;
+ case content:
+ store = contentStore = null; // createStore(fieldDefs,
+ // SearcherConstants.CONTENT_DATA_PROXY_URL,
+ // id);
+ break;
+ default:
+ throw new UIException("Unknown type of search");
+ }
- @Override
- public void onSpecialKey(final Field field, final EventObject event) {
- if (event.getKey() == KeyCodes.KEY_ENTER) {
- presenter.doSearch(field.getValueAsString());
- }
- event.stopEvent();
- }
+ final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { new ColumnConfig() {
+ {
+ setDataIndex(id);
+ setWidth(100);
+ }
+ }, new ColumnConfig() {
+ {
+ setDataIndex("longName");
+ setWidth(350);
+ }
+ } });
- });
- form.add(searchField);
+ // columnModel.setDefaultSortable(true);
- final Button searchBtn = new Button(i18n.tWithNT("Search", "used in button"));
- searchBtn.addListener(new ButtonListenerAdapter() {
- @Override
- public void onClick(final Button button, final EventObject e) {
- presenter.doSearch(searchField.getValueAsString());
- }
- });
- hp.add(form);
- hp.add(searchBtn);
- hp.setSpacing(7);
- hp.addStyleName("kune-Margin-Large-trbl");
- searchPanel.add(hp);
- return searchPanel;
- }
+ final String gridName = type == SiteSearcherType.group_user ? "group-search" : "content-search";
- private GridPanel createSearchPanel(final SiteSearcherType type) {
- final String id = "shortName";
- final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef(id), new StringFieldDef("longName"),
- new StringFieldDef("link"), new StringFieldDef("iconUrl") };
- final Store store;
+ final GridPanel grid = new GridPanel(gridName, 474, 250, store, columnModel);
- switch (type) {
- case group_user:
- store = groupStore = createStore(fieldDefs, SearcherConstants.GROUP_DATA_PROXY_URL, id);
- break;
- case content:
- store = contentStore = createStore(fieldDefs, SearcherConstants.CONTENT_DATA_PROXY_URL, id);
- break;
- default:
- throw new UIException("Unknown type of search");
- }
+ // createPagingToolbar(store, grid);
+ grid.setHideColumnHeader(true);
+ final GridView view = new GridView();
+ view.setForceFit(true);
+ view.setEmptyText(i18n.t("No results"));
+ grid.setView(view);
- final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { new ColumnConfig() {
- {
- setDataIndex(id);
- setWidth(100);
- }
- }, new ColumnConfig() {
- {
- setDataIndex("longName");
- setWidth(350);
- }
- } });
+ grid.addListener(new PanelListenerAdapter() {
+ @Override
+ public void onRender(final Component component) {
+ Log.debug("Loading store");
+ store.load(0, PAGINATION_SIZE);
+ }
+ });
- // columnModel.setDefaultSortable(true);
+ grid.addGridCellListener(new GridCellListenerAdapter() {
+ @Override
+ public void onCellClick(final GridPanel grid, final int rowIndex, final int colindex,
+ final EventObject e) {
+ final Record record = store.getRecordAt(rowIndex);
+ final String groupShortName = record.getAsString(id);
+ presenter.doGoto(groupShortName);
+ }
+ });
- final String gridName = type == SiteSearcherType.group_user ? "group-search" : "content-search";
+ return grid;
+ }
- final GridPanel grid = new GridPanel(gridName, 474, 250, store, columnModel);
+ @Override
+ public String getTextToSearch() {
+ return searchField.getValueAsString();
+ }
- createPagingToolbar(store, grid);
- grid.setHideColumnHeader(true);
- final GridView view = new GridView();
- view.setForceFit(true);
- view.setEmptyText(i18n.t("No results"));
- grid.setView(view);
+ @Override
+ public void hide() {
+ dialog.hide();
+ }
- grid.addListener(new PanelListenerAdapter() {
- @Override
- public void onRender(final Component component) {
- Log.debug("Loading store");
- store.load(0, PAGINATION_SIZE);
- }
- });
+ @Override
+ public void search(final String text, final SiteSearcherType type) {
+ searchField.setValue(text);
+ switch (type) {
+ case group_user:
+ // query(groupStore, groupsGrid, text);
+ break;
+ case content:
+ // query(contentStore, contentGrid, text);
+ break;
+ default:
+ break;
+ }
+ }
- grid.addGridCellListener(new GridCellListenerAdapter() {
- @Override
- public void onCellClick(final GridPanel grid, final int rowIndex, final int colindex, final EventObject e) {
- final Record record = store.getRecordAt(rowIndex);
- final String groupShortName = record.getAsString(id);
- presenter.doGoto(groupShortName);
- }
- });
+ @Override
+ public void setTextToSearch(final String text) {
+ searchField.setValue(text);
+ }
- return grid;
+ @Override
+ public void show() {
+ dialog.show();
+ dialog.expand();
+ dialog.center();
+ if (traybarButton == null) {
+ traybarButton = new SiteBottomTrayButton("images/kune-search-ico-push.gif",
+ i18n.t("Show/hide search engine"), dialog, ws);
}
+ }
}
Added: trunk/src/main/resources/ConstantsTest_en.properties
===================================================================
--- trunk/src/main/resources/ConstantsTest_en.properties (rev 0)
+++ trunk/src/main/resources/ConstantsTest_en.properties 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,7 @@
+areYouSure = Are you Sure?
+pleaseConfirm = Please confirm!
+somethingNotTranslated = Something not translated
+someMultipleLines = \
+some \
+multiple \
+lines
\ No newline at end of file
Added: trunk/src/main/resources/ConstantsTest_es.properties
===================================================================
--- trunk/src/main/resources/ConstantsTest_es.properties (rev 0)
+++ trunk/src/main/resources/ConstantsTest_es.properties 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,2 @@
+areYouSure = ¿Estás seguro?
+pleaseConfirm = ¡Por favor confirma!
\ No newline at end of file
Added: trunk/src/test/java/cc/kune/core/client/i18n/ConstantsTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/client/i18n/ConstantsTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/core/client/i18n/ConstantsTest.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,54 @@
+package cc.kune.core.client.i18n;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ConstantsTest {
+ private ResourceBundle english;
+ private ResourceBundle spanish;
+
+ @Test
+ public void basicEnglishFound() {
+ assertEquals("Are you Sure?", english.getString(I18nUtils.convertMethodName("Are you Sure?")));
+ }
+
+ @Test(expected = MissingResourceException.class)
+ public void basicEnglishNotFound() {
+ english.getString(I18nUtils.convertMethodName("Other thing"));
+ }
+
+ @Test
+ public void basicFound() {
+ assertEquals("¡Por favor confirma!",
+ spanish.getString(I18nUtils.convertMethodName("Please confirm!")));
+ }
+
+ @Test(expected = MissingResourceException.class)
+ public void basicNotFound() {
+ assertTrue(english.containsKey(I18nUtils.convertMethodName("Something not translated")));
+ assertFalse(spanish.containsKey(I18nUtils.convertMethodName("Something not translated")));
+ assertEquals("Something not translated",
+ spanish.getString(I18nUtils.convertMethodName("Something not translated")));
+ }
+
+ @Before
+ public void before() {
+ english = ResourceBundle.getBundle("ConstantsTest", Locale.ENGLISH);
+ spanish = ResourceBundle.getBundle("ConstantsTest", new Locale("es"));
+ Locale.setDefault(Locale.ENGLISH);
+ }
+
+ @Test
+ public void multipleLines() {
+ assertEquals("some multiple lines",
+ english.getString(I18nUtils.convertMethodName("some multiple lines")));
+ }
+}
Added: trunk/src/test/java/cc/kune/core/client/i18n/I18nUtilsTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/client/i18n/I18nUtilsTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/core/client/i18n/I18nUtilsTest.java 2011-08-03 17:07:42 UTC (rev 1478)
@@ -0,0 +1,39 @@
+package cc.kune.core.client.i18n;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class I18nUtilsTest {
+
+ @Test
+ public void basicLongMessage() {
+ assertEquals(
+ "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789",
+ I18nUtils.convertMethodName("0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 "));
+ }
+
+ @Test
+ public void basicMultipleReservedChars() {
+ assertEquals("yesOrNoMaybe", I18nUtils.convertMethodName("Yes, or; & no? maybe"));
+ assertEquals("yesOrNoMaybe", I18nUtils.convertMethodName("Yes, or; & no? (maybe)"));
+ assertEquals("yesOrNoMaybeGiveSomeAnyPerCent",
+ I18nUtils.convertMethodName("Yes, or; & no?! (maybe): 'give' \"some/any\" % per-cent"));
+ }
+
+ @Test
+ public void basicTests() {
+ assertEquals("yesOrNo", I18nUtils.convertMethodName("yes, or & no?"));
+ }
+
+ @Test
+ public void testParams() {
+ assertEquals("nOfParamItems", I18nUtils.convertMethodName("[%d] of [%s] items"));
+ assertEquals("nOfNItems", I18nUtils.convertMethodName("[%d] of [%d] items"));
+ }
+
+ @Test
+ public void testParent() {
+ assertEquals("ofItems", I18nUtils.convertMethodName("() of [] {} items"));
+ }
+}
More information about the kune-commits
mailing list