[kune-commits] r1112 - in trunk: .
src/main/java/org/ourproject/kune/app/server
src/main/java/org/ourproject/kune/blogs/client
src/main/java/org/ourproject/kune/chat/server/managers
src/main/java/org/ourproject/kune/docs/client
src/main/java/org/ourproject/kune/gallery/client
src/main/java/org/ourproject/kune/platf/client/actions
src/main/java/org/ourproject/kune/platf/client/actions/ui
src/main/java/org/ourproject/kune/platf/client/dto
src/main/java/org/ourproject/kune/platf/client/errors
src/main/java/org/ourproject/kune/platf/client/i18n
src/main/java/org/ourproject/kune/platf/client/services
src/main/java/org/ourproject/kune/platf/client/shortcuts
src/main/java/org/ourproject/kune/platf/client/state
src/main/java/org/ourproject/kune/platf/client/ui
src/main/java/org/ourproject/kune/platf/client/ui/gridmenu
src/main/java/org/ourproject/kune/platf/client/ui/palette
src/main/java/org/ourproject/kune/platf/client/ui/rte/basic
src/main/java/org/ourproject/kune/platf/client/ui/rte/impl
src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg
src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink
src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia
src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8
src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable
src/main/java/org/ourproject/kune/platf/client/ui/rte/saving
src/main/java/org/ourproject/kune/platf/client/utils
src/main/java/org/ourproject/kune/platf/server
src/main/java/org/ourproject/kune/platf/server/access
src/main/java/org/ourproject/kune/platf/server/auth
src/main/java/org/ourproject/kune/platf/server/content
src/main/java/org/ourproject/kune/platf/server/domain
src/main/java/org/ourproject/kune/platf/server/init
src/main/java/org/ourproject/kune/platf/server/manager
src/main/java/org/ourproject/kune/platf/server/manager/file
src/main/java/org/ourproject/kune/platf/server/manager/impl
src/main/java/org/ourproject/kune/platf/server/properties
src/main/java/org/ourproject/kune/platf/server/rpc
src/main/java/org/ourproject/kune/platf/server/sn
src/main/java/org/ourproject/kune/platf/server/utils
src/main/java/org/ourproject/kune/rack
src/main/java/org/ourproject/kune/rack/filters
src/main/java/org/ourproject/kune/rack/filters/gwts
src/main/java/org/ourproject/kune/rack/filters/rest
src/main/java/org/ourproject/kune/rack/filters/servlet
src/main/java/org/ourproject/kune/wiki/client
src/main/java/org/ourproject/kune/workspace/client
src/main/java/org/ourproject/kune/workspace/client/editor
src/main/java/org/ourproject/kune/workspace/client/entityheader
src/main/java/org/ourproject/kune/workspace/client/newgroup
src/main/java/org/ourproject/kune/workspace/client/options
src/main/java/org/ourproject/kune/workspace/client/rate
src/main/java/org/ourproject/kune/workspace/client/search
src/main/java/org/ourproject/kune/workspace/client/signin
src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic
src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch
src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign
src/main/java/org/ourproject/kune/workspace/client/socialnet
src/main/java/org/ourproject/kune/workspace/client/title
src/main/java/org/ourproject/kune/workspace/client/tool
src/test/java/org/ourproject/kune/platf/client/actions
src/test/java/org/ourproject/kune/platf/client/state
src/test/java/org/ourproject/kune/platf/client/ui/rte/saving
src/test/java/org/ourproject/kune/platf/integration
src/test/java/org/ourproject/kune/platf/integration/content
src/test/java/org/ourproject/kune/platf/integration/selenium
src/test/java/org/ourproject/kune/platf/server
src/test/java/org/ourproject/kune/platf/server/finders
src/test/java/org/ourproject/kune/platf/server/manager
vjrj
vjrj at ourproject.org
Thu May 21 20:31:46 CEST 2009
Author: vjrj
Date: 2009-05-21 20:31:14 +0200 (Thu, 21 May 2009)
New Revision: 1112
Added:
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/errors/UIException.java
trunk/src/main/java/org/ourproject/kune/platf/server/ServerException.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ServerManagerException.java
trunk/src/main/java/org/ourproject/kune/rack/filters/AbstractInjectedFilter.java
Removed:
trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationService.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java
trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java
Modified:
trunk/TODO
trunk/src/main/java/org/ourproject/kune/app/server/AbstractExtendedModule.java
trunk/src/main/java/org/ourproject/kune/app/server/KuneContainerListener.java
trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java
trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java
trunk/src/main/java/org/ourproject/kune/chat/server/managers/RoomConfigurationDumper.java
trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java
trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContainerSimpleDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/I18nCountryDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateTokenUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesDataDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java
trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nTranslationService.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/ErrorHandler.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImpl.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplSafari.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplStandard.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/InsertTableDialogPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
trunk/src/main/java/org/ourproject/kune/platf/client/utils/Convert.java
trunk/src/main/java/org/ourproject/kune/platf/client/utils/Url.java
trunk/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java
trunk/src/main/java/org/ourproject/kune/platf/server/LoggerMethodInterceptor.java
trunk/src/main/java/org/ourproject/kune/platf/server/OutermostCallInterceptor.java
trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java
trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentUtils.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUtils.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/properties/KunePropertiesDefault.java
trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java
trunk/src/main/java/org/ourproject/kune/platf/server/utils/StringW.java
trunk/src/main/java/org/ourproject/kune/platf/server/utils/XmlW.java
trunk/src/main/java/org/ourproject/kune/rack/Rack.java
trunk/src/main/java/org/ourproject/kune/rack/RackHelper.java
trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/ForwardFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/ListenerFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/rest/DefaultRESTMethodFinder.java
trunk/src/main/java/org/ourproject/kune/rack/filters/rest/JSONLibRESTSerializer.java
trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTMethod.java
trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTServiceFilter.java
trunk/src/main/java/org/ourproject/kune/rack/filters/servlet/ServletServiceFilter.java
trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java
trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java
trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java
trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java
trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java
trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java
trunk/src/test/java/org/ourproject/kune/platf/client/state/StateTokenTest.java
trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java
trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java
trunk/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/TestDomainHelper.java
trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
trunk/src/test/java/org/ourproject/kune/platf/server/manager/I18nManagerTest.java
Log:
Several PMD error/warning fixes
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/TODO 2009-05-21 18:31:14 UTC (rev 1112)
@@ -11,6 +11,16 @@
Use org-mode in emacs to easy manage this file
* SHORT-TERM (URGENT)
+** New Action class
+*** Things to support
+**** menu and toolbars separators (space, bar, expand)
+**** index position insertion (for buttons added by other plugins)
+**** menu button property change (icon, text). If we select a menu option, maybe this require a change in the menu button.
+**** confirmation of actions yes, no.... (confirmation title, text, and onNotConfirmed)
+**** tongle/push buttons with isPressed (initially and later)...
+**** position id, that is, if we have some toolbars and a list of actions, how to select which action in which toolbar.
+**** radio menu (with group) and check menu item
+
** maven-gwt problem (using another plugin from codehaus)
mvn com.totsp.gwt:maven-googlewebtoolkit2-plugin:compile
and so on.
@@ -119,6 +129,8 @@
** vjrj <v> IconHyperlink.java and IconLabel.java to gwt1.5
* MID-TERM
+** TODO <v> study opensocial, openstack and related
+ http://developer.yahoo.net/blog/archives/2008/12/the_open_stack.html
** TODO <v> Use of command key ⌘ for Mac shortcuts
** TODO <v,s> harden our privacy policy. Goals:
- permit user/projects/contents how much private or public are
@@ -127,6 +139,7 @@
- keep always the user informed
- consider integration of chryptopgraphy (keyczar.org ? )
- encourage the use of nicknames; discourage the use of real names (as in Facebook). If a political group uses real names, an undercover would have too much info
+ - take into account the rms recommendations about privacy...
** <v> trash icon area d&d
** vjrj <v> shortcuts enhacement
*** Clarify the keycodes vs utf8 chars Shortcut definition (Function keys and so on...)
@@ -464,6 +477,21 @@
http://groups.google.com/group/Google-Web-Toolkit/browse_frm/thread/5d01cd806d93b94e/2909d30d1b2ddfb7?lnk=gst&q=GWT+%2B+FlowPanel+%2B+CSS+#2909d30d1b2ddfb7
** TODO <v> captcha in anonymous comments/edits
http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/99c259aad06406c6?pli=1
+** TODO <v> Study P2P integration
+ Study of P2P usage:
+ http://torrentfreak.com/p2p-traffic-still-booming-071128/
+*** torrent
+ http://en.wikipedia.org/wiki/Torrent_tracker
+ BT FAQ:
+ http://www.dessent.net/btfaq/
+ mod_bt:
+ http://www.crackerjack.net/mod_bt/mod_bt.html
+ apt-cache show libapache2-mod-bt
+ http://mail.milwaukeelug.org/wws/arc/mlug-list/2007-10/msg00119.html
+
+ http://hightechsorcery.com/2008/02/bittorrent-tracker-debian-and-ubuntu
+ http://erdgeist.org/arts/software/opentracker/
+ http://torrentfreak.com/the-pirate-bay-switches-to-opentracker-071208/
* LONG-TERM
** <s> integrate some blog/wiki converter:
http://code.google.com/p/google-blog-converters-appengine/
Modified: trunk/src/main/java/org/ourproject/kune/app/server/AbstractExtendedModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/server/AbstractExtendedModule.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/app/server/AbstractExtendedModule.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -49,6 +49,24 @@
public abstract class AbstractExtendedModule extends AbstractModule {
/**
+ * Hack to ensure unique Keys for binding different instances of
+ * ExtendedModule. The prefix is chosen to reduce the chances of a conflict
+ * with some other use of
+ *
+ * @Named. A better solution would be to invent an Annotation for just this
+ * purpose.
+ */
+ private static Annotation getUniqueAnnotation() {
+ return named("ExtendedModule-" + COUNT.incrementAndGet());
+ }
+
+ private final Set<Object> toBeInjected = new HashSet<Object>();
+
+ private boolean selfInjected = false;
+
+ private static final AtomicInteger COUNT = new AtomicInteger();
+
+ /**
* Overridden version of bindInterceptor that, in addition to the standard
* behavior, arranges for field and method injection of each
* MethodInterceptor in {@code interceptors}.
@@ -77,6 +95,13 @@
}
}
+ private void ensureSelfInjection() {
+ if (!selfInjected) {
+ bind(AbstractExtendedModule.class).annotatedWith(getUniqueAnnotation()).toInstance(this);
+ selfInjected = true;
+ }
+ }
+
@SuppressWarnings("unused")
@Inject
private void injectRegisteredObjects(final Injector injector) {
@@ -84,29 +109,4 @@
injector.injectMembers(injectee);
}
}
-
- private void ensureSelfInjection() {
- if (!selfInjectionInitialized) {
- bind(AbstractExtendedModule.class).annotatedWith(getUniqueAnnotation()).toInstance(this);
- selfInjectionInitialized = true;
- }
- }
-
- private final Set<Object> toBeInjected = new HashSet<Object>();
-
- private boolean selfInjectionInitialized = false;
-
- /**
- * Hack to ensure unique Keys for binding different instances of
- * ExtendedModule. The prefix is chosen to reduce the chances of a conflict
- * with some other use of
- *
- * @Named. A better solution would be to invent an Annotation for just this
- * purpose.
- */
- private static Annotation getUniqueAnnotation() {
- return named("ExtendedModule-" + count.incrementAndGet());
- }
-
- private static final AtomicInteger count = new AtomicInteger();
}
Modified: trunk/src/main/java/org/ourproject/kune/app/server/KuneContainerListener.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/server/KuneContainerListener.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/app/server/KuneContainerListener.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -19,7 +19,7 @@
*/
/**
- *
+ *
\*/
package org.ourproject.kune.app.server;
@@ -41,11 +41,12 @@
KunePersistenceService persistenceService;
ServerToolRegistry toolRegistry;
DocumentServerTool documentTool;
+ // @PMD:REVIEWED:LoggerIsNotStaticFinal: by vjrj on 21/05/09 16:55
Logger logger;
@Inject
- public KuneContainerListener(KunePersistenceService persistenceService, ServerToolRegistry toolRegistry,
- DocumentServerTool documentTool, Logger logger) {
+ public KuneContainerListener(final KunePersistenceService persistenceService,
+ final ServerToolRegistry toolRegistry, final DocumentServerTool documentTool, final Logger logger) {
this.persistenceService = persistenceService;
this.toolRegistry = toolRegistry;
this.documentTool = documentTool;
@@ -57,9 +58,14 @@
logger.log(Level.INFO, "starting Kune...");
toolRegistry.register(documentTool);
persistenceService.start();
- logger.log(Level.INFO, "started");
+ logger.log(Level.INFO, "Kune server started");
}
+ public void stop() {
+ logger.log(Level.INFO, "stoping Kune...");
+ logger.log(Level.INFO, "Kune server stoped");
+ }
+
private void configureLog4j() {
try {
Properties properties = new Properties();
@@ -71,9 +77,4 @@
e.printStackTrace();
}
}
-
- public void stop() {
- logger.log(Level.INFO, "stoping Kune...");
- logger.log(Level.INFO, "stoped");
- }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientActions.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -104,4 +104,8 @@
createDelContentAction(parentMenuTitle, i18n.t("Delete"), contents);
createShowDeletedItems(parentMenuTitleCtx, all);
}
+
+ @Override
+ protected void createPostSessionInitActions() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,8 +35,8 @@
public BlogClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(NAME, i18n.t("blogs"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+ final ContentCapabilitiesRegistry cntCapReg) {
+ super(NAME, i18n.t("blogs"), toolSelector, wsThemePresenter, ws, cntCapReg);
// registerAclEditableTypes();
registerAuthorableTypes(TYPE_POST, TYPE_UPLOADEDFILE);
@@ -55,7 +55,7 @@
return NAME;
}
- protected void registerIcons() {
+ private void registerIcons() {
registerContentTypeIcon(TYPE_BLOG, "images/nav/blog.png");
registerContentTypeIcon(TYPE_POST, "images/nav/post.png");
registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/RoomConfigurationDumper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/RoomConfigurationDumper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/RoomConfigurationDumper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,6 +21,8 @@
import java.util.Iterator;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.FormField;
@@ -28,6 +30,8 @@
class RoomConfigurationDumper {
+ private static final Log LOG = LogFactory.getLog(RoomConfigurationDumper.class);
+
public static void showConfiguration(final Form form) {
for (Iterator<FormField> fields = form.getFields(); fields.hasNext();) {
FormField formField = fields.next();
@@ -50,7 +54,7 @@
}
private static void log(final String string) {
- System.out.println(string);
+ LOG.debug(string);
}
void configure2(final MultiUserChat muc) throws XMPPException {
Modified: trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/chat/server/managers/XmppManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -44,7 +44,7 @@
@Singleton
public class XmppManagerDefault implements XmppManager {
- public static final Log log = LogFactory.getLog(XmppManagerDefault.class);
+ public static final Log LOG = LogFactory.getLog(XmppManagerDefault.class);
private final ChatProperties chatProperties;
@@ -136,7 +136,7 @@
String userJid = userName + "@" + chatProperties.getDomain();
Chat newChat = xmppConn.getChatManager().createChat(userJid, new MessageListener() {
public void processMessage(final Chat arg0, final Message arg1) {
- log.info("Sended message: " + text);
+ LOG.info("Sended message: " + text);
}
});
try {
@@ -146,7 +146,7 @@
message.setBody(text);
newChat.sendMessage(message);
} catch (Exception e) {
- log.error("Error Delivering xmpp message to " + userName);
+ LOG.error("Error Delivering xmpp message to " + userName);
}
xmppConn.disconnect();
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,8 +35,8 @@
public DocumentClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+ final ContentCapabilitiesRegistry cntCapRegistry) {
+ super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws, cntCapRegistry);
// registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerAuthorableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
@@ -55,7 +55,7 @@
return NAME;
}
- protected void registerIcons() {
+ private void registerIcons() {
registerContentTypeIcon(TYPE_FOLDER, "images/nav/folder.png");
registerContentTypeIcon(TYPE_DOCUMENT, "images/nav/page.png");
registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -34,8 +34,8 @@
public GalleryClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(NAME, i18n.t("gallery"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+ final ContentCapabilitiesRegistry cntCapabReg) {
+ super(NAME, i18n.t("gallery"), toolSelector, wsThemePresenter, ws, cntCapabReg);
// registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerAuthorableTypes(TYPE_UPLOADEDFILE);
@@ -54,7 +54,7 @@
return NAME;
}
- protected void registerIcons() {
+ private void registerIcons() {
registerContentTypeIcon(TYPE_ALBUM, "images/nav/gallery.png");
registerUploadTypesAndMimes(TYPE_UPLOADEDFILE);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/AbstractAction.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -62,7 +62,7 @@
/**
* store
*/
- private final HashMap<String, Object> store = new HashMap<String, Object>();
+ private HashMap<String, Object> store = new HashMap<String, Object>();
/**
* Creates a new action with no properties set.
@@ -72,6 +72,15 @@
}
/**
+ * Copy constructor used as a substitute of clone
+ */
+ @SuppressWarnings("unchecked")
+ public AbstractAction(final AbstractAction action) {
+ enabled = action.enabled;
+ store = (HashMap<String, Object>) action.store.clone();
+ }
+
+ /**
* Creates a new action with the specified name. The name is stored as a
* property with the key {@link Action#NAME}, and no other properties are
* initialised.
@@ -80,6 +89,7 @@
* the name (<code>null</code> permitted).
*/
public AbstractAction(final String name) {
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 15:19
putValue(NAME, name);
}
@@ -95,7 +105,9 @@
* the icon (<code>null</code> permitted).
*/
public AbstractAction(final String name, final ImageResource icon) {
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 15:19
putValue(NAME, name);
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 15:19
putValue(SMALL_ICON, icon);
}
@@ -181,7 +193,7 @@
* the value (<code>null</code> permitted).
*/
public void putValue(final String key, final Object value) {
- Object old = getValue(key);
+ final Object old = getValue(key);
if ((old == null && value != null) || (old != null && !old.equals(value))) {
store.put(key, value);
firePropertyChange(key, old, value);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -123,7 +123,7 @@
public ActionDescriptor(final AccessRolDTO accessRolDTO, final Listener0 onPerformCall) {
this(accessRolDTO, new Listener<T>() {
- public void onEvent(T parameter) {
+ public void onEvent(final T parameter) {
onPerformCall.onEvent();
}
});
@@ -141,21 +141,49 @@
this.enableCondition = enableCondition;
}
- public ActionDescriptor(ActionDescriptor<T> copy) {
+ public ActionDescriptor(final ActionDescriptor<T> copy) {
this(copy.getAccessRol(), copy.getOnPerformCall());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setAddCondition(copy.getAddCondition());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:22
setConfirmationText(copy.getConfirmationText());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:22
setConfirmationTitle(copy.getConfirmationTitle());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setEnableCondition(copy.getEnableCondition());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setIconCls(copy.getIconCls());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setIconDescriptor(copy.getIconDescriptor());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setIconUrl(copy.getIconUrl());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setMustBeAuthenticated(copy.mustBeAuthenticated());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setMustBeConfirmed(copy.mustBeConfirmed());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setOnNotConfirmed(copy.getOnNotConfirmed());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setPosition(copy.getPosition());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setShortcut(copy.getShortcut());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setTextDescription(copy.getTextDescription());
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 15:21
setToolTip(copy.getToolTip());
}
@@ -280,7 +308,7 @@
return shortcut != null;
}
- public boolean mustBeAdded(T item) {
+ public boolean mustBeAdded(final T item) {
return addCondition != null ? addCondition.mustBeAdded(item) : true;
}
@@ -302,7 +330,7 @@
return mustBeConfirmed;
}
- public boolean mustBeEnabled(T item) {
+ public boolean mustBeEnabled(final T item) {
return enableCondition != null ? enableCondition.mustBeEnabled(item) : true;
}
@@ -356,7 +384,7 @@
this.enableCondition = enableCondition;
}
- public void setIconCls(String iconCls) {
+ public void setIconCls(final String iconCls) {
this.iconCls = iconCls;
}
@@ -386,7 +414,7 @@
* @param id
* the new id
*/
- public void setId(String id) {
+ public void setId(final String id) {
this.id = id;
}
@@ -415,11 +443,11 @@
*
* @param position
*/
- public void setPosition(int position) {
+ public void setPosition(final int position) {
this.position = position;
}
- public void setShortcut(ShortcutDescriptor shortcut) {
+ public void setShortcut(final ShortcutDescriptor shortcut) {
this.shortcut = shortcut;
}
@@ -463,7 +491,7 @@
return textDescription;
}
- private void setOnNotConfirmed(Listener<T> onNotConfirmed) {
+ private void setOnNotConfirmed(final Listener<T> onNotConfirmed) {
this.onNotConfirmed = onNotConfirmed;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMap.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -81,6 +81,7 @@
*
* @return an array of keys
*/
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:03
public Object[] allKeys() {
Set<Object> set = new HashSet<Object>();
@@ -134,6 +135,7 @@
*
* @return an array of keys
*/
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:03
public Object[] keys() {
if (size() != 0) {
return actionMap.keySet().toArray();
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionMenuItemDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -29,9 +29,4 @@
super(accessRolDTO, onPerformCall);
}
- public ActionMenuItemDescriptor(final AccessRolDTO accessRolDTO, final Listener<T> onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, onPerformCall, enableCondition);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonAndItemDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,20 +32,8 @@
}
public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
- public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) {
super(accessRolDTO, actionToolbarPosition, onPerformCall);
}
- public ActionToolbarButtonAndItemDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarButtonDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -63,10 +63,6 @@
super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
}
- public ActionToolbarButtonDescriptor(ActionDescriptor<T> copy) {
- super(copy);
- }
-
public ActionToolbarButtonSeparator getLeftSeparator() {
return leftSeparator;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -64,13 +64,13 @@
this.actionToolbarPosition = actionToolbarPosition;
}
- public ActionToolbarDescriptor(ActionDescriptor<T> copy) {
+ public ActionToolbarDescriptor(final ActionDescriptor<T> copy) {
super(copy);
}
- public ActionToolbarDescriptor(ActionToolbarDescriptor<T> copy) {
+ public ActionToolbarDescriptor(final ActionToolbarDescriptor<T> copy) {
super(copy);
- setActionPosition(copy.getActionPosition());
+ this.actionToolbarPosition = copy.getActionPosition();
}
public ActionToolbarPosition getActionPosition() {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuAndItemDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,20 +32,8 @@
}
public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
- public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) {
super(accessRolDTO, actionToolbarPosition, onPerformCall);
}
- public ActionToolbarMenuAndItemDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuCheckItemDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,25 +21,19 @@
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import com.calclab.suco.client.events.Listener;
import com.calclab.suco.client.events.Listener0;
public class ActionToolbarMenuCheckItemDescriptor<T> extends ActionToolbarMenuDescriptor<T> {
private final ActionCheckedCondition mustBeChecked;
- public ActionToolbarMenuCheckItemDescriptor(AccessRolDTO accessRol, ActionToolbarPosition toolbarPosition,
- Listener<T> onPerformCall, ActionCheckedCondition mustBeChecked) {
+ public ActionToolbarMenuCheckItemDescriptor(final AccessRolDTO accessRol,
+ final ActionToolbarPosition toolbarPosition, final Listener0 onPerformCall,
+ final ActionCheckedCondition mustBeChecked) {
super(accessRol, toolbarPosition, onPerformCall);
this.mustBeChecked = mustBeChecked;
}
- public ActionToolbarMenuCheckItemDescriptor(AccessRolDTO accessRol, ActionToolbarPosition toolbarPosition,
- Listener0 onPerformCall, ActionCheckedCondition mustBeChecked) {
- super(accessRol, toolbarPosition, onPerformCall);
- this.mustBeChecked = mustBeChecked;
- }
-
public ActionCheckedCondition getMustBeChecked() {
return mustBeChecked;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -42,12 +42,6 @@
public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionAddCondition<T> addCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition);
- }
-
- public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
final ActionEnableCondition<T> enableCondition) {
super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
}
@@ -59,17 +53,11 @@
public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionAddCondition<T> addCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition);
- }
-
- public ActionToolbarMenuDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
final ActionEnableCondition<T> enableCondition) {
super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
}
- public ActionToolbarMenuDescriptor(ActionDescriptor<T> copy) {
+ public ActionToolbarMenuDescriptor(final ActionDescriptor<T> copy) {
super(copy);
}
@@ -101,11 +89,11 @@
return topSeparator;
}
- public void setBottomSeparator(boolean bottomSeparator) {
+ public void setBottomSeparator(final boolean bottomSeparator) {
this.bottomSeparator = bottomSeparator;
}
- public void setParentMenuIconCls(String parentMenuIconCls) {
+ public void setParentMenuIconCls(final String parentMenuIconCls) {
this.parentMenuIconCls = parentMenuIconCls;
}
@@ -117,7 +105,7 @@
this.parentMenuTitle = parentMenuTitle;
}
- public void setParentMenuTooltip(String parentMenuTooltip) {
+ public void setParentMenuTooltip(final String parentMenuTooltip) {
this.parentMenuTooltip = parentMenuTooltip;
}
@@ -128,7 +116,7 @@
this.parentSubMenuTitle = parentSubMenuTitle;
}
- public void setTopSeparator(boolean topSeparator) {
+ public void setTopSeparator(final boolean topSeparator) {
this.topSeparator = topSeparator;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -22,26 +22,18 @@
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
import com.calclab.suco.client.events.Listener;
-import com.calclab.suco.client.events.Listener0;
public class ActionToolbarMenuRadioDescriptor<T> extends ActionToolbarMenuDescriptor<T> {
private final String group;
private final RadioMustBeChecked mustBeChecked;
- public ActionToolbarMenuRadioDescriptor(AccessRolDTO accessRol, ActionToolbarPosition toolbarPosition,
- Listener<T> onPerformCall, String group, RadioMustBeChecked mustBeChecked) {
+ public ActionToolbarMenuRadioDescriptor(final AccessRolDTO accessRol, final ActionToolbarPosition toolbarPosition,
+ final Listener<T> onPerformCall, final String group, final RadioMustBeChecked mustBeChecked) {
super(accessRol, toolbarPosition, onPerformCall);
this.group = group;
this.mustBeChecked = mustBeChecked;
}
- public ActionToolbarMenuRadioDescriptor(AccessRolDTO accessRol, ActionToolbarPosition toolbarPosition,
- Listener0 onPerformCall, String group, RadioMustBeChecked mustBeChecked) {
- super(accessRol, toolbarPosition, onPerformCall);
- this.group = group;
- this.mustBeChecked = mustBeChecked;
- }
-
public String getGroup() {
return group;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarPushButtonDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -2,52 +2,22 @@
import org.ourproject.kune.platf.client.dto.AccessRolDTO;
-import com.calclab.suco.client.events.Listener;
import com.calclab.suco.client.events.Listener0;
public class ActionToolbarPushButtonDescriptor<T> extends ActionToolbarButtonDescriptor<T> {
- ActionPressedCondition<T> mustInitialyPressed;
+ private ActionPressedCondition<T> mustInitialyPressed;
public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall);
- }
-
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionAddCondition<T> addCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition);
- }
-
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener<T> onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall) {
super(accessRolDTO, actionToolbarPosition, onPerformCall);
}
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionAddCondition<T> addCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, addCondition);
- }
-
- public ActionToolbarPushButtonDescriptor(final AccessRolDTO accessRolDTO,
- final ActionToolbarPosition actionToolbarPosition, final Listener0 onPerformCall,
- final ActionEnableCondition<T> enableCondition) {
- super(accessRolDTO, actionToolbarPosition, onPerformCall, enableCondition);
- }
-
public ActionPressedCondition<T> getMustInitialyPressed() {
return mustInitialyPressed;
}
- public void setMustInitialyPressed(ActionPressedCondition<T> mustInitialyPressed) {
+ public void setMustInitialyPressed(final ActionPressedCondition<T> mustInitialyPressed) {
this.mustInitialyPressed = mustInitialyPressed;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/InputMap.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -158,6 +158,7 @@
*
* @return An array of keys (may be <code>null</code> or have zero length).
*/
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:33
public KeyStroke[] keys() {
if (inputMap != null) {
KeyStroke[] array = new KeyStroke[size()];
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/KeyStroke.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -73,7 +73,7 @@
* under the assumption that garbage collection of a new keystroke is easy
* when we find the old one that it matches in the cache.
*/
- private static final HashMap<KeyStroke, KeyStroke> cache = new HashMap<KeyStroke, KeyStroke>();
+ private static final HashMap<KeyStroke, KeyStroke> CACHE = new HashMap<KeyStroke, KeyStroke>();
/** The most recently generated keystroke, or null. */
private static KeyStroke recent;
@@ -84,7 +84,7 @@
*
* @see #getKeyStroke(String)
*/
- static final HashMap<String, Object> vktable = new HashMap<String, Object>();
+ static final HashMap<String, Object> VKTABLE = new HashMap<String, Object>();
private static final int VK_UNDEFINED = 0;
private static final char CHAR_UNDEFINED = '\uffff';
@@ -207,9 +207,9 @@
}
stroke = new KeyStroke(keyChar, keyCode, modifiers, release);
// Check level 1 cache.
- KeyStroke cached = cache.get(stroke);
+ KeyStroke cached = CACHE.get(stroke);
if (cached == null) {
- cache.put(stroke, stroke);
+ CACHE.put(stroke, stroke);
} else {
stroke = cached;
}
@@ -503,11 +503,11 @@
* @return a cached replacement if something goes wrong
*/
protected Object readResolve() {
- KeyStroke s = cache.get(this);
+ KeyStroke s = CACHE.get(this);
if (s != null) {
return s;
}
- cache.put(this, this);
+ CACHE.put(this, this);
return this;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/PropertyChangeSupport.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -96,6 +96,7 @@
public PropertyChangeSupport(final Object source) {
this.source = source;
if (source == null) {
+ // @PMD:REVIEWED:AvoidThrowingNullPointerException: by vjrj on 21/05/09 14:12
throw new NullPointerException();
}
}
@@ -148,6 +149,7 @@
* @throws NullPointerException
* if propertyName is null
*/
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:12
public void addPropertyChangeListener(final String propertyName, PropertyChangeListener l) {
if (l == null) {
return;
@@ -410,6 +412,7 @@
* @throws NullPointerException
* if propertyName is null
*/
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:12
public void removePropertyChangeListener(final String propertyName, PropertyChangeListener l) {
if (children == null) {
return;
Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/CheckButton.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,5 @@
+package org.ourproject.kune.platf.client.actions.ui;
+
+public class CheckButton {
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ui/TestButton.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,6 +21,11 @@
}
NotifyUser.info("Button clicked");
}
+
+ @Override
+ public boolean isEnabled() {
+ return super.isEnabled();
+ }
}
public TestButton(final WorkspaceSkeleton ws) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/AccessRightsDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -22,18 +22,19 @@
import com.google.gwt.user.client.rpc.IsSerializable;
public class AccessRightsDTO implements IsSerializable {
- private boolean isAdministrable;
- private boolean isEditable;
- private boolean isVisible;
+ private boolean administrable;
+ private boolean editable;
+ private boolean visible;
+ private static final int PRIME = 31;
public AccessRightsDTO() {
this(false, false, false);
}
public AccessRightsDTO(final boolean isAdministrable, final boolean isEditable, final boolean isVisible) {
- this.isAdministrable = isAdministrable;
- this.isEditable = isEditable;
- this.isVisible = isVisible;
+ this.administrable = isAdministrable;
+ this.editable = isEditable;
+ this.visible = isVisible;
}
@Override
@@ -45,13 +46,13 @@
return false;
}
final AccessRightsDTO other = (AccessRightsDTO) obj;
- if (isAdministrable != other.isAdministrable) {
+ if (administrable != other.administrable) {
return false;
}
- if (isEditable != other.isEditable) {
+ if (editable != other.editable) {
return false;
}
- if (isVisible != other.isVisible) {
+ if (visible != other.visible) {
return false;
}
return true;
@@ -59,40 +60,39 @@
@Override
public int hashCode() {
- final int prime = 31;
int result = 1;
- result = prime * result + (isAdministrable ? 1231 : 1237);
- result = prime * result + (isEditable ? 1231 : 1237);
- result = prime * result + (isVisible ? 1231 : 1237);
+ result = PRIME * result + (administrable ? 1231 : 1237);
+ result = PRIME * result + (editable ? 1231 : 1237);
+ result = PRIME * result + (visible ? 1231 : 1237);
return result;
}
public boolean isAdministrable() {
- return isAdministrable;
+ return administrable;
}
public boolean isEditable() {
- return isEditable;
+ return editable;
}
public boolean isVisible() {
- return isVisible;
+ return visible;
}
- public void setAdministrable(final boolean isAdministrable) {
- this.isAdministrable = isAdministrable;
+ public void setAdministrable(final boolean administrable) {
+ this.administrable = administrable;
}
- public void setEditable(final boolean isEditable) {
- this.isEditable = isEditable;
+ public void setEditable(final boolean editable) {
+ this.editable = editable;
}
- public void setVisible(final boolean isVisible) {
- this.isVisible = isVisible;
+ public void setVisible(final boolean visible) {
+ this.visible = visible;
}
@Override
public String toString() {
- return "AccessRightsDTO[a: " + isAdministrable + ", e: " + isEditable + ", v: " + isVisible + "]";
+ return "AccessRightsDTO[a: " + administrable + ", e: " + editable + ", v: " + visible + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContainerSimpleDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContainerSimpleDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/ContainerSimpleDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,9 +32,6 @@
private StateToken stateToken;
private Long parentFolderId;
- public ContainerSimpleDTO() {
- }
-
public Long getId() {
return id;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/I18nCountryDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/I18nCountryDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/I18nCountryDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -43,7 +43,7 @@
this.code = code;
}
- public void setDateFormat(String dateFormat) {
+ public void setDateFormat(final String dateFormat) {
this.dateFormat = dateFormat;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/SocialNetworkDataDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -36,10 +36,10 @@
this(null, null, null, null, null, null, false, false);
}
- public SocialNetworkDataDTO(SocialNetworkVisibilityDTO socialNetworkVisibility,
+ public SocialNetworkDataDTO(final SocialNetworkVisibilityDTO socialNetworkVisibility,
final SocialNetworkDTO groupMembers, final ParticipationDataDTO userParticipation,
- UserBuddiesVisibilityDTO userBuddiesVisibility, final UserBuddiesDataDTO userBuddies,
- AccessRightsDTO groupRights, boolean isBuddiesVisible, boolean isMembersVisible) {
+ final UserBuddiesVisibilityDTO userBuddiesVisibility, final UserBuddiesDataDTO userBuddies,
+ final AccessRightsDTO groupRights, final boolean isBuddiesVisible, final boolean isMembersVisible) {
this.socialNetworkVisibility = socialNetworkVisibility;
this.groupMembers = groupMembers;
this.userParticipation = userParticipation;
@@ -90,7 +90,7 @@
return isMembersVisible;
}
- public void setBuddiesVisible(boolean isBuddiesVisible) {
+ public void setBuddiesVisible(final boolean isBuddiesVisible) {
this.isBuddiesVisible = isBuddiesVisible;
}
@@ -98,31 +98,31 @@
this.groupMembers = groupMembers;
}
- public void setGroupRights(AccessRightsDTO groupRights) {
+ public void setGroupRights(final AccessRightsDTO groupRights) {
this.groupRights = groupRights;
}
- public void setIsBuddiesVisible(boolean isBuddiesVisible) {
+ public void setIsBuddiesVisible(final boolean isBuddiesVisible) {
setBuddiesVisible(isBuddiesVisible);
}
- public void setIsMembersVisible(boolean isMembersVisible) {
+ public void setIsMembersVisible(final boolean isMembersVisible) {
setMembersVisible(isMembersVisible);
}
- public void setMembersVisible(boolean isMembersVisible) {
+ public void setMembersVisible(final boolean isMembersVisible) {
this.isMembersVisible = isMembersVisible;
}
- public void setSocialNetworkVisibility(SocialNetworkVisibilityDTO socialNetworkVisibilityDTO) {
+ public void setSocialNetworkVisibility(final SocialNetworkVisibilityDTO socialNetworkVisibilityDTO) {
this.socialNetworkVisibility = socialNetworkVisibilityDTO;
}
- public void setUserBuddies(UserBuddiesDataDTO userBuddies) {
+ public void setUserBuddies(final UserBuddiesDataDTO userBuddies) {
this.userBuddies = userBuddies;
}
- public void setUserBuddiesVisibility(UserBuddiesVisibilityDTO userBuddiesVisibilityDTO) {
+ public void setUserBuddiesVisibility(final UserBuddiesVisibilityDTO userBuddiesVisibilityDTO) {
this.userBuddiesVisibility = userBuddiesVisibilityDTO;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateToken.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,9 +35,9 @@
*/
public class StateToken implements IsSerializable {
public static final String SEPARATOR = ".";
- private static final String[] EMPTY = new String[0];
+ private static final String[] EMPTYA = new String[0];
- public static String encode(final String group, final String tool, final String folder, final String document) {
+ private static String encode(final String group, final String tool, final String folder, final String document) {
String encoded = "";
if (group != null) {
encoded += group;
@@ -57,7 +57,6 @@
private String group;
private String tool;
private String folder;
-
private String document;
private String encoded;
@@ -70,7 +69,7 @@
parse(encoded);
}
- public StateToken(final String group, final String tool) {
+ public StateToken(final String group, final String tool) { // NO_UCD
this(group, tool, null, null);
}
@@ -79,22 +78,22 @@
}
public StateToken(final String group, final String tool, final String folder, final String document) {
- this.setGroup(group);
- this.setTool(tool);
- this.setFolder(folder);
- this.setDocument(document);
- encoded = null;
+ this.group = group;
+ this.tool = tool;
+ this.folder = folder;
+ this.document = document;
+ resetEncoded();
}
public StateToken clearDocument() {
this.document = null;
- encoded = null;
+ resetEncoded();
return this;
}
- public StateToken clearFolder() {
+ public StateToken clearFolder() { // NO_UCD
this.folder = null;
- encoded = null;
+ resetEncoded();
return this;
}
@@ -170,10 +169,11 @@
}
public boolean hasSameContainer(final StateToken currentStateToken) {
+ boolean same = false;
if (copy().clearDocument().getEncoded().equals(currentStateToken.copy().clearDocument().getEncoded())) {
- return true;
+ same = true;
}
- return false;
+ return same;
}
public boolean isComplete() {
@@ -182,13 +182,13 @@
public StateToken setDocument(final Long document) {
this.document = document == null ? null : document.toString();
- encoded = null;
+ resetEncoded();
return this;
}
public StateToken setDocument(final String document) {
this.document = document;
- encoded = null;
+ resetEncoded();
return this;
}
@@ -198,25 +198,25 @@
public StateToken setFolder(final Long folder) {
this.folder = folder == null ? null : folder.toString();
- encoded = null;
+ resetEncoded();
return this;
}
- public StateToken setFolder(final String folder) {
+ public StateToken setFolder(final String folder) { // NO_UCD
this.folder = folder;
- encoded = null;
+ resetEncoded();
return this;
}
- public StateToken setGroup(final String group) {
+ public StateToken setGroup(final String group) { // NO_UCD
this.group = group;
- encoded = null;
+ resetEncoded();
return this;
}
- public StateToken setTool(final String tool) {
+ public StateToken setTool(final String tool) { // NO_UCD
this.tool = tool;
- encoded = null;
+ resetEncoded();
return this;
}
@@ -238,11 +238,16 @@
if (encoded != null && encoded.length() > 0) {
splitted = encoded.split("\\.");
} else {
- splitted = EMPTY;
+ splitted = EMPTYA;
}
- setGroup(conditionalAssign(0, splitted));
- setTool(conditionalAssign(1, splitted));
- setFolder(conditionalAssign(2, splitted));
- setDocument(conditionalAssign(3, splitted));
+ group = conditionalAssign(0, splitted);
+ tool = conditionalAssign(1, splitted);
+ folder = conditionalAssign(2, splitted);
+ document = conditionalAssign(3, splitted);
+ resetEncoded();
}
+
+ private void resetEncoded() {
+ encoded = null;
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateTokenUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateTokenUtils.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/StateTokenUtils.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -5,6 +5,7 @@
public class StateTokenUtils {
private final Session session;
+ private static final String SEPARATOR = ".";
public StateTokenUtils(final Session session) {
this.session = session;
@@ -12,12 +13,11 @@
public String getPublicUrl(final StateToken token) {
String publicUrl = "";
- String separator = ".";
- String group = token.getGroup();
- String tool = token.getTool();
- String folder = token.getFolder();
- String document = token.getDocument();
+ final String group = token.getGroup();
+ final String tool = token.getTool();
+ final String folder = token.getFolder();
+ final String document = token.getDocument();
publicUrl += session.getSiteUrl() + "/public";
@@ -25,13 +25,13 @@
publicUrl += "/" + group;
}
if (tool != null) {
- publicUrl += separator + tool;
+ publicUrl += SEPARATOR + tool;
}
if (folder != null) {
- publicUrl += separator + folder;
+ publicUrl += SEPARATOR + folder;
}
if (document != null) {
- publicUrl += separator + document;
+ publicUrl += SEPARATOR + document;
}
return publicUrl;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesDataDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesDataDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserBuddiesDataDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,17 +26,17 @@
public class UserBuddiesDataDTO implements IsSerializable {
- public static UserBuddiesDataDTO NO_BUDDIES = new UserBuddiesDataDTO();
+ public static final UserBuddiesDataDTO NO_BUDDIES = new UserBuddiesDataDTO();
private List<UserSimpleDTO> buddies;
- int otherExternalBuddies;
+ private int otherExtBuddies;
public UserBuddiesDataDTO() {
buddies = new ArrayList<UserSimpleDTO>();
- otherExternalBuddies = 0;
+ otherExtBuddies = 0;
}
- public boolean contains(String shortName) {
+ public boolean contains(final String shortName) {
for (UserSimpleDTO buddie : buddies) {
if (buddie.getShortName().equals(shortName)) {
return true;
@@ -49,20 +49,20 @@
return buddies;
}
- public int getOtherExternalBuddies() {
- return otherExternalBuddies;
+ public int getOtherExtBuddies() {
+ return otherExtBuddies;
}
- public void setBuddies(List<UserSimpleDTO> buddies) {
+ public void setBuddies(final List<UserSimpleDTO> buddies) {
this.buddies = buddies;
}
- public void setOtherExternalBuddies(int otherExternalBuddies) {
- this.otherExternalBuddies = otherExternalBuddies;
+ public void setOtherExtBuddies(final int otherExternalBuddies) {
+ this.otherExtBuddies = otherExternalBuddies;
}
@Override
public String toString() {
- return "UserBuddiesDataDTO[ext: " + otherExternalBuddies + " / int: " + buddies + "]";
+ return "UserBuddiesDataDTO[ext: " + otherExtBuddies + " / int: " + buddies + "]";
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/dto/UserSimpleDTO.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -119,7 +119,7 @@
this.country = country;
}
- public void setHasLogo(boolean hasLogo) {
+ public void setHasLogo(final boolean hasLogo) {
this.hasLogo = hasLogo;
}
@@ -139,7 +139,7 @@
this.shortName = shortName;
}
- public void setStateToken(StateToken stateToken) {
+ public void setStateToken(final StateToken stateToken) {
this.stateToken = stateToken;
}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/errors/UIException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/errors/UIException.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/errors/UIException.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,43 @@
+/*
+ *
+ * Copyright (C) 2007-2009 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.platf.client.errors;
+
+import com.allen_sauer.gwt.log.client.Log;
+
+public class UIException extends RuntimeException {
+
+ private static final long serialVersionUID = -1327164226202923181L;
+
+ public UIException(final String text) {
+ super(text);
+ Log.error(text);
+ }
+
+ public UIException(final String text, final Throwable cause) {
+ super(text, cause);
+ Log.error(text, cause);
+ }
+
+ public UIException(final Throwable cause) {
+ super(cause);
+ Log.error("UIException", cause);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nTranslationService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nTranslationService.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/i18n/I18nTranslationService.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -19,7 +19,6 @@
*/
package org.ourproject.kune.platf.client.i18n;
-
public abstract class I18nTranslationService {
protected static final String TRANSLATION_NOTE_REGEXP = " (\\[)%NT (.*)(\\])$";
protected static final String NOTE_FOR_TRANSLATOR_TAG_BEGIN = " [%NT ";
@@ -48,14 +47,14 @@
* @param text
* @return text translated in the current language
*/
- public String t(final String text) {
- return null;
- }
+ // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:49
+ public abstract String t(final String text);
/**
* Use [%d] to reference the Integer parameters
*
*/
+ // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:50
public String t(final String text, final Integer... args) {
String translation = t(text);
for (Integer arg : args) {
@@ -68,6 +67,7 @@
* Use [%d] to reference the Long parameter
*
*/
+ // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:50
public String t(final String text, final Long... args) {
String translation = t(text);
for (Long arg : args) {
@@ -80,6 +80,7 @@
* Use [%s] to reference the string parameter
*
*/
+ // @PMD:REVIEWED:ShortMethodName: by vjrj on 21/05/09 13:50
public String t(final String text, final String... args) {
String translation = t(text);
for (String arg : args) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/ErrorHandler.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/ErrorHandler.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/ErrorHandler.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -66,65 +66,63 @@
public void process(final Throwable caught) {
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final AccessViolationException e) {
- logException(e);
+ if (caught instanceof AccessViolationException) {
+ logException(caught);
NotifyUser.error(i18n.t("You do not have rights to perform that action"));
- } catch (final SessionExpiredException e) {
- logException(e);
+ } else if (caught instanceof SessionExpiredException) {
+ logException(caught);
doSessionExpired();
- } catch (final UserMustBeLoggedException e) {
- logException(e);
+ } else if (caught instanceof UserMustBeLoggedException) {
+ logException(caught);
if (session.isLogged()) {
doSessionExpired();
} else {
NotifyUser.important(i18n.t("Please sign in or register to collaborate"));
}
- } catch (final GroupNotFoundException e) {
- logException(e);
+ } else if (caught instanceof GroupNotFoundException) {
+ logException(caught);
NotifyUser.veryImportant(i18n.t("Group not found"));
stateManagerProvider.get().gotoToken("");
- } catch (final IncompatibleRemoteServiceException e) {
+ } else if (caught instanceof IncompatibleRemoteServiceException) {
NotifyUser.error(i18n.t("Your browser is outdated with the server software. Please reload this page."));
- } catch (final ContentNotFoundException e) {
- logException(e);
+ } else if (caught instanceof ContentNotFoundException) {
+ logException(caught);
NotifyUser.veryImportant(i18n.t("Content not found"));
stateManagerProvider.get().gotoToken("");
- } catch (final ContentNotPermittedException e) {
- logException(e);
+ } else if (caught instanceof ContentNotPermittedException) {
+ logException(caught);
NotifyUser.error(i18n.t("Action not permitted in this location"));
stateManagerProvider.get().gotoToken("");
- } catch (final ContainerNotPermittedException e) {
- logException(e);
+ } else if (caught instanceof ContainerNotPermittedException) {
+ logException(caught);
NotifyUser.error(i18n.t("Action not permitted in this location"));
stateManagerProvider.get().gotoToken("");
- } catch (final LastAdminInGroupException e) {
- logException(e);
+ } else if (caught instanceof LastAdminInGroupException) {
+ logException(caught);
NotifyUser.showAlertMessage(i18n.t("Warning"), i18n.t("Sorry, you are the last admin of this group."
+ " Look for someone to substitute you appropriately as admin before leaving this group."));
- } catch (final AlreadyGroupMemberException e) {
- logException(e);
+ } else if (caught instanceof AlreadyGroupMemberException) {
+ logException(caught);
NotifyUser.error(i18n.t("This group is already a group member"));
- } catch (final AlreadyUserMemberException e) {
- logException(e);
+ } else if (caught instanceof AlreadyUserMemberException) {
+ logException(caught);
NotifyUser.error(i18n.t("This user is already a group member"));
- } catch (final Throwable e) {
- logException(e, true);
+ } else {
+ logException(caught, true);
NotifyUser.error(i18n.t("Error performing operation"));
- GWT.log("Other kind of exception in StateManagerDefault/processErrorException", null);
+ GWT.log("Other kind of exception in StateManagerDefault/processErrorException", caught);
}
}
- private void logException(final Throwable e) {
- logException(e, false);
+ private void logException(final Throwable caught) {
+ logException(caught, false);
}
- private void logException(final Throwable e, final boolean showException) {
+ private void logException(final Throwable caught, final boolean showException) {
if (showException) {
- Log.debug("Exception in KuneErrorHandler", e);
+ Log.debug("Exception in KuneErrorHandler", caught);
} else {
- Log.debug("Exception in KuneErrorHandler: " + e.getMessage());
+ Log.debug("Exception in KuneErrorHandler: " + caught.getMessage());
}
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationService.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationService.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,6 +0,0 @@
-package org.ourproject.kune.platf.client.services;
-
- at Deprecated
-public class I18nTranslationService extends org.ourproject.kune.platf.client.i18n.I18nTranslationService {
-
-}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/I18nTranslationServiceMocked.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,12 +0,0 @@
-package org.ourproject.kune.platf.client.services;
-
-import org.ourproject.kune.platf.client.ui.TextUtils;
-
- at Deprecated
-public class I18nTranslationServiceMocked extends I18nTranslationService {
- public String t(final String text) {
- String encodeText = TextUtils.escapeHtmlLight(text);
- String translation = removeNT(encodeText);
- return decodeHtml(translation);
- }
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/PlatformModule.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -538,7 +538,7 @@
$(ApplicationComponentGroup.class).createAll();
$(ToolGroup.class).createAll();
$(Application.class).start();
- // $(HelloWorld.class);
+ //$(HelloWorld.class);
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/shortcuts/ShortcutDescriptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -8,7 +8,7 @@
private static final String NO_KEYNAME = "nokeyname";
- private static boolean has(int modifiers, int modifier) {
+ private static boolean has(final int modifiers, final int modifier) {
return ((modifiers & modifier) == modifier);
}
@@ -18,46 +18,51 @@
private final int keycode;
private final String keyName;
- public ShortcutDescriptor(boolean ctrl, boolean alt, boolean shift, int key) {
+ public ShortcutDescriptor(final boolean ctrl, final boolean alt, final boolean shift, final int key) {
this(ctrl, alt, shift, key, NO_KEYNAME);
}
- public ShortcutDescriptor(boolean ctrl, boolean alt, boolean shift, int key, String keyName) {
+ public ShortcutDescriptor(final boolean ctrl, final boolean alt, final boolean shift, final int key,
+ final String keyName) {
this.alt = alt;
this.ctrl = ctrl;
this.shift = shift;
this.keycode = key;
- this.keyName = keyName;
+ if (keyName == null) {
+ this.keyName = NO_KEYNAME;
+ } else {
+ this.keyName = keyName;
+ }
}
- public ShortcutDescriptor(boolean ctrl, boolean shift, int key) {
+ public ShortcutDescriptor(final boolean ctrl, final boolean shift, final int key) {
this(ctrl, false, shift, key, NO_KEYNAME);
}
- public ShortcutDescriptor(boolean ctrl, boolean shift, int key, String keyName) {
+ public ShortcutDescriptor(final boolean ctrl, final boolean shift, final int key, final String keyName) {
this(ctrl, false, shift, key, keyName);
}
- public ShortcutDescriptor(boolean ctrl, int key) {
+ public ShortcutDescriptor(final boolean ctrl, final int key) {
this(ctrl, false, false, key, NO_KEYNAME);
}
- public ShortcutDescriptor(boolean ctrl, int keycode, String keyName) {
+ public ShortcutDescriptor(final boolean ctrl, final int keycode, final String keyName) {
this(ctrl, false, false, keycode, keyName);
}
- public ShortcutDescriptor(int keycode, int modifiers) {
+ public ShortcutDescriptor(final int keycode, final int modifiers) {
this(has(modifiers, KeyboardListener.MODIFIER_CTRL), has(modifiers, KeyboardListener.MODIFIER_ALT), has(
modifiers, KeyboardListener.MODIFIER_SHIFT), keycode, NO_KEYNAME);
}
- public ShortcutDescriptor(int keycode, int modifiers, String keyName) {
+ public ShortcutDescriptor(final int keycode, final int modifiers, final String keyName) {
this(has(modifiers, KeyboardListener.MODIFIER_CTRL), has(modifiers, KeyboardListener.MODIFIER_ALT), has(
modifiers, KeyboardListener.MODIFIER_SHIFT), keycode, keyName);
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
@@ -94,13 +99,13 @@
return result;
}
- public boolean is(char keyCode, int modifiers) {
+ public boolean is(final char keyCode, final int modifiers) {
return (keyCode == keyCode && same(modifiers, KeyboardListener.MODIFIER_ALT, alt)
&& same(modifiers, KeyboardListener.MODIFIER_CTRL, ctrl) && same(modifiers,
KeyboardListener.MODIFIER_SHIFT, shift));
}
- public boolean same(int modifiers, int modifier, boolean keyValue) {
+ public boolean same(final int modifiers, final int modifier, final boolean keyValue) {
return (has(modifiers, modifier) == keyValue);
}
@@ -114,11 +119,11 @@
return s;
}
- private String sKey(boolean key, String specialKeyName) {
+ private String sKey(final boolean key, final String specialKeyName) {
return key ? translateKey(specialKeyName) + "+" : "";
}
- private String translateKey(String keyNameToTranslate) {
+ private String translateKey(final String keyNameToTranslate) {
return Resources.i18n.tWithNT(keyNameToTranslate, "The '" + keyNameToTranslate + "' keyboard key");
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/Session.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -129,6 +129,8 @@
boolean isLogged();
+ boolean isNotLogged();
+
void onInitDataReceived(Listener<InitDataDTO> listener);
void onUserSignIn(Listener<UserInfoDTO> listener);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/state/SessionDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -46,7 +46,7 @@
public class SessionDefault implements Session {
private String userHash;
- InitDataDTO initData;
+ private InitDataDTO initData;
private UserInfoDTO currentUserInfo;
private Object[][] languagesArray;
private Object[][] countriesArray;
@@ -201,6 +201,10 @@
return userHash != null;
}
+ public boolean isNotLogged() {
+ return !isLogged();
+ }
+
public void onInitDataReceived(final Listener<InitDataDTO> listener) {
onInitDataReceived.add(listener);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -37,55 +37,56 @@
*
*/
public class DropDownPanel extends Composite implements ClickListener {
- private final VerticalPanel vp;
- private final HorizontalPanel titleHP;
- private final Label titleLabel;
- private final SimplePanel contentPanel;
- private final Images img;
- private final Image arrowImage;
- private final RoundedPanel outerBorder;
- private String stylePrimaryName;
+ private transient final VerticalPanel vpanel;
+ private transient final HorizontalPanel titleHP;
+ private transient final Label titleLabel;
+ private transient final SimplePanel contentPanel;
+ private transient final Images img;
+ private transient final Image arrowImage;
+ private transient final RoundedPanel outerBorder;
+ private transient String stylePrimaryName;
- public DropDownPanel(Images img) {
+ public DropDownPanel(final Images img) {
+ super();
this.img = img;
- vp = new VerticalPanel();
- outerBorder = new RoundedPanel(vp, RoundedPanel.ALL);
+ vpanel = new VerticalPanel();
+ outerBorder = new RoundedPanel(vpanel, RoundedPanel.ALL);
titleHP = new HorizontalPanel();
arrowImage = new Image();
titleLabel = new Label();
contentPanel = new SimplePanel();
initWidget(outerBorder);
- vp.add(titleHP);
- vp.add(contentPanel);
+ vpanel.add(titleHP);
+ vpanel.add(contentPanel);
titleHP.add(arrowImage);
titleHP.add(titleLabel);
this.stylePrimaryName = "k-dropdownouter";
outerBorder.setCornerStyleName(stylePrimaryName);
- vp.setStylePrimaryName(stylePrimaryName);
- vp.setWidth("100%");
- vp.setCellWidth(contentPanel, "100%");
- vp.setCellWidth(titleHP, "100%");
+ vpanel.setStylePrimaryName(stylePrimaryName);
+ vpanel.setWidth("100%");
+ vpanel.setCellWidth(contentPanel, "100%");
+ vpanel.setCellWidth(titleHP, "100%");
titleHP.setStylePrimaryName("k-dropdownlabel");
img.arrowDownWhite().applyTo(arrowImage);
titleLabel.setText("");
contentPanel.setStylePrimaryName("k-dropdowninner");
- setContentVisible(false);
+ setContentVisibleImpl(false);
arrowImage.addClickListener(this);
titleLabel.addClickListener(this);
}
- public DropDownPanel(Images img, final boolean visible) {
+ public DropDownPanel(final Images img, final boolean visible) {
this(img);
- setContentVisible(visible);
+ setContentVisibleImpl(visible);
}
- public DropDownPanel(Images img, final String headerText, final boolean visible) {
+ public DropDownPanel(final Images img, final String headerText, final boolean visible) {
this(img);
- setContentVisible(visible);
- setHeaderText(headerText);
+ setContentVisibleImpl(visible);
+ setHeaderTextImpl(headerText);
}
public boolean isContentVisible() {
@@ -93,7 +94,7 @@
}
public void onClick(final Widget sender) {
- if (sender == titleHP | sender == arrowImage | sender == titleLabel) {
+ if (sender.equals(titleHP) | sender.equals(arrowImage) | sender.equals(titleLabel)) {
setContentVisible(!isContentVisible());
}
}
@@ -101,7 +102,7 @@
public void setBorderStylePrimaryName(final String stylePrimaryName) {
this.stylePrimaryName = stylePrimaryName;
outerBorder.setCornerStyleName(stylePrimaryName);
- vp.setStylePrimaryName(stylePrimaryName);
+ vpanel.setStylePrimaryName(stylePrimaryName);
}
public void setContent(final Widget widget) {
@@ -115,18 +116,11 @@
}
public void setContentVisible(final boolean visible) {
- if (visible) {
- img.arrowDownWhite().applyTo(arrowImage);
- contentPanel.setVisible(true);
-
- } else {
- img.arrowRightWhite().applyTo(arrowImage);
- contentPanel.setVisible(false);
- }
+ setContentVisibleImpl(visible);
}
public void setHeaderText(final String text) {
- titleLabel.setText(text);
+ setHeaderTextImpl(text);
}
public void setHeaderTitle(final String title) {
@@ -144,13 +138,13 @@
public void setTheme(final String oldTheme, final String newTheme) {
if (oldTheme != null) {
// outerBorder.removeStyleDependentName(oldThemeS);
- vp.removeStyleDependentName(oldTheme);
+ vpanel.removeStyleDependentName(oldTheme);
titleHP.removeStyleDependentName(oldTheme);
contentPanel.removeStyleDependentName(oldTheme);
}
outerBorder.setCornerStyleName(stylePrimaryName + "-" + newTheme);
// outerBorder.addStyleDependentName(newThemeS);
- vp.addStyleDependentName(newTheme);
+ vpanel.addStyleDependentName(newTheme);
titleHP.addStyleDependentName(newTheme);
contentPanel.addStyleDependentName(newTheme);
}
@@ -161,4 +155,19 @@
outerBorder.setWidth(width);
}
+ private void setContentVisibleImpl(final boolean visible) {
+ if (visible) {
+ img.arrowDownWhite().applyTo(arrowImage);
+ contentPanel.setVisible(true);
+
+ } else {
+ img.arrowRightWhite().applyTo(arrowImage);
+ contentPanel.setVisible(false);
+ }
+ }
+
+ private void setHeaderTextImpl(final String text) {
+ titleLabel.setText(text);
+ }
+
}
Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/EditableIconLabel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,199 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2009 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.platf.client.ui;
-
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.MouseListenerAdapter;
-import com.google.gwt.user.client.ui.Widget;
-import com.gwtext.client.widgets.MessageBox;
-import com.gwtext.client.widgets.MessageBoxConfig;
-
- at Deprecated
-public class EditableIconLabel extends Composite {
-
- private boolean useDoubleClick;
- private ClickListener listener;
- private String currentText;
- private String oldText;
- private EditableClickListener editableListener;
- private MouseListenerAdapter mouseOverListener;
- private final AbstractLabel label;
- private String renameDialogTitle;
- private String renameDialogLabel;
- private String doubleClickToRenameLabel;
- private String clickToRenameLabel;
-
- public EditableIconLabel(final AbstractImagePrototype icon, final String text, final boolean useDoubleClick,
- final EditableClickListener editableListenerOrig) {
- label = new IconLabel(icon, text);
- init(text, useDoubleClick, editableListenerOrig);
- }
-
- public EditableIconLabel(final AbstractImagePrototype icon, final String text, final String targetHistoryToken,
- final boolean useDoubleClick, final EditableClickListener editableListenerOrig) {
- label = new IconHyperlink(icon, text, targetHistoryToken);
- init(text, useDoubleClick, editableListenerOrig);
- }
-
- public EditableIconLabel(final EditableClickListener editableListener) {
- this("", editableListener);
- }
-
- public EditableIconLabel(final String text, final boolean wordWrap, final boolean useDoubleClick,
- final EditableClickListener editableListenerOrig) {
- label = new LabelWrapper(text, wordWrap);
- init(text, useDoubleClick, editableListenerOrig);
- }
-
- public EditableIconLabel(final String text, final boolean useDoubleClick,
- final EditableClickListener editableListener) {
- this(text, false, false, editableListener);
- }
-
- public EditableIconLabel(final String text, final EditableClickListener editableListener) {
- this(text, false, editableListener);
- }
-
- public EditableClickListener getEditableListener() {
- return editableListener;
- }
-
- public String getText() {
- return label.getText();
- }
-
- public void restoreOldText() {
- label.setText(oldText);
- this.currentText = this.oldText;
- }
-
- public void setClickToRenameLabel(final String clickToRenameLabel) {
- this.clickToRenameLabel = clickToRenameLabel;
- }
-
- public void setDoubleClickToRenameLabel(final String doubleClickToRenameLabel) {
- this.doubleClickToRenameLabel = doubleClickToRenameLabel;
- }
-
- public void setEditable(final boolean editable) {
- reset();
- if (editable) {
- if (useDoubleClick) {
- label.setTitle(doubleClickToRenameLabel);
- label.addDoubleClickListener(listener);
- } else {
- label.setTitle(clickToRenameLabel);
- label.addClickListener(listener);
- }
- label.addStyleDependentName("editable");
- // label.addDoubleClickListener(listener);
- label.addMouseListener(mouseOverListener);
- } else {
- label.setTitle(null);
- label.addStyleDependentName("noneditable");
- }
- }
-
- public void setEditableListener(final EditableClickListener editableListener) {
- this.editableListener = editableListener;
- }
-
- public void setRenameDialogLabel(final String renameDialogLabel) {
- this.renameDialogLabel = renameDialogLabel;
- }
-
- public void setRenameDialogTitle(final String renameDialogTitle) {
- this.renameDialogTitle = renameDialogTitle;
- }
-
- public void setText(final String text) {
- this.oldText = this.currentText;
- this.currentText = text;
- label.setText(text);
- }
-
- private void init(final String text, final boolean useDoubleClick, final EditableClickListener editableListenerOrig) {
- doubleClickToRenameLabel = "Double click to rename";
- clickToRenameLabel = "Click to rename";
- renameDialogLabel = "Write a new name:";
- renameDialogTitle = "Rename";
- initWidget((Widget) label);
- this.currentText = text;
- this.oldText = text;
- this.useDoubleClick = useDoubleClick;
- this.editableListener = editableListenerOrig;
- this.listener = new ClickListener() {
- public void onClick(final Widget sender) {
- showEditableDialog();
- }
- };
- mouseOverListener = new MouseListenerAdapter() {
- @Override
- public void onMouseEnter(final Widget sender) {
- label.addStyleDependentName("high");
- }
-
- @Override
- public void onMouseLeave(final Widget sender) {
- label.removeStyleDependentName("high");
- }
- };
- label.setStylePrimaryName("kune-EditableLabel");
- label.addMouseListener(mouseOverListener);
- setEditable(false);
- }
-
- private void reset() {
- label.removeStyleDependentName("noneditable");
- label.removeStyleDependentName("editable");
- label.removeClickListener(listener);
- label.removeDoubleClickListener(listener);
- label.removeMouseListener(mouseOverListener);
- }
-
- private void showEditableDialog() {
- MessageBox.show(new MessageBoxConfig() {
- {
- // i18n
- setClosable(true);
- setModal(true);
- setWidth(300);
- setDefaultTextHeight(2);
- setButtons(MessageBox.OKCANCEL);
- setTitle(renameDialogTitle);
- setMsg(renameDialogLabel);
- setCallback(new MessageBox.PromptCallback() {
- public void execute(final String btnID, final String text) {
- if (btnID.equals("ok") && text != null) {
- editableListener.onEdited(text);
- } else {
- // Do nothing
- }
- }
- });
- setMultiline(true);
- setValue(currentText);
- }
- });
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconHyperlink.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -56,17 +56,17 @@
final String targetHistoryToken) {
this(image);
if (asHTML) {
- setLabelHTML(text);
+ setLabelHtmlImpl(text);
} else {
- setLabelText(text);
+ setLabelTextImpl(text);
}
- setTargetHistoryToken(targetHistoryToken);
+ setTargetHistoryTokenImpl(targetHistoryToken);
}
public IconHyperlink(final AbstractImagePrototype image, final String text, final String targetHistoryToken) {
this(image);
- setLabelText(text);
- setTargetHistoryToken(targetHistoryToken);
+ setLabelTextImpl(text);
+ setTargetHistoryTokenImpl(targetHistoryToken);
}
public void addClickListener(final ClickListener listener) {
@@ -153,16 +153,15 @@
}
public void setLabelHTML(final String html) {
- DOM.setInnerHTML(link, html);
+ setLabelHtmlImpl(html);
}
public void setLabelText(final String text) {
- DOM.setInnerText(link, text);
+ setLabelTextImpl(text);
}
public void setTargetHistoryToken(final String targetHistoryToken) {
- this.targetHistoryToken = targetHistoryToken;
- DOM.setElementProperty(anchorElem, "href", "#" + targetHistoryToken);
+ setTargetHistoryTokenImpl(targetHistoryToken);
}
public void setText(final String text) {
@@ -174,4 +173,17 @@
KuneUiUtils.setQuickTip(icon, title);
KuneUiUtils.setQuickTip(anchorElem, title);
}
+
+ private void setLabelHtmlImpl(final String html) {
+ DOM.setInnerHTML(link, html);
+ }
+
+ private void setLabelTextImpl(final String text) {
+ DOM.setInnerText(link, text);
+ }
+
+ private void setTargetHistoryTokenImpl(final String targetHistoryToken) {
+ this.targetHistoryToken = targetHistoryToken;
+ DOM.setElementProperty(anchorElem, "href", "#" + targetHistoryToken);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -59,6 +59,28 @@
private final Element textLabel;
/**
+ * Creates an empty label with a icon.
+ *
+ * @param image
+ * the icon to add
+ */
+ public IconLabel(final AbstractImagePrototype image, final boolean leftIcon) {
+ setElement(DOM.createDiv());
+ sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.ONMOUSEWHEEL | Event.ONDBLCLICK);
+ setIconImpl(image);
+ textLabel = DOM.createSpan();
+ if (leftIcon) {
+ setStyleName("kune-IconLabel-l");
+ DOM.appendChild(getElement(), icon);
+ DOM.appendChild(getElement(), textLabel);
+ } else {
+ setStyleName("kune-IconLabel-r");
+ DOM.appendChild(getElement(), textLabel);
+ DOM.appendChild(getElement(), icon);
+ }
+ }
+
+ /**
* Creates a label with the specified text and a icon in the left.
*
* @param image
@@ -68,7 +90,7 @@
*/
public IconLabel(final AbstractImagePrototype image, final String text) {
this(image, true);
- setText(text);
+ setTextImpl(text);
}
/**
@@ -83,7 +105,7 @@
*/
public IconLabel(final AbstractImagePrototype image, final String text, final boolean wordWrap) {
this(image, text);
- setWordWrap(wordWrap);
+ setWordWrapImpl(wordWrap);
}
/**
@@ -96,7 +118,7 @@
*/
public IconLabel(final String text, final AbstractImagePrototype image) {
this(image, false);
- setText(text);
+ setTextImpl(text);
}
/**
@@ -111,31 +133,9 @@
*/
public IconLabel(final String text, final AbstractImagePrototype image, final boolean wordWrap) {
this(text, image);
- setWordWrap(wordWrap);
+ setWordWrapImpl(wordWrap);
}
- /**
- * Creates an empty label with a icon.
- *
- * @param image
- * the icon to add
- */
- private IconLabel(final AbstractImagePrototype image, final boolean leftIcon) {
- setElement(DOM.createDiv());
- sinkEvents(Event.ONCLICK | Event.MOUSEEVENTS | Event.ONMOUSEWHEEL | Event.ONDBLCLICK);
- setIcon(image);
- textLabel = DOM.createSpan();
- if (leftIcon) {
- setStyleName("kune-IconLabel-l");
- DOM.appendChild(getElement(), icon);
- DOM.appendChild(getElement(), textLabel);
- } else {
- setStyleName("kune-IconLabel-r");
- DOM.appendChild(getElement(), textLabel);
- DOM.appendChild(getElement(), icon);
- }
- }
-
public void addClickListener(final ClickListener listener) {
if (clickListeners == null) {
clickListeners = new ClickListenerCollection();
@@ -240,8 +240,8 @@
DOM.setStyleAttribute(textLabel, "textAlign", align.getTextAlignString());
}
- public void setIcon(AbstractImagePrototype image) {
- icon = getImageElement(image);
+ public void setIcon(final AbstractImagePrototype image) {
+ setIconImpl(image);
}
public void setStyleNameToText(final String styleName) {
@@ -249,7 +249,7 @@
}
public void setText(final String text) {
- DOM.setInnerText(textLabel, text);
+ setTextImpl(text);
}
@Override
@@ -259,11 +259,23 @@
}
public void setWordWrap(final boolean wrap) {
- DOM.setStyleAttribute(textLabel, "whiteSpace", wrap ? "normal" : "nowrap");
+ setWordWrapImpl(wrap);
}
private Element getImageElement(final AbstractImagePrototype image) {
return image.createImage().getElement();
}
+ private void setIconImpl(final AbstractImagePrototype image) {
+ icon = getImageElement(image);
+ }
+
+ private void setTextImpl(final String text) {
+ DOM.setInnerText(textLabel, text);
+ }
+
+ private void setWordWrapImpl(final boolean wrap) {
+ DOM.setStyleAttribute(textLabel, "whiteSpace", wrap ? "normal" : "nowrap");
+ }
+
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/IconLabelEditable.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,31 +31,37 @@
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
+/**
+ * @author vjrj
+ *
+ */
public class IconLabelEditable extends Composite {
- private boolean useDoubleClick;
- private ClickListener listener;
- private String currentText;
- private MouseListenerAdapter mouseOverListener;
- private final AbstractLabel label;
- private String doubleClickToRenameLabel;
- private String clickToRenameLabel;
- private Event2<String, String> onEdit;
- private TextBox editor;
- private HorizontalPanel hp;
+ private transient boolean useDoubleClick;
+ private transient ClickListener listener;
+ private transient String currentText;
+ private transient MouseListenerAdapter mouseOverListener;
+ private transient final AbstractLabel label;
+ private transient String dblClickLabel;
+ private transient String clickLabel;
+ private transient Event2<String, String> onEditEvent;
+ private transient TextBox editor;
+ private transient HorizontalPanel hpanel;
public IconLabelEditable() {
this("");
}
- public IconLabelEditable(final AbstractImagePrototype icon, final String text, final boolean useDoubleClick) {
+ public IconLabelEditable(final AbstractImagePrototype icon, final String text, final boolean useDoubleClick) { // NO_UCD
+ super();
label = new IconLabel(icon, text);
init(text, useDoubleClick);
}
- public IconLabelEditable(final AbstractImagePrototype icon, final String text, final String targetHistoryToken,
+ public IconLabelEditable(final AbstractImagePrototype icon, final String text, final String targetToken, // NO_UCD
final boolean useDoubleClick) {
- label = new IconHyperlink(icon, text, targetHistoryToken);
+ super();
+ label = new IconHyperlink(icon, text, targetToken);
init(text, useDoubleClick);
}
@@ -63,11 +69,12 @@
this(text, false);
}
- public IconLabelEditable(final String text, final boolean useDoubleClick) {
- this(text, false, false);
+ public IconLabelEditable(final String text, final boolean useDoubleClick) { // NO_UCD
+ this(text, false, useDoubleClick);
}
- public IconLabelEditable(final String text, final boolean wordWrap, final boolean useDoubleClick) {
+ public IconLabelEditable(final String text, final boolean wordWrap, final boolean useDoubleClick) { // NO_UCD
+ super();
label = new LabelWrapper(text, wordWrap);
init(text, useDoubleClick);
}
@@ -82,45 +89,41 @@
}
public void onEdit(final Listener2<String, String> slot) {
- onEdit.add(slot);
+ onEditEvent.add(slot);
}
- public void setClickToRenameLabel(final String clickToRenameLabel) {
- this.clickToRenameLabel = clickToRenameLabel;
+ /**
+ * Sets the text tooltip showed to indicate "click to rename".
+ *
+ * @param text
+ * the new click to rename label
+ */
+ public void setClickToRenameLabel(final String text) {
+ this.clickLabel = text;
}
- public void setDoubleClickToRenameLabel(final String doubleClickToRenameLabel) {
- this.doubleClickToRenameLabel = doubleClickToRenameLabel;
+ /**
+ * Sets the text tooltip showed to indicate "double click to rename".
+ *
+ * @param text
+ * the new double click to rename label
+ */
+ public void setDoubleClickToRenameLabel(final String text) {
+ this.dblClickLabel = text;
}
public void setEditable(final boolean editable) {
- reset();
- if (editable) {
- if (useDoubleClick) {
- label.setTitle(doubleClickToRenameLabel);
- label.addDoubleClickListener(listener);
- } else {
- label.setTitle(clickToRenameLabel);
- label.addClickListener(listener);
- }
- label.addStyleDependentName("editable");
- // label.addDoubleClickListener(listener);
- label.addMouseListener(mouseOverListener);
- } else {
- label.setTitle(null);
- label.addStyleDependentName("noneditable");
- }
+ setEditableImpl(editable);
}
public void setText(final String text) {
- this.currentText = text;
- label.setText(text);
+ setTextImpl(text);
}
private void afterEdit() {
- String text = editor.getText();
- onEdit.fire(currentText, text);
- setText(text);
+ final String text = editor.getText();
+ onEditEvent.fire(currentText, text);
+ setTextImpl(text);
editor.setVisible(false);
editor.setReadOnly(true);
label.setVisible(true);
@@ -128,12 +131,12 @@
}
private void init(final String text, final boolean useDoubleClick) {
- this.onEdit = new Event2<String, String>("onLabelEdit");
- doubleClickToRenameLabel = "Double click to rename";
- clickToRenameLabel = "Click to rename";
- hp = new HorizontalPanel();
- hp.add((Widget) label);
- initWidget(hp);
+ this.onEditEvent = new Event2<String, String>("onLabelEdit");
+ dblClickLabel = "Double click to rename";
+ clickLabel = "Click to rename";
+ hpanel = new HorizontalPanel();
+ hpanel.add((Widget) label);
+ initWidget(hpanel);
this.currentText = text;
this.useDoubleClick = useDoubleClick;
this.listener = new ClickListener() {
@@ -155,7 +158,7 @@
};
label.setStylePrimaryName("kune-EditableLabel");
label.addMouseListener(mouseOverListener);
- setEditable(false);
+ setEditableImpl(false);
}
private void reset() {
@@ -166,15 +169,40 @@
label.removeMouseListener(mouseOverListener);
}
+ private void setEditableImpl(final boolean editable) {
+ reset();
+ if (editable) {
+ if (useDoubleClick) {
+ label.setTitle(dblClickLabel);
+ label.addDoubleClickListener(listener);
+ } else {
+ label.setTitle(clickLabel);
+ label.addClickListener(listener);
+ }
+ label.addStyleDependentName("editable");
+ // label.addDoubleClickListener(listener);
+ label.addMouseListener(mouseOverListener);
+ } else {
+ label.setTitle(null);
+ label.addStyleDependentName("noneditable");
+ }
+ }
+
+ private void setTextImpl(final String text) {
+ this.currentText = text;
+ label.setText(text);
+ }
+
private void showEditor() {
- int hpWidth = hp.getParent().getOffsetWidth();
+ final int hpWidth = hpanel.getParent().getOffsetWidth();
label.setVisible(false);
if (editor == null) {
editor = new TextBox();
editor.setStyleName("k-eil-edit");
- hp.add(editor);
+ hpanel.add(editor);
editor.addFocusListener(new FocusListener() {
public void onFocus(final Widget sender) {
+ // doNothing
}
public void onLostFocus(final Widget sender) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/KuneUiUtils.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -29,7 +29,7 @@
import com.gwtext.client.widgets.ToolTip;
import com.gwtext.client.widgets.form.Field;
-public class KuneUiUtils {
+public final class KuneUiUtils {
public enum IconPosition {
left, right
@@ -67,24 +67,20 @@
iconImg.setStyleName("vamiddle");
// setQuickTip(iconImg, tipText, tipTitle);
- ToolTip tooltip = new ToolTip();
+ final ToolTip tooltip = new ToolTip();
tooltip.setHtml(tipText);
tooltip.setWidth(250);
tooltip.applyTo(iconImg.getElement());
- switch (iconPosition) {
- case left:
+ if (iconPosition.equals(IconPosition.left)) {
tipHtml += iconImg.toString();
tipHtml += " ";
tipHtml += labelText;
- break;
- case right:
+ } else if (iconPosition.equals(IconPosition.right)) {
tipHtml += labelText;
tipHtml += " ";
tipHtml += iconImg.toString();
- break;
}
-
tipHtml += "</span>";
return tipHtml;
}
@@ -114,7 +110,7 @@
if (tipText == null || tipText.length() == 0) {
DOM.removeElementAttribute(element, "ext:qtip");
} else {
- ToolTip tip = new ToolTip();
+ final ToolTip tip = new ToolTip();
tip.setHtml(tipText);
if (tipTitle != null) {
tip.setTitle(tipTitle);
@@ -141,4 +137,7 @@
public static void setUnselectable(final Element element) {
Ext.get(element).unselectable();
}
+
+ private KuneUiUtils() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/LabelWrapper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,8 +26,9 @@
import com.google.gwt.user.client.ui.Label;
public class LabelWrapper extends Label implements AbstractLabel {
- private ClickListenerCollection doubleClickListeners;
+ private transient ClickListenerCollection dblClickListeners;
+
public LabelWrapper() {
super();
}
@@ -41,32 +42,29 @@
super(text, wordWrap);
}
- public void setColor(final String color) {
- DOM.setStyleAttribute(super.getElement(), "color", color);
+ public void addDoubleClickListener(final ClickListener listener) {
+ if (dblClickListeners == null) {
+ dblClickListeners = new ClickListenerCollection();
+ }
+ dblClickListeners.add(listener);
}
- public void addDoubleClickListener(final ClickListener listener) {
- if (doubleClickListeners == null) {
- doubleClickListeners = new ClickListenerCollection();
+ @Override
+ public void onBrowserEvent(final Event event) {
+ if (DOM.eventGetType(event) == Event.ONDBLCLICK && dblClickListeners != null) {
+ dblClickListeners.fireClick(this);
}
- doubleClickListeners.add(listener);
+ super.onBrowserEvent(event);
}
public void removeDoubleClickListener(final ClickListener listener) {
- if (doubleClickListeners != null) {
- doubleClickListeners.remove(listener);
+ if (dblClickListeners != null) {
+ dblClickListeners.remove(listener);
}
}
- public void onBrowserEvent(final Event event) {
- switch (DOM.eventGetType(event)) {
- case Event.ONDBLCLICK:
-
- if (doubleClickListeners != null) {
- doubleClickListeners.fireClick(this);
- }
- break;
- }
- super.onBrowserEvent(event);
+ public void setColor(final String color) {
+ DOM.setStyleAttribute(super.getElement(), "color", color);
}
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/RoundedPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -183,6 +183,13 @@
*/
public class RoundedPanel extends SimplePanel {
+ private static final String _1PX = "1px";
+ private static final String _2PX = "2px";
+ private static final String _3PX = "3px";
+ private static final String _4PX = "4px";
+ private static final String _5PX = "5px";
+ private static final String _6PX = "6px";
+
/**
* <code>TOPLEFT</code> top left rounded corner
*/
@@ -236,29 +243,26 @@
/**
* Lookup table for corner border width
*/
- private final static String[][] CORNERBORDER = { { "1px" }, { "1px", "1px" }, { "1px", "1px", "1px" },
- { "1px", "1px", "1px", "1px" }, { "1px", "1px", "1px", "2px", "1px" },
- { "1px", "1px", "1px", "1px", "2px", "1px" }, { "1px", "1px", "1px", "1px", "1px", "2px", "1px" },
- { "1px", "1px", "1px", "1px", "1px", "2px", "2px", "1px" },
- { "1px", "1px", "1px", "1px", "1px", "1px", "2px", "3px", "1px" } };
+ private final static String[][] CORNERBORDER = { { _1PX }, { _1PX, _1PX }, { _1PX, _1PX, _1PX },
+ { _1PX, _1PX, _1PX, _1PX }, { _1PX, _1PX, _1PX, _2PX, _1PX }, { _1PX, _1PX, _1PX, _1PX, _2PX, _1PX },
+ { _1PX, _1PX, _1PX, _1PX, _1PX, _2PX, _1PX }, { _1PX, _1PX, _1PX, _1PX, _1PX, _2PX, _2PX, _1PX },
+ { _1PX, _1PX, _1PX, _1PX, _1PX, _1PX, _2PX, _3PX, _1PX } };
/**
* Lookup table for corner height
*/
- private final static String[][] CORNERHEIGHT = { { "1px" }, { "1px", "1px" }, { "1px", "1px", "1px" },
- { "1px", "1px", "1px", "1px" }, { "2px", "1px", "1px", "1px", "1px" },
- { "2px", "1px", "1px", "1px", "1px", "1px" }, { "2px", "1px", "1px", "1px", "1px", "1px", "1px" },
- { "2px", "1px", "1px", "1px", "1px", "1px", "1px", "1px" },
- { "3px", "2px", "1px", "1px", "1px", "1px", "1px", "1px", "1px" } };
+ private final static String[][] CORNERHEIGHT = { { _1PX }, { _1PX, _1PX }, { _1PX, _1PX, _1PX },
+ { _1PX, _1PX, _1PX, _1PX }, { _2PX, _1PX, _1PX, _1PX, _1PX }, { _2PX, _1PX, _1PX, _1PX, _1PX, _1PX },
+ { _2PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX }, { _2PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX },
+ { _3PX, _2PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX, _1PX } };
/**
* Lookup table for corner margin
*/
- private final static String[][] CORNERMARGIN = { { "1px" }, { "1px", "2px" }, { "1px", "2px", "3px" },
- { "1px", "2px", "3px", "4px" }, { "1px", "2px", "3px", "4px", "6px" },
- { "1px", "2px", "3px", "4px", "5px", "7px" }, { "1px", "2px", "3px", "4px", "5px", "6px", "8px" },
- { "1px", "2px", "3px", "4px", "5px", "6px", "8px", "10px" },
- { "1px", "2px", "3px", "4px", "5px", "6px", "7px", "9px", "12px" }, };
+ private final static String[][] CORNERMARGIN = { { _1PX }, { _1PX, _2PX }, { _1PX, _2PX, _3PX },
+ { _1PX, _2PX, _3PX, _4PX }, { _1PX, _2PX, _3PX, _4PX, _6PX }, { _1PX, _2PX, _3PX, _4PX, _5PX, "7px" },
+ { _1PX, _2PX, _3PX, _4PX, _5PX, _6PX, "8px" }, { _1PX, _2PX, _3PX, _4PX, _5PX, _6PX, "8px", "10px" },
+ { _1PX, _2PX, _3PX, _4PX, _5PX, _6PX, "7px", "9px", "12px" }, };
/**
* Element array containing all div elements of the top corner div's.
@@ -348,6 +352,8 @@
divb[i] = addLine(cb, cornerHeight - (i + 1));
}
}
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09
+ // 14:17
setCornerStyleName(RPSTYLE);
}
@@ -450,6 +456,7 @@
* @param style
* css style name
*/
+ @Override
public void setStyleName(final String style) {
DOM.setElementProperty(body, "className", style);
}
@@ -457,25 +464,12 @@
/**
* Overwrite of parent getContainerElement()
*/
+ @Override
protected Element getContainerElement() {
return divElement;
}
/**
- * Convenience method to check if given <code>input</code> is with the
- * <code>mask</code>.
- *
- * @param input
- * input to check
- * @param mask
- * mask to check against
- * @return true if input within mask
- */
- protected boolean inMask(final int input, final int mask) {
- return (input & mask) > 0;
- }
-
- /**
* Creates div element representing part of the rounded corner.
*
* @param corner
@@ -501,4 +495,18 @@
DOM.appendChild(body, div);
return div;
}
+
+ /**
+ * Convenience method to check if given <code>input</code> is with the
+ * <code>mask</code>.
+ *
+ * @param input
+ * input to check
+ * @param mask
+ * mask to check against
+ * @return true if input within mask
+ */
+ private boolean inMask(final int input, final int mask) {
+ return (input & mask) > 0;
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridDropConfiguration.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -51,7 +51,7 @@
public GridDropConfiguration(final String ddGroupId, final Listener<String> listener) {
this.ddGroupId = ddGroupId;
this.onDrop = new Event<String>("onDrop");
- this.onDrop(listener);
+ this.onDropImpl(listener);
}
public void fire(final String id) {
@@ -63,6 +63,10 @@
}
public void onDrop(final Listener<String> listener) {
+ onDropImpl(listener);
+ }
+
+ private void onDropImpl(final Listener<String> listener) {
onDrop.add(listener);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridGroup.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,7 +21,7 @@
public class GridGroup {
- public static GridGroup NoGridGroup = new GridGroup("", "", "", "", false);
+ public static GridGroup noGridGroup = new GridGroup("", "", "", "", false);
private String name;
private String tooltipTitle;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/gridmenu/GridMenuPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -282,14 +282,14 @@
}
}
- private void configureDrag(final GridDragConfiguration gridDragConfiguration) {
+ private void configureDragImpl(final GridDragConfiguration gridDragConfiguration) {
// TODO: put this in GDConf
grid.setEnableDragDrop(true);
grid.setDdGroup(gridDragConfiguration.getDdGroupId());
grid.setDragDropText(gridDragConfiguration.getDragMessage());
}
- private void configureDrop(final GridDropConfiguration gridDropConfiguration) {
+ private void configureDropImpl(final GridDropConfiguration gridDropConfiguration) {
// TODO: put this in GDConf
grid.setEnableDragDrop(true);
grid.setDdGroup(gridDropConfiguration.getDdGroupId());
@@ -346,24 +346,24 @@
final String commonTootipHtmlRender = "<span ext:qtitle=\"{1}\" ext:qtip=\"{2}\">{0}</span>";
final Renderer iconHtmlRenderer = new Renderer() {
- public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
- Store store) {
+ public String render(final Object value, final CellMetadata cellMetadata, final Record record,
+ final int rowIndex, final int colNum, final Store store) {
return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(ICON_HTML),
record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
}
};
final Renderer titleHtmlRenderer = new Renderer() {
- public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
- Store store) {
+ public String render(final Object value, final CellMetadata cellMetadata, final Record record,
+ final int rowIndex, final int colNum, final Store store) {
return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(TITLE_HTML),
record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
}
};
final Renderer endIconHtmlRenderer = new Renderer() {
- public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum,
- Store store) {
+ public String render(final Object value, final CellMetadata cellMetadata, final Record record,
+ final int rowIndex, final int colNum, final Store store) {
return Format.format(commonTootipHtmlRender, new String[] { record.getAsString(END_ICON_HTML),
record.getAsString(TOOLTIPTITLE), record.getAsString(TOOLTIP) });
}
@@ -398,7 +398,7 @@
grid.addGridRowListener(new GridRowListener() {
public void onRowClick(final GridPanel grid, final int rowIndex, final EventObject e) {
showMenu(rowIndex, e);
- onClick(rowIndex);
+ onClickImpl(rowIndex);
}
public void onRowContextMenu(final GridPanel grid, final int rowIndex, final EventObject e) {
@@ -406,7 +406,7 @@
}
public void onRowDblClick(final GridPanel grid, final int rowIndex, final EventObject e) {
- onDoubleClick(rowIndex);
+ onDoubleClickImpl(rowIndex);
}
private void showMenu(final int rowIndex, final EventObject e) {
@@ -461,22 +461,22 @@
grid.setAutoHeight(true);
if (gridDropConfiguration != null) {
- configureDrop(gridDropConfiguration);
+ configureDropImpl(gridDropConfiguration);
}
if (gridDragConfiguration != null) {
- configureDrag(gridDragConfiguration);
+ configureDragImpl(gridDragConfiguration);
} else {
grid.setDraggable(false);
}
super.add(grid);
}
- private void onClick(final int rowIndex) {
+ private void onClickImpl(final int rowIndex) {
final Record record = store.getRecordAt(rowIndex);
onClick.fire(record.getAsString(ID));
}
- private void onDoubleClick(final int rowIndex) {
+ private void onDoubleClickImpl(final int rowIndex) {
final Record record = store.getRecordAt(rowIndex);
onDoubleClick.fire(record.getAsString(ID));
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/palette/AbstractPalettePanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,7 +26,6 @@
popupPalette.setVisible(true);
}
- protected void createPalette() {
- }
+ protected abstract void createPalette();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -11,9 +11,9 @@
public interface RTEditor {
- public final ActionToolbarPosition topbarPosition = new ActionToolbarPosition("rte-topbar");
- public final ActionToolbarPosition sndbarPosition = new ActionToolbarPosition("rte-sndbar");;
- public final ActionToolbarPosition linkCtxPosition = new ActionToolbarPosition("rte-linkctx");;
+ ActionToolbarPosition TOPBAR = new ActionToolbarPosition("rte-topbar");
+ ActionToolbarPosition SNDBAR = new ActionToolbarPosition("rte-sndbar");;
+ ActionToolbarPosition LINKCTX = new ActionToolbarPosition("rte-linkctx");;
void addAction(ActionDescriptor<Object> action);
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/basic/RTEditorPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -42,7 +42,7 @@
private final String fontNames[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet", "Verdana" };
private final String fontSizes[] = { "Extra small", "Very small (normal)", "Small", "Medium", "Large",
"Very large", "Extra large" };
- private static final RichTextArea.FontSize[] fontSizesConstants = new RichTextArea.FontSize[] {
+ private static final RichTextArea.FontSize[] FONT_SIZES = new RichTextArea.FontSize[] {
RichTextArea.FontSize.XX_SMALL, RichTextArea.FontSize.X_SMALL, RichTextArea.FontSize.SMALL,
RichTextArea.FontSize.MEDIUM, RichTextArea.FontSize.LARGE, RichTextArea.FontSize.X_LARGE,
RichTextArea.FontSize.XX_LARGE };
@@ -139,8 +139,8 @@
public void attach() {
topBar.clear();
sndBar.clear();
- topBar.addActions(actions, topbarPosition);
- sndBar.addActions(actions, sndbarPosition);
+ topBar.addActions(actions, TOPBAR);
+ sndBar.addActions(actions, SNDBAR);
view.addActions(actions);
}
@@ -241,7 +241,7 @@
private void createBasicActions() {
ActionToolbarMenuDescriptor<Object> selectAll = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.selectAll();
}
@@ -254,7 +254,7 @@
selectAll.setTopSeparator(true);
selectAll.setBottomSeparator(true);
- bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ bold = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.toggleBold();
fireOnEdit();
@@ -265,7 +265,7 @@
bold.setShortcut(new ShortcutDescriptor(true, 'B'));
bold.setAddCondition(canBeBasic);
- italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ italic = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.toggleItalic();
fireOnEdit();
@@ -277,7 +277,7 @@
italic.setAddCondition(canBeBasic);
italic.setAddCondition(canBeBasic);
- underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ underline = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.toggleUnderline();
fireOnEdit();
@@ -289,7 +289,7 @@
underline.setAddCondition(canBeBasic);
ActionToolbarMenuDescriptor<Object> subscript = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.toggleSubscript();
fireOnEdit();
@@ -302,7 +302,7 @@
subscript.setAddCondition(canBeBasic);
ActionToolbarMenuDescriptor<Object> superscript = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.toggleSuperscript();
fireOnEdit();
@@ -315,7 +315,7 @@
superscript.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyLeft = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.justifyLeft();
fireOnEdit();
@@ -327,7 +327,7 @@
justifyLeft.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyCentre = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.justifyCenter();
fireOnEdit();
@@ -339,7 +339,7 @@
justifyCentre.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> justifyRight = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.justifyRight();
fireOnEdit();
@@ -350,7 +350,7 @@
justifyRight.setShortcut(new ShortcutDescriptor(true, 'R'));
justifyRight.setAddCondition(canBeBasic);
- ActionToolbarMenuDescriptor<Object> undo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> undo = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.undo();
@@ -363,7 +363,7 @@
undo.setAddCondition(canBeExtended);
undo.setIconCls(getCssName(imgResources.undo()));
- ActionToolbarMenuDescriptor<Object> redo = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> redo = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.redo();
@@ -378,7 +378,7 @@
redo.setIconCls(getCssName(imgResources.redo()));
ActionToolbarButtonDescriptor<Object> undoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.undo();
fireOnEdit();
@@ -390,7 +390,7 @@
undoBtn.setPosition(0);
ActionToolbarButtonDescriptor<Object> redoBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.redo();
fireOnEdit();
@@ -402,7 +402,7 @@
redoBtn.setPosition(1);
redoBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
- ActionToolbarMenuDescriptor<Object> copy = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> copy = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.copy();
@@ -414,7 +414,7 @@
copy.setAddCondition(canBeExtended);
copy.setIconCls(getCssName(imgResources.copy()));
- ActionToolbarMenuDescriptor<Object> cut = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> cut = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.cut();
@@ -427,7 +427,7 @@
cut.setAddCondition(canBeExtended);
cut.setIconCls(getCssName(imgResources.cut()));
- ActionToolbarMenuDescriptor<Object> paste = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> paste = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.paste();
@@ -441,7 +441,7 @@
paste.setIconCls(getCssName(imgResources.paste()));
ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
if (updateHtmlListener == null) {
@@ -465,7 +465,7 @@
editHtml.setAddCondition(canBeExtended);
ActionToolbarMenuDescriptor<Object> comment = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -507,7 +507,7 @@
comment.setEnableCondition(isInsertHtmlSupported());
comment.setAddCondition(canBeExtended);
- ActionToolbarMenuDescriptor<Object> hr = new ActionToolbarMenuDescriptor<Object>(accessRol, topbarPosition,
+ ActionToolbarMenuDescriptor<Object> hr = new ActionToolbarMenuDescriptor<Object>(accessRol, TOPBAR,
new Listener0() {
public void onEvent() {
view.focus();
@@ -522,7 +522,7 @@
hr.setAddCondition(canBeExtended);
ActionToolbarMenuDescriptor<Object> blockquote = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.focus();
view.insertBlockquote();
@@ -534,7 +534,7 @@
blockquote.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> hrButton = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.focus();
view.insertHorizontalRule();
@@ -545,7 +545,7 @@
hrButton.setToolTip(i18n.t("Horizontal line"));
hrButton.setAddCondition(canBeExtended);
- strikethrough = new ActionToolbarPushButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ strikethrough = new ActionToolbarPushButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.toggleStrikethrough();
fireOnEdit();
@@ -557,7 +557,7 @@
strikethrough.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> decreaseIndent = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.leftIndent();
fireOnEdit();
@@ -568,7 +568,7 @@
decreaseIndent.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> increaseIndent = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.rightIndent();
fireOnEdit();
@@ -578,7 +578,7 @@
increaseIndent.setToolTip(i18n.t("Increase Indent"));
increaseIndent.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> ol = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
+ ActionToolbarButtonDescriptor<Object> ol = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
new Listener0() {
public void onEvent() {
view.insertOrderedList();
@@ -590,7 +590,7 @@
ol.setShortcut(new ShortcutDescriptor(true, '7'));
ol.setAddCondition(canBeExtended);
- ActionToolbarButtonDescriptor<Object> ul = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition,
+ ActionToolbarButtonDescriptor<Object> ul = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR,
new Listener0() {
public void onEvent() {
view.insertUnorderedList();
@@ -604,7 +604,7 @@
ul.setAddCondition(canBeExtended);
ActionToolbarButtonDescriptor<Object> imgBtn = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -636,10 +636,10 @@
imgMenu.setTextDescription(i18n.t("Image..."));
imgMenu.setToolTip(null);
imgMenu.setParentMenuTitle(i18n.t(INSERT_MENU));
- imgMenu.setActionPosition(topbarPosition);
+ imgMenu.setActionPosition(TOPBAR);
final ActionToolbarMenuDescriptor<Object> insertMedia = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -666,7 +666,7 @@
insertMedia.setAddCondition(canBeExtended);
insertMedia.setParentMenuTitle(i18n.t(INSERT_MENU));
ActionToolbarButtonDescriptor<Object> createOrEditLinkBtn = new ActionToolbarButtonDescriptor<Object>(
- accessRol, sndbarPosition, new Listener0() {
+ accessRol, SNDBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -709,17 +709,17 @@
createOrEditLink.setTextDescription(i18n.t("Link...") + createOrEditLinkBtn.getShortcutToS());
createOrEditLink.setToolTip(null);
createOrEditLink.setShortcut(null);
- createOrEditLink.setActionPosition(topbarPosition);
+ createOrEditLink.setActionPosition(TOPBAR);
createOrEditLink.setParentMenuTitle(i18n.t(INSERT_MENU));
ActionToolbarMenuDescriptor<Object> editLinkCtx = new ActionToolbarMenuDescriptor<Object>(createOrEditLink);
editLinkCtx.setTextDescription(i18n.t("Change"));
editLinkCtx.setToolTip(null);
editLinkCtx.setShortcut(null);
- editLinkCtx.setActionPosition(linkCtxPosition);
+ editLinkCtx.setActionPosition(LINKCTX);
ActionToolbarButtonDescriptor<Object> removeLink = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
if (view.isAnythingSelected()) {
// we try to unlink the selection
@@ -745,10 +745,10 @@
removeLinkCtx.setTextDescription(i18n.t("Remove"));
removeLinkCtx.setToolTip(null);
removeLinkCtx.setShortcut(null);
- removeLinkCtx.setActionPosition(linkCtxPosition);
+ removeLinkCtx.setActionPosition(LINKCTX);
final ActionToolbarMenuDescriptor<Object> removeFormat = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
view.removeFormat();
fireOnEdit();
@@ -762,7 +762,7 @@
removeFormat.setBottomSeparator(true);
final ActionToolbarButtonDescriptor<Object> removeFormatBtn = new ActionToolbarButtonDescriptor<Object>(
- accessRol, sndbarPosition, new Listener0() {
+ accessRol, SNDBAR, new Listener0() {
public void onEvent() {
view.removeFormat();
fireOnEdit();
@@ -775,7 +775,7 @@
removeFormatBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
final ActionToolbarMenuDescriptor<Object> insertSpecialChar = new ActionToolbarMenuDescriptor<Object>(
- accessRol, topbarPosition, new Listener0() {
+ accessRol, TOPBAR, new Listener0() {
public void onEvent() {
NotifyUser.showProgressLoading();
if (insertSpecialCharListener == null) {
@@ -798,7 +798,7 @@
insertSpecialChar.setTopSeparator(true);
final ActionToolbarMenuDescriptor<Object> insertTable = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
onInsertTablePressed();
}
@@ -808,7 +808,7 @@
insertTable.setAddCondition(canBeExtended);
insertTable.setParentMenuTitle(i18n.t(INSERT_MENU));
- insertTableBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, sndbarPosition, new Listener0() {
+ insertTableBtn = new ActionToolbarButtonDescriptor<Object>(accessRol, SNDBAR, new Listener0() {
public void onEvent() {
onInsertTablePressed();
}
@@ -819,7 +819,7 @@
insertTableBtn.setRightSeparator(ActionToolbarButtonSeparator.separator);
final ActionToolbarButtonDescriptor<Object> fontColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
getPalette();
palette.show(getActionLeftPosition(sndBar, insertTableBtn), getActionTopPosition(sndBar,
@@ -838,7 +838,7 @@
fontColor.setAddCondition(canBeBasic);
ActionToolbarButtonDescriptor<Object> backgroundColor = new ActionToolbarButtonDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
getPalette();
palette.show(getActionLeftPosition(sndBar, fontColor), getActionTopPosition(sndBar, fontColor),
@@ -857,7 +857,7 @@
backgroundColor.setAddCondition(canBeBasic);
final ActionToolbarMenuDescriptor<Object> devInfo = new ActionToolbarMenuDescriptor<Object>(accessRol,
- topbarPosition, new Listener0() {
+ TOPBAR, new Listener0() {
public void onEvent() {
deferred.addCommand(new Listener0() {
public void onEvent() {
@@ -931,7 +931,7 @@
private ActionToolbarMenuDescriptor<Object> createFontNameAction(final ActionAddCondition<Object> canBeBasic,
final String fontName) {
final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
view.setFontName(fontName);
fireOnEdit();
@@ -947,9 +947,9 @@
private ActionToolbarMenuDescriptor<Object> createFontSizeAction(final ActionAddCondition<Object> canBeBasic,
final int fontSize, final String fontSizeName) {
final ActionToolbarMenuDescriptor<Object> font = new ActionToolbarMenuDescriptor<Object>(accessRol,
- sndbarPosition, new Listener0() {
+ SNDBAR, new Listener0() {
public void onEvent() {
- view.setFontSize(fontSizesConstants[fontSize]);
+ view.setFontSize(FONT_SIZES[fontSize]);
fireOnEdit();
}
});
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImpl.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImpl.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImpl.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,6 +32,7 @@
protected Element elem;
public RichTextAreaImpl() {
+ // @PMD:REVIEWED:ConstructorCallsOverridableMethod: by vjrj on 21/05/09 14:39
elem = createElement();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplSafari.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplSafari.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplSafari.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -23,6 +23,7 @@
*/
public class RichTextAreaImplSafari extends RichTextAreaImplStandard {
+ // @PMD:REVIEWED:VariableNamingConventions: by vjrj on 21/05/09 16:12
private static final String[] sizeNumberCSSValues = new String[] { "medium", "xx-small", "x-small", "small",
"medium", "large", "x-large", "xx-large" };
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplStandard.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplStandard.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/impl/RichTextAreaImplStandard.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -118,6 +118,7 @@
}
@Override
+ // @PMD:REVIEWED:EmptyMethodInAbstractClassShouldBeAbstract: by vjrj on 21/05/09 13:58
public boolean isBasicEditingSupported() {
return true;
}
@@ -127,6 +128,7 @@
}
@Override
+ // @PMD:REVIEWED:EmptyMethodInAbstractClassShouldBeAbstract: by vjrj on 21/05/09 13:58
public boolean isExtendedEditingSupported() {
return true;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertimg/ImageInfo.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -38,8 +38,8 @@
this.src = src;
this.wraptext = wraptext;
this.clickOriginal = clickOriginal;
- this.setPosition(position);
- this.setSize(size);
+ setPositionImpl(position);
+ setSizeImpl(size);
}
public boolean getClickOriginal() {
@@ -80,11 +80,11 @@
}
public void setPosition(final String position) {
- this.position = position;
+ setPositionImpl(position);
}
public void setSize(final String size) {
- this.size = size;
+ setSizeImpl(size);
}
public void setSrc(final String src) {
@@ -116,4 +116,12 @@
}
return "";
}
+
+ private void setPositionImpl(final String position) {
+ this.position = position;
+ }
+
+ private void setSizeImpl(final String size) {
+ this.size = size;
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertlink/LinkInfo.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -11,13 +11,13 @@
private static final String NO_TARGET = null;
public static LinkInfo parse(final Element element) {
- String target = element.getAttribute(TARGET);
+ final String target = element.getAttribute(TARGET);
return new LinkInfo(element.getInnerText(), element.getTitle(), element.getAttribute(HREF), target != null
&& target.equals(_BLANK));
}
public static LinkInfo parse(final org.xwiki.gwt.dom.client.Element element) {
- String target = element.getAttribute(TARGET);
+ final String target = element.getAttribute(TARGET);
return new LinkInfo(element.getInnerText(), element.getTitle(), element.getAttribute(HREF), target != null
&& target.equals(_BLANK));
}
@@ -40,12 +40,12 @@
this.text = text;
this.href = href;
this.title = title;
- setInNewWindow(inNewWindow);
+ setInNewWindowImpl(inNewWindow);
}
public Element getElement() {
- Element anchor = DOM.createAnchor();
- com.google.gwt.user.client.Element element = (com.google.gwt.user.client.Element) anchor;
+ final Element anchor = DOM.createAnchor();
+ final com.google.gwt.user.client.Element element = (com.google.gwt.user.client.Element) anchor;
DOM.setElementProperty(element, HREF, href);
if (getTarget() != NO_TARGET) {
DOM.setElementProperty(element, TARGET, getTarget());
@@ -74,10 +74,10 @@
}
public boolean inSameWindow() {
- if (target != NO_TARGET) {
+ if (target.equals(NO_TARGET)) {
+ return false;
+ } else {
return target.equals(_BLANK);
- } else {
- return false;
}
}
@@ -86,15 +86,11 @@
}
public void setInNewWindow(final boolean inNewWindow) {
- if (inNewWindow) {
- this.setTarget(_BLANK);
- } else {
- setTarget(NO_TARGET);
- }
+ setInNewWindowImpl(inNewWindow);
}
public void setTarget(final String target) {
- this.target = target;
+ setTargetImpl(target);
}
public void setText(final String text) {
@@ -107,8 +103,20 @@
@Override
public String toString() {
- Element anchor = getElement();
+ final Element anchor = getElement();
return anchor.getString();
}
+ private void setInNewWindowImpl(final boolean inNewWindow) {
+ if (inNewWindow) {
+ setTargetImpl(_BLANK);
+ } else {
+ setTargetImpl(NO_TARGET);
+ }
+ }
+
+ private void setTargetImpl(final String target) {
+ this.target = target;
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertmedia/abstractmedia/InsertMediaAbstractPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -12,7 +12,7 @@
public class InsertMediaAbstractPanel extends InsertElementAbstractPanel implements InsertMediaAbstractView {
- protected TextField hrefField;
+ protected transient TextField hrefField;
public InsertMediaAbstractPanel(final String title, final InsertMediaAbstractPresenter presenter) {
super(title, InsertMediaDialogView.HEIGHT);
@@ -33,7 +33,7 @@
}
});
- insert(1, hrefField);
+ insertImpl(1, hrefField);
defValues();
}
@@ -44,7 +44,7 @@
@Override
public void insert(final int index, final Component component) {
- super.insert(index, component);
+ insertImpl(index, component);
}
@Override
@@ -67,4 +67,8 @@
wrapText.setChecked(true);
positionCombo.setValue(ContentPosition.RIGHT);
}
+
+ private void insertImpl(final int index, final Component component) {
+ super.insert(index, component);
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/insertspecialchar/utf8/InsertSpecialUTF8CharPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -83,7 +83,7 @@
private char getCharEntered() {
try {
- return (char) (new Integer(inputUnicodeField.getRawValue())).intValue();
+ return (char) Integer.valueOf(inputUnicodeField.getRawValue()).intValue();
} catch (Exception except) {
Log.debug("Not possible to cast utf8 int to char");
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/InsertTableDialogPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/InsertTableDialogPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/inserttable/InsertTableDialogPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -17,7 +17,7 @@
view.hide();
}
- public void init(InsertTableDialogView view) {
+ public void init(final InsertTableDialogView view) {
this.view = view;
}
@@ -26,14 +26,14 @@
view.reset();
}
- public void onInsert(String rowsS, String colsS, String borderS) {
+ public void onInsert(final String rowsS, final String colsS, final String borderS) {
if (onInsertTable != null) {
- Integer rows = new Integer(rowsS);
- Integer cols = new Integer(colsS);
- Integer border = new Integer(borderS);
- boolean validRows = rows < MAX_ROWS && rows > 0;
- boolean validCols = cols < MAX_COLS && cols > 0;
- boolean validBorder = border < MAX_BORDER && border > 0;
+ final Integer rows = Integer.valueOf(rowsS);
+ final Integer cols = Integer.valueOf(colsS);
+ final Integer border = Integer.valueOf(borderS);
+ final boolean validRows = rows < MAX_ROWS && rows > 0;
+ final boolean validCols = cols < MAX_COLS && cols > 0;
+ final boolean validBorder = border < MAX_BORDER && border > 0;
onInsertTable.onEvent(createTable(validRows ? rows : MAX_ROWS, validCols ? cols : MAX_COLS,
validBorder ? border : MAX_BORDER));
}
@@ -41,7 +41,7 @@
view.reset();
}
- public void setOnInsertTable(Listener<String> listener) {
+ public void setOnInsertTable(final Listener<String> listener) {
this.onInsertTable = listener;
}
@@ -49,7 +49,7 @@
view.show();
}
- private String createTable(int rows, int cols, int border) {
+ private String createTable(final int rows, final int cols, final int border) {
return view.generateTable(rows, cols, view.getSameColWidth(), view.getBackgroundColor(), border,
view.getBorderColor());
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -96,8 +96,7 @@
}
public void onDoSaveAndClose() {
- saveAndCloseConfirmed = true;
- onDoSave();
+ onDoSaveAndCloseImpl();
}
public void onSavedSuccessful() {
@@ -120,40 +119,16 @@
}
protected void onCancel() {
- if (savePending) {
- timer.cancel();
- Listener0 onYes = new Listener0() {
- public void onEvent() {
- onDoSaveAndClose();
- }
- };
- Listener0 onCancel = new Listener0() {
- public void onEvent() {
- onCancelConfirmed();
- }
- };
- view.askConfirmation(i18n.t("Save confirmation"),
- i18n.t("Do you want to save before closing the editor?"), onYes, onCancel);
- } else {
- onCancelConfirmed();
- }
+ onCancelImpl();
}
protected void onCancelConfirmed() {
- stateManager.removeBeforeStateChangeListener(beforeStateChangeListener);
- stateManager.resumeTokenChange();
- reset();
- editor.detach();
- onDoEditCancelled();
+ onCancelConfirmedImpl();
}
- protected void onDoSave() {
- onSave.onEvent(editor.getHtml());
- }
-
boolean beforeTokenChange() {
if (savePending) {
- onCancel();
+ onCancelImpl();
return false;
} else {
deferredCommandWrapper.addCommand(new Listener0() {
@@ -165,6 +140,10 @@
}
}
+ void onDoSave() {
+ onDoSaveImpl();
+ }
+
void onEdit() {
if (!savePending) {
savePending = true;
@@ -178,10 +157,10 @@
private void createActions() {
Listener0 onPerformSaveCall = new Listener0() {
public void onEvent() {
- onDoSave();
+ onDoSaveImpl();
}
};
- saveBtn = new ActionToolbarButtonDescriptor<Object>(AccessRolDTO.Editor, RTEditor.sndbarPosition, onPerformSaveCall);
+ saveBtn = new ActionToolbarButtonDescriptor<Object>(AccessRolDTO.Editor, RTEditor.SNDBAR, onPerformSaveCall);
saveBtn.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
saveBtn.setToolTip(i18n.t("Save"));
ShortcutDescriptor ctrl_S = new ShortcutDescriptor(true, 'S');
@@ -189,14 +168,14 @@
saveBtn.setPosition(0);
ActionToolbarMenuDescriptor<Object> save = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, onPerformSaveCall);
+ RTEditor.TOPBAR, onPerformSaveCall);
save.setIconCls(RTEImgResources.SUFFIX + imgResources.save().getName());
save.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
save.setTextDescription(i18n.t("Save") + (ctrl_S.toString()));
save.setPosition(0);
ActionToolbarMenuCheckItemDescriptor<Object> autoSaveMenuItem = new ActionToolbarMenuCheckItemDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, new Listener0() {
+ RTEditor.TOPBAR, new Listener0() {
public void onEvent() {
autoSave = !autoSave;
if (autoSave) {
@@ -213,9 +192,9 @@
autoSaveMenuItem.setTextDescription(i18n.t("Autosave"));
ActionToolbarMenuDescriptor<Object> close = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, new Listener<Object>() {
+ RTEditor.TOPBAR, new Listener<Object>() {
public void onEvent(final Object parameter) {
- onCancel();
+ onCancelImpl();
}
});
close.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
@@ -225,19 +204,19 @@
public void onEvent() {
if (savePending) {
timer.cancel();
- onDoSaveAndClose();
+ onDoSaveAndCloseImpl();
} else {
- onCancelConfirmed();
+ onCancelConfirmedImpl();
}
}
};
ActionToolbarMenuDescriptor<Object> saveclose = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, onPerformSaveAndCloseCall);
+ RTEditor.TOPBAR, onPerformSaveAndCloseCall);
saveclose.setParentMenuTitle(i18n.t(FILE_DEF_MENU_OPTION));
saveclose.setTextDescription(i18n.t("Save & Close"));
ActionToolbarButtonDescriptor<Object> saveCloseBtn = new ActionToolbarButtonDescriptor<Object>(
- AccessRolDTO.Editor, RTEditor.topbarPosition, onPerformSaveAndCloseCall);
+ AccessRolDTO.Editor, RTEditor.TOPBAR, onPerformSaveAndCloseCall);
// saveCloseBtn.setIconCls(RTEImgResources.SUFFIX +
// imgResources.save().getName());
saveCloseBtn.setTextDescription(i18n.t("Save & Close"));
@@ -256,10 +235,47 @@
editor.getSndBar().setButtonEnable(saveBtn, enable);
}
+ private void onCancelConfirmedImpl() {
+ stateManager.removeBeforeStateChangeListener(beforeStateChangeListener);
+ stateManager.resumeTokenChange();
+ reset();
+ editor.detach();
+ onDoEditCancelled();
+ }
+
+ private void onCancelImpl() {
+ if (savePending) {
+ timer.cancel();
+ Listener0 onYes = new Listener0() {
+ public void onEvent() {
+ onDoSaveAndCloseImpl();
+ }
+ };
+ Listener0 onCancel = new Listener0() {
+ public void onEvent() {
+ onCancelConfirmedImpl();
+ }
+ };
+ view.askConfirmation(i18n.t("Save confirmation"),
+ i18n.t("Do you want to save before closing the editor?"), onYes, onCancel);
+ } else {
+ onCancelConfirmedImpl();
+ }
+ }
+
private void onDoEditCancelled() {
onEditCancelled.onEvent();
}
+ private void onDoSaveAndCloseImpl() {
+ saveAndCloseConfirmed = true;
+ onDoSaveImpl();
+ }
+
+ private void onDoSaveImpl() {
+ onSave.onEvent(editor.getHtml());
+ }
+
private void reset() {
timer.cancel();
savePending = false;
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/utils/Convert.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/utils/Convert.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/utils/Convert.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -19,8 +19,11 @@
*/
package org.ourproject.kune.platf.client.utils;
-public class Convert {
- public static int toInt(String value) {
- return new Integer(value).intValue();
+public final class Convert {
+ public static int toInt(final String value) {
+ return Integer.valueOf(value);
}
+
+ private Convert() {
+ };
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/utils/Url.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/utils/Url.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/utils/Url.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -20,10 +20,11 @@
package org.ourproject.kune.platf.client.utils;
import java.util.ArrayList;
+import java.util.List;
public class Url {
- private final String base;
- private final ArrayList<UrlParam> params;
+ private transient final String base;
+ private transient final List<UrlParam> params;
public Url(final String base) {
this.base = base;
@@ -33,12 +34,12 @@
public Url(final String base, final UrlParam... iniParams) {
this(base);
for (UrlParam param : iniParams) {
- add(param);
+ addImpl(param);
}
}
public void add(final UrlParam param) {
- params.add(param);
+ addImpl(param);
}
@Override
@@ -55,4 +56,8 @@
}
return base + paramPart;
}
+
+ private void addImpl(final UrlParam param) {
+ params.add(param);
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/KunePersistenceService.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -37,7 +37,7 @@
persistenceService.start();
databaseInitializer.initConditional();
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new ServerException("Error starting persistence service", e);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/LoggerMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/LoggerMethodInterceptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/LoggerMethodInterceptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,7 +26,7 @@
public class LoggerMethodInterceptor implements MethodInterceptor {
- private static final Log log = LogFactory.getLog(LoggerMethodInterceptor.class);
+ private static final Log LOG = LogFactory.getLog(LoggerMethodInterceptor.class);
private final boolean simplifyNames;
public LoggerMethodInterceptor() {
@@ -40,17 +40,17 @@
public Object invoke(final MethodInvocation invocation) throws Throwable {
logInvocation(invocation);
try {
- Object result = invocation.proceed();
+ final Object result = invocation.proceed();
logResult(invocation, result);
return result;
- } catch (Throwable e) {
+ } catch (Exception e) {
logException(invocation, e);
throw e;
}
}
protected void log(final String output) {
- log.debug(output);
+ LOG.debug(output);
}
protected void logException(final MethodInvocation invocation, final Throwable e) {
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/OutermostCallInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/OutermostCallInterceptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/OutermostCallInterceptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -28,10 +28,10 @@
/*
* See:
* http://tembrel.blogspot.com/2007/09/matcher-and-methodinterceptor-for-dwr.html
- *
+ *
*/
-public class OutermostCallInterceptor implements MethodInterceptor {
+public final class OutermostCallInterceptor implements MethodInterceptor {
/**
* Decorates a MethodInterceptor so that only the outermost invocation using
* that interceptor will be intercepted and nested invocations willbe
Added: trunk/src/main/java/org/ourproject/kune/platf/server/ServerException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/ServerException.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/ServerException.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,31 @@
+package org.ourproject.kune.platf.server;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class ServerException extends RuntimeException {
+
+ private static final long serialVersionUID = 2028618233098694418L;
+
+ private static final Log LOG = LogFactory.getLog(ServerException.class);
+
+ public ServerException() {
+ super();
+ }
+
+ public ServerException(final String text) {
+ super(text);
+ LOG.error(text);
+ }
+
+ public ServerException(final String text, final Throwable cause) {
+ super(text, cause);
+ LOG.error(text, cause);
+ }
+
+ public ServerException(final Throwable cause) {
+ super(cause);
+ LOG.error("ServerManagerException", cause);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/access/AccessRights.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -20,45 +20,46 @@
package org.ourproject.kune.platf.server.access;
public class AccessRights {
- boolean isAdministrable;
- boolean isEditable;
- boolean isVisible;
+ boolean administrable;
+ boolean editable;
+ boolean visible;
public AccessRights() {
this(false, false, false);
}
- public AccessRights(final boolean isAdministrable, final boolean isEditable, final boolean isVisible) {
- this.isAdministrable = isAdministrable;
- this.isEditable = isEditable;
- this.isVisible = isVisible;
+ public AccessRights(final boolean administrable, final boolean editable, final boolean visible) {
+ this.administrable = administrable;
+ this.editable = editable;
+ this.visible = visible;
}
public boolean isAdministrable() {
- return isAdministrable;
+ return administrable;
}
public boolean isEditable() {
- return isEditable;
+ return editable;
}
public boolean isVisible() {
- return isVisible;
+ return visible;
}
public void setAdministrable(final boolean isAdministrable) {
- this.isAdministrable = isAdministrable;
+ this.administrable = isAdministrable;
}
public void setEditable(final boolean isEditable) {
- this.isEditable = isEditable;
+ this.editable = isEditable;
}
public void setVisible(final boolean isVisible) {
- this.isVisible = isVisible;
+ this.visible = isVisible;
}
+ @Override
public String toString() {
- return "AccessRights[a: " + isAdministrable + ", e: " + isEditable + ", v: " + isVisible + "]";
+ return "AccessRights[a: " + administrable + ", e: " + editable + ", v: " + visible + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/auth/AuthenticatedMethodInterceptor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -34,7 +34,7 @@
public class AuthenticatedMethodInterceptor implements MethodInterceptor {
- public static final Log log = LogFactory.getLog(AuthenticatedMethodInterceptor.class);
+ public static final Log LOG = LogFactory.getLog(AuthenticatedMethodInterceptor.class);
@Inject
Provider<UserSession> userSessionProvider;
@@ -50,9 +50,9 @@
// Some browsers getCookie returns "null" as String instead of null
final String userHash = arguments[0] == null || arguments[0].equals("null") ? null : (String) arguments[0];
- log.info("Method: " + invocation.getMethod().getName());
- log.info("Userhash received: " + userHash);
- log.info("--------------------------------------------------------------------------------");
+ LOG.info("Method: " + invocation.getMethod().getName());
+ LOG.info("Userhash received: " + userHash);
+ LOG.info("--------------------------------------------------------------------------------");
final UserSession userSession = userSessionProvider.get();
final SessionService sessionService = sessionServiceProvider.get();
@@ -64,18 +64,18 @@
throw new UserMustBeLoggedException();
} else if (userSession.isUserNotLoggedIn() && mandatory) {
sessionService.getNewSession();
- log.info("Session expired (not logged in server and mandatory)");
+ LOG.info("Session expired (not logged in server and mandatory)");
throw new SessionExpiredException();
} else if (userSession.isUserNotLoggedIn() && userHash == null) {
// Ok, do nothing
} else if (userSession.isUserNotLoggedIn() && userHash != null) {
sessionService.getNewSession();
- log.info("Session expired (not logged in server)");
+ LOG.info("Session expired (not logged in server)");
throw new SessionExpiredException();
} else if (!userSession.getHash().equals(userHash)) {
userSession.logout();
sessionService.getNewSession();
- log.info("Session expired (userHash different in server)");
+ LOG.info("Session expired (userHash different in server)");
throw new SessionExpiredException();
}
final Object result = invocation.proceed();
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContainerManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -38,6 +38,7 @@
import org.ourproject.kune.platf.server.manager.file.FileUtils;
import org.ourproject.kune.platf.server.manager.impl.DefaultManager;
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
+import org.ourproject.kune.platf.server.manager.impl.ServerManagerException;
import org.ourproject.kune.platf.server.utils.FilenameUtils;
import com.google.inject.Inject;
@@ -51,7 +52,7 @@
private final Content contentFinder;
@Inject
- public ContainerManagerDefault(Content contentFinder, Container containerFinder,
+ public ContainerManagerDefault(final Content contentFinder, final Container containerFinder,
final Provider<EntityManager> provider) {
super(provider, Container.class);
this.contentFinder = contentFinder;
@@ -59,7 +60,7 @@
}
public Container createFolder(final Group group, final Container parent, final String name,
- final I18nLanguage language, String typeId) {
+ final I18nLanguage language, final String typeId) {
FilenameUtils.checkBasicFilename(name);
String newtitle = findInexistentName(parent, name);
final List<Container> parentAbsolutePath = parent.getAbsolutePath();
@@ -90,7 +91,7 @@
}
/** Duplicate code in ContentMD **/
- public boolean findIfExistsTitle(Container container, String title) {
+ public boolean findIfExistsTitle(final Container container, final String title) {
return (contentFinder.findIfExistsTitle(container, title) > 0)
|| (containerFinder.findIfExistsTitle(container, title) > 0);
}
@@ -100,7 +101,7 @@
FilenameUtils.checkBasicFilename(newName);
String newNameWithoutNT = FilenameUtils.chomp(newName);
if (container.isRoot()) {
- throw new RuntimeException("Root folder cannot be renamed");
+ throw new DefaultException("Root folder cannot be renamed");
}
if (findIfExistsTitle(container.getParent(), newNameWithoutNT)) {
throw new NameInUseException();
@@ -120,19 +121,19 @@
try {
query = parser.parse(search);
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search");
}
return super.search(query, firstResult, maxResults);
}
- public void setAccessList(Container container, AccessLists accessList) {
+ public void setAccessList(final Container container, final AccessLists accessList) {
container.setAccessLists(accessList);
persist(container);
}
/** Duplicate code in ContentMD **/
- private String findInexistentName(Container container, String title) {
- String initialTitle = new String(title);
+ private String findInexistentName(final Container container, final String title) {
+ String initialTitle = String.valueOf(title);
while (findIfExistsTitle(container, initialTitle)) {
initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -45,6 +45,7 @@
import org.ourproject.kune.platf.server.manager.file.FileUtils;
import org.ourproject.kune.platf.server.manager.impl.DefaultManager;
import org.ourproject.kune.platf.server.manager.impl.SearchResult;
+import org.ourproject.kune.platf.server.manager.impl.ServerManagerException;
import org.ourproject.kune.platf.server.utils.FilenameUtils;
import com.google.inject.Inject;
@@ -177,7 +178,7 @@
try {
query = parser.parse(search);
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search");
}
return super.search(query, firstResult, maxResults);
}
@@ -243,7 +244,7 @@
}
private String findInexistentTitle(final Container container, final String title) {
- String initialTitle = new String(title);
+ String initialTitle = String.valueOf(title);
while (findIfExistsTitle(container, initialTitle)) {
initialTitle = FileUtils.getNextSequentialFileName(initialTitle);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentUtils.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/content/ContentUtils.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,13 +21,18 @@
import org.ourproject.kune.platf.client.errors.ContentNotFoundException;
-public class ContentUtils {
+public final class ContentUtils {
+ // @PMD:REVIEWED:ShortVariable: by vjrj on 21/05/09 14:05
public static Long parseId(final String id) throws ContentNotFoundException {
try {
- return new Long(id);
+ return Long.valueOf(id);
} catch (final NumberFormatException e) {
+ // @PMD:REVIEWED:PreserveStackTrace: by vjrj on 21/05/09 14:05
throw new ContentNotFoundException();
}
}
+
+ private ContentUtils() {
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Content.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -64,11 +64,16 @@
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Content implements HasStateToken {
- public static Content NO_CONTENT = new Content();
+ private static final String TITLE = "title";
+ private static final String GROUP = "group";
+ private static final String MIMETYPE = "mimetype";
+ public static final Content NO_CONTENT = new Content();
+
@Id
@DocumentId
@GeneratedValue
+ // @PMD:REVIEWED:ShortVariable: by vjrj on 21/05/09 15:28
private Long id;
@Version
@@ -162,32 +167,32 @@
}
@Finder(query = "FROM Content WHERE lastRevision.title LIKE :title AND (mimeType.mimetype=:mimetype OR mimeType.mimetype=:mimetype2) AND container.owner.shortName=:group AND deletedOn=null ORDER BY lastRevision.title ASC")
- public List<Content> find2Mime(@Named("group") final String groupShortName, @Named("title") final String title,
- @Named("mimetype") final String mimetype, @Named("mimetype2") final String mimetype2,
+ public List<Content> find2Mime(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @Named("mimetype2") final String mimetype2,
@FirstResult final int offset, @MaxResults final int limit) {
return null;
}
@Finder(query = "SELECT count(id) FROM Content WHERE lastRevision.title LIKE :title AND (mimeType.mimetype=:mimetype OR mimeType.mimetype=:mimetype2) AND container.owner.shortName=:group AND deletedOn=null")
- public int find2MimeCount(@Named("group") final String groupShortName, @Named("title") final String title,
- @Named("mimetype") final String mimetype, @Named("mimetype2") final String mimetype2) {
+ public int find2MimeCount(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @Named("mimetype2") final String mimetype2) {
return 0;
}
@Finder(query = "select count(*) from Container ctx, Content ctn where ctn.container.id = ctx.id and ctx = :container and ctn.lastRevision.title LIKE :title")
- public Long findIfExistsTitle(@Named("container") final Container container, @Named("title") final String title) {
+ public Long findIfExistsTitle(@Named("container") final Container container, @Named(TITLE) final String title) {
return null;
}
@Finder(query = "FROM Content WHERE lastRevision.title LIKE :title AND mimeType.mimetype=:mimetype AND container.owner.shortName=:group AND deletedOn=null ORDER BY lastRevision.title ASC")
- public List<Content> findMime(@Named("group") final String groupShortName, @Named("title") final String title,
- @Named("mimetype") final String mimetype, @FirstResult final int offset, @MaxResults final int limit) {
+ public List<Content> findMime(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype, @FirstResult final int offset, @MaxResults final int limit) {
return null;
}
@Finder(query = "SELECT count(id) FROM Content WHERE lastRevision.title LIKE :title AND mimeType.mimetype=:mimetype AND container.owner.shortName=:group AND deletedOn=null")
- public int findMimeCount(@Named("group") final String groupShortName, @Named("title") final String title,
- @Named("mimetype") final String mimetype) {
+ public int findMimeCount(@Named(GROUP) final String groupShortName, @Named(TITLE) final String title,
+ @Named(MIMETYPE) final String mimetype) {
return 0;
}
@@ -315,6 +320,7 @@
this.filename = filename;
}
+ // @PMD:REVIEWED:ShortVariable: by vjrj on 21/05/09 15:28
public void setId(final Long id) {
this.id = id;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/Group.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -58,7 +58,7 @@
// see: http://docs.codehaus.org/display/PICO/Good+Citizen:
// Never expect or return null
- public static Group NO_GROUP = null;
+ public static final Group NO_GROUP = null;
@Id
@DocumentId
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/domain/User.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -128,7 +128,7 @@
customProperties = new CustomProperties();
buddiesVisibility = UserBuddiesVisibility.anyone;
this.createdOn = System.currentTimeMillis();
- this.setLastLogin(null);
+ this.lastLogin = null;
}
@Finder(query = "from User")
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/init/DatabaseInitializer.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -53,13 +53,13 @@
}
public void createOthers() {
- final I18nLanguage english = new I18nLanguage(new Long(1819), "en", "ltr", "English", "", "", "en", "eng",
+ final I18nLanguage english = new I18nLanguage(Long.valueOf(1819), "en", "ltr", "English", "", "", "en", "eng",
"eng", false, "", "", "", "c == 1 ? 1 : 2", null, "L", "MMM d\\, yyyy");
- final I18nLanguage spanish = new I18nLanguage(new Long(5889), "es", "ltr", "Spanish", "", "", "es", "spa",
+ final I18nLanguage spanish = new I18nLanguage(Long.valueOf(5889), "es", "ltr", "Spanish", "", "", "es", "spa",
"spa", true, "Español", "", "", "c == 1 ? 1 : 2", null, "L", "dd/MM/yyyy");
languageManager.persist(english);
languageManager.persist(spanish);
- final I18nCountry gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
+ final I18nCountry gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
"western", ",");
countryManager.persist(gb);
final I18nTranslation test = new I18nTranslation("test", english, "test");
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/FileManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -49,6 +49,6 @@
* @param dir
* the directory (use File.separator for dir delimiters)
*/
- void rmdir(String dir);
+ void rmdir(String dir) throws IOException;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/EntityLogoUploadManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -55,8 +55,11 @@
I18nTranslationService i18n;
@Override
+ protected void beforePostStart() {
+ }
+
+ @Override
protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
- super.beforeRespond(response, w);
response.setCharacterEncoding("utf-8");
response.setContentType("text/xml");
}
@@ -141,7 +144,7 @@
@Override
protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
super.onOtherException(response, e);
- log.info("Exception: " + e.getCause());
+ LOG.info("Exception: " + e.getCause());
// e.printStackTrace();
doResponse(response, createXmlResponse(false, i18n.t("Error uploading file")).toString(),
HttpServletResponse.SC_BAD_REQUEST);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileDownloadManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -62,7 +62,7 @@
static final String APPLICATION_X_DOWNLOAD = "application/x-download";
- public static final Log log = LogFactory.getLog(FileDownloadManager.class);
+ public static final Log LOG = LogFactory.getLog(FileDownloadManager.class);
@Inject
ContentManager contentManager;
@@ -132,7 +132,7 @@
contentType = mimeType.toString();
}
resp.setContentType(contentType);
- log.info("Content type returned: " + contentType);
+ LOG.info("Content type returned: " + contentType);
resp.setHeader(RESP_HEADER_CONTEND_DISP, RESP_HEADER_ATTACHMENT_FILENAME + title + extension + RESP_HEADER_END);
return absFilename;
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileJsonUploadManagerAbstract.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -38,7 +38,6 @@
@Override
protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
- super.beforeRespond(response, w);
response.setCharacterEncoding("utf-8");
response.setContentType("text/html");
}
@@ -55,7 +54,7 @@
@Override
protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
super.onOtherException(response, e);
- log.info("Exception: " + e.getCause());
+ LOG.info("Exception: " + e.getCause());
// e.printStackTrace();
doResponse(response, createJsonResponse(false, i18n.t("Error uploading file")).toString());
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -30,10 +30,12 @@
public class FileManagerDefault implements FileManager {
public File createFileWithSequentialName(final String dir, final String fileName) throws IOException {
- String fileNameProposal = new String(fileName);
+ String fileNameProposal = String.valueOf(fileName);
File file = new File(dir, fileNameProposal);
while (file.exists()) {
fileNameProposal = FileUtils.getNextSequentialFileName(fileNameProposal, true);
+ // @PMD:REVIEWED:AvoidInstantiatingObjectsInLoops: by vjrj on
+ // 21/05/09 13:15
file = new File(dir, fileNameProposal);
}
file.createNewFile();
@@ -41,16 +43,16 @@
}
public boolean mkdir(final String dir) {
- return (new File(dir)).mkdirs();
+ return new File(dir).mkdirs();
}
- public void rmdir(final String dir) {
+ public void rmdir(final String dir) throws IOException {
final File file = new File(dir);
if (!file.isDirectory()) {
- throw new RuntimeException("rmdir: " + dir + ": Not a directory");
+ throw new IOException("rmdir: " + dir + ": Not a directory");
}
if (file.listFiles().length != 0) {
- throw new RuntimeException("rmdir: " + dir + ": Directory not empty");
+ throw new IOException("rmdir: " + dir + ": Directory not empty");
}
file.delete();
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -66,6 +66,10 @@
I18nTranslationService i18n;
@Override
+ protected void beforePostStart() {
+ }
+
+ @Override
protected JSONObject createJsonResponse(final boolean success, final String message) {
/**
*
@@ -86,7 +90,7 @@
response.put("error", message);
response.put("code", "232");
} catch (final Exception e) {
- log.error("Error building response");
+ LOG.error("Error building response");
}
return response;
}
@@ -114,7 +118,7 @@
final String mimetype = fileUploadItem.getContentType();
BasicMimeType basicMimeType = new BasicMimeType(mimetype);
- log.info("Mimetype: " + basicMimeType);
+ LOG.info("Mimetype: " + basicMimeType);
final String extension = FileUtils.getFileNameExtension(file.getName(), false);
String preview = "";
@@ -167,12 +171,11 @@
ImageUtilsDefault.createThumbFromPdf(fileOrig, previewName);
}
} catch (NumberFormatException e) {
- log.error("Image sizes in kune.properties are not integers");
- e.printStackTrace();
+ LOG.error("Image sizes in kune.properties are not integers", e);
} catch (MagickException e) {
- log.info("Problem generating image thumb for " + filename);
+ LOG.info("Problem generating image thumb for " + filename, e);
} catch (FileNotFoundException e) {
- log.info("Original image not found generating image thumb for " + filename);
+ LOG.info("Original image not found generating image thumb for " + filename, e);
}
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUploadManagerAbstract.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -47,23 +47,17 @@
private static final long serialVersionUID = -4227762495128652369L;
- public static final Log log = LogFactory.getLog(FileUploadManager.class);
+ public static final Log LOG = LogFactory.getLog(FileUploadManager.class);
protected static final String UTF8 = "UTF-8";
@Inject
KuneProperties kuneProperties;
- protected void beforePostStart() {
- }
+ protected abstract void beforePostStart();
- protected void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException {
- }
+ protected abstract void beforeRespond(final HttpServletResponse response, final Writer w) throws IOException;
- protected void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
- final FileItem file, final String typeId) throws Exception {
- }
-
@Override
@SuppressWarnings( { "unchecked", "deprecation" })
protected void doPost(final HttpServletRequest req, final HttpServletResponse response) throws ServletException,
@@ -78,12 +72,12 @@
factory.setRepository(new File("/tmp"));
if (!ServletFileUpload.isMultipartContent(req)) {
- log.warn("Not a multipart upload");
+ LOG.warn("Not a multipart upload");
}
final ServletFileUpload upload = new ServletFileUpload(factory);
// maximum size before a FileUploadException will be thrown
- upload.setSizeMax(new Integer(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE)) * 1024 * 1024);
+ upload.setSizeMax(Integer.valueOf(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE)) * 1024 * 1024);
try {
final List fileItems = upload.parseRequest(req);
@@ -97,7 +91,7 @@
if (item.isFormField()) {
final String name = item.getFieldName();
final String value = item.getString();
- log.info("name: " + name + " value: " + value);
+ LOG.info("name: " + name + " value: " + value);
if (name.equals(FileConstants.HASH)) {
userHash = value;
}
@@ -109,7 +103,7 @@
}
} else {
fileName = item.getName();
- log.info("file: " + fileName + " fieldName: " + item.getFieldName() + " size: " + item.getSize()
+ LOG.info("file: " + fileName + " fieldName: " + item.getFieldName() + " size: " + item.getSize()
+ " typeId: " + typeId);
file = item;
}
@@ -142,7 +136,7 @@
}
protected void onOtherException(final HttpServletResponse response, final Exception e) throws IOException {
- log.info("Exception: " + e.getCause());
+ LOG.info("Exception: " + e.getCause());
e.printStackTrace();
doResponse(response, null);
}
@@ -151,4 +145,7 @@
doResponse(response, null);
}
+ abstract void createUploadedFile(final String userHash, final StateToken stateToken, final String fileName,
+ final FileItem file, final String typeId) throws Exception;
+
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUtils.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUtils.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/file/FileUtils.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,23 +35,23 @@
* http://www.java-tips.org/java-se-tips/java.io/reading-a-file
* -into-a-byte-array.html
*/
- public static byte[] getBytesFromFile(File file) throws IOException {
- InputStream is = new FileInputStream(file);
+ public static byte[] getBytesFromFile(final File file) throws IOException {
+ final InputStream iStream = new FileInputStream(file);
// Get the size of the file
- long length = file.length();
+ final long length = file.length();
if (length > Integer.MAX_VALUE) {
// File is too large
}
// Create the byte array to hold the data
- byte[] bytes = new byte[(int) length];
+ final byte[] bytes = new byte[(int) length];
// Read in the bytes
int offset = 0;
int numRead = 0;
- while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) {
+ while (offset < bytes.length && (numRead = iStream.read(bytes, offset, bytes.length - offset)) >= 0) {
offset += numRead;
}
@@ -61,7 +61,7 @@
}
// Close the input stream and return bytes
- is.close();
+ iStream.close();
return bytes;
}
@@ -77,7 +77,7 @@
if (filename == null) {
return "";
}
- final int dotIndex = filename.lastIndexOf(".");
+ final int dotIndex = filename.lastIndexOf('.');
if (dotIndex == -1 || dotIndex == 0) {
return "";
} else {
@@ -93,7 +93,7 @@
public static String getFileNameWithoutExtension(final String fileName, final String extension) {
final int extlength = extension.length();
if (extlength > 0) {
- boolean withDot = extension.charAt(0) == '.';
+ final boolean withDot = extension.charAt(0) == '.';
return fileName.substring(0, fileName.length() - extlength - (withDot ? 0 : 1));
} else {
return fileName;
@@ -105,7 +105,7 @@
if (lastSpace != -1) {
final String suffix = fileName.substring(lastSpace + 1);
try {
- final Integer i = new Integer(suffix);
+ final Integer i = Integer.valueOf(suffix);
return fileName.substring(0, lastSpace + 1) + (i + 1);
} catch (final NumberFormatException e) {
}
@@ -113,7 +113,7 @@
return fileName + " 1";
}
- public static String getNextSequentialFileName(final String fileName, boolean preserveExtension) {
+ public static String getNextSequentialFileName(final String fileName, final boolean preserveExtension) {
if (!preserveExtension) {
return getNextSequentialFileName(fileName);
}
@@ -130,7 +130,7 @@
return SLASH + stateToken.getGroup() + SLASH + stateToken.getTool() + SLASH + stateToken.getFolder() + SLASH;
}
- public boolean exist(String file) {
+ public boolean exist(final String file) {
return new File(file).exists();
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/DefaultManager.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -23,6 +23,8 @@
import javax.persistence.EntityManager;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
@@ -37,10 +39,12 @@
public abstract class DefaultManager<T, K> {
private final Provider<EntityManager> provider;
private final Class<T> entityClass;
+ protected final Log log;
public DefaultManager(final Provider<EntityManager> provider, final Class<T> entityClass) {
this.provider = provider;
this.entityClass = entityClass;
+ log = LogFactory.getLog(entityClass);
}
public T find(final Long primaryKey) {
@@ -100,7 +104,7 @@
try {
queryQ = MultiFieldQueryParser.parse(query, fields, flags, new StandardAnalyzer());
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search", e);
}
return search(queryQ, firstResult, maxResults);
}
@@ -111,7 +115,7 @@
try {
query = MultiFieldQueryParser.parse(queries, fields, flags, new StandardAnalyzer());
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search", e);
}
return search(query, firstResult, maxResults);
}
@@ -122,7 +126,7 @@
try {
query = MultiFieldQueryParser.parse(queries, fields, new StandardAnalyzer());
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search", e);
}
return search(query, firstResult, maxResults);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/GroupManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -87,7 +87,7 @@
public void changeDefLicense(final User user, final Group group, final String licName) {
final License license = licenseFinder.findByShortName(licName);
if (license == null) {
- throw new RuntimeException("Unknown license");
+ throw new ServerManagerException("Unknown license");
}
group.setDefaultLicense(license);
}
@@ -191,7 +191,7 @@
try {
query = parser.parse(search);
} catch (final ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search");
}
return super.search(query, firstResult, maxResults);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/I18nTranslationManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -120,7 +120,7 @@
}
public String setTranslation(final String id, final String translation) throws DefaultException {
- final I18nTranslation trans = super.find(new Long(id));
+ final I18nTranslation trans = super.find(Long.valueOf(id));
if (trans != null) {
final String escapedTranslation = TextUtils.escapeHtmlLight(translation);
trans.setText(escapedTranslation);
Added: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ServerManagerException.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ServerManagerException.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/ServerManagerException.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,25 @@
+package org.ourproject.kune.platf.server.manager.impl;
+
+import org.ourproject.kune.platf.server.ServerException;
+
+public class ServerManagerException extends ServerException {
+
+ private static final long serialVersionUID = -8407996943857184946L;
+
+ public ServerManagerException() {
+ super();
+ }
+
+ public ServerManagerException(final String text) {
+ super(text);
+ }
+
+ public ServerManagerException(final String text, final Throwable cause) {
+ super(text, cause);
+ }
+
+ public ServerManagerException(final Throwable cause) {
+ super(cause);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/SocialNetworkManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,6 +31,7 @@
import org.ourproject.kune.platf.client.errors.DefaultException;
import org.ourproject.kune.platf.client.errors.LastAdminInGroupException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
+import org.ourproject.kune.platf.server.ServerException;
import org.ourproject.kune.platf.server.access.AccessRights;
import org.ourproject.kune.platf.server.access.AccessRightsService;
import org.ourproject.kune.platf.server.domain.AdmissionType;
@@ -155,7 +156,7 @@
return sn;
}
- public SocialNetworkData getSocialNetworkData(User userLogged, Group group) {
+ public SocialNetworkData getSocialNetworkData(final User userLogged, final Group group) {
SocialNetworkData socialNetData = new SocialNetworkData();
socialNetData.setGroupMembers(get(userLogged, group));
AccessRights groupRights = accessRightsService.get(userLogged, group.getAccessLists());
@@ -218,7 +219,7 @@
}
final AdmissionType admissionType = inGroup.getAdmissionType();
if (admissionType == null) {
- throw new RuntimeException();
+ throw new ServerException("No admissionType");
}
final Group userGroup = userLogged.getUserGroup();
checkGroupIsNotAlreadyAMember(userGroup, sn);
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/UserManagerDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,6 +31,7 @@
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.Query;
import org.jivesoftware.smack.RosterEntry;
+import org.jivesoftware.smack.packet.RosterPacket.ItemType;
import org.ourproject.kune.chat.server.managers.ChatConnection;
import org.ourproject.kune.chat.server.managers.XmppManager;
import org.ourproject.kune.platf.client.errors.I18nNotFoundException;
@@ -106,15 +107,14 @@
// two db at the same time). This compromise solution is server
// independent.
// In the future cache this.
- String domain = "@" + properties.getDomain();
+ final String domain = "@" + properties.getDomain();
UserBuddiesData buddiesData = new UserBuddiesData();
User user = finder.getByShortName(shortName);
ChatConnection connection = xmppManager.login(user.getShortName() + domain, user.getPassword(), "kserver");
Collection<RosterEntry> roster = xmppManager.getRoster(connection);
xmppManager.disconnect(connection);
for (RosterEntry entry : roster) {
- switch (entry.getType()) {
- case both:
+ if (entry.getType().equals(ItemType.both)) {
// only show buddies with subscription 'both'
int index = entry.getUser().indexOf(domain);
if (index > 0) {
@@ -127,7 +127,7 @@
}
} else {
// ext user (only count)
- buddiesData.setOtherExternalBuddies(buddiesData.getOtherExternalBuddies() + 1);
+ buddiesData.setOtherExtBuddies(buddiesData.getOtherExtBuddies() + 1);
}
}
}
@@ -172,7 +172,7 @@
try {
query = parser.parse(search);
} catch (ParseException e) {
- throw new RuntimeException("Error parsing search");
+ throw new ServerManagerException("Error parsing search", e);
}
return super.search(query, firstResult, maxResults);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/properties/KunePropertiesDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/properties/KunePropertiesDefault.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/properties/KunePropertiesDefault.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -24,6 +24,8 @@
import java.text.MessageFormat;
import java.util.Properties;
+import org.ourproject.kune.platf.server.ServerException;
+
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -41,7 +43,7 @@
properties.load(input);
} catch (IOException e) {
String msg = MessageFormat.format("Couldn't open property file {0}", fileName);
- throw new RuntimeException(msg, e);
+ throw new ServerException(msg, e);
}
}
@@ -49,7 +51,7 @@
public String get(final String key) {
String value = properties.getProperty(key);
if (value == null) {
- throw new RuntimeException("PROPERTY: " + key + " not defined in " + fileName);
+ throw new ServerException("PROPERTY: " + key + " not defined in " + fileName);
}
return value;
}
@@ -63,7 +65,7 @@
InputStream input = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName);
if (input == null) {
String msg = MessageFormat.format("Properties file: ''{0}'' not found", fileName);
- throw new RuntimeException(msg);
+ throw new ServerException(msg);
}
return input;
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/rpc/SiteRPC.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -55,7 +55,7 @@
private final I18nLanguageManager languageManager;
private final I18nCountryManager countryManager;
private final ServerToolRegistry serverToolRegistry;
- private final ExtMediaDescripManager extMediaDescripManager;
+ private final ExtMediaDescripManager extMediaDescManager;
// TODO: refactor: too many parameters! refactor to Facade Pattern
@Inject
@@ -63,7 +63,7 @@
final UserInfoService userInfoService, final LicenseManager licenseManager, final Mapper mapper,
final KuneProperties kuneProperties, final ChatProperties chatProperties,
final I18nLanguageManager languageManager, final I18nCountryManager countryManager,
- final ServerToolRegistry serverToolRegistry, final ExtMediaDescripManager extMediaDescripManager) {
+ final ServerToolRegistry serverToolRegistry, final ExtMediaDescripManager extMediaDescManager) {
this.userSessionProvider = userSessionProvider;
this.userManager = userManager;
this.userInfoService = userInfoService;
@@ -74,7 +74,7 @@
this.languageManager = languageManager;
this.countryManager = countryManager;
this.serverToolRegistry = serverToolRegistry;
- this.extMediaDescripManager = extMediaDescripManager;
+ this.extMediaDescManager = extMediaDescManager;
}
@Transactional(type = TransactionType.READ_ONLY)
@@ -102,15 +102,15 @@
data.setMaxFileSizeInMb(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE));
data.setUserTools(serverToolRegistry.getToolsForUsers());
data.setGroupTools(serverToolRegistry.getToolsForGroups());
- data.setImgResizewidth(new Integer(kuneProperties.get(KuneProperties.IMAGES_RESIZEWIDTH)));
- data.setImgThumbsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_THUMBSIZE)));
- data.setImgCropsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_CROPSIZE)));
- data.setImgIconsize(new Integer(kuneProperties.get(KuneProperties.IMAGES_ICONSIZE)));
+ data.setImgResizewidth(Integer.valueOf(kuneProperties.get(KuneProperties.IMAGES_RESIZEWIDTH)));
+ data.setImgThumbsize(Integer.valueOf(kuneProperties.get(KuneProperties.IMAGES_THUMBSIZE)));
+ data.setImgCropsize(Integer.valueOf(kuneProperties.get(KuneProperties.IMAGES_CROPSIZE)));
+ data.setImgIconsize(Integer.valueOf(kuneProperties.get(KuneProperties.IMAGES_ICONSIZE)));
data.setFlvEmbedObject(kuneProperties.get(KuneProperties.FLV_EMBEDED_OBJECT));
data.setMp3EmbedObject(kuneProperties.get(KuneProperties.MP3_EMBEDED_OBJECT));
data.setOggEmbedObject(kuneProperties.get(KuneProperties.OGG_EMBEDED_OBJECT));
data.setAviEmbedObject(kuneProperties.get(KuneProperties.AVI_EMBEDED_OBJECT));
- data.setExtMediaDescrips(extMediaDescripManager.getAll());
+ data.setExtMediaDescrips(extMediaDescManager.getAll());
return mapper.map(data, InitDataDTO.class);
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/sn/UserBuddiesData.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,17 +26,17 @@
public class UserBuddiesData {
- public static UserBuddiesData EMPTY = new UserBuddiesData();
+ public static final UserBuddiesData EMPTY = new UserBuddiesData();
private List<User> buddies;
- int otherExternalBuddies;
+ private int otherExtBuddies;
public UserBuddiesData() {
- otherExternalBuddies = 0;
+ otherExtBuddies = 0;
buddies = new ArrayList<User>();
}
- public boolean contains(String shortName) {
+ public boolean contains(final String shortName) {
for (User buddie : buddies) {
if (buddie.getShortName().equals(shortName)) {
return true;
@@ -49,20 +49,20 @@
return buddies;
}
- public int getOtherExternalBuddies() {
- return otherExternalBuddies;
+ public int getOtherExtBuddies() {
+ return otherExtBuddies;
}
- public void setBuddies(List<User> buddies) {
+ public void setBuddies(final List<User> buddies) {
this.buddies = buddies;
}
- public void setOtherExternalBuddies(int otherExternalBuddies) {
- this.otherExternalBuddies = otherExternalBuddies;
+ public void setOtherExtBuddies(final int otherExtBuddies) {
+ this.otherExtBuddies = otherExtBuddies;
}
@Override
public String toString() {
- return "UserBuddiesData[ext: " + otherExternalBuddies + " / int: " + buddies + "]";
+ return "UserBuddiesData[ext: " + otherExtBuddies + " / int: " + buddies + "]";
}
}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/utils/StringW.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/utils/StringW.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/utils/StringW.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -86,6 +86,7 @@
*
* @author timster at mac.com
*/
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
public static String truncateNicely(String str, int lower, int upper, String appendToEnd) {
// strip markup from the string
str = XmlW.removeXml(str);
@@ -180,6 +181,7 @@
*
* @return String that has been word wrapped
*/
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
static public String wordWrap(String str, int width, String delim, String split, boolean delimInside) {
int sz = str.length();
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/utils/XmlW.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/utils/XmlW.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/utils/XmlW.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -29,6 +29,7 @@
*/
final public class XmlW {
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
static public String escapeXml(String str) {
str = StringUtils.replace(str, "&", "&");
str = StringUtils.replace(str, "<", "<");
@@ -59,6 +60,7 @@
return unescapeXml(text.substring(attrStartIdx, attrCloseIdx));
}
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
static public String getContent(String tag, String text) {
int idx = XmlW.getIndexOpeningTag(tag, text);
if (idx == -1) {
@@ -135,6 +137,7 @@
return buffer.toString();
}
+ // @PMD:REVIEWED:AvoidReassigningParameters: by vjrj on 21/05/09 14:13
static public String unescapeXml(String str) {
str = StringUtils.replace(str, "&", "&");
str = StringUtils.replace(str, "<", "<");
Modified: trunk/src/main/java/org/ourproject/kune/rack/Rack.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/Rack.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/Rack.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -48,7 +48,7 @@
import com.google.inject.Module;
public class Rack {
- public static final Log log = LogFactory.getLog(Rack.class);
+ public static final Log LOG = LogFactory.getLog(Rack.class);
private final ArrayList<Dock> docks;
private final ArrayList<Module> modules;
private final ArrayList<RequestMatcher> excludes;
@@ -67,7 +67,7 @@
}
public void add(final Dock dock) {
- log.debug("INSTALLING: " + dock.toString());
+ LOG.debug("INSTALLING: " + dock.toString());
docks.add(dock);
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/RackHelper.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/RackHelper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/RackHelper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -22,8 +22,10 @@
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
-public class RackHelper {
- private RackHelper() {
+public final class RackHelper {
+ public static String buildForwardString(final ServletRequest request, final String forward) {
+ String parameters = RackHelper.extractParameters(request);
+ return new StringBuilder(forward).append(parameters).toString();
}
public static String extractParameters(final ServletRequest request) {
@@ -49,9 +51,7 @@
return httpServletRequest.getRequestURI();
}
- public static String buildForwardString(final ServletRequest request, final String forward) {
- String parameters = RackHelper.extractParameters(request);
- return new StringBuilder(forward).append(parameters).toString();
+ private RackHelper() {
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/RackServletFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,6 +32,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.ourproject.kune.platf.server.ServerException;
import org.ourproject.kune.rack.dock.Dock;
import org.ourproject.kune.rack.dock.RequestMatcher;
@@ -69,7 +70,7 @@
}
public static final String INJECTOR_ATTRIBUTE = Injector.class.getName();
private static final String MODULE_PARAMETER = RackModule.class.getName();
- private static final Log log = LogFactory.getLog(RackServletFilter.class);
+ private static final Log LOG = LogFactory.getLog(RackServletFilter.class);
private List<Dock> docks;
private List<RequestMatcher> excludes;
@@ -98,7 +99,7 @@
}
public void init(final FilterConfig filterConfig) throws ServletException {
- log.debug("INITIALIZING RackServletFilter...");
+ LOG.debug("INITIALIZING RackServletFilter...");
final RackModule module = getModule(filterConfig);
final RackBuilder builder = new RackBuilder();
module.configure(builder);
@@ -110,7 +111,7 @@
docks = rack.getDocks();
excludes = rack.getExcludes();
initFilters(filterConfig);
- log.debug("INITIALIZATION DONE!");
+ LOG.debug("INITIALIZATION DONE!");
}
private RackModule getModule(final FilterConfig filterConfig) {
@@ -120,14 +121,14 @@
final RackModule module = (RackModule) clazz.newInstance();
return module;
} catch (final Exception e) {
- throw new RuntimeException("couldn't instantiate the rack module", e);
+ throw new ServerException("couldn't instantiate the rack module", e);
}
}
private String getModuleName(final FilterConfig filterConfig) {
final String moduleName = filterConfig.getInitParameter(MODULE_PARAMETER);
if (moduleName == null) {
- throw new RuntimeException("Rack module name can't be null!");
+ throw new ServerException("Rack module name can't be null!");
}
return moduleName;
}
@@ -146,7 +147,7 @@
private void startContainerListeners(final List<Class<? extends ContainerListener>> listenerClasses,
final Injector injector) {
- log.debug("STARTING CONTAINER LISTENERS...");
+ LOG.debug("STARTING CONTAINER LISTENERS...");
for (final Class<? extends ContainerListener> listenerClass : listenerClasses) {
final ContainerListener listener = injector.getInstance(listenerClass);
listener.start();
@@ -157,7 +158,7 @@
@SuppressWarnings("unused")
private void stopContainerListeners(final List<Class<? extends ContainerListener>> listenerClasses,
final Injector injector) {
- log.debug("STOPING CONTAINER LISTENERS...");
+ LOG.debug("STOPING CONTAINER LISTENERS...");
for (final Class<? extends ContainerListener> listenerClass : listenerClasses) {
final ContainerListener listener = injector.getInstance(listenerClass);
listener.stop();
Copied: trunk/src/main/java/org/ourproject/kune/rack/filters/AbstractInjectedFilter.java (from rev 1105, trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java)
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java 2009-04-29 22:05:47 UTC (rev 1105)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/AbstractInjectedFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -0,0 +1,50 @@
+/*
+ *
+ * Copyright (C) 2007-2009 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.rack.filters;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+
+import org.ourproject.kune.rack.RackServletFilter;
+
+import com.google.inject.Injector;
+
+public abstract class AbstractInjectedFilter implements Filter {
+
+ protected ServletContext ctx;
+
+ public abstract void destroy();
+
+ public <T> T getInstance(final Class<T> type) {
+ return getInjector().getInstance(type);
+ }
+
+ public void init(final FilterConfig filterConfig) throws ServletException {
+ this.ctx = filterConfig.getServletContext();
+ getInjector().injectMembers(this);
+ }
+
+ private Injector getInjector() {
+ return (Injector) ctx.getAttribute(RackServletFilter.INJECTOR_ATTRIBUTE);
+ }
+
+}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/ForwardFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/ForwardFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/ForwardFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,7 +31,7 @@
import org.ourproject.kune.rack.RackHelper;
-public class ForwardFilter extends InjectedFilter {
+public class ForwardFilter extends AbstractInjectedFilter {
// private static final Log log = LogFactory.getLog(ForwardFilter.class);
private final String forward;
@@ -46,6 +46,10 @@
this.pattern = Pattern.compile(pattern);
}
+ @Override
+ public void destroy() {
+ }
+
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
Deleted: trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/InjectedFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,50 +0,0 @@
-/*
- *
- * Copyright (C) 2007-2009 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.rack.filters;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import org.ourproject.kune.rack.RackServletFilter;
-
-import com.google.inject.Injector;
-
-public abstract class InjectedFilter implements Filter {
- protected ServletContext ctx;
-
- public void destroy() {
- }
-
- public <T> T getInstance(final Class<T> type) {
- return getInjector().getInstance(type);
- }
-
- public void init(final FilterConfig filterConfig) throws ServletException {
- this.ctx = filterConfig.getServletContext();
- getInjector().injectMembers(this);
- }
-
- private Injector getInjector() {
- return (Injector) ctx.getAttribute(RackServletFilter.INJECTOR_ATTRIBUTE);
- }
-
-}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/ListenerFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/ListenerFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/ListenerFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -28,15 +28,19 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-public class ListenerFilter extends InjectedFilter {
- private Class<? extends ApplicationListener> listenerClass;
+public class ListenerFilter extends AbstractInjectedFilter {
+ private final Class<? extends ApplicationListener> listenerClass;
- public ListenerFilter(Class<? extends ApplicationListener> listenerClass) {
+ public ListenerFilter(final Class<? extends ApplicationListener> listenerClass) {
this.listenerClass = listenerClass;
}
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
- ServletException {
+ @Override
+ public void destroy() {
+ }
+
+ public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
+ throws IOException, ServletException {
ApplicationListener listener = super.getInstance(listenerClass);
listener.doBefore((HttpServletRequest) request, (HttpServletResponse) response);
chain.doFilter(request, response);
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/LogFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -33,7 +33,7 @@
import org.ourproject.kune.rack.RackHelper;
public class LogFilter implements Filter {
- public static final Log log = LogFactory.getLog(LogFilter.class);
+ public static final Log LOG = LogFactory.getLog(LogFilter.class);
public void destroy() {
}
@@ -41,7 +41,7 @@
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
// final long start = System.currentTimeMillis();
- log.debug("REQUEST: " + RackHelper.getURI(request));
+ LOG.debug("REQUEST: " + RackHelper.getURI(request));
chain.doFilter(request, response);
// final long finish = System.currentTimeMillis();
// log.debug("TOTAL TIME: " + (finish - start) + " miliseconds");
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/gwts/GWTServiceFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,12 +32,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ourproject.kune.rack.RackHelper;
-import org.ourproject.kune.rack.filters.InjectedFilter;
+import org.ourproject.kune.rack.filters.AbstractInjectedFilter;
import com.google.gwt.user.client.rpc.RemoteService;
-public class GWTServiceFilter extends InjectedFilter {
- public static final Log log = LogFactory.getLog(GWTServiceFilter.class);
+public class GWTServiceFilter extends AbstractInjectedFilter {
+ public static final Log LOG = LogFactory.getLog(GWTServiceFilter.class);
private final Class<? extends RemoteService> serviceClass;
private final DelegatedRemoteServlet servlet;
@@ -47,10 +47,14 @@
this.servlet = new DelegatedRemoteServlet();
}
+ @Override
+ public void destroy() {
+ }
+
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
- log.info("--------------------------------------------------------------------------------");
- log.debug("SERVICE: " + RackHelper.getURI(request) + " - " + serviceClass.getSimpleName());
+ LOG.info("--------------------------------------------------------------------------------");
+ LOG.debug("SERVICE: " + RackHelper.getURI(request) + " - " + serviceClass.getSimpleName());
final RemoteService service = getInstance(serviceClass);
servlet.setService(service);
servlet.doPost((HttpServletRequest) request, (HttpServletResponse) response);
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/rest/DefaultRESTMethodFinder.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/rest/DefaultRESTMethodFinder.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/rest/DefaultRESTMethodFinder.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -27,20 +27,20 @@
import org.apache.commons.logging.LogFactory;
public class DefaultRESTMethodFinder implements RESTMethodFinder {
- private static final Log log = LogFactory.getLog(DefaultRESTMethodFinder.class);
+ private static final Log LOG = LogFactory.getLog(DefaultRESTMethodFinder.class);
- private HashMap<Class<?>, RESTServiceDefinition> definitionCache;
+ private final HashMap<Class<?>, RESTServiceDefinition> definitionCache;
public DefaultRESTMethodFinder() {
this.definitionCache = new HashMap<Class<?>, RESTServiceDefinition>();
}
- public RESTMethod findMethod(String methodName, Parameters parameters, Class<?> serviceType) {
+ public RESTMethod findMethod(final String methodName, final Parameters parameters, final Class<?> serviceType) {
RESTServiceDefinition serviceDefinition = getServiceDefinition(serviceType);
Method[] serviceMethods = serviceDefinition.getMethods();
- log.debug("SERVICE METHODS: " + Arrays.toString(serviceMethods));
+ LOG.debug("SERVICE METHODS: " + Arrays.toString(serviceMethods));
for (Method method : serviceMethods) {
- log.debug("CHEKING: " + method.toString());
+ LOG.debug("CHEKING: " + method.toString());
if (method.getName().equals(methodName)) {
REST methodAnnotation = method.getAnnotation(REST.class);
if (checkParams(methodAnnotation, parameters)) {
@@ -51,7 +51,16 @@
return null;
}
- private RESTServiceDefinition getServiceDefinition(Class<?> serviceType) {
+ private boolean checkParams(final REST methodAnnotation, final Parameters parameters) {
+ for (String name : methodAnnotation.params()) {
+ if (parameters.get(name) == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private RESTServiceDefinition getServiceDefinition(final Class<?> serviceType) {
RESTServiceDefinition serviceDefinition = definitionCache.get(serviceType);
if (serviceDefinition == null) {
serviceDefinition = new RESTServiceDefinition(serviceType);
@@ -59,13 +68,4 @@
}
return serviceDefinition;
}
-
- private boolean checkParams(REST methodAnnotation, Parameters parameters) {
- for (String name : methodAnnotation.params()) {
- if (parameters.get(name) == null) {
- return false;
- }
- }
- return true;
- }
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/rest/JSONLibRESTSerializer.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/rest/JSONLibRESTSerializer.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/rest/JSONLibRESTSerializer.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -23,6 +23,8 @@
import net.sf.json.JsonConfig;
import net.sf.json.util.CycleDetectionStrategy;
+import org.ourproject.kune.platf.server.ServerException;
+
public class JSONLibRESTSerializer implements RESTSerializer {
private final JsonConfig config;
@@ -31,11 +33,11 @@
config.setCycleDetectionStrategy(CycleDetectionStrategy.LENIENT);
}
- public String serialize(Object target, String format) {
+ public String serialize(final Object target, final String format) {
if (format.equals(RESTMethod.FORMAT_JSON)) {
return JSONSerializer.toJSON(target, config).toString();
} else {
- throw new RuntimeException("format not implemented!");
+ throw new ServerException("format not implemented!");
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTMethod.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTMethod.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTMethod.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -21,6 +21,8 @@
import java.lang.reflect.Method;
+import org.ourproject.kune.platf.server.ServerException;
+
public class RESTMethod {
public static final String FORMAT_JSON = "json";
public static final String FORMAT_XML = "xml";
@@ -31,14 +33,22 @@
private Object response;
private final String format;
- public RESTMethod(Method method, String[] names, Parameters parameters, String format) {
+ public RESTMethod(final Method method, final String[] names, final Parameters parameters, final String format) {
this.method = method;
this.names = names;
this.parameters = parameters;
this.format = format;
}
- public boolean invoke(Object service) {
+ public String getFormat() {
+ return format;
+ }
+
+ public Object getResponse() {
+ return response;
+ }
+
+ public boolean invoke(final Object service) {
Object[] values = convertParameters();
try {
response = method.invoke(service, values);
@@ -48,19 +58,7 @@
}
}
- private Object[] convertParameters() {
- int total = names.length;
- Object[] values = new Object[total];
- Class<?>[] types = method.getParameterTypes();
-
- for (int index = 0; index < total; index++) {
- values[index] = convert(types[index], parameters.get(names[index]));
- }
-
- return values;
- }
-
- private Object convert(Class<?> type, String stringValue) {
+ private Object convert(final Class<?> type, final String stringValue) {
if (type.equals(String.class)) {
return stringValue;
} else if (type.equals(Integer.TYPE) || type.equals(Integer.class)) {
@@ -68,16 +66,20 @@
} else if (type.equals(Long.TYPE) || type.equals(Long.class)) {
return Long.parseLong(stringValue);
} else {
- throw new RuntimeException("unable to convert parameter in JSON method to type: " + type);
+ throw new ServerException("unable to convert parameter in JSON method to type: " + type);
}
}
- public String getFormat() {
- return format;
- }
+ private Object[] convertParameters() {
+ int total = names.length;
+ Object[] values = new Object[total];
+ Class<?>[] types = method.getParameterTypes();
- public Object getResponse() {
- return response;
+ for (int index = 0; index < total; index++) {
+ values[index] = convert(types[index], parameters.get(names[index]));
+ }
+
+ return values;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTServiceFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTServiceFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/rest/RESTServiceFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -32,12 +32,12 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ourproject.kune.rack.RackHelper;
-import org.ourproject.kune.rack.filters.InjectedFilter;
+import org.ourproject.kune.rack.filters.AbstractInjectedFilter;
import com.google.inject.Inject;
-public class RESTServiceFilter extends InjectedFilter {
- private static final Log log = LogFactory.getLog(RESTServiceFilter.class);
+public class RESTServiceFilter extends AbstractInjectedFilter {
+ private static final Log LOG = LogFactory.getLog(RESTServiceFilter.class);
private final Pattern pattern;
private final Class<?> serviceClass;
@@ -50,12 +50,16 @@
this.pattern = Pattern.compile(pattern);
}
+ @Override
+ public void destroy() {
+ }
+
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
String methodName = getMethodName(request);
ParametersAdapter parameters = new ParametersAdapter(request);
- log.debug("JSON METHOD: '" + methodName + "' on: " + serviceClass.getSimpleName());
+ LOG.debug("JSON METHOD: '" + methodName + "' on: " + serviceClass.getSimpleName());
response.setCharacterEncoding("utf-8");
response.setContentType("text/json");
Modified: trunk/src/main/java/org/ourproject/kune/rack/filters/servlet/ServletServiceFilter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/rack/filters/servlet/ServletServiceFilter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/rack/filters/servlet/ServletServiceFilter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -31,9 +31,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.ourproject.kune.rack.RackHelper;
-import org.ourproject.kune.rack.filters.InjectedFilter;
+import org.ourproject.kune.rack.filters.AbstractInjectedFilter;
-public class ServletServiceFilter extends InjectedFilter {
+public class ServletServiceFilter extends AbstractInjectedFilter {
Log log = LogFactory.getLog(ServletServiceFilter.class);
private final Class<? extends HttpServlet> servletClass;
@@ -41,6 +41,10 @@
this.servletClass = servletClass;
}
+ @Override
+ public void destroy() {
+ }
+
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
throws IOException, ServletException {
log.debug("SERVICE: " + RackHelper.getURI(request) + " - " + servletClass.getSimpleName());
Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -35,8 +35,8 @@
public WikiClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
- ContentCapabilitiesRegistry contentCapabilitiesRegistry) {
- super(NAME, i18n.t("wiki"), toolSelector, wsThemePresenter, ws, contentCapabilitiesRegistry);
+ final ContentCapabilitiesRegistry cntCapabReg) {
+ super(NAME, i18n.t("wiki"), toolSelector, wsThemePresenter, ws, cntCapabReg);
// registerAclEditableTypes(TYPE_DOCUMENT, TYPE_UPLOADEDFILE);
registerAuthorableTypes(TYPE_WIKIPAGE, TYPE_UPLOADEDFILE);
@@ -55,7 +55,7 @@
return NAME;
}
- protected void registerIcons() {
+ private void registerIcons() {
registerContentTypeIcon(TYPE_FOLDER, "images/nav/folder.png");
// registerContentTypeIcon(TYPE_FOLDER, "images/nav/wiki.png");
registerContentTypeIcon(TYPE_WIKIPAGE, "images/nav/wikipage.png");
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -133,8 +133,7 @@
});
}
- protected void createActions() {
- }
+ protected abstract void createActions();
protected void createContentModeratedActions(final String parentMenuTitle, final String... contentsModerated) {
createSetStatusAction(AccessRolDTO.Administrator, i18n.t("Published online"), ContentStatusDTO.publishedOnline,
@@ -252,11 +251,9 @@
new AsyncCallback<Object>() {
public void onFailure(final Throwable caught) {
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final SessionExpiredException e) {
+ if (caught instanceof SessionExpiredException) {
errorHandler.doSessionExpired();
- } catch (final Throwable e) {
+ } else {
NotifyUser.error(i18n.t("Error saving document. Retrying..."));
errorHandler.process(caught);
editor.onSaveFailed();
@@ -383,8 +380,7 @@
return addContent;
}
- protected void createPostSessionInitActions() {
- }
+ protected abstract void createPostSessionInitActions();
protected ActionToolbarMenuDescriptor<StateToken> createRefreshCntAction(final String parentMenuTitle,
final String... registerInTypes) {
@@ -614,13 +610,10 @@
private void register(final ActionToolbarMenuAndItemDescriptor<StateToken> action, final Position position,
final String... registerInTypes) {
- switch (position) {
- case ctx:
+ if (position.equals(Position.ctx)) {
contextActionRegistry.addAction(action, registerInTypes);
- break;
- case cnt:
+ } else if (position.equals(Position.cnt)) {
contentActionRegistry.addAction(action, registerInTypes);
- break;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/ContentEditor.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -97,7 +97,7 @@
}
public void setFileMenuTitle(String fileMenuTitleNew) {
- basicEditor.getTopBar().setParentMenuTitle(RTEditor.topbarPosition, fileMenuTitle, null, fileMenuTitleNew);
+ basicEditor.getTopBar().setParentMenuTitle(RTEditor.TOPBAR, fileMenuTitle, null, fileMenuTitleNew);
}
@Override
@@ -109,7 +109,7 @@
private void addContentActions() {
ActionToolbarMenuDescriptor<Object> rename = new ActionToolbarMenuDescriptor<Object>(AccessRolDTO.Editor,
- RTEditor.topbarPosition, new Listener0() {
+ RTEditor.TOPBAR, new Listener0() {
public void onEvent() {
entityTitle.edit();
// basicEditor.setFocus(false);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityHeaderPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -30,11 +30,11 @@
import com.calclab.suco.client.events.Listener2;
public class EntityHeaderPresenter implements EntityHeader {
- int GROUP_MEDIUM_NAME_LIMIT_SIZE = 90;
- int GROUP_LARGE_NAME_LIMIT_SIZE = 20;
+ private static final int MEDIUM_NAME_LIMIT = 90;
+ private static final int LARGE_NAME_LIMIT = 20;
- private EntityHeaderView view;
- private final Session session;
+ private transient EntityHeaderView view;
+ private transient final Session session;
public EntityHeaderPresenter(final StateManager stateManager, final WsThemePresenter theme, final Session session) {
this.session = session;
@@ -51,7 +51,7 @@
});
}
- public void addWidget(View widget) {
+ public void addWidget(final View widget) {
view.addWidget(widget);
}
@@ -86,11 +86,11 @@
}
}
- void setLogoText(String name) {
+ void setLogoText(final String name) {
int length = name.length();
- if (length <= GROUP_LARGE_NAME_LIMIT_SIZE) {
+ if (length <= LARGE_NAME_LIMIT) {
view.setLargeFont();
- } else if (length <= GROUP_MEDIUM_NAME_LIMIT_SIZE) {
+ } else if (length <= MEDIUM_NAME_LIMIT) {
view.setMediumFont();
} else {
view.setSmallFont();
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/entityheader/EntityTextLogo.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -40,8 +40,8 @@
public EntityTextLogo() {
// Initialize
super();
- HorizontalPanel generalHP = new HorizontalPanel();
- VerticalPanel logoTextVP = new VerticalPanel();
+ final HorizontalPanel generalHP = new HorizontalPanel();
+ final VerticalPanel logoTextVP = new VerticalPanel();
logoImage = new Image();
logoLabel = new Label();
final Label expandCell = new Label("");
@@ -70,7 +70,7 @@
setStylePrimaryName("k-entitytextlogo");
addStyleName("k-entitytextlogo-no-border");
logoImage.setVisible(false);
- setLogoText("");
+ setLogoTextImpl("");
}
public void setLargeFont() {
@@ -78,7 +78,7 @@
logoLabel.addStyleName(LOGO_LARGE_FONT_STYLE);
}
- public void setLogoImage(AbstractImagePrototype imageProto) {
+ public void setLogoImage(final AbstractImagePrototype imageProto) {
imageProto.applyTo(logoImage);
}
@@ -88,7 +88,7 @@
}
public void setLogoText(final String text) {
- logoLabel.setText(text);
+ setLogoTextImpl(text);
}
public void setLogoVisible(final boolean visible) {
@@ -110,4 +110,8 @@
logoLabel.removeStyleName(LOGO_SMALL_FONT_STYLE);
logoLabel.removeStyleName(LOGO_MEDIUM_FONT_STYLE);
}
+
+ private void setLogoTextImpl(final String text) {
+ logoLabel.setText(text);
+ }
}
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -88,7 +88,7 @@
private LicenseDTO license;
public NewGroupPanel(final NewGroupPresenter presenter, final I18nTranslationService i18n,
- final Provider<LicenseWizard> licenseWizard, Images img) {
+ final Provider<LicenseWizard> licenseWizard, final Images img) {
super(NEWGROUP_WIZARD, WorkspaceMessages.REGISTER_A_NEW_GROUP_TITLE, true, true, 450, 430, "k-newgroup-icon",
i18n.t("Cancel"), CANCEL_BUTTON, i18n.t("Register"), REGISTER_BUTTON, new Listener0() {
public void onEvent() {
@@ -101,12 +101,12 @@
}, 9);
super.addListener(new WindowListenerAdapter() {
@Override
- public void onHide(Component component) {
+ public void onHide(final Component component) {
presenter.onClose();
}
@Override
- public void onShow(Component component) {
+ public void onShow(final Component component) {
KuneUiUtils.focusOnField(shortNameField);
}
});
@@ -170,10 +170,8 @@
mask(i18n.t("Processing"));
}
- public void setLicense(LicenseDTO license) {
- this.license = license;
- licenseImage.setUrl(license.getImageUrl());
- KuneUiUtils.setQuickTip(licenseImage, license.getLongName());
+ public void setLicense(final LicenseDTO license) {
+ setLicenseImpl(license);
}
public void setMessage(final String message, final Level level) {
@@ -247,7 +245,7 @@
licenseImage = new Image("images/lic/bysa80x15.png");
licenseImage.addClickListener(new ClickListener() {
- public void onClick(Widget arg0) {
+ public void onClick(final Widget arg0) {
KuneWindowUtils.open(license.getUrl());
}
});
@@ -261,10 +259,10 @@
changeLicenseButton.setTabIndex(5);
changeLicenseButton.addListener(new ButtonListenerAdapter() {
@Override
- public void onClick(Button button, EventObject e) {
+ public void onClick(final Button button, final EventObject e) {
licenseWizard.get().start(new Listener<LicenseDTO>() {
- public void onEvent(LicenseDTO license) {
- setLicense(license);
+ public void onEvent(final LicenseDTO license) {
+ setLicenseImpl(license);
}
});
}
@@ -314,4 +312,10 @@
return form;
}
+
+ private void setLicenseImpl(final LicenseDTO license) {
+ this.license = license;
+ licenseImage.setUrl(license.getImageUrl());
+ KuneUiUtils.setQuickTip(licenseImage, license.getLongName());
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -25,6 +25,7 @@
import org.ourproject.kune.platf.client.dto.LicenseDTO;
import org.ourproject.kune.platf.client.dto.StateToken;
import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple;
import org.ourproject.kune.platf.client.rpc.GroupServiceAsync;
@@ -37,24 +38,23 @@
import com.calclab.suco.client.events.Listener0;
import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class NewGroupPresenter implements NewGroup {
- private NewGroupView view;
- private final I18nTranslationService i18n;
- private final Session session;
- private final StateManager stateManager;
- private final Provider<GroupServiceAsync> groupServiceProvider;
- private boolean mustGoToPrevious;
+ private transient NewGroupView view;
+ private transient final I18nTranslationService i18n;
+ private transient final Session session;
+ private transient final StateManager stateManager;
+ private transient final Provider<GroupServiceAsync> groupService;
+ private transient boolean mustGoToPrevious;
public NewGroupPresenter(final I18nTranslationService i18n, final Session session, final StateManager stateManager,
- final Provider<GroupServiceAsync> groupServiceProvider) {
+ final Provider<GroupServiceAsync> groupService) {
this.i18n = i18n;
this.session = session;
this.stateManager = stateManager;
- this.groupServiceProvider = groupServiceProvider;
+ this.groupService = groupService;
stateManager.addSiteToken(SiteToken.newgroup.toString(), new Listener0() {
public void onEvent() {
doNewGroup();
@@ -113,16 +113,13 @@
final AsyncCallback<StateToken> callback = new AsyncCallback<StateToken>() {
public void onFailure(final Throwable caught) {
- try {
- throw caught;
- } catch (final GroupNameInUseException e) {
+ if (caught instanceof GroupNameInUseException) {
view.unMask();
setMessage(i18n.t(WorkspaceMessages.NAME_IN_ALREADY_IN_USE), Level.error);
- } catch (final Throwable e) {
+ } else {
view.unMask();
setMessage(i18n.t("Error creating group"), Level.error);
- GWT.log("Other kind of exception in group registration", null);
- throw new RuntimeException();
+ throw new UIException("Other kind of exception in group registration", caught);
}
}
@@ -134,8 +131,7 @@
view.unMask();
}
};
- groupServiceProvider.get().createNewGroup(session.getUserHash(), group, publicDesc, view.getTags(), null,
- callback);
+ groupService.get().createNewGroup(session.getUserHash(), group, publicDesc, view.getTags(), null, callback);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/EntityOptionsPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -56,8 +56,7 @@
@Override
public void createAndShow() {
// FIXME: use onAfterCreate in Factory/Module
- entityPreferencesGroup.createAll();
- super.createAndShow();
+ createAndShowItImpl();
}
public void setButtonVisible(final boolean visible) {
@@ -74,11 +73,16 @@
optionsButton.setText(i18n.t(PlatfMessages.ENT_OPTIONS_USER_TITLE));
}
+ private void createAndShowItImpl() {
+ entityPreferencesGroup.createAll();
+ super.createAndShow();
+ }
+
private void createOptionsButton() {
optionsButton = new EntityHeaderButton("", images.emblemSystem());
optionsButton.addClickListener(new ClickListener() {
public void onClick(final Widget arg0) {
- createAndShow();
+ createAndShowItImpl();
}
});
optionsButton.ensureDebugId(GROUP_OPTIONS_ICON);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -41,10 +41,10 @@
layout();
setProperties();
if (rate != null) {
- setRate(rate);
+ setRateImpl(rate);
}
if (byUsers != null) {
- setByUsers(byUsers);
+ setByUsersImpl(byUsers);
}
final Toolbar bottomBar = ws.getEntityWorkspace().getContentBottomBar();
bottomBar.addFill();
@@ -52,18 +52,11 @@
}
public void setByUsers(final Integer byUsers) {
- if (byUsers.intValue() == 0) {
- rateDesc.setText(i18n.t("(Not rated)"));
- } else if (byUsers.intValue() == 1) {
- // i18n params pluralization
- rateDesc.setText(i18n.t("([%d] user)", byUsers));
- } else {
- rateDesc.setText(i18n.t("([%d] users)", byUsers));
- }
+ setByUsersImpl(byUsers);
}
public void setRate(final Double rate) {
- setRate(Star.genStars(rate.doubleValue()));
+ setRateImpl(rate);
}
private void initialize() {
@@ -84,6 +77,17 @@
rateGrid.setWidget(0, 5, rateDesc);
}
+ private void setByUsersImpl(final Integer byUsers) {
+ if (byUsers.intValue() == 0) {
+ rateDesc.setText(i18n.t("(Not rated)"));
+ } else if (byUsers.intValue() == 1) {
+ // i18n params pluralization
+ rateDesc.setText(i18n.t("([%d] user)", byUsers));
+ } else {
+ rateDesc.setText(i18n.t("([%d] users)", byUsers));
+ }
+ }
+
private void setProperties() {
rateGrid.setCellPadding(0);
rateGrid.setCellSpacing(0);
@@ -93,7 +97,11 @@
rateDesc.addStyleName("kune-Margin-Small-lr");
}
- private void setRate(final Star stars[]) {
+ private void setRateImpl(final Double rate) {
+ setRateImpl(Star.genStars(rate.doubleValue()));
+ }
+
+ private void setRateImpl(final Star stars[]) {
for (int i = 0; i < 5; i++) {
stars[i].getImage().applyTo(starImg[i]);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -24,69 +24,69 @@
import com.google.gwt.user.client.ui.AbstractImagePrototype;
public class Star {
- private static final Images img = Images.App.getInstance();
+ private static final Images IMG = Images.App.getInstance();
public static final int GREY = 0;
public static final int YELLOW = 1;
public final static Star[] CLEAR = { new Star(), new Star(), new Star(), new Star(), new Star() };
- private AbstractImagePrototype image;
+ public static Star[] genStars(final double rate) {
+ Star[] stars;
+ stars = new Star[5];
+ final int rateTruncated = (int) rate;
+ final double rateDecimals = rate - rateTruncated;
- public Star() {
- image = img.starGrey();
+ for (int i = 0; i < 5; i++) {
+ if (i < rateTruncated) {
+ stars[i] = new Star(Star.YELLOW);
+ } else {
+ if (i == rateTruncated) {
+ stars[i] = new Star(rateDecimals);
+ } else {
+ stars[i] = new Star(Star.GREY);
+ }
+ }
+ }
+ return stars;
}
- public AbstractImagePrototype getImage() {
- return image;
+ private transient AbstractImagePrototype image;
+
+ public Star() {
+ image = IMG.starGrey();
}
public Star(final double rateDecimals) {
if (rateDecimals == 1) {
- image = img.starYellow();
+ image = IMG.starYellow();
} else if (rateDecimals == 0) {
- image = img.starGrey();
+ image = IMG.starGrey();
} else {
final int rateTrucated = (int) rateDecimals;
final int rateDecimal = (int) ((rateDecimals - rateTrucated) * 10) * 10;
if (rateDecimal == 10) {
- image = img.star10();
+ image = IMG.star10();
} else if (rateDecimal == 20) {
- image = img.star20();
+ image = IMG.star20();
} else if (rateDecimal == 30) {
- image = img.star30();
+ image = IMG.star30();
} else if (rateDecimal == 40) {
- image = img.star40();
+ image = IMG.star40();
} else if (rateDecimal == 50) {
- image = img.star50();
+ image = IMG.star50();
} else if (rateDecimal == 60) {
- image = img.star60();
+ image = IMG.star60();
} else if (rateDecimal == 70) {
- image = img.star70();
+ image = IMG.star70();
} else if (rateDecimal == 80) {
- image = img.star80();
+ image = IMG.star80();
} else if (rateDecimal == 90) {
- image = img.star90();
+ image = IMG.star90();
}
}
}
- public static Star[] genStars(final double rate) {
- Star[] stars;
- stars = new Star[5];
- final int rateTruncated = (int) rate;
- final double rateDecimals = rate - rateTruncated;
-
- for (int i = 0; i < 5; i++) {
- if (i < rateTruncated) {
- stars[i] = new Star(Star.YELLOW);
- } else {
- if (i == rateTruncated) {
- stars[i] = new Star(rateDecimals);
- } else {
- stars[i] = new Star(Star.GREY);
- }
- }
- }
- return stars;
+ public AbstractImagePrototype getImage() {
+ return image;
}
}
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 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -19,6 +19,7 @@
*/
package org.ourproject.kune.workspace.client.search;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
import org.ourproject.kune.platf.client.services.SearcherConstants;
import org.ourproject.kune.platf.client.ui.AbstractSearcherPanel;
@@ -188,13 +189,11 @@
searchField.addListener(new FieldListenerAdapter() {
@Override
- public void onSpecialKey(final Field field, final EventObject e) {
- switch (e.getKey()) {
- case KeyboardListener.KEY_ENTER:
+ public void onSpecialKey(final Field field, final EventObject event) {
+ if (event.getKey() == KeyboardListener.KEY_ENTER) {
presenter.doSearch(field.getValueAsString());
- break;
}
- e.stopEvent();
+ event.stopEvent();
}
});
@@ -204,7 +203,7 @@
searchBtn.addListener(new ButtonListenerAdapter() {
@Override
public void onClick(final Button button, final EventObject e) {
- presenter.doSearch(getTextToSearch());
+ presenter.doSearch(searchField.getValueAsString());
}
});
hp.add(form);
@@ -229,7 +228,7 @@
store = contentStore = createStore(fieldDefs, SearcherConstants.CONTENT_DATA_PROXY_URL, id);
break;
default:
- throw new RuntimeException("Unknown type of search");
+ throw new UIException("Unknown type of search");
}
final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { new ColumnConfig() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -28,6 +28,7 @@
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.errors.EmailAddressInUseException;
import org.ourproject.kune.platf.client.errors.GroupNameInUseException;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
import org.ourproject.kune.platf.client.rpc.UserServiceAsync;
import org.ourproject.kune.platf.client.state.Session;
@@ -37,7 +38,6 @@
import com.calclab.emiteuimodule.client.SubscriptionMode;
import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class RegisterPresenter extends SignInAbstractPresenter implements Register {
@@ -46,8 +46,9 @@
private final Provider<UserServiceAsync> userServiceProvider;
private final Provider<SignIn> signInProvider;
- public RegisterPresenter(Session session, StateManager stateManager, I18nUITranslationService i18n,
- Provider<UserServiceAsync> userServiceProvider, Provider<SignIn> signInProvider) {
+ public RegisterPresenter(final Session session, final StateManager stateManager,
+ final I18nUITranslationService i18n, final Provider<UserServiceAsync> userServiceProvider,
+ final Provider<SignIn> signInProvider) {
super(session, stateManager, i18n);
this.userServiceProvider = userServiceProvider;
this.signInProvider = signInProvider;
@@ -69,7 +70,7 @@
return view;
}
- public void init(RegisterView view) {
+ public void init(final RegisterView view) {
this.view = view;
super.view = view;
}
@@ -87,25 +88,21 @@
final TimeZoneDTO timezone = new TimeZoneDTO();
timezone.setId(view.getTimezone());
- final boolean wantPersonalHomepage = view.wantPersonalHomepage();
+ final boolean wantHomepage = view.wantPersonalHomepage();
final UserDTO user = new UserDTO(view.getLongName(), view.getShortName(), view.getRegisterPassword(),
view.getEmail(), language, country, timezone, null, true, SubscriptionMode.manual, "blue");
final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() {
public void onFailure(final Throwable caught) {
view.unMask();
- try {
- throw caught;
- } catch (final EmailAddressInUseException e) {
+ if (caught instanceof EmailAddressInUseException) {
view.setErrorMessage(i18n.t(PlatfMessages.EMAIL_IN_USE), Level.error);
- } catch (final GroupNameInUseException e) {
+ } else if (caught instanceof GroupNameInUseException) {
view.setErrorMessage(i18n.t(PlatfMessages.NAME_IN_USE), Level.error);
- } catch (final Throwable e) {
+ } else {
view.setErrorMessage(i18n.t("Error during registration."), Level.error);
- GWT.log("Other kind of exception in user registration" + e.getMessage() + ", "
- + e.getLocalizedMessage(), null);
- e.printStackTrace();
- throw new RuntimeException();
+ throw new UIException("Other kind of exception in user registration", caught);
+
}
}
@@ -114,14 +111,14 @@
stateManager.gotoToken(userInfoDTO.getHomePage());
view.hide();
view.unMask();
- if (wantPersonalHomepage) {
+ if (wantHomepage) {
view.showWelcolmeDialog();
} else {
view.showWelcolmeDialogNoHomepage();
}
}
};
- userServiceProvider.get().createUser(user, wantPersonalHomepage, callback);
+ userServiceProvider.get().createUser(user, wantHomepage, callback);
}
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -42,8 +42,8 @@
private final Provider<UserServiceAsync> userServiceProvider;
private final Provider<Register> registerProvider;
- public SignInPresenter(Session session, StateManager stateManager, I18nUITranslationService i18n,
- Provider<UserServiceAsync> userServiceProvider, Provider<Register> registerProvider) {
+ public SignInPresenter(final Session session, final StateManager stateManager, final I18nUITranslationService i18n,
+ final Provider<UserServiceAsync> userServiceProvider, final Provider<Register> registerProvider) {
super(session, stateManager, i18n);
this.userServiceProvider = userServiceProvider;
this.registerProvider = registerProvider;
@@ -66,7 +66,7 @@
return view;
}
- public void init(SignInView view) {
+ public void init(final SignInView view) {
this.view = view;
super.view = view;
}
@@ -93,11 +93,9 @@
public void onFailure(final Throwable caught) {
view.unMask();
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final UserAuthException e) {
+ if (caught instanceof UserAuthException) {
view.setErrorMessage(i18n.t(PlatfMessages.INCORRECT_NICKNAME_EMAIL_OR_PASSWORD), Level.error);
- } catch (final Throwable e) {
+ } else {
view.setErrorMessage("Error in login", Level.error);
Log.error("Other kind of exception in SignInPresenter/doLogin");
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitepublic/SitePublicSpaceLinkPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -54,7 +54,7 @@
siteBar.addFill();
gotoPublic.addStyleName("kune-Margin-Medium-r");
- setContentPublic(true);
+ setContentPublicImpl(true);
gotoPublic.addClickListener(new ClickListener() {
public void onClick(final Widget sender) {
gotoPublic();
@@ -80,9 +80,8 @@
this.publicUrl = publicUrl;
}
- public void setContentPublic(boolean visible) {
- gotoPublic.setVisible(visible);
- contentNoPublic.setVisible(!visible);
+ public void setContentPublic(final boolean visible) {
+ setContentPublicImpl(visible);
}
public void setVisible(final boolean visible) {
@@ -93,4 +92,9 @@
private void gotoPublic() {
Window.open(publicUrl, "_kunepublic", "");
}
+
+ private void setContentPublicImpl(final boolean visible) {
+ gotoPublic.setVisible(visible);
+ contentNoPublic.setVisible(!visible);
+ }
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -42,7 +42,7 @@
private final TextBox searchTextBox;
private final AbstractToolbar siteBar;
- public SiteSearchPanel(final SiteSearchPresenter presenter, final WorkspaceSkeleton ws, Images img) {
+ public SiteSearchPanel(final SiteSearchPresenter presenter, final WorkspaceSkeleton ws, final Images img) {
siteBar = ws.getSiteBar();
siteBar.addSpacer();
searchButton = new PushButton(img.kuneSearchIco().createImage(), img.kuneSearchIcoPush().createImage());
@@ -54,7 +54,7 @@
siteBar.addSpacer();
siteBar.add(searchTextBox);
- setTextSearchSmall();
+ setTextSearchSmallImpl();
searchTextBox.addFocusListener(new FocusListener() {
public void onFocus(final Widget arg0) {
presenter.onSearchFocus();
@@ -102,7 +102,7 @@
searchTextBox.setText(text);
}
- public void setTextSearch(String text) {
+ public void setTextSearch(final String text) {
searchTextBox.setText(text);
}
@@ -111,6 +111,10 @@
}
public void setTextSearchSmall() {
+ setTextSearchSmallImpl();
+ }
+
+ private void setTextSearchSmallImpl() {
searchTextBox.setPixelSize(SEARCH_TEXT_WIDTH_SMALL, SEARCH_TEXT_HEIGHT);
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -26,6 +26,7 @@
import org.ourproject.kune.platf.client.actions.BeforeActionListener;
import org.ourproject.kune.platf.client.dto.UserInfoDTO;
import org.ourproject.kune.platf.client.errors.SessionExpiredException;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException;
import org.ourproject.kune.platf.client.rpc.UserServiceAsync;
import org.ourproject.kune.platf.client.services.ErrorHandler;
@@ -35,21 +36,20 @@
import com.calclab.suco.client.events.Listener;
import com.calclab.suco.client.events.Listener0;
import com.calclab.suco.client.ioc.Provider;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.rpc.AsyncCallback;
public class SiteSignOutLinkPresenter implements SiteSignOutLink {
- private SiteSignOutLinkView view;
- private final Session session;
- private final Provider<UserServiceAsync> userServiceProvider;
- private final BeforeActionCollection beforeSignOutCollection;
+ private transient SiteSignOutLinkView view;
+ private transient final Session session;
+ private transient final Provider<UserServiceAsync> userService;
+ private transient final BeforeActionCollection beforeSignOut;
- public SiteSignOutLinkPresenter(final Session session, final Provider<UserServiceAsync> userServiceProvider,
- final Provider<ErrorHandler> kuneErrorHandlerProvider) {
+ public SiteSignOutLinkPresenter(final Session session, final Provider<UserServiceAsync> userService,
+ final Provider<ErrorHandler> errorHandler) {
this.session = session;
- this.userServiceProvider = userServiceProvider;
+ this.userService = userService;
session.onUserSignIn(new Listener<UserInfoDTO>() {
public void onEvent(final UserInfoDTO userInfoDTO) {
view.setVisible(true);
@@ -60,32 +60,29 @@
view.setVisible(false);
}
});
- kuneErrorHandlerProvider.get().onSessionExpired(new Listener0() {
+ errorHandler.get().onSessionExpired(new Listener0() {
public void onEvent() {
clientUIsignOut();
}
});
- beforeSignOutCollection = new BeforeActionCollection();
+ beforeSignOut = new BeforeActionCollection();
}
- public void addBeforeSignOut(BeforeActionListener listener) {
- beforeSignOutCollection.add(listener);
+ public void addBeforeSignOut(final BeforeActionListener listener) {
+ beforeSignOut.add(listener);
}
public void doSignOut() {
- if (beforeSignOutCollection.checkBeforeAction()) {
- userServiceProvider.get().logout(session.getUserHash(), new AsyncCallback<Object>() {
+ if (beforeSignOut.checkBeforeAction()) {
+ userService.get().logout(session.getUserHash(), new AsyncCallback<Object>() {
public void onFailure(final Throwable caught) {
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final SessionExpiredException e) {
+ if (caught instanceof SessionExpiredException) {
clientUIsignOut();
- } catch (final UserMustBeLoggedException e) {
+ } else if (caught instanceof UserMustBeLoggedException) {
clientUIsignOut();
- } catch (final Throwable e) {
- GWT.log("Other kind of exception in doLogout", null);
- throw new RuntimeException();
+ } else {
+ throw new UIException("Other kind of exception in doLogout", caught);
}
}
@@ -109,8 +106,8 @@
view.setVisible(false);
}
- public void removeBeforeSignOut(BeforeActionListener listener) {
- beforeSignOutCollection.remove(listener);
+ public void removeBeforeSignOut(final BeforeActionListener listener) {
+ beforeSignOut.remove(listener);
}
private void clientUIsignOut() {
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -115,7 +115,7 @@
new AccessRightsDTO(true, true, true), false), avatarUrl, user.getName(), tooltip);
}
boolean hasLocalBuddies = buddies.size() > 0;
- int numExtBuddies = userBuddies.getOtherExternalBuddies();
+ int numExtBuddies = userBuddies.getOtherExtBuddies();
if (numExtBuddies > 0) {
if (hasLocalBuddies) {
// i18n: plural
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -74,7 +74,7 @@
public SocialNetworkPresenter(final I18nTranslationService i18n, final StateManager stateManager,
final Session session, final Provider<SocialNetworkServiceAsync> snServiceProvider,
- GroupActionRegistry groupActionRegistry, final Provider<FileDownloadUtils> downloadProvider) {
+ final GroupActionRegistry groupActionRegistry, final Provider<FileDownloadUtils> downloadProvider) {
this.i18n = i18n;
this.stateManager = stateManager;
this.session = session;
@@ -128,23 +128,18 @@
return gridItem;
}
- protected String createTooltipWithLogo(String shortName, StateToken token, boolean hasLogo, boolean isPersonal) {
+ protected String createTooltipWithLogo(final String shortName, final StateToken token, final boolean hasLogo,
+ final boolean isPersonal) {
return "<table><tr><td>"
+ (hasLogo ? downloadProvider.get().getLogoAvatarHtml(token, hasLogo, isPersonal,
FileConstants.LOGO_ICON_DEFAULT_HEIGHT, 3) : "") + "</td><td>"
+ i18n.t(isPersonal ? "Nickname: [%s]" : "Group short name: [%s]", shortName) + "</td></tr></table>";
}
- protected boolean isMember(AccessRightsDTO rights) {
- boolean userIsAdmin = rights.isAdministrable();
- final boolean userIsCollab = !userIsAdmin && rights.isEditable();
- return isMember(userIsAdmin, userIsCollab);
- }
-
private void createButtons() {
participate = new ActionToolbarButtonDescriptor<StateToken>(AccessRolDTO.Viewer, membersBottom,
new Listener<StateToken>() {
- public void onEvent(StateToken parameter) {
+ public void onEvent(final StateToken parameter) {
NotifyUser.showProgressProcessing();
snServiceProvider.get().requestJoinGroup(session.getUserHash(),
session.getCurrentState().getStateToken(), new AsyncCallbackSimple<Object>() {
@@ -172,14 +167,14 @@
participate.setToolTip(i18n.t("Request to participate in this group"));
participate.setMustBeAuthenticated(false);
participate.setAddCondition(new ActionAddCondition<StateToken>() {
- public boolean mustBeAdded(StateToken token) {
+ public boolean mustBeAdded(final StateToken token) {
return !isMember(session.getCurrentState().getGroupRights());
}
});
unJoin = new ActionToolbarMenuDescriptor<StateToken>(AccessRolDTO.Editor, membersBottom,
new Listener<StateToken>() {
- public void onEvent(StateToken parameter) {
+ public void onEvent(final StateToken parameter) {
removeMemberAction();
}
});
@@ -322,6 +317,12 @@
});
}
+ private boolean isMember(final AccessRightsDTO rights) {
+ boolean userIsAdmin = rights.isAdministrable();
+ final boolean userIsCollab = !userIsAdmin && rights.isEditable();
+ return isMember(userIsAdmin, userIsCollab);
+ }
+
private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) {
return userIsAdmin || userIsCollab;
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -40,7 +40,8 @@
private final Event2<StateToken, String> onSuccess;
private final Event2<StateToken, String> onFail;
- public RenameAction(I18nTranslationService i18n, Session session, Provider<ContentServiceAsync> contentService) {
+ public RenameAction(final I18nTranslationService i18n, final Session session,
+ final Provider<ContentServiceAsync> contentService) {
this.i18n = i18n;
this.session = session;
this.contentService = contentService;
@@ -62,15 +63,13 @@
final AsyncCallback<StateAbstractDTO> asyncCallback = new AsyncCallback<StateAbstractDTO>() {
public void onFailure(final Throwable caught) {
NotifyUser.hideProgress();
- try {
- throw caught;
- } catch (final NameInUseException e) {
+ if (caught instanceof NameInUseException) {
NotifyUser.error(i18n.tWithNT("This name already exists",
"It is used when a file or a folder with the same name already exists"));
- } catch (final NameNotPermittedException e) {
+ } else if (caught instanceof NameNotPermittedException) {
NotifyUser.error(i18n.tWithNT("This name is not permitted",
"It is used when a file or a folder does not have a permitted name"));
- } catch (final Throwable e) {
+ } else {
NotifyUser.error(i18n.t("Error renaming"));
}
onFail.fire(token, oldName);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -23,6 +23,7 @@
import java.util.List;
import org.ourproject.kune.platf.client.dto.StateAbstractDTO;
+import org.ourproject.kune.platf.client.errors.UIException;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.workspace.client.themes.WsThemePresenter;
@@ -37,7 +38,7 @@
public ToolSelectorPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter) {
tools = new HashMap<String, ToolSelectorItem>();
stateManager.onStateChanged(new Listener<StateAbstractDTO>() {
- public void onEvent(StateAbstractDTO state) {
+ public void onEvent(final StateAbstractDTO state) {
for (String tool : tools.keySet()) {
List<String> enabledTools = state.getEnabledTools();
if (enabledTools != null && enabledTools.contains(tool)) {
@@ -63,10 +64,10 @@
public void addTool(final ToolSelectorItem item) {
final String name = item.getShortName();
if (name == null) {
- throw new RuntimeException("You cannot add a tool without a name");
+ throw new UIException("You cannot add a tool without a name");
}
if (tools.get(name) != null) {
- throw new RuntimeException("A tool with the same name already added");
+ throw new UIException("A tool with the same name already added");
}
tools.put(name, item);
item.setSelected(false);
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/actions/ActionShortcutTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -5,6 +5,8 @@
import org.junit.Before;
import org.junit.Test;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationServiceMocked;
+import org.ourproject.kune.platf.client.i18n.Resources;
import org.ourproject.kune.platf.client.shortcuts.ShortcutDescriptor;
import com.google.gwt.user.client.ui.KeyboardListener;
@@ -22,10 +24,11 @@
@Before
public void before() {
+ new Resources(new I18nTranslationServiceMocked());
}
@Test
- public void ctrl_coma() {
+ public void ctrlComa() {
ShortcutDescriptor shortcut = new ShortcutDescriptor(true, ',');
assertEquals(" (Ctrl+,)", shortcut.toString());
assertTrue(shortcut.is(',', KeyboardListener.MODIFIER_CTRL));
@@ -34,7 +37,7 @@
}
@Test
- public void ctrl_s() {
+ public void ctrlS() {
ShortcutDescriptor shortcut = new ShortcutDescriptor(true, 's');
assertEquals(" (Ctrl+S)", shortcut.toString());
assertTrue(shortcut.is('s', KeyboardListener.MODIFIER_CTRL));
@@ -43,7 +46,7 @@
}
@Test
- public void ctrlS() {
+ public void ctrlSCapital() {
ShortcutDescriptor shortcut = new ShortcutDescriptor(true, 'S');
assertEquals(" (Ctrl+S)", shortcut.toString());
assertTrue(shortcut.is('S', KeyboardListener.MODIFIER_CTRL));
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/state/StateTokenTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/state/StateTokenTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateTokenTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -38,4 +38,15 @@
final StateToken token2 = new StateToken("abc", "da", 1L);
assertFalse(token1.equals(token2));
}
+
+ @Test
+ public void parseEncodedNotCatched() {
+ final StateToken token1 = new StateToken();
+ final StateToken token2 = new StateToken();
+ token1.getEncoded();
+ token2.getEncoded();
+ token1.setEncoded("abc.da.1.1");
+ token2.setEncoded("abc.da.1.2");
+ assertFalse(token1.equals(token2));
+ }
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/client/ui/rte/saving/RTESavingEditorPresenterTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -8,12 +8,12 @@
import org.mockito.Mockito;
import org.mockito.internal.verification.api.VerificationMode;
import org.ourproject.kune.platf.client.actions.toolbar.ActionToolbar;
-import org.ourproject.kune.platf.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationService;
+import org.ourproject.kune.platf.client.i18n.I18nTranslationServiceMocked;
+import org.ourproject.kune.platf.client.i18n.Resources;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.ui.rte.basic.RTEditor;
import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources;
-import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditorPresenter;
-import org.ourproject.kune.platf.client.ui.rte.saving.RTESavingEditorView;
import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper;
import org.ourproject.kune.platf.client.utils.TimerWrapper;
@@ -38,7 +38,8 @@
@SuppressWarnings("unchecked")
@Before
public void createObjects() {
- I18nUITranslationService i18n = Mockito.mock(I18nUITranslationService.class);
+ I18nTranslationService i18n = new I18nTranslationServiceMocked();
+ new Resources(i18n);
stateManager = Mockito.mock(StateManager.class);
deferredCommandWrapper = Mockito.mock(DeferredCommandWrapper.class);
rteEditor = Mockito.mock(RTEditor.class);
@@ -153,7 +154,7 @@
return newToken;
}
- private void verifyAskConfirmationCalled(VerificationMode mode) {
+ private void verifyAskConfirmationCalled(final VerificationMode mode) {
Mockito.verify(view, mode).askConfirmation(Mockito.anyString(), Mockito.anyString(),
(Listener0) Mockito.anyObject(), (Listener0) Mockito.anyObject());
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/DatabaseInitializationTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -81,9 +81,9 @@
@Test
public void testI18n() {
- assertNotNull(countryManager.find(new Long(75)));
+ assertNotNull(countryManager.find(Long.valueOf(75)));
assertNotNull(languageManager.findByCode("en"));
- assertNotNull(languageManager.find(new Long(1819)));
+ assertNotNull(languageManager.find(Long.valueOf(1819)));
}
@Test
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/HttpServletRequestMocked.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -45,6 +45,7 @@
return null;
}
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17
public Cookie[] getCookies() {
return null;
}
@@ -114,6 +115,7 @@
return null;
}
+ // @PMD:REVIEWED:ReturnEmptyArrayRatherThanNull: by vjrj on 21/05/09 15:17
public String[] getParameterValues(final String arg0) {
return null;
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/content/ContentServiceVariousTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -1,6 +1,7 @@
package org.ourproject.kune.platf.integration.content;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -52,7 +53,7 @@
defaultContent.getStateToken());
assertEquals(new Double(4.5), again.getCurrentUserRate());
assertEquals(new Double(4.5), again.getRate());
- assertEquals(new Integer(1), again.getRateByUsers());
+ assertEquals(Integer.valueOf(1), again.getRateByUsers());
}
@Test
@@ -173,7 +174,7 @@
final ContentSimpleDTO newDefContent = contentService.setAsDefaultContent(session.getHash(),
added.getStateToken());
- assertTrue(!defaultContent.getStateToken().equals(newDefContent.getStateToken()));
+ assertFalse(defaultContent.getStateToken().equals(newDefContent.getStateToken()));
assertTrue(added.getStateToken().equals(newDefContent.getStateToken()));
}
@@ -204,7 +205,7 @@
assertEquals(newTitle, folderAgain.getContainer().getName());
}
- private void checkResult(TagCloudResultDTO cloudResultDTO) {
+ private void checkResult(final TagCloudResultDTO cloudResultDTO) {
assertNotNull(cloudResultDTO.getTagCountList());
List<TagCountDTO> summaryTags = cloudResultDTO.getTagCountList();
assertEquals(3, summaryTags.size());
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/KuneSeleniumTestHelper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -9,6 +9,7 @@
import org.junit.BeforeClass;
import org.ourproject.kune.platf.client.dto.GroupType;
import org.ourproject.kune.platf.client.dto.StateToken;
+import org.ourproject.kune.platf.server.ServerException;
import org.ourproject.kune.workspace.client.WorkspaceMessages;
import org.ourproject.kune.workspace.client.newgroup.NewGroupPanel;
import org.ourproject.kune.workspace.client.signin.RegisterForm;
@@ -54,16 +55,16 @@
selenium.refresh();
selenium.windowMaximize();
} catch (final UnsupportedOperationException e) {
- System.err.println("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ");
+ new ServerException("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ");
}
}
- public void setMustCapture(boolean mustCapture) {
+ public void setMustCapture(final boolean mustCapture) {
this.mustCapture = mustCapture;
}
- protected void fillNewGroup1stPage(String shortname, String longName, String description, String tags,
- GroupType groupType) throws Exception {
+ protected void fillNewGroup1stPage(final String shortname, final String longName, final String description,
+ final String tags, final GroupType groupType) throws Exception {
type(NewGroupPanel.SHORTNAME_FIELD, shortname);
type(NewGroupPanel.LONGNAME_FIELD, longName);
type(NewGroupPanel.PUBLICDESC_FIELD, description);
@@ -95,24 +96,24 @@
}
}
- protected void newGroupRegistrationDefLicense(String shortname, String longName, String description, String tags)
- throws Exception {
+ protected void newGroupRegistrationDefLicense(final String shortname, final String longName,
+ final String description, final String tags) throws Exception {
GroupType organization = GroupType.ORGANIZATION;
signInAndNewGroup();
fillNewGroup1stPage(shortname, longName, description, tags, organization);
click(NewGroupPanel.REGISTER_BUTTON);
}
- protected void open(SiteToken token) {
+ protected void open(final SiteToken token) {
open(KUNE_BASE_URL + token.toString());
}
- protected void open(StateToken token) {
+ protected void open(final StateToken token) {
open(KUNE_BASE_URL + token.toString());
}
@Override
- protected void open(String url) {
+ protected void open(final String url) {
try {
selenium.setTimeout("0");
super.open(url);
@@ -127,8 +128,8 @@
waitForTextInside(gid(EntityTitlePanel.ENTITY_TITLE_RIGHT_TITLE), "Welcome to kune");
}
- protected void register(String shortName, String longName, String passwd, String passwdDup, String email,
- String country, String language, String tz, boolean wantHomepage) {
+ protected void register(final String shortName, final String longName, final String passwd, final String passwdDup,
+ final String email, final String country, final String language, final String tz, final boolean wantHomepage) {
click(gid(SiteSignInLinkPanel.SITE_SIGN_IN));
click(gid(SignInPanel.CREATE_ONE));
type(RegisterForm.NICK_FIELD, shortName);
@@ -159,7 +160,7 @@
click(RegisterPanel.REGISTER_BUTTON_ID);
}
- protected String registerValidUser(boolean wantHomepage) {
+ protected String registerValidUser(final boolean wantHomepage) {
String shortName = "u" + genPrefix();
register(shortName, "some name " + genPrefix(), "somepasswd", "somepasswd", genPrefix() + "@example.com",
"Andorra", "English", "MET", wantHomepage);
@@ -170,7 +171,7 @@
signIn("admin", "easyeasy");
}
- protected void signIn(String nick, String passwd) {
+ protected void signIn(final String nick, final String passwd) {
click(gid(SiteSignInLinkPanel.SITE_SIGN_IN));
type(SignInForm.NICKOREMAIL_FIELD, nick);
type(SignInForm.PASSWORD_FIELD, passwd);
@@ -189,7 +190,7 @@
click("gwt-debug-k-ssolp-lb");
}
- protected void verifyLoggedUserShorName(String userShortName) throws Exception {
+ protected void verifyLoggedUserShorName(final String userShortName) throws Exception {
waitForTextInside(gid(SiteUserMenuPanel.LOGGED_USER_MENU), userShortName);
}
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/integration/selenium/SeleniumTestHelper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -2,6 +2,7 @@
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.ourproject.kune.platf.server.ServerException;
import com.google.gwt.user.client.ui.UIObject;
import com.thoughtworks.selenium.DefaultSelenium;
@@ -12,7 +13,7 @@
private static boolean mustStopFinally = true;
@AfterClass
- public static void afterClass() throws Exception {
+ public static void afterClass() {
if (mustStopFinally) {
selenium.stop();
}
@@ -49,22 +50,22 @@
selenium.start();
}
- public static void setMustStopFinally(boolean mustStopFinally) {
+ public static void setMustStopFinally(final boolean mustStopFinally) {
SeleniumTestHelper.mustStopFinally = mustStopFinally;
}
- protected void click(String id) {
+ protected void click(final String id) {
selenium.click(id);
}
- protected void clickOnPushButton(String id) {
+ protected void clickOnPushButton(final String id) {
selenium.mouseOver(id);
selenium.mouseDown(id);
selenium.mouseUp(id);
}
- protected void fail(String message) throws Exception {
- throw new Exception(message);
+ protected void fail(final String message) throws Exception {
+ throw new ServerException(message);
}
/**
@@ -73,31 +74,32 @@
* @param id
* @return
*/
- protected String gid(String id) {
+ protected String gid(final String id) {
return UIObject.DEBUG_ID_PREFIX + id;
}
- protected String linkId(String link) {
+ protected String linkId(final String link) {
return "link=" + link;
}
- protected void open(String url) {
+ protected void open(final String url) {
try {
selenium.open(url);
} catch (final UnsupportedOperationException e) {
- System.err.println("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ");
+ new ServerException("Seems that selenium server is not running; run before: 'mvn selenium:start-server' ",
+ e);
}
}
- protected void setSpeed(int milliseconds) {
+ protected void setSpeed(final int milliseconds) {
selenium.setSpeed("" + milliseconds);
}
- protected void type(String id, String text) {
+ protected void type(final String id, final String text) {
selenium.type(id, text);
}
- protected void wait(int milliseconds) {
+ protected void wait(final int milliseconds) {
try {
Thread.sleep(milliseconds);
} catch (InterruptedException e) {
@@ -106,7 +108,7 @@
}
}
- protected void waitForTextInside(String id, String text) throws Exception {
+ protected void waitForTextInside(final String id, final String text) throws Exception {
for (int second = 0;; second++) {
if (second >= 60) {
fail("timeout");
@@ -122,7 +124,7 @@
}
}
- protected void waitForTextRegExp(String id, String text) throws Exception {
+ protected void waitForTextRegExp(final String id, final String text) throws Exception {
for (int second = 0;; second++) {
if (second >= 60) {
fail("timeout");
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/PersistencePreLoadedDataTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -77,9 +77,9 @@
assertEquals(0, userFinder.getAll().size());
assertEquals(0, groupFinder.getAll().size());
assertEquals(0, licenseFinder.getAll().size());
- english = new I18nLanguage(new Long(1819), "English", "English", "en");
+ english = new I18nLanguage(Long.valueOf(1819), "English", "English", "en");
languageManager.persist(english);
- gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
+ gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western", ",");
countryManager.persist(gb);
user = userManager.createUser(USER_SHORT_NAME, USER_LONG_NAME, USER_EMAIL, USER_PASSWORD, "en", "GB",
TimeZone.getDefault().getID());
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/TestDomainHelper.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/TestDomainHelper.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/TestDomainHelper.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -13,57 +13,6 @@
public abstract class TestDomainHelper {
- public static User createUser(final int number) {
- String shortName = "shortname" + number;
- String longName = "name" + number;
- User user = new User(shortName, longName, "email at domain" + number, "password" + number, null, null,
- TimeZone.getDefault());
- Group userGroup = new Group(shortName, longName);
- userGroup.setAdmissionType(AdmissionType.Closed);
- userGroup.setSocialNetwork(createSocialNetwork(userGroup, userGroup, userGroup, null));
- user.setUserGroup(userGroup);
- return user;
- }
-
- public static Container createFolderWithId(final long id) {
- Container container = new Container();
- container.setId(id);
- return container;
- }
-
- public static Container createFolderWithIdAndToolName(final int i, final String toolName) {
- Container container = createFolderWithId(i);
- container.setToolName(toolName);
- return container;
- }
-
- public static Container createFolderWithIdAndGroupAndTool(final int i, final String groupShortName,
- final String toolName) {
- Container container = createFolderWithIdAndToolName(i, toolName);
- Group owner = new Group();
- owner.setShortName(groupShortName);
- container.setOwner(owner);
- return container;
-
- }
-
- public static Group createGroup(final int number) {
- Group group = new Group("ysei" + number, "Yellow Submarine Environmental Initiative" + number);
- group.setId(new Long(number));
- return group;
- }
-
- public static SocialNetwork createSocialNetwork(final Group groupInAdmins, final Group groupInCollab,
- final Group groupInViewer, final Group groupInPendings) {
-
- SocialNetwork socialNetwork = new SocialNetwork();
- socialNetwork.addAdmin(groupInAdmins);
- socialNetwork.addCollaborator(groupInCollab);
- socialNetwork.addViewer(groupInViewer);
- socialNetwork.addPendingCollaborator(groupInPendings);
- return socialNetwork;
- }
-
public static AccessLists createAccessLists(final Group groupAdmin, final Group groupEditor, final Group groupViewer) {
AccessLists lists = new AccessLists();
@@ -79,16 +28,6 @@
return lists;
}
- public static Content createDescriptor(final long id, final String title, final String content) {
- Content descriptor = new Content();
- descriptor.setId(id);
- Revision rev = new Revision(descriptor);
- descriptor.addRevision(rev);
- rev.setTitle(title);
- rev.setBody(content);
- return descriptor;
- }
-
public static String createBigText() {
String text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce leo felis, cursus eget, scelerisque adipiscing, fringilla vel, sem. Vestibulum semper tristique sem. Etiam quam neque, consectetuer at, fermentum id, vulputate non, leo. Ut condimentum, mauris et sollicitudin faucibus, lectus arcu facilisis mi, eu pretium arcu tortor quis sem. Pellentesque sit amet nulla ut tellus dapibus blandit. Donec eu dolor vitae mi scelerisque pretium. Donec sit amet nunc ut risus laoreet porta. Integer dictum mi at mauris. Vivamus vulputate, dolor quis pharetra interdum, augue nisi congue eros, a consectetuer libero mi ut quam. Fusce commodo sem blandit massa. Phasellus vehicula varius felis.\n"
+ "\n"
@@ -237,4 +176,65 @@
+ "Cras vulputate. Praesent tempus fringilla diam. Suspendisse at elit. Cras ut nulla eget mi dapibus pretium. Etiam hendrerit tortor sed lectus. Cras mauris. Nam ligula. Mauris semper, arcu ut facilisis molestie, lorem sapien iaculis quam, at dignissim sapien mauris id pede. In metus ante, porttitor id, fringilla a, adipiscing eget, nisi. Ut ornare sapien nec velit. Aenean tortor metus, pellentesque vitae, iaculis eget, imperdiet nec, turpis. Vestibulum sit amet erat ac urna auctor imperdiet. Nulla facilisi. Quisque facilisis pede vel mi consequat dignissim. Vivamus sapien.\n";
return text;
}
+
+ public static Content createDescriptor(final long id, final String title, final String content) {
+ Content descriptor = new Content();
+ descriptor.setId(id);
+ Revision rev = new Revision(descriptor);
+ descriptor.addRevision(rev);
+ rev.setTitle(title);
+ rev.setBody(content);
+ return descriptor;
+ }
+
+ public static Container createFolderWithId(final long id) {
+ Container container = new Container();
+ container.setId(id);
+ return container;
+ }
+
+ public static Container createFolderWithIdAndGroupAndTool(final int i, final String groupShortName,
+ final String toolName) {
+ Container container = createFolderWithIdAndToolName(i, toolName);
+ Group owner = new Group();
+ owner.setShortName(groupShortName);
+ container.setOwner(owner);
+ return container;
+
+ }
+
+ public static Container createFolderWithIdAndToolName(final int i, final String toolName) {
+ Container container = createFolderWithId(i);
+ container.setToolName(toolName);
+ return container;
+ }
+
+ public static Group createGroup(final int number) {
+ Group group = new Group("ysei" + number, "Yellow Submarine Environmental Initiative" + number);
+ group.setId(Long.valueOf(number));
+ return group;
+ }
+
+ public static SocialNetwork createSocialNetwork(final Group groupInAdmins, final Group groupInCollab,
+ final Group groupInViewer, final Group groupInPendings) {
+
+ SocialNetwork socialNetwork = new SocialNetwork();
+ socialNetwork.addAdmin(groupInAdmins);
+ socialNetwork.addCollaborator(groupInCollab);
+ socialNetwork.addViewer(groupInViewer);
+ socialNetwork.addPendingCollaborator(groupInPendings);
+ return socialNetwork;
+ }
+
+ public static User createUser(final int number) {
+ String shortName = "shortname" + number;
+ String longName = "name" + number;
+ User user = new User(shortName, longName, "email at domain" + number, "password" + number, null, null,
+ TimeZone.getDefault());
+ Group userGroup = new Group(shortName, longName);
+ userGroup.setAdmissionType(AdmissionType.Closed);
+ userGroup.setSocialNetwork(createSocialNetwork(userGroup, userGroup, userGroup, null));
+ user.setUserGroup(userGroup);
+ return user;
+ }
}
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/finders/RateFinderTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -74,7 +74,7 @@
final Long rateByUsers = rateFinder.calculateRateNumberOfUsers(cd);
final Double average = (1.3 + 4.3) / 2;
assertEquals(average, rate);
- assertEquals(new Long(2), rateByUsers);
+ assertEquals(Long.valueOf(2), rateByUsers);
final Rate newRate1 = rateFinder.find(user1, cd);
final Rate newRate2 = rateFinder.find(user2, cd);
assertEquals(new Double(1.3), newRate1.getValue());
Modified: trunk/src/test/java/org/ourproject/kune/platf/server/manager/I18nManagerTest.java
===================================================================
--- trunk/src/test/java/org/ourproject/kune/platf/server/manager/I18nManagerTest.java 2009-05-13 14:29:29 UTC (rev 1111)
+++ trunk/src/test/java/org/ourproject/kune/platf/server/manager/I18nManagerTest.java 2009-05-21 18:31:14 UTC (rev 1112)
@@ -27,66 +27,18 @@
@Inject
I18nTranslationService translationService;
- @Before
- public void insertData() {
- openTransaction();
- I18nLanguage english = new I18nLanguage(new Long(1819), "English", "English", "en");
- I18nLanguage spanish = new I18nLanguage(new Long(5889), "Spanish", "Español", "es");
- I18nLanguage afrikaans = new I18nLanguage(new Long(114), "Afrikaans", "Afrikaans", "af");
- I18nLanguage greek = new I18nLanguage(new Long(1793), "Greek", "Ελληνικά", "el");
- languageManager.persist(english);
- languageManager.persist(spanish);
- languageManager.persist(afrikaans);
- languageManager.persist(greek);
- translationManager.persist(new I18nTranslation("Sunday [weekday]", english, "Sunday"));
- translationManager.persist(new I18nTranslation("January [month]", english, "January"));
- translationManager.persist(new I18nTranslation("Sunday [weekday]", afrikaans, "Sondag"));
- translationManager.persist(new I18nTranslation("January [month]", greek, "Ιανουάριος"));
- translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%s] users"), english,
- StringEscapeUtils.escapeHtml("[%s] users")));
- translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%d] users"), english,
- StringEscapeUtils.escapeHtml("[%d] users")));
- I18nCountry gb = new I18nCountry(new Long(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom", "western",
- ",");
- countryManager.persist(gb);
- }
-
@Test
- public void testGetLexicon() {
- HashMap<String, String> map = translationManager.getLexicon("af");
- assertTrue(map.size() > 0);
- }
-
- @Test
- public void getTranslation() {
- String translation = translationManager.getTranslation("af", "Sunday [weekday]");
- assertEquals("Sondag", translation);
- }
-
- @Test
- public void getTranslationUTF8() {
- String translation = translationManager.getTranslation("el", "January [month]");
- assertEquals("Ιανουάριος", translation);
- }
-
- @Test
- public void setTranslation() {
- translationManager.setTranslation("en", "Foo foo foo", "Foo foo foo translation");
- String translation = translationManager.getTranslation("en", "Foo foo foo");
- assertEquals("Foo foo foo translation", translation);
- }
-
- @Test
public void byDefaultUseEnglish() {
HashMap<String, String> map = translationManager.getLexicon("en");
HashMap<String, String> map2 = translationManager.getLexicon("af");
assertEquals(map.size(), map2.size());
}
- @Test
- public void getNonExistentTranslationReturnsDefaultLanguage() {
- String translation = translationManager.getTranslation("af", "January [month]");
- assertEquals("January", translation);
+ @After
+ public void close() {
+ if (getTransaction().isActive()) {
+ getTransaction().rollback();
+ }
}
@Test
@@ -112,12 +64,24 @@
}
@Test
- public void getTranslationWithStringArg() {
- String translation = translationManager.getTranslation("en", "[%s] users", "Twenty");
- assertEquals("Twenty users", translation);
+ public void getNonExistentTranslationReturnsDefaultLanguage() {
+ String translation = translationManager.getTranslation("af", "January [month]");
+ assertEquals("January", translation);
}
@Test
+ public void getTranslation() {
+ String translation = translationManager.getTranslation("af", "Sunday [weekday]");
+ assertEquals("Sondag", translation);
+ }
+
+ @Test
+ public void getTranslationUTF8() {
+ String translation = translationManager.getTranslation("el", "January [month]");
+ assertEquals("Ιανουάριος", translation);
+ }
+
+ @Test
public void getTranslationWithIntArg() {
String translation = translationManager.getTranslation("en", "[%d] users", 20);
assertEquals("20 users", translation);
@@ -130,15 +94,21 @@
}
@Test
- public void getTranslationWithStringArgFromService() {
- String translation = translationService.t("[%s] users", "Twenty");
+ public void getTranslationWithIntArgFromWithNtService() {
+ String translation = translationService.tWithNT("[%d] users", "foo foo", 20);
+ assertEquals("20 users", translation);
+ }
+
+ @Test
+ public void getTranslationWithStringArg() {
+ String translation = translationManager.getTranslation("en", "[%s] users", "Twenty");
assertEquals("Twenty users", translation);
}
@Test
- public void getTranslationWithIntArgFromWithNtService() {
- String translation = translationService.tWithNT("[%d] users", "foo foo", 20);
- assertEquals("20 users", translation);
+ public void getTranslationWithStringArgFromService() {
+ String translation = translationService.t("[%s] users", "Twenty");
+ assertEquals("Twenty users", translation);
}
@Test
@@ -147,10 +117,40 @@
assertEquals("Twenty users", translation);
}
- @After
- public void close() {
- if (getTransaction().isActive()) {
- getTransaction().rollback();
- }
+ @Before
+ public void insertData() {
+ openTransaction();
+ I18nLanguage english = new I18nLanguage(Long.valueOf(1819), "English", "English", "en");
+ I18nLanguage spanish = new I18nLanguage(Long.valueOf(5889), "Spanish", "Español", "es");
+ I18nLanguage afrikaans = new I18nLanguage(Long.valueOf(114), "Afrikaans", "Afrikaans", "af");
+ I18nLanguage greek = new I18nLanguage(Long.valueOf(1793), "Greek", "Ελληνικά", "el");
+ languageManager.persist(english);
+ languageManager.persist(spanish);
+ languageManager.persist(afrikaans);
+ languageManager.persist(greek);
+ translationManager.persist(new I18nTranslation("Sunday [weekday]", english, "Sunday"));
+ translationManager.persist(new I18nTranslation("January [month]", english, "January"));
+ translationManager.persist(new I18nTranslation("Sunday [weekday]", afrikaans, "Sondag"));
+ translationManager.persist(new I18nTranslation("January [month]", greek, "Ιανουάριος"));
+ translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%s] users"), english,
+ StringEscapeUtils.escapeHtml("[%s] users")));
+ translationManager.persist(new I18nTranslation(StringEscapeUtils.escapeHtml("[%d] users"), english,
+ StringEscapeUtils.escapeHtml("[%d] users")));
+ I18nCountry gb = new I18nCountry(Long.valueOf(75), "GB", "GBP", ".", "£%n", "", ".", "United Kingdom",
+ "western", ",");
+ countryManager.persist(gb);
}
+
+ @Test
+ public void setTranslation() {
+ translationManager.setTranslation("en", "Foo foo foo", "Foo foo foo translation");
+ String translation = translationManager.getTranslation("en", "Foo foo foo");
+ assertEquals("Foo foo foo translation", translation);
+ }
+
+ @Test
+ public void testGetLexicon() {
+ HashMap<String, String> map = translationManager.getLexicon("af");
+ assertTrue(map.size() > 0);
+ }
}
More information about the kune-commits
mailing list