Author: vjrj Date: 2009-03-02 14:25:37 +0100 (Mon, 02 Mar 2009) New Revision: 1053 Added: trunk/src/main/java/org/ourproject/kune/platf/client/actions/RadioMustBeChecked.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/ trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java trunk/src/main/java/org/ourproject/kune/workspace/client/rate/ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateIt.java trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItView.java trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateView.java trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/WorkspaceNotifyUser.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/AbstractClientTool.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ClientTool.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/FoldableAbstractClientTool.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelector.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItem.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemView.java trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java trunk/src/test/java/org/ourproject/kune/workspace/client/tool/ trunk/src/test/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenterTest.java Removed: trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/Star.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/RadioMustBeChecked.java trunk/src/main/java/org/ourproject/kune/workspace/client/summary/ trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java Modified: trunk/TODO trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatRoomPresenter.java trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderPresenter.java trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.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/KuneWorkspaceModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/ContextPropEditorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/options/pscape/EntityOptionsPublicSpaceConfPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.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/site/msg/SiteToastMessage.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessageView.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteprogress/SiteProgressPanel.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/SiteSignOutLinkPanel.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/GroupMembersSummaryPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/other/AddAsBuddiePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java Log: Incomplete - task Better RTE (Rich Text Editor) support Site renamed to NotifyUser and now it use Suco Events. In the future we can use different UI notifiers -people with vision difficulties need to use other user notifiers different than a toaster dialog- Modified: trunk/TODO =================================================================== --- trunk/TODO 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/TODO 2009-03-02 13:25:37 UTC (rev 1053) @@ -462,6 +462,8 @@ http://groups.google.com/group/rocket-gwt/browse_frm/thread/e56540d4168479c0... http://code.google.com/p/gwt-html-editor/source/browse/branches/gwt1.4/src/c... ** <v> P2P downloads for bigg uploads (the server acts as seeder). +** TODO <s> Include CC0 license: + http://creativecommons.org/license/zero/ * 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/blogs/client/BlogClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientModule.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -41,7 +41,6 @@ import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; import org.ourproject.kune.platf.client.ui.upload.FileUploader; import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; @@ -52,6 +51,7 @@ import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.ToolSelector; import com.calclab.suco.client.ioc.decorator.Singleton; import com.calclab.suco.client.ioc.module.AbstractModule; Modified: trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/blogs/client/BlogClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,10 +21,10 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.services.I18nUITranslationService; -import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.FoldableAbstractClientTool; +import org.ourproject.kune.workspace.client.tool.ToolSelector; public class BlogClientTool extends FoldableAbstractClientTool { public static final String NAME = "blogs"; Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientModule.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -38,11 +38,11 @@ import org.ourproject.kune.platf.client.services.I18nUITranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.ToolSelector; import com.calclab.emiteuimodule.client.EmiteUIDialog; import com.calclab.suco.client.ioc.decorator.Singleton; Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,10 +21,10 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.FoldableAbstractClientTool; +import org.ourproject.kune.workspace.client.tool.ToolSelector; public class ChatClientTool extends FoldableAbstractClientTool { public static final String NAME = "chats"; Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatRoomPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatRoomPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/ChatRoomPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -27,9 +27,9 @@ import org.ourproject.kune.platf.client.services.I18nUITranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.platf.client.ui.TextUtils; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; import org.ourproject.kune.workspace.client.cnt.FoldableContentPresenter; -import org.ourproject.kune.workspace.client.site.Site; import com.calclab.suco.client.ioc.Provider; @@ -59,7 +59,7 @@ view.setInfo(i18n.t("Select a chat room")); } } else { - view.setInfo("History of room conversations..." + Site.IN_DEVELOPMENT); + view.setInfo("History of room conversations..." + TextUtils.IN_DEVELOPMENT_P); } super.setState(state); } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/room/AddRoomPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -25,7 +25,7 @@ import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.ioc.Provider; @@ -44,14 +44,14 @@ } public void addRoom(String roomName) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); final String groupShortName = session.getCurrentState().getGroup().getShortName(); contentServiceProvider.get().addRoom(session.getUserHash(), session.getContainerState().getRootContainer().getStateToken(), groupShortName + "-" + roomName, new AsyncCallbackSimple<StateContainerDTO>() { public void onSuccess(final StateContainerDTO state) { stateManager.setRetrievedState(state); - Site.hideProgress(); + NotifyUser.hideProgress(); } }); } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -41,7 +41,6 @@ import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; import org.ourproject.kune.platf.client.ui.upload.FileUploader; import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; @@ -52,6 +51,7 @@ import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.ToolSelector; import com.calclab.suco.client.ioc.decorator.Singleton; import com.calclab.suco.client.ioc.module.AbstractModule; Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,10 +21,10 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.services.I18nUITranslationService; -import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.FoldableAbstractClientTool; +import org.ourproject.kune.workspace.client.tool.ToolSelector; public class DocumentClientTool extends FoldableAbstractClientTool { public static final String NAME = "docs"; Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientModule.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -41,7 +41,6 @@ import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; import org.ourproject.kune.platf.client.ui.upload.FileUploader; import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; @@ -52,6 +51,7 @@ import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.ToolSelector; import com.calclab.suco.client.ioc.decorator.Singleton; import com.calclab.suco.client.ioc.module.AbstractModule; Modified: trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/gallery/client/GalleryClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,10 +21,10 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.services.I18nUITranslationService; -import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.FoldableAbstractClientTool; +import org.ourproject.kune.workspace.client.tool.ToolSelector; public class GalleryClientTool extends FoldableAbstractClientTool { public static final String NAME = "gallery"; 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/ActionToolbarMenuRadioDescriptor.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -20,7 +20,6 @@ package org.ourproject.kune.platf.client.actions; import org.ourproject.kune.platf.client.dto.AccessRolDTO; -import org.ourproject.kune.workspace.client.socialnet.RadioMustBeChecked; import com.calclab.suco.client.events.Listener; import com.calclab.suco.client.events.Listener0; Copied: trunk/src/main/java/org/ourproject/kune/platf/client/actions/RadioMustBeChecked.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/RadioMustBeChecked.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/RadioMustBeChecked.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/platf/client/actions/RadioMustBeChecked.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,24 @@ +/* + * + * 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.actions; + +public interface RadioMustBeChecked { + boolean mustBeChecked(); +} \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationDefault.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -23,8 +23,8 @@ import org.ourproject.kune.platf.client.rpc.SiteService; import org.ourproject.kune.platf.client.rpc.SiteServiceAsync; import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.platf.client.utils.PrefetchUtilities; -import org.ourproject.kune.workspace.client.site.Site; import com.allen_sauer.gwt.log.client.Log; import com.calclab.suco.client.events.Event0; @@ -84,7 +84,7 @@ public void onFailure(final Throwable error) { RootPanel.get("kuneinitialcurtain").setVisible(false); RootPanel.get("kuneloading").setVisible(false); - Site.error("Error fetching initial data"); + NotifyUser.error("Error fetching initial data"); Log.debug(error.getMessage()); } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -31,7 +31,7 @@ import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.allen_sauer.gwt.log.client.Log; import com.calclab.suco.client.events.Event0; @@ -56,7 +56,7 @@ public void doSessionExpired() { onSessionExpired.fire(); - Site.info("Your session has expired. Please log in again."); + NotifyUser.info("Your session has expired. Please log in again."); } public void onSessionExpired(final Listener0 listener) { @@ -64,12 +64,12 @@ } public void process(final Throwable caught) { - Site.hideProgress(); + NotifyUser.hideProgress(); try { throw caught; } catch (final AccessViolationException e) { logException(e); - Site.error(i18n.t("You do not have rights to perform that action")); + NotifyUser.error(i18n.t("You do not have rights to perform that action")); } catch (final SessionExpiredException e) { logException(e); doSessionExpired(); @@ -78,39 +78,39 @@ if (session.isLogged()) { doSessionExpired(); } else { - Site.important(i18n.t("Please sign in or register to collaborate")); + NotifyUser.important(i18n.t("Please sign in or register to collaborate")); } } catch (final GroupNotFoundException e) { logException(e); - Site.veryImportant(i18n.t("Group not found")); + NotifyUser.veryImportant(i18n.t("Group not found")); stateManagerProvider.get().gotoToken(""); } catch (final IncompatibleRemoteServiceException e) { - Site.error(i18n.t("Your browser is outdated with the server software. Please reload this page.")); + NotifyUser.error(i18n.t("Your browser is outdated with the server software. Please reload this page.")); } catch (final ContentNotFoundException e) { logException(e); - Site.veryImportant(i18n.t("Content not found")); + NotifyUser.veryImportant(i18n.t("Content not found")); stateManagerProvider.get().gotoToken(""); } catch (final ContentNotPermittedException e) { logException(e); - Site.error(i18n.t("Action not permitted in this location")); + NotifyUser.error(i18n.t("Action not permitted in this location")); stateManagerProvider.get().gotoToken(""); } catch (final ContainerNotPermittedException e) { logException(e); - Site.error(i18n.t("Action not permitted in this location")); + NotifyUser.error(i18n.t("Action not permitted in this location")); stateManagerProvider.get().gotoToken(""); } catch (final LastAdminInGroupException e) { logException(e); - Site.showAlertMessage(i18n.t("Warning"), i18n.t("Sorry, you are the last admin of this group." + 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); - Site.error(i18n.t("This group is already a group member")); + NotifyUser.error(i18n.t("This group is already a group member")); } catch (final AlreadyUserMemberException e) { logException(e); - Site.error(i18n.t("This user is already a group member")); + NotifyUser.error(i18n.t("This user is already a group member")); } catch (final Throwable e) { logException(e, true); - Site.error(i18n.t("Error performing operation")); + NotifyUser.error(i18n.t("Error performing operation")); GWT.log("Other kind of exception in StateManagerDefault/processErrorException", null); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KunePlatformModule.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -40,6 +40,7 @@ import org.ourproject.kune.platf.client.state.StateManagerDefault; import org.ourproject.kune.platf.client.ui.QuickTipsHelper; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette; import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalettePanel; import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalettePresenter; @@ -212,6 +213,13 @@ // ew TestRTEDialog($(RTEditor.class)); + register(ApplicationComponentGroup.class, new Factory<NotifyUser>(NotifyUser.class) { + @Override + public NotifyUser create() { + return new NotifyUser($(I18nTranslationService.class)); + } + }); + $(ApplicationComponentGroup.class).createAll(); $(ToolGroup.class).createAll(); $(Application.class).start(); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/state/ContentProviderDefault.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.dto.StateAbstractDTO; import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -43,7 +43,7 @@ } public void getContent(final String user, final StateToken newState, final AsyncCallback<StateAbstractDTO> callback) { - Site.showProgressLoading(); + NotifyUser.showProgressLoading(); final StateAbstractDTO catched = getCached(newState); if (catched != null) { callback.onSuccess(catched); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/state/StateManagerDefault.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -29,7 +29,7 @@ import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.dto.UserInfoDTO; import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.allen_sauer.gwt.log.client.Log; import com.calclab.suco.client.events.Event; @@ -190,7 +190,7 @@ void setState(final StateAbstractDTO newState) { session.setCurrentState(newState); onStateChanged.fire(newState); - Site.hideProgress(); + NotifyUser.hideProgress(); checkGroupAndToolChange(newState); previousToken = newState.getStateToken(); } Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,35 +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.tool; - -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; -import org.ourproject.kune.workspace.client.themes.WsThemePresenter; - -public abstract class AbstractClientTool implements ClientTool { - - public AbstractClientTool(final String shortName, final String longName, final ToolSelector toolSelector, - final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws) { - final ToolSelectorItemPresenter presenter = new ToolSelectorItemPresenter(shortName, longName, toolSelector, - wsThemePresenter); - final ToolSelectorItemPanel panel = new ToolSelectorItemPanel(presenter, ws); - presenter.init(panel); - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,26 +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.tool; - -public interface ClientTool { - - String getName(); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,122 +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.tool; - -import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO; -import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; -import org.ourproject.kune.workspace.client.themes.WsThemePresenter; - -public abstract class FoldableAbstractClientTool extends AbstractClientTool { - public static final String UPLOADEDFILE_SUFFIX = "uploaded"; - - protected final ContentCapabilitiesRegistry contentCapabilitiesRegistry; - - public FoldableAbstractClientTool(String shortName, String longName, ToolSelector toolSelector, - WsThemePresenter wsThemePresenter, WorkspaceSkeleton ws, - ContentCapabilitiesRegistry contentCapabilitiesRegistry) { - super(shortName, longName, toolSelector, wsThemePresenter, ws); - this.contentCapabilitiesRegistry = contentCapabilitiesRegistry; - } - - public void registerContentTypeIcon(final String typeId, final BasicMimeTypeDTO mimeType, final String iconUrl) { - contentCapabilitiesRegistry.getIconsRegistry().registerContentTypeIcon(typeId, mimeType, iconUrl); - } - - public void registerContentTypeIcon(final String contentTypeId, final String iconUrl) { - contentCapabilitiesRegistry.getIconsRegistry().registerContentTypeIcon(contentTypeId, iconUrl); - } - - protected void registerAclEditableTypes(String... typeIds) { - contentCapabilitiesRegistry.getAclEditable().register(typeIds); - } - - protected void registerAuthorableTypes(String... typeIds) { - contentCapabilitiesRegistry.getAuthorable().register(typeIds); - } - - protected void registerComentableTypes(String... typeIds) { - contentCapabilitiesRegistry.getComentable().register(typeIds); - } - - protected void registerDragableTypes(String... typeIds) { - contentCapabilitiesRegistry.getDragable().register(typeIds); - } - - protected void registerDropableTypes(String... typeIds) { - contentCapabilitiesRegistry.getDropable().register(typeIds); - } - - protected void registerEmailSubscribeAbleTypes(String... typeIds) { - contentCapabilitiesRegistry.getEmailSubscribeAble().register(typeIds); - } - - protected void registerLicensableTypes(String... typeIds) { - contentCapabilitiesRegistry.getLicensable().register(typeIds); - } - - protected void registerPublishModerableTypes(String... typeIds) { - contentCapabilitiesRegistry.getPublishModerable().register(typeIds); - } - - protected void registerRateableTypes(String... typeIds) { - contentCapabilitiesRegistry.getRateable().register(typeIds); - } - - protected void registerRenamableTypes(String... typeIds) { - contentCapabilitiesRegistry.getRenamable().register(typeIds); - } - - protected void registerTageableTypes(String... typeIds) { - contentCapabilitiesRegistry.getTageable().register(typeIds); - } - - protected void registerTranslatableTypes(String... typeIds) { - contentCapabilitiesRegistry.getTranslatable().register(typeIds); - } - - protected void registerUploadTypesAndMimes(String typeUploadedfile) { - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("image"), "images/nav/picture.png"); - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("video"), "images/nav/film.png"); - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "pdf"), "images/nav/page_pdf.png"); - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "zip"), "images/nav/page_zip.png"); - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "zip"), "images/nav/page_zip.png"); - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("text"), "images/nav/page_text.png"); - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "msword"), - "images/nav/page_word.png"); - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "excel"), - "images/nav/page_excel.png"); - registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "mspowerpoint"), - "images/nav/page_pps.png"); - registerContentTypeIcon(typeUploadedfile, "images/nav/page.png"); - } - - protected void registerVersionableTypes(String... typeIds) { - contentCapabilitiesRegistry.getVersionable().register(typeIds); - } - - protected void registerXmppComentableTypes(String... typeIds) { - contentCapabilitiesRegistry.getXmppComentable().register(typeIds); - } - - protected void registerXmppNotifyCapableTypes(String... typeIds) { - contentCapabilitiesRegistry.getXmppNotificyCapable().register(typeIds); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,26 +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.tool; - -public interface ToolSelector { - - void addTool(ToolSelectorItem item); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,32 +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.tool; - -public interface ToolSelectorItem { - - String getShortName(); - - void setGroupShortName(String groupShortName); - - void setSelected(boolean selected); - - void setVisible(boolean visible); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,69 +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.tool; - -import org.ourproject.kune.platf.client.ui.RoundedPanel; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; -import org.ourproject.kune.workspace.client.themes.WsTheme; - -import com.google.gwt.user.client.Event; -import com.google.gwt.user.client.ui.Hyperlink; - -public class ToolSelectorItemPanel extends RoundedPanel implements ToolSelectorItemView { - private final Hyperlink hl; - - public ToolSelectorItemPanel(final ToolSelectorItemPresenter presenter, final WorkspaceSkeleton ws) { - super(RoundedPanel.RIGHT, 2); - hl = new Hyperlink(); - super.setWidget(hl); - ws.addInTools(this); - super.sinkEvents(Event.ONCLICK); - super.addStyleName("k-toolselectoritem"); - } - - @Override - public void onBrowserEvent(final Event event) { - super.onBrowserEvent(event); - } - - public void setLink(final String text, final String targetHistoryToken) { - hl.setText(text); - hl.setTargetHistoryToken(targetHistoryToken); - } - - public void setSelected(final boolean selected) { - if (selected) { - hl.setStylePrimaryName("k-toolselectoritem-sel"); - } else { - hl.setStylePrimaryName("k-toolselectoritem-notsel"); - } - super.setCornerStyleName(hl.getStyleName()); - } - - public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { - if (oldTheme != null) { - final String oldName = oldTheme.getName(); - hl.removeStyleDependentName(oldName); - } - final String newName = newTheme.getName(); - hl.addStyleDependentName(newName); - super.setCornerStyleName(hl.getStyleName()); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,79 +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.tool; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.workspace.client.themes.WsTheme; -import org.ourproject.kune.workspace.client.themes.WsThemePresenter; - -import com.calclab.suco.client.events.Listener2; - -public class ToolSelectorItemPresenter implements ToolSelectorItem { - - private ToolSelectorItemView view; - private final ToolSelector toolSelector; - private final WsThemePresenter wsThemePresenter; - private final String shortName; - private final String longName; - - public ToolSelectorItemPresenter(final String shortName, final String longName, final ToolSelector toolSelector, - final WsThemePresenter wsThemePresenter) { - this.shortName = shortName; - this.longName = longName; - this.toolSelector = toolSelector; - this.wsThemePresenter = wsThemePresenter; - } - - public String getShortName() { - return shortName; - } - - public View getView() { - return view; - } - - public void init(final ToolSelectorItemView view) { - this.view = view; - toolSelector.addTool(this); - wsThemePresenter.onThemeChanged(new Listener2<WsTheme, WsTheme>() { - public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) { - setTheme(oldTheme, newTheme); - } - }); - } - - public void setGroupShortName(final String groupShortName) { - final StateToken token = new StateToken(groupShortName, getShortName(), null, null); - view.setLink(longName, token.toString()); - } - - public void setSelected(final boolean selected) { - view.setSelected(selected); - } - - public void setVisible(boolean visible) { - view.setVisible(visible); - } - - private void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { - view.setTheme(oldTheme, newTheme); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,34 +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.tool; - -import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.workspace.client.themes.WsTheme; - -public interface ToolSelectorItemView extends View { - - void setLink(String text, String targetHistoryToken); - - void setSelected(boolean selected); - - void setTheme(WsTheme oldTheme, WsTheme newTheme); - - void setVisible(boolean visible); -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,90 +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.tool; - -import java.util.HashMap; -import java.util.List; - -import org.ourproject.kune.platf.client.dto.StateAbstractDTO; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.themes.WsThemePresenter; - -import com.allen_sauer.gwt.log.client.Log; -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.events.Listener2; - -public class ToolSelectorPresenter implements ToolSelector { - - private final HashMap<String, ToolSelectorItem> tools; - - public ToolSelectorPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter) { - tools = new HashMap<String, ToolSelectorItem>(); - stateManager.onStateChanged(new Listener<StateAbstractDTO>() { - public void onEvent(StateAbstractDTO state) { - for (String tool : tools.keySet()) { - List<String> enabledTools = state.getEnabledTools(); - if (enabledTools != null && enabledTools.contains(tool)) { - tools.get(tool).setVisible(true); - } else { - tools.get(tool).setVisible(false); - } - } - } - }); - stateManager.onGroupChanged(new Listener2<String, String>() { - public void onEvent(final String oldGroup, final String newGroup) { - onGroupChanged(newGroup); - } - }); - stateManager.onToolChanged(new Listener2<String, String>() { - public void onEvent(final String oldTool, final String newTool) { - onToolChanged(oldTool, newTool); - } - }); - } - - 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"); - } - if (tools.get(name) != null) { - throw new RuntimeException("A tool with the same name already added"); - } - tools.put(name, item); - item.setSelected(false); - } - - void onGroupChanged(final String newGroupName) { - for (final String name : tools.keySet()) { - tools.get(name).setGroupShortName(newGroupName); - } - } - - void onToolChanged(final String oldTool, final String newTool) { - Log.debug("Registered tools: " + tools.keySet().toString()); - if (!oldTool.equals("")) { - tools.get(oldTool).setSelected(false); - } - if (!newTool.equals("")) { - tools.get(newTool).setSelected(true); - } - } -} 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/DropDownPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -20,7 +20,6 @@ package org.ourproject.kune.platf.client.ui; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.workspace.client.themes.WsTheme; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Composite; @@ -142,20 +141,18 @@ outerBorder.setHeight(height); } - public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { + public void setTheme(final String oldTheme, final String newTheme) { if (oldTheme != null) { - final String oldThemeS = oldTheme.toString(); // outerBorder.removeStyleDependentName(oldThemeS); - vp.removeStyleDependentName(oldThemeS); - titleHP.removeStyleDependentName(oldThemeS); - contentPanel.removeStyleDependentName(oldThemeS); + vp.removeStyleDependentName(oldTheme); + titleHP.removeStyleDependentName(oldTheme); + contentPanel.removeStyleDependentName(oldTheme); } - final String newThemeS = newTheme.toString(); - outerBorder.setCornerStyleName(stylePrimaryName + "-" + newThemeS); + outerBorder.setCornerStyleName(stylePrimaryName + "-" + newTheme); // outerBorder.addStyleDependentName(newThemeS); - vp.addStyleDependentName(newThemeS); - titleHP.addStyleDependentName(newThemeS); - contentPanel.addStyleDependentName(newThemeS); + vp.addStyleDependentName(newTheme); + titleHP.addStyleDependentName(newTheme); + contentPanel.addStyleDependentName(newTheme); } @Override Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/TextUtils.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -22,6 +22,10 @@ import java.util.ArrayList; public class TextUtils { + + public static final String IN_DEVELOPMENT_P = " (in development)"; + public static final String IN_DEVELOPMENT = "In development"; + // Original regexp from http://snippets.dzone.com/posts/show/452 public static final String URL_REGEXP = "((ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?)"; Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,7 +21,7 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.google.gwt.user.client.ui.DeckPanel; import com.google.gwt.user.client.ui.Widget; @@ -239,7 +239,7 @@ dialog.add(mainPanel); doLayoutIfNeeded(); } else { - Site.error("Widget not found in deck of WizardDialog"); + NotifyUser.error("Widget not found in deck of WizardDialog"); } } @@ -271,7 +271,7 @@ } else if (view instanceof DefaultForm) { return ((DefaultForm) view).getFormPanel(); } else { - Site.error("Trying to add a unknown element in WizardDialog"); + NotifyUser.error("Trying to add a unknown element in WizardDialog"); return null; } } Copied: trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java (from rev 1052, trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/noti/NotifyUser.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,114 @@ +/* + * + * 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.noti; + +import org.ourproject.kune.platf.client.services.I18nTranslationService; + +import com.calclab.suco.client.events.Event; +import com.calclab.suco.client.events.Event0; +import com.calclab.suco.client.events.Event2; +import com.calclab.suco.client.events.Listener; +import com.calclab.suco.client.events.Listener0; +import com.calclab.suco.client.events.Listener2; + +public class NotifyUser { + + public enum Level { + info, important, veryImportant, error, + } + + private static Event2<Level, String> onNotify; + + private static Event2<String, String> onAlert; + + private static Event<String> onProgress; + + private static Event0 onHideProgress; + + private static I18nTranslationService i18n; + + public static void error(final String message) { + onNotify.fire(Level.error, message); + } + + public static void hideProgress() { + onHideProgress.fire(); + } + + public static void important(final String message) { + onNotify.fire(Level.important, message); + } + + public static void info(final String message) { + onNotify.fire(Level.info, message); + } + + public static void showAlertMessage(String title, String message) { + onAlert.fire(title, message); + } + + public static void showProgress(final String text) { + onProgress.fire(text); + } + + public static void showProgressLoading() { + onProgress.fire(i18n.t("Loading")); + } + + public static void showProgressProcessing() { + onProgress.fire(i18n.t("Processing")); + } + + public static void showProgressSaving() { + onProgress.fire(i18n.t("Saving")); + } + + public static void showProgressStarting() { + onProgress.fire(i18n.t("Starting")); + } + + public static void veryImportant(final String message) { + onNotify.fire(Level.veryImportant, message); + } + + public NotifyUser(I18nTranslationService i18n) { + NotifyUser.i18n = i18n; + onNotify = new Event2<Level, String>("onNotify"); + onAlert = new Event2<String, String>("onNotify"); + onProgress = new Event<String>("onProgress"); + onHideProgress = new Event0("onHideProgress"); + } + + public void addAlerter(final Listener2<String, String> listener) { + onAlert.add(listener); + } + + public void addHideProgressNotifier(final Listener0 listener) { + onHideProgress.add(listener); + } + + public void addNotifier(final Listener2<Level, String> listener) { + onNotify.add(listener); + } + + public void addProgressNotifier(final Listener<String> listener) { + onProgress.add(listener); + } +} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,26 +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.rate; - -public interface RateIt { - - void setVisible(boolean visible); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,134 +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.rate; - -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; - -import com.google.gwt.user.client.ui.ClickListener; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.MouseListenerAdapter; -import com.google.gwt.user.client.ui.Widget; - -public class RateItPanel extends Composite implements ClickListener, RateItView { - private Grid rateGrid; - private Image[] starImg; - private Label rateDesc; - private final Images img; - private final RateItPresenter presenter; - private Label rateItLabel; - private final I18nTranslationService i18n; - - public RateItPanel(final RateItPresenter presenter, final I18nTranslationService i18n, final WorkspaceSkeleton ws, - Images img) { - this.presenter = presenter; - this.i18n = i18n; - this.img = img; - initialize(); - layout(); - setProperties(); - ws.getEntityWorkspace().getContentBottomBar().add(this); - } - - public void clearRate() { - for (int i = 0; i < 5; i++) { - img.starGrey().applyTo(starImg[i]); - } - } - - public void onClick(final Widget sender) { - for (int i = 0; i < 5; i++) { - if (sender == starImg[i]) { - presenter.starClicked(i); - } - } - } - - public void setDesc(final String desc) { - rateDesc.setText(desc); - } - - public void setRate(final Star stars[]) { - for (int i = 0; i < 5; i++) { - stars[i].getImage().applyTo(starImg[i]); - } - } - - public void setStars(final Double rate) { - setRate(Star.genStars(rate.doubleValue())); - } - - private void initialize() { - rateItLabel = new Label(i18n.t("Rate it:")); - rateGrid = new Grid(1, 7); - starImg = new Image[5]; - rateDesc = new Label(); - for (int i = 0; i < 5; i++) { - starImg[i] = new Image(); - img.starGrey().applyTo(starImg[i]); - starImg[i].addStyleName("rateit-star"); - starImg[i].setStyleName("rateit-star"); - starImg[i].setTitle(i18n.t("Click to rate this")); - starImg[i].addClickListener(this); - starImg[i].addMouseListener(new MouseListenerAdapter() { - @Override - public void onMouseEnter(final Widget sender) { - for (int j = 0; j < 5; j++) { - if (sender == starImg[j]) { - presenter.starOver(j); - } - } - - } - - @Override - public void onMouseLeave(final Widget sender) { - presenter.revertCurrentRate(); - } - }); - } - } - - private void layout() { - initWidget(rateGrid); - rateGrid.setWidget(0, 0, rateItLabel); - for (int i = 0; i < 5; i++) { - rateGrid.setWidget(0, i + 1, starImg[i]); - } - rateGrid.setWidget(0, 6, rateDesc); - } - - private void setProperties() { - rateGrid.setCellPadding(0); - rateGrid.setCellSpacing(0); - rateGrid.setBorderWidth(0); - rateItLabel.addStyleName("kune-Margin-Small-r"); - // rateItLabel.addStyleName("kune-Margin-Medium-l"); - rateItLabel.addStyleName("kune-RatePanel-Label"); - rateGrid.addStyleName("kune-RatePanel-Stars"); - rateGrid.addStyleName("kune-RatePanel-Stars-RateIt"); - rateDesc.addStyleName("kune-RatePanel-Label"); - rateDesc.addStyleName("kune-Margin-Small-l"); - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,162 +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.rate; - -import org.ourproject.kune.platf.client.dto.RateResultDTO; -import org.ourproject.kune.platf.client.dto.StateAbstractDTO; -import org.ourproject.kune.platf.client.dto.StateContentDTO; -import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; -import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; -import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.site.Site; - -import com.calclab.suco.client.events.Listener; -import com.calclab.suco.client.ioc.Provider; - -public class RateItPresenter implements RateIt { - - private static final Double NOT_RATED = new Double(-1); - private RateItView view; - private Double currentRate; - private boolean isRating; - private final I18nTranslationService i18n; - private final Provider<ContentServiceAsync> contentServiceProvider; - private final Session session; - private final Provider<RatePresenter> ratePresenterProv; - - public RateItPresenter(final I18nTranslationService i18n, final Session session, - final Provider<ContentServiceAsync> contentServiceProvider, final StateManager stateManager, - Provider<RatePresenter> ratePresenterProvider, final ContentCapabilitiesRegistry capabilitiesRegistry) { - this.i18n = i18n; - this.session = session; - this.contentServiceProvider = contentServiceProvider; - this.ratePresenterProv = ratePresenterProvider; - stateManager.onStateChanged(new Listener<StateAbstractDTO>() { - public void onEvent(final StateAbstractDTO state) { - if (state instanceof StateContentDTO) { - StateContentDTO stateContentDTO = (StateContentDTO) state; - setState(capabilitiesRegistry.isRateable(stateContentDTO.getTypeId()), - stateContentDTO.getCurrentUserRate()); - } else { - view.setVisible(false); - } - } - }); - } - - public void init(final RateItView view) { - this.view = view; - currentRate = NOT_RATED; - isRating = false; - } - - public void setRate(final Double value) { - currentRate = value; - if (currentRate == null) { - currentRate = NOT_RATED; - } - isRating = false; - setRatePanel(currentRate); - } - - public void setVisible(final boolean visible) { - view.setVisible(visible); - } - - protected void revertCurrentRate() { - if (!isRating) { - setRatePanel(currentRate); - } - } - - protected void starClicked(final int starClicked) { - isRating = true; - final Double newValue = starClicked + 1d == currentRate ? currentRate - 0.5d : starClicked + 1d; - setRatePanel(newValue); - Site.showProgressProcessing(); - final StateAbstractDTO currentState = session.getCurrentState(); - contentServiceProvider.get().rateContent(session.getUserHash(), currentState.getStateToken(), newValue, - new AsyncCallbackSimple<RateResultDTO>() { - public void onSuccess(final RateResultDTO result) { - Site.hideProgress(); - Site.info(i18n.t("Content rated")); - if (currentState.getStateToken().equals(session.getCurrentStateToken())) { - session.getContentState().setRate(result); - setState(true, result.getCurrentUserRate()); - ratePresenterProv.get().setRate(result); - } - } - }); - } - - protected void starOver(final int starMouseOver) { - Double value = new Double(starMouseOver + 1); - if (Math.ceil(currentRate.doubleValue()) == value.doubleValue()) { - // use user already rated -> live same value when mouse is over - value = currentRate; - } - if (!isRating) { - // If we are not doing a rate rpc call - setRatePanel(value); - } - } - - private void setDesc(final int rateTruncated) { - if (rateTruncated >= 0 && rateTruncated <= 1) { - view.setDesc(i18n.t("Poor")); - } else if (rateTruncated == 2) { - view.setDesc(i18n.t("Below average")); - } else if (rateTruncated == 3) { - view.setDesc(i18n.t("Average")); - } else if (rateTruncated == 4) { - view.setDesc(i18n.t("Above average")); - } else if (rateTruncated == 5) { - view.setDesc(i18n.t("Excellent")); - } else { - view.setDesc(""); - } - } - - private void setRatePanel(final Double value) { - if (value.equals(NOT_RATED)) { - view.clearRate(); - view.setDesc(""); - } else { - view.setStars(value); - setDesc((int) Math.ceil(value.doubleValue())); - } - } - - private void setState(boolean isRateable, Double currentUserRate) { - if (isRateable) { - if (session.isLogged()) { - setRate(currentUserRate); - view.setVisible(true); - } else { - view.setVisible(false); - } - } else { - view.setVisible(false); - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,32 +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.rate; - -public interface RateItView { - - void clearRate(); - - void setDesc(String desc); - - void setStars(Double value); - - void setVisible(boolean visible); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,102 +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.rate; - -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.workspace.client.skel.Toolbar; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; - -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Label; - -public class RatePanel extends Composite implements RateView { - private Grid rateGrid; - private Image[] starImg; - private Label rateDesc; - private final I18nTranslationService i18n; - - public RatePanel(final Double rate, final Integer byUsers, final I18nTranslationService i18n, - final WorkspaceSkeleton ws) { - this.i18n = i18n; - initialize(); - layout(); - setProperties(); - if (rate != null) { - setRate(rate); - } - if (byUsers != null) { - setByUsers(byUsers); - } - final Toolbar bottomBar = ws.getEntityWorkspace().getContentBottomBar(); - bottomBar.addFill(); - bottomBar.add(this); - } - - 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)); - } - } - - public void setRate(final Double rate) { - setRate(Star.genStars(rate.doubleValue())); - } - - private void initialize() { - rateGrid = new Grid(1, 6); - starImg = new Image[5]; - for (int i = 0; i < 5; i++) { - starImg[i] = new Image(); - new Star(Star.GREY).getImage().applyTo(starImg[i]); - } - rateDesc = new Label(); - } - - private void layout() { - initWidget(rateGrid); - for (int i = 0; i < 5; i++) { - rateGrid.setWidget(0, i, starImg[i]); - } - rateGrid.setWidget(0, 5, rateDesc); - } - - private void setProperties() { - rateGrid.setCellPadding(0); - rateGrid.setCellSpacing(0); - rateGrid.setBorderWidth(0); - rateGrid.addStyleName("kune-RatePanel-Stars"); - rateDesc.addStyleName("kune-RatePanel-Label"); - rateDesc.addStyleName("kune-Margin-Small-lr"); - } - - private void setRate(final Star stars[]) { - for (int i = 0; i < 5; i++) { - stars[i].getImage().applyTo(starImg[i]); - } - } - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,75 +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.rate; - -import org.ourproject.kune.platf.client.dto.RateResultDTO; -import org.ourproject.kune.platf.client.dto.StateAbstractDTO; -import org.ourproject.kune.platf.client.dto.StateContentDTO; -import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; -import org.ourproject.kune.platf.client.state.StateManager; - -import com.calclab.suco.client.events.Listener; - -public class RatePresenter { - - private RateView view; - private final ContentCapabilitiesRegistry capabilitiesRegistry; - - public RatePresenter(final StateManager stateManager, ContentCapabilitiesRegistry capabilitiesRegistry) { - this.capabilitiesRegistry = capabilitiesRegistry; - stateManager.onStateChanged(new Listener<StateAbstractDTO>() { - public void onEvent(final StateAbstractDTO state) { - if (state instanceof StateContentDTO) { - setState((StateContentDTO) state); - } else { - view.setVisible(false); - } - } - }); - } - - public void init(final RateView view) { - this.view = view; - } - - public void setRate(RateResultDTO result) { - setRate(result.getRateByUsers(), result.getRate()); - } - - public void setVisible(final boolean visible) { - view.setVisible(visible); - } - - private void setRate(Integer rateByUsers, Double rate) { - view.setVisible(true); - view.setRate(rate); - view.setByUsers(rateByUsers); - } - - private void setState(final StateContentDTO state) { - Integer rateByUsers = state.getRateByUsers(); - Double rate = state.getRate(); - if (capabilitiesRegistry.isRateable(state.getTypeId())) { - setRate(rateByUsers, rate); - } else { - view.setVisible(false); - } - } -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,30 +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.rate; - -public interface RateView { - - void setByUsers(Integer byUsers); - - void setRate(Double rate); - - void setVisible(boolean visible); - -} Deleted: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/Star.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/Star.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/Star.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,92 +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.rate; - -import org.ourproject.kune.platf.client.services.Images; - -import com.google.gwt.user.client.ui.AbstractImagePrototype; - -public class Star { - 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 Star() { - image = img.starGrey(); - } - - public AbstractImagePrototype getImage() { - return image; - } - - public Star(final double rateDecimals) { - if (rateDecimals == 1) { - image = img.starYellow(); - } else if (rateDecimals == 0) { - image = img.starGrey(); - } else { - final int rateTrucated = (int) rateDecimals; - final int rateDecimal = (int) ((rateDecimals - rateTrucated) * 10) * 10; - if (rateDecimal == 10) { - image = img.star10(); - } else if (rateDecimal == 20) { - image = img.star20(); - } else if (rateDecimal == 30) { - image = img.star30(); - } else if (rateDecimal == 40) { - image = img.star40(); - } else if (rateDecimal == 50) { - image = img.star50(); - } else if (rateDecimal == 60) { - image = img.star60(); - } else if (rateDecimal == 70) { - image = img.star70(); - } else if (rateDecimal == 80) { - image = img.star80(); - } else if (rateDecimal == 90) { - 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; - } -} Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rte/RTEditorPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -13,8 +13,8 @@ import org.ourproject.kune.platf.client.dto.AccessRolDTO; import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.platf.client.ui.rte.img.RTEImgResources; -import org.ourproject.kune.workspace.client.site.Site; import com.calclab.suco.client.events.Listener0; @@ -197,7 +197,7 @@ ActionToolbarMenuDescriptor<Object> editHtml = new ActionToolbarMenuDescriptor<Object>(accessRol, ActionToolbarPosition.topbar, new Listener0() { public void onEvent() { - Site.info("In dev"); + NotifyUser.info("In dev"); } }); editHtml.setTextDescription(i18n.t("Edit HTML")); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderDialog.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,7 +21,7 @@ import org.ourproject.kune.platf.client.services.I18nUITranslationService; import org.ourproject.kune.platf.client.ui.TextUtils; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.allen_sauer.gwt.log.client.Log; @@ -59,7 +59,7 @@ public void destroy() { if (hasUploadingFiles()) { dialog.stopUpload(); - Site.important(i18n.t("Upload cancelled after signing out")); + NotifyUser.important(i18n.t("Upload cancelled after signing out")); } if (dialog != null) { dialog.destroy(); @@ -138,7 +138,7 @@ public boolean onBeforeAdd(final UploadDialog source, final String filename) { boolean mustAdd = presenter.checkFolderChange(); if (!mustAdd) { - Site.important(i18n.t("Please, wait until current uploads are finished to upload new files into another location")); + NotifyUser.important(i18n.t("Please, wait until current uploads are finished to upload new files into another location")); } return mustAdd; } @@ -151,7 +151,7 @@ @Override public void onUploadComplete(final UploadDialog source) { if (!dialog.isVisible()) { - Site.info(i18n.t("Upload completed")); + NotifyUser.info(i18n.t("Upload completed")); traybarButton.destroy(); traybarButton = null; } @@ -170,7 +170,7 @@ private void showError() { if (!dialog.isVisible()) { - Site.veryImportant(i18n.t("Error uploading")); + NotifyUser.veryImportant(i18n.t("Error uploading")); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/upload/FileUploaderPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,7 +21,7 @@ import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool; +import org.ourproject.kune.workspace.client.tool.FoldableAbstractClientTool; import com.calclab.suco.client.events.Event; import com.calclab.suco.client.events.Listener; Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientModule.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -31,7 +31,6 @@ import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; import org.ourproject.kune.platf.client.ui.upload.FileUploader; import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; @@ -52,6 +51,7 @@ import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.ToolSelector; import com.calclab.suco.client.ioc.decorator.Singleton; import com.calclab.suco.client.ioc.module.AbstractModule; Modified: trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/wiki/client/WikiClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,10 +21,10 @@ import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; import org.ourproject.kune.platf.client.services.I18nUITranslationService; -import org.ourproject.kune.platf.client.tool.FoldableAbstractClientTool; -import org.ourproject.kune.platf.client.tool.ToolSelector; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.FoldableAbstractClientTool; +import org.ourproject.kune.workspace.client.tool.ToolSelector; public class WikiClientTool extends FoldableAbstractClientTool { public static final String NAME = "wiki"; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/AbstractFoldableContentActions.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -32,6 +32,7 @@ import org.ourproject.kune.platf.client.actions.ActionToolbarPosition; import org.ourproject.kune.platf.client.actions.ContentActionRegistry; import org.ourproject.kune.platf.client.actions.ContextActionRegistry; +import org.ourproject.kune.platf.client.actions.RadioMustBeChecked; import org.ourproject.kune.platf.client.dto.AccessRolDTO; import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO; import org.ourproject.kune.platf.client.dto.ContentSimpleDTO; @@ -51,6 +52,7 @@ import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.platf.client.ui.upload.FileUploader; import org.ourproject.kune.platf.client.utils.DeferredCommandWrapper; import org.ourproject.kune.workspace.client.cnt.FoldableContent; @@ -58,9 +60,7 @@ import org.ourproject.kune.workspace.client.cxt.ContextPropEditor; import org.ourproject.kune.workspace.client.editor.TextEditor; import org.ourproject.kune.workspace.client.entityheader.EntityHeader; -import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.sitebar.sitepublic.SitePublicSpaceLink; -import org.ourproject.kune.workspace.client.socialnet.RadioMustBeChecked; import com.calclab.suco.client.events.Listener; import com.calclab.suco.client.events.Listener0; @@ -159,7 +159,7 @@ final ActionToolbarMenuAndItemDescriptor<StateToken> delContainer = new ActionToolbarMenuAndItemDescriptor<StateToken>( AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() { public void onEvent(final StateToken token) { - Site.info("Sorry, in development"); + NotifyUser.info("Sorry, in development"); } }); delContainer.setParentMenuTitle(parentMenuTitle); @@ -233,24 +233,24 @@ contextPropEditorProvider.get().attach(); editor.editContent(session.getContentState().getContent(), new Listener<String>() { public void onEvent(final String html) { - Site.showProgressSaving(); + NotifyUser.showProgressSaving(); contentServiceProvider.get().save(session.getUserHash(), stateToken, html, new AsyncCallback<Object>() { public void onFailure(final Throwable caught) { - Site.hideProgress(); + NotifyUser.hideProgress(); try { throw caught; } catch (final SessionExpiredException e) { errorHandler.doSessionExpired(); } catch (final Throwable e) { - Site.error(i18n.t("Error saving document. Retrying...")); + NotifyUser.error(i18n.t("Error saving document. Retrying...")); errorHandler.process(caught); editor.onSaveFailed(); } } public void onSuccess(Object param) { - Site.hideProgress(); + NotifyUser.hideProgress(); session.getContentState().setContent(html); editor.onSavedSuccessful(); } @@ -325,7 +325,7 @@ addFolder = new ActionToolbarMenuAndItemDescriptor<StateToken>(AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() { public void onEvent(final StateToken stateToken) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); contentServiceProvider.get().addFolder(session.getUserHash(), stateToken, defaultName, contentTypeId, new AsyncCallbackSimple<StateContainerDTO>() { public void onSuccess(final StateContainerDTO state) { @@ -348,7 +348,7 @@ final ActionToolbarMenuAndItemDescriptor<StateToken> addContent = new ActionToolbarMenuAndItemDescriptor<StateToken>( AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener0() { public void onEvent() { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); contentServiceProvider.get().addContent(session.getUserHash(), session.getCurrentState().getStateToken(), description, typeId, new AsyncCallbackSimple<StateContentDTO>() { @@ -424,13 +424,13 @@ setAsDefGroupContent = new ActionToolbarMenuDescriptor<StateToken>(AccessRolDTO.Administrator, ActionToolbarPosition.topbar, new Listener<StateToken>() { public void onEvent(final StateToken token) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); contentServiceProvider.get().setAsDefaultContent(session.getUserHash(), token, new AsyncCallbackSimple<ContentSimpleDTO>() { public void onSuccess(final ContentSimpleDTO defContent) { session.getCurrentState().getGroup().setDefaultContent(defContent); - Site.hideProgress(); - Site.info(i18n.t("Content selected as the group homepage")); + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Content selected as the group homepage")); } }); } @@ -493,7 +493,7 @@ ActionToolbarButtonDescriptor<StateToken> translateContent = new ActionToolbarButtonDescriptor<StateToken>( AccessRolDTO.Editor, ActionToolbarPosition.topbar, new Listener<StateToken>() { public void onEvent(final StateToken stateToken) { - Site.important(i18n.t("Sorry, this functionality is currently in development")); + NotifyUser.important(i18n.t("Sorry, this functionality is currently in development")); } }); translateContent.setTextDescription(i18n.tWithNT("Translate", "used in button")); @@ -552,7 +552,7 @@ groupServiceProvider.get().setGroupFullLogo(session.getUserHash(), token, new AsyncCallbackSimple<GroupDTO>() { public void onSuccess(GroupDTO newGroup) { - Site.info("Logo selected"); + NotifyUser.info("Logo selected"); if (session.getCurrentState().getGroup().getShortName().equals( newGroup.getShortName())) { session.getCurrentState().setGroup(newGroup); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/KuneWorkspaceModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/KuneWorkspaceModule.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/KuneWorkspaceModule.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -62,15 +62,9 @@ import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.platf.client.tool.ToolSelector; -import org.ourproject.kune.platf.client.tool.ToolSelectorPresenter; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.platf.client.ui.palette.ColorWebSafePalette; -import org.ourproject.kune.platf.client.ui.rate.RateIt; -import org.ourproject.kune.platf.client.ui.rate.RateItPanel; -import org.ourproject.kune.platf.client.ui.rate.RateItPresenter; -import org.ourproject.kune.platf.client.ui.rate.RatePanel; -import org.ourproject.kune.platf.client.ui.rate.RatePresenter; import org.ourproject.kune.platf.client.ui.upload.FileUploader; import org.ourproject.kune.platf.client.ui.upload.FileUploaderDialog; import org.ourproject.kune.platf.client.ui.upload.FileUploaderPresenter; @@ -144,6 +138,11 @@ import org.ourproject.kune.workspace.client.options.tools.EntityOptionsToolsConf; import org.ourproject.kune.workspace.client.options.tools.EntityOptionsToolsConfPanel; import org.ourproject.kune.workspace.client.options.tools.EntityOptionsToolsConfPresenter; +import org.ourproject.kune.workspace.client.rate.RateIt; +import org.ourproject.kune.workspace.client.rate.RateItPanel; +import org.ourproject.kune.workspace.client.rate.RateItPresenter; +import org.ourproject.kune.workspace.client.rate.RatePanel; +import org.ourproject.kune.workspace.client.rate.RatePresenter; import org.ourproject.kune.workspace.client.search.EntityLiveSearcherView; import org.ourproject.kune.workspace.client.search.GroupLiveSearchPanel; import org.ourproject.kune.workspace.client.search.GroupLiveSearcher; @@ -163,8 +162,8 @@ import org.ourproject.kune.workspace.client.signin.SignInPanel; import org.ourproject.kune.workspace.client.signin.SignInPresenter; import org.ourproject.kune.workspace.client.signin.SignInView; -import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.site.SiteToken; +import org.ourproject.kune.workspace.client.site.WorkspaceNotifyUser; import org.ourproject.kune.workspace.client.site.msg.SiteToastMessage; import org.ourproject.kune.workspace.client.site.msg.SiteToastMessagePanel; import org.ourproject.kune.workspace.client.site.msg.SiteToastMessagePresenter; @@ -210,10 +209,6 @@ import org.ourproject.kune.workspace.client.socialnet.other.AddAsBuddie; import org.ourproject.kune.workspace.client.socialnet.other.AddAsBuddiePanel; import org.ourproject.kune.workspace.client.socialnet.other.AddAsBuddiePresenter; -import org.ourproject.kune.workspace.client.summary.GroupSummary; -import org.ourproject.kune.workspace.client.summary.GroupSummaryPanel; -import org.ourproject.kune.workspace.client.summary.GroupSummaryPresenter; -import org.ourproject.kune.workspace.client.summary.GroupSummaryView; import org.ourproject.kune.workspace.client.tags.TagsSummary; import org.ourproject.kune.workspace.client.tags.TagsSummaryPanel; import org.ourproject.kune.workspace.client.tags.TagsSummaryPresenter; @@ -226,6 +221,8 @@ import org.ourproject.kune.workspace.client.title.EntityTitlePanel; import org.ourproject.kune.workspace.client.title.EntityTitlePresenter; import org.ourproject.kune.workspace.client.title.RenameAction; +import org.ourproject.kune.workspace.client.tool.ToolSelector; +import org.ourproject.kune.workspace.client.tool.ToolSelectorPresenter; import com.calclab.suco.client.events.Listener0; import com.calclab.suco.client.ioc.decorator.NoDecoration; @@ -280,11 +277,11 @@ } }); - register(ApplicationComponentGroup.class, new Factory<Site>(Site.class) { + register(ApplicationComponentGroup.class, new Factory<WorkspaceNotifyUser>(WorkspaceNotifyUser.class) { @Override - public Site create() { - return new Site($(I18nUITranslationService.class), $(SiteProgress.class), $$(SiteToastMessage.class), - $$(WorkspaceSkeleton.class)); + public WorkspaceNotifyUser create() { + return new WorkspaceNotifyUser($(NotifyUser.class), $(I18nUITranslationService.class), + $(SiteProgress.class), $$(SiteToastMessage.class), $$(WorkspaceSkeleton.class)); } }); @@ -521,18 +518,6 @@ } }); - register(ApplicationComponentGroup.class, new Factory<GroupSummary>(GroupSummary.class) { - @Override - public GroupSummary create() { - final GroupSummaryPresenter presenter = new GroupSummaryPresenter($(StateManager.class), - $(WsThemePresenter.class)); - final GroupSummaryView view = new GroupSummaryPanel($(Images.class), presenter, - $(I18nUITranslationService.class), $(WorkspaceSkeleton.class)); - presenter.init(view); - return presenter; - } - }); - register(ApplicationComponentGroup.class, new Factory<AddAsBuddie>(AddAsBuddie.class) { @Override public AddAsBuddie create() { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -25,7 +25,7 @@ import org.ourproject.kune.platf.client.dto.ContentStatusDTO; import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.allen_sauer.gwt.log.client.Log; @@ -239,7 +239,7 @@ public boolean doBeforeNodeDrop(final TreePanel treePanel, final TreeNode target, final DragData dragData, final String point, final DragDrop source, final TreeNode dropNode, final DropNodeCallback dropNodeCallback) { - Site.info("Drag & drop of contents in development"); + NotifyUser.info("Drag & drop of contents in development"); return false; } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/ContextPropEditorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/ContextPropEditorPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/cxt/ContextPropEditorPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -33,7 +33,7 @@ import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.tags.TagsSummary; import org.ourproject.kune.workspace.client.title.EntitySubTitle; @@ -61,12 +61,12 @@ } public void addAuthor(final String authorShortName) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); final StateContainerDTO currentState = session.getContentState(); contentServiceProvider.get().addAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName, new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { - Site.hideProgress(); + NotifyUser.hideProgress(); stateManager.reload(); } }); @@ -81,12 +81,12 @@ } public void delAuthor(final String authorShortName) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); final StateContainerDTO currentState = session.getContentState(); contentServiceProvider.get().removeAuthor(session.getUserHash(), currentState.getStateToken(), authorShortName, new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { - Site.hideProgress(); + NotifyUser.hideProgress(); stateManager.reload(); } }); @@ -97,12 +97,12 @@ } public void doChangeLanguage(final String langCode) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); final StateContainerDTO currentState = session.getContentState(); contentServiceProvider.get().setLanguage(session.getUserHash(), currentState.getStateToken(), langCode, new AsyncCallbackSimple<I18nLanguageDTO>() { public void onSuccess(final I18nLanguageDTO lang) { - Site.hideProgress(); + NotifyUser.hideProgress(); } }); } @@ -112,12 +112,12 @@ } public void setPublishedOn(final Date publishedOn) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); final StateContainerDTO currentState = session.getContentState(); contentServiceProvider.get().setPublishedOn(session.getUserHash(), currentState.getStateToken(), publishedOn, new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { - Site.hideProgress(); + NotifyUser.hideProgress(); entitySubTitle.setContentDate(publishedOn); } }); @@ -178,13 +178,13 @@ } public void setTags(final String tagsString) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); final StateContainerDTO currentState = session.getContentState(); contentServiceProvider.get().setTags(session.getUserHash(), currentState.getStateToken(), tagsString, new AsyncCallbackSimple<TagCloudResultDTO>() { public void onSuccess(final TagCloudResultDTO result) { tagsSummaryProvider.get().setGroupTags(result); - Site.hideProgress(); + NotifyUser.hideProgress(); } }); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/hello/HelloWorldModule.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -27,7 +27,7 @@ import org.ourproject.kune.platf.client.dto.UserSimpleDTO; import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.I18nTranslationServiceMocked; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.allen_sauer.gwt.log.client.Log; @@ -78,7 +78,7 @@ public void showMessage() { /** i18n use with parameters **/ - Site.info(i18n.t("Hello [%s]!", "world")); + NotifyUser.info(i18n.t("Hello [%s]!", "world")); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -25,8 +25,8 @@ import org.ourproject.kune.platf.client.ui.AbstractSearcherPanel; import org.ourproject.kune.platf.client.ui.TextUtils; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.search.SiteBottomTrayButton; -import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.Frame; @@ -288,10 +288,10 @@ } private void setLanguage(final String language) { - Site.showProgressLoading(); + NotifyUser.showProgressLoading(); query(unTransStore, unTransGrid, language); query(transStore, transGrid, language); - Site.hideProgress(); + NotifyUser.hideProgress(); } private String[] splitNT(final String textWithNT) { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/I18nTranslatorPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.I18nServiceAsync; import org.ourproject.kune.platf.client.services.I18nUITranslationService; import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.events.Listener0; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -52,25 +52,25 @@ } public void doShowTranslator() { - Site.showProgressLoading(); + NotifyUser.showProgressLoading(); if (session.isLogged()) { view.show(); } else { - Site.info(i18n.t("Sign in or register to help with the translation")); + NotifyUser.info(i18n.t("Sign in or register to help with the translation")); } - Site.hideProgress(); + NotifyUser.hideProgress(); } public void doTranslation(final String id, final String trKey, final String translation) { - Site.showProgressSaving(); + NotifyUser.showProgressSaving(); i18nService.setTranslation(session.getUserHash(), id, translation, new AsyncCallback<String>() { public void onFailure(final Throwable caught) { - Site.hideProgress(); - Site.error(i18n.t("Server error saving the translation")); + NotifyUser.hideProgress(); + NotifyUser.error(i18n.t("Server error saving the translation")); } public void onSuccess(final String result) { - Site.hideProgress(); + NotifyUser.hideProgress(); i18n.setTranslationAfterSave(trKey, result); } }); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseChangeAction.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.events.Listener0; import com.calclab.suco.client.ioc.Provider; @@ -45,12 +45,12 @@ } public void changeLicense(final LicenseDTO license, final Listener0 onSuccess) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); groupService.get().changeDefLicense(session.getUserHash(), session.getCurrentStateToken(), license, new AsyncCallback<Object>() { public void onFailure(Throwable caught) { - Site.hideProgress(); - Site.error(i18n.t("Error changing default group license")); + NotifyUser.hideProgress(); + NotifyUser.error(i18n.t("Error changing default group license")); } public void onSuccess(Object result) { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensewizard/LicenseWizardPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -24,11 +24,11 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.dto.LicenseDTO; import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFirstFormView; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardFrdFormView; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardSndFormView; import org.ourproject.kune.workspace.client.licensewizard.pages.LicenseWizardTrdFormView; -import org.ourproject.kune.workspace.client.site.Site; import com.allen_sauer.gwt.log.client.Log; import com.calclab.suco.client.events.Listener; @@ -119,7 +119,7 @@ } } else if (in(sndForm)) { licenseShortName = "by-sa" + ccVers; - Site.error("Programatic error in LicenseWizardPresenter"); + NotifyUser.error("Programatic error in LicenseWizardPresenter"); } else { licenseShortName = frdForm.getSelectedLicense(); } 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -30,8 +30,8 @@ import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.WorkspaceMessages; -import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.site.SiteToken; import com.calclab.suco.client.events.Listener0; @@ -66,14 +66,14 @@ session.check(new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { if (session.isLogged()) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); view.show(); view.center(); view.setLicense(session.getDefLicense()); - Site.hideProgress(); + NotifyUser.hideProgress(); } else { stateManager.restorePreviousToken(); - Site.info(i18n.t(WorkspaceMessages.REGISTER_TO_CREATE_A_GROUP)); + NotifyUser.info(i18n.t(WorkspaceMessages.REGISTER_TO_CREATE_A_GROUP)); } } }); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -23,9 +23,9 @@ import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.dialogs.DefaultFormUtils; import org.ourproject.kune.platf.client.ui.download.FileParams; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.entityheader.EntityHeaderView; import org.ourproject.kune.workspace.client.options.EntityOptionsView; -import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.gwtext.client.core.Connection; @@ -102,7 +102,7 @@ FieldListenerAdapter changeListener = new FieldListenerAdapter() { @Override public void onChange(Field field, Object newVal, Object oldVal) { - Site.info("change"); + NotifyUser.info("change"); // setEnableFileField(); } }; Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/logo/EntityOptionsLogoPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -26,9 +26,9 @@ import org.ourproject.kune.platf.client.rpc.UserServiceAsync; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.entityheader.EntityHeader; import org.ourproject.kune.workspace.client.options.EntityOptions; -import org.ourproject.kune.workspace.client.site.Site; import com.calclab.suco.client.events.Listener2; import com.calclab.suco.client.ioc.Provider; @@ -80,7 +80,7 @@ } public void onSubmitFailed(int httpStatus, String responseText) { - Site.error("Error setting the group logo: " + responseText); + NotifyUser.error("Error setting the group logo: " + responseText); } private void setState() { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/options/pscape/EntityOptionsPublicSpaceConfPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/options/pscape/EntityOptionsPublicSpaceConfPanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/options/pscape/EntityOptionsPublicSpaceConfPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -21,8 +21,9 @@ import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.BasicThumb; +import org.ourproject.kune.platf.client.ui.TextUtils; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.options.EntityOptionsView; -import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; @@ -61,7 +62,7 @@ for (int i = 1; i <= 6; i++) { BasicThumb thumb = new BasicThumb("images/styles/styl" + i + ".png", "Style " + i, new ClickListener() { public void onClick(Widget sender) { - Site.info(Site.IN_DEVELOPMENT); + NotifyUser.info(TextUtils.IN_DEVELOPMENT_P); } }); thumb.setTooltip(i18n.t("Click to select and configure this theme")); Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateIt.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateIt.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateIt.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,26 @@ +/* + * + * 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.workspace.client.rate; + +public interface RateIt { + + void setVisible(boolean visible); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPanel.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,134 @@ +/* + * + * 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.workspace.client.rate; + +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.platf.client.services.Images; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; + +import com.google.gwt.user.client.ui.ClickListener; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Grid; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.MouseListenerAdapter; +import com.google.gwt.user.client.ui.Widget; + +public class RateItPanel extends Composite implements ClickListener, RateItView { + private Grid rateGrid; + private Image[] starImg; + private Label rateDesc; + private final Images img; + private final RateItPresenter presenter; + private Label rateItLabel; + private final I18nTranslationService i18n; + + public RateItPanel(final RateItPresenter presenter, final I18nTranslationService i18n, final WorkspaceSkeleton ws, + Images img) { + this.presenter = presenter; + this.i18n = i18n; + this.img = img; + initialize(); + layout(); + setProperties(); + ws.getEntityWorkspace().getContentBottomBar().add(this); + } + + public void clearRate() { + for (int i = 0; i < 5; i++) { + img.starGrey().applyTo(starImg[i]); + } + } + + public void onClick(final Widget sender) { + for (int i = 0; i < 5; i++) { + if (sender == starImg[i]) { + presenter.starClicked(i); + } + } + } + + public void setDesc(final String desc) { + rateDesc.setText(desc); + } + + public void setRate(final Star stars[]) { + for (int i = 0; i < 5; i++) { + stars[i].getImage().applyTo(starImg[i]); + } + } + + public void setStars(final Double rate) { + setRate(Star.genStars(rate.doubleValue())); + } + + private void initialize() { + rateItLabel = new Label(i18n.t("Rate it:")); + rateGrid = new Grid(1, 7); + starImg = new Image[5]; + rateDesc = new Label(); + for (int i = 0; i < 5; i++) { + starImg[i] = new Image(); + img.starGrey().applyTo(starImg[i]); + starImg[i].addStyleName("rateit-star"); + starImg[i].setStyleName("rateit-star"); + starImg[i].setTitle(i18n.t("Click to rate this")); + starImg[i].addClickListener(this); + starImg[i].addMouseListener(new MouseListenerAdapter() { + @Override + public void onMouseEnter(final Widget sender) { + for (int j = 0; j < 5; j++) { + if (sender == starImg[j]) { + presenter.starOver(j); + } + } + + } + + @Override + public void onMouseLeave(final Widget sender) { + presenter.revertCurrentRate(); + } + }); + } + } + + private void layout() { + initWidget(rateGrid); + rateGrid.setWidget(0, 0, rateItLabel); + for (int i = 0; i < 5; i++) { + rateGrid.setWidget(0, i + 1, starImg[i]); + } + rateGrid.setWidget(0, 6, rateDesc); + } + + private void setProperties() { + rateGrid.setCellPadding(0); + rateGrid.setCellSpacing(0); + rateGrid.setBorderWidth(0); + rateItLabel.addStyleName("kune-Margin-Small-r"); + // rateItLabel.addStyleName("kune-Margin-Medium-l"); + rateItLabel.addStyleName("kune-RatePanel-Label"); + rateGrid.addStyleName("kune-RatePanel-Stars"); + rateGrid.addStyleName("kune-RatePanel-Stars-RateIt"); + rateDesc.addStyleName("kune-RatePanel-Label"); + rateDesc.addStyleName("kune-Margin-Small-l"); + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPresenter.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,162 @@ +/* + * + * 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.workspace.client.rate; + +import org.ourproject.kune.platf.client.dto.RateResultDTO; +import org.ourproject.kune.platf.client.dto.StateAbstractDTO; +import org.ourproject.kune.platf.client.dto.StateContentDTO; +import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; +import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; +import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; + +import com.calclab.suco.client.events.Listener; +import com.calclab.suco.client.ioc.Provider; + +public class RateItPresenter implements RateIt { + + private static final Double NOT_RATED = new Double(-1); + private RateItView view; + private Double currentRate; + private boolean isRating; + private final I18nTranslationService i18n; + private final Provider<ContentServiceAsync> contentServiceProvider; + private final Session session; + private final Provider<RatePresenter> ratePresenterProv; + + public RateItPresenter(final I18nTranslationService i18n, final Session session, + final Provider<ContentServiceAsync> contentServiceProvider, final StateManager stateManager, + Provider<RatePresenter> ratePresenterProvider, final ContentCapabilitiesRegistry capabilitiesRegistry) { + this.i18n = i18n; + this.session = session; + this.contentServiceProvider = contentServiceProvider; + this.ratePresenterProv = ratePresenterProvider; + stateManager.onStateChanged(new Listener<StateAbstractDTO>() { + public void onEvent(final StateAbstractDTO state) { + if (state instanceof StateContentDTO) { + StateContentDTO stateContentDTO = (StateContentDTO) state; + setState(capabilitiesRegistry.isRateable(stateContentDTO.getTypeId()), + stateContentDTO.getCurrentUserRate()); + } else { + view.setVisible(false); + } + } + }); + } + + public void init(final RateItView view) { + this.view = view; + currentRate = NOT_RATED; + isRating = false; + } + + public void setRate(final Double value) { + currentRate = value; + if (currentRate == null) { + currentRate = NOT_RATED; + } + isRating = false; + setRatePanel(currentRate); + } + + public void setVisible(final boolean visible) { + view.setVisible(visible); + } + + protected void revertCurrentRate() { + if (!isRating) { + setRatePanel(currentRate); + } + } + + protected void starClicked(final int starClicked) { + isRating = true; + final Double newValue = starClicked + 1d == currentRate ? currentRate - 0.5d : starClicked + 1d; + setRatePanel(newValue); + NotifyUser.showProgressProcessing(); + final StateAbstractDTO currentState = session.getCurrentState(); + contentServiceProvider.get().rateContent(session.getUserHash(), currentState.getStateToken(), newValue, + new AsyncCallbackSimple<RateResultDTO>() { + public void onSuccess(final RateResultDTO result) { + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Content rated")); + if (currentState.getStateToken().equals(session.getCurrentStateToken())) { + session.getContentState().setRate(result); + setState(true, result.getCurrentUserRate()); + ratePresenterProv.get().setRate(result); + } + } + }); + } + + protected void starOver(final int starMouseOver) { + Double value = new Double(starMouseOver + 1); + if (Math.ceil(currentRate.doubleValue()) == value.doubleValue()) { + // use user already rated -> live same value when mouse is over + value = currentRate; + } + if (!isRating) { + // If we are not doing a rate rpc call + setRatePanel(value); + } + } + + private void setDesc(final int rateTruncated) { + if (rateTruncated >= 0 && rateTruncated <= 1) { + view.setDesc(i18n.t("Poor")); + } else if (rateTruncated == 2) { + view.setDesc(i18n.t("Below average")); + } else if (rateTruncated == 3) { + view.setDesc(i18n.t("Average")); + } else if (rateTruncated == 4) { + view.setDesc(i18n.t("Above average")); + } else if (rateTruncated == 5) { + view.setDesc(i18n.t("Excellent")); + } else { + view.setDesc(""); + } + } + + private void setRatePanel(final Double value) { + if (value.equals(NOT_RATED)) { + view.clearRate(); + view.setDesc(""); + } else { + view.setStars(value); + setDesc((int) Math.ceil(value.doubleValue())); + } + } + + private void setState(boolean isRateable, Double currentUserRate) { + if (isRateable) { + if (session.isLogged()) { + setRate(currentUserRate); + view.setVisible(true); + } else { + view.setVisible(false); + } + } else { + view.setVisible(false); + } + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItView.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItView.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateItView.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,32 @@ +/* + * + * 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.workspace.client.rate; + +public interface RateItView { + + void clearRate(); + + void setDesc(String desc); + + void setStars(Double value); + + void setVisible(boolean visible); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,102 @@ +/* + * + * 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.workspace.client.rate; + +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.workspace.client.skel.Toolbar; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; + +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.Grid; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.Label; + +public class RatePanel extends Composite implements RateView { + private Grid rateGrid; + private Image[] starImg; + private Label rateDesc; + private final I18nTranslationService i18n; + + public RatePanel(final Double rate, final Integer byUsers, final I18nTranslationService i18n, + final WorkspaceSkeleton ws) { + this.i18n = i18n; + initialize(); + layout(); + setProperties(); + if (rate != null) { + setRate(rate); + } + if (byUsers != null) { + setByUsers(byUsers); + } + final Toolbar bottomBar = ws.getEntityWorkspace().getContentBottomBar(); + bottomBar.addFill(); + bottomBar.add(this); + } + + 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)); + } + } + + public void setRate(final Double rate) { + setRate(Star.genStars(rate.doubleValue())); + } + + private void initialize() { + rateGrid = new Grid(1, 6); + starImg = new Image[5]; + for (int i = 0; i < 5; i++) { + starImg[i] = new Image(); + new Star(Star.GREY).getImage().applyTo(starImg[i]); + } + rateDesc = new Label(); + } + + private void layout() { + initWidget(rateGrid); + for (int i = 0; i < 5; i++) { + rateGrid.setWidget(0, i, starImg[i]); + } + rateGrid.setWidget(0, 5, rateDesc); + } + + private void setProperties() { + rateGrid.setCellPadding(0); + rateGrid.setCellSpacing(0); + rateGrid.setBorderWidth(0); + rateGrid.addStyleName("kune-RatePanel-Stars"); + rateDesc.addStyleName("kune-RatePanel-Label"); + rateDesc.addStyleName("kune-Margin-Small-lr"); + } + + private void setRate(final Star stars[]) { + for (int i = 0; i < 5; i++) { + stars[i].getImage().applyTo(starImg[i]); + } + } + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePresenter.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePresenter.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RatePresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,75 @@ +/* + * + * 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.workspace.client.rate; + +import org.ourproject.kune.platf.client.dto.RateResultDTO; +import org.ourproject.kune.platf.client.dto.StateAbstractDTO; +import org.ourproject.kune.platf.client.dto.StateContentDTO; +import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; +import org.ourproject.kune.platf.client.state.StateManager; + +import com.calclab.suco.client.events.Listener; + +public class RatePresenter { + + private RateView view; + private final ContentCapabilitiesRegistry capabilitiesRegistry; + + public RatePresenter(final StateManager stateManager, ContentCapabilitiesRegistry capabilitiesRegistry) { + this.capabilitiesRegistry = capabilitiesRegistry; + stateManager.onStateChanged(new Listener<StateAbstractDTO>() { + public void onEvent(final StateAbstractDTO state) { + if (state instanceof StateContentDTO) { + setState((StateContentDTO) state); + } else { + view.setVisible(false); + } + } + }); + } + + public void init(final RateView view) { + this.view = view; + } + + public void setRate(RateResultDTO result) { + setRate(result.getRateByUsers(), result.getRate()); + } + + public void setVisible(final boolean visible) { + view.setVisible(visible); + } + + private void setRate(Integer rateByUsers, Double rate) { + view.setVisible(true); + view.setRate(rate); + view.setByUsers(rateByUsers); + } + + private void setState(final StateContentDTO state) { + Integer rateByUsers = state.getRateByUsers(); + Double rate = state.getRate(); + if (capabilitiesRegistry.isRateable(state.getTypeId())) { + setRate(rateByUsers, rate); + } else { + view.setVisible(false); + } + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateView.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateView.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/RateView.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,30 @@ +/* + * + * 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.workspace.client.rate; + +public interface RateView { + + void setByUsers(Integer byUsers); + + void setRate(Double rate); + + void setVisible(boolean visible); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/Star.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/Star.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/rate/Star.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,92 @@ +/* + * + * 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.workspace.client.rate; + +import org.ourproject.kune.platf.client.services.Images; + +import com.google.gwt.user.client.ui.AbstractImagePrototype; + +public class Star { + 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 Star() { + image = img.starGrey(); + } + + public AbstractImagePrototype getImage() { + return image; + } + + public Star(final double rateDecimals) { + if (rateDecimals == 1) { + image = img.starYellow(); + } else if (rateDecimals == 0) { + image = img.starGrey(); + } else { + final int rateTrucated = (int) rateDecimals; + final int rateDecimal = (int) ((rateDecimals - rateTrucated) * 10) * 10; + if (rateDecimal == 10) { + image = img.star10(); + } else if (rateDecimal == 20) { + image = img.star20(); + } else if (rateDecimal == 30) { + image = img.star30(); + } else if (rateDecimal == 40) { + image = img.star40(); + } else if (rateDecimal == 50) { + image = img.star50(); + } else if (rateDecimal == 60) { + image = img.star60(); + } else if (rateDecimal == 70) { + image = img.star70(); + } else if (rateDecimal == 80) { + image = img.star80(); + } else if (rateDecimal == 90) { + 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; + } +} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/SiteSearcherPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -23,7 +23,7 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.ioc.Provider; @@ -58,11 +58,11 @@ } public void doSearch(final String text) { - Site.showProgressLoading(); + NotifyUser.showProgressLoading(); searchHistory.put(text, null); view.search(text, currentSearch); view.show(); - Site.hideProgress(); + NotifyUser.hideProgress(); } public void doSearchOfType(final String text, final SiteSearcherType typeOfSearch) { 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/RegisterPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -32,8 +32,8 @@ import org.ourproject.kune.platf.client.services.I18nUITranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; -import org.ourproject.kune.workspace.client.site.Site; import com.calclab.emiteuimodule.client.SubscriptionMode; import com.calclab.suco.client.ioc.Provider; @@ -56,10 +56,10 @@ public void doRegister() { signInProvider.get().hide(); if (!session.isLogged()) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); view.show(); view.center(); - Site.hideProgress(); + NotifyUser.hideProgress(); } else { stateManager.restorePreviousToken(); } 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -28,8 +28,8 @@ import org.ourproject.kune.platf.client.services.I18nUITranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; -import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.site.SiteToken; import com.allen_sauer.gwt.log.client.Log; @@ -52,10 +52,10 @@ public void doSignIn() { registerProvider.get().hide(); if (!session.isLogged()) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); view.show(); view.center(); - Site.hideProgress(); + NotifyUser.hideProgress(); view.focusOnNickname(); } else { stateManager.restorePreviousToken(); @@ -92,7 +92,7 @@ final AsyncCallback<UserInfoDTO> callback = new AsyncCallback<UserInfoDTO>() { public void onFailure(final Throwable caught) { view.unMask(); - Site.hideProgress(); + NotifyUser.hideProgress(); try { throw caught; } catch (final UserAuthException e) { Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/Site.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,93 +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.workspace.client.site; - -import org.ourproject.kune.platf.client.services.I18nTranslationService; -import org.ourproject.kune.platf.client.services.I18nUITranslationService; -import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; -import org.ourproject.kune.workspace.client.site.msg.SiteToastMessage; -import org.ourproject.kune.workspace.client.sitebar.siteprogress.SiteProgress; -import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; - -import com.calclab.suco.client.ioc.Provider; - -public class Site { - public static final String IN_DEVELOPMENT = " (in development)"; - private static I18nTranslationService i18n; - private static SiteProgress progress; - private static Provider<SiteToastMessage> siteMessageProvider; - private static Provider<WorkspaceSkeleton> ws; - - public static void error(final String value) { - getSiteMessage().showMessage(i18n.t("Error"), value, SiteErrorType.error); - } - - public static void hideProgress() { - progress.hideProgress(); - } - - public static void important(final String value) { - getSiteMessage().showMessage(i18n.t("Important"), value, SiteErrorType.imp); - } - - public static void info(final String value) { - getSiteMessage().showMessage(i18n.t("Info"), value, SiteErrorType.info); - } - - public static void showAlertMessage(String title, String message) { - ws.get().showAlertMessage(title, message); - } - - public static void showProgress(final String text) { - progress.showProgress(text); - } - - public static void showProgressLoading() { - progress.showProgress(i18n.t("Loading")); - } - - public static void showProgressProcessing() { - progress.showProgress(i18n.t("Processing")); - } - - public static void showProgressSaving() { - progress.showProgress(i18n.t("Saving")); - } - - public static void showProgressStarting() { - progress.showProgress(i18n.t("Starting")); - } - - public static void veryImportant(final String value) { - getSiteMessage().showMessage(i18n.t("Alert"), value, SiteErrorType.veryimp); - } - - private static SiteToastMessage getSiteMessage() { - return siteMessageProvider.get(); - } - - public Site(final I18nUITranslationService i18n, final SiteProgress progress, - final Provider<SiteToastMessage> siteMessageProvider, Provider<WorkspaceSkeleton> ws) { - Site.i18n = i18n; - Site.progress = progress; - Site.siteMessageProvider = siteMessageProvider; - Site.ws = ws; - } -} Added: trunk/src/main/java/org/ourproject/kune/workspace/client/site/WorkspaceNotifyUser.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/site/WorkspaceNotifyUser.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/WorkspaceNotifyUser.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,57 @@ +package org.ourproject.kune.workspace.client.site; + +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; +import org.ourproject.kune.workspace.client.site.msg.SiteToastMessage; +import org.ourproject.kune.workspace.client.sitebar.siteprogress.SiteProgress; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; + +import com.calclab.suco.client.events.Listener; +import com.calclab.suco.client.events.Listener0; +import com.calclab.suco.client.events.Listener2; +import com.calclab.suco.client.ioc.Provider; + +public class WorkspaceNotifyUser { + + public WorkspaceNotifyUser(NotifyUser notifyUser, final I18nTranslationService i18n, + final SiteProgress siteProgress, final Provider<SiteToastMessage> toaster, + final Provider<WorkspaceSkeleton> ws) { + notifyUser.addProgressNotifier(new Listener<String>() { + public void onEvent(String message) { + siteProgress.showProgress(message); + } + }); + notifyUser.addHideProgressNotifier(new Listener0() { + public void onEvent() { + siteProgress.hideProgress(); + } + }); + notifyUser.addNotifier(new Listener2<Level, String>() { + public void onEvent(Level level, String msg) { + String title = ""; + switch (level) { + case error: + title = i18n.t("Error"); + break; + case important: + title = i18n.t("Important"); + break; + case veryImportant: + title = i18n.t("Alert"); + break; + case info: + title = i18n.t("Info"); + break; + } + toaster.get().showMessage(title, msg, level); + } + }); + notifyUser.addAlerter(new Listener2<String, String>() { + public void onEvent(String title, String msg) { + ws.get().showAlertMessage(title, msg); + } + }); + } + +} Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessage.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessage.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessage.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -19,10 +19,10 @@ */ package org.ourproject.kune.workspace.client.site.msg; -import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; public interface SiteToastMessage { - void showMessage(String title, String message, SiteErrorType type); + void showMessage(String title, String message, Level level); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -19,7 +19,7 @@ */ package org.ourproject.kune.workspace.client.site.msg; -import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; import com.google.gwt.user.client.ui.HTML; import com.gwtextux.client.widgets.window.ToastWindow; @@ -29,19 +29,19 @@ public SiteToastMessagePanel() { } - public void showMessage(String title, String message, SiteErrorType type) { + public void showMessage(String title, String message, Level level) { HTML html = new HTML(message); html.addStyleName("kune-Margin-Medium-trbl"); ToastWindow toastWindow = new ToastWindow(title, html.toString()); String iconCls = ""; - switch (type) { + switch (level) { case info: iconCls = "k-stm-info-icon"; break; - case imp: + case important: iconCls = "k-stm-imp-icon"; break; - case veryimp: + case veryImportant: iconCls = "k-stm-verimp-icon"; break; case error: Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessagePresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.site.msg; import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; public class SiteToastMessagePresenter implements SiteToastMessage { @@ -37,7 +37,7 @@ this.view = view; } - public void showMessage(String title, final String message, final SiteErrorType type) { - view.showMessage(title, message, type); + public void showMessage(String title, final String message, final Level level) { + view.showMessage(title, message, level); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessageView.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessageView.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/site/msg/SiteToastMessageView.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -20,10 +20,10 @@ package org.ourproject.kune.workspace.client.site.msg; import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.workspace.client.newgroup.SiteErrorType; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser.Level; public interface SiteToastMessageView extends View { - void showMessage(String title, String message, SiteErrorType type); + void showMessage(String title, String message, Level level); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteprogress/SiteProgressPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteprogress/SiteProgressPanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/siteprogress/SiteProgressPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -34,7 +34,7 @@ private final Widget progressPanel; private final Widget progressText; - private Timer timeProgressMaxTime; + private final Timer timeProgressMaxTime; private final Provider<SitePublicSpaceLink> publicLinkProvider; @@ -43,6 +43,12 @@ this.publicLinkProvider = publicLinkProvider; progressPanel = RootPanel.get("kuneprogresspanel"); progressText = RootPanel.get("kuneprogresstext"); + timeProgressMaxTime = new Timer() { + @Override + public void run() { + hideProgress(); + } + }; } public void hideProgress() { @@ -56,14 +62,6 @@ } public void showProgress(final String text) { - if (timeProgressMaxTime == null) { - timeProgressMaxTime = new Timer() { - @Override - public void run() { - hideProgress(); - } - }; - } timeProgressMaxTime.schedule(MAX_TIME_PROGRESS_BAR); publicLinkProvider.get().setVisible(false); progressPanel.setVisible(true); 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesearch/SiteSearchPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.sitebar.sitesearch; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.skel.SimpleToolbar; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; @@ -67,7 +67,7 @@ searchButton.addClickListener(new ClickListener() { public void onClick(final Widget arg0) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); presenter.doSearch(searchTextBox.getText()); } }); @@ -82,7 +82,7 @@ public void onKeyUp(final Widget widget, final char key, final int mod) { if (key == KEY_ENTER) { if (searchTextBox.getText().length() > 0) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); presenter.doSearch(searchTextBox.getText()); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPanel.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.sitebar.sitesign; import org.ourproject.kune.platf.client.services.I18nUITranslationService; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; import com.google.gwt.user.client.ui.ClickListener; @@ -42,7 +42,7 @@ ws.getSiteBar().add(signOutLabel); signOutLabel.addClickListener(new ClickListener() { public void onClick(final Widget arg0) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); presenter.doSignOut(); } }); 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/sitesign/SiteSignOutLinkPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -30,7 +30,7 @@ import org.ourproject.kune.platf.client.rpc.UserServiceAsync; import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.events.Listener; import com.calclab.suco.client.events.Listener0; @@ -76,7 +76,7 @@ if (beforeSignOutCollection.checkBeforeAction()) { userServiceProvider.get().logout(session.getUserHash(), new AsyncCallback<Object>() { public void onFailure(final Throwable caught) { - Site.hideProgress(); + NotifyUser.hideProgress(); try { throw caught; } catch (final SessionExpiredException e) { @@ -90,13 +90,13 @@ } public void onSuccess(final Object arg0) { - Site.hideProgress(); + NotifyUser.hideProgress(); clientUIsignOut(); } }); } else { - Site.hideProgress(); + NotifyUser.hideProgress(); } } 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/BuddiesSummaryPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -29,6 +29,7 @@ import org.ourproject.kune.platf.client.actions.ActionToolbarMenuRadioDescriptor; import org.ourproject.kune.platf.client.actions.ActionToolbarPosition; import org.ourproject.kune.platf.client.actions.GroupActionRegistry; +import org.ourproject.kune.platf.client.actions.RadioMustBeChecked; import org.ourproject.kune.platf.client.actions.UserActionRegistry; import org.ourproject.kune.platf.client.actions.toolbar.ActionBuddiesSummaryToolbar; import org.ourproject.kune.platf.client.dto.AccessRightsDTO; @@ -46,7 +47,7 @@ import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.events.Listener; import com.calclab.suco.client.ioc.Provider; @@ -151,7 +152,7 @@ ActionToolbarMenuDescriptor<UserSimpleDTO> addNewBuddiesAction = new ActionToolbarMenuDescriptor<UserSimpleDTO>( AccessRolDTO.Administrator, ActionToolbarPosition.bottombar, new Listener<UserSimpleDTO>() { public void onEvent(UserSimpleDTO parameter) { - Site.info("In development"); + NotifyUser.info("In development"); } }); addNewBuddiesAction.setTextDescription(i18n.t("Add a new buddy")); @@ -168,7 +169,7 @@ session.getCurrentState().getGroup().getStateToken(), visibility, new AsyncCallbackSimple<Object>() { public void onSuccess(Object result) { - Site.info(i18n.t("Buddies visibility changed")); + NotifyUser.info(i18n.t("Buddies visibility changed")); } }); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersSummaryPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -26,6 +26,7 @@ import org.ourproject.kune.platf.client.actions.ActionToolbarMenuRadioDescriptor; import org.ourproject.kune.platf.client.actions.ActionToolbarPosition; import org.ourproject.kune.platf.client.actions.GroupActionRegistry; +import org.ourproject.kune.platf.client.actions.RadioMustBeChecked; import org.ourproject.kune.platf.client.actions.toolbar.ActionGroupSummaryToolbar; import org.ourproject.kune.platf.client.dto.AccessListsDTO; import org.ourproject.kune.platf.client.dto.AccessRightsDTO; @@ -50,8 +51,8 @@ import org.ourproject.kune.platf.client.ui.MenuItem; import org.ourproject.kune.platf.client.ui.download.FileDownloadUtils; import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.search.GroupLiveSearcher; -import org.ourproject.kune.workspace.client.site.Site; import org.ourproject.kune.workspace.client.themes.WsTheme; import org.ourproject.kune.workspace.client.themes.WsThemePresenter; @@ -118,7 +119,7 @@ chatEngineProvider.get().chat( XmppURI.jid(group.getShortName() + "@" + initData.getChatDomain())); } else { - Site.important(i18n.t("To start a chat you need to be 'online'")); + NotifyUser.important(i18n.t("To start a chat you need to be 'online'")); } } }), true); @@ -139,12 +140,12 @@ } public void addCollab(final String groupShortName) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); snServiceProvider.get().addCollabMember(session.getUserHash(), session.getCurrentState().getStateToken(), groupShortName, new AsyncCallbackSimple<SocialNetworkDataDTO>() { public void onSuccess(final SocialNetworkDataDTO result) { - Site.hideProgress(); - Site.info(i18n.t("Member added as collaborator")); + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Member added as collaborator")); stateManager.setSocialNetwork(result); } @@ -191,7 +192,7 @@ session.getCurrentState().getGroup().getStateToken(), admissionPolicy, new AsyncCallbackSimple<Object>() { public void onSuccess(Object result) { - Site.info(i18n.t("Members joining policy changed")); + NotifyUser.info(i18n.t("Members joining policy changed")); } }); } @@ -215,7 +216,7 @@ session.getCurrentState().getGroup().getStateToken(), visibility, new AsyncCallbackSimple<Object>() { public void onSuccess(Object result) { - Site.info(i18n.t("Members visibility changed")); + NotifyUser.info(i18n.t("Members visibility changed")); } }); } Deleted: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/RadioMustBeChecked.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/RadioMustBeChecked.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/RadioMustBeChecked.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,24 +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.workspace.client.socialnet; - -public interface RadioMustBeChecked { - boolean mustBeChecked(); -} \ No newline at end of file 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -41,8 +41,8 @@ import org.ourproject.kune.platf.client.ui.gridmenu.CustomMenu; import org.ourproject.kune.platf.client.ui.gridmenu.GridGroup; import org.ourproject.kune.platf.client.ui.gridmenu.GridItem; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.entityheader.EntityHeaderView; -import org.ourproject.kune.workspace.client.site.Site; import com.calclab.suco.client.events.Listener; import com.calclab.suco.client.ioc.Provider; @@ -143,22 +143,22 @@ participate = new ActionToolbarButtonDescriptor<StateToken>(AccessRolDTO.Viewer, ActionToolbarPosition.bottombar, new Listener<StateToken>() { public void onEvent(StateToken parameter) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); snServiceProvider.get().requestJoinGroup(session.getUserHash(), session.getCurrentState().getStateToken(), new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { - Site.hideProgress(); + NotifyUser.hideProgress(); final SocialNetworkRequestResult resultType = (SocialNetworkRequestResult) result; switch (resultType) { case accepted: - Site.info(i18n.t("You are now member of this group")); + NotifyUser.info(i18n.t("You are now member of this group")); stateManager.reload(); break; case denied: - Site.important(i18n.t("Sorry this is a closed group")); + NotifyUser.important(i18n.t("Sorry this is a closed group")); break; case moderated: - Site.info(i18n.t("Membership requested. Waiting for admins decision")); + NotifyUser.info(i18n.t("Membership requested. Waiting for admins decision")); break; } } @@ -238,13 +238,13 @@ changeToCollabMenuItem = new MenuItem<GroupDTO>("images/arrow-down-green.gif", i18n.t("Change to collaborator"), new Listener<GroupDTO>() { public void onEvent(final GroupDTO group) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); snServiceProvider.get().setAdminAsCollab(session.getUserHash(), session.getCurrentState().getStateToken(), group.getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() { public void onSuccess(final SocialNetworkDataDTO result) { - Site.hideProgress(); - Site.info(i18n.t("Member type changed")); + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Member type changed")); stateManager.setSocialNetwork(result); } }); @@ -253,13 +253,13 @@ removeMemberMenuItem = new MenuItem<GroupDTO>("images/del.gif", i18n.t("Remove this member"), new Listener<GroupDTO>() { public void onEvent(final GroupDTO group) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); snServiceProvider.get().deleteMember(session.getUserHash(), session.getCurrentState().getStateToken(), group.getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() { public void onSuccess(final SocialNetworkDataDTO result) { - Site.hideProgress(); - Site.info(i18n.t("Member removed")); + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Member removed")); stateManager.reload(); // in the // future, @@ -276,13 +276,13 @@ changeToAdminMenuItem = new MenuItem<GroupDTO>("images/arrow-up-green.gif", i18n.t("Change to admin"), new Listener<GroupDTO>() { public void onEvent(final GroupDTO group) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); snServiceProvider.get().setCollabAsAdmin(session.getUserHash(), session.getCurrentState().getStateToken(), group.getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() { public void onSuccess(final SocialNetworkDataDTO result) { - Site.hideProgress(); - Site.info(i18n.t("Member type changed")); + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Member type changed")); stateManager.setSocialNetwork(result); } }); @@ -291,13 +291,13 @@ acceptJoinGroupMenuItem = new MenuItem<GroupDTO>("images/accept.gif", i18n.t("Accept this member"), new Listener<GroupDTO>() { public void onEvent(final GroupDTO group) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); snServiceProvider.get().acceptJoinGroup(session.getUserHash(), session.getCurrentState().getStateToken(), group.getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() { public void onSuccess(final SocialNetworkDataDTO result) { - Site.hideProgress(); - Site.info(i18n.t("Member accepted")); + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Member accepted")); stateManager.setSocialNetwork(result); } }); @@ -306,13 +306,13 @@ denyJoinGroupMenuItem = new MenuItem<GroupDTO>("images/cancel.gif", i18n.t("Reject this member"), new Listener<GroupDTO>() { public void onEvent(final GroupDTO group) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); snServiceProvider.get().denyJoinGroup(session.getUserHash(), session.getCurrentState().getStateToken(), group.getShortName(), new AsyncCallbackSimple<SocialNetworkDataDTO>() { public void onSuccess(final SocialNetworkDataDTO result) { - Site.hideProgress(); - Site.info(i18n.t("Member rejected")); + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Member rejected")); stateManager.setSocialNetwork(result); } }); @@ -329,12 +329,12 @@ } private void removeMemberAction(final GroupDTO groupDTO) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); snServiceProvider.get().unJoinGroup(session.getUserHash(), new StateToken(groupDTO.getShortName()), new AsyncCallbackSimple<SocialNetworkDataDTO>() { public void onSuccess(final SocialNetworkDataDTO result) { - Site.hideProgress(); - Site.info(i18n.t("Removed as member")); + NotifyUser.hideProgress(); + NotifyUser.info(i18n.t("Removed as member")); stateManager.reload(); // in the future with user // info: Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/other/AddAsBuddiePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/other/AddAsBuddiePresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/other/AddAsBuddiePresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -5,7 +5,7 @@ import org.ourproject.kune.platf.client.dto.StateAbstractDTO; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.events.Listener; import com.calclab.suco.client.events.Listener0; @@ -42,7 +42,7 @@ public void onAdd() { chatEngine.get().addNewBuddie(session.getCurrentState().getGroup().getShortName()); - Site.info("Added as buddie. Waiting buddie response"); + NotifyUser.info("Added as buddie. Waiting buddie response"); view.setVisible(false); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/themes/WsThemePresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -26,7 +26,7 @@ import org.ourproject.kune.platf.client.rpc.GroupServiceAsync; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.events.Event2; import com.calclab.suco.client.events.Listener; @@ -74,12 +74,12 @@ } protected void onChangeGroupWsTheme(final WsTheme newTheme) { - Site.showProgressProcessing(); + NotifyUser.showProgressProcessing(); groupServiceProvider.get().changeGroupWsTheme(session.getUserHash(), session.getCurrentState().getStateToken(), newTheme.getName(), new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { setTheme(newTheme); - Site.hideProgress(); + NotifyUser.hideProgress(); } }); } 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-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/title/RenameAction.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -26,7 +26,7 @@ import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import com.calclab.suco.client.events.Event2; import com.calclab.suco.client.events.Listener2; @@ -58,26 +58,26 @@ public void rename(final StateToken token, final String oldName, final String newName) { if (!newName.equals(oldName)) { - Site.showProgress(i18n.t("Renaming")); + NotifyUser.showProgress(i18n.t("Renaming")); final AsyncCallback<StateAbstractDTO> asyncCallback = new AsyncCallback<StateAbstractDTO>() { public void onFailure(final Throwable caught) { - Site.hideProgress(); + NotifyUser.hideProgress(); try { throw caught; } catch (final NameInUseException e) { - Site.error(i18n.tWithNT("This name already exists", + 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) { - Site.error(i18n.tWithNT("This name is not permitted", + 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) { - Site.error(i18n.t("Error renaming")); + NotifyUser.error(i18n.t("Error renaming")); } onFail.fire(token, oldName); } public void onSuccess(final StateAbstractDTO state) { - Site.hideProgress(); + NotifyUser.hideProgress(); session.setCurrentState(state); onSuccess.fire(token, state.getTitle()); } Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/AbstractClientTool.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/AbstractClientTool.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/AbstractClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,35 @@ +/* + * + * 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.workspace.client.tool; + +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.themes.WsThemePresenter; + +public abstract class AbstractClientTool implements ClientTool { + + public AbstractClientTool(final String shortName, final String longName, final ToolSelector toolSelector, + final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws) { + final ToolSelectorItemPresenter presenter = new ToolSelectorItemPresenter(shortName, longName, toolSelector, + wsThemePresenter); + final ToolSelectorItemPanel panel = new ToolSelectorItemPanel(presenter, ws); + presenter.init(panel); + } + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ClientTool.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ClientTool.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,26 @@ +/* + * + * 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.workspace.client.tool; + +public interface ClientTool { + + String getName(); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/FoldableAbstractClientTool.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/FoldableAbstractClientTool.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/FoldableAbstractClientTool.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,122 @@ +/* + * + * 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.workspace.client.tool; + +import org.ourproject.kune.platf.client.dto.BasicMimeTypeDTO; +import org.ourproject.kune.platf.client.registry.ContentCapabilitiesRegistry; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.themes.WsThemePresenter; + +public abstract class FoldableAbstractClientTool extends AbstractClientTool { + public static final String UPLOADEDFILE_SUFFIX = "uploaded"; + + protected final ContentCapabilitiesRegistry contentCapabilitiesRegistry; + + public FoldableAbstractClientTool(String shortName, String longName, ToolSelector toolSelector, + WsThemePresenter wsThemePresenter, WorkspaceSkeleton ws, + ContentCapabilitiesRegistry contentCapabilitiesRegistry) { + super(shortName, longName, toolSelector, wsThemePresenter, ws); + this.contentCapabilitiesRegistry = contentCapabilitiesRegistry; + } + + public void registerContentTypeIcon(final String typeId, final BasicMimeTypeDTO mimeType, final String iconUrl) { + contentCapabilitiesRegistry.getIconsRegistry().registerContentTypeIcon(typeId, mimeType, iconUrl); + } + + public void registerContentTypeIcon(final String contentTypeId, final String iconUrl) { + contentCapabilitiesRegistry.getIconsRegistry().registerContentTypeIcon(contentTypeId, iconUrl); + } + + protected void registerAclEditableTypes(String... typeIds) { + contentCapabilitiesRegistry.getAclEditable().register(typeIds); + } + + protected void registerAuthorableTypes(String... typeIds) { + contentCapabilitiesRegistry.getAuthorable().register(typeIds); + } + + protected void registerComentableTypes(String... typeIds) { + contentCapabilitiesRegistry.getComentable().register(typeIds); + } + + protected void registerDragableTypes(String... typeIds) { + contentCapabilitiesRegistry.getDragable().register(typeIds); + } + + protected void registerDropableTypes(String... typeIds) { + contentCapabilitiesRegistry.getDropable().register(typeIds); + } + + protected void registerEmailSubscribeAbleTypes(String... typeIds) { + contentCapabilitiesRegistry.getEmailSubscribeAble().register(typeIds); + } + + protected void registerLicensableTypes(String... typeIds) { + contentCapabilitiesRegistry.getLicensable().register(typeIds); + } + + protected void registerPublishModerableTypes(String... typeIds) { + contentCapabilitiesRegistry.getPublishModerable().register(typeIds); + } + + protected void registerRateableTypes(String... typeIds) { + contentCapabilitiesRegistry.getRateable().register(typeIds); + } + + protected void registerRenamableTypes(String... typeIds) { + contentCapabilitiesRegistry.getRenamable().register(typeIds); + } + + protected void registerTageableTypes(String... typeIds) { + contentCapabilitiesRegistry.getTageable().register(typeIds); + } + + protected void registerTranslatableTypes(String... typeIds) { + contentCapabilitiesRegistry.getTranslatable().register(typeIds); + } + + protected void registerUploadTypesAndMimes(String typeUploadedfile) { + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("image"), "images/nav/picture.png"); + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("video"), "images/nav/film.png"); + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "pdf"), "images/nav/page_pdf.png"); + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "zip"), "images/nav/page_zip.png"); + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "zip"), "images/nav/page_zip.png"); + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("text"), "images/nav/page_text.png"); + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "msword"), + "images/nav/page_word.png"); + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "excel"), + "images/nav/page_excel.png"); + registerContentTypeIcon(typeUploadedfile, new BasicMimeTypeDTO("application", "mspowerpoint"), + "images/nav/page_pps.png"); + registerContentTypeIcon(typeUploadedfile, "images/nav/page.png"); + } + + protected void registerVersionableTypes(String... typeIds) { + contentCapabilitiesRegistry.getVersionable().register(typeIds); + } + + protected void registerXmppComentableTypes(String... typeIds) { + contentCapabilitiesRegistry.getXmppComentable().register(typeIds); + } + + protected void registerXmppNotifyCapableTypes(String... typeIds) { + contentCapabilitiesRegistry.getXmppNotificyCapable().register(typeIds); + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelector.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelector.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelector.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,26 @@ +/* + * + * 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.workspace.client.tool; + +public interface ToolSelector { + + void addTool(ToolSelectorItem item); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItem.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItem.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItem.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,32 @@ +/* + * + * 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.workspace.client.tool; + +public interface ToolSelectorItem { + + String getShortName(); + + void setGroupShortName(String groupShortName); + + void setSelected(boolean selected); + + void setVisible(boolean visible); + +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemPanel.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPanel.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemPanel.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,69 @@ +/* + * + * 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.workspace.client.tool; + +import org.ourproject.kune.platf.client.ui.RoundedPanel; +import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton; +import org.ourproject.kune.workspace.client.themes.WsTheme; + +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.ui.Hyperlink; + +public class ToolSelectorItemPanel extends RoundedPanel implements ToolSelectorItemView { + private final Hyperlink hl; + + public ToolSelectorItemPanel(final ToolSelectorItemPresenter presenter, final WorkspaceSkeleton ws) { + super(RoundedPanel.RIGHT, 2); + hl = new Hyperlink(); + super.setWidget(hl); + ws.addInTools(this); + super.sinkEvents(Event.ONCLICK); + super.addStyleName("k-toolselectoritem"); + } + + @Override + public void onBrowserEvent(final Event event) { + super.onBrowserEvent(event); + } + + public void setLink(final String text, final String targetHistoryToken) { + hl.setText(text); + hl.setTargetHistoryToken(targetHistoryToken); + } + + public void setSelected(final boolean selected) { + if (selected) { + hl.setStylePrimaryName("k-toolselectoritem-sel"); + } else { + hl.setStylePrimaryName("k-toolselectoritem-notsel"); + } + super.setCornerStyleName(hl.getStyleName()); + } + + public void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { + if (oldTheme != null) { + final String oldName = oldTheme.getName(); + hl.removeStyleDependentName(oldName); + } + final String newName = newTheme.getName(); + hl.addStyleDependentName(newName); + super.setCornerStyleName(hl.getStyleName()); + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemPresenter.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemPresenter.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,79 @@ +/* + * + * 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.workspace.client.tool; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.workspace.client.themes.WsTheme; +import org.ourproject.kune.workspace.client.themes.WsThemePresenter; + +import com.calclab.suco.client.events.Listener2; + +public class ToolSelectorItemPresenter implements ToolSelectorItem { + + private ToolSelectorItemView view; + private final ToolSelector toolSelector; + private final WsThemePresenter wsThemePresenter; + private final String shortName; + private final String longName; + + public ToolSelectorItemPresenter(final String shortName, final String longName, final ToolSelector toolSelector, + final WsThemePresenter wsThemePresenter) { + this.shortName = shortName; + this.longName = longName; + this.toolSelector = toolSelector; + this.wsThemePresenter = wsThemePresenter; + } + + public String getShortName() { + return shortName; + } + + public View getView() { + return view; + } + + public void init(final ToolSelectorItemView view) { + this.view = view; + toolSelector.addTool(this); + wsThemePresenter.onThemeChanged(new Listener2<WsTheme, WsTheme>() { + public void onEvent(final WsTheme oldTheme, final WsTheme newTheme) { + setTheme(oldTheme, newTheme); + } + }); + } + + public void setGroupShortName(final String groupShortName) { + final StateToken token = new StateToken(groupShortName, getShortName(), null, null); + view.setLink(longName, token.toString()); + } + + public void setSelected(final boolean selected) { + view.setSelected(selected); + } + + public void setVisible(boolean visible) { + view.setVisible(visible); + } + + private void setTheme(final WsTheme oldTheme, final WsTheme newTheme) { + view.setTheme(oldTheme, newTheme); + } +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemView.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorItemView.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorItemView.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,34 @@ +/* + * + * 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.workspace.client.tool; + +import org.ourproject.kune.platf.client.View; +import org.ourproject.kune.workspace.client.themes.WsTheme; + +public interface ToolSelectorItemView extends View { + + void setLink(String text, String targetHistoryToken); + + void setSelected(boolean selected); + + void setTheme(WsTheme oldTheme, WsTheme newTheme); + + void setVisible(boolean visible); +} Copied: trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java (from rev 1044, trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java) =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenter.java 2009-02-01 14:46:12 UTC (rev 1044) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenter.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,90 @@ +/* + * + * 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.workspace.client.tool; + +import java.util.HashMap; +import java.util.List; + +import org.ourproject.kune.platf.client.dto.StateAbstractDTO; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.themes.WsThemePresenter; + +import com.allen_sauer.gwt.log.client.Log; +import com.calclab.suco.client.events.Listener; +import com.calclab.suco.client.events.Listener2; + +public class ToolSelectorPresenter implements ToolSelector { + + private final HashMap<String, ToolSelectorItem> tools; + + public ToolSelectorPresenter(final StateManager stateManager, final WsThemePresenter wsThemePresenter) { + tools = new HashMap<String, ToolSelectorItem>(); + stateManager.onStateChanged(new Listener<StateAbstractDTO>() { + public void onEvent(StateAbstractDTO state) { + for (String tool : tools.keySet()) { + List<String> enabledTools = state.getEnabledTools(); + if (enabledTools != null && enabledTools.contains(tool)) { + tools.get(tool).setVisible(true); + } else { + tools.get(tool).setVisible(false); + } + } + } + }); + stateManager.onGroupChanged(new Listener2<String, String>() { + public void onEvent(final String oldGroup, final String newGroup) { + onGroupChanged(newGroup); + } + }); + stateManager.onToolChanged(new Listener2<String, String>() { + public void onEvent(final String oldTool, final String newTool) { + onToolChanged(oldTool, newTool); + } + }); + } + + 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"); + } + if (tools.get(name) != null) { + throw new RuntimeException("A tool with the same name already added"); + } + tools.put(name, item); + item.setSelected(false); + } + + void onGroupChanged(final String newGroupName) { + for (final String name : tools.keySet()) { + tools.get(name).setGroupShortName(newGroupName); + } + } + + void onToolChanged(final String oldTool, final String newTool) { + Log.debug("Registered tools: " + tools.keySet().toString()); + if (!oldTool.equals("")) { + tools.get(oldTool).setSelected(false); + } + if (!newTool.equals("")) { + tools.get(newTool).setSelected(true); + } + } +} Modified: trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/test/java/org/ourproject/kune/platf/client/state/StateManagerTest.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -9,10 +9,8 @@ import org.ourproject.kune.platf.client.app.HistoryWrapper; import org.ourproject.kune.platf.client.dto.StateAbstractDTO; import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.services.I18nUITranslationService; -import org.ourproject.kune.workspace.client.site.Site; +import org.ourproject.kune.platf.client.ui.noti.NotifyUser; import org.ourproject.kune.workspace.client.site.SiteToken; -import org.ourproject.kune.workspace.client.sitebar.siteprogress.SiteProgress; import com.calclab.suco.testing.events.MockedListener; import com.calclab.suco.testing.events.MockedListener0; @@ -49,7 +47,7 @@ stateManager.onStateChanged(stateChangeListener); stateManager.onGroupChanged(groupChangeListener); stateManager.onToolChanged(toolChangeListener); - new Site(Mockito.mock(I18nUITranslationService.class), Mockito.mock(SiteProgress.class), null, null); + new NotifyUser(null); } @Test Deleted: trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java 2009-02-26 01:46:09 UTC (rev 1052) +++ trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -1,103 +0,0 @@ -package org.ourproject.kune.platf.client.tool; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mockito; -import org.ourproject.kune.platf.client.state.StateManager; -import org.ourproject.kune.workspace.client.themes.WsThemePresenter; - -public class ToolSelectorPresenterTest { - - private static final String TOOL1_NAME = "tool1"; - private static final String TOOL2_NAME = "tool2"; - private static final String GROUP1_NAME = "group1"; - private ToolSelectorPresenter toolSelector; - private ToolSelectorItem toolSelectorItem1; - private ToolSelectorItem toolSelectorItem2; - - @Test - public void addFirstToolMustNotSelect() { - setToolNames(); - toolSelector.addTool(toolSelectorItem1); - Mockito.verify(toolSelectorItem1).setSelected(false); - } - - @Test(expected = RuntimeException.class) - public void addToolWithoutNameMustGiveException() { - toolSelector.addTool(toolSelectorItem1); - } - - @Test - public void addTwoToolsMustSelectNothing() { - setToolNames(); - toolSelector.addTool(toolSelectorItem1); - toolSelector.addTool(toolSelectorItem2); - Mockito.verify(toolSelectorItem1).setSelected(false); - Mockito.verify(toolSelectorItem2).setSelected(false); - } - - @Test(expected = RuntimeException.class) - public void addTwoToolsWithSameNameMustGiveException() { - setToolNames(); - final ToolSelectorItem toolSelectorItemCopy = Mockito.mock(ToolSelectorItem.class); - Mockito.when(toolSelectorItemCopy.getShortName()).thenReturn(TOOL1_NAME); - toolSelector.addTool(toolSelectorItem1); - toolSelector.addTool(toolSelectorItemCopy); - } - - @Before - public void begin() { - final StateManager stateManager = Mockito.mock(StateManager.class); - final WsThemePresenter themePresenter = Mockito.mock(WsThemePresenter.class); - toolSelector = new ToolSelectorPresenter(stateManager, themePresenter); - toolSelectorItem1 = Mockito.mock(ToolSelectorItem.class); - toolSelectorItem2 = Mockito.mock(ToolSelectorItem.class); - } - - @Test - public void setStateFirstMustSelect() { - setToolNames(); - toolSelector.addTool(toolSelectorItem1); - toolSelector.onToolChanged("", TOOL1_NAME); - Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(false); - Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(true); - } - - @Test - public void setStateWithADifferentGroupMustSetLink() { - setToolNames(); - toolSelector.addTool(toolSelectorItem1); - toolSelector.addTool(toolSelectorItem2); - toolSelector.onGroupChanged(GROUP1_NAME); - Mockito.verify(toolSelectorItem1, Mockito.times(1)).setGroupShortName(GROUP1_NAME); - Mockito.verify(toolSelectorItem2, Mockito.times(1)).setGroupShortName(GROUP1_NAME); - } - - @Test - public void setStateWithADifferentToolNameMustSelectAndUnSelectTheOlder() { - setToolNames(); - toolSelector.addTool(toolSelectorItem1); - toolSelector.addTool(toolSelectorItem2); - toolSelector.onToolChanged(TOOL1_NAME, TOOL2_NAME); - Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(false); - Mockito.verify(toolSelectorItem1, Mockito.times(2)).setSelected(false); - Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(true); - } - - @Test - public void setStateWithNoToolNameMustUnSelectTheOlder() { - setToolNames(); - toolSelector.addTool(toolSelectorItem1); - toolSelector.addTool(toolSelectorItem2); - toolSelector.onToolChanged(TOOL1_NAME, ""); - Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(false); - Mockito.verify(toolSelectorItem1, Mockito.times(2)).setSelected(false); - Mockito.verify(toolSelectorItem2, Mockito.never()).setSelected(true); - } - - public void setToolNames() { - Mockito.when(toolSelectorItem1.getShortName()).thenReturn(TOOL1_NAME); - Mockito.when(toolSelectorItem2.getShortName()).thenReturn(TOOL2_NAME); - } - -} Copied: trunk/src/test/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenterTest.java (from rev 1042, trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java) =================================================================== --- trunk/src/test/java/org/ourproject/kune/platf/client/tool/ToolSelectorPresenterTest.java 2009-01-29 18:42:08 UTC (rev 1042) +++ trunk/src/test/java/org/ourproject/kune/workspace/client/tool/ToolSelectorPresenterTest.java 2009-03-02 13:25:37 UTC (rev 1053) @@ -0,0 +1,105 @@ +package org.ourproject.kune.workspace.client.tool; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.themes.WsThemePresenter; +import org.ourproject.kune.workspace.client.tool.ToolSelectorItem; +import org.ourproject.kune.workspace.client.tool.ToolSelectorPresenter; + +public class ToolSelectorPresenterTest { + + private static final String TOOL1_NAME = "tool1"; + private static final String TOOL2_NAME = "tool2"; + private static final String GROUP1_NAME = "group1"; + private ToolSelectorPresenter toolSelector; + private ToolSelectorItem toolSelectorItem1; + private ToolSelectorItem toolSelectorItem2; + + @Test + public void addFirstToolMustNotSelect() { + setToolNames(); + toolSelector.addTool(toolSelectorItem1); + Mockito.verify(toolSelectorItem1).setSelected(false); + } + + @Test(expected = RuntimeException.class) + public void addToolWithoutNameMustGiveException() { + toolSelector.addTool(toolSelectorItem1); + } + + @Test + public void addTwoToolsMustSelectNothing() { + setToolNames(); + toolSelector.addTool(toolSelectorItem1); + toolSelector.addTool(toolSelectorItem2); + Mockito.verify(toolSelectorItem1).setSelected(false); + Mockito.verify(toolSelectorItem2).setSelected(false); + } + + @Test(expected = RuntimeException.class) + public void addTwoToolsWithSameNameMustGiveException() { + setToolNames(); + final ToolSelectorItem toolSelectorItemCopy = Mockito.mock(ToolSelectorItem.class); + Mockito.when(toolSelectorItemCopy.getShortName()).thenReturn(TOOL1_NAME); + toolSelector.addTool(toolSelectorItem1); + toolSelector.addTool(toolSelectorItemCopy); + } + + @Before + public void begin() { + final StateManager stateManager = Mockito.mock(StateManager.class); + final WsThemePresenter themePresenter = Mockito.mock(WsThemePresenter.class); + toolSelector = new ToolSelectorPresenter(stateManager, themePresenter); + toolSelectorItem1 = Mockito.mock(ToolSelectorItem.class); + toolSelectorItem2 = Mockito.mock(ToolSelectorItem.class); + } + + @Test + public void setStateFirstMustSelect() { + setToolNames(); + toolSelector.addTool(toolSelectorItem1); + toolSelector.onToolChanged("", TOOL1_NAME); + Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(false); + Mockito.verify(toolSelectorItem1, Mockito.times(1)).setSelected(true); + } + + @Test + public void setStateWithADifferentGroupMustSetLink() { + setToolNames(); + toolSelector.addTool(toolSelectorItem1); + toolSelector.addTool(toolSelectorItem2); + toolSelector.onGroupChanged(GROUP1_NAME); + Mockito.verify(toolSelectorItem1, Mockito.times(1)).setGroupShortName(GROUP1_NAME); + Mockito.verify(toolSelectorItem2, Mockito.times(1)).setGroupShortName(GROUP1_NAME); + } + + @Test + public void setStateWithADifferentToolNameMustSelectAndUnSelectTheOlder() { + setToolNames(); + toolSelector.addTool(toolSelectorItem1); + toolSelector.addTool(toolSelectorItem2); + toolSelector.onToolChanged(TOOL1_NAME, TOOL2_NAME); + Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(false); + Mockito.verify(toolSelectorItem1, Mockito.times(2)).setSelected(false); + Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(true); + } + + @Test + public void setStateWithNoToolNameMustUnSelectTheOlder() { + setToolNames(); + toolSelector.addTool(toolSelectorItem1); + toolSelector.addTool(toolSelectorItem2); + toolSelector.onToolChanged(TOOL1_NAME, ""); + Mockito.verify(toolSelectorItem2, Mockito.times(1)).setSelected(false); + Mockito.verify(toolSelectorItem1, Mockito.times(2)).setSelected(false); + Mockito.verify(toolSelectorItem2, Mockito.never()).setSelected(true); + } + + public void setToolNames() { + Mockito.when(toolSelectorItem1.getShortName()).thenReturn(TOOL1_NAME); + Mockito.when(toolSelectorItem2.getShortName()).thenReturn(TOOL2_NAME); + } + +}