r772 - in trunk/src: main/java/org/ourproject/kune main/java/org/ourproject/kune/app main/java/org/ourproject/kune/app/client main/java/org/ourproject/kune/app/server main/java/org/ourproject/kune/chat/client main/java/org/ourproject/kune/chat/client/cnt/room/ui main/java/org/ourproject/kune/chat/client/ctx/rooms main/java/org/ourproject/kune/docs/client main/java/org/ourproject/kune/docs/client/actions main/java/org/ourproject/kune/docs/client/cnt/reader/ui main/java/org/ourproject/kune/docs
Author: vjrj Date: 2008-06-01 16:44:36 +0200 (Sun, 01 Jun 2008) New Revision: 772 Removed: trunk/src/main/java/org/ourproject/kune/blogs/ Modified: trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/DocsClientModule.java trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java trunk/src/main/java/org/ourproject/kune/docs/client/actions/AddDocumentAction.java trunk/src/main/java/org/ourproject/kune/docs/client/actions/AddFolderAction.java trunk/src/main/java/org/ourproject/kune/docs/client/actions/SaveDocumentAction.java trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderControlPanel.java trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/ui/AdminContextPanel.java trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java trunk/src/main/java/org/ourproject/kune/docs/client/ui/DocumentFactory.java trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java trunk/src/main/java/org/ourproject/kune/platf/client/app/DefaultApplication.java trunk/src/main/java/org/ourproject/kune/platf/client/app/ui/DesktopPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.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/RatePanel.java trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackSubItemAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/LoggedInAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/RateContentAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/DoTranslationAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/GetLexiconAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/ShowTranslatorAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AcceptJoinGroupAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddAdminAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddCollabAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddViewerAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/DeleteMemberAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/DenyJoinGroupAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/RequestJoinGroupAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/SetAdminAsCollabAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/SetCollabAsAdminAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/UnJoinGroupAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/LanguageSelectorPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/ui/LicensePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/ui/NewGroupPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/presence/ui/GroupSummaryPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/search/ui/SearchSitePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/SiteBarFactory.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginForm.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/RegisterForm.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/MemberAction.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/EntityLiveSearchPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/GroupLiveSearchPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/GroupMembersPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/ParticipationPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/UserLiveSearchPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/tags/ui/TagsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/theme/ui/ThemeMenuPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/admin/AccessListsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ContentSubTitlePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ContentTitlePresenter.java trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentBottomToolBarPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentSubTitlePanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/GroupLogoPanel.java trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/GroupToolsBar.java trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java trunk/src/test/java/org/ourproject/kune/sitebar/client/ui/LoginPresenterTest.java Log: more modules... Modified: trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml 2008-06-01 14:44:36 UTC (rev 772) @@ -16,7 +16,6 @@ <inherits name='org.ourproject.kune.platf.Kune-Platform' /> <inherits name='org.ourproject.kune.docs.Kune-Docs' /> <inherits name='org.ourproject.kune.chat.Kune-Chat' /> - <inherits name='org.ourproject.kune.blogs.Kune-Blogs' /> <inherits name="com.allen_sauer.gwt.log.gwt-log" /> Modified: trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/app/client/KuneEntryPoint.java 2008-06-01 14:44:36 UTC (rev 772) @@ -61,8 +61,7 @@ Log.debug("Workspace adaptation to your language failed"); } - public void onSuccess(final I18nLanguageDTO result) { - final I18nLanguageDTO initialLang = result; + public void onSuccess(final I18nLanguageDTO initialLang) { server.getLexicon(initialLang.getCode(), new AsyncCallback<HashMap<String, String>>() { public void onFailure(final Throwable caught) { Log.debug("Workspace adaptation to your language failed"); Modified: trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/app/server/KuneRackModule.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,7 +19,6 @@ */ package org.ourproject.kune.app.server; -import org.ourproject.kune.blogs.server.BlogServerModule; import org.ourproject.kune.chat.server.ChatServerModule; import org.ourproject.kune.docs.server.DocumentServerModule; import org.ourproject.kune.platf.client.rpc.ContentService; @@ -104,7 +103,6 @@ builder.use(new PlatformServerModule()); builder.use(new DocumentServerModule()); builder.use(new ChatServerModule()); - builder.use(new BlogServerModule()); builder.use(new RESTServicesModule()); builder.use(configModule); } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatClientTool.java 2008-06-01 14:44:36 UTC (rev 772) @@ -36,11 +36,13 @@ private final ChatToolComponents components; private ChatEngine chat; private final EmiteUIDialog emiteUIDialog; + private final I18nTranslationService i18n; public ChatClientTool(final I18nTranslationService i18n, final EmiteUIDialog emiteUIDialog) { super(i18n.t("chat rooms")); + this.i18n = i18n; this.emiteUIDialog = emiteUIDialog; - components = new ChatToolComponents(emiteUIDialog); + components = new ChatToolComponents(emiteUIDialog, i18n); } public ChatEngine getChat() { @@ -60,7 +62,7 @@ } public void initEngine(final ChatOptions options) { - this.chat = new ChatEngineXmpp(emiteUIDialog, options); + this.chat = new ChatEngineXmpp(emiteUIDialog, options, i18n); } public void setContent(final StateDTO state) { Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatEngineXmpp.java 2008-06-01 14:44:36 UTC (rev 772) @@ -21,7 +21,7 @@ import java.util.Date; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import com.calclab.emite.client.core.signal.Listener; import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode; @@ -35,10 +35,13 @@ class ChatEngineXmpp implements ChatEngine { private final ChatOptions chatOptions; private final EmiteUIDialog emiteDialog; + private final I18nTranslationService i18n; - public ChatEngineXmpp(final EmiteUIDialog emiteUIDialog, final ChatOptions chatOptions) { + public ChatEngineXmpp(final EmiteUIDialog emiteUIDialog, final ChatOptions chatOptions, + final I18nTranslationService i18n) { this.emiteDialog = emiteUIDialog; this.chatOptions = chatOptions; + this.i18n = i18n; } public ChatOptions getChatOptions() { @@ -66,8 +69,7 @@ final String initialWindowTitle = Window.getTitle(); chatOptions.userOptions = userChatOptions; - emiteDialog.start(userChatOptions, chatOptions.httpBase, chatOptions.roomHost, avatarProvider, Kune.I18N - .t("Chat")); + emiteDialog.start(userChatOptions, chatOptions.httpBase, chatOptions.roomHost, avatarProvider, i18n.t("Chat")); emiteDialog.show(OwnStatus.online); emiteDialog.hide(); emiteDialog.onConversationAttended(new Listener<String>() { Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatFactory.java 2008-06-01 14:44:36 UTC (rev 772) @@ -35,6 +35,7 @@ import org.ourproject.kune.chat.client.ctx.ChatContextPresenter; import org.ourproject.kune.chat.client.ctx.rooms.RoomsAdmin; import org.ourproject.kune.chat.client.ctx.rooms.RoomsAdminPresenter; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.WorkspaceFactory; import org.ourproject.kune.workspace.client.component.WorkspaceDeckPanel; import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; @@ -43,7 +44,10 @@ public class ChatFactory { - public static ChatContent createChatContent(final EmiteUIDialog emiteUIDialog) { + private static I18nTranslationService i18n; + + public static ChatContent createChatContent(final EmiteUIDialog emiteUIDialog, final I18nTranslationService i18n) { + ChatFactory.i18n = i18n; WorkspaceDeckPanel panel = new WorkspaceDeckPanel(); ChatContentPresenter presenter = new ChatContentPresenter(emiteUIDialog, panel); return presenter; @@ -61,7 +65,7 @@ } public static ChatRoomControl createChatRoomControlViewer(final ChatRoomListener listener) { - ChatRoomControlPanel panel = new ChatRoomControlPanel(listener); + ChatRoomControlPanel panel = new ChatRoomControlPanel(listener, i18n); ChatRoomControlPresenter presenter = new ChatRoomControlPresenter(panel); return presenter; } @@ -74,7 +78,7 @@ public static RoomsAdmin createRoomsAdmin() { ContextItems contextItems = WorkspaceFactory.createContextItems(); - RoomsAdminPresenter presenter = new RoomsAdminPresenter(contextItems); + RoomsAdminPresenter presenter = new RoomsAdminPresenter(contextItems, i18n); return presenter; } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ChatToolComponents.java 2008-06-01 14:44:36 UTC (rev 772) @@ -22,6 +22,7 @@ import org.ourproject.kune.chat.client.cnt.ChatContent; import org.ourproject.kune.chat.client.ctx.ChatContext; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import com.calclab.emiteuimodule.client.EmiteUIDialog; @@ -29,14 +30,16 @@ private ChatContent content; private ChatContext context; private final EmiteUIDialog emiteUIDialog; + private final I18nTranslationService i18n; - public ChatToolComponents(final EmiteUIDialog emiteUIDialog) { + public ChatToolComponents(final EmiteUIDialog emiteUIDialog, final I18nTranslationService i18n) { this.emiteUIDialog = emiteUIDialog; + this.i18n = i18n; } public ChatContent getContent() { if (content == null) { - content = ChatFactory.createChatContent(emiteUIDialog); + content = ChatFactory.createChatContent(emiteUIDialog, i18n); } return content; } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/chat/client/cnt/room/ui/ChatRoomControlPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -22,7 +22,7 @@ import org.ourproject.kune.chat.client.cnt.room.ChatRoomControlView; import org.ourproject.kune.chat.client.cnt.room.ChatRoomListener; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.CustomPushButton; import com.google.gwt.user.client.ui.ClickListener; @@ -32,8 +32,8 @@ public class ChatRoomControlPanel extends HorizontalPanel implements ChatRoomControlView { private final CustomPushButton enterRoomBtn; - public ChatRoomControlPanel(final ChatRoomListener listener) { - enterRoomBtn = new CustomPushButton(Kune.I18N.t("Enter room"), new ClickListener() { + public ChatRoomControlPanel(final ChatRoomListener listener, final I18nTranslationService i18n) { + enterRoomBtn = new CustomPushButton(i18n.t("Enter room"), new ClickListener() { public void onClick(final Widget sender) { listener.onEnterRoom(); } Modified: trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/chat/client/ctx/rooms/RoomsAdminPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -26,22 +26,26 @@ import org.ourproject.kune.platf.client.dto.AccessRightsDTO; import org.ourproject.kune.platf.client.dto.ContainerDTO; import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsImages; public class RoomsAdminPresenter implements RoomsAdmin { private final ContextItems contextItems; - public RoomsAdminPresenter(final ContextItems contextItems) { + public RoomsAdminPresenter(final ContextItems contextItems, final I18nTranslationService i18n) { this.contextItems = contextItems; ContextItemsImages images = ContextItemsImages.App.getInstance(); contextItems.setParentTreeVisible(false); contextItems.registerType(ChatClientTool.TYPE_CHAT, images.page()); contextItems.registerType(ChatClientTool.TYPE_ROOM, images.chatGreen()); - contextItems.canCreate(ChatClientTool.TYPE_ROOM, Kune.I18N.t("New chat room"), ChatEvents.ADD_ROOM); + contextItems.canCreate(ChatClientTool.TYPE_ROOM, i18n.t("New chat room"), ChatEvents.ADD_ROOM); } + public View getView() { + return contextItems.getView(); + } + // FIXME: cierta lógica de negocio en el cliente // ¿debemos quitarla? es decir, enviar desde el servidor si se puede añadir // hijos al contenedor @@ -53,8 +57,4 @@ } } - public View getView() { - return contextItems.getView(); - } - } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocsClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocsClientModule.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocsClientModule.java 2008-06-01 14:44:36 UTC (rev 772) @@ -37,6 +37,7 @@ import org.ourproject.kune.docs.client.actions.WSSplitterStopResizingAction; import org.ourproject.kune.platf.client.extend.ClientModule; import org.ourproject.kune.platf.client.extend.Register; +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.WorkspaceEvents; @@ -47,17 +48,20 @@ private final Session session; private final Workspace workspace; private final StateManager stateManager; + private final I18nTranslationService i18n; - public DocsClientModule(final Session session, final StateManager stateManager, final Workspace workspace) { + public DocsClientModule(final Session session, final StateManager stateManager, final Workspace workspace, + final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; this.workspace = workspace; + this.i18n = i18n; } public void configure(final Register register) { - register.addAction(DocsEvents.SAVE_DOCUMENT, new SaveDocumentAction(session)); - register.addAction(DocsEvents.ADD_DOCUMENT, new AddDocumentAction(stateManager, session)); - register.addAction(DocsEvents.ADD_FOLDER, new AddFolderAction(stateManager, session)); + register.addAction(DocsEvents.SAVE_DOCUMENT, new SaveDocumentAction(session, i18n)); + register.addAction(DocsEvents.ADD_DOCUMENT, new AddDocumentAction(stateManager, session, i18n)); + register.addAction(DocsEvents.ADD_FOLDER, new AddFolderAction(stateManager, session, i18n)); register.addAction(DocsEvents.GO_PARENT_FOLDER, new GoParentFolderAction(stateManager, session)); register.addAction(DocsEvents.ADD_AUTHOR, new ContentAddAuthorAction(stateManager, session)); register.addAction(DocsEvents.REMOVE_AUTHOR, new ContentRemoveAuthorAction(stateManager, session)); Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientNewModule.java 2008-06-01 14:44:36 UTC (rev 772) @@ -34,7 +34,8 @@ Session session = builder.getInstance(Session.class); StateManager stateManager = builder.getInstance(StateManager.class); Application application = builder.getInstance(Application.class); - platform.install(new DocsClientModule(session, stateManager, application.getWorkspace())); + I18nUITranslationService i18n = builder.getInstance(I18nUITranslationService.class); + platform.install(new DocsClientModule(session, stateManager, application.getWorkspace(), i18n)); } } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/actions/AddDocumentAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/actions/AddDocumentAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/AddDocumentAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -26,7 +26,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.ContentService; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -35,10 +35,12 @@ private final Session session; private final StateManager stateManager; + private final I18nTranslationService i18n; - public AddDocumentAction(final StateManager stateManager, final Session session) { + public AddDocumentAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n) { this.stateManager = stateManager; this.session = session; + this.i18n = i18n; } public void execute(final String name) { @@ -52,7 +54,7 @@ .getId(), name, new AsyncCallbackSimple<StateDTO>() { public void onSuccess(final StateDTO state) { Site.hideProgress(); - Site.info(Kune.I18N.t("Created, now you can edit the document")); + Site.info(i18n.t("Created, now you can edit the document")); stateManager.setRetrievedState(state); } }); Modified: trunk/src/main/java/org/ourproject/kune/docs/client/actions/AddFolderAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/actions/AddFolderAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/AddFolderAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -27,7 +27,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.ContentService; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -35,10 +35,12 @@ public class AddFolderAction implements Action<String> { private final Session session; private final StateManager stateManager; + private final I18nTranslationService i18n; - public AddFolderAction(final StateManager stateManager, final Session session) { + public AddFolderAction(final StateManager stateManager, final Session session, final I18nTranslationService i18n) { this.stateManager = stateManager; this.session = session; + this.i18n = i18n; } public void execute(final String name) { @@ -53,7 +55,7 @@ server.addFolder(session.getUserHash(), group.getShortName(), container.getId(), name, new AsyncCallbackSimple<StateDTO>() { public void onSuccess(final StateDTO state) { - Site.info(Kune.I18N.t("Folder created")); + Site.info(i18n.t("Folder created")); stateManager.setRetrievedState(state); // FIXME: Isn't using cache stateManager.reloadContextAndTitles(); Modified: trunk/src/main/java/org/ourproject/kune/docs/client/actions/SaveDocumentAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/actions/SaveDocumentAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/actions/SaveDocumentAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -25,7 +25,7 @@ import org.ourproject.kune.platf.client.errors.SessionExpiredException; import org.ourproject.kune.platf.client.rpc.ContentService; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.workspace.client.sitebar.Site; @@ -35,9 +35,11 @@ public class SaveDocumentAction implements Action<SaveDocumentActionParams> { private final Session session; + private final I18nTranslationService i18n; - public SaveDocumentAction(final Session session) { + public SaveDocumentAction(final Session session, final I18nTranslationService i18n) { this.session = session; + this.i18n = i18n; } public void execute(final SaveDocumentActionParams params) { @@ -55,14 +57,14 @@ throw caught; } catch (final SessionExpiredException e) { Site.doLogout(); - MessageBox.alert(Kune.I18N.t("Alert"), - Kune.I18N.t("Your session has expired. Please login again."), new AlertCallback() { + MessageBox.alert(i18n.t("Alert"), i18n.t("Your session has expired. Please login again."), + new AlertCallback() { public void execute() { Site.doLogin(null); } }); } catch (final Throwable e) { - Site.error(Kune.I18N.t("Error saving document. Retrying...")); + Site.error(i18n.t("Error saving document. Retrying...")); params.getDocumentContent().onSaveFailed(); } } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderControlPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderControlPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/cnt/reader/ui/DocumentReaderControlPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -22,7 +22,7 @@ import org.ourproject.kune.docs.client.cnt.reader.DocumentReaderControlView; import org.ourproject.kune.docs.client.cnt.reader.DocumentReaderListener; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.CustomPushButton; import org.ourproject.kune.workspace.client.sitebar.Site; @@ -35,26 +35,26 @@ private final CustomPushButton deleteBtn; private final CustomPushButton translateBtn; - public DocumentReaderControlPanel(final DocumentReaderListener listener) { - editBtn = new CustomPushButton(Kune.I18N.tWithNT("Edit", "used in button"), new ClickListener() { + public DocumentReaderControlPanel(final DocumentReaderListener listener, final I18nTranslationService i18n) { + editBtn = new CustomPushButton(i18n.tWithNT("Edit", "used in button"), new ClickListener() { public void onClick(final Widget sender) { listener.onEdit(); editBtn.removeStyleDependentName("up-hovering"); } }); - deleteBtn = new CustomPushButton(Kune.I18N.tWithNT("Delete", "used in button"), new ClickListener() { + deleteBtn = new CustomPushButton(i18n.tWithNT("Delete", "used in button"), new ClickListener() { public void onClick(final Widget sender) { listener.onDelete(); deleteBtn.removeStyleDependentName("up-hovering"); } }); - translateBtn = new CustomPushButton(Kune.I18N.tWithNT("Translate", "used in button"), new ClickListener() { + translateBtn = new CustomPushButton(i18n.tWithNT("Translate", "used in button"), new ClickListener() { public void onClick(final Widget sender) { listener.onTranslate(); translateBtn.removeStyleDependentName("up-hovering"); - Site.showAlertMessage(Kune.I18N.t("Sorry, this functionality is currently in development")); + Site.showAlertMessage(i18n.t("Sorry, this functionality is currently in development")); } }); @@ -68,14 +68,14 @@ setTranslateEnabled(false); } + public void setDeleteEnabled(final boolean isEnabled) { + deleteBtn.setVisible(isEnabled); + } + public void setEditEnabled(final boolean isEnabled) { editBtn.setVisible(isEnabled); } - public void setDeleteEnabled(final boolean isEnabled) { - deleteBtn.setVisible(isEnabled); - } - public void setTranslateEnabled(final boolean isEnabled) { translateBtn.setVisible(isEnabled); } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/ui/AdminContextPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/ui/AdminContextPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/admin/ui/AdminContextPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -30,8 +30,8 @@ import org.ourproject.kune.platf.client.dto.AccessListsDTO; import org.ourproject.kune.platf.client.dto.I18nLanguageDTO; import org.ourproject.kune.platf.client.dto.UserSimpleDTO; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.IconLabel; import org.ourproject.kune.platf.client.ui.stacks.IndexedStackPanelWithSubItems; import org.ourproject.kune.platf.client.ui.stacks.StackSubItemAction; @@ -54,11 +54,6 @@ public class AdminContextPanel extends VerticalPanel implements AdminContextView { private static final Images IMG = Images.App.getInstance(); - private static final String TAGS_ITEM = Kune.I18N.t("Tags"); - private static final String LANGUAGE_ITEM = Kune.I18N.t("Language"); - private static final String PERMS_ITEM = Kune.I18N.t("Permissions"); - private static final String AUTHORS_ITEM = Kune.I18N.t("Authors"); - private static final String PUBLICATION_ITEM = Kune.I18N.t("Publication"); private static final int FORMS_WIDTH = 145; private final IndexedStackPanelWithSubItems options; @@ -73,184 +68,196 @@ private VerticalPanel authorsComponent; private VerticalPanel langComponent; private IconLabel addAuthorLabel; + private final I18nTranslationService i18n; + private final String authors_item; + private final String publication_item; + private final String perms_item; + private final String language_item; + private final String tags_item; - public AdminContextPanel(final AdminContextPresenter presenter) { - this.presenter = presenter; - options = new IndexedStackPanelWithSubItems(); - options.addStyleName("kune-AdminContextPanel"); + public AdminContextPanel(final AdminContextPresenter presenter, final I18nTranslationService i18n) { + this.presenter = presenter; + this.i18n = i18n; + options = new IndexedStackPanelWithSubItems(); + options.addStyleName("kune-AdminContextPanel"); - add(options); - setCellWidth(options, "100%"); - setWidth("100%"); + add(options); + setCellWidth(options, "100%"); + setWidth("100%"); + authors_item = i18n.t("Authors"); + publication_item = i18n.t("Publication"); + perms_item = i18n.t("Permissions"); + language_item = i18n.t("Language"); + tags_item = i18n.t("Tags"); } public void removeAccessListComponent() { - if (options.containsItem(PERMS_ITEM)) { - removeComponent(PERMS_ITEM); - } + if (options.containsItem(perms_item)) { + removeComponent(perms_item); + } } public void removeAuthorsComponent() { - if (options.containsItem(AUTHORS_ITEM)) { - removeComponent(AUTHORS_ITEM); - } + if (options.containsItem(authors_item)) { + removeComponent(authors_item); + } } public void removeLangComponent() { - if (options.containsItem(LANGUAGE_ITEM)) { - removeComponent(LANGUAGE_ITEM); - } + if (options.containsItem(language_item)) { + removeComponent(language_item); + } } public void removePublishedOnComponent() { - if (options.containsItem(PUBLICATION_ITEM)) { - removeComponent(PUBLICATION_ITEM); - } + if (options.containsItem(publication_item)) { + removeComponent(publication_item); + } } public void removeTagsComponent() { - if (options.containsItem(TAGS_ITEM)) { - removeComponent(TAGS_ITEM); - } + if (options.containsItem(tags_item)) { + removeComponent(tags_item); + } } public void reset() { - options.clear(); + options.clear(); } public void setAccessLists(final AccessListsDTO accessLists) { - if (accessListsPanel == null) { - accessListsPanel = new AccessListsPanel(); - } - if (!options.containsItem(PERMS_ITEM)) { - addComponent(PERMS_ITEM, Kune.I18N.t("Who can admin/edit/view this work"), accessListsPanel); - } - accessListsPanel.setAccessLists(accessLists); + if (accessListsPanel == null) { + accessListsPanel = new AccessListsPanel(i18n); + } + if (!options.containsItem(perms_item)) { + addComponent(perms_item, i18n.t("Who can admin/edit/view this work"), accessListsPanel); + } + accessListsPanel.setAccessLists(accessLists); } public void setAuthors(final List<UserSimpleDTO> authors) { - if (authorsComponent == null) { - authorsComponent = new VerticalPanel(); - addAuthorLabel = new IconLabel(IMG.addGreen(), Kune.I18N.t("Add author")); - addAuthorLabel.addClickListener(new ClickListener() { - public void onClick(final Widget sender) { - presenter.doAction(DocsEvents.ADD_AUTHOR, null); - } - }); - } else { - if (options.containsItem(AUTHORS_ITEM)) { - options.removeStackItem(AUTHORS_ITEM); - } - authorsComponent.clear(); - } - if (!options.containsItem(AUTHORS_ITEM)) { - addComponent(AUTHORS_ITEM, Kune.I18N.t("Authors of this work"), authorsComponent); - } - for (final Iterator<UserSimpleDTO> iterator = authors.iterator(); iterator.hasNext();) { - final UserSimpleDTO author = iterator.next(); - final StackSubItemAction[] authorActions = { new StackSubItemAction(IMG.del(), - Kune.I18N.t("Remove author"), DocsEvents.REMOVE_AUTHOR) }; - options.addStackSubItem(AUTHORS_ITEM, IMG.personDef(), author.getShortName(), author.getName(), - authorActions, presenter); - } - authorsComponent.add(addAuthorLabel); + if (authorsComponent == null) { + authorsComponent = new VerticalPanel(); + addAuthorLabel = new IconLabel(IMG.addGreen(), i18n.t("Add author")); + addAuthorLabel.addClickListener(new ClickListener() { + public void onClick(final Widget sender) { + presenter.doAction(DocsEvents.ADD_AUTHOR, null); + } + }); + } else { + if (options.containsItem(authors_item)) { + options.removeStackItem(authors_item); + } + authorsComponent.clear(); + } + if (!options.containsItem(authors_item)) { + addComponent(authors_item, i18n.t("Authors of this work"), authorsComponent); + } + for (final Iterator<UserSimpleDTO> iterator = authors.iterator(); iterator.hasNext();) { + final UserSimpleDTO author = iterator.next(); + final StackSubItemAction[] authorActions = { new StackSubItemAction(IMG.del(), i18n.t("Remove author"), + DocsEvents.REMOVE_AUTHOR) }; + options.addStackSubItem(authors_item, IMG.personDef(), author.getShortName(), author.getName(), + authorActions, presenter); + } + authorsComponent.add(addAuthorLabel); } public void setLanguage(final I18nLanguageDTO language) { - if (langComponent == null) { - langPresenter = WorkspaceFactory.createLanguageSelectorComponent(); - langComponent = new VerticalPanel(); - final LanguageSelectorPanel view = (LanguageSelectorPanel) langPresenter.getView(); - view.setWidth("" + FORMS_WIDTH); - langComponent.add(view); - view.addChangeListener(new ComboBoxListenerAdapter() { - public void onSelect(final ComboBox comboBox, final Record record, final int index) { - presenter.doChangeLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID)); - } - }); - } - if (!options.containsItem(LANGUAGE_ITEM)) { - addComponent(LANGUAGE_ITEM, Kune.I18N.t("The language of this work"), langComponent); - } - langPresenter.setLanguage(language); + if (langComponent == null) { + langPresenter = WorkspaceFactory.createLanguageSelectorComponent(); + langComponent = new VerticalPanel(); + final LanguageSelectorPanel view = (LanguageSelectorPanel) langPresenter.getView(); + view.setWidth("" + FORMS_WIDTH); + langComponent.add(view); + view.addChangeListener(new ComboBoxListenerAdapter() { + public void onSelect(final ComboBox comboBox, final Record record, final int index) { + presenter.doChangeLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID)); + } + }); + } + if (!options.containsItem(language_item)) { + addComponent(language_item, i18n.t("The language of this work"), langComponent); + } + langPresenter.setLanguage(language); } public void setPublishedOn(final Date publishedOn) { - if (publishedOnField == null) { - publishedOnComponent = createPublicationComponent(); - } - if (!options.containsItem(PUBLICATION_ITEM)) { - addComponent(PUBLICATION_ITEM, Kune.I18N.t("Date of publication of this work"), publishedOnComponent); - } - // publishedOnField.setValue(publishedOn); + if (publishedOnField == null) { + publishedOnComponent = createPublicationComponent(); + } + if (!options.containsItem(publication_item)) { + addComponent(publication_item, i18n.t("Date of publication of this work"), publishedOnComponent); + } + // publishedOnField.setValue(publishedOn); } public void setTags(final String tags) { - if (tagsComponent == null) { - tagsComponent = createTagsComponent(); - } - if (!options.containsItem(TAGS_ITEM)) { - addComponent(TAGS_ITEM, Kune.I18N.t("Keywords or terms associated with this work"), tagsComponent); - } - tagsField.setValue(tags); + if (tagsComponent == null) { + tagsComponent = createTagsComponent(); + } + if (!options.containsItem(tags_item)) { + addComponent(tags_item, i18n.t("Keywords or terms associated with this work"), tagsComponent); + } + tagsField.setValue(tags); } private void addComponent(final String header, final String headerTitle, final VerticalPanel panel) { - panel.addStyleName("kune-AdminContextPanel-inner-wrap"); - final VerticalPanel vp = options.addStackItem(header, headerTitle, false); - vp.setStyleName("kune-AdminContextPanel-inner"); - vp.add(panel); - vp.setCellWidth(panel, "100%"); - vp.setWidth("100%"); + panel.addStyleName("kune-AdminContextPanel-inner-wrap"); + final VerticalPanel vp = options.addStackItem(header, headerTitle, false); + vp.setStyleName("kune-AdminContextPanel-inner"); + vp.add(panel); + vp.setCellWidth(panel, "100%"); + vp.setWidth("100%"); } private FormPanel createDefaultForm() { - final FormPanel form = new FormPanel(); - form.setHideLabels(true); - form.setWidth(FORMS_WIDTH); - form.setBorder(false); - return form; + final FormPanel form = new FormPanel(); + form.setHideLabels(true); + form.setWidth(FORMS_WIDTH); + form.setBorder(false); + return form; } private VerticalPanel createPublicationComponent() { - final FormPanel form = createDefaultForm(); + final FormPanel form = createDefaultForm(); - publishedOnField = new DateField(); - publishedOnField.setWidth("140"); - publishedOnField.setFormat("Y-m-d"); + publishedOnField = new DateField(); + publishedOnField.setWidth("140"); + publishedOnField.setFormat("Y-m-d"); - publishedOnField.addListener(new FieldListenerAdapter() { - public void onChange(final Field field, final Object newVal, final Object oldVal) { - presenter.setPublishedOn((Date) newVal); - } - }); + publishedOnField.addListener(new FieldListenerAdapter() { + public void onChange(final Field field, final Object newVal, final Object oldVal) { + presenter.setPublishedOn((Date) newVal); + } + }); - form.add(publishedOnField); + form.add(publishedOnField); - final VerticalPanel vp = new VerticalPanel(); - vp.add(form); - return vp; + final VerticalPanel vp = new VerticalPanel(); + vp.add(form); + return vp; } private VerticalPanel createTagsComponent() { - final FormPanel form = createDefaultForm(); - tagsField = new TextArea(); - tagsField.setWidth("" + FORMS_WIDTH); - tagsField.setHeight("3em"); - tagsField.addListener(new FieldListenerAdapter() { - public void onChange(final Field field, final Object newVal, final Object oldVal) { - presenter.setTags((String) newVal); - } - }); + final FormPanel form = createDefaultForm(); + tagsField = new TextArea(); + tagsField.setWidth("" + FORMS_WIDTH); + tagsField.setHeight("3em"); + tagsField.addListener(new FieldListenerAdapter() { + public void onChange(final Field field, final Object newVal, final Object oldVal) { + presenter.setTags((String) newVal); + } + }); - form.add(tagsField); - final VerticalPanel vp = new VerticalPanel(); - vp.add(form); - return vp; + form.add(tagsField); + final VerticalPanel vp = new VerticalPanel(); + vp.add(form); + return vp; } private void removeComponent(final String header) { - options.removeStackItem(header); + options.removeStackItem(header); } } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ctx/folder/FolderContextPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -26,20 +26,20 @@ import org.ourproject.kune.platf.client.dto.AccessRightsDTO; import org.ourproject.kune.platf.client.dto.ContainerDTO; import org.ourproject.kune.platf.client.dto.StateToken; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItemsImages; public class FolderContextPresenter implements FolderContext { private final ContextItems contextItems; - public FolderContextPresenter(final ContextItems contextItems) { + public FolderContextPresenter(final ContextItems contextItems, final I18nTranslationService i18n) { this.contextItems = contextItems; ContextItemsImages contextImages = ContextItemsImages.App.getInstance(); contextItems.registerType(DocumentClientTool.TYPE_DOCUMENT, contextImages.pageWhite()); contextItems.registerType(DocumentClientTool.TYPE_FOLDER, contextImages.folder()); - contextItems.canCreate(DocumentClientTool.TYPE_DOCUMENT, Kune.I18N.t("New document"), DocsEvents.ADD_DOCUMENT); - contextItems.canCreate(DocumentClientTool.TYPE_FOLDER, Kune.I18N.t("New folder"), DocsEvents.ADD_FOLDER); + contextItems.canCreate(DocumentClientTool.TYPE_DOCUMENT, i18n.t("New document"), DocsEvents.ADD_DOCUMENT); + contextItems.canCreate(DocumentClientTool.TYPE_FOLDER, i18n.t("New folder"), DocsEvents.ADD_FOLDER); contextItems.setParentTreeVisible(true); } Modified: trunk/src/main/java/org/ourproject/kune/docs/client/ui/DocumentFactory.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/docs/client/ui/DocumentFactory.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/docs/client/ui/DocumentFactory.java 2008-06-01 14:44:36 UTC (rev 772) @@ -47,12 +47,22 @@ import org.ourproject.kune.docs.client.ctx.admin.ui.AdminContextPanel; import org.ourproject.kune.docs.client.ctx.folder.FolderContext; import org.ourproject.kune.docs.client.ctx.folder.FolderContextPresenter; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.WorkspaceFactory; import org.ourproject.kune.workspace.client.component.WorkspaceDeckPanel; import org.ourproject.kune.workspace.client.ui.ctx.items.ContextItems; public class DocumentFactory { + private static I18nTranslationService i18n; + + public static AdminContext createAdminContext() { + AdminContextPresenter presenter = new AdminContextPresenter(); + AdminContextView view = new AdminContextPanel(presenter, i18n); + presenter.init(view); + return presenter; + } + public static DocumentContent createDocumentContent(final DocumentContentListener listener) { WorkspaceDeckPanel panel = new WorkspaceDeckPanel(); DocumentContentPresenter presenter = new DocumentContentPresenter(listener, panel); @@ -72,34 +82,31 @@ } public static DocumentReaderControl createDocumentReaderControl(final DocumentReaderListener listener) { - DocumentReaderControlView view = new DocumentReaderControlPanel(listener); + DocumentReaderControlView view = new DocumentReaderControlPanel(listener, i18n); DocumentReaderControlPresenter presenter = new DocumentReaderControlPresenter(view); return presenter; } public static FolderContext createFolderContext() { ContextItems contextItems = WorkspaceFactory.createContextItems(); - FolderContextPresenter presenter = new FolderContextPresenter(contextItems); + FolderContextPresenter presenter = new FolderContextPresenter(contextItems, i18n); return presenter; } - public static FolderViewer createFolderViewer() { - FolderViewerView view = new FolderViewerPanel(); - FolderViewerPresenter presenter = new FolderViewerPresenter(view); - return presenter; - } - public static FolderEditor createFolderEditor() { FolderEditorPanel view = new FolderEditorPanel(); FolderEditorPresenter presenter = new FolderEditorPresenter(view); return presenter; } - public static AdminContext createAdminContext() { - AdminContextPresenter presenter = new AdminContextPresenter(); - AdminContextView view = new AdminContextPanel(presenter); - presenter.init(view); + public static FolderViewer createFolderViewer() { + FolderViewerView view = new FolderViewerPanel(); + FolderViewerPresenter presenter = new FolderViewerPresenter(view); return presenter; } + public DocumentFactory(final I18nTranslationService i18n) { + DocumentFactory.i18n = i18n; + } + } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ApplicationBuilder.java 2008-06-01 14:44:36 UTC (rev 772) @@ -33,9 +33,9 @@ import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; import org.ourproject.kune.workspace.client.WorkspaceClientModule; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.sitebar.Site; -import com.google.gwt.user.client.History; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.WindowCloseListener; @@ -54,11 +54,10 @@ final KunePlatform platform = kune.getPlatform(); final StateManager stateManager = kune.getStateManager(); final Application application = kune.getInstance(Application.class); + I18nUITranslationService i18n = kune.getI18N(); - History.addHistoryListener(stateManager); - platform.install(new PlatformClientModule(session, stateManager)); - platform.install(new WorkspaceClientModule(session, stateManager, application.getWorkspace())); + platform.install(new WorkspaceClientModule(session, stateManager, application.getWorkspace(), i18n)); final DefaultDispatcher dispatcher = DefaultDispatcher.getInstance(); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/DefaultApplication.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/app/DefaultApplication.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/app/DefaultApplication.java 2008-06-01 14:44:36 UTC (rev 772) @@ -27,6 +27,9 @@ import org.ourproject.kune.platf.client.dispatch.Dispatcher; import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.extend.ExtensibleWidgetsManager; +import org.ourproject.kune.platf.client.services.ColorTheme; +import org.ourproject.kune.platf.client.services.I18nTranslationService; +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.ClientTool; @@ -42,19 +45,20 @@ private StateManager stateManager; public DefaultApplication(final Map<String, ClientTool> tools, final Session session, - final ExtensibleWidgetsManager extensionPointManager) { + final ExtensibleWidgetsManager extensionPointManager, final I18nTranslationService i18n, + final ColorTheme colorTheme, final KuneErrorHandler errorHandler) { this.tools = tools; - workspace = WorkspaceFactory.createWorkspace(session, extensionPointManager); + workspace = WorkspaceFactory.createWorkspace(session, extensionPointManager, i18n, colorTheme, errorHandler); workspace.attachTools(tools.values().iterator()); DesktopView desktop = WorkspaceFactory.createDesktop(workspace, new SiteBarListener() { + public void onChangeState(StateToken token) { + stateManager.setState(token); + } + public void onUserLoggedOut() { dispatcher.fire(WorkspaceEvents.USER_LOGGED_OUT, null); } - - public void onChangeState(StateToken token) { - stateManager.setState(token); - } }, session); desktop.attach(); @@ -64,23 +68,23 @@ return dispatcher; } - public Workspace getWorkspace() { - return workspace; + public StateManager getStateManager() { + return stateManager; } public ClientTool getTool(final String toolName) { return tools.get(toolName); } + public Workspace getWorkspace() { + return workspace; + } + public void init(final DefaultDispatcher dispatcher, final StateManager stateManager) { this.dispatcher = dispatcher; this.stateManager = stateManager; } - public StateManager getStateManager() { - return stateManager; - } - public void setGroupState(final String groupShortName) { Iterator<ClientTool> iterator = tools.values().iterator(); while (iterator.hasNext()) { Modified: trunk/src/main/java/org/ourproject/kune/platf/client/app/ui/DesktopPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/app/ui/DesktopPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/app/ui/DesktopPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -21,6 +21,7 @@ package org.ourproject.kune.platf.client.app.ui; import org.ourproject.kune.platf.client.app.DesktopView; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.workspace.client.sitebar.SiteBarFactory; import org.ourproject.kune.workspace.client.sitebar.bar.SiteBar; @@ -38,13 +39,14 @@ public class DesktopPanel extends AbsolutePanel implements DesktopView { - public DesktopPanel(final Workspace workspace, final SiteBarListener listener, final Session session) { + public DesktopPanel(final Workspace workspace, final SiteBarListener listener, final Session session, + final I18nTranslationService i18n) { QuickTips.init(); // extgwt tips QuickTip quickTipInstance = QuickTips.getQuickTip(); quickTipInstance.setDismissDelay(8000); quickTipInstance.setHideDelay(500); quickTipInstance.setInterceptTitles(true); - SiteBar siteBar = SiteBarFactory.createSiteBar(listener, session); + SiteBar siteBar = SiteBarFactory.createSiteBar(listener, session, i18n); SiteMessage siteMessage = SiteBarFactory.getSiteMessage(); this.add((Widget) siteMessage.getView(), calculateMessageWidth(Window.getClientWidth()), calculateMessageHeight()); @@ -59,6 +61,14 @@ RootPanel.get().add(this); } + private int calculateMessageHeight() { + return 2; + } + + private int calculateMessageWidth(final int width) { + return width * 20 / 100 - 10; + } + private void initResizeListener(final AbsolutePanel desktop, final Workspace workspace, final SiteMessage siteMessage) { Window.addWindowResizeListener(new WindowResizeListener() { @@ -85,12 +95,4 @@ calculateMessageHeight()); } - private int calculateMessageWidth(final int width) { - return width * 20 / 100 - 10; - } - - private int calculateMessageHeight() { - return 2; - } - } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/Kune.java 2008-06-01 14:44:36 UTC (rev 772) @@ -41,27 +41,17 @@ public class Kune extends DelegatedContainer { - public static final ColorTheme theme = getInstance().getColorTheme(); - - public static final I18nUITranslationService I18N = getInstance().getI18N(); - - private static Kune instance; - public static Kune create(final I18nLanguageDTO initialLang, final HashMap<String, String> lexicon) { - return instance = create(new KuneModule(initialLang, lexicon), new EmiteUIModule(), - new DocumentClientNewModule(), new ChatClientNewModule()); + return create(new KuneModule(initialLang, lexicon), new EmiteUIModule(), new DocumentClientNewModule(), + new ChatClientNewModule()); } - public static Kune create(final Module... modules) { + private static Kune create(final Module... modules) { final ModuleBuilder container = new ModuleBuilder(); container.add(modules); return container.getInstance(Kune.class); } - public static Kune getInstance() { - return instance; - } - protected Kune(final Container container) { super(container); } 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 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneErrorHandler.java 2008-06-01 14:44:36 UTC (rev 772) @@ -43,9 +43,11 @@ } private final Session session; + private final I18nTranslationService i18n; - public KuneErrorHandler(final Session session) { + public KuneErrorHandler(final Session session, final I18nTranslationService i18n) { this.session = session; + this.i18n = i18n; instance = this; } @@ -54,30 +56,30 @@ try { throw caught; } catch (final AccessViolationException e) { - Site.error(Kune.I18N.t("You don't have rights to do that")); + Site.error(i18n.t("You don't have rights to do that")); } catch (final SessionExpiredException e) { doSessionExpired(); } catch (final UserMustBeLoggedException e) { if (session.isLogged()) { doSessionExpired(); } else { - Site.important(Kune.I18N.t("Please sign in or register to collaborate")); + Site.important(i18n.t("Please sign in or register to collaborate")); } } catch (final GroupNotFoundException e) { - Site.error(Kune.I18N.t("Group not found")); + Site.error(i18n.t("Group not found")); DefaultDispatcher.getInstance().fire(PlatformEvents.GOTO, ""); } catch (final ContentNotFoundException e) { - Site.error(Kune.I18N.t("Content not found")); + Site.error(i18n.t("Content not found")); DefaultDispatcher.getInstance().fire(PlatformEvents.GOTO, ""); } catch (final LastAdminInGroupException e) { - Site.showAlertMessage(Kune.I18N.t("Sorry, you are the last admin of this group." + Site.showAlertMessage(i18n.t("Sorry, you are the last admin of this group." + " Look for someone to substitute you appropriately as admin before unjoin this group.")); } catch (final AlreadyGroupMemberException e) { - Site.error(Kune.I18N.t("This group is already a group member")); + Site.error(i18n.t("This group is already a group member")); } catch (final AlreadyUserMemberException e) { - Site.error(Kune.I18N.t("This user is already a member of this group")); + Site.error(i18n.t("This user is already a member of this group")); } catch (final Throwable e) { - Site.error(Kune.I18N.t("Error performing operation")); + Site.error(i18n.t("Error performing operation")); GWT.log("Other kind of exception in StateManagerDefault/processErrorException", null); throw new RuntimeException(); } @@ -85,7 +87,7 @@ private void doSessionExpired() { Site.doLogout(); - Site.showAlertMessage(Kune.I18N.t("Your session has expired. Please login again.")); + Site.showAlertMessage(i18n.t("Your session has expired. Please login again.")); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-06-01 14:44:36 UTC (rev 772) @@ -17,6 +17,7 @@ import org.ourproject.kune.platf.client.state.StateManagerDefault; import org.ourproject.kune.platf.client.tool.ClientTool; import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; +import org.ourproject.kune.workspace.client.sitebar.Site; import com.calclab.emite.client.modular.Container; import com.calclab.emite.client.modular.Module; @@ -24,6 +25,7 @@ import com.calclab.emite.client.modular.Provider; import com.calclab.emite.client.modular.Scopes; import com.google.gwt.user.client.Cookies; +import com.google.gwt.user.client.History; public class KuneModule implements Module { @@ -59,6 +61,8 @@ } }, Scopes.SINGLETON); + Site.init(builder.getInstance(I18nUITranslationService.class)); + builder.registerProvider(Session.class, new Provider<Session>() { public Session get() { return new SessionImpl(Cookies.getCookie("userHash"), initialLang); @@ -67,44 +71,50 @@ builder.registerProvider(KuneErrorHandler.class, new Provider<KuneErrorHandler>() { public KuneErrorHandler get() { - return new KuneErrorHandler(builder.getInstance(Session.class)); + return new KuneErrorHandler(builder.getInstance(Session.class), builder + .getInstance(I18nUITranslationService.class)); } }); + builder.registerProvider(ColorTheme.class, new Provider<ColorTheme>() { + public ColorTheme get() { + return new ColorTheme(); + } + }, Scopes.SINGLETON); + builder.registerProvider(KunePlatform.class, new Provider<KunePlatform>() { public KunePlatform get() { return new KunePlatform(); } }, Scopes.SINGLETON); - builder.registerProvider(ColorTheme.class, new Provider<ColorTheme>() { - public ColorTheme get() { - return new ColorTheme(); - } - }, Scopes.SINGLETON); - builder.registerProvider(ExtensibleWidgetsManager.class, new Provider<ExtensibleWidgetsManager>() { public ExtensibleWidgetsManager get() { return new ExtensibleWidgetsManager(); } }); - final Session session = builder.getInstance(Session.class); - builder.registerProvider(Application.class, new Provider<Application>() { public Application get() { + Session session = builder.getInstance(Session.class); HashMap<String, ClientTool> tools = builder.getInstance(KunePlatform.class).getIndexedTools(); ExtensibleWidgetsManager extensionPointManager = builder.getInstance(ExtensibleWidgetsManager.class); - return new DefaultApplication(tools, session, extensionPointManager); + return new DefaultApplication(tools, session, extensionPointManager, builder + .getInstance(I18nUITranslationService.class), builder.getInstance(ColorTheme.class), builder + .getInstance(KuneErrorHandler.class)); } }); builder.registerProvider(StateManager.class, new Provider<StateManager>() { public StateManager get() { + Session session = builder.getInstance(Session.class); ContentProviderImpl provider = new ContentProviderImpl(ContentService.App.getInstance()); final HistoryWrapper historyWrapper = new HistoryWrapperImpl(); Application application = builder.getInstance(Application.class); - return new StateManagerDefault(provider, application, session, historyWrapper); + StateManagerDefault stateManager = new StateManagerDefault(provider, application, session, + historyWrapper); + History.addHistoryListener(stateManager); + return stateManager; } }); Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/AbstractSearcherPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,7 +19,7 @@ */ package org.ourproject.kune.platf.client.ui; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import com.gwtext.client.core.Connection; import com.gwtext.client.core.UrlParam; @@ -35,32 +35,33 @@ public class AbstractSearcherPanel { protected static final int PAGINATION_SIZE = 10; + protected final I18nTranslationService i18n; - public AbstractSearcherPanel() { + public AbstractSearcherPanel(final I18nTranslationService i18n) { + this.i18n = i18n; } protected void createPagingToolbar(final Store store, final GridPanel grid) { - final PagingToolbar pag = new PagingToolbar(store); - pag.setPageSize(PAGINATION_SIZE); - pag.setDisplayInfo(true); - pag.setDisplayMsg(Kune.I18N.tWithNT("Displaying results {0} - {1} of {2}", - "Respect {} values in translations, " - + "this will produce: 'Displaying results 1 - 25 of 95465' for instance")); - pag.setEmptyMsg(Kune.I18N.t("No results to display")); - pag.setAfterPageText(Kune.I18N.tWithNT("of {0}", "Used to show multiple results: '1 of 30'")); - pag.setBeforePageText(Kune.I18N.t("Page")); - pag.setFirstText(Kune.I18N.t("First Page")); - pag.setLastText(Kune.I18N.t("Last Page")); - pag.setNextText(Kune.I18N.t("Next Page")); - pag.setPrevText(Kune.I18N.t("Previous Page")); - pag.setRefreshText(Kune.I18N.t("Refresh")); - grid.setBottomToolbar(pag); - grid.setLoadMask(true); - grid.setLoadMask(Kune.I18N.t("Searching")); - grid.setSelectionModel(new RowSelectionModel()); - grid.setBorder(false); - grid.setFrame(true); - grid.setStripeRows(true); + final PagingToolbar pag = new PagingToolbar(store); + pag.setPageSize(PAGINATION_SIZE); + pag.setDisplayInfo(true); + pag.setDisplayMsg(i18n.tWithNT("Displaying results {0} - {1} of {2}", "Respect {} values in translations, " + + "this will produce: 'Displaying results 1 - 25 of 95465' for instance")); + pag.setEmptyMsg(i18n.t("No results to display")); + pag.setAfterPageText(i18n.tWithNT("of {0}", "Used to show multiple results: '1 of 30'")); + pag.setBeforePageText(i18n.t("Page")); + pag.setFirstText(i18n.t("First Page")); + pag.setLastText(i18n.t("Last Page")); + pag.setNextText(i18n.t("Next Page")); + pag.setPrevText(i18n.t("Previous Page")); + pag.setRefreshText(i18n.t("Refresh")); + grid.setBottomToolbar(pag); + grid.setLoadMask(true); + grid.setLoadMask(i18n.t("Searching")); + grid.setSelectionModel(new RowSelectionModel()); + grid.setBorder(false); + grid.setFrame(true); + grid.setStripeRows(true); } // protected void createPagingToolbar(final Store store, final GridPanel @@ -68,20 +69,20 @@ // final PagingToolbar pag = new PagingToolbar(store); // pag.setPageSize(PAGINATION_SIZE); // pag.setDisplayInfo(true); - // pag.setDisplayMsg(Kune.I18N.tWithNT("Displaying results {0} - {1} of + // pag.setDisplayMsg(i18n.tWithNT("Displaying results {0} - {1} of // {2}", // "Respect {} values in translations, " // + "these will produce: 'Displaying results 1 - 25 of 95465' for // instance")); - // pag.setEmptyMsg(Kune.I18N.t("No results to display")); - // pag.setAfterPageText(Kune.I18N.tWithNT("of {0}", "Used to show multiple + // pag.setEmptyMsg(i18n.t("No results to display")); + // pag.setAfterPageText(i18n.tWithNT("of {0}", "Used to show multiple // results: '1 of 30'")); - // pag.setBeforePageText(Kune.I18N.t("Page")); - // pag.setFirstText(Kune.I18N.t("First Page")); - // pag.setLastText(Kune.I18N.t("Last Page")); - // pag.setNextText(Kune.I18N.t("Next Page")); - // pag.setPrevText(Kune.I18N.t("Previous Page")); - // pag.setRefreshText(Kune.I18N.t("Refresh")); + // pag.setBeforePageText(i18n.t("Page")); + // pag.setFirstText(i18n.t("First Page")); + // pag.setLastText(i18n.t("Last Page")); + // pag.setNextText(i18n.t("Next Page")); + // pag.setPrevText(i18n.t("Previous Page")); + // pag.setRefreshText(i18n.t("Refresh")); // grid.setBottomToolbar(pag); // // grid.addListener(new PanelListenerAdapter() { @@ -92,21 +93,21 @@ // } protected Store createStore(final FieldDef[] fieldDefs, final String url, final String id) { - final JsonReader reader = new JsonReader(new RecordDef(fieldDefs)); - reader.setRoot("list"); - reader.setTotalProperty("size"); - reader.setId(id); - final HttpProxy proxy = new HttpProxy(url, Connection.POST); - return new Store(proxy, reader, true); + final JsonReader reader = new JsonReader(new RecordDef(fieldDefs)); + reader.setRoot("list"); + reader.setTotalProperty("size"); + reader.setId(id); + final HttpProxy proxy = new HttpProxy(url, Connection.POST); + return new Store(proxy, reader, true); } protected void query(final Store store, final GridPanel grid, final String query) { - final UrlParam[] newParams = new UrlParam[] { new UrlParam("query", query), new UrlParam("start", 0), - new UrlParam("limit", PAGINATION_SIZE) }; - store.setBaseParams(newParams); - store.load(0, PAGINATION_SIZE); - // see bind/unbind in: - // http://groups.google.com/group/gwt-ext/browse_thread/thread/ae0badb8114b30cd... + final UrlParam[] newParams = new UrlParam[] { new UrlParam("query", query), new UrlParam("start", 0), + new UrlParam("limit", PAGINATION_SIZE) }; + store.setBaseParams(newParams); + store.load(0, PAGINATION_SIZE); + // see bind/unbind in: + // http://groups.google.com/group/gwt-ext/browse_thread/thread/ae0badb8114b30cd... } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/InfoDialog.java 2008-06-01 14:44:36 UTC (rev 772) @@ -1,7 +1,5 @@ package org.ourproject.kune.platf.client.ui.dialogs; -import org.ourproject.kune.platf.client.services.Kune; - import com.google.gwt.user.client.ui.Label; import com.gwtext.client.core.EventObject; import com.gwtext.client.widgets.Button; @@ -9,28 +7,28 @@ import com.gwtext.client.widgets.event.ButtonListenerAdapter; public class InfoDialog extends BasicDialog { - public InfoDialog(final String title, final String header, final String text, final boolean modal, - final boolean autoScroll, final int width, final int height) { - super(title, modal, autoScroll, width, height); - final Button okButton = new Button(Kune.I18N.t("Ok")); - okButton.addListener(new ButtonListenerAdapter() { - public void onClick(final Button button, final EventObject e) { - hide(); - } - }); - final Panel panel = new Panel(); - panel.setBorder(false); - panel.setHeader(false); - panel.setPaddings(20); + public InfoDialog(final String title, final String header, final String text, final String okButtonText, + final boolean modal, final boolean autoScroll, final int width, final int height) { + super(title, modal, autoScroll, width, height); + final Button okButton = new Button(okButtonText); + okButton.addListener(new ButtonListenerAdapter() { + public void onClick(final Button button, final EventObject e) { + hide(); + } + }); + final Panel panel = new Panel(); + panel.setBorder(false); + panel.setHeader(false); + panel.setPaddings(20); - final Label headerLabel = new Label(header); - final Label textLabel = new Label(text); + final Label headerLabel = new Label(header); + final Label textLabel = new Label(text); - panel.add(headerLabel); - panel.add(new Label()); - panel.add(textLabel); + panel.add(headerLabel); + panel.add(new Label()); + panel.add(textLabel); - add(okButton); - show(); + add(okButton); + show(); } } 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 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/WizardDialog.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.platf.client.ui.dialogs; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.CustomButton; import com.google.gwt.user.client.ui.ClickListener; @@ -36,38 +36,41 @@ private final Button nextButton; private final Button cancelButton; private final Button finishButton; + private final I18nTranslationService i18n; public WizardDialog(final String caption, final boolean modal, final boolean minimizable, final int width, - final int height, final int minWidth, final int minHeight, final WizardListener listener) { + final int height, final int minWidth, final int minHeight, final WizardListener listener, + final I18nTranslationService i18n) { dialog = new BasicDialog(caption, modal, false, width, height, minWidth, minHeight); + this.i18n = i18n; dialog.setCollapsible(minimizable); dialog.setShadow(true); dialog.setPlain(true); dialog.setCollapsible(false); dialog.setResizable(false); - backButton = new CustomButton(Kune.I18N.tWithNT("« Back", "used in button"), new ClickListener() { + backButton = new CustomButton(i18n.tWithNT("« Back", "used in button"), new ClickListener() { public void onClick(final Widget sender) { listener.onBack(); } }).getButton(); dialog.addButton(backButton); - nextButton = new CustomButton(Kune.I18N.tWithNT("Next »", "used in button"), new ClickListener() { + nextButton = new CustomButton(i18n.tWithNT("Next »", "used in button"), new ClickListener() { public void onClick(final Widget sender) { listener.onNext(); } }).getButton(); dialog.addButton(nextButton); - cancelButton = new CustomButton(Kune.I18N.tWithNT("Cancel", "used in button"), new ClickListener() { + cancelButton = new CustomButton(i18n.tWithNT("Cancel", "used in button"), new ClickListener() { public void onClick(final Widget sender) { listener.onCancel(); } }).getButton(); dialog.addButton(cancelButton); - finishButton = new CustomButton(Kune.I18N.tWithNT("Finish", "used in button"), new ClickListener() { + finishButton = new CustomButton(i18n.tWithNT("Finish", "used in button"), new ClickListener() { public void onClick(final Widget sender) { listener.onFinish(); } @@ -82,18 +85,14 @@ } public WizardDialog(final String caption, final boolean modal, final boolean minimizable, final int width, - final int height, final WizardListener listener) { - this(caption, modal, minimizable, width, height, width, height, listener); + final int height, final WizardListener listener, final I18nTranslationService i18n) { + this(caption, modal, minimizable, width, height, width, height, listener, i18n); } public void add(final Widget widget) { dialog.add(widget); } - public void show() { - dialog.show(); - } - public void center() { dialog.center(); } @@ -102,35 +101,27 @@ dialog.hide(); } - public void setVisibleNextButton(final boolean visible) { - nextButton.setVisible(visible); + public void mask(final String message) { + dialog.getEl().mask(message, "x-mask-loading"); } - public void setVisibleBackButton(final boolean visible) { - backButton.setVisible(visible); + public void maskProcessing() { + mask(i18n.t("Processing")); } - public void setVisibleFinishButton(final boolean visible) { - finishButton.setVisible(visible); - } - - public void setVisibleCancelButton(final boolean visible) { - cancelButton.setVisible(visible); - } - - public void setEnabledNextButton(final boolean enabled) { + public void setEnabledBackButton(final boolean enabled) { if (enabled) { - nextButton.enable(); + backButton.enable(); } else { - nextButton.disable(); + backButton.disable(); } } - public void setEnabledBackButton(final boolean enabled) { + public void setEnabledCancelButton(final boolean enabled) { if (enabled) { - backButton.enable(); + cancelButton.enable(); } else { - backButton.disable(); + cancelButton.disable(); } } @@ -142,11 +133,11 @@ } } - public void setEnabledCancelButton(final boolean enabled) { + public void setEnabledNextButton(final boolean enabled) { if (enabled) { - cancelButton.enable(); + nextButton.enable(); } else { - cancelButton.disable(); + nextButton.disable(); } } @@ -154,14 +145,26 @@ finishButton.setText(text); } - public void mask(final String message) { - dialog.getEl().mask(message, "x-mask-loading"); + public void setVisibleBackButton(final boolean visible) { + backButton.setVisible(visible); } - public void maskProcessing() { - mask(Kune.I18N.t("Processing")); + public void setVisibleCancelButton(final boolean visible) { + cancelButton.setVisible(visible); } + public void setVisibleFinishButton(final boolean visible) { + finishButton.setVisible(visible); + } + + public void setVisibleNextButton(final boolean visible) { + nextButton.setVisible(visible); + } + + public void show() { + dialog.show(); + } + public void unMask() { dialog.getEl().unmask(); } Modified: 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 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,8 +19,8 @@ */ 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.platf.client.services.Kune; import com.google.gwt.user.client.ui.ClickListener; import com.google.gwt.user.client.ui.Composite; @@ -37,16 +37,46 @@ private final Images img = Images.App.getInstance(); private final RateItPresenter presenter; private Label rateItLabel; + private final I18nTranslationService i18n; - public RateItPanel(final RateItPresenter presenter) { + public RateItPanel(final RateItPresenter presenter, final I18nTranslationService i18n) { this.presenter = presenter; + this.i18n = i18n; initialize(); layout(); setProperties(); } + 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(Kune.I18N.t("Rate it:")); + rateItLabel = new Label(i18n.t("Rate it:")); rateGrid = new Grid(1, 7); starImg = new Image[5]; rateDesc = new Label(); @@ -55,13 +85,9 @@ img.starGrey().applyTo(starImg[i]); starImg[i].addStyleName("rateit-star"); starImg[i].setStyleName("rateit-star"); - starImg[i].setTitle(Kune.I18N.t("Click to rate this")); + starImg[i].setTitle(i18n.t("Click to rate this")); starImg[i].addClickListener(this); starImg[i].addMouseListener(new MouseListenerAdapter() { - public void onMouseLeave(final Widget sender) { - presenter.revertCurrentRate(); - } - public void onMouseEnter(final Widget sender) { for (int j = 0; j < 5; j++) { if (sender == starImg[j]) { @@ -70,6 +96,10 @@ } } + + public void onMouseLeave(final Widget sender) { + presenter.revertCurrentRate(); + } }); } } @@ -95,32 +125,4 @@ rateDesc.addStyleName("kune-RatePanel-Label"); rateDesc.addStyleName("kune-Margin-Medium-l"); } - - public void onClick(final Widget sender) { - for (int i = 0; i < 5; i++) { - if (sender == starImg[i]) { - presenter.starClicked(i); - } - } - } - - public void setRate(final Star stars[]) { - for (int i = 0; i < 5; i++) { - stars[i].getImage().applyTo(starImg[i]); - } - } - - public void clearRate() { - for (int i = 0; i < 5; i++) { - img.starGrey().applyTo(starImg[i]); - } - } - - public void setStars(final Double rate) { - setRate(Star.genStars(rate.doubleValue())); - } - - public void setDesc(final String desc) { - rateDesc.setText(desc); - } } Modified: 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 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RateItPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.platf.client.ui.rate; import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.WorkspaceEvents; public class RateItPresenter { @@ -33,6 +33,12 @@ private boolean isRating; + private final I18nTranslationService i18n; + + public RateItPresenter(final I18nTranslationService i18n) { + this.i18n = i18n; + } + public void init(final RateItView view) { this.view = view; currentRate = NOT_RATED; @@ -77,29 +83,29 @@ } } - 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 setDesc(final int rateTruncated) { if (rateTruncated >= 0 && rateTruncated <= 1) { - view.setDesc(Kune.I18N.t("Poor")); + view.setDesc(i18n.t("Poor")); } else if (rateTruncated == 2) { - view.setDesc(Kune.I18N.t("Below average")); + view.setDesc(i18n.t("Below average")); } else if (rateTruncated == 3) { - view.setDesc(Kune.I18N.t("Average")); + view.setDesc(i18n.t("Average")); } else if (rateTruncated == 4) { - view.setDesc(Kune.I18N.t("Above average")); + view.setDesc(i18n.t("Above average")); } else if (rateTruncated == 5) { - view.setDesc(Kune.I18N.t("Excellent")); + 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())); + } + } } Modified: 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 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/rate/RatePanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,7 +19,7 @@ */ package org.ourproject.kune.platf.client.ui.rate; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Grid; @@ -30,8 +30,10 @@ private Grid rateGrid; private Image[] starImg; private Label rateDesc; + private final I18nTranslationService i18n; - public RatePanel(final Double rate, final Integer byUsers) { + public RatePanel(final Double rate, final Integer byUsers, final I18nTranslationService i18n) { + this.i18n = i18n; initialize(); layout(); setProperties(); @@ -45,12 +47,12 @@ public void setByUsers(final Integer byUsers) { if (byUsers.intValue() == 0) { - rateDesc.setText(Kune.I18N.t("(Not rated)")); + rateDesc.setText(i18n.t("(Not rated)")); } else if (byUsers.intValue() == 1) { // i18n params pluralization - rateDesc.setText(Kune.I18N.t("([%d] user)", byUsers)); + rateDesc.setText(i18n.t("([%d] user)", byUsers)); } else { - rateDesc.setText(Kune.I18N.t("([%d] users)", byUsers)); + rateDesc.setText(i18n.t("([%d] users)", byUsers)); } } Modified: trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackSubItemAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackSubItemAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/stacks/StackSubItemAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,17 +19,9 @@ */ package org.ourproject.kune.platf.client.ui.stacks; -import org.ourproject.kune.platf.client.PlatformEvents; -import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; - import com.google.gwt.user.client.ui.AbstractImagePrototype; public class StackSubItemAction { - private final static Images img = Images.App.getInstance(); - public final static StackSubItemAction DEFAULT_VISIT_GROUP = new StackSubItemAction(img.groupHome(), Kune.I18N - .t("Visit this member homepage"), PlatformEvents.GOTO); - private final AbstractImagePrototype icon; private final String text; private final String action; @@ -40,6 +32,10 @@ this.action = action; } + public String getAction() { + return action; + } + public AbstractImagePrototype getIcon() { return icon; } @@ -47,8 +43,4 @@ public String getText() { return text; } - - public String getAction() { - return action; - } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceClientModule.java 2008-06-01 14:44:36 UTC (rev 772) @@ -62,6 +62,7 @@ import org.ourproject.kune.workspace.client.actions.sn.SetAdminAsCollabAction; import org.ourproject.kune.workspace.client.actions.sn.SetCollabAsAdminAction; import org.ourproject.kune.workspace.client.actions.sn.UnJoinGroupAction; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.workspace.Workspace; public class WorkspaceClientModule implements ClientModule { @@ -70,10 +71,13 @@ private final Workspace workspace; private final Dispatcher dispacher; private final Session session; + private final I18nUITranslationService i18n; - public WorkspaceClientModule(final Session session, final StateManager stateManager, final Workspace workspace) { + public WorkspaceClientModule(final Session session, final StateManager stateManager, final Workspace workspace, + final I18nUITranslationService i18n) { this.session = session; this.stateManager = stateManager; + this.i18n = i18n; dispacher = DefaultDispatcher.getInstance(); this.workspace = workspace; } @@ -82,37 +86,39 @@ register.addAction(WorkspaceEvents.START_APP, new InitAction(session, dispacher, workspace)); register.addAction(WorkspaceEvents.STOP_APP, new StopAction(workspace)); register.addAction(WorkspaceEvents.INIT_DATA_RECEIVED, new InitDataReceivedAction(session, workspace)); - register.addAction(WorkspaceEvents.USER_LOGGED_IN, new LoggedInAction(session, stateManager)); + register.addAction(WorkspaceEvents.USER_LOGGED_IN, new LoggedInAction(session, stateManager, i18n)); register.addAction(WorkspaceEvents.USER_LOGGED_OUT, new LoggedOutAction(session, stateManager)); register.addAction(WorkspaceEvents.ONLY_CHECK_USER_SESSION, new OnlyCheckUserSessionAction(session)); register.addAction(PlatformEvents.ATTACH_TO_EXTENSIBLE_WIDGET, new AttachToExtensibleWidgetAction(workspace)); register.addAction(PlatformEvents.DETACH_FROM_EXTENSIBLE_WIDGET, new DetachFromExtensibleWidgetAction(workspace)); register.addAction(PlatformEvents.CLEAR_EXTENSIBLE_WIDGET, new ClearExtensibleWidgetAction(workspace)); - register.addAction(WorkspaceEvents.REQ_JOIN_GROUP, new RequestJoinGroupAction(session, stateManager)); + register.addAction(WorkspaceEvents.REQ_JOIN_GROUP, new RequestJoinGroupAction(session, stateManager, i18n)); register.addAction(WorkspaceEvents.ACCEPT_JOIN_GROUP, new AcceptJoinGroupAction(session, stateManager, - workspace)); - register.addAction(WorkspaceEvents.DENY_JOIN_GROUP, new DenyJoinGroupAction(session, stateManager)); - register.addAction(WorkspaceEvents.DEL_MEMBER, new DeleteMemberAction(session, stateManager)); + workspace, i18n)); + register.addAction(WorkspaceEvents.DENY_JOIN_GROUP, new DenyJoinGroupAction(session, stateManager, i18n)); + register.addAction(WorkspaceEvents.DEL_MEMBER, new DeleteMemberAction(session, stateManager, i18n)); register.addAction(WorkspaceEvents.SET_COLLAB_AS_ADMIN, new SetCollabAsAdminAction(session, stateManager, - workspace)); + workspace, i18n)); register.addAction(WorkspaceEvents.SET_ADMIN_AS_COLLAB, new SetAdminAsCollabAction(session, stateManager, - workspace)); - register.addAction(WorkspaceEvents.ADD_ADMIN_MEMBER, new AddAdminAction(session, stateManager, workspace)); - register.addAction(WorkspaceEvents.ADD_COLLAB_MEMBER, new AddCollabAction(session, stateManager, workspace)); - register.addAction(WorkspaceEvents.ADD_VIEWER_MEMBER, new AddViewerAction(session, stateManager)); - register.addAction(WorkspaceEvents.UNJOIN_GROUP, new UnJoinGroupAction(session, stateManager)); + workspace, i18n)); + register + .addAction(WorkspaceEvents.ADD_ADMIN_MEMBER, new AddAdminAction(session, stateManager, workspace, i18n)); + register.addAction(WorkspaceEvents.ADD_COLLAB_MEMBER, new AddCollabAction(session, stateManager, workspace, + i18n)); + register.addAction(WorkspaceEvents.ADD_VIEWER_MEMBER, new AddViewerAction(session, stateManager, i18n)); + register.addAction(WorkspaceEvents.UNJOIN_GROUP, new UnJoinGroupAction(session, stateManager, i18n)); register.addAction(WorkspaceEvents.CHANGE_GROUP_WSTHEME, new ChangeGroupWsThemeAction(session, workspace)); - register.addAction(WorkspaceEvents.RATE_CONTENT, new RateContentAction(session, stateManager)); + register.addAction(WorkspaceEvents.RATE_CONTENT, new RateContentAction(session, stateManager, i18n)); register.addAction(WorkspaceEvents.ENABLE_RATEIT, new EnableRateItAction(workspace)); register.addAction(WorkspaceEvents.DISABLE_RATEIT, new DisableRateItAction(workspace)); register.addAction(WorkspaceEvents.GET_TRANSLATION, new GetTranslationAction(session)); register.addAction(WorkspaceEvents.ADD_MEMBER_GROUPLIVESEARCH, new AddGroupLiveSearchAction(workspace)); register.addAction(WorkspaceEvents.ADD_USERLIVESEARCH, new AddUserLiveSearchAction(workspace)); - register.addAction(WorkspaceEvents.SHOW_TRANSLATOR, new ShowTranslatorAction(session, workspace)); + register.addAction(WorkspaceEvents.SHOW_TRANSLATOR, new ShowTranslatorAction(session, workspace, i18n)); register.addAction(WorkspaceEvents.SHOW_SEARCHER, new ShowSearcherAction()); - register.addAction(WorkspaceEvents.DO_TRANSLATION, new DoTranslationAction(session)); - register.addAction(WorkspaceEvents.GET_LEXICON, new GetLexiconAction()); + register.addAction(WorkspaceEvents.DO_TRANSLATION, new DoTranslationAction(session, i18n)); + register.addAction(WorkspaceEvents.GET_LEXICON, new GetLexiconAction(i18n)); register.addAction(WorkspaceEvents.USER_LOGIN, new UserLoginAction()); register.addAction(WorkspaceEvents.USER_LOGOUT, new UserLogoutAction(session)); register.addAction(WorkspaceEvents.USER_REGISTER, new UserRegisterAction()); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/WorkspaceFactory.java 2008-06-01 14:44:36 UTC (rev 772) @@ -22,6 +22,9 @@ import org.ourproject.kune.platf.client.app.DesktopView; import org.ourproject.kune.platf.client.app.ui.DesktopPanel; import org.ourproject.kune.platf.client.extend.ExtensibleWidgetsManager; +import org.ourproject.kune.platf.client.services.ColorTheme; +import org.ourproject.kune.platf.client.services.I18nTranslationService; +import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.workspace.client.editor.TextEditor; import org.ourproject.kune.workspace.client.editor.TextEditorListener; @@ -94,130 +97,138 @@ public class WorkspaceFactory { private static Session session; + private static I18nTranslationService i18n; + private static ColorTheme colorTheme; + private static KuneErrorHandler errorHandler; - public static Workspace createWorkspace(final Session session, final ExtensibleWidgetsManager extensionPointManager) { - WorkspaceFactory.session = session; - WorkspacePresenter workspace = new WorkspacePresenter(session); - WorkspaceView view = new WorkspacePanel(workspace); - workspace.init(view, extensionPointManager); - return workspace; - } - - public static TextEditor createDocumentEditor(final TextEditorListener listener) { - TextEditorPresenter presenter = new TextEditorPresenter(listener, true); - TextEditorPanel panel = new TextEditorPanel(presenter); - presenter.init(panel); + public static ContentBottomToolBarComponent createContentBottomToolBarComponent() { + ContentBottomToolBarPresenter presenter = new ContentBottomToolBarPresenter(); + ContentBottomToolBarView view = new ContentBottomToolBarPanel(presenter, i18n); + presenter.init(view); return presenter; } - public static DesktopView createDesktop(final Workspace workspace, final SiteBarListener listener, - final Session session) { - return new DesktopPanel(workspace, listener, session); - } - - public static LicenseComponent createLicenseComponent() { - LicensePresenter presenter = new LicensePresenter(); - LicenseView view = new LicensePanel(presenter); + public static ContentSubTitleComponent createContentSubTitleComponent() { + ContentSubTitlePresenter presenter = new ContentSubTitlePresenter(i18n); + ContentSubTitleView view = new ContentSubTitlePanel(presenter, i18n); presenter.init(view); return presenter; } public static ContentTitleComponent createContentTitleComponent() { - ContentTitlePresenter presenter = new ContentTitlePresenter(); + ContentTitlePresenter presenter = new ContentTitlePresenter(i18n, errorHandler); ContentTitleView view = new ContentTitlePanel(presenter); presenter.init(view); return presenter; } - public static ContentSubTitleComponent createContentSubTitleComponent() { - ContentSubTitlePresenter presenter = new ContentSubTitlePresenter(); - ContentSubTitleView view = new ContentSubTitlePanel(presenter); + public static ContentToolBarComponent createContentToolBarComponent() { + ContentToolBarPresenter presenter = new ContentToolBarPresenter(); + ContentToolBarView view = new ContentToolBarPanel(presenter); presenter.init(view); return presenter; } public static ContextItems createContextItems() { - ContextItemsPresenter presenter = new ContextItemsPresenter(); - ContextItemsPanel panel = new ContextItemsPanel(presenter); + ContextItemsPresenter presenter = new ContextItemsPresenter(i18n); + ContextItemsPanel panel = new ContextItemsPanel(presenter, i18n); presenter.init(panel); return presenter; } - public static GroupMembersComponent createGroupMembersComponent() { - GroupMembersPresenter presenter = new GroupMembersPresenter(); - GroupMembersView view = new GroupMembersPanel(presenter); + public static DesktopView createDesktop(final Workspace workspace, final SiteBarListener listener, + final Session session) { + return new DesktopPanel(workspace, listener, session, i18n); + } + + public static TextEditor createDocumentEditor(final TextEditorListener listener) { + TextEditorPresenter presenter = new TextEditorPresenter(listener, true); + TextEditorPanel panel = new TextEditorPanel(presenter, i18n); + presenter.init(panel); + return presenter; + } + + public static GroupLiveSearchComponent createGroupLiveSearchComponent() { + GroupLiveSearchPresenter presenter = new GroupLiveSearchPresenter(); + EntityLiveSearchView view = new GroupLiveSearchPanel(presenter, i18n); presenter.init(view); return presenter; } - public static ParticipationComponent createParticipationComponent() { - ParticipationPresenter presenter = new ParticipationPresenter(); - ParticipationView view = new ParticipationPanel(presenter); + public static GroupMembersComponent createGroupMembersComponent() { + GroupMembersPresenter presenter = new GroupMembersPresenter(i18n); + GroupMembersView view = new GroupMembersPanel(presenter, i18n); presenter.init(view); return presenter; } public static GroupSummaryComponent createGroupSummaryComponent() { GroupSummaryPresenter presenter = new GroupSummaryPresenter(); - GroupSummaryView view = new GroupSummaryPanel(presenter); + GroupSummaryView view = new GroupSummaryPanel(presenter, i18n, colorTheme); presenter.init(view); return presenter; } - public static ThemeMenuComponent createThemeMenuComponent() { - ThemeMenuPresenter presenter = new ThemeMenuPresenter(); - ThemeMenuView view = new ThemeMenuPanel(presenter); + public static I18nTranslatorComponent createI18nTranslatorComponent() { + I18nTranslatorPresenter presenter = new I18nTranslatorPresenter(session); + I18nTranslatorView view = new I18nTranslatorPanel(presenter, i18n); presenter.init(view); return presenter; } - public static TagsComponent createTagsComponent() { - TagsPresenter presenter = new TagsPresenter(session); - TagsView view = new TagsPanel(presenter); + public static LanguageSelectorComponent createLanguageSelectorComponent() { + LanguageSelectorPresenter presenter = new LanguageSelectorPresenter(session); + LanguageSelectorView view = new LanguageSelectorPanel(presenter, i18n); presenter.init(view); return presenter; } - public static ContentBottomToolBarComponent createContentBottomToolBarComponent() { - ContentBottomToolBarPresenter presenter = new ContentBottomToolBarPresenter(); - ContentBottomToolBarView view = new ContentBottomToolBarPanel(presenter); + public static LicenseComponent createLicenseComponent() { + LicensePresenter presenter = new LicensePresenter(); + LicenseView view = new LicensePanel(presenter, i18n); presenter.init(view); return presenter; } - public static ContentToolBarComponent createContentToolBarComponent() { - ContentToolBarPresenter presenter = new ContentToolBarPresenter(); - ContentToolBarView view = new ContentToolBarPanel(presenter); + public static ParticipationComponent createParticipationComponent() { + ParticipationPresenter presenter = new ParticipationPresenter(i18n); + ParticipationView view = new ParticipationPanel(presenter, i18n); presenter.init(view); return presenter; } - public static GroupLiveSearchComponent createGroupLiveSearchComponent() { - GroupLiveSearchPresenter presenter = new GroupLiveSearchPresenter(); - EntityLiveSearchView view = new GroupLiveSearchPanel(presenter); + public static TagsComponent createTagsComponent() { + TagsPresenter presenter = new TagsPresenter(session); + TagsView view = new TagsPanel(presenter, i18n); presenter.init(view); return presenter; } - public static UserLiveSearchComponent createUserLiveSearchComponent() { - UserLiveSearchPresenter presenter = new UserLiveSearchPresenter(); - EntityLiveSearchView view = new UserLiveSearchPanel(presenter); + public static ThemeMenuComponent createThemeMenuComponent() { + ThemeMenuPresenter presenter = new ThemeMenuPresenter(); + ThemeMenuView view = new ThemeMenuPanel(presenter, i18n, colorTheme); presenter.init(view); return presenter; } - public static I18nTranslatorComponent createI18nTranslatorComponent() { - I18nTranslatorPresenter presenter = new I18nTranslatorPresenter(session); - I18nTranslatorView view = new I18nTranslatorPanel(presenter); + public static UserLiveSearchComponent createUserLiveSearchComponent() { + UserLiveSearchPresenter presenter = new UserLiveSearchPresenter(); + EntityLiveSearchView view = new UserLiveSearchPanel(presenter, i18n); presenter.init(view); return presenter; } - public static LanguageSelectorComponent createLanguageSelectorComponent() { - LanguageSelectorPresenter presenter = new LanguageSelectorPresenter(session); - LanguageSelectorView view = new LanguageSelectorPanel(presenter); - presenter.init(view); - return presenter; + public static Workspace createWorkspace(final Session session, + final ExtensibleWidgetsManager extensionPointManager, final I18nTranslationService i18n, + final ColorTheme colorTheme, final KuneErrorHandler errorHandler) { + WorkspaceFactory.session = session; + WorkspaceFactory.i18n = i18n; + WorkspaceFactory.colorTheme = colorTheme; + WorkspaceFactory.errorHandler = errorHandler; + WorkspacePresenter workspace = new WorkspacePresenter(session); + WorkspaceView view = new WorkspacePanel(workspace, i18n, colorTheme); + workspace.init(view, extensionPointManager); + return workspace; } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/LoggedInAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/LoggedInAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/LoggedInAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,9 +24,9 @@ import org.ourproject.kune.platf.client.dispatch.Action; import org.ourproject.kune.platf.client.dto.I18nLanguageDTO; import org.ourproject.kune.platf.client.dto.UserInfoDTO; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.platf.client.state.StateManager; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.sitebar.Site; import com.google.gwt.user.client.Cookies; @@ -34,10 +34,12 @@ public class LoggedInAction implements Action<UserInfoDTO> { private final Session session; private final StateManager stateManager; + private final I18nUITranslationService i18n; - public LoggedInAction(final Session session, final StateManager stateManager) { + public LoggedInAction(final Session session, final StateManager stateManager, final I18nUITranslationService i18n) { this.session = session; this.stateManager = stateManager; + this.i18n = i18n; } public void execute(final UserInfoDTO value) { @@ -50,7 +52,7 @@ Site.sitebar.showLoggedUser(userInfoDTO); I18nLanguageDTO language = userInfoDTO.getLanguage(); stateManager.reload(); - Kune.I18N.changeCurrentLanguage(language.getCode()); + i18n.changeCurrentLanguage(language.getCode()); session.setCurrentLanguage(language); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/RateContentAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/RateContentAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/RateContentAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.ContentService; import org.ourproject.kune.platf.client.rpc.ContentServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -33,10 +33,12 @@ private final StateManager stateManager; private final Session session; + private final I18nTranslationService i18n; - public RateContentAction(final Session session, final StateManager stateManager) { + public RateContentAction(final Session session, final StateManager stateManager, final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; + this.i18n = i18n; } public void execute(final Double value) { @@ -51,7 +53,7 @@ value, new AsyncCallbackSimple<Object>() { public void onSuccess(final Object result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Content rated")); + Site.info(i18n.t("Content rated")); stateManager.reload(); } }); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/DoTranslationAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/DoTranslationAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/DoTranslationAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -23,8 +23,8 @@ import org.ourproject.kune.platf.client.dto.DoTranslationActionParams; import org.ourproject.kune.platf.client.rpc.I18nService; import org.ourproject.kune.platf.client.rpc.I18nServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.state.Session; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import org.ourproject.kune.workspace.client.sitebar.Site; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -32,9 +32,11 @@ public class DoTranslationAction implements Action<DoTranslationActionParams> { private final Session session; + private final I18nUITranslationService i18n; - public DoTranslationAction(final Session session) { + public DoTranslationAction(final Session session, final I18nUITranslationService i18n) { this.session = session; + this.i18n = i18n; } public void execute(final DoTranslationActionParams params) { @@ -47,12 +49,12 @@ server.setTranslation(session.getUserHash(), params.getId(), params.getText(), new AsyncCallback<String>() { public void onFailure(final Throwable caught) { Site.hideProgress(); - Site.error(Kune.I18N.t("Server error saving translation")); + Site.error(i18n.t("Server error saving translation")); } public void onSuccess(final String result) { Site.hideProgress(); - Kune.I18N.setTranslationAfterSave(params.getTrKey(), result); + i18n.setTranslationAfterSave(params.getTrKey(), result); } }); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/GetLexiconAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/GetLexiconAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/GetLexiconAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,13 +24,19 @@ import org.ourproject.kune.platf.client.dispatch.Action; import org.ourproject.kune.platf.client.rpc.I18nService; import org.ourproject.kune.platf.client.rpc.I18nServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService; import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.user.client.rpc.AsyncCallback; public class GetLexiconAction implements Action<String> { + private final I18nUITranslationService i18n; + + public GetLexiconAction(final I18nUITranslationService i18n) { + this.i18n = i18n; + } + public void execute(final String value) { onGetLexicon(value); } @@ -43,7 +49,7 @@ } public void onSuccess(final HashMap<String, String> result) { - Kune.I18N.setLexicon(result); + i18n.setLexicon(result); } }); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/ShowTranslatorAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/ShowTranslatorAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/i18n/ShowTranslatorAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.actions.i18n; import org.ourproject.kune.platf.client.dispatch.Action; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.workspace.client.sitebar.Site; import org.ourproject.kune.workspace.client.workspace.Workspace; @@ -30,10 +30,12 @@ private final Session session; private final Workspace workspace; + private final I18nTranslationService i18n; - public ShowTranslatorAction(final Session session, final Workspace workspace) { + public ShowTranslatorAction(final Session session, final Workspace workspace, final I18nTranslationService i18n) { this.session = session; this.workspace = workspace; + this.i18n = i18n; } public void execute(final Object value) { @@ -45,7 +47,7 @@ if (session.isLogged()) { workspace.getI18nTranslatorComponent().show(); } else { - Site.info(Kune.I18N.t("Sign in or register to help with translation")); + Site.info(i18n.t("Sign in or register to help with translation")); } Site.hideProgress(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AcceptJoinGroupAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AcceptJoinGroupAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AcceptJoinGroupAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -35,11 +35,14 @@ private final StateManager stateManager; private final Workspace workspace; private final Session session; + private final I18nTranslationService i18n; - public AcceptJoinGroupAction(final Session session, final StateManager stateManager, final Workspace workspace) { + public AcceptJoinGroupAction(final Session session, final StateManager stateManager, final Workspace workspace, + final I18nTranslationService i18n) { this.session = session; this.workspace = workspace; this.stateManager = stateManager; + this.i18n = i18n; } public void execute(final String groupShortName) { @@ -53,7 +56,7 @@ groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Member accepted")); + Site.info(i18n.t("Member accepted")); stateManager.setSocialNetwork(result); workspace.getGroupMembersComponent().showCollabs(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddAdminAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddAdminAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddAdminAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -35,11 +35,14 @@ private final Workspace workspace; private final StateManager stateManager; private final Session session; + private final I18nTranslationService i18n; - public AddAdminAction(final Session session, final StateManager stateManager, final Workspace workspace) { + public AddAdminAction(final Session session, final StateManager stateManager, final Workspace workspace, + final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; this.workspace = workspace; + this.i18n = i18n; } public void execute(final String groupShortName) { @@ -53,7 +56,7 @@ groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Member added as admin")); + Site.info(i18n.t("Member added as admin")); stateManager.setSocialNetwork(result); workspace.getGroupMembersComponent().showAdmins(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddCollabAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddCollabAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddCollabAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -35,11 +35,14 @@ private final Session session; private final StateManager stateManager; private final Workspace workspace; + private final I18nTranslationService i18n; - public AddCollabAction(final Session session, final StateManager stateManager, final Workspace workspace) { + public AddCollabAction(final Session session, final StateManager stateManager, final Workspace workspace, + final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; this.workspace = workspace; + this.i18n = i18n; } public void execute(final String groupShortName) { @@ -53,7 +56,7 @@ groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Member added as collaborator")); + Site.info(i18n.t("Member added as collaborator")); stateManager.setSocialNetwork(result); workspace.getGroupMembersComponent().showCollabs(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddViewerAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddViewerAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/AddViewerAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -33,10 +33,12 @@ private final Session session; private final StateManager stateManager; + private final I18nTranslationService i18n; - public AddViewerAction(final Session session, final StateManager stateManager) { + public AddViewerAction(final Session session, final StateManager stateManager, final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; + this.i18n = i18n; } public void execute(final String groupShortName) { @@ -50,7 +52,7 @@ groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Member can now view this group contents")); + Site.info(i18n.t("Member can now view this group contents")); stateManager.setSocialNetwork(result); } }); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/DeleteMemberAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/DeleteMemberAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/DeleteMemberAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -32,10 +32,12 @@ public class DeleteMemberAction implements Action<String> { private final Session session; private final StateManager stateManager; + private final I18nTranslationService i18n; - public DeleteMemberAction(final Session session, final StateManager stateManager) { + public DeleteMemberAction(final Session session, final StateManager stateManager, final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; + this.i18n = i18n; } public void execute(final String value) { @@ -49,7 +51,7 @@ new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Member removed")); + Site.info(i18n.t("Member removed")); stateManager.reload(); // in the future, only if I cannot be affected: // services.stateManager.reloadSocialNetwork((SocialNetworkResultDTO) Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/DenyJoinGroupAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/DenyJoinGroupAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/DenyJoinGroupAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -33,10 +33,12 @@ private final Session session; private final StateManager stateManager; + private final I18nTranslationService i18n; - public DenyJoinGroupAction(final Session session, final StateManager stateManager) { + public DenyJoinGroupAction(final Session session, final StateManager stateManager, final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; + this.i18n = i18n; } public void execute(final String value) { @@ -50,7 +52,7 @@ groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Member rejected")); + Site.info(i18n.t("Member rejected")); stateManager.setSocialNetwork(result); } }); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/RequestJoinGroupAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/RequestJoinGroupAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/RequestJoinGroupAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -34,10 +34,13 @@ private final Session session; private final StateManager stateManager; + private final I18nTranslationService i18n; - public RequestJoinGroupAction(final Session session, final StateManager stateManager) { + public RequestJoinGroupAction(final Session session, final StateManager stateManager, + final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; + this.i18n = i18n; } public void execute(final Object value) { @@ -53,14 +56,14 @@ Site.hideProgress(); final String resultType = (String) result; if (resultType == SocialNetworkDTO.REQ_JOIN_ACEPTED) { - Site.info(Kune.I18N.t("You are now member of this group")); + Site.info(i18n.t("You are now member of this group")); stateManager.reload(); } if (resultType == SocialNetworkDTO.REQ_JOIN_DENIED) { - Site.important(Kune.I18N.t("Sorry this is a closed group")); + Site.important(i18n.t("Sorry this is a closed group")); } if (resultType == SocialNetworkDTO.REQ_JOIN_WAITING_MODERATION) { - Site.info(Kune.I18N.t("Requested. Waiting for admins decision")); + Site.info(i18n.t("Requested. Waiting for admins decision")); } } }); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/SetAdminAsCollabAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/SetAdminAsCollabAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/SetAdminAsCollabAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -35,11 +35,14 @@ private final Session session; private final StateManager stateManager; private final Workspace workspace; + private final I18nTranslationService i18n; - public SetAdminAsCollabAction(final Session session, final StateManager stateManager, final Workspace workspace) { + public SetAdminAsCollabAction(final Session session, final StateManager stateManager, final Workspace workspace, + final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; this.workspace = workspace; + this.i18n = i18n; } public void execute(final String value) { @@ -53,7 +56,7 @@ groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Type of member changed")); + Site.info(i18n.t("Type of member changed")); stateManager.reload(); workspace.getGroupMembersComponent().showCollabs(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/SetCollabAsAdminAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/SetCollabAsAdminAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/SetCollabAsAdminAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -35,11 +35,14 @@ private final Session session; private final StateManager stateManager; private final Workspace workspace; + private final I18nTranslationService i18n; - public SetCollabAsAdminAction(final Session session, final StateManager stateManager, final Workspace workspace) { + public SetCollabAsAdminAction(final Session session, final StateManager stateManager, final Workspace workspace, + final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; this.workspace = workspace; + this.i18n = i18n; } public void execute(final String value) { @@ -53,7 +56,7 @@ groupShortName, new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Type of member changed")); + Site.info(i18n.t("Type of member changed")); stateManager.setSocialNetwork(result); workspace.getGroupMembersComponent().showAdmins(); workspace.getGroupMembersComponent().showAdmins(); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/UnJoinGroupAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/UnJoinGroupAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/actions/sn/UnJoinGroupAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.SocialNetworkService; import org.ourproject.kune.platf.client.rpc.SocialNetworkServiceAsync; -import org.ourproject.kune.platf.client.services.Kune; +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.sitebar.Site; @@ -32,10 +32,12 @@ public class UnJoinGroupAction implements Action<String> { private final Session session; private final StateManager stateManager; + private final I18nTranslationService i18n; - public UnJoinGroupAction(final Session session, final StateManager stateManager) { + public UnJoinGroupAction(final Session session, final StateManager stateManager, final I18nTranslationService i18n) { this.session = session; this.stateManager = stateManager; + this.i18n = i18n; } public void execute(final String value) { @@ -49,7 +51,7 @@ new AsyncCallbackSimple<SocialNetworkResultDTO>() { public void onSuccess(final SocialNetworkResultDTO result) { Site.hideProgress(); - Site.info(Kune.I18N.t("Removed as member")); + Site.info(i18n.t("Removed as member")); stateManager.reload(); // in the future with user info: // services.stateManager.reloadSocialNetwork((SocialNetworkResultDTO) Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -21,7 +21,7 @@ package org.ourproject.kune.workspace.client.editor; import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Timer; @@ -38,12 +38,14 @@ private final TextEditorToolbar textEditorToolbar; private final TextEditorPresenter presenter; private final Timer saveTimer; + private final I18nTranslationService i18n; - public TextEditorPanel(final TextEditorPresenter presenter) { + public TextEditorPanel(final TextEditorPresenter presenter, final I18nTranslationService i18n) { this.presenter = presenter; + this.i18n = i18n; gwtRTarea = new RichTextArea(); - textEditorToolbar = new TextEditorToolbar(gwtRTarea, presenter); + textEditorToolbar = new TextEditorToolbar(gwtRTarea, presenter, i18n); initWidget(gwtRTarea); gwtRTarea.setWidth("97%"); @@ -61,28 +63,48 @@ }; } - public void scheduleSave(final int delayMillis) { - saveTimer.schedule(delayMillis); + public void editHTML(final boolean edit) { + textEditorToolbar.editHTML(edit); } + public String getHTML() { + return gwtRTarea.getHTML(); + } + + public String getText() { + return gwtRTarea.getText(); + } + + public View getToolBar() { + return this.textEditorToolbar; + } + public void saveTimerCancel() { saveTimer.cancel(); } + public void scheduleSave(final int delayMillis) { + saveTimer.schedule(delayMillis); + } + public void setEnabled(final boolean enabled) { final String bgColor = enabled ? BACKCOLOR_ENABLED : BACKCOLOR_DISABLED; DOM.setStyleAttribute(gwtRTarea.getElement(), "backgroundColor", bgColor); gwtRTarea.setEnabled(enabled); } - public String getHTML() { - return gwtRTarea.getHTML(); + public void setEnabledCancelButton(final boolean enabled) { + textEditorToolbar.setEnabledCloseButton(enabled); } - public String getText() { - return gwtRTarea.getText(); + public void setEnabledSaveButton(final boolean enabled) { + textEditorToolbar.setEnabledSaveButton(enabled); } + public void setHeight(final String height) { + gwtRTarea.setHeight(height); + } + public void setHTML(final String html) { gwtRTarea.setHTML(html); } @@ -91,45 +113,24 @@ gwtRTarea.setText(text); } - public void setHeight(final String height) { - gwtRTarea.setHeight(height); - } - - public void setEnabledSaveButton(final boolean enabled) { - textEditorToolbar.setEnabledSaveButton(enabled); - } - - public void setEnabledCancelButton(final boolean enabled) { - textEditorToolbar.setEnabledCloseButton(enabled); - } - public void setTextSaveButton(final String text) { textEditorToolbar.setTextSaveButton(text); } - public void editHTML(final boolean edit) { - textEditorToolbar.editHTML(edit); + public void showSaveBeforeDialog() { + MessageBox.confirm(i18n.t("Save confirmation"), i18n.t("Save before close?"), new MessageBox.ConfirmCallback() { + public void execute(final String btnID) { + if (btnID.equals("yes")) { + presenter.onSaveAndClose(); + } else { + presenter.onCancelConfirmed(); + } + } + }); + } private void adjustSize(final String height) { gwtRTarea.setHeight(height); } - - public void showSaveBeforeDialog() { - MessageBox.confirm(Kune.I18N.t("Save confirmation"), Kune.I18N.t("Save before close?"), - new MessageBox.ConfirmCallback() { - public void execute(final String btnID) { - if (btnID.equals("yes")) { - presenter.onSaveAndClose(); - } else { - presenter.onCancelConfirmed(); - } - } - }); - - } - - public View getToolBar() { - return this.textEditorToolbar; - } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/editor/TextEditorToolbar.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.editor; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.CustomPushButton; import org.ourproject.kune.platf.client.ui.KuneUiUtils; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; @@ -154,47 +154,26 @@ } } - private void showLinkPanel() { + public void onKeyDown(final Widget sender, final char keyCode, final int modifiers) { + if (sender == removeLink && keyCode == KeyboardListener.KEY_ENTER) { + fireEditHTML(); + } } - private void showImagePanel() { - // i18n: - FileUploadFormSample fileUploadFormSample = new FileUploadFormSample(); - BasicDialog dialog = new BasicDialog("Insert image", false, true, 400, 400); - dialog.add(fileUploadFormSample); - dialog.show(); + public void onKeyPress(final Widget sender, final char keyCode, final int modifiers) { + } - if (ic == null) { - MemoryProxy dataProxy = new MemoryProxy(getData()); - RecordDef recordDef = new RecordDef(new FieldDef[] { new StringFieldDef("name"), - new IntegerFieldDef("size"), new DateFieldDef("lastmod", "timestamp"), - new StringFieldDef("url") }); - ArrayReader reader = new ArrayReader(recordDef); - final Store store = new Store(dataProxy, reader, true); - store.load(); - - ic = new ImageChooser("Image Chooser", 515, 400, store); + public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) { + if (sender == richText) { + // We use the RichTextArea's onKeyUp event to update the + // toolbar status. + // This will catch any cases where the user moves the cursur + // using the + // keyboard, or uses one of the browser's built-in keyboard + // shortcuts. + updateStatus(); + fireEdit(); } - - ic.show(new ImageChooserCallback() { - public void onImageSelection(final ImageData data) { - // Element el = DomHelper.append("images", - // Format.format("<img src='{0}' - // style='margin:20px;visibility:hidden;'/>", - // data.getUrl())); - // ExtElement extEl = new ExtElement(el); - // extEl.show(true).frame(); - } - }); - // MessageBox.prompt("Insert image", "Enter an image URL:", new - // PromptCallback() { - // public void execute(final String btnID, final String text) { - // if (btnID.equals("ok") && text != null) { - // extended.insertImage(text); - // } - // } - // }); - } private Object[][] getData() { @@ -230,26 +209,47 @@ }; } - public void onKeyDown(final Widget sender, final char keyCode, final int modifiers) { - if (sender == removeLink && keyCode == KeyboardListener.KEY_ENTER) { - fireEditHTML(); + private void showImagePanel() { + // i18n: + FileUploadFormSample fileUploadFormSample = new FileUploadFormSample(); + BasicDialog dialog = new BasicDialog("Insert image", false, true, 400, 400); + dialog.add(fileUploadFormSample); + dialog.show(); + + if (ic == null) { + MemoryProxy dataProxy = new MemoryProxy(getData()); + RecordDef recordDef = new RecordDef(new FieldDef[] { new StringFieldDef("name"), + new IntegerFieldDef("size"), new DateFieldDef("lastmod", "timestamp"), + new StringFieldDef("url") }); + ArrayReader reader = new ArrayReader(recordDef); + final Store store = new Store(dataProxy, reader, true); + store.load(); + + ic = new ImageChooser("Image Chooser", 515, 400, store); } - } - public void onKeyPress(final Widget sender, final char keyCode, final int modifiers) { + ic.show(new ImageChooserCallback() { + public void onImageSelection(final ImageData data) { + // Element el = DomHelper.append("images", + // Format.format("<img src='{0}' + // style='margin:20px;visibility:hidden;'/>", + // data.getUrl())); + // ExtElement extEl = new ExtElement(el); + // extEl.show(true).frame(); + } + }); + // MessageBox.prompt("Insert image", "Enter an image URL:", new + // PromptCallback() { + // public void execute(final String btnID, final String text) { + // if (btnID.equals("ok") && text != null) { + // extended.insertImage(text); + // } + // } + // }); + } - public void onKeyUp(final Widget sender, final char keyCode, final int modifiers) { - if (sender == richText) { - // We use the RichTextArea's onKeyUp event to update the - // toolbar status. - // This will catch any cases where the user moves the cursur - // using the - // keyboard, or uses one of the browser's built-in keyboard - // shortcuts. - updateStatus(); - fireEdit(); - } + private void showLinkPanel() { } } @@ -294,19 +294,20 @@ private final CustomPushButton close; private WebSafePalettePanel palettePanel; private final TextEditorPresenter panelListener; - private PopupPanel popupPalette; - private WebSafePalettePresenter palettePresenter; + private final I18nTranslationService i18n; /** * Creates a new toolbar that drives the given rich text area. - * + * * @param richText * the rich text area to be controlled */ - public TextEditorToolbar(final RichTextArea richText, final TextEditorPresenter panelListener) { + public TextEditorToolbar(final RichTextArea richText, final TextEditorPresenter panelListener, + final I18nTranslationService i18n) { this.richText = richText; + this.i18n = i18n; this.basic = richText.getBasicFormatter(); this.extended = richText.getExtendedFormatter(); @@ -320,39 +321,38 @@ setStyleName("gwt-RichTextToolbar"); if (basic != null) { - topPanel.add(bold = createToggleButton(images.bold(), Kune.I18N.t("Toggle Bold"))); - topPanel.add(italic = createToggleButton(images.italic(), Kune.I18N.t("Toggle Italic"))); - topPanel.add(underline = createToggleButton(images.underline(), Kune.I18N.t("Toggle Underline"))); + topPanel.add(bold = createToggleButton(images.bold(), i18n.t("Toggle Bold"))); + topPanel.add(italic = createToggleButton(images.italic(), i18n.t("Toggle Italic"))); + topPanel.add(underline = createToggleButton(images.underline(), i18n.t("Toggle Underline"))); } if (extended != null) { - topPanel - .add(strikethrough = createToggleButton(images.strikeout(), Kune.I18N.t("Toggle Strikethrough"))); + topPanel.add(strikethrough = createToggleButton(images.strikeout(), i18n.t("Toggle Strikethrough"))); } if (basic != null) { - topPanel.add(subscript = createToggleButton(images.subscript(), Kune.I18N.t("Toggle Subscript"))); - topPanel.add(superscript = createToggleButton(images.superscript(), Kune.I18N.t("Toggle Superscript"))); - topPanel.add(justifyLeft = createPushButton(images.alignleft(), Kune.I18N.t("Left Justify"))); - topPanel.add(justifyCenter = createPushButton(images.centerpara(), Kune.I18N.t("Center"))); - topPanel.add(justifyRight = createPushButton(images.alignright(), Kune.I18N.t("Right Justify"))); + topPanel.add(subscript = createToggleButton(images.subscript(), i18n.t("Toggle Subscript"))); + topPanel.add(superscript = createToggleButton(images.superscript(), i18n.t("Toggle Superscript"))); + topPanel.add(justifyLeft = createPushButton(images.alignleft(), i18n.t("Left Justify"))); + topPanel.add(justifyCenter = createPushButton(images.centerpara(), i18n.t("Center"))); + topPanel.add(justifyRight = createPushButton(images.alignright(), i18n.t("Right Justify"))); } if (extended != null) { - topPanel.add(indent = createPushButton(images.incrementindent(), Kune.I18N.t("Indent Right"))); - topPanel.add(outdent = createPushButton(images.decrementindent(), Kune.I18N.t("Indent Left"))); - topPanel.add(hr = createPushButton(images.hfixedline(), Kune.I18N.t("Insert Horizontal Rule"))); - topPanel.add(ol = createPushButton(images.defaultnumbering(), Kune.I18N.t("Insert Ordered List"))); - topPanel.add(ul = createPushButton(images.defaultbullet(), Kune.I18N.t("Insert Unordered List"))); - topPanel.add(insertImage = createPushButton(images.images(), Kune.I18N.t("Insert Image"))); - topPanel.add(createLink = createPushButton(images.link(), Kune.I18N.t("Create Link"))); - topPanel.add(removeLink = createPushButton(images.linkBreak(), Kune.I18N.t("Remove Link"))); - topPanel.add(removeFormat = createPushButton(images.removeFormat(), Kune.I18N.t("Remove Formatting"))); + topPanel.add(indent = createPushButton(images.incrementindent(), i18n.t("Indent Right"))); + topPanel.add(outdent = createPushButton(images.decrementindent(), i18n.t("Indent Left"))); + topPanel.add(hr = createPushButton(images.hfixedline(), i18n.t("Insert Horizontal Rule"))); + topPanel.add(ol = createPushButton(images.defaultnumbering(), i18n.t("Insert Ordered List"))); + topPanel.add(ul = createPushButton(images.defaultbullet(), i18n.t("Insert Unordered List"))); + topPanel.add(insertImage = createPushButton(images.images(), i18n.t("Insert Image"))); + topPanel.add(createLink = createPushButton(images.link(), i18n.t("Create Link"))); + topPanel.add(removeLink = createPushButton(images.linkBreak(), i18n.t("Remove Link"))); + topPanel.add(removeFormat = createPushButton(images.removeFormat(), i18n.t("Remove Formatting"))); } if (basic != null) { - topPanel.add(backColor = createPushButton(images.backcolor(), Kune.I18N.t("Background Color"))); - topPanel.add(fontColor = createPushButton(images.fontcolor(), Kune.I18N.t("Font Color"))); + topPanel.add(backColor = createPushButton(images.backcolor(), i18n.t("Background Color"))); + topPanel.add(fontColor = createPushButton(images.fontcolor(), i18n.t("Font Color"))); topPanel.add(fonts = createFontsMenu()); topPanel.add(fontSizes = createFontSizesMenu()); @@ -363,7 +363,7 @@ richText.addClickListener(listener); } - save = new CustomPushButton(Kune.I18N.tWithNT("Save", "used in button"), new ClickListener() { + save = new CustomPushButton(i18n.tWithNT("Save", "used in button"), new ClickListener() { public void onClick(final Widget sender) { if (save.isEnabled()) { fireSave(); @@ -371,7 +371,7 @@ } }); - close = new CustomPushButton(Kune.I18N.tWithNT("Close", "used in button"), new ClickListener() { + close = new CustomPushButton(i18n.tWithNT("Close", "used in button"), new ClickListener() { public void onClick(final Widget sender) { if (close.isEnabled()) { fireCancel(); @@ -383,29 +383,13 @@ // if (basic != null) { // topPanel.add(editHtml = createToggleButton(images.editHtml(), - // Kune.I18N.t("Edit HTML"))); + // i18n.t("Edit HTML"))); // } subtopPanel.add(save); subtopPanel.add(close); } - private void fireEdit() { - panelListener.onEdit(); - } - - private void fireSave() { - panelListener.onSave(); - } - - private void fireCancel() { - panelListener.onCancel(); - } - - private void fireEditHTML() { - panelListener.onEditHTML(); - } - public void editHTML(final boolean edit) { boolean enable = !edit; if (basic != null) { @@ -436,18 +420,45 @@ } } - private MenuBar createFontsMenu() { + public void setEnabledCloseButton(final boolean enabled) { + close.setEnabled(enabled); + } + + public void setEnabledSaveButton(final boolean enabled) { + save.setEnabled(enabled); + } + + public void setTextSaveButton(final String text) { + save.setText(text); + } + + public void showPalette(final Widget sender, final int left, final int top) { + if (palettePanel == null) { + palettePresenter = new WebSafePalettePresenter(); + palettePanel = new WebSafePalettePanel(palettePresenter); + } + popupPalette = new PopupPanel(true, true); + popupPalette.setVisible(false); + popupPalette.show(); + popupPalette.setPopupPosition(left, top); + popupPalette.setWidget(palettePanel); + popupPalette.setVisible(true); + } + + private MenuBar createFontSizesMenu() { MenuBar menu = new MenuBar(); MenuBar submenu = new MenuBar(true); - String fontName[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet", "Verdana" }; + String fontSizes[] = { i18n.t("Extra small"), i18n.t("Very small"), i18n.t("small"), i18n.t("Medium"), + i18n.t("Large"), i18n.t("Very large"), i18n.t("Extra large") }; - KuneUiUtils.setQuickTip(menu, Kune.I18N.t("Font Type")); - menu.addItem(images.charfontname().getHTML(), true, submenu); - for (int i = 0; i < fontName.length; i++) { - final String f = fontName[i]; - submenu.addItem("<span style=\"font-family: " + f + "\">" + f + "</span>", true, new Command() { + KuneUiUtils.setQuickTip(menu, i18n.t("Font Size")); + menu.addItem(images.fontheight().getHTML(), true, submenu); + for (int i = 0; i < fontSizes.length; i++) { + final String f = fontSizes[i]; + final int fontSize = i; + submenu.addItem("<font size=\"" + (i + 1) + "\">" + f + "</font>", true, new Command() { public void execute() { - basic.setFontName(f); + basic.setFontSize(fontSizesConstants[fontSize]); fireEdit(); } }); @@ -457,20 +468,18 @@ return menu; } - private MenuBar createFontSizesMenu() { + private MenuBar createFontsMenu() { MenuBar menu = new MenuBar(); MenuBar submenu = new MenuBar(true); - String fontSizes[] = { Kune.I18N.t("Extra small"), Kune.I18N.t("Very small"), Kune.I18N.t("small"), - Kune.I18N.t("Medium"), Kune.I18N.t("Large"), Kune.I18N.t("Very large"), Kune.I18N.t("Extra large") }; + String fontName[] = { "Times New Roman", "Arial", "Courier New", "Georgia", "Trebuchet", "Verdana" }; - KuneUiUtils.setQuickTip(menu, Kune.I18N.t("Font Size")); - menu.addItem(images.fontheight().getHTML(), true, submenu); - for (int i = 0; i < fontSizes.length; i++) { - final String f = fontSizes[i]; - final int fontSize = i; - submenu.addItem("<font size=\"" + (i + 1) + "\">" + f + "</font>", true, new Command() { + KuneUiUtils.setQuickTip(menu, i18n.t("Font Type")); + menu.addItem(images.charfontname().getHTML(), true, submenu); + for (int i = 0; i < fontName.length; i++) { + final String f = fontName[i]; + submenu.addItem("<span style=\"font-family: " + f + "\">" + f + "</span>", true, new Command() { public void execute() { - basic.setFontSize(fontSizesConstants[fontSize]); + basic.setFontName(f); fireEdit(); } }); @@ -494,29 +503,20 @@ return tb; } - public void showPalette(final Widget sender, final int left, final int top) { - if (palettePanel == null) { - palettePresenter = new WebSafePalettePresenter(); - palettePanel = new WebSafePalettePanel(palettePresenter); - } - popupPalette = new PopupPanel(true, true); - popupPalette.setVisible(false); - popupPalette.show(); - popupPalette.setPopupPosition(left, top); - popupPalette.setWidget(palettePanel); - popupPalette.setVisible(true); + private void fireCancel() { + panelListener.onCancel(); } - public void setEnabledSaveButton(final boolean enabled) { - save.setEnabled(enabled); + private void fireEdit() { + panelListener.onEdit(); } - public void setEnabledCloseButton(final boolean enabled) { - close.setEnabled(enabled); + private void fireEditHTML() { + panelListener.onEditHTML(); } - public void setTextSaveButton(final String text) { - save.setText(text); + private void fireSave() { + panelListener.onSave(); } /** Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/I18nTranslatorPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,8 +20,8 @@ package org.ourproject.kune.workspace.client.i18n.ui; import org.ourproject.kune.platf.client.dto.I18nLanguageDTO; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.AbstractSearcherPanel; import org.ourproject.kune.platf.client.ui.BottomTrayIcon; import org.ourproject.kune.platf.client.ui.KuneStringUtils; @@ -78,250 +78,251 @@ private GridPanel transGrid; private GridPanel unTransGrid; - public I18nTranslatorPanel(final I18nTranslatorPresenter initPresenter) { - this.presenter = initPresenter; + public I18nTranslatorPanel(final I18nTranslatorPresenter initPresenter, final I18nTranslationService i18n) { + super(i18n); + this.presenter = initPresenter; } public void close() { - dialog.hide(); + dialog.hide(); } public void hide() { - dialog.hide(); + dialog.hide(); } public void show() { - if (dialog == null) { - dialog = createDialog(); - } - // By default we use the user lang to help in translation - final I18nLanguageDTO lang = presenter.getLanguage(); - setLanguage(lang); - final String languageNativeNameIfAvailable = lang.getNativeName().length() > 0 ? lang.getNativeName() : lang - .getEnglishName(); - dialog.setTitle(Kune.I18N.t("Help to translate kune to [%s]", languageNativeNameIfAvailable)); - dialog.show(); - dialog.expand(); - dialog.center(); - if (bottomIcon == null) { - bottomIcon = new BottomTrayIcon(Kune.I18N.t("Show/hide translator")); - bottomIcon.addMainButton(Images.App.getInstance().language(), new Command() { - public void execute() { - if (dialog.isVisible()) { - dialog.hide(); - } else { - dialog.show(); - } - } - }); - presenter.attachIconToBottomBar(bottomIcon); - } + if (dialog == null) { + dialog = createDialog(); + } + // By default we use the user lang to help in translation + final I18nLanguageDTO lang = presenter.getLanguage(); + setLanguage(lang); + final String languageNativeNameIfAvailable = lang.getNativeName().length() > 0 ? lang.getNativeName() : lang + .getEnglishName(); + dialog.setTitle(i18n.t("Help to translate kune to [%s]", languageNativeNameIfAvailable)); + dialog.show(); + dialog.expand(); + dialog.center(); + if (bottomIcon == null) { + bottomIcon = new BottomTrayIcon(i18n.t("Show/hide translator")); + bottomIcon.addMainButton(Images.App.getInstance().language(), new Command() { + public void execute() { + if (dialog.isVisible()) { + dialog.hide(); + } else { + dialog.show(); + } + } + }); + presenter.attachIconToBottomBar(bottomIcon); + } } private Window createDialog() { - final Panel north = new Panel(); - north.setBorder(false); + final Panel north = new Panel(); + north.setBorder(false); - final Panel center = new TabPanel(); - center.setAutoScroll(false); - center.setClosable(false); - center.setBorder(false); + final Panel center = new TabPanel(); + center.setAutoScroll(false); + center.setClosable(false); + center.setBorder(false); - final Window dialog = new BasicDialog("", false, false, 720, 330); - // dialog.setResizable(false); - dialog.setIconCls("i18n-icon"); + final Window dialog = new BasicDialog("", false, false, 720, 330); + // dialog.setResizable(false); + dialog.setIconCls("i18n-icon"); - final Button close = new Button(); - close.setText(Kune.I18N.tWithNT("Close", "used in button")); - close.addListener(new ButtonListenerAdapter() { - public void onClick(final Button button, final EventObject e) { - presenter.doClose(); - } - }); - dialog.addButton(close); + final Button close = new Button(); + close.setText(i18n.tWithNT("Close", "used in button")); + close.addListener(new ButtonListenerAdapter() { + public void onClick(final Button button, final EventObject e) { + presenter.doClose(); + } + }); + dialog.addButton(close); - final Panel unTransCenterPanel = new Panel(Kune.I18N.t("Untranslated")); - unTransCenterPanel.setAutoScroll(false); - unTransCenterPanel.setLayout(new FitLayout()); + final Panel unTransCenterPanel = new Panel(i18n.t("Untranslated")); + unTransCenterPanel.setAutoScroll(false); + unTransCenterPanel.setLayout(new FitLayout()); - final Panel transCenterPanel = new Panel(Kune.I18N.t("Translated")); - transCenterPanel.setAutoScroll(false); - transCenterPanel.setLayout(new FitLayout()); + final Panel transCenterPanel = new Panel(i18n.t("Translated")); + transCenterPanel.setAutoScroll(false); + transCenterPanel.setLayout(new FitLayout()); - final Panel recommendationPanel = new Panel(Kune.I18N.t("Recommendations")); - recommendationPanel.setAutoScroll(true); - recommendationPanel.setLayout(new FitLayout()); + final Panel recommendationPanel = new Panel(i18n.t("Recommendations")); + recommendationPanel.setAutoScroll(true); + recommendationPanel.setLayout(new FitLayout()); - transGrid = createGridPanel(true); - unTransGrid = createGridPanel(false); - final HorizontalPanel hp = new HorizontalPanel(); - final LanguageSelectorComponent langComponent = WorkspaceFactory.createLanguageSelectorComponent(); - languageSelectorPanel = (LanguageSelectorPanel) langComponent.getView(); - languageSelectorPanel.addChangeListener(new ComboBoxListenerAdapter() { - public void onSelect(final ComboBox comboBox, final Record record, final int index) { - setLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID)); - dialog.setTitle(Kune.I18N.t("Help to translate kune to [%s]", record.getAsString("language"))); - } - }); - hp.add(languageSelectorPanel); - hp.addStyleName("kune-Margin-Large-trbl"); - north.add(hp); + transGrid = createGridPanel(true); + unTransGrid = createGridPanel(false); + final HorizontalPanel hp = new HorizontalPanel(); + final LanguageSelectorComponent langComponent = WorkspaceFactory.createLanguageSelectorComponent(); + languageSelectorPanel = (LanguageSelectorPanel) langComponent.getView(); + languageSelectorPanel.addChangeListener(new ComboBoxListenerAdapter() { + public void onSelect(final ComboBox comboBox, final Record record, final int index) { + setLanguage(record.getAsString(LanguageSelectorPanel.LANG_ID)); + dialog.setTitle(i18n.t("Help to translate kune to [%s]", record.getAsString("language"))); + } + }); + hp.add(languageSelectorPanel); + hp.addStyleName("kune-Margin-Large-trbl"); + north.add(hp); - unTransCenterPanel.add(unTransGrid); - transCenterPanel.add(transGrid); - final Frame recommFrame = new Frame("html/i18n-recom.html"); - // recommFrame.setHeight("220"); - recommendationPanel.add(recommFrame); + unTransCenterPanel.add(unTransGrid); + transCenterPanel.add(transGrid); + final Frame recommFrame = new Frame("html/i18n-recom.html"); + // recommFrame.setHeight("220"); + recommendationPanel.add(recommFrame); - center.add(unTransCenterPanel); - center.add(transCenterPanel); - center.add(recommendationPanel); - dialog.add(north, new BorderLayoutData(RegionPosition.NORTH)); - dialog.add(center, new BorderLayoutData(RegionPosition.CENTER)); + center.add(unTransCenterPanel); + center.add(transCenterPanel); + center.add(recommendationPanel); + dialog.add(north, new BorderLayoutData(RegionPosition.NORTH)); + dialog.add(center, new BorderLayoutData(RegionPosition.CENTER)); - center.setActiveItemID(unTransCenterPanel.getId()); + center.setActiveItemID(unTransCenterPanel.getId()); - return dialog; + return dialog; } private GridPanel createGridPanel(final boolean translated) { - final Renderer renderNT = new Renderer() { - public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum, - Store store) { - String renderer; - String[] splitted = splitNT((String) value); - if (splitted.length > 1) { - renderer = "{0} " + NOTE_FOR_TRANSLATORS_IMAGE_HTML; - String tip = "<div style='min-width: 75px'>" + splitted[1] + "</div>"; - cellMetadata.setHtmlAttribute("ext:qtip=\"" + tip + "\" ext:qtitle=\"Note for translators\""); - } else { - renderer = "{0}"; - } - return Format.format(renderer, splitted); - } - }; + final Renderer renderNT = new Renderer() { + public String render(Object value, CellMetadata cellMetadata, Record record, int rowIndex, int colNum, + Store store) { + String renderer; + String[] splitted = splitNT((String) value); + if (splitted.length > 1) { + renderer = "{0} " + NOTE_FOR_TRANSLATORS_IMAGE_HTML; + String tip = "<div style='min-width: 75px'>" + splitted[1] + "</div>"; + cellMetadata.setHtmlAttribute("ext:qtip=\"" + tip + "\" ext:qtitle=\"Note for translators\""); + } else { + renderer = "{0}"; + } + return Format.format(renderer, splitted); + } + }; - Store store; - final String id = "id"; - final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef("trKey"), new StringFieldDef("text"), - new StringFieldDef(id) }; + Store store; + final String id = "id"; + final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef("trKey"), new StringFieldDef("text"), + new StringFieldDef(id) }; - if (translated) { - final String url = "/kune/json/I18nTranslationJSONService/searchtranslated"; - transStore = createStore(fieldDefs, url, id); - store = transStore; - } else { - final String url = "/kune/json/I18nTranslationJSONService/search"; - unTransStore = createStore(fieldDefs, url, id); - store = unTransStore; - } + if (translated) { + final String url = "/kune/json/I18nTranslationJSONService/searchtranslated"; + transStore = createStore(fieldDefs, url, id); + store = transStore; + } else { + final String url = "/kune/json/I18nTranslationJSONService/search"; + unTransStore = createStore(fieldDefs, url, id); + store = unTransStore; + } - final ColumnConfig trKeyColumn = new ColumnConfig() { - { - setHeader(Kune.I18N.t("Text to translate")); - setDataIndex("trKey"); - setWidth(335); - setTooltip(Kune.I18N.t("Click to sort")); - setRenderer(renderNT); - } - }; + final ColumnConfig trKeyColumn = new ColumnConfig() { + { + setHeader(i18n.t("Text to translate")); + setDataIndex("trKey"); + setWidth(335); + setTooltip(i18n.t("Click to sort")); + setRenderer(renderNT); + } + }; - final GridEditor textColumnEditor = new GridEditor(new TextField()); + final GridEditor textColumnEditor = new GridEditor(new TextField()); - final ColumnConfig textColumn = new ColumnConfig() { - { - setHeader(Kune.I18N.t("Translation (click to edit)")); - setDataIndex("text"); - setWidth(335); - setEditor(textColumnEditor); - } - }; + final ColumnConfig textColumn = new ColumnConfig() { + { + setHeader(i18n.t("Translation (click to edit)")); + setDataIndex("text"); + setWidth(335); + setEditor(textColumnEditor); + } + }; - final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { trKeyColumn, textColumn }); + final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { trKeyColumn, textColumn }); - columnModel.setDefaultSortable(true); + columnModel.setDefaultSortable(true); - final EditorGridPanel grid = new EditorGridPanel((translated ? "grid-translated" : "grid-untranslated"), 695, - 180, store, columnModel); - createPagingToolbar(store, grid); + final EditorGridPanel grid = new EditorGridPanel((translated ? "grid-translated" : "grid-untranslated"), 695, + 180, store, columnModel); + createPagingToolbar(store, grid); - // final PagingToolbar pag = new PagingToolbar(store); - // pag.setPageSize(PAGINATION_SIZE); - // pag.setDisplayInfo(true); - // pag.setDisplayMsg(Kune.I18N.tWithNT("Displaying results {0} - {1} of - // {2}", - // "Respect {} values in translations, " - // + "these will produce: 'Displaying results 1 - 25 of 95465' for - // instance")); - // pag.setEmptyMsg(Kune.I18N.t("No results to display")); - // pag.setAfterPageText(Kune.I18N.tWithNT("of {0}", "Used to show - // multiple results: '1 of 30'")); - // pag.setBeforePageText(Kune.I18N.t("Page")); - // pag.setFirstText(Kune.I18N.t("First Page")); - // pag.setLastText(Kune.I18N.t("Last Page")); - // pag.setNextText(Kune.I18N.t("Next Page")); - // pag.setPrevText(Kune.I18N.t("Previous Page")); - // pag.setRefreshText(Kune.I18N.t("Refresh")); - // grid.setBottomToolbar(pag); - // grid.setLoadMask(true); - // grid.setLoadMask(Kune.I18N.t("Loading")); - grid.setClicksToEdit(1); - // grid.setStripeRows(true); - // grid.setFrame(true); - // grid.setSelectionModel(new RowSelectionModel()); + // final PagingToolbar pag = new PagingToolbar(store); + // pag.setPageSize(PAGINATION_SIZE); + // pag.setDisplayInfo(true); + // pag.setDisplayMsg(i18n.tWithNT("Displaying results {0} - {1} of + // {2}", + // "Respect {} values in translations, " + // + "these will produce: 'Displaying results 1 - 25 of 95465' for + // instance")); + // pag.setEmptyMsg(i18n.t("No results to display")); + // pag.setAfterPageText(i18n.tWithNT("of {0}", "Used to show + // multiple results: '1 of 30'")); + // pag.setBeforePageText(i18n.t("Page")); + // pag.setFirstText(i18n.t("First Page")); + // pag.setLastText(i18n.t("Last Page")); + // pag.setNextText(i18n.t("Next Page")); + // pag.setPrevText(i18n.t("Previous Page")); + // pag.setRefreshText(i18n.t("Refresh")); + // grid.setBottomToolbar(pag); + // grid.setLoadMask(true); + // grid.setLoadMask(i18n.t("Loading")); + grid.setClicksToEdit(1); + // grid.setStripeRows(true); + // grid.setFrame(true); + // grid.setSelectionModel(new RowSelectionModel()); - grid.addEditorGridListener(new EditorGridListenerAdapter() { - public void onAfterEdit(final GridPanel grid, final Record record, final String field, - final Object newValue, final Object oldValue, final int rowIndex, final int colIndex) { - final String idValue = record.getAsString(id); - final String trKey = record.getAsString("trKey"); - presenter.doTranslation(idValue, trKey, (String) newValue); - record.set(field, KuneStringUtils.escapeHtmlLight((String) newValue)); - } - }); + grid.addEditorGridListener(new EditorGridListenerAdapter() { + public void onAfterEdit(final GridPanel grid, final Record record, final String field, + final Object newValue, final Object oldValue, final int rowIndex, final int colIndex) { + final String idValue = record.getAsString(id); + final String trKey = record.getAsString("trKey"); + presenter.doTranslation(idValue, trKey, (String) newValue); + record.set(field, KuneStringUtils.escapeHtmlLight((String) newValue)); + } + }); - grid.addGridCellListener(new GridCellListenerAdapter() { - public void onCellDblClick(final GridPanel grid, final int rowIndex, final int colIndex, final EventObject e) { - final Record record = unTransStore.getRecordAt(rowIndex); - final String idValue = record.getAsString(id); - final String trKey = record.getAsString("trKey"); - final String text = record.getAsString("text"); - if (text == null || text.length() == 0) { - final String trWithoutNT = removeNT(trKey); - record.set("text", trWithoutNT); - presenter.doTranslation(idValue, trKey, trWithoutNT); - } - } - }); + grid.addGridCellListener(new GridCellListenerAdapter() { + public void onCellDblClick(final GridPanel grid, final int rowIndex, final int colIndex, final EventObject e) { + final Record record = unTransStore.getRecordAt(rowIndex); + final String idValue = record.getAsString(id); + final String trKey = record.getAsString("trKey"); + final String text = record.getAsString("text"); + if (text == null || text.length() == 0) { + final String trWithoutNT = removeNT(trKey); + record.set("text", trWithoutNT); + presenter.doTranslation(idValue, trKey, trWithoutNT); + } + } + }); - return grid; + return grid; } private String removeNT(final String string) { - return Kune.I18N.removeNT(string); + return i18n.removeNT(string); } private void setLanguage(final I18nLanguageDTO language) { - languageSelectorPanel.setLanguage(language.getCode()); - setLanguage(language.getCode()); + languageSelectorPanel.setLanguage(language.getCode()); + setLanguage(language.getCode()); } private void setLanguage(final String language) { - Site.showProgressLoading(); - query(unTransStore, unTransGrid, language); - query(transStore, transGrid, language); - Site.hideProgress(); + Site.showProgressLoading(); + query(unTransStore, unTransGrid, language); + query(transStore, transGrid, language); + Site.hideProgress(); } private String[] splitNT(final String textWithNT) { - String[] nt; - final String[] splitted = textWithNT.split(" \\[%NT "); - if (splitted.length > 1) { - nt = splitted[1].split("\\]$"); - splitted[1] = nt[0]; - } - return splitted; + String[] nt; + final String[] splitted = textWithNT.split(" \\[%NT "); + if (splitted.length > 1) { + nt = splitted[1].split("\\]$"); + splitted[1] = nt[0]; + } + return splitted; } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/LanguageSelectorPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/LanguageSelectorPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/i18n/ui/LanguageSelectorPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,7 +19,7 @@ */ package org.ourproject.kune.workspace.client.i18n.ui; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.i18n.LanguageSelectorPresenter; import org.ourproject.kune.workspace.client.i18n.LanguageSelectorView; @@ -40,8 +40,16 @@ private final LanguageSelectorPresenter presenter; - public LanguageSelectorPanel(final LanguageSelectorPresenter presenter, final String langFieldTitle) { + private final I18nTranslationService i18n; + + public LanguageSelectorPanel(final LanguageSelectorPresenter presenter, final I18nTranslationService i18n) { + this(presenter, null, i18n); + } + + public LanguageSelectorPanel(final LanguageSelectorPresenter presenter, final String langFieldTitle, + final I18nTranslationService i18n) { super(); + this.i18n = i18n; super.setBorder(false); if (langFieldTitle == null) { setHideLabels(true); @@ -51,14 +59,10 @@ super.add(langCombo); } - public LanguageSelectorPanel(final LanguageSelectorPresenter presenter) { - this(presenter, null); + public void addChangeListener(final ComboBoxListener listener) { + langCombo.addListener(listener); } - public void setLanguage(final String languageCode) { - langCombo.setValue(languageCode); - } - public String getLanguage() { return langCombo.getValueAsString(); } @@ -67,8 +71,8 @@ langCombo.reset(); } - public void addChangeListener(final ComboBoxListener listener) { - langCombo.addListener(listener); + public void setLanguage(final String languageCode) { + langCombo.setValue(languageCode); } private void createLangCombo(final String langFieldTitle) { @@ -86,8 +90,8 @@ langCombo.setDisplayField("language"); langCombo.setMode(ComboBox.LOCAL); langCombo.setTriggerAction(ComboBox.ALL); - langCombo.setEmptyText(Kune.I18N.t("Enter language")); - langCombo.setLoadingText(Kune.I18N.t("Searching...")); + langCombo.setEmptyText(i18n.t("Enter language")); + langCombo.setLoadingText(i18n.t("Searching...")); langCombo.setTypeAhead(true); langCombo.setTypeAheadDelay(1000); langCombo.setSelectOnFocus(false); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensechoose/LicenseChoosePanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -22,8 +22,8 @@ import java.util.List; import org.ourproject.kune.platf.client.dto.LicenseDTO; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.HorizontalLine; import org.ourproject.kune.platf.client.ui.IconLabel; import org.ourproject.kune.platf.client.ui.TitledPanel; @@ -55,45 +55,48 @@ private final IconLabel nonCopyleft; private final RadioButton noModifRB; private final RadioButton nonCommercialRB; + private final I18nTranslationService i18n; - public LicenseChoosePanel(final List<LicenseDTO> nonCCLicenses, final LicenseChoosePresenter presenter) { + public LicenseChoosePanel(final List<LicenseDTO> nonCCLicenses, final LicenseChoosePresenter presenter, + final I18nTranslationService i18n) { + this.i18n = i18n; Images img = Images.App.getInstance(); VerticalPanel generalVP = new VerticalPanel(); initWidget(generalVP); VerticalPanel licenseTypesVP = new VerticalPanel(); - ccRB = new RadioButton("ccOrNot", Kune.I18N.t("Creative Commons")); - RadioButton notCcRB = new RadioButton("ccOrNot", Kune.I18N.t("Others licenses")); + ccRB = new RadioButton("ccOrNot", i18n.t("Creative Commons")); + RadioButton notCcRB = new RadioButton("ccOrNot", i18n.t("Others licenses")); options = new DeckPanel(); ccIntro = new Label( - Kune.I18N + i18n .t("With a Creative Commons license, you keep your copyright but allow people to copy and distribute your work provided they give you credit — and only on the conditions you specify here. What do you want to do?")); otherLicenses = new ListBox(); VerticalPanel ccOptionsVP = new VerticalPanel(); VerticalPanel nonCcOptionsVP = new VerticalPanel(); - Label comercialLabel = new Label(Kune.I18N.t("Allow commercial uses of your work?")); - commercialRB = new RadioButton("comercial", Kune.I18N.t("Yes")); - nonCommercialRB = new RadioButton("comercial", Kune.I18N.t("No")); - Label allowModifLabel = new Label(Kune.I18N.t("Allow modifications of your work?")); - allowModifRB = new RadioButton("allowModif", Kune.I18N.t("Yes")); - allowModifShareAlikeRB = new RadioButton("allowModif", Kune.I18N.t("Yes, as long as others share alike")); - noModifRB = new RadioButton("allowModif", Kune.I18N.t("No")); + Label comercialLabel = new Label(i18n.t("Allow commercial uses of your work?")); + commercialRB = new RadioButton("comercial", i18n.t("Yes")); + nonCommercialRB = new RadioButton("comercial", i18n.t("No")); + Label allowModifLabel = new Label(i18n.t("Allow modifications of your work?")); + allowModifRB = new RadioButton("allowModif", i18n.t("Yes")); + allowModifShareAlikeRB = new RadioButton("allowModif", i18n.t("Yes, as long as others share alike")); + noModifRB = new RadioButton("allowModif", i18n.t("No")); generalVP.add(licenseTypesVP); licenseTypesVP.add(ccRB); licenseTypesVP.add(notCcRB); - copyleft = new IconLabel(img.copyleft(), Kune.I18N.t("This is a copyleft license"), false); - nonCopyleft = new IconLabel(img.noCopyleft(), Kune.I18N.t("This is not a copyleft license"), false); + copyleft = new IconLabel(img.copyleft(), i18n.t("This is a copyleft license"), false); + nonCopyleft = new IconLabel(img.noCopyleft(), i18n.t("This is not a copyleft license"), false); nonCopyleft.setVisible(false); generalVP.add(options); // Options - optionsBox = new TitledPanel(Kune.I18N.t("Options"), options); + optionsBox = new TitledPanel(i18n.t("Options"), options); generalVP.add(optionsBox); generalVP.add(nonCopyleft); generalVP.add(copyleft); @@ -153,27 +156,6 @@ configureListeners(presenter); } - private void configureListeners(final LicenseChoosePresenter presenter) { - ChangeListener changeListener = new ChangeListener() { - public void onChange(final Widget arg0) { - presenter.onChange(); - } - }; - - ClickListener clickListener = new ClickListener() { - public void onClick(final Widget arg0) { - presenter.onChange(); - } - }; - otherLicenses.addChangeListener(changeListener); - ccRB.addClickListener(clickListener); - allowModifRB.addClickListener(clickListener); - commercialRB.addClickListener(clickListener); - nonCommercialRB.addClickListener(clickListener); - allowModifShareAlikeRB.addClickListener(clickListener); - noModifRB.addClickListener(clickListener); - } - public int getSelectedNonCCLicenseIndex() { return otherLicenses.getSelectedIndex(); } @@ -203,15 +185,10 @@ public void showCCoptions() { options.showWidget(0); - optionsBox.setTitle(Kune.I18N.t("Options")); + optionsBox.setTitle(i18n.t("Options")); } - public void showNotCCoptions() { - options.showWidget(1); - optionsBox.setTitle(Kune.I18N.t("Select one of these licenses:")); - } - public void showIsCopyleft() { nonCopyleft.setVisible(false); copyleft.setVisible(true); @@ -221,4 +198,30 @@ nonCopyleft.setVisible(true); copyleft.setVisible(false); } + + public void showNotCCoptions() { + options.showWidget(1); + optionsBox.setTitle(i18n.t("Select one of these licenses:")); + } + + private void configureListeners(final LicenseChoosePresenter presenter) { + ChangeListener changeListener = new ChangeListener() { + public void onChange(final Widget arg0) { + presenter.onChange(); + } + }; + + ClickListener clickListener = new ClickListener() { + public void onClick(final Widget arg0) { + presenter.onChange(); + } + }; + otherLicenses.addChangeListener(changeListener); + ccRB.addClickListener(clickListener); + allowModifRB.addClickListener(clickListener); + commercialRB.addClickListener(clickListener); + nonCommercialRB.addClickListener(clickListener); + allowModifShareAlikeRB.addClickListener(clickListener); + noModifRB.addClickListener(clickListener); + } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/ui/LicensePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/ui/LicensePanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/licensefoot/ui/LicensePanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.licensefoot.ui; import org.ourproject.kune.platf.client.dto.LicenseDTO; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.licensefoot.LicensePresenter; import org.ourproject.kune.workspace.client.licensefoot.LicenseView; @@ -35,8 +35,10 @@ private final Label copyright; private final Image image; private final Label license; + private final I18nTranslationService i18n; - public LicensePanel(final LicensePresenter presenter) { + public LicensePanel(final LicensePresenter presenter, final I18nTranslationService i18n) { + this.i18n = i18n; copyright = new Label(); image = new Image(); license = new Label(); @@ -59,16 +61,16 @@ license.setStyleName("kune-LicensePanel-licensetext"); } + public void openWindow(final String url) { + Window.open(url, "_blank", ""); + } + public void showLicense(final String groupName, final LicenseDTO licenseDTO) { - copyright.setText(Kune.I18N.t("© [%s], under license: ", groupName)); + copyright.setText(i18n.t("© [%s], under license: ", groupName)); license.setText(licenseDTO.getLongName()); copyright.setVisible(true); license.setVisible(true); image.setVisible(true); image.setUrl(licenseDTO.getImageUrl()); } - - public void openWindow(final String url) { - Window.open(url, "_blank", ""); - } } 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 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/NewGroupPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -26,7 +26,7 @@ import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.errors.GroupNameInUseException; import org.ourproject.kune.platf.client.rpc.ParamCallback; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.WorkspaceEvents; import org.ourproject.kune.workspace.client.newgroup.ui.SiteErrorType; @@ -36,9 +36,11 @@ public class NewGroupPresenter implements NewGroup { private final NewGroupListener listener; private NewGroupView view; + private final I18nTranslationService i18n; - public NewGroupPresenter(final NewGroupListener listener) { + public NewGroupPresenter(final NewGroupListener listener, final I18nTranslationService i18n) { this.listener = listener; + this.i18n = i18n; } public View getView() { @@ -92,12 +94,11 @@ } catch (final GroupNameInUseException e) { onBack(); view.unMask(); - setMessage(Kune.I18N.t("This name in already in use, try with a different name."), - SiteErrorType.error); + setMessage(i18n.t("This name in already in use, try with a different name."), SiteErrorType.error); } catch (final Throwable e) { onBack(); // The messageP is in first page of wizard :-/ view.unMask(); - setMessage(Kune.I18N.t("Error creating group"), SiteErrorType.error); + setMessage(i18n.t("Error creating group"), SiteErrorType.error); GWT.log("Other kind of exception in group registration", null); throw new RuntimeException(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/ui/NewGroupPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/ui/NewGroupPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/newgroup/ui/NewGroupPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,8 +20,8 @@ package org.ourproject.kune.workspace.client.newgroup.ui; import org.ourproject.kune.platf.client.dto.LicenseDTO; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.KuneStringUtils; import org.ourproject.kune.platf.client.ui.KuneUiUtils; import org.ourproject.kune.platf.client.ui.dialogs.WizardDialog; @@ -70,283 +70,283 @@ private final DeckPanel deck; private LicenseChoose licenseChoosePanel; private final SiteMessagePanel messagesPanel; + private final I18nTranslationService i18n; - public NewGroupPanel(final NewGroupPresenter presenter) { - super(Kune.I18N.t("Register a new Group"), true, false, 460, 480, new WizardListener() { - public void onBack() { - presenter.onBack(); - } + public NewGroupPanel(final NewGroupPresenter presenter, final I18nTranslationService i18n) { + super(i18n.t("Register a new Group"), true, false, 460, 480, new WizardListener() { + public void onBack() { + presenter.onBack(); + } - public void onCancel() { - presenter.onCancel(); - } + public void onCancel() { + presenter.onCancel(); + } - public void onClose() { - presenter.onClose(); - } + public void onClose() { + presenter.onClose(); + } - public void onFinish() { - presenter.onFinish(); - } + public void onFinish() { + presenter.onFinish(); + } - public void onNext() { - presenter.onNext(); - } - }); - Field.setMsgTarget("side"); - final Panel centerPanel = new Panel(); - centerPanel.setLayout(new FitLayout()); - deck = new DeckPanel(); - newGroupInitialDataForm = createNewGroupInitialDataForm(presenter); - createChooseLicensePanel(); - final VerticalPanel newGroupInitialDataVP = new VerticalPanel(); - final HorizontalPanel newGroupInitialDataHP = new HorizontalPanel(); - final VerticalPanel chooseLicenseVP = new VerticalPanel(); - final HorizontalPanel chooseLicenseHP = new HorizontalPanel(); - final Images img = Images.App.getInstance(); - newGroupInitialDataHP.add(img.step1().createImage()); - final Label step1Label = new Label(Kune.I18N - .t("Please fill this form and follow the next steps to register a new group:")); - newGroupInitialDataHP.add(step1Label); - newGroupInitialDataVP.add(newGroupInitialDataHP); - newGroupInitialDataVP.add(newGroupInitialDataForm); - chooseLicenseHP.add(img.step2().createImage()); - final HTML step2Label = new HTML(Kune.I18N.t( - "Select a license to share your group contents with other people. " - + "We recomend [%s] licenses for practical works.", KuneStringUtils.generateHtmlLink( - "http://en.wikipedia.org/wiki/Copyleft", "copyleft"))); - chooseLicenseHP.add(step2Label); - final Label licenseTypeLabel = new Label(Kune.I18N.t("Choose a license type:")); - chooseLicenseVP.add(chooseLicenseHP); - chooseLicenseVP.add(licenseTypeLabel); + public void onNext() { + presenter.onNext(); + } + }, i18n); + this.i18n = i18n; + Field.setMsgTarget("side"); + final Panel centerPanel = new Panel(); + centerPanel.setLayout(new FitLayout()); + deck = new DeckPanel(); + newGroupInitialDataForm = createNewGroupInitialDataForm(presenter); + createChooseLicensePanel(); + final VerticalPanel newGroupInitialDataVP = new VerticalPanel(); + final HorizontalPanel newGroupInitialDataHP = new HorizontalPanel(); + final VerticalPanel chooseLicenseVP = new VerticalPanel(); + final HorizontalPanel chooseLicenseHP = new HorizontalPanel(); + final Images img = Images.App.getInstance(); + newGroupInitialDataHP.add(img.step1().createImage()); + final Label step1Label = new Label(i18n + .t("Please fill this form and follow the next steps to register a new group:")); + newGroupInitialDataHP.add(step1Label); + newGroupInitialDataVP.add(newGroupInitialDataHP); + newGroupInitialDataVP.add(newGroupInitialDataForm); + chooseLicenseHP.add(img.step2().createImage()); + final HTML step2Label = new HTML(i18n.t("Select a license to share your group contents with other people. " + + "We recomend [%s] licenses for practical works.", KuneStringUtils.generateHtmlLink( + "http://en.wikipedia.org/wiki/Copyleft", "copyleft"))); + chooseLicenseHP.add(step2Label); + final Label licenseTypeLabel = new Label(i18n.t("Choose a license type:")); + chooseLicenseVP.add(chooseLicenseHP); + chooseLicenseVP.add(licenseTypeLabel); - newGroupInitialDataHP.addStyleName("kune-Margin-Medium-b"); - step1Label.addStyleName("kune-Margin-Large-l"); - step2Label.addStyleName("kune-Margin-Large-l"); - step1Label.addStyleName("kune-Margin-Medium-b"); - step2Label.addStyleName("kune-Margin-Medium-b"); + newGroupInitialDataHP.addStyleName("kune-Margin-Medium-b"); + step1Label.addStyleName("kune-Margin-Large-l"); + step2Label.addStyleName("kune-Margin-Large-l"); + step1Label.addStyleName("kune-Margin-Medium-b"); + step2Label.addStyleName("kune-Margin-Medium-b"); - messagesPanel = new SiteMessagePanel(null, false); - messagesPanel.setWidth("425"); - messagesPanel.setMessage("", SiteErrorType.info, SiteErrorType.error); - newGroupInitialDataVP.add(messagesPanel); + messagesPanel = new SiteMessagePanel(null, false); + messagesPanel.setWidth("425"); + messagesPanel.setMessage("", SiteErrorType.info, SiteErrorType.error); + newGroupInitialDataVP.add(messagesPanel); - chooseLicenseVP.add((Widget) licenseChoosePanel.getView()); - deck.add(newGroupInitialDataVP); - deck.add(chooseLicenseVP); - centerPanel.add(deck); - super.add(centerPanel); - deck.showWidget(0); - initBottomButtons(); - // newGroupInitialDataVP.addStyleName("kune-Default-Form"); - deck.addStyleName("kune-Default-Form"); - licenseTypeLabel.addStyleName("kune-License-CC-Header"); - newGroupInitialDataVP.setHeight("10"); // Ext set this to 100% ... - chooseLicenseVP.setHeight("10"); // (same here) - super.setFinishText(Kune.I18N.t("Register")); + chooseLicenseVP.add((Widget) licenseChoosePanel.getView()); + deck.add(newGroupInitialDataVP); + deck.add(chooseLicenseVP); + centerPanel.add(deck); + super.add(centerPanel); + deck.showWidget(0); + initBottomButtons(); + // newGroupInitialDataVP.addStyleName("kune-Default-Form"); + deck.addStyleName("kune-Default-Form"); + licenseTypeLabel.addStyleName("kune-License-CC-Header"); + newGroupInitialDataVP.setHeight("10"); // Ext set this to 100% ... + chooseLicenseVP.setHeight("10"); // (same here) + super.setFinishText(i18n.t("Register")); } public void clearData() { - deck.showWidget(0); - newGroupInitialDataForm.getForm().reset(); - ((LicenseChoosePanel) licenseChoosePanel.getView()).reset(); - showNewGroupInitialDataForm(); - initBottomButtons(); - shortNameField.focus(false); + deck.showWidget(0); + newGroupInitialDataForm.getForm().reset(); + ((LicenseChoosePanel) licenseChoosePanel.getView()).reset(); + showNewGroupInitialDataForm(); + initBottomButtons(); + shortNameField.focus(false); } public LicenseDTO getLicense() { - return licenseChoosePanel.getLicense(); + return licenseChoosePanel.getLicense(); } public String getLongName() { - return longNameField.getValueAsString(); + return longNameField.getValueAsString(); } public String getPublicDesc() { - return publicDescField.getValueAsString(); + return publicDescField.getValueAsString(); } public String getShortName() { - return shortNameField.getValueAsString(); + return shortNameField.getValueAsString(); } public void hideMessage() { - messagesPanel.hide(); + messagesPanel.hide(); } public boolean isCommunity() { - return communityRadio.getValue(); + return communityRadio.getValue(); } public boolean isFormValid() { - return newGroupInitialDataForm.getForm().isValid(); + return newGroupInitialDataForm.getForm().isValid(); } public boolean isOrganization() { - return orgRadio.getValue(); + return orgRadio.getValue(); } public boolean isOrphanedProject() { - return orphanedProjectRadio.getValue(); + return orphanedProjectRadio.getValue(); } public boolean isProject() { - return projectRadio.getValue(); + return projectRadio.getValue(); } public void setMessage(final String message, final SiteErrorType type) { - messagesPanel.setMessage(message, type, type); - messagesPanel.show(); + messagesPanel.setMessage(message, type, type); + messagesPanel.show(); } public void showLicenseForm() { - deck.showWidget(1); + deck.showWidget(1); } public void showNewGroupInitialDataForm() { - deck.showWidget(0); + deck.showWidget(0); } private void createChooseLicensePanel() { - licenseChoosePanel = SiteBarFactory.createLicenseChoose(); + licenseChoosePanel = SiteBarFactory.createLicenseChoose(); } private FormPanel createNewGroupInitialDataForm(final NewGroupPresenter presenter) { - final FormPanel form = new FormPanel(); - form.setBorder(false); - form.setWidth(420); - form.setLabelWidth(100); - form.setLabelAlign(Position.RIGHT); - form.setButtonAlign(Position.RIGHT); + final FormPanel form = new FormPanel(); + form.setBorder(false); + form.setWidth(420); + form.setLabelWidth(100); + form.setLabelAlign(Position.RIGHT); + form.setButtonAlign(Position.RIGHT); - shortNameField = new TextField(); - shortNameField.setFieldLabel(Kune.I18N.t("Short name")); - shortNameField. + shortNameField = new TextField(); + shortNameField.setFieldLabel(i18n.t("Short name")); + shortNameField. - setName(SHORTNAME_FIELD); - shortNameField.setWidth(175); - shortNameField.setMinLength(3); - shortNameField.setMaxLength(15); - shortNameField.setAllowBlank(false); - shortNameField.setRegex("^[a-z0-9_\\-]+$"); - shortNameField.setMinLengthText(Kune.I18N.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameField.setMaxLengthText(Kune.I18N.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameField.setRegexText(Kune.I18N.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameField.setValidationDelay(1000); + setName(SHORTNAME_FIELD); + shortNameField.setWidth(175); + shortNameField.setMinLength(3); + shortNameField.setMaxLength(15); + shortNameField.setAllowBlank(false); + shortNameField.setRegex("^[a-z0-9_\\-]+$"); + shortNameField.setMinLengthText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); + shortNameField.setMaxLengthText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); + shortNameField.setRegexText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); + shortNameField.setValidationDelay(1000); - form.add(shortNameField); + form.add(shortNameField); - longNameField = new TextField(); - longNameField.setFieldLabel(Kune.I18N.t("Long name")); - longNameField.setName(LONGNAME_FIELD); - longNameField.setWidth(300); - longNameField.setAllowBlank(false); + longNameField = new TextField(); + longNameField.setFieldLabel(i18n.t("Long name")); + longNameField.setName(LONGNAME_FIELD); + longNameField.setWidth(300); + longNameField.setAllowBlank(false); - longNameField.setMinLength(3); - longNameField.setMaxLength(50); - longNameField.setValidationDelay(1000); - form.add(longNameField); + longNameField.setMinLength(3); + longNameField.setMaxLength(50); + longNameField.setValidationDelay(1000); + form.add(longNameField); - publicDescField = new TextArea(); - publicDescField.setFieldLabel(Kune.I18N.t("Public description")); - publicDescField.setName(PUBLICDESC_FIELD); - publicDescField.setWidth(300); - publicDescField.setAllowBlank(false); - publicDescField.setMinLength(10); - publicDescField.setMaxLength(255); - publicDescField.setValidationDelay(1000); + publicDescField = new TextArea(); + publicDescField.setFieldLabel(i18n.t("Public description")); + publicDescField.setName(PUBLICDESC_FIELD); + publicDescField.setWidth(300); + publicDescField.setAllowBlank(false); + publicDescField.setMinLength(10); + publicDescField.setMaxLength(255); + publicDescField.setValidationDelay(1000); - form.add(publicDescField); + form.add(publicDescField); - final FieldSet groupTypeFieldSet = new FieldSet(Kune.I18N.t("Type of group")); - groupTypeFieldSet.setStyle("margin-left: 105px"); + final FieldSet groupTypeFieldSet = new FieldSet(i18n.t("Type of group")); + groupTypeFieldSet.setStyle("margin-left: 105px"); - form.add(groupTypeFieldSet); + form.add(groupTypeFieldSet); - projectRadio = new Radio(); - createRadio(groupTypeFieldSet, projectRadio, "Project", - "A project is a kind of group in which new members inclusion " - + "is moderated by the project administrators. " - + "An administrator is the person who creates the project " - + "and other people she/he choose in the future as administrator too."); - projectRadio.setChecked(true); + projectRadio = new Radio(); + createRadio(groupTypeFieldSet, projectRadio, "Project", + "A project is a kind of group in which new members inclusion " + + "is moderated by the project administrators. " + + "An administrator is the person who creates the project " + + "and other people she/he choose in the future as administrator too."); + projectRadio.setChecked(true); - orgRadio = new Radio(); - createRadio(groupTypeFieldSet, orgRadio, "Organization", "An organization is like a project, " - + "but organizations must be a legal entity."); + orgRadio = new Radio(); + createRadio(groupTypeFieldSet, orgRadio, "Organization", "An organization is like a project, " + + "but organizations must be a legal entity."); - communityRadio = new Radio(); - createRadio(groupTypeFieldSet, communityRadio, "Community", "Communities are social group of persons " - + "with shared interests and they are open to new members " - + "(for instance the environmental community or the LGBT community). " - + "Normally they aren't a legal entity."); + communityRadio = new Radio(); + createRadio(groupTypeFieldSet, communityRadio, "Community", "Communities are social group of persons " + + "with shared interests and they are open to new members " + + "(for instance the environmental community or the LGBT community). " + + "Normally they aren't a legal entity."); - orphanedProjectRadio = new Radio(); - createRadio(groupTypeFieldSet, orphanedProjectRadio, "Orphaned Project", - "If you have an idea but you don't have " + "capacity/possibilities/resources to work on it, " - + "just register a orphaned project, and permit others to work and develop it."); + orphanedProjectRadio = new Radio(); + createRadio(groupTypeFieldSet, orphanedProjectRadio, "Orphaned Project", + "If you have an idea but you don't have " + "capacity/possibilities/resources to work on it, " + + "just register a orphaned project, and permit others to work and develop it."); - groupTypeFieldSet.setCollapsible(false); + groupTypeFieldSet.setCollapsible(false); - shortNameField.addListener(new TextFieldListenerAdapter() { - public void onChange(final Field field, final Object newVal, final Object oldVal) { - presenter.onChange(); - } - }); + shortNameField.addListener(new TextFieldListenerAdapter() { + public void onChange(final Field field, final Object newVal, final Object oldVal) { + presenter.onChange(); + } + }); - longNameField.addListener(new TextFieldListenerAdapter() { - public void onChange(final Field field, final Object newVal, final Object oldVal) { - presenter.onChange(); - } - }); + longNameField.addListener(new TextFieldListenerAdapter() { + public void onChange(final Field field, final Object newVal, final Object oldVal) { + presenter.onChange(); + } + }); - publicDescField.addListener(new TextFieldListenerAdapter() { - public void onChange(final Field field, final Object newVal, final Object oldVal) { - presenter.onChange(); - } - }); + publicDescField.addListener(new TextFieldListenerAdapter() { + public void onChange(final Field field, final Object newVal, final Object oldVal) { + presenter.onChange(); + } + }); - return form; + return form; } private void createRadio(final FieldSet fieldSet, final Radio radio, final String radioLabel, final String radioTip) { - radio.setName(TYPEOFGROUP_FIELD); - radio.setBoxLabel(KuneUiUtils - .genQuickTipLabel(Kune.I18N.t(radioLabel), null, Kune.I18N.t(radioTip), INFO_IMAGE)); - radio.setAutoCreate(true); - radio.setHideLabel(true); - fieldSet.add(radio); - // ToolTip fieldToolTip = new ToolTip("Tooltip on a Field."); - // fieldToolTip.applyTo(captchaField); - // Image info = new Image("images/silk/information.gif"); - // - // ToolTip tooltip = new ToolTip(); - // tooltip.setHtml("A <b>CAPTCHA</b> is a challenge-response test to - // determine whether " + - // "the user is human."); - // tooltip.setWidth(150); - // tooltip.applyTo(info.getElement()); + radio.setName(TYPEOFGROUP_FIELD); + radio.setBoxLabel(KuneUiUtils.genQuickTipLabel(i18n.t(radioLabel), null, i18n.t(radioTip), INFO_IMAGE)); + radio.setAutoCreate(true); + radio.setHideLabel(true); + fieldSet.add(radio); + // ToolTip fieldToolTip = new ToolTip("Tooltip on a Field."); + // fieldToolTip.applyTo(captchaField); + // Image info = new Image("images/silk/information.gif"); + // + // ToolTip tooltip = new ToolTip(); + // tooltip.setHtml("A <b>CAPTCHA</b> is a challenge-response test to + // determine whether " + + // "the user is human."); + // tooltip.setWidth(150); + // tooltip.applyTo(info.getElement()); - // Tested: - // Set tooltip - // Image info = new Image(); - // ChatIcons.App.getInstance().info().applyTo(info); - // ToolTip tooltip = new ToolTip(); - // tooltip.setHtml(i18n.t("Note that the 'Jabber Id' sometimes is the - // same as the email " - // + "(in gmail accounts for instance).")); - // tooltip.setWidth(250); - // tooltip.applyTo(info.getElement()); - // jidPanel.addToRow(info, new ColumnLayoutData(1)); - // - // formPanel.add(jidPanel); + // Tested: + // Set tooltip + // Image info = new Image(); + // ChatIcons.App.getInstance().info().applyTo(info); + // ToolTip tooltip = new ToolTip(); + // tooltip.setHtml(i18n.t("Note that the 'Jabber Id' sometimes is the + // same as the email " + // + "(in gmail accounts for instance).")); + // tooltip.setWidth(250); + // tooltip.applyTo(info.getElement()); + // jidPanel.addToRow(info, new ColumnLayoutData(1)); + // + // formPanel.add(jidPanel); } private void initBottomButtons() { - super.setEnabledBackButton(false); - super.setEnabledFinishButton(false); - super.setEnabledNextButton(true); + super.setEnabledBackButton(false); + super.setEnabledFinishButton(false); + super.setEnabledNextButton(true); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/presence/ui/GroupSummaryPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/presence/ui/GroupSummaryPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/presence/ui/GroupSummaryPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,15 +20,18 @@ package org.ourproject.kune.workspace.client.presence.ui; import org.ourproject.kune.platf.client.AbstractPresenter; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.ColorTheme; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.stacks.StackedDropDownPanel; import org.ourproject.kune.workspace.client.sitebar.Site; import org.ourproject.kune.workspace.client.summary.GroupSummaryView; public class GroupSummaryPanel extends StackedDropDownPanel implements GroupSummaryView { - public GroupSummaryPanel(final AbstractPresenter presenter) { - super(presenter, Kune.getInstance().theme.getSummaryDD(), Kune.I18N.t("Group Summary"), Kune.I18N + public GroupSummaryPanel(final AbstractPresenter presenter, final I18nTranslationService i18n, + final ColorTheme colorTheme) { + // FIXME + super(presenter, colorTheme.getSummaryDD(), i18n.t("Group Summary"), i18n .t("Some summarized information about current project" + Site.IN_DEVELOPMENT), false); setDropDownContentVisible(true); setVisible(true); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/search/ui/SearchSitePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/search/ui/SearchSitePanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/search/ui/SearchSitePanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,8 +19,8 @@ */ package org.ourproject.kune.workspace.client.search.ui; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.AbstractSearcherPanel; import org.ourproject.kune.platf.client.ui.BottomTrayIcon; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; @@ -76,244 +76,245 @@ private GridPanel contentGrid; - public SearchSitePanel(final SearchSitePresenter initPresenter) { - this.presenter = initPresenter; - dialog = createDialog(); + public SearchSitePanel(final SearchSitePresenter initPresenter, final I18nTranslationService i18n) { + super(i18n); + this.presenter = initPresenter; + dialog = createDialog(); } public String getComboTextToSearch() { - return searchCombo.getValue(); + return searchCombo.getValue(); } public void hide() { - dialog.hide(); + dialog.hide(); } public void search(final String text, final int type) { - searchCombo.setValue(text); - switch (type) { - case SearchSiteView.GROUP_USER_SEARCH: - query(groupStore, groupsGrid, text); - break; - case SearchSiteView.CONTENT_SEARCH: - query(contentStore, contentGrid, text); - break; - default: - break; - } + searchCombo.setValue(text); + switch (type) { + case SearchSiteView.GROUP_USER_SEARCH: + query(groupStore, groupsGrid, text); + break; + case SearchSiteView.CONTENT_SEARCH: + query(contentStore, contentGrid, text); + break; + default: + break; + } } public void show() { - dialog.show(); - dialog.expand(); - dialog.center(); - if (bottomIcon == null) { - bottomIcon = new BottomTrayIcon(Kune.I18N.t("Show/hide searcher")); - bottomIcon.addMainButton(Images.App.getInstance().kuneSearchIcoPush(), new Command() { - public void execute() { - if (dialog.isVisible()) { - dialog.hide(); - } else { - dialog.show(); - } - } - }); - presenter.attachIconToBottomBar(bottomIcon); - } + dialog.show(); + dialog.expand(); + dialog.center(); + if (bottomIcon == null) { + bottomIcon = new BottomTrayIcon(i18n.t("Show/hide searcher")); + bottomIcon.addMainButton(Images.App.getInstance().kuneSearchIcoPush(), new Command() { + public void execute() { + if (dialog.isVisible()) { + dialog.hide(); + } else { + dialog.show(); + } + } + }); + presenter.attachIconToBottomBar(bottomIcon); + } } private Window createDialog() { - final Panel north = new Panel(); - north.setHeight(50); - north.setBorder(false); + final Panel north = new Panel(); + north.setHeight(50); + north.setBorder(false); - final TabPanel centerPanel = new TabPanel(); - centerPanel.setActiveTab(0); - centerPanel.setAutoScroll(true); - centerPanel.setClosable(false); - centerPanel.setBorder(false); + final TabPanel centerPanel = new TabPanel(); + centerPanel.setActiveTab(0); + centerPanel.setAutoScroll(true); + centerPanel.setClosable(false); + centerPanel.setBorder(false); - final BasicDialog dialog = new BasicDialog(Kune.I18N.t("Search"), false, false, 500, 400); - // dialog.setResizable(false); - dialog.setIconCls("search-icon"); - final Button closeButton = new Button(Kune.I18N.tWithNT("Close", "used in button")); - closeButton.addListener(new ButtonListenerAdapter() { - public void onClick(final Button button, final EventObject e) { - presenter.doClose(); - } - }); - dialog.addButton(closeButton); + final BasicDialog dialog = new BasicDialog(i18n.t("Search"), false, false, 500, 400); + // dialog.setResizable(false); + dialog.setIconCls("search-icon"); + final Button closeButton = new Button(i18n.tWithNT("Close", "used in button")); + closeButton.addListener(new ButtonListenerAdapter() { + public void onClick(final Button button, final EventObject e) { + presenter.doClose(); + } + }); + dialog.addButton(closeButton); - final Panel searchPanel = createSearchForm(presenter); - final Panel groupsPanel = new Panel("Groups & Users"); - final Panel contentPanel = new Panel("Content"); - groupsPanel.setLayout(new FitLayout()); - contentPanel.setLayout(new FitLayout()); + final Panel searchPanel = createSearchForm(presenter); + final Panel groupsPanel = new Panel("Groups & Users"); + final Panel contentPanel = new Panel("Content"); + groupsPanel.setLayout(new FitLayout()); + contentPanel.setLayout(new FitLayout()); - groupsGrid = createSearchPanel(GROUP_USER_SEARCH); - contentGrid = createSearchPanel(CONTENT_SEARCH); - groupsPanel.add(groupsGrid); - contentPanel.add(contentGrid); - centerPanel.add(groupsPanel); - centerPanel.add(contentPanel); - dialog.add(searchPanel, new BorderLayoutData(RegionPosition.NORTH)); - dialog.add(centerPanel, new BorderLayoutData(RegionPosition.CENTER)); + groupsGrid = createSearchPanel(GROUP_USER_SEARCH); + contentGrid = createSearchPanel(CONTENT_SEARCH); + groupsPanel.add(groupsGrid); + contentPanel.add(contentGrid); + centerPanel.add(groupsPanel); + centerPanel.add(contentPanel); + dialog.add(searchPanel, new BorderLayoutData(RegionPosition.NORTH)); + dialog.add(centerPanel, new BorderLayoutData(RegionPosition.CENTER)); - groupsPanel.addListener(new PanelListenerAdapter() { - public void onActivate(final Panel panel) { - dialog.setTitle(Kune.I18N.t("Search users & groups")); - presenter.doSearch(GROUP_USER_SEARCH); - } - }); + groupsPanel.addListener(new PanelListenerAdapter() { + public void onActivate(final Panel panel) { + dialog.setTitle(i18n.t("Search users & groups")); + presenter.doSearch(GROUP_USER_SEARCH); + } + }); - contentPanel.addListener(new PanelListenerAdapter() { - public void onActivate(final Panel panel) { - dialog.setTitle(Kune.I18N.t("Search contents")); - presenter.doSearch(CONTENT_SEARCH); - } - }); + contentPanel.addListener(new PanelListenerAdapter() { + public void onActivate(final Panel panel) { + dialog.setTitle(i18n.t("Search contents")); + presenter.doSearch(CONTENT_SEARCH); + } + }); - final String panelId = groupsPanel.getId(); - centerPanel.setActiveItemID(panelId); + final String panelId = groupsPanel.getId(); + centerPanel.setActiveItemID(panelId); - dialog.setCloseAction(Window.HIDE); + dialog.setCloseAction(Window.HIDE); - dialog.addListener(new WindowListenerAdapter() { - public void onCollapse(final Panel panel) { - // dialog.hide(); - } - }); + dialog.addListener(new WindowListenerAdapter() { + public void onCollapse(final Panel panel) { + // dialog.hide(); + } + }); - return dialog; + return dialog; } private Panel createSearchForm(final SearchSitePresenter presenter) { - final Panel searchPanel = new Panel(); - searchPanel.setBorder(false); + final Panel searchPanel = new Panel(); + searchPanel.setBorder(false); - final HorizontalPanel hp = new HorizontalPanel(); + final HorizontalPanel hp = new HorizontalPanel(); - final FormPanel form = new FormPanel(); - form.setBorder(false); - form.setWidth(330); - form.setHideLabels(true); + final FormPanel form = new FormPanel(); + form.setBorder(false); + form.setWidth(330); + form.setHideLabels(true); - historyStore = new SimpleStore(new String[] { "term" }, presenter.getSearchHistory()); + historyStore = new SimpleStore(new String[] { "term" }, presenter.getSearchHistory()); - searchCombo = new ComboBox(); - searchCombo.setStore(historyStore); - searchCombo.setDisplayField("term"); - searchCombo.setTypeAhead(false); - searchCombo.setLoadingText(Kune.I18N.t("Searching...")); - searchCombo.setWidth(300); - searchCombo.setPageSize(10); - searchCombo.setMode(ComboBox.LOCAL); - searchCombo.setMinChars(1); - searchCombo.setValueField("term"); - searchCombo.setForceSelection(false); - searchCombo.setEditable(true); - historyStore.load(); - searchCombo.addListener(new ComboBoxListenerAdapter() { - public void onSelect(final ComboBox comboBox, final Record record, final int index) { - presenter.doSearch(getComboTextToSearch()); - historyStore = new SimpleStore(new String[] { "term" }, presenter.getSearchHistory()); - searchCombo.setStore(historyStore); - historyStore.load(); - } - }); - searchCombo.addListener(new FieldListenerAdapter() { - public void onChange(final Field field, final Object newVal, final Object oldVal) { - // Maybe we use... - } + searchCombo = new ComboBox(); + searchCombo.setStore(historyStore); + searchCombo.setDisplayField("term"); + searchCombo.setTypeAhead(false); + searchCombo.setLoadingText(i18n.t("Searching...")); + searchCombo.setWidth(300); + searchCombo.setPageSize(10); + searchCombo.setMode(ComboBox.LOCAL); + searchCombo.setMinChars(1); + searchCombo.setValueField("term"); + searchCombo.setForceSelection(false); + searchCombo.setEditable(true); + historyStore.load(); + searchCombo.addListener(new ComboBoxListenerAdapter() { + public void onSelect(final ComboBox comboBox, final Record record, final int index) { + presenter.doSearch(getComboTextToSearch()); + historyStore = new SimpleStore(new String[] { "term" }, presenter.getSearchHistory()); + searchCombo.setStore(historyStore); + historyStore.load(); + } + }); + searchCombo.addListener(new FieldListenerAdapter() { + public void onChange(final Field field, final Object newVal, final Object oldVal) { + // Maybe we use... + } - public void onSpecialKey(final Field field, final EventObject e) { - switch (e.getKey()) { - case KeyboardListener.KEY_ENTER: - Log.debug("Enter pressed"); - Log.debug("field: " + field.getValueAsString()); - Log.debug("field2: " + getComboTextToSearch()); - presenter.doSearch(field.getValueAsString()); - historyStore = new SimpleStore(new String[] { "term" }, presenter.getSearchHistory()); - historyStore.load(); - searchCombo.setStore(historyStore); - break; - } - e.stopEvent(); - } + public void onSpecialKey(final Field field, final EventObject e) { + switch (e.getKey()) { + case KeyboardListener.KEY_ENTER: + Log.debug("Enter pressed"); + Log.debug("field: " + field.getValueAsString()); + Log.debug("field2: " + getComboTextToSearch()); + presenter.doSearch(field.getValueAsString()); + historyStore = new SimpleStore(new String[] { "term" }, presenter.getSearchHistory()); + historyStore.load(); + searchCombo.setStore(historyStore); + break; + } + e.stopEvent(); + } - }); - form.add(searchCombo); + }); + form.add(searchCombo); - final Button searchBtn = new Button(Kune.I18N.tWithNT("Search", "used in button")); - searchBtn.addListener(new ButtonListenerAdapter() { - public void onClick(final Button button, final EventObject e) { - presenter.doSearch(getComboTextToSearch()); - } - }); - hp.add(form); - hp.add(searchBtn); - hp.setSpacing(7); - hp.addStyleName("kune-Margin-Large-trbl"); - searchPanel.add(hp); - return searchPanel; + final Button searchBtn = new Button(i18n.tWithNT("Search", "used in button")); + searchBtn.addListener(new ButtonListenerAdapter() { + public void onClick(final Button button, final EventObject e) { + presenter.doSearch(getComboTextToSearch()); + } + }); + hp.add(form); + hp.add(searchBtn); + hp.setSpacing(7); + hp.addStyleName("kune-Margin-Large-trbl"); + searchPanel.add(hp); + return searchPanel; } private GridPanel createSearchPanel(final int type) { - final String id = "shortName"; - final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef(id), new StringFieldDef("longName"), - new StringFieldDef("link"), new StringFieldDef("iconUrl") }; - final Store store; + final String id = "shortName"; + final FieldDef[] fieldDefs = new FieldDef[] { new StringFieldDef(id), new StringFieldDef("longName"), + new StringFieldDef("link"), new StringFieldDef("iconUrl") }; + final Store store; - switch (type) { - case GROUP_USER_SEARCH: - store = groupStore = createStore(fieldDefs, "/kune/json/GroupJSONService/search", id); - break; - case CONTENT_SEARCH: - store = contentStore = createStore(fieldDefs, "/kune/json/ContentJSONService/search", id); - break; - default: - throw new RuntimeException("Unknown type of search"); - } + switch (type) { + case GROUP_USER_SEARCH: + store = groupStore = createStore(fieldDefs, "/kune/json/GroupJSONService/search", id); + break; + case CONTENT_SEARCH: + store = contentStore = createStore(fieldDefs, "/kune/json/ContentJSONService/search", id); + break; + default: + throw new RuntimeException("Unknown type of search"); + } - final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { new ColumnConfig() { - { - setDataIndex(id); - setWidth(100); - } - }, new ColumnConfig() { - { - setDataIndex("longName"); - setWidth(350); - } - } }); + final ColumnModel columnModel = new ColumnModel(new ColumnConfig[] { new ColumnConfig() { + { + setDataIndex(id); + setWidth(100); + } + }, new ColumnConfig() { + { + setDataIndex("longName"); + setWidth(350); + } + } }); - // columnModel.setDefaultSortable(true); + // columnModel.setDefaultSortable(true); - final String gridName = type == GROUP_USER_SEARCH ? "group-search" : "content-search"; + final String gridName = type == GROUP_USER_SEARCH ? "group-search" : "content-search"; - final GridPanel grid = new GridPanel(gridName, 474, 250, store, columnModel); - createPagingToolbar(store, grid); - grid.setHideColumnHeader(true); - // final GridView view = new GridView(); - // view.setForceFit(true); - // // view.setEnableRowBody(true); - // grid.setView(view); + final GridPanel grid = new GridPanel(gridName, 474, 250, store, columnModel); + createPagingToolbar(store, grid); + grid.setHideColumnHeader(true); + // final GridView view = new GridView(); + // view.setForceFit(true); + // // view.setEnableRowBody(true); + // grid.setView(view); - grid.addListener(new PanelListenerAdapter() { - public void onRender(final Component component) { - Log.debug("Loading store"); - store.load(0, PAGINATION_SIZE); - } - }); + grid.addListener(new PanelListenerAdapter() { + public void onRender(final Component component) { + Log.debug("Loading store"); + store.load(0, PAGINATION_SIZE); + } + }); - grid.addGridCellListener(new GridCellListenerAdapter() { - public void onCellClick(final GridPanel grid, final int rowIndex, final int colindex, final EventObject e) { - final Record record = store.getRecordAt(rowIndex); - final String groupShortName = record.getAsString(id); - presenter.doGoto(groupShortName); - } - }); + grid.addGridCellListener(new GridCellListenerAdapter() { + public void onCellClick(final GridPanel grid, final int rowIndex, final int colindex, final EventObject e) { + final Record record = store.getRecordAt(rowIndex); + final String groupShortName = record.getAsString(id); + presenter.doGoto(groupShortName); + } + }); - return grid; + return grid; } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/Site.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,7 +19,7 @@ */ package org.ourproject.kune.workspace.client.sitebar; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.newgroup.ui.SiteErrorType; import org.ourproject.kune.workspace.client.sitebar.bar.SiteBar; import org.ourproject.kune.workspace.client.sitebar.msg.SiteMessage; @@ -40,68 +40,74 @@ public static final String IN_DEVELOPMENT = " (in development)"; + private static I18nTranslationService i18n; + public static void doLogin(final String returnToken) { - sitebar.doLogin(returnToken); + sitebar.doLogin(returnToken); } public static void doLogout() { - sitebar.doLogout(); + sitebar.doLogout(); } public static void doNewGroup(final String returnToken) { - sitebar.doNewGroup(returnToken); + sitebar.doNewGroup(returnToken); } public static void error(final String value) { - siteUserMessage.setMessage(value, SiteErrorType.error); + siteUserMessage.setMessage(value, SiteErrorType.error); } public static void hideProgress() { - sitebar.hideProgress(); + sitebar.hideProgress(); } public static void important(final String value) { - siteUserMessage.setMessage(value, SiteErrorType.imp); + siteUserMessage.setMessage(value, SiteErrorType.imp); } public static void info(final String value) { - siteUserMessage.setMessage(value, SiteErrorType.info); + siteUserMessage.setMessage(value, SiteErrorType.info); } + public static void init(final I18nTranslationService i18n) { + Site.i18n = i18n; + } + public static void mask() { - sitebar.mask(); + sitebar.mask(); } public static void mask(final String message) { - sitebar.mask(message); + sitebar.mask(message); } public static void showAlertMessage(final String message) { - sitebar.showAlertMessage(message); + sitebar.showAlertMessage(message); } public static void showProgress(final String text) { - sitebar.showProgress(text); + sitebar.showProgress(text); } public static void showProgressLoading() { - sitebar.showProgress(Kune.I18N.t("Loading")); + sitebar.showProgress(i18n.t("Loading")); } public static void showProgressProcessing() { - sitebar.showProgress(Kune.I18N.t("Processing")); + sitebar.showProgress(i18n.t("Processing")); } public static void showProgressSaving() { - sitebar.showProgress(Kune.I18N.t("Saving")); + sitebar.showProgress(i18n.t("Saving")); } public static void unMask() { - sitebar.unMask(); + sitebar.unMask(); } public static void veryImportant(final String value) { - siteUserMessage.setMessage(value, SiteErrorType.veryimp); + siteUserMessage.setMessage(value, SiteErrorType.veryimp); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/SiteBarFactory.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/SiteBarFactory.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/SiteBarFactory.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,6 +24,7 @@ import java.util.List; import org.ourproject.kune.platf.client.dto.LicenseDTO; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.workspace.client.licensechoose.LicenseChoose; import org.ourproject.kune.workspace.client.licensechoose.LicenseChoosePanel; @@ -55,31 +56,39 @@ private static NewGroup newGroup; private static SearchSite search; private static Session session; + private static I18nTranslationService i18n; - public static SiteBar createSiteBar(final SiteBarListener listener, final Session session) { + public static LicenseChoose createLicenseChoose() { + List<LicenseDTO> licensesList = session.getLicenses(); + List<LicenseDTO> licensesNonCCList = new ArrayList<LicenseDTO>(); + + for (Iterator<LicenseDTO> iterator = licensesList.iterator(); iterator.hasNext();) { + LicenseDTO license = iterator.next(); + if (!license.isCC()) { + licensesNonCCList.add(license); + } + } + LicenseChoosePresenter presenter = new LicenseChoosePresenter(); + LicenseChoosePanel view = new LicenseChoosePanel(licensesNonCCList, presenter, i18n); + presenter.init(view, licensesList, licensesNonCCList); + return presenter; + } + + public static SiteBar createSiteBar(final SiteBarListener listener, final Session session, + final I18nTranslationService i18n) { SiteBarFactory.session = session; - SiteBarPresenter siteBarPresenter = new SiteBarPresenter(listener, session); - SiteBarPanel siteBarView = new SiteBarPanel(siteBarPresenter); + SiteBarFactory.i18n = i18n; + SiteBarPresenter siteBarPresenter = new SiteBarPresenter(listener, session, i18n); + SiteBarPanel siteBarView = new SiteBarPanel(siteBarPresenter, i18n); siteBarPresenter.init(siteBarView); Site.sitebar = siteBarPresenter; return siteBarPresenter; } - public static SiteMessage getSiteMessage() { - if (siteMessage == null) { - SiteMessagePresenter siteMessagePresenter = new SiteMessagePresenter(); - SiteMessageView siteMessageView = new SiteMessagePanel(siteMessagePresenter, true); - siteMessagePresenter.init(siteMessageView); - siteMessage = siteMessagePresenter; - Site.siteUserMessage = siteMessagePresenter; - } - return siteMessage; - } - public static Login getLoginForm(final LoginListener listener) { if (login == null) { - LoginPresenter presenter = new LoginPresenter(session, listener); - LoginPanel view = new LoginPanel(presenter); + LoginPresenter presenter = new LoginPresenter(session, listener, i18n); + LoginPanel view = new LoginPanel(presenter, i18n); presenter.init(view); login = presenter; } @@ -88,8 +97,8 @@ public static NewGroup getNewGroupForm(final NewGroupListener listener) { if (newGroup == null) { - NewGroupPresenter presenter = new NewGroupPresenter(listener); - NewGroupPanel view = new NewGroupPanel(presenter); + NewGroupPresenter presenter = new NewGroupPresenter(listener, i18n); + NewGroupPanel view = new NewGroupPanel(presenter, i18n); presenter.init(view); newGroup = presenter; } @@ -99,26 +108,21 @@ public static SearchSite getSearch() { if (search == null) { SearchSitePresenter presenter = new SearchSitePresenter(); - SearchSiteView view = new SearchSitePanel(presenter); + SearchSiteView view = new SearchSitePanel(presenter, i18n); presenter.init(view); search = presenter; } return search; } - public static LicenseChoose createLicenseChoose() { - List<LicenseDTO> licensesList = session.getLicenses(); - List<LicenseDTO> licensesNonCCList = new ArrayList<LicenseDTO>(); - - for (Iterator<LicenseDTO> iterator = licensesList.iterator(); iterator.hasNext();) { - LicenseDTO license = iterator.next(); - if (!license.isCC()) { - licensesNonCCList.add(license); - } + public static SiteMessage getSiteMessage() { + if (siteMessage == null) { + SiteMessagePresenter siteMessagePresenter = new SiteMessagePresenter(); + SiteMessageView siteMessageView = new SiteMessagePanel(siteMessagePresenter, true); + siteMessagePresenter.init(siteMessageView); + siteMessage = siteMessagePresenter; + Site.siteUserMessage = siteMessagePresenter; } - LicenseChoosePresenter presenter = new LicenseChoosePresenter(); - LicenseChoosePanel view = new LicenseChoosePanel(licensesNonCCList, presenter); - presenter.init(view, licensesList, licensesNonCCList); - return presenter; + return siteMessage; } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -23,8 +23,8 @@ import org.ourproject.kune.platf.client.dto.LinkDTO; import org.ourproject.kune.platf.client.dto.StateToken; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.IconLabel; import org.ourproject.kune.platf.client.ui.RoundedBorderDecorator; import org.ourproject.kune.workspace.client.newgroup.NewGroup; @@ -92,8 +92,10 @@ private final ExtElement extRootBody; private String publicUrl; private Timer timeProgressMaxTime; + private final I18nTranslationService i18n; - public SiteBarPanel(final SiteBarPresenter initPresenter) { + public SiteBarPanel(final SiteBarPresenter initPresenter, final I18nTranslationService i18n) { + this.i18n = i18n; img = Images.App.getInstance(); // Initialize @@ -106,8 +108,8 @@ progressText = RootPanel.get("kuneprogresstext"); publicHP = new HorizontalPanel(); - gotoPublic = new IconLabel(img.anybody(), Kune.I18N.t("Go to Public Space"), false); - contentNoPublic = new IconLabel(img.anybody(), Kune.I18N.t("This content is not public")); + gotoPublic = new IconLabel(img.anybody(), i18n.t("Go to Public Space"), false); + contentNoPublic = new IconLabel(img.anybody(), i18n.t("This content is not public")); final Label expandLabel = new Label(""); newGroupHyperlink = new Hyperlink(); @@ -145,7 +147,7 @@ // Set properties siteBarHP.addStyleName("kune-SiteBarPanel"); siteBarHP.setCellWidth(expandLabel, "100%"); - showProgress(Kune.I18N.t("Processing")); + showProgress(i18n.t("Processing")); gotoPublic.addStyleName("kune-Margin-Medium-r"); setContentPublic(true); gotoPublic.addClickListener(new ClickListener() { @@ -153,22 +155,22 @@ gotoPublic(); } }); - gotoPublic.setTitle(Kune.I18N.t("Leave the workspace and go to the public space of this group") + gotoPublic.setTitle(i18n.t("Leave the workspace and go to the public space of this group") + Site.IN_DEVELOPMENT); gotoPublic.addStyleName("kune-SiteBarPanel-LabelLink"); contentNoPublic.addStyleName("kune-Margin-Medium-r"); - newGroupHyperlink.setText(Kune.I18N.t("Create New Group")); + newGroupHyperlink.setText(i18n.t("Create New Group")); newGroupHyperlink.setTargetHistoryToken(Site.NEWGROUP_TOKEN); loggedUserHyperlink.setVisible(false); pipeSeparatorHtml.setHTML("|"); pipeSeparatorHtml.setStyleName("kune-SiteBarPanel-Separator"); pipeSeparatorHtml2.setHTML("|"); pipeSeparatorHtml2.setStyleName("kune-SiteBarPanel-Separator"); - loginHyperlink.setText(Kune.I18N.t("Sign in to collaborate")); + loginHyperlink.setText(i18n.t("Sign in to collaborate")); loginHyperlink.setTargetHistoryToken(Site.LOGIN_TOKEN); - logoutLabel.setText(Kune.I18N.t("Sign out")); + logoutLabel.setText(i18n.t("Sign out")); logoutLabel.addStyleName("kune-SiteBarPanel-LabelLink"); - options.addItem(Kune.I18N.t("Options"), true, optionsSubmenu); + options.addItem(i18n.t("Options"), true, optionsSubmenu); options.setStyleName("kune-MenuBar"); optionsButton.setColor("AAA"); optionsButton.setHeight("16px"); @@ -186,86 +188,119 @@ extRootBody = new ExtElement(RootPanel.getBodyElement()); } - public void setContentPublic(boolean visible) { - gotoPublic.setVisible(visible); - contentNoPublic.setVisible(!visible); + public void centerLoginDialog() { + loginPanel.center(); } - public void setContentGotoPublicUrl(final String publicUrl) { - this.publicUrl = publicUrl; + public void centerNewGroupDialog() { + newGroupPanel.center(); } + public void clearSearchText() { + searchTextBox.setText(""); + } + + public void clearUserName() { + loginHyperlink.setText(i18n.t("Sign in to collaborate")); + } + public void gotoPublic() { Window.open(publicUrl, "_blank", ""); } - private void createOptionsSubmenu() { - linkHelpInTrans = new MenuItem(img.language().getHTML() + Kune.I18N.t("Help with the translation"), true, - new Command() { - public void execute() { - presenter.onHelpInTranslation(); - } - }); - linkKuneBugs = new MenuItem(img.kuneIcon16().getHTML() + Kune.I18N.t("Report kune bugs"), true, new Command() { - public void execute() { - Window.open("http://code.google.com/p/kune/issues/list", "_blank", null); - } - }); - // linkHelp = new MenuItem(img.kuneIcon16().getHTML() + - // Kune.I18N.t("Help"), true, new Command() { - // public void execute() { - // presenter.changeState(new StateToken("site.docs")); - // } - // }); + public void hideLoginDialog() { + loginPanel.hide(); } - private void createSearchBox() { - searchButton = new PushButton(img.kuneSearchIco().createImage(), img.kuneSearchIcoPush().createImage()); - searchTextBox = new TextBox(); + public void hideNewGroupDialog() { + newGroupPanel.hide(); + } - siteBarHP.add(searchButton); - siteBarHP.add(searchTextBox); + public void hideProgress() { + timeProgressMaxTime.cancel(); + progressPanel.setVisible(false); + publicHP.setVisible(true); + } - setTextSearchSmall(); - setDefaultTextSearch(); - searchTextBox.addFocusListener(new FocusListener() { + public void mask() { + extRootBody.mask(); + } - public void onFocus(final Widget arg0) { - presenter.onSearchFocus(); - } + public void mask(final String message) { + extRootBody.mask(message, "x-mask-loading"); + } - public void onLostFocus(final Widget arg0) { - presenter.onSearchLostFocus(searchTextBox.getText()); - } - }); + public void resetOptionsSubmenu() { + optionsSubmenu.clearItems(); + addDefaultItemsToOptions(); } - public void setDefaultTextSearch() { - searchTextBox.setText(Kune.I18N.t("Search")); + public void restoreLoginLink() { + loginHyperlink.setVisible(true); + loggedUserHyperlink.setVisible(false); + loginHyperlink.setTargetHistoryToken(Site.LOGIN_TOKEN); } - public void clearSearchText() { - searchTextBox.setText(""); + public void setContentGotoPublicUrl(final String publicUrl) { + this.publicUrl = publicUrl; } - public void clearUserName() { - loginHyperlink.setText(Kune.I18N.t("Sign in to collaborate")); + public void setContentPublic(boolean visible) { + gotoPublic.setVisible(visible); + contentNoPublic.setVisible(!visible); } + public void setDefaultTextSearch() { + searchTextBox.setText(i18n.t("Search")); + } + + public void setGroupsIsMember(final List<LinkDTO> groupsIsAdmin, final List<LinkDTO> groupsIsCollab) { + optionsSubmenu.clearItems(); + yourGroupsSubmenu.clearItems(); + + int isAdminCount = groupsIsAdmin.size(); + int isCollabCount = groupsIsCollab.size(); + if (isAdminCount > 0 || isCollabCount > 0) { + optionsSubmenu.addItem(i18n.t("My Groups") + " »", yourGroupsSubmenu); + for (int i = 0; i < isAdminCount; i++) { + final LinkDTO link = groupsIsAdmin.get(i); + addItemToYourGroupSubmenu(link); + } + for (int i = 0; i < isCollabCount; i++) { + final LinkDTO link = groupsIsCollab.get(i); + addItemToYourGroupSubmenu(link); + } + } + addDefaultItemsToOptions(); + } + public void setLogo(final Image logo) { // TODO } + public void setLogoutLinkVisible(final boolean visible) { + logoutLabel.setVisible(visible); + pipeSeparatorHtml2.setVisible(visible); + } + public void setSearchText(final String text) { searchTextBox.setText(text); } + public void setTextSearchBig() { + searchTextBox.setWidth(SEARCH_TEXT_WIDTH_BIG); + } + public void setTextSearchSmall() { searchTextBox.setWidth(SEARCH_TEXT_WIDTH_SMALL); } - public void setTextSearchBig() { - searchTextBox.setWidth(SEARCH_TEXT_WIDTH_BIG); + public void showAlertMessage(final String message) { + MessageBox.alert(i18n.t("Alert"), message, new MessageBox.AlertCallback() { + public void execute() { + // Do nothing + } + }); } public void showLoggedUserName(final String name, final String homePage) { @@ -282,10 +317,6 @@ } - public void hideLoginDialog() { - loginPanel.hide(); - } - public void showNewGroupDialog() { final NewGroup newGroupForm = SiteBarFactory.getNewGroupForm(presenter); newGroupPanel = (NewGroupPanel) newGroupForm.getView(); @@ -293,29 +324,6 @@ Site.hideProgress(); } - public void showSearchPanel(final String termToSearch) { - final SearchSite search = SiteBarFactory.getSearch(); - search.doSearch(termToSearch); - searchPanel = (SearchSitePanel) search.getView(); - searchPanel.show(); - Site.hideProgress(); - } - - public void hideNewGroupDialog() { - newGroupPanel.hide(); - } - - public void setLogoutLinkVisible(final boolean visible) { - logoutLabel.setVisible(visible); - pipeSeparatorHtml2.setVisible(visible); - } - - public void restoreLoginLink() { - loginHyperlink.setVisible(true); - loggedUserHyperlink.setVisible(false); - loginHyperlink.setTargetHistoryToken(Site.LOGIN_TOKEN); - } - public void showProgress(final String text) { if (timeProgressMaxTime == null) { timeProgressMaxTime = new Timer() { @@ -330,32 +338,31 @@ DOM.setInnerText(progressText.getElement(), text); } - public void hideProgress() { - timeProgressMaxTime.cancel(); - progressPanel.setVisible(false); - publicHP.setVisible(true); + public void showSearchPanel(final String termToSearch) { + final SearchSite search = SiteBarFactory.getSearch(); + search.doSearch(termToSearch); + searchPanel = (SearchSitePanel) search.getView(); + searchPanel.show(); + Site.hideProgress(); } - public void centerLoginDialog() { - loginPanel.center(); + public void unMask() { + extRootBody.unmask(); } - public void centerNewGroupDialog() { - newGroupPanel.center(); + private void addDefaultItemsToOptions() { + optionsSubmenu.addItem(linkHelpInTrans); + optionsSubmenu.addItem(linkKuneBugs); } - public void mask() { - extRootBody.mask(); + private void addItemToYourGroupSubmenu(final LinkDTO link) { + yourGroupsSubmenu.addItem(link.getShortName(), true, new Command() { + public void execute() { + presenter.changeState(new StateToken(link.getLink())); + } + }); } - public void mask(final String message) { - extRootBody.mask(message, "x-mask-loading"); - } - - public void unMask() { - extRootBody.unmask(); - } - private void createListeners() { searchButton.addClickListener(new ClickListener() { public void onClick(final Widget arg0) { @@ -387,50 +394,45 @@ }); } - public void setGroupsIsMember(final List<LinkDTO> groupsIsAdmin, final List<LinkDTO> groupsIsCollab) { - optionsSubmenu.clearItems(); - yourGroupsSubmenu.clearItems(); - - int isAdminCount = groupsIsAdmin.size(); - int isCollabCount = groupsIsCollab.size(); - if (isAdminCount > 0 || isCollabCount > 0) { - optionsSubmenu.addItem(Kune.I18N.t("My Groups") + " »", yourGroupsSubmenu); - for (int i = 0; i < isAdminCount; i++) { - final LinkDTO link = groupsIsAdmin.get(i); - addItemToYourGroupSubmenu(link); - } - for (int i = 0; i < isCollabCount; i++) { - final LinkDTO link = groupsIsCollab.get(i); - addItemToYourGroupSubmenu(link); - } - } - addDefaultItemsToOptions(); - } - - public void showAlertMessage(final String message) { - MessageBox.alert(Kune.I18N.t("Alert"), message, new MessageBox.AlertCallback() { + private void createOptionsSubmenu() { + linkHelpInTrans = new MenuItem(img.language().getHTML() + i18n.t("Help with the translation"), true, + new Command() { + public void execute() { + presenter.onHelpInTranslation(); + } + }); + linkKuneBugs = new MenuItem(img.kuneIcon16().getHTML() + i18n.t("Report kune bugs"), true, new Command() { public void execute() { - // Do nothing + Window.open("http://code.google.com/p/kune/issues/list", "_blank", null); } }); + // linkHelp = new MenuItem(img.kuneIcon16().getHTML() + + // i18n.t("Help"), true, new Command() { + // public void execute() { + // presenter.changeState(new StateToken("site.docs")); + // } + // }); } - private void addDefaultItemsToOptions() { - optionsSubmenu.addItem(linkHelpInTrans); - optionsSubmenu.addItem(linkKuneBugs); - } + private void createSearchBox() { + searchButton = new PushButton(img.kuneSearchIco().createImage(), img.kuneSearchIcoPush().createImage()); + searchTextBox = new TextBox(); - private void addItemToYourGroupSubmenu(final LinkDTO link) { - yourGroupsSubmenu.addItem(link.getShortName(), true, new Command() { - public void execute() { - presenter.changeState(new StateToken(link.getLink())); + siteBarHP.add(searchButton); + siteBarHP.add(searchTextBox); + + setTextSearchSmall(); + setDefaultTextSearch(); + searchTextBox.addFocusListener(new FocusListener() { + + public void onFocus(final Widget arg0) { + presenter.onSearchFocus(); } + + public void onLostFocus(final Widget arg0) { + presenter.onSearchLostFocus(searchTextBox.getText()); + } }); } - public void resetOptionsSubmenu() { - optionsSubmenu.clearItems(); - addDefaultItemsToOptions(); - } - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/bar/SiteBarPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -28,7 +28,7 @@ import org.ourproject.kune.platf.client.errors.SessionExpiredException; import org.ourproject.kune.platf.client.errors.UserMustBeLoggedException; import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.workspace.client.WorkspaceEvents; import org.ourproject.kune.workspace.client.newgroup.NewGroupListener; @@ -46,29 +46,18 @@ private final SiteBarListener listener; private String previousToken; private final Session session; + private final I18nTranslationService i18n; - public SiteBarPresenter(final SiteBarListener listener, final Session session) { + public SiteBarPresenter(final SiteBarListener listener, final Session session, final I18nTranslationService i18n) { this.listener = listener; this.session = session; + this.i18n = i18n; } - public void init(final SiteBarView view) { - this.view = view; - view.setLogoutLinkVisible(false); + public void changeState(final StateToken token) { + listener.onChangeState(token); } - public void setState(final StateDTO state) { - StateToken token = state.getStateToken(); - if (state.getAccessLists().getViewers().getMode().equals(GroupListDTO.EVERYONE)) { - String publicUrl = token.getPublicUrl(); - view.setContentGotoPublicUrl(publicUrl); - view.setContentPublic(true); - } else { - view.setContentPublic(false); - } - - } - public void doLogin(final String previousToken) { this.previousToken = previousToken; Site.showProgressProcessing(); @@ -77,27 +66,6 @@ Site.hideProgress(); } - public void doNewGroup(final String previousTokenOrig) { - DefaultDispatcher.getInstance().fire(WorkspaceEvents.ONLY_CHECK_USER_SESSION, - new AsyncCallbackSimple<Object>() { - public void onSuccess(final Object result) { - previousToken = previousTokenOrig; - if (session.isLogged()) { - Site.showProgressProcessing(); - view.showNewGroupDialog(); - view.centerNewGroupDialog(); - } else { - returnToPreviousState(); - Site.info(Kune.I18N.t("Sign in or register to create a group")); - } - } - }); - } - - public void doSearch(final String termToSearch) { - view.showSearchPanel(termToSearch); - } - public void doLogout() { AsyncCallback<Object> callback = new AsyncCallback<Object>() { public void onFailure(final Throwable caught) { @@ -130,37 +98,52 @@ DefaultDispatcher.getInstance().fire(WorkspaceEvents.USER_LOGOUT, callback); } - public void reloadUserInfo(final String userHash) { - UserServiceAsync siteBarService = UserService.App.getInstance(); - siteBarService.reloadUserInfo(userHash, new AsyncCallback<UserInfoDTO>() { - public void onFailure(final Throwable arg0) { - Site.hideProgress(); - } + public void doNewGroup(final String previousTokenOrig) { + DefaultDispatcher.getInstance().fire(WorkspaceEvents.ONLY_CHECK_USER_SESSION, + new AsyncCallbackSimple<Object>() { + public void onSuccess(final Object result) { + previousToken = previousTokenOrig; + if (session.isLogged()) { + Site.showProgressProcessing(); + view.showNewGroupDialog(); + view.centerNewGroupDialog(); + } else { + returnToPreviousState(); + Site.info(i18n.t("Sign in or register to create a group")); + } + } + }); + } - public void onSuccess(final UserInfoDTO response) { - showLoggedUser(response); - Site.hideProgress(); - } - }); + public void doSearch(final String termToSearch) { + view.showSearchPanel(termToSearch); } - public void userLoggedIn(final UserInfoDTO userInfoDTO) { - DefaultDispatcher.getInstance().fire(WorkspaceEvents.USER_LOGGED_IN, userInfoDTO); - view.hideLoginDialog(); - returnToPreviousState(); + public View getView() { + return view; } - public void showLoggedUser(final UserInfoDTO user) { - if (user == null) { - view.restoreLoginLink(); - view.setLogoutLinkVisible(false); - } else { - view.showLoggedUserName(user.getShortName(), user.getHomePage()); - view.setLogoutLinkVisible(true); - view.setGroupsIsMember(user.getGroupsIsAdmin(), user.getGroupsIsCollab()); - } + public void hideProgress() { + view.hideProgress(); } + public void init(final SiteBarView view) { + this.view = view; + view.setLogoutLinkVisible(false); + } + + public void mask() { + view.mask(); + } + + public void mask(final String message) { + view.mask(message); + } + + public void onHelpInTranslation() { + DefaultDispatcher.getInstance().fire(WorkspaceEvents.SHOW_TRANSLATOR, null); + } + public void onLoginCancelled() { view.hideLoginDialog(); returnToPreviousState(); @@ -172,11 +155,6 @@ } } - public void onNewGroupCreated(final StateToken homePage) { - view.hideNewGroupDialog(); - changeState(homePage); - } - public void onNewGroupCancel() { view.hideNewGroupDialog(); returnToPreviousState(); @@ -186,42 +164,71 @@ returnToPreviousState(); } - public void hideProgress() { - view.hideProgress(); + public void onNewGroupCreated(final StateToken homePage) { + view.hideNewGroupDialog(); + changeState(homePage); } - public void showProgress(final String text) { - view.showProgress(text); + public void reloadUserInfo(final String userHash) { + UserServiceAsync siteBarService = UserService.App.getInstance(); + siteBarService.reloadUserInfo(userHash, new AsyncCallback<UserInfoDTO>() { + public void onFailure(final Throwable arg0) { + Site.hideProgress(); + } + + public void onSuccess(final UserInfoDTO response) { + showLoggedUser(response); + Site.hideProgress(); + } + }); } + public void setState(final StateDTO state) { + StateToken token = state.getStateToken(); + if (state.getAccessLists().getViewers().getMode().equals(GroupListDTO.EVERYONE)) { + String publicUrl = token.getPublicUrl(); + view.setContentGotoPublicUrl(publicUrl); + view.setContentPublic(true); + } else { + view.setContentPublic(false); + } + + } + public void showAlertMessage(final String message) { view.showAlertMessage(message); } - public View getView() { - return view; + public void showLoggedUser(final UserInfoDTO user) { + if (user == null) { + view.restoreLoginLink(); + view.setLogoutLinkVisible(false); + } else { + view.showLoggedUserName(user.getShortName(), user.getHomePage()); + view.setLogoutLinkVisible(true); + view.setGroupsIsMember(user.getGroupsIsAdmin(), user.getGroupsIsCollab()); + } } - public void changeState(final StateToken token) { - listener.onChangeState(token); + public void showProgress(final String text) { + view.showProgress(text); } - public void onHelpInTranslation() { - DefaultDispatcher.getInstance().fire(WorkspaceEvents.SHOW_TRANSLATOR, null); + public void unMask() { + view.unMask(); } - public void mask() { - view.mask(); + public void userLoggedIn(final UserInfoDTO userInfoDTO) { + DefaultDispatcher.getInstance().fire(WorkspaceEvents.USER_LOGGED_IN, userInfoDTO); + view.hideLoginDialog(); + returnToPreviousState(); } - public void mask(final String message) { - view.mask(message); + protected void onSearchFocus() { + view.setTextSearchBig(); + view.clearSearchText(); } - public void unMask() { - view.unMask(); - } - protected void onSearchLostFocus(final String search) { if (search.length() == 0) { view.setDefaultTextSearch(); @@ -229,11 +236,6 @@ } } - protected void onSearchFocus() { - view.setTextSearchBig(); - view.clearSearchText(); - } - private void returnToPreviousState() { if (this.previousToken != null) { listener.onChangeState(new StateToken(this.previousToken)); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginForm.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginForm.java 2008-06-01 14:44:36 UTC (rev 772) @@ -1,6 +1,6 @@ package org.ourproject.kune.workspace.client.sitebar.login; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; import com.gwtext.client.widgets.form.TextField; @@ -12,35 +12,35 @@ private final TextField loginNickOrEmailField; private final TextField loginPassField; - public LoginForm() { - loginNickOrEmailField = new TextField(); - loginNickOrEmailField.setFieldLabel(Kune.I18N.t("Nickname or email")); - loginNickOrEmailField.setName(NICKOREMAIL_FIELD); - loginNickOrEmailField.setWidth(DEF_FIELD_WIDTH); - loginNickOrEmailField.setAllowBlank(false); - loginNickOrEmailField.setValidationEvent(false); - super.add(loginNickOrEmailField); + public LoginForm(final I18nTranslationService i18n) { + loginNickOrEmailField = new TextField(); + loginNickOrEmailField.setFieldLabel(i18n.t("Nickname or email")); + loginNickOrEmailField.setName(NICKOREMAIL_FIELD); + loginNickOrEmailField.setWidth(DEF_FIELD_WIDTH); + loginNickOrEmailField.setAllowBlank(false); + loginNickOrEmailField.setValidationEvent(false); + super.add(loginNickOrEmailField); - loginPassField = new TextField(); - loginPassField.setFieldLabel(Kune.I18N.t("Password")); - loginPassField.setName(PASSWORD_FIELD); - loginPassField.setWidth(DEF_FIELD_WIDTH); - loginPassField.setPassword(true); - loginPassField.setAllowBlank(false); - loginPassField.setValidationEvent(false); - super.add(loginPassField); + loginPassField = new TextField(); + loginPassField.setFieldLabel(i18n.t("Password")); + loginPassField.setName(PASSWORD_FIELD); + loginPassField.setWidth(DEF_FIELD_WIDTH); + loginPassField.setPassword(true); + loginPassField.setAllowBlank(false); + loginPassField.setValidationEvent(false); + super.add(loginPassField); } public void focusLogin() { - loginNickOrEmailField.focus(); + loginNickOrEmailField.focus(); } public String getLoginPassword() { - return loginPassField.getValueAsString(); + return loginPassField.getValueAsString(); } public String getNickOrEmail() { - return loginNickOrEmailField.getValueAsString(); + return loginNickOrEmailField.getValueAsString(); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.sitebar.login; import org.ourproject.kune.platf.client.View; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; import org.ourproject.kune.platf.client.ui.dialogs.InfoDialog; import org.ourproject.kune.workspace.client.newgroup.ui.SiteErrorType; @@ -82,8 +82,10 @@ private InfoDialog welcomeDialog; private TabPanel centerPanel; private MessagePanel messagesRegisterPanel; + private final I18nTranslationService i18n; - public LoginPanel(final LoginPresenter initialPresenter) { + public LoginPanel(final LoginPresenter initialPresenter, final I18nTranslationService i18n) { + this.i18n = i18n; Field.setMsgTarget("side"); this.presenter = initialPresenter; createPanel(); @@ -154,7 +156,7 @@ } public void maskProcessing() { - mask(Kune.I18N.t("Processing")); + mask(i18n.t("Processing")); } public void reset() { @@ -191,11 +193,11 @@ public void showWelcolmeDialog() { if (welcomeDialog == null) { - welcomeDialog = new InfoDialog(Kune.I18N.t("Welcome"), Kune.I18N.t("Thanks for registering"), Kune.I18N + welcomeDialog = new InfoDialog(i18n.t("Welcome"), i18n.t("Thanks for registering"), i18n .t("Now you can participate more actively in this site with other people and groups. " + "You can also use your personal space to publish contents. " + "Your email is not verified, please follow the instructions you will receive by email."), - true, true, 400, 270); + i18n.t("Ok"), true, true, 400, 270); } welcomeDialog.show(); } @@ -214,8 +216,8 @@ final Panel noAccRegisterPanel = new Panel(); noAccRegisterPanel.setBorder(false); noAccRegisterPanel.setMargins(0, 90, 0, 0); - final Label dontHaveAccountLabel = new Label(Kune.I18N.t("Don't have an account?")); - final Label registerLabel = new Label(Kune.I18N.t("Create one.")); + final Label dontHaveAccountLabel = new Label(i18n.t("Don't have an account?")); + final Label registerLabel = new Label(i18n.t("Create one.")); registerLabel.addClickListener(new ClickListener() { public void onClick(final Widget arg0) { centerPanel.activate(1); @@ -229,7 +231,7 @@ } private void createPanel() { - dialog = new BasicDialog(Kune.I18N.t("Sign in"), true, false, 370, 400); + dialog = new BasicDialog(i18n.t("Sign in"), true, false, 370, 400); dialog.setLayout(new FitLayout()); final Panel dialogPanel = new Panel(); dialogPanel.setLayout(new BorderLayout()); @@ -247,15 +249,15 @@ // centerPanel.setAutoHeight(true); centerPanel.setClosable(false); - final Panel signInPanel = new Panel(Kune.I18N.t("Sign in")); + final Panel signInPanel = new Panel(i18n.t("Sign in")); confPanel(signInPanel); - signInForm = new LoginForm(); + signInForm = new LoginForm(i18n); signInPanel.add(signInForm.getForm()); signInPanel.add(createNoAccountRegister()); messagesSignInPanel = new MessagePanel(); signInPanel.add(messagesSignInPanel); - final Panel registerPanel = new Panel(Kune.I18N.t("Register")); + final Panel registerPanel = new Panel(i18n.t("Register")); confPanel(registerPanel); centerPanel.add(signInPanel); @@ -263,7 +265,7 @@ dialogPanel.add(centerPanel, new BorderLayoutData(RegionPosition.CENTER)); dialog.add(dialogPanel); - final Button signInBtn = new Button(Kune.I18N.t("Sign in")); + final Button signInBtn = new Button(i18n.t("Sign in")); signInBtn.addListener(new ButtonListenerAdapter() { public void onClick(final Button button, final EventObject e) { signInForm.validate(); @@ -274,7 +276,7 @@ }); dialog.addButton(signInBtn); - final Button registerBtn = new Button(Kune.I18N.t("Register")); + final Button registerBtn = new Button(i18n.t("Register")); registerBtn.addListener(new ButtonListenerAdapter() { public void onClick(final Button button, final EventObject e) { registerForm.validate(); @@ -288,7 +290,7 @@ final Button cancel = new Button(); dialog.addButton(cancel); - cancel.setText(Kune.I18N.tWithNT("Cancel", "used in button")); + cancel.setText(i18n.tWithNT("Cancel", "used in button")); cancel.addListener(new ButtonListenerAdapter() { public void onClick(final Button button, final EventObject e) { presenter.onCancel(); @@ -297,7 +299,7 @@ signInPanel.addListener(new PanelListenerAdapter() { public void onActivate(final Panel panel) { - dialog.setTitle(Kune.I18N.t("Sign in")); + dialog.setTitle(i18n.t("Sign in")); registerBtn.hide(); signInBtn.show(); } @@ -307,7 +309,7 @@ public void onActivate(final Panel panel) { if (registerForm == null) { maskProcessing(); - registerForm = new RegisterForm(presenter); + registerForm = new RegisterForm(presenter, i18n); registerPanel.add(registerForm.getForm()); messagesRegisterPanel = new MessagePanel(); registerPanel.add(messagesRegisterPanel); @@ -315,7 +317,7 @@ renderDialogIfNeeded(); unMask(); } - dialog.setTitle(Kune.I18N.t("Register")); + dialog.setTitle(i18n.t("Register")); signInBtn.hide(); registerBtn.show(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/LoginPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -31,7 +31,7 @@ import org.ourproject.kune.platf.client.errors.GroupNameInUseException; import org.ourproject.kune.platf.client.errors.UserAuthException; import org.ourproject.kune.platf.client.rpc.ParamCallback; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.state.Session; import org.ourproject.kune.workspace.client.WorkspaceEvents; import org.ourproject.kune.workspace.client.newgroup.ui.SiteErrorType; @@ -49,9 +49,12 @@ private final Session session; - public LoginPresenter(final Session session, final LoginListener listener) { + private final I18nTranslationService i18n; + + public LoginPresenter(final Session session, final LoginListener listener, final I18nTranslationService i18n) { this.session = session; this.listener = listener; + this.i18n = i18n; } public void doLogin() { @@ -72,7 +75,7 @@ try { throw caught; } catch (final UserAuthException e) { - view.setSignInMessage(Kune.I18N.t("Incorrect nickname/email or password"), SiteErrorType.error); + view.setSignInMessage(i18n.t("Incorrect nickname/email or password"), SiteErrorType.error); } catch (final Throwable e) { view.setSignInMessage("Error in login", SiteErrorType.error); GWT.log("Other kind of exception in LoginFormPresenter/doLogin", null); @@ -112,13 +115,13 @@ try { throw caught; } catch (final EmailAddressInUseException e) { - view.setRegisterMessage(Kune.I18N.t("This email in in use by other person, try with another."), + view.setRegisterMessage(i18n.t("This email in in use by other person, try with another."), SiteErrorType.error); } catch (final GroupNameInUseException e) { - view.setRegisterMessage(Kune.I18N.t("This name in already in use, try with a different name."), + view.setRegisterMessage(i18n.t("This name in already in use, try with a different name."), SiteErrorType.error); } catch (final Throwable e) { - view.setRegisterMessage(Kune.I18N.t("Error during registration."), SiteErrorType.error); + view.setRegisterMessage(i18n.t("Error during registration."), SiteErrorType.error); GWT.log("Other kind of exception in user registration", null); throw new RuntimeException(); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/RegisterForm.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/RegisterForm.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/sitebar/login/RegisterForm.java 2008-06-01 14:44:36 UTC (rev 772) @@ -1,6 +1,6 @@ package org.ourproject.kune.workspace.client.sitebar.login; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.dialogs.DefaultForm; import com.gwtext.client.data.SimpleStore; @@ -33,172 +33,175 @@ private final ComboBox countryCombo; private final ComboBox timezoneCombo; - public RegisterForm(final LoginPresenter presenter) { - shortNameRegField = new TextField(); - shortNameRegField.setFieldLabel(Kune.I18N.t("Nickname")); - shortNameRegField.setName(NICK_FIELD); - shortNameRegField.setWidth(DEF_FIELD_WIDTH); - shortNameRegField.setAllowBlank(false); - shortNameRegField.setMinLength(3); - shortNameRegField.setMaxLength(15); - shortNameRegField.setRegex("^[a-z0-9_\\-]+$"); - shortNameRegField.setMinLengthText(Kune.I18N.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameRegField.setMaxLengthText(Kune.I18N.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameRegField.setRegexText(Kune.I18N.t(MUST_BE_BETWEEN_3_AND_15)); - shortNameRegField.setValidationEvent(false); - add(shortNameRegField); + private final I18nTranslationService i18n; - longNameRegField = new TextField(); - longNameRegField.setFieldLabel(Kune.I18N.t("Full Name")); - longNameRegField.setName(LONGNAME_FIELD); - longNameRegField.setWidth(DEF_FIELD_WIDTH); - longNameRegField.setAllowBlank(false); - longNameRegField.setMinLength(3); - longNameRegField.setMaxLength(50); - longNameRegField.setValidationEvent(false); - add(longNameRegField); + public RegisterForm(final LoginPresenter presenter, final I18nTranslationService i18n) { + this.i18n = i18n; + shortNameRegField = new TextField(); + shortNameRegField.setFieldLabel(i18n.t("Nickname")); + shortNameRegField.setName(NICK_FIELD); + shortNameRegField.setWidth(DEF_FIELD_WIDTH); + shortNameRegField.setAllowBlank(false); + shortNameRegField.setMinLength(3); + shortNameRegField.setMaxLength(15); + shortNameRegField.setRegex("^[a-z0-9_\\-]+$"); + shortNameRegField.setMinLengthText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); + shortNameRegField.setMaxLengthText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); + shortNameRegField.setRegexText(i18n.t(MUST_BE_BETWEEN_3_AND_15)); + shortNameRegField.setValidationEvent(false); + add(shortNameRegField); - passwdRegField = new TextField(); - passwdRegField.setFieldLabel(Kune.I18N.t("Password")); - passwdRegField.setName(PASSWORD_FIELD); - passwdRegField.setPassword(true); - passwdRegField.setAllowBlank(false); - passwdRegField.setMaxLength(40); - passwdRegField.setWidth(DEF_FIELD_WIDTH); - passwdRegField.setValidationEvent(false); - add(passwdRegField); + longNameRegField = new TextField(); + longNameRegField.setFieldLabel(i18n.t("Full Name")); + longNameRegField.setName(LONGNAME_FIELD); + longNameRegField.setWidth(DEF_FIELD_WIDTH); + longNameRegField.setAllowBlank(false); + longNameRegField.setMinLength(3); + longNameRegField.setMaxLength(50); + longNameRegField.setValidationEvent(false); + add(longNameRegField); - passwdRegFieldDup = new TextField(); - passwdRegFieldDup.setFieldLabel(Kune.I18N.t("Retype password")); - passwdRegFieldDup.setName(PASSWORD_FIELD_DUP); - passwdRegFieldDup.setPassword(true); - passwdRegFieldDup.setAllowBlank(false); - passwdRegFieldDup.setMinLength(6); - passwdRegFieldDup.setMaxLength(40); - passwdRegFieldDup.setWidth(DEF_FIELD_WIDTH); - passwdRegFieldDup.setInvalidText(Kune.I18N.t("Passwords do not match")); - passwdRegFieldDup.setValidator(new Validator() { - public boolean validate(final String value) throws ValidationException { - return passwdRegField.getValueAsString().equals(passwdRegFieldDup.getValueAsString()); - } - }); - passwdRegFieldDup.setValidationEvent(false); - add(passwdRegFieldDup); + passwdRegField = new TextField(); + passwdRegField.setFieldLabel(i18n.t("Password")); + passwdRegField.setName(PASSWORD_FIELD); + passwdRegField.setPassword(true); + passwdRegField.setAllowBlank(false); + passwdRegField.setMaxLength(40); + passwdRegField.setWidth(DEF_FIELD_WIDTH); + passwdRegField.setValidationEvent(false); + add(passwdRegField); - emailRegField = new TextField(); - emailRegField.setFieldLabel(Kune.I18N.t("Email")); - emailRegField.setName(EMAIL_FIELD); - emailRegField.setVtype(VType.EMAIL); - emailRegField.setWidth(DEF_FIELD_WIDTH); - emailRegField.setAllowBlank(false); - emailRegField.setValidationEvent(false); + passwdRegFieldDup = new TextField(); + passwdRegFieldDup.setFieldLabel(i18n.t("Retype password")); + passwdRegFieldDup.setName(PASSWORD_FIELD_DUP); + passwdRegFieldDup.setPassword(true); + passwdRegFieldDup.setAllowBlank(false); + passwdRegFieldDup.setMinLength(6); + passwdRegFieldDup.setMaxLength(40); + passwdRegFieldDup.setWidth(DEF_FIELD_WIDTH); + passwdRegFieldDup.setInvalidText(i18n.t("Passwords do not match")); + passwdRegFieldDup.setValidator(new Validator() { + public boolean validate(final String value) throws ValidationException { + return passwdRegField.getValueAsString().equals(passwdRegFieldDup.getValueAsString()); + } + }); + passwdRegFieldDup.setValidationEvent(false); + add(passwdRegFieldDup); - add(emailRegField); + emailRegField = new TextField(); + emailRegField.setFieldLabel(i18n.t("Email")); + emailRegField.setName(EMAIL_FIELD); + emailRegField.setVtype(VType.EMAIL); + emailRegField.setWidth(DEF_FIELD_WIDTH); + emailRegField.setAllowBlank(false); + emailRegField.setValidationEvent(false); - final Store langStore = new SimpleStore(new String[] { "abbr", "language" }, presenter.getLanguages()); - langStore.load(); + add(emailRegField); - languageCombo = new ComboBox(); - languageCombo.setName(LANG_FIELD); - languageCombo.setMinChars(1); - languageCombo.setFieldLabel(Kune.I18N.t("Language")); - languageCombo.setStore(langStore); - languageCombo.setDisplayField("language"); - languageCombo.setMode(ComboBox.LOCAL); - languageCombo.setTriggerAction(ComboBox.ALL); - languageCombo.setEmptyText(Kune.I18N.t("Enter language")); - languageCombo.setLoadingText(Kune.I18N.t("Searching...")); - languageCombo.setTypeAhead(true); - languageCombo.setTypeAheadDelay(1000); - languageCombo.setSelectOnFocus(false); - languageCombo.setWidth(186); - languageCombo.setAllowBlank(false); - languageCombo.setValueField("abbr"); - languageCombo.setValue(presenter.getCurrentLanguage().getCode()); - languageCombo.setPageSize(7); - languageCombo.setForceSelection(true); - languageCombo.setValidationEvent(false); - add(languageCombo); + final Store langStore = new SimpleStore(new String[] { "abbr", "language" }, presenter.getLanguages()); + langStore.load(); - final Store countryStore = new SimpleStore(new String[] { "abbr", "country" }, presenter.getCountries()); - countryStore.load(); + languageCombo = new ComboBox(); + languageCombo.setName(LANG_FIELD); + languageCombo.setMinChars(1); + languageCombo.setFieldLabel(i18n.t("Language")); + languageCombo.setStore(langStore); + languageCombo.setDisplayField("language"); + languageCombo.setMode(ComboBox.LOCAL); + languageCombo.setTriggerAction(ComboBox.ALL); + languageCombo.setEmptyText(i18n.t("Enter language")); + languageCombo.setLoadingText(i18n.t("Searching...")); + languageCombo.setTypeAhead(true); + languageCombo.setTypeAheadDelay(1000); + languageCombo.setSelectOnFocus(false); + languageCombo.setWidth(186); + languageCombo.setAllowBlank(false); + languageCombo.setValueField("abbr"); + languageCombo.setValue(presenter.getCurrentLanguage().getCode()); + languageCombo.setPageSize(7); + languageCombo.setForceSelection(true); + languageCombo.setValidationEvent(false); + add(languageCombo); - countryCombo = new ComboBox(); - countryCombo.setName(COUNTRY_FIELD); - countryCombo.setMinChars(1); - countryCombo.setFieldLabel(Kune.I18N.t("Country")); - countryCombo.setStore(countryStore); - countryCombo.setDisplayField("country"); - countryCombo.setMode(ComboBox.LOCAL); - countryCombo.setTriggerAction(ComboBox.ALL); - countryCombo.setEmptyText(Kune.I18N.t("Enter your country")); - countryCombo.setLoadingText(Kune.I18N.t("Searching...")); - countryCombo.setTypeAhead(true); - countryCombo.setTypeAheadDelay(1000); - countryCombo.setSelectOnFocus(false); - countryCombo.setWidth(186); - countryCombo.setAllowBlank(false); - countryCombo.setValueField("abbr"); - countryCombo.setPageSize(7); - countryCombo.setForceSelection(true); - countryCombo.setValidationEvent(false); - add(countryCombo); + final Store countryStore = new SimpleStore(new String[] { "abbr", "country" }, presenter.getCountries()); + countryStore.load(); - final Store timezoneStore = new SimpleStore(new String[] { "id" }, presenter.getTimezones()); - timezoneStore.load(); + countryCombo = new ComboBox(); + countryCombo.setName(COUNTRY_FIELD); + countryCombo.setMinChars(1); + countryCombo.setFieldLabel(i18n.t("Country")); + countryCombo.setStore(countryStore); + countryCombo.setDisplayField("country"); + countryCombo.setMode(ComboBox.LOCAL); + countryCombo.setTriggerAction(ComboBox.ALL); + countryCombo.setEmptyText(i18n.t("Enter your country")); + countryCombo.setLoadingText(i18n.t("Searching...")); + countryCombo.setTypeAhead(true); + countryCombo.setTypeAheadDelay(1000); + countryCombo.setSelectOnFocus(false); + countryCombo.setWidth(186); + countryCombo.setAllowBlank(false); + countryCombo.setValueField("abbr"); + countryCombo.setPageSize(7); + countryCombo.setForceSelection(true); + countryCombo.setValidationEvent(false); + add(countryCombo); - timezoneCombo = new ComboBox(); - timezoneCombo.setName(TIMEZONE_FIELD); - timezoneCombo.setMinChars(1); - timezoneCombo.setFieldLabel(Kune.I18N.t("Timezone")); - timezoneCombo.setStore(timezoneStore); - timezoneCombo.setDisplayField("id"); - timezoneCombo.setMode(ComboBox.LOCAL); - timezoneCombo.setTriggerAction(ComboBox.ALL); - timezoneCombo.setEmptyText(Kune.I18N.t("Enter your timezone")); - timezoneCombo.setLoadingText(Kune.I18N.t("Searching...")); - timezoneCombo.setTypeAhead(true); - timezoneCombo.setTypeAheadDelay(1000); - timezoneCombo.setSelectOnFocus(false); - timezoneCombo.setWidth(186); - timezoneCombo.setAllowBlank(false); - timezoneCombo.setValueField("id"); - timezoneCombo.setPageSize(7); - timezoneCombo.setForceSelection(true); - timezoneCombo.setValidationEvent(false); - add(timezoneCombo); + final Store timezoneStore = new SimpleStore(new String[] { "id" }, presenter.getTimezones()); + timezoneStore.load(); + + timezoneCombo = new ComboBox(); + timezoneCombo.setName(TIMEZONE_FIELD); + timezoneCombo.setMinChars(1); + timezoneCombo.setFieldLabel(i18n.t("Timezone")); + timezoneCombo.setStore(timezoneStore); + timezoneCombo.setDisplayField("id"); + timezoneCombo.setMode(ComboBox.LOCAL); + timezoneCombo.setTriggerAction(ComboBox.ALL); + timezoneCombo.setEmptyText(i18n.t("Enter your timezone")); + timezoneCombo.setLoadingText(i18n.t("Searching...")); + timezoneCombo.setTypeAhead(true); + timezoneCombo.setTypeAheadDelay(1000); + timezoneCombo.setSelectOnFocus(false); + timezoneCombo.setWidth(186); + timezoneCombo.setAllowBlank(false); + timezoneCombo.setValueField("id"); + timezoneCombo.setPageSize(7); + timezoneCombo.setForceSelection(true); + timezoneCombo.setValidationEvent(false); + add(timezoneCombo); } public String getCountry() { - return countryCombo.getValueAsString(); + return countryCombo.getValueAsString(); } public String getEmail() { - return emailRegField.getValueAsString(); + return emailRegField.getValueAsString(); } public String getLanguage() { - return languageCombo.getValueAsString(); + return languageCombo.getValueAsString(); } public String getLongName() { - return longNameRegField.getValueAsString(); + return longNameRegField.getValueAsString(); } public String getRegisterPassword() { - return passwdRegField.getValueAsString(); + return passwdRegField.getValueAsString(); } public String getRegisterPasswordDup() { - return passwdRegFieldDup.getValueAsString(); + return passwdRegFieldDup.getValueAsString(); } public String getShortName() { - return shortNameRegField.getValueAsString(); + return shortNameRegField.getValueAsString(); } public String getTimezone() { - return timezoneCombo.getValueAsString(); + return timezoneCombo.getValueAsString(); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersPresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/GroupMembersPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -23,6 +23,7 @@ import java.util.List; import org.ourproject.kune.platf.client.AbstractPresenter; +import org.ourproject.kune.platf.client.PlatformEvents; import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher; import org.ourproject.kune.platf.client.dto.AccessListsDTO; @@ -30,21 +31,52 @@ import org.ourproject.kune.platf.client.dto.GroupDTO; import org.ourproject.kune.platf.client.dto.SocialNetworkDTO; import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.WorkspaceEvents; import org.ourproject.kune.workspace.client.workspace.GroupMembersComponent; public class GroupMembersPresenter extends AbstractPresenter implements GroupMembersComponent, EntityLiveSearchListener { - private static final String ADMIN_CATEGORY = Kune.I18N.t("Admins"); - private static final String COLLAB_CATEGORY = Kune.I18N.t("Collaborators"); - private static final String PENDING_CATEGORY = Kune.I18N.t("Pending"); private GroupMembersView view; + private final I18nTranslationService i18n; + private final String adminCategory; + private final String collabCategory; + private final String pendigCategory; + private final MemberAction gotoGroupCommand; + public GroupMembersPresenter(final I18nTranslationService i18n) { + this.i18n = i18n; + adminCategory = i18n.t("Admins"); + collabCategory = i18n.t("Collaborators"); + pendigCategory = i18n.t("Pending"); + gotoGroupCommand = new MemberAction(i18n.t("Visit this member homepage"), PlatformEvents.GOTO); + + } + + public void addCollab(final String groupShortName) { + DefaultDispatcher.getInstance().fire(WorkspaceEvents.ADD_COLLAB_MEMBER, groupShortName); + } + + public View getView() { + return view; + } + + public void hide() { + view.hide(); + } + public void init(final GroupMembersView view) { this.view = view; } + public void onJoin() { + DefaultDispatcher.getInstance().fire(WorkspaceEvents.REQ_JOIN_GROUP, null); + } + + public void onSelection(final String groupShortName, final String groupLongName) { + view.confirmAddCollab(groupShortName, groupLongName); + } + public void setGroupMembers(final StateDTO state) { if (state.getGroup().getType() == GroupDTO.PERSONAL) { hide(); @@ -53,6 +85,48 @@ } } + public void showAdmins() { + view.showCategory(adminCategory); + } + + public void showCollabs() { + view.showCategory(collabCategory); + } + + private void addMembers(final List<GroupDTO> adminsList, final List<GroupDTO> collabList, + final List<GroupDTO> pendingCollabsList, final int numAdmins, final int numCollaborators, + final int numPendingCollabs, final boolean isAdmin, final MemberAction[] adminsActions, + final MemberAction[] collabActions, final MemberAction[] pendingsActions, final MemberAction[] viewerActions) { + if (numAdmins > 0) { + view.addCategory(adminCategory, i18n.t("People that can admin this group")); + iteraList(adminCategory, adminsList, adminsActions); + } + if (numCollaborators > 0) { + view.addCategory(collabCategory, i18n.t("Other people that collaborate with this group")); + iteraList(collabCategory, collabList, collabActions); + } + if (isAdmin) { + if (numPendingCollabs > 0) { + view.addCategory(pendigCategory, i18n.t("People pending to be accepted in this group by the admins"), + GroupMembersView.ICON_ALERT); + iteraList(pendigCategory, pendingCollabsList, pendingsActions); + } + } + + } + + private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) { + return userIsAdmin || userIsCollab; + } + + private void iteraList(final String categoryName, final List<GroupDTO> groupList, final MemberAction[] actions) { + final Iterator<GroupDTO> iter = groupList.iterator(); + while (iter.hasNext()) { + final GroupDTO group = iter.next(); + view.addCategoryMember(categoryName, group.getShortName(), group.getLongName(), actions); + } + } + private void setGroupMembers(final SocialNetworkDTO socialNetwork, final AccessRightsDTO rights) { final AccessListsDTO accessLists = socialNetwork.getAccessLists(); @@ -83,32 +157,32 @@ } if (numAdmins == 0 && numCollaborators == 0) { - view.addComment(Kune.I18N.t("This is an orphaned project, if you are interested " + view.addComment(i18n.t("This is an orphaned project, if you are interested " + "please request to join to work on it")); } if (userCanView) { if (rights.isAdministrable()) { MemberAction[] adminsActions = { - new MemberAction(Kune.I18N.t("Remove this member"), WorkspaceEvents.DEL_MEMBER), - new MemberAction(Kune.I18N.t("Change to collaborator"), WorkspaceEvents.SET_ADMIN_AS_COLLAB), - MemberAction.GOTO_GROUP_COMMAND }; + new MemberAction(i18n.t("Remove this member"), WorkspaceEvents.DEL_MEMBER), + new MemberAction(i18n.t("Change to collaborator"), WorkspaceEvents.SET_ADMIN_AS_COLLAB), + gotoGroupCommand }; MemberAction[] collabActions = { - new MemberAction(Kune.I18N.t("Remove this member"), WorkspaceEvents.DEL_MEMBER), - new MemberAction(Kune.I18N.t("Change to admin"), WorkspaceEvents.SET_COLLAB_AS_ADMIN), - MemberAction.GOTO_GROUP_COMMAND }; + new MemberAction(i18n.t("Remove this member"), WorkspaceEvents.DEL_MEMBER), + new MemberAction(i18n.t("Change to admin"), WorkspaceEvents.SET_COLLAB_AS_ADMIN), + gotoGroupCommand }; MemberAction[] pendingsActions = { - new MemberAction(Kune.I18N.t("Accept this member"), WorkspaceEvents.ACCEPT_JOIN_GROUP), - new MemberAction(Kune.I18N.t("Don't accept this member"), WorkspaceEvents.DENY_JOIN_GROUP), - MemberAction.GOTO_GROUP_COMMAND }; - MemberAction[] viewerActions = { MemberAction.GOTO_GROUP_COMMAND }; + new MemberAction(i18n.t("Accept this member"), WorkspaceEvents.ACCEPT_JOIN_GROUP), + new MemberAction(i18n.t("Don't accept this member"), WorkspaceEvents.DENY_JOIN_GROUP), + gotoGroupCommand }; + MemberAction[] viewerActions = { gotoGroupCommand }; addMembers(adminsList, collabList, pendingCollabsList, numAdmins, numCollaborators, numPendingCollabs, userIsAdmin, adminsActions, collabActions, pendingsActions, viewerActions); } else if (rights.isEditable() || rights.isVisible()) { - MemberAction[] adminsActions = { MemberAction.GOTO_GROUP_COMMAND }; - MemberAction[] collabActions = { MemberAction.GOTO_GROUP_COMMAND }; - MemberAction[] pendingsActions = { MemberAction.GOTO_GROUP_COMMAND }; - MemberAction[] viewerActions = { MemberAction.GOTO_GROUP_COMMAND }; + MemberAction[] adminsActions = { gotoGroupCommand }; + MemberAction[] collabActions = { gotoGroupCommand }; + MemberAction[] pendingsActions = { gotoGroupCommand }; + MemberAction[] viewerActions = { gotoGroupCommand }; addMembers(adminsList, collabList, pendingCollabsList, numAdmins, numCollaborators, numPendingCollabs, userIsAdmin, adminsActions, collabActions, pendingsActions, viewerActions); } @@ -117,66 +191,4 @@ view.show(); } - public void showAdmins() { - view.showCategory(ADMIN_CATEGORY); - } - - public void showCollabs() { - view.showCategory(COLLAB_CATEGORY); - } - - public void hide() { - view.hide(); - } - - public void onJoin() { - DefaultDispatcher.getInstance().fire(WorkspaceEvents.REQ_JOIN_GROUP, null); - } - - public void onSelection(final String groupShortName, final String groupLongName) { - view.confirmAddCollab(groupShortName, groupLongName); - } - - public View getView() { - return view; - } - - private void addMembers(final List<GroupDTO> adminsList, final List<GroupDTO> collabList, - final List<GroupDTO> pendingCollabsList, final int numAdmins, final int numCollaborators, - final int numPendingCollabs, final boolean isAdmin, final MemberAction[] adminsActions, - final MemberAction[] collabActions, final MemberAction[] pendingsActions, final MemberAction[] viewerActions) { - if (numAdmins > 0) { - view.addCategory(ADMIN_CATEGORY, Kune.I18N.t("People that can admin this group")); - iteraList(ADMIN_CATEGORY, adminsList, adminsActions); - } - if (numCollaborators > 0) { - view.addCategory(COLLAB_CATEGORY, Kune.I18N.t("Other people that collaborate with this group")); - iteraList(COLLAB_CATEGORY, collabList, collabActions); - } - if (isAdmin) { - if (numPendingCollabs > 0) { - view.addCategory(PENDING_CATEGORY, Kune.I18N - .t("People pending to be accepted in this group by the admins"), GroupMembersView.ICON_ALERT); - iteraList(PENDING_CATEGORY, pendingCollabsList, pendingsActions); - } - } - - } - - private void iteraList(final String categoryName, final List<GroupDTO> groupList, final MemberAction[] actions) { - final Iterator<GroupDTO> iter = groupList.iterator(); - while (iter.hasNext()) { - final GroupDTO group = iter.next(); - view.addCategoryMember(categoryName, group.getShortName(), group.getLongName(), actions); - } - } - - private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) { - return userIsAdmin || userIsCollab; - } - - public void addCollab(final String groupShortName) { - DefaultDispatcher.getInstance().fire(WorkspaceEvents.ADD_COLLAB_MEMBER, groupShortName); - } - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/MemberAction.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/MemberAction.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/MemberAction.java 2008-06-01 14:44:36 UTC (rev 772) @@ -19,14 +19,9 @@ */ package org.ourproject.kune.workspace.client.socialnet; -import org.ourproject.kune.platf.client.PlatformEvents; -import org.ourproject.kune.platf.client.services.Kune; public class MemberAction { - public final static MemberAction GOTO_GROUP_COMMAND = new MemberAction(Kune.I18N.t("Visit this member homepage"), - PlatformEvents.GOTO); - private final String text; private final String action; @@ -35,11 +30,11 @@ this.action = action; } - public String getText() { - return text; - } - public String getAction() { return action; } + + public String getText() { + return text; + } } \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationPresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ParticipationPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -29,36 +29,44 @@ import org.ourproject.kune.platf.client.dto.LinkDTO; import org.ourproject.kune.platf.client.dto.ParticipationDataDTO; import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.WorkspaceEvents; import org.ourproject.kune.workspace.client.workspace.ParticipationComponent; public class ParticipationPresenter extends AbstractPresenter implements ParticipationComponent { - private static final String ADMIN_SUBTITLE = Kune.I18N.t("admin in:"); - private final static MemberAction GOTO_GROUP_COMMAND = new MemberAction(Kune.I18N.t("Visit this group homepage"), - PlatformEvents.GOTO); - private ParticipationView view; - public void init(final ParticipationView view) { - this.view = view; + private final I18nTranslationService i18n; + + private final String admin_subtitle; + + private final MemberAction goto_group_command; + + public ParticipationPresenter(final I18nTranslationService i18n) { + this.i18n = i18n; + admin_subtitle = i18n.t("admin in:"); + goto_group_command = new MemberAction(i18n.t("Visit this group homepage"), PlatformEvents.GOTO); } public View getView() { return view; } + public void init(final ParticipationView view) { + this.view = view; + } + public void setParticipation(final StateDTO state) { ParticipationDataDTO participation = state.getParticipation(); AccessRightsDTO rights = state.getGroupRights(); view.setDropDownContentVisible(false); view.clear(); MemberAction[] adminsActions = { - new MemberAction(Kune.I18N.t("Don't participate more in this group"), WorkspaceEvents.UNJOIN_GROUP), - GOTO_GROUP_COMMAND }; + new MemberAction(i18n.t("Don't participate more in this group"), WorkspaceEvents.UNJOIN_GROUP), + goto_group_command }; MemberAction[] collabActions = adminsActions; - MemberAction[] viewerActions = { GOTO_GROUP_COMMAND }; + MemberAction[] viewerActions = { goto_group_command }; List<LinkDTO> groupsIsAdmin = participation.getGroupsIsAdmin(); List<LinkDTO> groupsIsCollab = participation.getGroupsIsCollab(); boolean userIsAdmin = rights.isAdministrable(); @@ -77,10 +85,6 @@ } - private void hide() { - view.hide(); - } - private void addParticipants(final List<LinkDTO> groupsIsAdmin, final List<LinkDTO> groupsIsCollab, final int numAdmins, final int numCollaborators, final boolean userIsAdmin, boolean userIsMember, final MemberAction[] adminsActions, final MemberAction[] collabActions, final MemberAction[] viewerActions) { @@ -97,19 +101,27 @@ } } if (numAdmins > 0) { - view.addCategory(ADMIN_SUBTITLE, Kune.I18N.tWithNT("Administrate these groups", "talking about a person")); - iteraList(ADMIN_SUBTITLE, groupsIsAdmin, actions); - collabTitle = Kune.I18N.t("and as collaborator in:"); + view.addCategory(admin_subtitle, i18n.tWithNT("Administrate these groups", "talking about a person")); + iteraList(admin_subtitle, groupsIsAdmin, actions); + collabTitle = i18n.t("and as collaborator in:"); } else { - collabTitle = Kune.I18N.t("collaborator in:"); + collabTitle = i18n.t("collaborator in:"); } if (numCollaborators > 0) { - view.addCategory(collabTitle, Kune.I18N.t("Collaborate in these groups")); + view.addCategory(collabTitle, i18n.t("Collaborate in these groups")); iteraList(collabTitle, groupsIsCollab, actions); } } + private void hide() { + view.hide(); + } + + private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) { + return userIsAdmin || userIsCollab; + } + private void iteraList(final String categoryName, final List<LinkDTO> groupList, final MemberAction[] actions) { final Iterator<LinkDTO> iter = groupList.iterator(); while (iter.hasNext()) { @@ -117,8 +129,4 @@ view.addCategoryMember(categoryName, group.getShortName(), group.getLongName(), actions); } } - - private boolean isMember(final boolean userIsAdmin, final boolean userIsCollab) { - return userIsAdmin || userIsCollab; - } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/EntityLiveSearchPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/EntityLiveSearchPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/EntityLiveSearchPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.socialnet.ui; import org.ourproject.kune.platf.client.AbstractPresenter; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.dialogs.BasicDialog; import org.ourproject.kune.workspace.client.socialnet.EntityLiveSearchView; import org.ourproject.kune.workspace.client.socialnet.GroupLiveSearchPresenter; @@ -47,19 +47,17 @@ private BasicDialog dialog; private final int searchType; private FormPanel searchForm; + private final I18nTranslationService i18n; - public EntityLiveSearchPanel(final AbstractPresenter initPresenter, final int searchType) { + public EntityLiveSearchPanel(final AbstractPresenter initPresenter, final int searchType, + final I18nTranslationService i18n) { this.presenter = initPresenter; this.searchType = searchType; + this.i18n = i18n; } - public void show() { - if (dialog == null) { - createGroupSearchDialog(searchType); - } - dialog.show(); + public void center() { dialog.center(); - // DOM.setStyleAttribute(dialog.getElement(), "zIndex", "10000"); } public void hide() { @@ -67,16 +65,21 @@ searchForm.getForm().reset(); } - public void center() { + public void show() { + if (dialog == null) { + createGroupSearchDialog(searchType); + } + dialog.show(); dialog.center(); + // DOM.setStyleAttribute(dialog.getElement(), "zIndex", "10000"); } private void createGroupSearchDialog(final int searchType) { String title; if (searchType == EntityLiveSearchView.SEARCH_GROUPS) { - title = Kune.I18N.t("Search existing users and groups"); + title = i18n.t("Search existing users and groups"); } else { - title = Kune.I18N.t("Search existing users"); + title = i18n.t("Search existing users"); } dialog = new BasicDialog(title, true, false, 285, 55); dialog.setClosable(true); @@ -114,10 +117,10 @@ "<div class=\"search-item\"><span class=\"kune-IconHyperlink\"><img alt=\"group logo\" src=\"images/group-def-icon.png\" style=\"height: 16px; width: 16px;\" />{shortName}: {longName}</span></div>"); ComboBox cb = new ComboBox(); cb.setStore(store); - cb.setEmptyText(Kune.I18N.t("Write here to search")); + cb.setEmptyText(i18n.t("Write here to search")); cb.setDisplayField("longName"); cb.setTypeAhead(true); - cb.setLoadingText(Kune.I18N.t("Searching...")); + cb.setLoadingText(i18n.t("Searching...")); cb.setWidth(268); cb.setPageSize(PAGINATION_SIZE); cb.setTpl(resultTpl); @@ -126,7 +129,7 @@ cb.setSelectOnFocus(false); cb.setHideTrigger(true); cb.setHideLabel(true); - // setTitle(Kune.I18N.t("User or group")); + // setTitle(i18n.t("User or group")); cb.setItemSelector("div.search-item"); cb.addListener(new ComboBoxListenerAdapter() { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/GroupLiveSearchPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/GroupLiveSearchPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/GroupLiveSearchPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,12 +20,13 @@ package org.ourproject.kune.workspace.client.socialnet.ui; import org.ourproject.kune.platf.client.AbstractPresenter; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.socialnet.EntityLiveSearchView; public class GroupLiveSearchPanel extends EntityLiveSearchPanel { - public GroupLiveSearchPanel(final AbstractPresenter presenter) { - super(presenter, EntityLiveSearchView.SEARCH_GROUPS); + public GroupLiveSearchPanel(final AbstractPresenter presenter, final I18nTranslationService i18n) { + super(presenter, EntityLiveSearchView.SEARCH_GROUPS, i18n); } } \ No newline at end of file Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/GroupMembersPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/GroupMembersPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/GroupMembersPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,8 +20,8 @@ package org.ourproject.kune.workspace.client.socialnet.ui; import org.ourproject.kune.platf.client.PlatformEvents; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.UIConstants; import org.ourproject.kune.platf.client.ui.stacks.StackSubItemAction; import org.ourproject.kune.platf.client.ui.stacks.StackedDropDownPanel; @@ -37,45 +37,25 @@ private static final boolean COUNTS_VISIBLE = true; private final Images img = Images.App.getInstance(); private final GroupMembersPresenter presenter; + private final I18nTranslationService i18n; - public GroupMembersPanel(final GroupMembersPresenter initPresenter) { - super(initPresenter, "#00D4AA", Kune.I18N.t("Group members"), Kune.I18N + public GroupMembersPanel(final GroupMembersPresenter initPresenter, final I18nTranslationService i18n) { + super(initPresenter, "#00D4AA", i18n.t("Group members"), i18n .t("People and groups collaborating in this group"), COUNTS_VISIBLE); presenter = initPresenter; + this.i18n = i18n; } - public void addJoinLink() { - super.addBottomLink(img.addGreen(), Kune.I18N.t("Request to join"), Kune.I18N - .t("Request to participate in this group"), WorkspaceEvents.REQ_JOIN_GROUP); - } - - public void addUnjoinLink() { - super.addBottomLink(img.del(), Kune.I18N.t("Unjoin this group"), Kune.I18N - .t("Don't participate more as a member in this group"), WorkspaceEvents.UNJOIN_GROUP); - } - public void addAddMemberLink() { - super.addBottomLink(img.addGreen(), Kune.I18N.t("Add member"), Kune.I18N + super.addBottomLink(img.addGreen(), i18n.t("Add member"), i18n .t("Add a group or a person as member of this group"), WorkspaceEvents.ADD_MEMBER_GROUPLIVESEARCH, presenter); } - public void clear() { - super.clear(); - } - - public void addComment(final String comment) { - super.addComment(comment); - } - public void addCategory(final String name, final String title) { super.addStackItem(name, title, COUNTS_VISIBLE); } - public void showCategory(final String name) { - super.showStackItem(name); - } - public void addCategory(final String name, final String title, final String iconType) { super.addStackItem(name, title, getIcon(iconType), UIConstants.ICON_HORIZ_ALIGN_RIGHT, COUNTS_VISIBLE); } @@ -91,17 +71,27 @@ super.addStackSubItem(categoryName, img.groupDefIcon(), name, title, subItems); } - public void show() { - this.setVisible(true); + public void addComment(final String comment) { + super.addComment(comment); } - public void hide() { - this.setVisible(false); + public void addJoinLink() { + super.addBottomLink(img.addGreen(), i18n.t("Request to join"), i18n.t("Request to participate in this group"), + WorkspaceEvents.REQ_JOIN_GROUP); } + public void addUnjoinLink() { + super.addBottomLink(img.del(), i18n.t("Unjoin this group"), i18n + .t("Don't participate more as a member in this group"), WorkspaceEvents.UNJOIN_GROUP); + } + + public void clear() { + super.clear(); + } + public void confirmAddCollab(final String groupShortName, final String groupLongName) { String groupName = groupLongName + " (" + groupShortName + ")"; - MessageBox.confirm(Kune.I18N.t("Confirm addition of member"), Kune.I18N.t("Add [%s] as member?", groupName), + MessageBox.confirm(i18n.t("Confirm addition of member"), i18n.t("Add [%s] as member?", groupName), new MessageBox.ConfirmCallback() { public void execute(final String btnID) { if (btnID.equals("yes")) { @@ -111,6 +101,18 @@ }); } + public void hide() { + this.setVisible(false); + } + + public void show() { + this.setVisible(true); + } + + public void showCategory(final String name) { + super.showStackItem(name); + } + private AbstractImagePrototype getIcon(final String event) { if (event == GroupMembersView.ICON_ALERT) { return img.alert(); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/ParticipationPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/ParticipationPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/ParticipationPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -21,8 +21,8 @@ import org.ourproject.kune.platf.client.AbstractPresenter; import org.ourproject.kune.platf.client.PlatformEvents; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.UIConstants; import org.ourproject.kune.platf.client.ui.stacks.StackSubItemAction; import org.ourproject.kune.platf.client.ui.stacks.StackedDropDownPanel; @@ -38,15 +38,11 @@ private static final boolean COUNTS_VISIBLE = false; private final Images img = Images.App.getInstance(); - public ParticipationPanel(final AbstractPresenter presenter) { - super(presenter, "#00D4AA", Kune.I18N.t("Participates as..."), Kune.I18N.t("Groups in which participates"), + public ParticipationPanel(final AbstractPresenter presenter, final I18nTranslationService i18n) { + super(presenter, "#00D4AA", i18n.t("Participates as..."), i18n.t("Groups in which participates"), COUNTS_VISIBLE); } - public void clear() { - super.clear(); - } - public void addCategory(final String name, final String title) { super.addStackItem(name, title, COUNTS_VISIBLE); } @@ -66,6 +62,18 @@ super.addStackSubItem(categoryName, img.groupDefIcon(), name, title, subItems); } + public void clear() { + super.clear(); + } + + public void hide() { + this.setVisible(false); + } + + public void show() { + this.setVisible(true); + } + private AbstractImagePrototype getIcon(final String event) { if (event == GroupMembersView.ICON_ALERT) { return img.alert(); @@ -83,12 +91,4 @@ throw new IndexOutOfBoundsException("Event unknown in ParticipationPanel"); } - public void show() { - this.setVisible(true); - } - - public void hide() { - this.setVisible(false); - } - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/UserLiveSearchPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/UserLiveSearchPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/ui/UserLiveSearchPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,12 +20,13 @@ package org.ourproject.kune.workspace.client.socialnet.ui; import org.ourproject.kune.platf.client.AbstractPresenter; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.socialnet.EntityLiveSearchView; public class UserLiveSearchPanel extends EntityLiveSearchPanel { - public UserLiveSearchPanel(final AbstractPresenter presenter) { - super(presenter, EntityLiveSearchView.SEARCH_USERS); + public UserLiveSearchPanel(final AbstractPresenter presenter, final I18nTranslationService i18n) { + super(presenter, EntityLiveSearchView.SEARCH_USERS, i18n); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/tags/ui/TagsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/tags/ui/TagsPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/tags/ui/TagsPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -24,7 +24,7 @@ import java.util.List; import org.ourproject.kune.platf.client.dto.TagResultDTO; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.DropDownPanel; import org.ourproject.kune.platf.client.ui.KuneUiUtils; import org.ourproject.kune.workspace.client.tags.TagsPresenter; @@ -41,10 +41,12 @@ private final FlowPanel flowPanel; private final TagsPresenter presenter; private final Label noTagsLabel; + private final I18nTranslationService i18n; - public TagsPanel(final TagsPresenter presenter) { - super(Kune.I18N.t("Tags"), true); - setHeaderTitle(Kune.I18N.t("Keywords or terms associated with this group")); + public TagsPanel(final TagsPresenter presenter, final I18nTranslationService i18n) { + super(i18n.t("Tags"), true); + this.i18n = i18n; + setHeaderTitle(i18n.t("Keywords or terms associated with this group")); this.presenter = presenter; addStyleName("kune-Margin-Medium-t"); flowPanel = new FlowPanel(); @@ -53,7 +55,7 @@ vp.setWidth("100%"); vp.setCellWidth(flowPanel, "100%"); super.setContent(vp); - noTagsLabel = new Label(Kune.I18N.t("The contents of this group don't have any tag")); + noTagsLabel = new Label(i18n.t("The contents of this group don't have any tag")); } public void setTags(final List<TagResultDTO> groupTags) { @@ -66,9 +68,9 @@ Label label = new Label(tagResult.getName()); // i18n pluralization if (tagResult.getCount().intValue() > 1) { - KuneUiUtils.setQuickTip(label, Kune.I18N.t("[%d] items with this tag", tagResult.getCount())); + KuneUiUtils.setQuickTip(label, i18n.t("[%d] items with this tag", tagResult.getCount())); } else { - KuneUiUtils.setQuickTip(label, Kune.I18N.t("[%d] item with this tag", tagResult.getCount())); + KuneUiUtils.setQuickTip(label, i18n.t("[%d] item with this tag", tagResult.getCount())); } label.addClickListener(new ClickListener() { public void onClick(final Widget sender) { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/theme/ui/ThemeMenuPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/theme/ui/ThemeMenuPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/theme/ui/ThemeMenuPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -21,8 +21,8 @@ package org.ourproject.kune.workspace.client.theme.ui; import org.ourproject.kune.platf.client.services.ColorTheme; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.BottomTrayIcon; import org.ourproject.kune.workspace.client.theme.ThemeMenuPresenter; import org.ourproject.kune.workspace.client.theme.ThemeMenuView; @@ -34,10 +34,13 @@ private final MenuBar themesMB; private final ThemeMenuPresenter presenter; + private final ColorTheme colorTheme; - public ThemeMenuPanel(final ThemeMenuPresenter presenter) { - super(Kune.I18N.t("Select Workspace theme for this group")); + public ThemeMenuPanel(final ThemeMenuPresenter presenter, final I18nTranslationService i18n, + final ColorTheme colorTheme) { + super(i18n.t("Select Workspace theme for this group")); this.presenter = presenter; + this.colorTheme = colorTheme; themesMB = new MenuBar(true); themesMB.addStyleDependentName("bottomMenu"); this.addItem(Images.App.getInstance().themeChoose().getHTML(), true, themesMB); @@ -46,7 +49,6 @@ public void setThemes(final String[] themes) { for (int i = 0; i < themes.length; i++) { final String theme = themes[i]; - final ColorTheme colorTheme = Kune.getInstance().theme; colorTheme.setTheme(theme); String themeName = colorTheme.getThemeName(); String mainColor = colorTheme.getContentMainBorder(); Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/admin/AccessListsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/admin/AccessListsPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/admin/AccessListsPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -25,8 +25,8 @@ import org.ourproject.kune.platf.client.dto.AccessListsDTO; import org.ourproject.kune.platf.client.dto.GroupDTO; import org.ourproject.kune.platf.client.dto.GroupListDTO; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.IconLabel; import com.google.gwt.user.client.ui.Label; @@ -38,13 +38,15 @@ private final VerticalPanel adminsVP; private final VerticalPanel editorsVP; private final VerticalPanel viewersVP; + private final I18nTranslationService i18n; - public AccessListsPanel() { - final Label adminsLabel = new Label(Kune.I18N.t("Who can admin this:")); + public AccessListsPanel(final I18nTranslationService i18n) { + this.i18n = i18n; + final Label adminsLabel = new Label(i18n.t("Who can admin this:")); adminsVP = new VerticalPanel(); - final Label editorsLabel = new Label(Kune.I18N.t("Who more can edit:")); + final Label editorsLabel = new Label(i18n.t("Who more can edit:")); editorsVP = new VerticalPanel(); - final Label viewersLabel = new Label(Kune.I18N.t("Who more can view:")); + final Label viewersLabel = new Label(i18n.t("Who more can view:")); viewersVP = new VerticalPanel(); // Layout @@ -83,9 +85,9 @@ private void setGroupList(final GroupListDTO groupList, final VerticalPanel groupVP) { groupVP.clear(); if (groupList.getMode() == GroupListDTO.EVERYONE) { - groupVP.add(new IconLabel(img.everybody(), Kune.I18N.t("Everybody"))); + groupVP.add(new IconLabel(img.everybody(), i18n.t("Everybody"))); } else if (groupList.getMode() == GroupListDTO.NOBODY) { - groupVP.add(new IconLabel(img.nobody(), Kune.I18N.t("Nobody"))); + groupVP.add(new IconLabel(img.nobody(), i18n.t("Nobody"))); } else { final Iterator<GroupDTO> iter = groupList.getList().iterator(); while (iter.hasNext()) { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -21,8 +21,8 @@ package org.ourproject.kune.workspace.client.ui.ctx.items; import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.ui.HorizontalLine; import org.ourproject.kune.platf.client.ui.IconLabel; @@ -41,10 +41,12 @@ private final ContextItemsPresenter presenter; private String currentEventName; private String workaroundTypeName; + private final I18nTranslationService i18n; - public ContextItemsPanel(final ContextItemsPresenter presenter) { + public ContextItemsPanel(final ContextItemsPresenter presenter, final I18nTranslationService i18n) { this.presenter = presenter; - topBar = new ContextTopBar(presenter); + this.i18n = i18n; + topBar = new ContextTopBar(presenter, i18n); addTopBar(topBar); items = new ItemsPanel(presenter); @@ -66,21 +68,42 @@ horizontalLine.setWidth("100%"); } - private void addTopBar(final Widget widget) { - add(topBar, DockPanel.NORTH); + public void addCommand(final String typeName, final String label, final String eventName) { + final String type = typeName; + IconLabel iconLabel = new IconLabel(Images.App.getInstance().addGreen(), label); + iconLabel.addClickListener(new ClickListener() { + public void onClick(final Widget sender) { + currentEventName = eventName; + presenter.onNew(type); + } + }); + iconLabel.addStyleName("kune-ContextItemsPanel-LabelLink"); + controls.add(iconLabel); } public void addItem(final String name, final String type, final String event, final boolean editable) { items.add(name, type, event, editable); } + public void clear() { + items.clear(); + } + + public void registerType(final String typeName, final AbstractImagePrototype image) { + items.registerType(typeName, image); + } + public void selectItem(final int index) { } - public void clear() { - items.clear(); + public void setAbsolutePath(final ContainerSimpleDTO[] absolutePath) { + topBar.setAbsolutePath(absolutePath); } + public void setControlsVisible(final boolean visible) { + controls.setVisible(visible); + } + public void setCurrentName(final String name) { topBar.currentFolder.setText(name); } @@ -94,27 +117,6 @@ topBar.firstRow.setVisible(visible); } - public void setControlsVisible(final boolean visible) { - controls.setVisible(visible); - } - - public void registerType(final String typeName, final AbstractImagePrototype image) { - items.registerType(typeName, image); - } - - public void addCommand(final String typeName, final String label, final String eventName) { - final String type = typeName; - IconLabel iconLabel = new IconLabel(Images.App.getInstance().addGreen(), label); - iconLabel.addClickListener(new ClickListener() { - public void onClick(final Widget sender) { - currentEventName = eventName; - presenter.onNew(type); - } - }); - iconLabel.addStyleName("kune-ContextItemsPanel-LabelLink"); - controls.add(iconLabel); - } - public void showCreationField(final String typeName) { String title; // Workaround: gwt-ext bug, I cannot use typeName directly @@ -122,22 +124,22 @@ // FIXME use constants!!!! if (typeName.equals("docs.doc")) { - title = Kune.I18N.t("Add a document"); + title = i18n.t("Add a document"); } else if (typeName.equals("docs.folder")) { - title = Kune.I18N.t("Add a folder"); + title = i18n.t("Add a folder"); } else if (typeName.equals("chat.room")) { - title = Kune.I18N.t("Add a chat room"); + title = i18n.t("Add a chat room"); } else { - title = Kune.I18N.t("Add a new [%s]", typeName); + title = i18n.t("Add a new [%s]", typeName); } - MessageBox.prompt(title, Kune.I18N.t("Please enter a name:"), new MessageBox.PromptCallback() { + MessageBox.prompt(title, i18n.t("Please enter a name:"), new MessageBox.PromptCallback() { public void execute(final String btnID, final String text) { presenter.create(workaroundTypeName, text, currentEventName); } }); } - public void setAbsolutePath(final ContainerSimpleDTO[] absolutePath) { - topBar.setAbsolutePath(absolutePath); + private void addTopBar(final Widget widget) { + add(topBar, DockPanel.NORTH); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextItemsPresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -32,7 +32,7 @@ import org.ourproject.kune.platf.client.dto.StateToken; import org.ourproject.kune.platf.client.rpc.AsyncCallbackSimple; import org.ourproject.kune.platf.client.rpc.ParamCallback; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.WorkspaceEvents; import org.ourproject.kune.workspace.client.sitebar.Site; @@ -40,86 +40,88 @@ public class ContextItemsPresenter implements ContextItems { protected ContextItemsView view; + private final I18nTranslationService i18n; - public ContextItemsPresenter() { + public ContextItemsPresenter(final I18nTranslationService i18n) { + this.i18n = i18n; } public void canCreate(final String typeName, final String label, final String eventName) { - view.addCommand(typeName, label, eventName); + view.addCommand(typeName, label, eventName); } public void create(final String typeName, final String value, final String eventName) { - if (value != null) { - final Dispatcher dispatcher = DefaultDispatcher.getInstance(); - dispatcher.fire(eventName, value); - } + if (value != null) { + final Dispatcher dispatcher = DefaultDispatcher.getInstance(); + dispatcher.fire(eventName, value); + } } public View getView() { - return view; + return view; } public void init(final ContextItemsView view) { - this.view = view; + this.view = view; } public void onGoUp() { - DefaultDispatcher.getInstance().fire(DocsEvents.GO_PARENT_FOLDER, null); + DefaultDispatcher.getInstance().fire(DocsEvents.GO_PARENT_FOLDER, null); } public void onNew(final String typeName) { - view.showCreationField(typeName); + view.showCreationField(typeName); } public void onTitleRename(final String text, final String token) { - Site.showProgressSaving(); - DefaultDispatcher.getInstance().fire(DocsEvents.RENAME_CONTENT, - new ParamCallback<String, Object>(text, new AsyncCallbackSimple<Object>() { - public void onSuccess(final Object result) { - DefaultDispatcher.getInstance().fire(WorkspaceEvents.RELOAD_CONTEXT, null); - Site.hideProgress(); - } - })); + Site.showProgressSaving(); + DefaultDispatcher.getInstance().fire(DocsEvents.RENAME_CONTENT, + new ParamCallback<String, Object>(text, new AsyncCallbackSimple<Object>() { + public void onSuccess(final Object result) { + DefaultDispatcher.getInstance().fire(WorkspaceEvents.RELOAD_CONTEXT, null); + Site.hideProgress(); + } + })); } public void registerType(final String typeName, final AbstractImagePrototype image) { - view.registerType(typeName, image); + view.registerType(typeName, image); } public void setControlsVisible(final boolean visible) { - view.setControlsVisible(visible); + view.setControlsVisible(visible); } public void setParentTreeVisible(final boolean visible) { - view.setParentTreeVisible(visible); + view.setParentTreeVisible(visible); } public void showContainer(final StateToken state, final ContainerDTO container, final AccessRightsDTO rights) { - state.setDocument(null); - if (container.getParentFolderId() == null) { - // We translate root folder names (documents, chat room, - // etcetera) - view.setCurrentName(Kune.I18N.t(container.getName())); - } else { - view.setCurrentName(container.getName()); - } - view.clear(); - final List<ContainerDTO> folders = container.getChilds(); - for (int index = 0; index < folders.size(); index++) { - final ContainerDTO child = folders.get(index); - state.setFolder(child.getId().toString()); - view.addItem(child.getName(), child.getTypeId(), state.getEncoded(), rights.isEditable()); - } + state.setDocument(null); + if (container.getParentFolderId() == null) { + // We translate root folder names (documents, chat room, + // etcetera) + view.setCurrentName(i18n.t(container.getName())); + } else { + view.setCurrentName(container.getName()); + } + view.clear(); + final List<ContainerDTO> folders = container.getChilds(); + for (int index = 0; index < folders.size(); index++) { + final ContainerDTO child = folders.get(index); + state.setFolder(child.getId().toString()); + view.addItem(child.getName(), child.getTypeId(), state.getEncoded(), rights.isEditable()); + } - state.setFolder(container.getId().toString()); - final List<ContentDTO> contents = container.getContents(); - for (int index = 0; index < contents.size(); index++) { - final ContentDTO dto = contents.get(index); - state.setDocument(dto.getId().toString()); - view.addItem(dto.getTitle(), dto.getTypeId(), state.getEncoded(), rights.isEditable()); - } - view.setParentButtonEnabled(container.getParentFolderId() != null); - view.setControlsVisible(rights.isEditable()); - view.setAbsolutePath(container.getAbsolutePath()); + state.setFolder(container.getId().toString()); + final List<ContentDTO> contents = container.getContents(); + for (int index = 0; index < contents.size(); index++) { + final ContentDTO dto = contents.get(index); + state.setDocument(dto.getId().toString()); + view.addItem(dto.getTitle(), dto.getTypeId(), state.getEncoded(), rights.isEditable()); + } + view.setParentButtonEnabled(container.getParentFolderId() != null); + view.setControlsVisible(rights.isEditable()); + view.setAbsolutePath(container.getAbsolutePath()); } } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/ui/ctx/items/ContextTopBar.java 2008-06-01 14:44:36 UTC (rev 772) @@ -23,7 +23,7 @@ import org.ourproject.kune.platf.client.PlatformEvents; import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher; import org.ourproject.kune.platf.client.dto.ContainerSimpleDTO; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.KuneUiUtils; import org.ourproject.kune.platf.client.ui.RoundedBorderDecorator; @@ -45,8 +45,10 @@ public final HorizontalPanel firstRow; private final ContextItemsImages img; private final MenuBar pathSubmenu; + private final I18nTranslationService i18n; - public ContextTopBar(final ContextItemsPresenter presenter) { + public ContextTopBar(final ContextItemsPresenter presenter, final I18nTranslationService i18n) { + this.i18n = i18n; img = ContextItemsImages.App.getInstance(); firstRow = new HorizontalPanel(); final HorizontalPanel secondRow = new HorizontalPanel(); @@ -59,7 +61,7 @@ } }); - KuneUiUtils.setQuickTip(btnGoParent, Kune.I18N.t("Go to parent folder")); + KuneUiUtils.setQuickTip(btnGoParent, i18n.t("Go to parent folder")); btnGoParentDisabled = img.folderGoUpLight().createImage(); final MenuBar pathMenu = new MenuBar(); pathSubmenu = new MenuBar(true); @@ -73,7 +75,7 @@ RoundedBorderDecorator.SIMPLE); iconBarHP.add(buttonRounded); pathMenu.addItem(img.folderpathmenu().getHTML(), true, pathSubmenu); - KuneUiUtils.setQuickTip(pathMenu, Kune.I18N.t("Navigation tree")); + KuneUiUtils.setQuickTip(pathMenu, i18n.t("Navigation tree")); currentFolderHP.add(btnGoParent); currentFolderHP.add(btnGoParentDisabled); currentFolder = new Label("Current Container"); @@ -105,7 +107,7 @@ String folderName = folder.getName(); if (i == 0) { // We translate root folders - folderName = Kune.I18N.t(folderName); + folderName = i18n.t(folderName); } pathSubmenu.addItem(indent + img.folder().getHTML() + " " + folderName, true, new Command() { public void execute() { Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ContentSubTitlePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ContentSubTitlePresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ContentSubTitlePresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -22,21 +22,33 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.dto.StateDTO; -import org.ourproject.kune.platf.client.dto.UserSimpleDTO; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; public class ContentSubTitlePresenter implements ContentSubTitleComponent { private ContentSubTitleView view; + private final I18nTranslationService i18n; + public ContentSubTitlePresenter(final I18nTranslationService i18n) { + this.i18n = i18n; + } + + public View getView() { + return view; + } + public void init(final ContentSubTitleView view) { this.view = view; } + public void setContentLanguage(final String langName) { + view.setContentSubTitleRight(i18n.t("Language: [%s]", langName)); + } + public void setState(final StateDTO state) { if (state.hasDocument()) { - view.setContentSubTitleLeft(Kune.I18N.tWithNT("by: [%s]", "used in a list of authors", - ((UserSimpleDTO) state.getAuthors().get(0)).getName())); + view.setContentSubTitleLeft(i18n.tWithNT("by: [%s]", "used in a list of authors", state.getAuthors().get(0) + .getName())); view.setContentSubTitleLeftVisible(true); } else { view.setContentSubTitleLeftVisible(false); @@ -50,12 +62,4 @@ } } - public void setContentLanguage(final String langName) { - view.setContentSubTitleRight(Kune.I18N.t("Language: [%s]", langName)); - } - - public View getView() { - return view; - } - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ContentTitlePresenter.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ContentTitlePresenter.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ContentTitlePresenter.java 2008-06-01 14:44:36 UTC (rev 772) @@ -27,7 +27,7 @@ import org.ourproject.kune.platf.client.dispatch.DefaultDispatcher; import org.ourproject.kune.platf.client.dto.StateDTO; import org.ourproject.kune.platf.client.rpc.ParamCallback; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.KuneErrorHandler; import org.ourproject.kune.workspace.client.WorkspaceEvents; import org.ourproject.kune.workspace.client.sitebar.Site; @@ -38,11 +38,45 @@ public class ContentTitlePresenter implements ContentTitleComponent { private ContentTitleView view; + private final I18nTranslationService i18n; + private final KuneErrorHandler errorHandler; + public ContentTitlePresenter(final I18nTranslationService i18n, final KuneErrorHandler errorHandler) { + this.i18n = i18n; + this.errorHandler = errorHandler; + } + + public View getView() { + return view; + } + public void init(final ContentTitleView view) { this.view = view; } + public void onTitleRename(final String text) { + Site.showProgressSaving(); + AsyncCallback<String> callback = new AsyncCallback<String>() { + public void onFailure(final Throwable caught) { + view.restoreOldTitle(); + errorHandler.process(caught); + } + + public void onSuccess(final String result) { + Site.hideProgress(); + view.setContentTitle(result); + DefaultDispatcher.getInstance().fire(WorkspaceEvents.RELOAD_CONTEXT, null); + } + }; + DefaultDispatcher.getInstance().fire(DocsEvents.RENAME_CONTENT, + new ParamCallback<String, String>(text, callback)); + } + + public void setContentDate(final Date publishedOn) { + DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy, Z"); + view.setContentDate(i18n.t("Published on: [%s]", fmt.format(publishedOn))); + } + public void setState(final StateDTO state) { if (state.hasDocument()) { setContentTitle(state.getTitle(), state.getContentRights().isEditable()); @@ -52,7 +86,7 @@ if (state.getFolder().getParentFolderId() == null) { // We translate root folder names (documents, chat room, // etcetera) - setContentTitle(Kune.I18N.t(state.getTitle()), false); + setContentTitle(i18n.t(state.getTitle()), false); } else { setContentTitle(state.getTitle(), state.getContentRights().isEditable()); } @@ -60,9 +94,8 @@ } } - public void setContentDate(final Date publishedOn) { - DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy, Z"); - view.setContentDate(Kune.I18N.t("Published on: [%s]", fmt.format(publishedOn))); + private void setContentDateVisible(final boolean visible) { + view.setDateVisible(visible); } private void setContentTitle(final String title, final boolean editable) { @@ -70,30 +103,4 @@ view.setContentTitleEditable(editable); } - private void setContentDateVisible(final boolean visible) { - view.setDateVisible(visible); - } - - public View getView() { - return view; - } - - public void onTitleRename(final String text) { - Site.showProgressSaving(); - AsyncCallback<String> callback = new AsyncCallback<String>() { - public void onFailure(final Throwable caught) { - view.restoreOldTitle(); - KuneErrorHandler.getInstance().process(caught); - } - - public void onSuccess(final String result) { - Site.hideProgress(); - view.setContentTitle(result); - DefaultDispatcher.getInstance().fire(WorkspaceEvents.RELOAD_CONTEXT, null); - } - }; - DefaultDispatcher.getInstance().fire(DocsEvents.RENAME_CONTENT, - new ParamCallback<String, String>(text, callback)); - } - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentBottomToolBarPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentBottomToolBarPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentBottomToolBarPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,6 +20,7 @@ package org.ourproject.kune.workspace.client.workspace.ui; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.ui.CustomPushButton; import org.ourproject.kune.platf.client.ui.rate.RateItPanel; import org.ourproject.kune.platf.client.ui.rate.RateItPresenter; @@ -39,10 +40,10 @@ private final RateItPanel rateIt; private CustomPushButton btn; - public ContentBottomToolBarPanel(final ContentBottomToolBarPresenter presenter) { - rate = new RatePanel(null, null); - rateItPresenter = new RateItPresenter(); - rateIt = new RateItPanel(rateItPresenter); + public ContentBottomToolBarPanel(final ContentBottomToolBarPresenter presenter, final I18nTranslationService i18n) { + rate = new RatePanel(null, null, i18n); + rateItPresenter = new RateItPresenter(i18n); + rateIt = new RateItPanel(rateItPresenter, i18n); rateItPresenter.init(rateIt); Label expand = new Label(""); this.add(rateIt); @@ -60,6 +61,16 @@ // TODO setEnabled false to RateIt } + public void addButton(final String caption, final ClickListener listener) { + btn = new CustomPushButton(caption, listener); + this.insert(btn, 0); + btn.addStyleName("kune-Button-Large-lrSpace"); + } + + public void setButtonVisible(final boolean isEnabled) { + btn.setVisible(isEnabled); + } + public void setRate(final Double value, final Integer rateByUsers) { rate.setRate(value); rate.setByUsers(rateByUsers); @@ -69,22 +80,12 @@ rateItPresenter.setRate(currentUserRate); } - public void setRateVisible(final boolean visible) { - rate.setVisible(visible); - } - public void setRateItVisible(final boolean visible) { rateIt.setVisible(visible); } - public void addButton(final String caption, final ClickListener listener) { - btn = new CustomPushButton(caption, listener); - this.insert(btn, 0); - btn.addStyleName("kune-Button-Large-lrSpace"); + public void setRateVisible(final boolean visible) { + rate.setVisible(visible); } - public void setButtonVisible(final boolean isEnabled) { - btn.setVisible(isEnabled); - } - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentSubTitlePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentSubTitlePanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/ContentSubTitlePanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.workspace.ui; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.workspace.client.workspace.ContentSubTitlePresenter; import org.ourproject.kune.workspace.client.workspace.ContentSubTitleView; @@ -33,7 +33,7 @@ private final Label subTitleLeftLabel; private final Label subTitleRightLabel; - public ContentSubTitlePanel(final ContentSubTitlePresenter presenter) { + public ContentSubTitlePanel(final ContentSubTitlePresenter presenter, final I18nTranslationService i18n) { subTitleLeftLabel = new Label(); HorizontalPanel rigthHP = new HorizontalPanel(); @@ -44,7 +44,7 @@ rigthHP.add(subTitleRightLabel); setWidth("100%"); - subTitleRightLabel.setText(Kune.I18N.t("Language:")); + subTitleRightLabel.setText(i18n.t("Language:")); subTitleLeftLabel.addStyleName("kune-Margin-Large-l"); subTitleLeftLabel.addStyleName("kune-ft15px"); subTitleLeftLabel.addStyleName("kune-ContentSubTitleBar-l"); @@ -56,6 +56,12 @@ rigthHP.setCellVerticalAlignment(subTitleRightLabel, VerticalPanel.ALIGN_MIDDLE); } + public void setColors(final String background, final String textColor) { + DOM.setStyleAttribute(this.getElement(), "backgroundColor", background); + DOM.setStyleAttribute(subTitleLeftLabel.getElement(), "color", textColor); + DOM.setStyleAttribute(subTitleRightLabel.getElement(), "color", textColor); + } + public void setContentSubTitleLeft(final String subTitle) { subTitleLeftLabel.setText(subTitle); } @@ -73,10 +79,4 @@ subTitleRightLabel.setVisible(visible); } - public void setColors(final String background, final String textColor) { - DOM.setStyleAttribute(this.getElement(), "backgroundColor", background); - DOM.setStyleAttribute(subTitleLeftLabel.getElement(), "color", textColor); - DOM.setStyleAttribute(subTitleRightLabel.getElement(), "color", textColor); - } - } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/GroupLogoPanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/GroupLogoPanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/GroupLogoPanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -20,7 +20,7 @@ package org.ourproject.kune.workspace.client.workspace.ui; -import org.ourproject.kune.platf.client.services.Kune; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.HTML; @@ -32,33 +32,6 @@ import com.google.gwt.user.client.ui.VerticalPanel; class GroupLogoPanel extends SimplePanel { - private EntityTextLogo entityTextLogo; - - public GroupLogoPanel() { - } - - private EntityTextLogo getEntityTextLogo() { - if (entityTextLogo == null) { - this.entityTextLogo = new EntityTextLogo(); - } - return entityTextLogo; - } - - public void setLogo(final String groupName) { - clear(); - add(getEntityTextLogo()); - entityTextLogo.setDefaultText(groupName); - } - - public void setLogo(final Image image) { - clear(); - add(image); - } - - public void setTextColor(final String color) { - this.entityTextLogo.setTextColor(color); - } - class EntityTextLogo extends VerticalPanel { private static final int GROUP_NAME_LIMIT_SIZE = 90; @@ -84,7 +57,7 @@ // Set properties // TODO: Put your logo here functionality - defTextPutYourLogoHL.setText(Kune.I18N.t("Put Your Logo Here")); + defTextPutYourLogoHL.setText(i18n.t("Put Your Logo Here")); expandCell.setWidth("100%"); putYourLogoHP.setCellWidth(expandCell, "100%"); // TODO: link to configure the logo @@ -102,19 +75,48 @@ } + public void setPutYourLogoVisible(final boolean visible) { + putYourLogoHP.setVisible(visible); + + } + public void setTextColor(final String color) { DOM.setStyleAttribute(defTextLogoLabel.getElement(), "color", color); } + } - public void setPutYourLogoVisible(final boolean visible) { - putYourLogoHP.setVisible(visible); + private EntityTextLogo entityTextLogo; + private final I18nTranslationService i18n; - } + public GroupLogoPanel(final I18nTranslationService i18n) { + this.i18n = i18n; } + public void setLogo(final Image image) { + clear(); + add(image); + } + + public void setLogo(final String groupName) { + clear(); + add(getEntityTextLogo()); + entityTextLogo.setDefaultText(groupName); + } + public void setPutYourLogoVisible(final boolean visible) { entityTextLogo.setPutYourLogoVisible(visible); } + public void setTextColor(final String color) { + this.entityTextLogo.setTextColor(color); + } + + private EntityTextLogo getEntityTextLogo() { + if (entityTextLogo == null) { + this.entityTextLogo = new EntityTextLogo(); + } + return entityTextLogo; + } + } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/GroupToolsBar.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/GroupToolsBar.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/GroupToolsBar.java 2008-06-01 14:44:36 UTC (rev 772) @@ -23,7 +23,6 @@ import java.util.Iterator; import org.ourproject.kune.platf.client.services.ColorTheme; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.tool.ToolTrigger; import org.ourproject.kune.platf.client.tool.ToolTrigger.TriggerListener; import org.ourproject.kune.platf.client.ui.HasColor; @@ -39,8 +38,10 @@ private static final String ITEM_NOT_SELECTED = "kune-GroupToolsBar-itemNotSelected"; private Widget currentTab; private final HashMap<String, Widget> tabs; + private final ColorTheme colorTheme; - public GroupToolsBar() { + public GroupToolsBar(final ColorTheme colorTheme) { + this.colorTheme = colorTheme; tabs = new HashMap<String, Widget>(); currentTab = null; addStyleName("kune-GroupToolsBar"); @@ -54,19 +55,6 @@ this.add(menuItem); } - private Widget createItem(final int index, final ToolTrigger trigger) { - final SimplePanel menuItem = new SimplePanel(); - addStyleName("Tab"); - final Hyperlink hl = new Hyperlink(trigger.getLabel(), ""); - trigger.setListener(new TriggerListener() { - public void onStateChanged(final String encoded) { - hl.setTargetHistoryToken(encoded); - } - }); - menuItem.add(hl); - return new RoundedBorderDecorator(menuItem, RoundedBorderDecorator.RIGHT); - } - public void selectItem(final String toolName) { if (currentTab != null) { setTabSelected(currentTab, false); @@ -87,12 +75,24 @@ } } + private Widget createItem(final int index, final ToolTrigger trigger) { + final SimplePanel menuItem = new SimplePanel(); + addStyleName("Tab"); + final Hyperlink hl = new Hyperlink(trigger.getLabel(), ""); + trigger.setListener(new TriggerListener() { + public void onStateChanged(final String encoded) { + hl.setTargetHistoryToken(encoded); + } + }); + menuItem.add(hl); + return new RoundedBorderDecorator(menuItem, RoundedBorderDecorator.RIGHT); + } + private Widget getWidget(final String toolName) { return tabs.get(toolName); } private void setTabSelected(final Widget tab, final boolean isSelected) { - ColorTheme theme = Kune.getInstance().theme; if (isSelected) { tab.removeStyleName(ITEM_NOT_SELECTED); tab.addStyleName(ITEM_SELECTED); @@ -100,7 +100,7 @@ tab.removeStyleName(ITEM_SELECTED); tab.addStyleName(ITEM_NOT_SELECTED); } - String color = isSelected ? theme.getToolSelected() : theme.getToolUnselected(); + String color = isSelected ? colorTheme.getToolSelected() : colorTheme.getToolUnselected(); ((HasColor) tab).setColor(color); } Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java =================================================================== --- trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/main/java/org/ourproject/kune/workspace/client/workspace/ui/WorkspacePanel.java 2008-06-01 14:44:36 UTC (rev 772) @@ -23,8 +23,8 @@ import org.ourproject.kune.platf.client.View; import org.ourproject.kune.platf.client.extend.ExtensibleWidgetId; import org.ourproject.kune.platf.client.services.ColorTheme; +import org.ourproject.kune.platf.client.services.I18nTranslationService; import org.ourproject.kune.platf.client.services.Images; -import org.ourproject.kune.platf.client.services.Kune; import org.ourproject.kune.platf.client.tool.ToolTrigger; import org.ourproject.kune.platf.client.ui.DropDownPanel; import org.ourproject.kune.platf.client.ui.RoundedBorderDecorator; @@ -67,7 +67,7 @@ private DropDownPanel groupSummaryPanel; private final VerticalPanel cntcxtVP; private final ScrollPanel groupDropDownsSP; - private final ColorTheme th; + private final ColorTheme colorTheme; private final BottomIconsTrayPanel bottomIconsTrayPanel; private ContentTitlePanel contentTitlePanel; private ContentSubTitlePanel contentSubTitlePanel; @@ -82,17 +82,18 @@ private int previousRightWidgetWidth; private final WorkspacePresenter presenter; - public WorkspacePanel(final WorkspacePresenter presenter) { + public WorkspacePanel(final WorkspacePresenter presenter, final I18nTranslationService i18n, + final ColorTheme colorTheme) { this.presenter = presenter; - th = Kune.getInstance().theme; + this.colorTheme = colorTheme; // Initialize final VerticalPanel generalVP = new VerticalPanel(); initWidget(generalVP); - groupLogoPanel = new GroupLogoPanel(); + groupLogoPanel = new GroupLogoPanel(i18n); final HorizontalPanel generalHP = new HorizontalPanel(); cntcxtVP = new VerticalPanel(); final VerticalPanel groupNavBarVP = new VerticalPanel(); - groupToolsBar = new GroupToolsBar(); + groupToolsBar = new GroupToolsBar(colorTheme); bottomIconsTrayPanel = new BottomIconsTrayPanel(); groupDropDownsSP = new ScrollPanel(); groupDropDownsVP = new VerticalPanel(); @@ -156,7 +157,7 @@ addStyleName("kune-WorkspacePanel"); setGroupLogo(""); generalHP.addStyleName("GeneralHP"); - contentTitleBarBorderDec.setColor(th.getContentMainBorder()); + contentTitleBarBorderDec.setColor(colorTheme.getContentMainBorder()); contentTitleBarHP.setWidth("100%"); contentSubTitleBarHP.setWidth("100%"); contentTitleBarHP.addStyleName("kune-ContentTitleBar"); @@ -172,7 +173,7 @@ contentBottomBarHP.addStyleName("kune-ContentBottomBar"); contentBottomBarHP.addStyleName("kune-ft12px"); groupDropDownsVP.addStyleName("kune-GroupSummaryPanel"); - bottomBorderDecorator.setColor(th.getContentMainBorder()); + bottomBorderDecorator.setColor(colorTheme.getContentMainBorder()); bottomIconsTrayPanel.addStyleName("kune-Margin-Medium-l"); bottomIconsTrayPanel.addStyleName("kune-BottomIconsTrayPanel"); bottomIconsTrayPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER); @@ -285,12 +286,12 @@ public void setGroupMembers(final View view) { groupMembersPanel = (DropDownPanel) view; - AddDropDown(groupMembersPanel, th.getGroupMembersDD()); + AddDropDown(groupMembersPanel, colorTheme.getGroupMembersDD()); } public void setParticipation(final View view) { participationPanel = (DropDownPanel) view; - AddDropDown(participationPanel, th.getParticipationDD()); + AddDropDown(participationPanel, colorTheme.getParticipationDD()); } public void setPutYourLogoVisible(final boolean visible) { @@ -299,36 +300,36 @@ public void setSummary(final View view) { groupSummaryPanel = (DropDownPanel) view; - AddDropDown(groupSummaryPanel, th.getSummaryDD()); + AddDropDown(groupSummaryPanel, colorTheme.getSummaryDD()); } public void setTags(final View view) { tagsPanel = (DropDownPanel) view; - AddDropDown(tagsPanel, th.getTagsDD()); + AddDropDown(tagsPanel, colorTheme.getTagsDD()); } public void setTheme(final String theme) { - th.setTheme(theme); - final String mainColor = th.getContentMainBorder(); - groupLogoPanel.setTextColor(th.getContentTitleText()); + colorTheme.setTheme(theme); + final String mainColor = colorTheme.getContentMainBorder(); + groupLogoPanel.setTextColor(colorTheme.getContentTitleText()); contentTitleBarBorderDec.setColor(mainColor); bottomBorderDecorator.setColor(mainColor); DOM.setStyleAttribute(cntcxtVP.getElement(), "borderRightColor", mainColor); - contentTitlePanel.setColors(th.getContentTitle(), th.getContentTitleText()); - contentSubTitlePanel.setColors(mainColor, th.getContentSubTitleText()); + contentTitlePanel.setColors(colorTheme.getContentTitle(), colorTheme.getContentTitleText()); + contentSubTitlePanel.setColors(mainColor, colorTheme.getContentSubTitleText()); DOM.setStyleAttribute(contentTitleBarHP.getElement(), "borderLeftColor", mainColor); - DOM.setStyleAttribute(contentTitleBarHP.getElement(), "backgroundColor", th.getContentTitle()); + DOM.setStyleAttribute(contentTitleBarHP.getElement(), "backgroundColor", colorTheme.getContentTitle()); DOM.setStyleAttribute(contentSubTitleBarHP.getElement(), "backgroundColor", mainColor); DOM.setStyleAttribute(contentBottomBarHP.getElement(), "backgroundColor", mainColor); - DOM.setStyleAttribute(cntcxtHSP.getRightWidget().getElement(), "backgroundColor", th.getContext()); - DOM.setStyleAttribute(DOM.getChild(DOM.getChild(cntcxtHSP.getElement(), 0), 1), "backgroundColor", th + DOM.setStyleAttribute(cntcxtHSP.getRightWidget().getElement(), "backgroundColor", colorTheme.getContext()); + DOM.setStyleAttribute(DOM.getChild(DOM.getChild(cntcxtHSP.getElement(), 0), 1), "backgroundColor", colorTheme .getSplitter()); - DOM.setStyleAttribute(contentBottomBarHP.getWidget(0).getElement(), "color", th.getContentBottomText()); - groupMembersPanel.setColor(th.getGroupMembersDD()); - participationPanel.setColor(th.getParticipationDD()); - groupSummaryPanel.setColor(th.getSummaryDD()); - tagsPanel.setColor(th.getTagsDD()); - groupToolsBar.setTabsColors(th.getToolSelected(), th.getToolUnselected()); + DOM.setStyleAttribute(contentBottomBarHP.getWidget(0).getElement(), "color", colorTheme.getContentBottomText()); + groupMembersPanel.setColor(colorTheme.getGroupMembersDD()); + participationPanel.setColor(colorTheme.getParticipationDD()); + groupSummaryPanel.setColor(colorTheme.getSummaryDD()); + tagsPanel.setColor(colorTheme.getTagsDD()); + groupToolsBar.setTabsColors(colorTheme.getToolSelected(), colorTheme.getToolUnselected()); } public void setTool(final String toolName) { Modified: trunk/src/test/java/org/ourproject/kune/sitebar/client/ui/LoginPresenterTest.java =================================================================== --- trunk/src/test/java/org/ourproject/kune/sitebar/client/ui/LoginPresenterTest.java 2008-06-01 04:01:10 UTC (rev 771) +++ trunk/src/test/java/org/ourproject/kune/sitebar/client/ui/LoginPresenterTest.java 2008-06-01 14:44:36 UTC (rev 772) @@ -3,6 +3,7 @@ import org.easymock.EasyMock; import org.junit.Before; import org.junit.Test; +import org.ourproject.kune.platf.client.services.I18nTranslationServiceMocked; import org.ourproject.kune.platf.client.state.SessionImpl; import org.ourproject.kune.workspace.client.sitebar.login.LoginListener; import org.ourproject.kune.workspace.client.sitebar.login.LoginPresenter; @@ -16,7 +17,7 @@ @Before public void createObjects() { listener = EasyMock.createStrictMock(LoginListener.class); - presenter = new LoginPresenter(new SessionImpl("foo", null), listener); + presenter = new LoginPresenter(new SessionImpl("foo", null), listener, new I18nTranslationServiceMocked()); view = EasyMock.createStrictMock(LoginView.class); }
participants (1)
-
vjrj